Repository navigation
Description
Found by the second cross-family review of #1371 and reproduced on that branch (Python 3.13.12, debugpy 1.8.20). The guide added by #1371 states the limit; this issue is the repair.
What happens
The Python logpoint check examines a message's % only when it knows how many values the template will be given. A starred group ({*items}) makes that number a value of the program, and the check then skips the template entirely, for the message as written and for its repair:
| Message | Verdict | Sent | At a hit, for items of any length |
|---|---|---|---|
{*items} 100% |
runs (the answer says nothing) |
as written | incomplete format (not enough arguments for format string when empty) |
100% total {*items} |
runs |
as written | unsupported format character 't' |
%(k)s {*items} {x} |
runs |
as written | format requires a mapping |
{x!r} {*items} 100% |
rewritten, percentDoubled: false |
{f'{x!r}'} {*items} 100% |
incomplete format |
None of the four can log its message for any values. Without the starred group each is caught: {x!r} 100% is sent as {f'{x!r}'} 100%%.
Before #1371 all four also failed at every hit, so nothing regressed. What is wrong is the answer: runs says nothing where every hit fails, and the last row reports a repair that does not run.
Why
cannot_runin the checker (packages/shared/src/interfaces/python-logpoint-check.ts) returns "can run" as soon as the tuple holds a starred element, before the template is bounded or formatted:The same call validates the repaired expression, so aif any(isinstance(e, ast.Starred) for e in t.right.elts): return None # how many elements there are is a value: left to the hit
%is never doubled there either.- The test's oracle has the same shortcut.
formats_with_onesintests/adapters/python/integration/logpoint-corpus/emulate.pyreturnsTruefor any starred tuple, and the emulation relabels every%failure on a starred tuple as a failure of the values. The property "a message answeredrunshas a template that formats" is therefore not checked for these messages, although the generated sets contain them (%(k)s {*items} {x}is in the multi-group set).
Expected
The number of values is unknown, but it is one unknown with a floor: any length from the count of unstarred elements up. A template can format for some values exactly when it formats for one of those lengths, and it consumes a fixed number of arguments, at most a small multiple of its % count. So the check can be exact: try the lengths from the floor up to that bound, answer "can run" on the first that formats, and otherwise report why none does. {*items} 100% then gets its % doubled like 100% {x} does, and %(k)s {*items} {x} is answered as failing.
The oracle must not share the rule: brute force over lengths in emulate.py, with the "values" label kept only for a template that formats for some length. The four messages above become rows.
The width limits (_bound_template) are skipped for a starred message for the same reason and should apply before any formatting.
Class: a test's oracle copies the shortcut of the code it judges, so the property is vacuous exactly where the code gives up. Path: edge (a starred group in a logpoint message is rare: debugpy gives it one %s, so it logs only when it yields exactly one value).
Activity
fix(python): a logpoint's message is checked by the program's own int…