Skip to content

[fix] run-path correctness: Execute output-limit (P1-1) + per-run result reset (P1-2)#25

Merged
vt128 merged 1 commit into
masterfrom
fix/run-path-correctness
Jun 19, 2026
Merged

[fix] run-path correctness: Execute output-limit (P1-1) + per-run result reset (P1-2)#25
vt128 merged 1 commit into
masterfrom
fix/run-path-correctness

Conversation

@vt128

@vt128 vt128 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Release blockers P1-1 + P1-2 (independent review 2026-06-20)

Two run-path invariants violated on the builder / reuse paths. Both fixed test-first (each repro confirmed failing before the fix).

P1-1 — RunnerConfig.Execute() bypassed the output limit

Execute() returned the machine result directly, skipping applyOutputLimit, so SetMaxOutputEntries was silently ignored for the builder/thin-shell path (the one starcli is likely to use).
Fix: Execute() now returns b.applyOutputLimit(out, err), matching Run/RunFile/RunTimeout/RunInspect*.

P1-2 — output() slot was once-per-Box, not once-per-run

The result slot was cleared only at AddResultBuiltin time, so a second Run on the same Box failed with result already set once — contradicting the documented "second call within a run is an error."
Fix: a new markRun() helper — now the single place every run path bumps the run counter — resets the slot at each run start. A second output() within one run is still an error (TestResultOnce stays green).

Tests

  • TestRunnerConfig_OutputLimitExecute() honors the output-entry cap (OutputLimitExceededError).
  • TestResultResetPerRun — a reused Box runs repeatedly; GetResult reflects each run; a no-output run reports unset even after a prior set.

markRun/applyOutputLimit 100%; overall 99.3%. gofmt/vet clean, -race -count=2 and Docker golang:1.19 floor green.

…ult reset (P1-2)

Independent review (2026-06-20) found two run-path invariants that the
RunnerConfig and reuse paths violated:

- P1-1: RunnerConfig.Execute() returned the machine result directly,
  bypassing applyOutputLimit - so SetMaxOutputEntries was silently ignored
  for the builder/thin-shell path (the path starcli is likely to use). It
  now returns b.applyOutputLimit(out, err), matching Run/RunFile/RunTimeout.

- P1-2: the output() result slot was cleared only at AddResultBuiltin time,
  making it once-per-Box-lifetime instead of once-per-run as documented; a
  second Run on the same Box failed with "result already set once". A new
  markRun() helper (now the single place every run path bumps the counter)
  resets the slot at each run start. A second output() within one run is
  still an error (TestResultOnce).

Tests (test-first, both reproduced before the fix):
- TestRunnerConfig_OutputLimit: Execute() honors the output-entry cap.
- TestResultResetPerRun: Box runs repeatedly; GetResult reflects each run;
  a no-output run reports unset even after a prior set.
@codacy-production

codacy-production Bot commented Jun 19, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 9 complexity · 0 duplication

Metric Results
Complexity 9
Duplication 0

View in Codacy

🟢 Coverage 100.00% diff coverage · 0.00% coverage variation

Metric Results
Coverage variation 0.00% coverage variation (-1.00%)
Diff coverage 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (3098df0) 1155 1146 99.22%
Head commit (e7d6a5a) 1154 (-1) 1145 (-1) 99.22% (0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#25) 14 14 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.95%. Comparing base (3098df0) to head (e7d6a5a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #25      +/-   ##
==========================================
- Coverage   98.95%   98.95%   -0.01%     
==========================================
  Files          12       12              
  Lines         864      862       -2     
==========================================
- Hits          855      853       -2     
  Misses          5        5              
  Partials        4        4              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vt128 vt128 merged commit 9c74acf into master Jun 19, 2026
11 checks passed
@vt128 vt128 deleted the fix/run-path-correctness branch June 19, 2026 19:16
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