Skip to content

fix(quality): keep the gate verdict if the summary write fails - #237

Open
tbhb-agent wants to merge 3 commits into
mainfrom
agent/rules-mutation-summary
Open

tbhb-agent wants to merge 3 commits into
mainfrom
agent/rules-mutation-summary

Conversation

@tbhb-agent

Copy link
Copy Markdown
Contributor

Why

mutation_gate_test appends its timeout line to $GITHUB_STEP_SUMMARY. After #233, a summary path that failed to write ended the gate before its verdict. Bazel's test sandbox also dropped the variable, so the summary got nothing.

Behavior change

A failed write to the summary now prints mutation_gate: could not write to GITHUB_STEP_SUMMARY on stderr. The gate still prints its timeout line and survivor listing, and it exits with the verdict the report deserves.

mutation_gate_test now inherits GITHUB_STEP_SUMMARY from the environment. The timeout line lands in the job summary when CI sets the variable. The change also drops a comment that quoted one run's timeout figures.

Decisions

  • The rule returns RunEnvironmentInfo(inherited_environment = ...). env_inherit belongs to native test rules, and this rule is custom.
  • CI passes the variable through the rule, so the workflow doesn't change.
  • The failing-report test checks the stderr note, because that report fails the gate with or without the guard.

Risk

Low. The change touches the append and the environment list. Bazel keys the test's cache on the inherited value, so a new summary path reruns the gate test.

Verification

A scratch file as GITHUB_STEP_SUMMARY, one gate test, no --test_env: before the change the file was empty, and afterward it held mutation_gate: 5 timed out of 100 (5.0%), counted as killed.

With the stderr guard removed, both new tests fail. The passing-report test exits 1 instead of 0, and the failing-report test doesn't find the stderr note.

The tests cover a missing directory only, with no read-only file. CI doesn't show whether a gate inside a real job receives the variable.

Opened-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:debb814921f029ad;surface=cli
Generated-by: LLM effort=medium;harness=claude-code:2.1.318;model=anthropic:claude-sonnet-5-5;session=sha-256-64:f1227f050617f845;surface=sdk-cli
Assisted-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:debb814921f029ad;surface=cli

A GITHUB_STEP_SUMMARY that cannot be written no longer ends the gate under set -e before the verdict and survivor listing; it warns on stderr. The gate test rule now inherits GITHUB_STEP_SUMMARY, which Bazel's test sandbox otherwise drops, and the stale timeout figures leave the cap comment.

Generated-by: LLM effort=medium;harness=claude-code:2.1.318;model=anthropic:claude-sonnet-5-5;session=sha-256-64:f1227f050617f845;surface=sdk-cli
Generated-by: LLM effort=medium;harness=claude-code:2.1.318;model=anthropic:claude-sonnet-5-5;session=sha-256-64:f1227f050617f845;surface=sdk-cli
The summary warning's own write to stderr could end the gate before its verdict when stderr was closed. Ignore that failure, require the FAIL line in the failing summary test, say no mutant failed when none was checked, and reword the header.

Generated-by: LLM effort=medium;harness=claude-code:2.1.318;model=anthropic:claude-sonnet-5-5;session=sha-256-64:06dc52093e5d8aba;surface=sdk-cli
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