Repository navigation
fix(compliance): stop silent RC fallback for lines without a stable build - #7679
Conversation
…uild latestBadgeEligibleComplianceVersionForLine() silently returned the latest RC when a non-default line (e.g. "3.2") had no stable build yet, so a bare line alias or an explicit compliance_target for that line would resolve to a prerelease indistinguishable from a stable release. Callers (badge eligibility checks, explicit compliance_target resolution) had no way to tell the difference. Throw loudly for non-default lines instead. The default line (3.0) keeps its existing stable -> rc -> beta fallback chain unchanged. Diagnosed by bokelley on adcontextprotocol#7356 as a real latent risk separate from that issue's original (unreproducible) report, with this exact fix proposed and flagged as non-breaking for current callers on 3.0 and 3.1. Fixes adcontextprotocol#7356
19de21e to
0e1580e
Compare
There was a problem hiding this comment.
Ladon verdict: Request changes
Request changes — 2 blocking finding(s)
The source fix in hosted-compliance-version.ts is correct and well-scoped (non-default lines fail-closed rather than silently promoting to an RC; the default 3.0 line is unchanged), and no changeset is required (server-only, no protocol surface). However, the accompanying test file ships red.
Blocking findings
- server/tests/unit/hosted-compliance-version.test.ts:9 — Hardcoded drifted release-state value: asserts 3.1→3.1.20 but the published ceiling is now 3.1.23. Test fails against current published state.
- server/tests/unit/hosted-compliance-version.test.ts:22 — Regression guard expects a "No npm-published" throw for 3.2, but 3.2.0 is now published, so the actual "No checked-in cache" throw fails the regex. The PR's own validation ships red.
Resolve both test assertions to match current published release state before merge.
Blocking findings
- server/tests/unit/hosted-compliance-version.test.ts:9 — Hardcoded drifted release-state value (asserts 3.1→3.1.20 but published ceiling is 3.1.23); test fails.
- server/tests/unit/hosted-compliance-version.test.ts:22 — Regression guard expects 'No npm-published' throw for 3.2, but 3.2.0 is now published so the actual 'No checked-in cache' throw fails the regex; PR validation ships red.
Superseded by a later Ladon review that rechecked and resolved its blocking findings.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean pass, prior blockers resolved.
This is a subsequent review of a server-only change (server/src/services/hosted-compliance-version.ts + test). The prior run was request-changes; both prior blocking findings on the test file are now resolved:
- Test line 9 is now regex-based (correctly resolves 3.1.23) instead of the drifted 3.1.20 pin.
- The 3.2 case correctly throws "No npm-published compliance version is registered for 3.2" since no stable 3.2.x exists in published_versions (only rc/beta; 3.2.0 is package_only).
The source fix is a fail-closed improvement: non-default lines throw rather than silently promoting to an RC, while the default 3.0 line retains its stable→rc→beta fallback. Server-only, no protocol surface (static/schemas/source/**, docs/reference, dist artifacts) touched, so no changeset required.
No current critical/high/medium findings. Not high-risk, no gated paths, no author-team gate, review_decision not applicable. None of rows 1–8 fire → row 9 approve. Net improvement over the prior run.
Summary
latestBadgeEligibleComplianceVersionForLine()silently fell back to the latest RC build when a non-default compliance line (e.g.3.2) had no stable release yet. Any caller resolving a bare line alias for that line, whether through badge-eligibility checks or an explicitcompliance_target: "3.2", got a prerelease back with no signal that it wasn't a stable release.This was diagnosed by @bokelley in #7356. The original report (an explicit
compliance_target: "3.1.20"resolving to3.2.0-rc.1) doesn't reproduce against current code, since an exact version string bypasses this function entirely. But the triage identified the underlying fallback as a real, separate risk, and proposed this exact fix:That triage also flagged a focused follow-up issue as a planned next step; none has been filed yet, so this PR does the fix directly against #7356 rather than waiting on a second issue.
Change
3.0) keeps its existingstable -> rc -> betafallback chain, unchanged.Test plan
server/tests/unit/hosted-compliance-version.test.ts:3.1still resolves to its latest stable build (3.1.20)3.0still resolves to the module's default version3.2(currently RC-only, no stable release) now throws instead of silently returning a prereleasevitest run --config server/vitest.config.ts server/tests/unit/ server/tests/integration/ -t compliance: 1 failed / 164 passed / 757 skipped. Confirmed the 1 failure (sdk_versionmismatch incompliance-publication.test.ts) is pre-existing and identical onupstream/mainwithout this change (stale@adcp/sdkin localnode_modules), not caused by this diff.npx tsc --project server/tsconfig.json --noEmit: no new errors introduced by this file.Fixes #7356