fix(review): six more — reporting honesty, surface parity, two vacuous tests - #35
Merged
Conversation
…s tests
1. report.html claimed "✓ code fix drafted" for a dependency upgrade.
The badge keyed on the mere PRESENCE of a remediation, so a
`dependency_upgrade` — where there is no file to patch and pr.py writes no
diff — claimed a drafted code fix, contradicting the hero on the same page.
Three outcomes now: upgrade (naming package and version), drafted code fix,
and "cure planned — no patch drafted" for a plan carrying neither a diff nor
patched_content.
2. The blast-radius table reported an unmeasured replay as safe.
`simulate` computes evaluated / errored / enforcement_confirmed / reason and
the table used NONE of them, so a replay in which every request failed in
transit (evaluated=0, errored=12, reason="nothing measurable") rendered as a
green "within threshold" at 0.0% — a rate that means "we measured nothing",
presented as "safe to promote". Now: not measured / unconfirmed / within
threshold / over threshold, with a caveats column carrying the reason.
3. reconcile reported a transport failure as "no runnable probe".
`{}` is what "no probe recorded" returns — a PERMANENT condition an operator
can only fix by re-scanning. A probe that exists and blew up in transport is
TRANSIENT. Reporting the second as the first sends someone to fix the wrong
thing. Now its own hold code, saying the next pass will retry.
4. MCP ignored VPCOPILOT_SIM_THRESHOLD.
The threshold was a lookup each surface had to REMEMBER. CLI, console and
refiner remembered; MCP did not — so an operator's tightened blast-radius
threshold was silently replaced by the default for every simulation an agent
ran. Now `simulate.effective_threshold`, one resolver all four call, and a
malformed value is REFUSED rather than silently defaulted: substituting the
default would apply a threshold the operator did not choose to the gate that
decides whether a policy is safe to promote.
5. test_safe_rollback_restores_and_verifies never tested "verifies".
FakeXC genuinely applies the PUT, so the restore succeeded on its own and
`verify` returned True whatever it did — delete the verify call from
safe_rollback and the test still passed. It was asserting the behaviour of
the fake. A new test uses an appliance that ACCEPTS the rollback PUT and
applies nothing (a 200 that changed nothing), which is what a partially
degraded control plane looks like, and asserts RollbackError plus the audit
record. Without it, safe_rollback reports a clean rollback while the band-aid
is still attached to a live LB — the "silent half-rollback" the module
docstring calls the worst outcome.
6. The four-place agent registration guard was a whole-file substring search.
It asserted `"resolve" in report.py`, which the unrelated word "resolved"
already satisfied — so it passed with the agent missing from the very list it
guarded. report.py now exposes REPORTED_AGENTS and the test asserts the LIST;
a second test asserts all four sites AGREE, which holds for the next agent
rather than for this one by name.
Also: tests/test_report.py's remediation fixture carried empty `diff` and
`patched_content`, so it was asserting the drafted-fix badge for a plan with no
patch. Given a real patch — an unrealistic fixture, not a behaviour change.
10 new tests; suite 1067 -> 1077. Mutation-verified: reverting the four source
fixes fails 7, and the two vacuous tests fail against the mutations they
previously survived. Live suite: 18 passed, estates restored (0 ASM policies,
Larkspur balance 48215, vpcopilot-lab at baseline).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sixth PR from the deep-dive review. 26 of 27 findings now closed.
Reporting honesty
1.
report.htmlclaimed "✓ code fix drafted" for a dependency upgrade. The badge keyed on the mere presence of a remediation. There is no file to patch in someone else's package andpr.pywrites no diff for one — so the card described work that does not exist, contradicting the hero on the same page. Three outcomes now:2. The blast-radius table reported an unmeasured replay as safe.
simulatecomputesevaluated,errored,enforcement_confirmedandreason, and the table used none of them. A replay in which every request failed in transit rendered as green "within threshold" at 0.0% — a rate that means "we measured nothing", presented as "safe to promote". Now four verdicts (not measured / unconfirmed / within / over) plus a caveats column carrying the reason and the transit-failure count.3.
reconcilereported a transport failure as "no runnable probe".{}is what "no probe recorded" returns — a permanent condition an operator can only fix by re-scanning. A probe that exists and blew up in transport is transient. Reporting the second as the first sends someone to fix the wrong thing. It now has its own hold code that says the next pass will retry. (auth_failedalready existed for exactly this reason — the pattern was one case short.)Surface parity
4. MCP ignored
VPCOPILOT_SIM_THRESHOLD. The threshold was a lookup each surface had to remember. The CLI, console and refiner remembered; MCP did not — so an operator who tightened the blast-radius threshold got the default silently applied to every simulation an agent ran, and the number they set was the number they believed was in force.Now
simulate.effective_threshold, one resolver all four call, pinned by a test that asserts no caller re-implements the lookup — because the defect was one caller not calling it. A malformed value is refused rather than silently defaulted: substituting the default would apply a threshold the operator did not choose, on the gate that decides whether a policy is safe to promote, and they would never be told. An empty value is treated as unset, not malformed.Two vacuous tests
5.
test_safe_rollback_restores_and_verifiesnever tested "verifies".FakeXCgenuinely applies the PUT, so the restore succeeded on its own andverifyreturned True whatever it did — delete the verify call fromsafe_rollbackentirely and the test still passed. It was asserting the behaviour of the fake.The new test uses an appliance that accepts the rollback PUT and applies nothing — a 200 that changed nothing, which is what a partially degraded control plane looks like. Without the verify step,
safe_rollbackreturns True and the caller reports a clean rollback while the band-aid is still attached to a live load balancer: the "silent half-rollback" the module docstring calls the worst outcome on a live LB.6. The four-place registration guard was a whole-file substring search. It asserted
"resolve" in report.py— which the unrelated word "resolved" elsewhere in that module already satisfied. It passed with the agent missing from the very list it guarded.report.pynow exposesREPORTED_AGENTSand the test asserts the list; a second test asserts all four sites agree with each other, which holds for the next agent rather than for this one by name.One fixture corrected, called out
tests/test_report.py's remediation carried emptydiffandpatched_content, so it was asserting the drafted-fix badge for a plan with no patch. Given a real patch — the fixture was unrealistic (acode_fixwith no patch is nothing forpr.pyto write), not a behaviour change I am papering over.Verification
verifyfromsafe_rollback, removingresolvefromREPORTED_AGENTS).LK-1001at 48215,vpcopilot-labback to baseline.What is left
One finding remains open, and it deserves its own PR rather than being folded in here: the spec-vs-code orphan comparison (
pipeline.py:152). It is not a small bug —servedis never derived from code in any configuration, so with no in-repo spec every declared endpoint is reported as unserved, and with one the comparison is spec-vs-spec and a genuinely undeclared route is reported nowhere. It also synthesises a Finding that bypasses the verify agent and can draw a realapi_schemaband-aid, so a wrong answer there is load-bearing. The honest fix likely involves declining the comparison when route extraction found nothing, which is a design decision worth reviewing on its own.The two remaining
cli.pyitems (scan-path existence, run-dir existence — both "enforced only on MCP") go with it.🤖 Generated with Claude Code