Skip to content

feat(calibration): bounded loosenable-knob registry generalizing the backtest-gated loosening - #8190

Merged
JSONbored merged 1 commit into
mainfrom
feat/loosening-knob-registry
Jul 23, 2026
Merged

feat(calibration): bounded loosenable-knob registry generalizing the backtest-gated loosening#8190
JSONbored merged 1 commit into
mainfrom
feat/loosening-knob-registry

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

What

Generalizes #8121's satisfaction-floor loosening into a declarative LOOSENABLE_KNOBS registry (#8159) and registers a second, REPORT-ONLY knob: ai_review_close_confidence (candidates 0.9 → 0.85, hard minimum 0.85, backtested against the real ai_consensus_defect corpus).

How

  • src/services/loosening-knobs.ts — the registry + evaluateKnobLoosening, the generic backtest-gated evaluator (visible improvement + held-out non-regression + bounded candidate ladder). Each knob declares its applyMode: live (satisfaction floor — unchanged behavior, now delegating to the generic evaluator, pinned byte-stable by the existing tests) or report_only (the new knob: proposals surface with full evidence, nothing can apply them until consumption plumbing ships as its own reviewed change — calibration: wire ai_review_close_confidence override consumption and flip the knob to live #8176).
  • loadReportOnlyKnobProposals in the loosening run module + buildReportOnlyKnobRecs in the advisor: report-only proposals appear in the tuning advisor with the same evidence shape as calibration: surface backtest-cleared loosening proposals in the tuning advisor with evidence payloads #8160's, and an explicit refused-apply line.
  • No gate-authority change anywhere in this PR: the close-confidence knob cannot move any live value.

Validation

Full npm run test:ci green locally; 100% branch coverage on all touched src ranges; satisfaction-floor behavior pinned unchanged by the pre-existing suites.

Closes #8159

…backtest-gated loosening (#8159)

The #8121 narrow start hardcoded one loosenable value. LOOSENABLE_KNOBS now
declares each knob the way KNOWN_THRESHOLDS/KNOWN_LOGIC_RULES declare their
surfaces -- rule id, nearest-first candidate steps, hard minimum, sample
floors, per-knob fixed split seed -- evaluated by ONE generic
evaluateKnobLoosening carrying the narrow start's invariants verbatim.
evaluateSatisfactionFloorLoosening now delegates to it; the registry entry is
test-pinned to the legacy constants and seed, so behavior and held-out
membership are byte-stable across the refactor (all pre-existing evaluator
tests pass unchanged).

Second knob: ai_review_close_confidence (DEFAULT_AI_REVIEW_CLOSE_CONFIDENCE,
corpus ai_consensus_defect -- real today via the #8157 backfill) enters
REPORT-ONLY: loadReportOnlyKnobProposals evaluates it fail-safe per knob, and
buildReportOnlyKnobRecs surfaces the full split evidence in the selftune
advisor pass (once per pass, payload-less -- the apply path provably cannot
touch it), with the action line stating that applying requires shipping its
override-consumption plumbing as its own reviewed change. Bounds are tight by
design: candidates 0.9/0.85, hard floor 0.85, higher sample minimums.

Registry structural invariants (candidates strictly below shipped, at/above
the hard minimum, descending; unique ids and seeds) are themselves pinned by
tests. 100% line+branch coverage on every touched module.

Advances #8159.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jul 23, 2026
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.60%. Comparing base (06ebd53) to head (4d0d6d0).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8190      +/-   ##
==========================================
- Coverage   92.07%   89.60%   -2.47%     
==========================================
  Files         770      102     -668     
  Lines       77925    22768   -55157     
  Branches    23541     3903   -19638     
==========================================
- Hits        71750    20402   -51348     
+ Misses       5062     2187    -2875     
+ Partials     1113      179     -934     
Flag Coverage Δ
shard-1 40.41% <45.16%> (-11.68%) ⬇️
shard-2 82.87% <100.00%> (+27.90%) ⬆️
shard-3 10.95% <3.22%> (-44.57%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/review/loosening-recs.ts 100.00% <100.00%> (ø)
src/review/selftune-wire.ts 96.96% <100.00%> (+0.19%) ⬆️
src/services/loosening-knobs.ts 100.00% <100.00%> (ø)
src/services/satisfaction-floor-loosening-run.ts 100.00% <100.00%> (ø)
src/services/satisfaction-floor-loosening.ts 100.00% <100.00%> (ø)

... and 669 files with indirect coverage changes

@JSONbored
JSONbored merged commit 46d7877 into main Jul 23, 2026
14 checks passed
@JSONbored
JSONbored deleted the feat/loosening-knob-registry branch July 23, 2026 09:43
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.

calibration: generalize backtest-gated loosening into a bounded knob registry beyond the satisfaction floor

1 participant