Skip to content

fix(testkit): make 03_update Log calls alignment-safe#7

Merged
feliperun merged 1 commit into
mainfrom
fix/robot-log-alignment
Apr 17, 2026
Merged

fix(testkit): make 03_update Log calls alignment-safe#7
feliperun merged 1 commit into
mainfrom
fix/robot-log-alignment

Conversation

@feliperun
Copy link
Copy Markdown
Owner

Summary

The second log line in `Token Count Is Stable After Whitespace Edit`
visually aligned `after:` with `before: ` by inserting two spaces
between `after:` and the embedded variable. Robot Framework treats
two-or-more spaces as an argument separator, so the extra whitespace
flipped the statement from a single-message `Log` into a two-argument
call, handing the `count-tokens` stdout to the `level` slot (which
only accepts `TRACE/DEBUG/INFO/...`). That blew up the whole suite
for any agent whose corpus is large enough to produce a multi-line
report from `count-tokens` — i.e. every non-toy production agent.

Fix

Switch both log lines to `Log Many`, which takes N positional
arguments and is immune to alignment.

Test plan

  • Caught by running `expert test --suite 03_update` against
    a real 797k-token corpus (ecg-expert): 1 test failing with
    `ValueError: Argument 'level' got value '…' that cannot be
    converted to 'TRACE', 'DEBUG', 'INFO', 'CONSOLE', 'HTML',
    'WARN' or 'ERROR'`.
  • After the fix, same command reports 2/2 passed.
  • `ruff`, `mypy`, `pytest` still green.
  • No other suite in the packaged kit has the same pattern
    (grep `^\s*Log\s+.+\s{2,}\${` across `cli/expert/testkit/suites/`
    returned zero hits after the change).

Made with Cursor

The second log line in `Token Count Is Stable After Whitespace Edit`
visually aligned `after:` with `before: ` by inserting two spaces
between `after:` and the embedded variable. Robot Framework treats
two-or-more spaces as an argument separator, so the extra
whitespace flipped the statement from

    Log    "after:  ${after}[stdout]"   # single message

into

    Log    "after:"    "${after}[stdout]"   # message + level

and the embedded stdout (a rich count-tokens table) was handed to
the `level` slot, which only accepts TRACE/DEBUG/INFO/... That
blew up the whole suite for any agent whose corpus is non-trivial
enough for `count-tokens` to produce a multi-line report —
effectively every production agent.

Switch both log lines to `Log Many`, which takes N positional
arguments and is immune to how the caller lines them up. Verified
locally against ecg-expert (797k-token corpus): suite 03_update
now reports 2/2 passed.

No other test in the packaged kit has this alignment pattern.

Made-with: Cursor
@feliperun feliperun merged commit 55b6142 into main Apr 17, 2026
4 checks passed
@feliperun feliperun deleted the fix/robot-log-alignment branch April 17, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant