fix(mcp): stabilize close-score guidance ranking - #1617
Conversation
|
[PHASE: PLAN] S0 locked the #1615 implementation decision from measured evidence in Evidence
NextImplement leader-anchored, transitive close-score groups; preserve numeric order within the same source document; prove all eight cases on base and fresh corpora. |
|
[PHASE: IMPL] S1 landed as Evidence
Slice reviewReviewed transitivity, route precedence, same-document relevance, confidence preservation, and scope boundaries before the sign-off commit. S2 owns the required throwaway-commit negative control and full gates. |
S2 — implementation gate evidenceImmutable implementation head:
The PR remains draft with exactly |
|
Final immutable implementation head: |
… D-11 PR #1608 cycle-2 exact-head IMPL-EVAL: PASS with a blocking sequencing precondition. Merging it alone would flip main's green check-test red, because the guidance-ranking test (owned by #1615) fails against the fresh corpus. Sequencing verified by execution rather than argued: #1617's scoring passes both with the stale corpus (exit 0) and with the fresh one (exit 0), so merging #1617 first does not merely relocate the red. Structural finding: main-branch-protection sets strict_required_status_checks_policy=false, so a branch can merge without being up to date. That is what makes a freshness gate verified at an earlier head unsound at merge time. origin/main moved three times during this one PR's repair and evaluation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QGrdeXR3yuCZt78FxtpMy5
|
[PHASE: IMPL] [VERDICT: REVIEW_CORRECTION_LANDED] S3 restores pre-PR route-ranked confidence semantics at immutable head Correction
Explicit limits
Gates
Package-wide format is not claimed; #1618 owns the malformed-fixture formatter obstruction. The PR remains draft with exactly |
|
Final immutable S3 handoff head: |
Exact-head IMPL-EVAL — PASSProvenance: native Claude Opus 5, read-only, fresh session, opposite-family to this Codex-authored Head evaluated: Does merging leave
|
Pre-merge gate — merging with the suite's cloud-eval check bypassed, and why
What stands in its place: a native Claude Opus 5, read-only, separate-session, opposite-family IMPL-EVAL — PASS at immutable head
No paid evaluator ran on this branch. The verdict is still bound to this code. It was issued at Merge-time verification at
The evaluator independently reproduced the merged-tree result in an isolated clone (3353 passed, 0 failed), so two separate constructions agree. Follow-ups filed, neither blocking: #1622 ( |
Summary
Make close-score guidance ordering deterministic across unrelated corpus-wide statistic changes, based on the measured near-tie in #1615. This keeps the exact golden meaningful without treating either the stale or freshly generated corpus as an oracle.
Scope
packages/mcpArchetype 2 guidance rankingSlices
0b73d7333b943392d75d7ca0f46,c86a4080f,33e0ef9d0,543a7b1e97933e044c,5a0e7303eScore measurement
6aee2b41411.8034377664767311.721196841503339+0.082240924973390860.082240924973390869e9a9b6f611.50224433911376611.804224537299888-0.30198019818612210.3019801981861221The fresh gap is about 2.6% of either score and reverses solely through unrelated corpus changes. Direction 1 is selected: deterministic tie handling for close cross-document scores. Concept weighting is rejected because the gap is not wide; fixture narrowing is rejected because rank three can remain deterministic.
Ordering and confidence semantics
The implementation forms leader-anchored, same-route groups within a
0.5score gap, avoiding a non-transitive epsilon comparator. Corpus-wide document frequency and average length are the unstable inputs, so different documents inside a statistically tied group are ordered by stable slug. Sections within one document retain raw-score order because those candidate-local relevance differences remain meaningful.The resulting cross-document order is deterministic but arbitrary: the expected
data-persistenceanchor wins this tie because its slug sorts beforeexplanation, not because this PR proves that document deserves higher semantic rank. The exact golden is unchanged because a stable total order is justified by the measured tie.This is deterministic for a fixed candidate set, not insertion-stable under corpus growth. If a third document enters the same leader-anchored
0.5group and its slug sorts before both current candidates, the locked order can change again. Such a new close candidate is a real membership change and requires semantic review of the fixture/scorer.There is a second, sibling instability that needs no membership change at all: an existing member can exit the band. Verified —
10.0 / 9.5groups by slug,10.0 / 9.4999999reverts to score order. So this fix converts an instability at gap ~= 0 into an instability at gap ~= 0.5; it is a large improvement, not an elimination. Measured headroom on the real pair: the band span moved from0.2271214530129786(base corpus) to0.3019801981861221(fresh), i.e.+0.0748587451731435from a single regeneration, leaving0.1980198018138779of headroom — about 2.6x the observed per-regeneration movement. A future regeneration of similar magnitude can re-red this gate with the fix in place.Confidence follows the post-order route-priority winner, preserving pre-PR route-promotion behavior. Close-score ordering can replace the numeric leader only with an entry at most
0.5lower, so confidence can differ only when the winning score is within0.5of thresholds8or24. A regression test proves that an unhinted global scorer yieldshigh, while activating a route promotes a lower scorer and yieldsmedium.Validation
Original evidence:
GuidanceIndex.find()top-three orders agree on base and fresh corpora5d7ca0f46— raw exit1; 0 passed, 1 failed; deliberate expectedllms#deliberate-negative-controlversus actualllms#getting-startedc86a4080f— exit 0; 1 passed, 0 failed; fixture restored exactlyquality:gate— exit 0private-type-refonSchemaViewNameinget-operation-schema-flow.ts, a file this PR does not touch. Confirmed exit 1 onorigin/mainwithout this PR, so it is pre-existing and not introduced here.fmt/lintwrappers cannot produce a verdict forpackages/mcpat all (tooling: deno fmt cannot verify packages/mcp — a deliberately malformed test fixture aborts config parsing #1618) — they abort onFailed to parse "workspace" configurationfrom the deliberately malformed doctor fixture. Single-filedeno fmt --checkanddeno linton the two touched files were used instead: both exit 0.S3 review cycle:
packages/mcppackage tests — exit 0; 136 passed, 0 faileddeno fmt --check— exit 01; 0 passed, 1 failed; fixture restored before package tests and commitNo package-wide format verdict is claimed. The deliberately malformed
packages/mcp/tests/fixtures/doctor/broken/deno.jsonprevents the formatter from producing a trustworthy package-scoped verdict; this is pre-existing onorigin/mainand tracked by #1618. This PR uses exact touched-file format checks only.Harness
.llm/runs/fix-1615-ranking--leaf/PLAN-EVAL: N/Ais recorded because the issue supplied the complete contract, boundaries, and gates and measurement resolved the only open decision.Drift / Debt
mainfails the published-JSDoc codename guard — bare issue reference#1589in netscript-web-runtime-closure.ts #1612 / PR fix(cli): replace published JSDoc issue codename #1614; this leaf does not absorb it.MCP-A6-V2-SHAPEdebt is neither deepened nor resolved.Definition of Done
5a0e7303e93413a80999dbf59ba9f8191798e1ee, no blocking findings. Verdict posted at fix(mcp): stabilize close-score guidance ranking #1617 (comment). The feature diff is byte-identical at the current merged head32d3e1842(git diff origin/main...HEAD -- packages/— 6649 bytes before and after the main merge), so the verdict remains bound to unchanged code.