fix(review): freshness-gate shadow-override promotion, audit-before-write ordering, and clear_at preservation - #6458
Merged
Conversation
- evaluateShadowPromotion now refuses to promote a shadow-queued tightening once the project's freshly-measured merge precision has recovered above the risk floor that originally warranted it, instead of blindly applying a stale 24h-old snapshot's verdict. - applyOverrideRecommendation and the shadow-promotion path now record the override_audit row before the live/shadow mutation (and the audit write's swallowed error is now logged at error level), so a transient D1 write failure can no longer leave a live config change with zero audit trail. - writeLiveOverride/writeShadowOverride now preserve the clear_at column across INSERT OR REPLACE instead of silently dropping it, and writeLiveOverride threads nowIso into its internal re-read so an already-expired override is treated as cleared rather than resurrected.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6458 +/- ##
=======================================
Coverage 95.59% 95.59%
=======================================
Files 589 589
Lines 47025 47034 +9
Branches 14951 14956 +5
=======================================
+ Hits 44952 44962 +10
Misses 1291 1291
+ Partials 782 781 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Summary
Fixes 3 confirmed adversarial-audit findings in
src/review/auto-apply.ts(plus a one-line, non-logic-changing export addition tosrc/review/auto-tune.tsso the new freshness gate can reuse the sameRISK_MERGE_PRECISIONthresholdcomputeTuningRecommendationsitself gates on, instead of duplicating the magic number):INSERT OR REPLACEontunables_overrides/tunables_overrides_shadowsilently drops theclear_atcolumn on every write, and the internal re-read that seeds the merge never passesnowIsoso an expired override would never be treated as clearedEach fix follows the audit's own verified failure scenario and root-cause analysis (2-independent-skeptic adversarial verification pass, both had to vote "confirmed").
Note: finding 1's fix threads a new optional
mergePrecisionfield throughAutoApplyContextintoevaluateShadowPromotion, but the actual host-side cron wiring that populatesAutoApplyContextfrom aGateEvalReportis explicitly deferred infra per this module's own header comment (not yet built) — same as the pre-existingdecided/recsfields. The fix is fully correct and tested at the module boundary; when that wiring lands, it must pass the repo's current merge precision intoctx.mergePrecision.Closes #6416
Closes #6420
Closes #6421
Test plan
clear_atpreservationtest/unit/auto-apply.test.ts(95/95),test/unit/auto-tune.test.ts(55/55)npm run test:ci) green