Repository navigation
test: assert the invalid interval rejection with ts-expect-error instead of a cast - #14
Merged
Upd4ting merged 2 commits intoOct 31, 2026
Merged
Conversation
…ead of a cast The conformance case for an interval outside the vocabulary now passes the invalid value directly, with a @ts-expect-error that names the rejection under test, and a Partial<SubscriptionRequest> return type so the error stays on that one line. The ratchet has no debt left, so its file is deleted; the suppressions budget raises tsExpectError from 0 to 1 for this one directive.
Member
Author
e7bc1fa: PASS+NOTESIndependent verifier, fresh clone, node 24.22.2, base CI is red only on the approved budget raise. That is the single failure, in CI's log and in local Ruling 1
Ratchet and budget
The single failureLocal
Notes (cosmetic, not blocking)
Attention
|
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.
Why
Goal (Antony): every AntelopeJS
guardrails.ratchet.jsondeleted through verified PRs oncampaign/integration. interface-subscriptions had one row left,src/tests/subscriptions-changes.test.ts:225("fortnight" as SubscriptionRequest["interval"]). Antony's ruling 1 (2026-10-31) lets a test that feeds a deliberately invalid value to prove a rejection use// @ts-expect-error <reason naming the rejection under test>on that one line, never anascast, with the suppressions-budget raise approved and listed line by line. This PR applies it and deletes the ratchet. The task named line 231; oncampaign/integration9eebc70 the row is at line 225.What changed
src/tests/subscriptions-changes.test.ts: the case "an interval outside the vocabulary" returns the invalid value directly. Its factory gets aPartial<SubscriptionRequest>return type. Without that, the unsuppressed literal type{ interval: "fortnight" }leaks into the unionObject.entries(INVALID)yields and raises a second error at theCreateSubscription(monthly(payer, overrides(...)))call (line 242), which the one directive cannot cover. The annotation keeps the error on the one property line.guardrails.ratchet.jsondeleted bypnpm exec antelopejs-ratchet --update.guardrails.suppressions.json:tsExpectError0 -> 1.pnpm run sync(drops the ratchet step fromlefthook.yml,package.json,AGENTS.md).Suppression budget raise (approved by ruling 1), line by line
src/tests/subscriptions-changes.test.ts:225// @ts-expect-error"fortnight" is outside the interval vocabulary, which CreateSubscription must refuse with InvalidSubscriptionRequestErrorThis is the only raise. No
SAFETY:, no lint directive, no rule-off, no ceiling raise.Proofs
Ratchet (
pnpm exec antelopejs-ratchet --update):tsc errors on that line without the directive (cast removed, nothing else changed,
tsc -p tsconfig.json --noEmit):With the directive and the annotation,
tsc -p tsconfig.json --noEmitexits 0 (a@ts-expect-errorwith nothing to suppress would itself be TS2578).The test still asserts the rejection. The suite is a provider conformance suite, skipped without
ANTELOPE_PAYMENT_TEST_METHODand a payment provider, so it cannot run in this repo. Instead: (1) emitting both the base and the head test file withtsc --removeCommentsgives byte-identical JS, so theassert.rejects(CreateSubscription(...), InvalidSubscriptionRequestError, label)body and the value passed are unchanged; (2) the library's ownValidateSubscriptionRequest, which a provider calls, on the builtdist:pnpm run checkson the committed head e7bc1fa (node 24.22.2,distremoved first,CI=true,GITHUB_BASE_REF=campaign/integration):The one failure is the approved raise above, so CI cannot be green by design (the check refuses any raise without the operator's ruleset bypass). Ruling 1 approves it, and the PR is landed with
LAND_ADMIN=1(land-one.sh).land-raise.shdoes not accept this gate: its gate check matches onlySAFETY:raise lines, so it would refuse a@ts-expect-errorraise. Every other check passes.pnpm run sync:checkis part of those 7 and passes after the sync commit.api-diff (
campaign/tools/api-diff-slot.sh origin/campaign/integration, committed head e7bc1fa):Attention
@ts-expect-errorline is 140 characters. The formatter andantelopejs-formataccept it..nvmrc24).Re-verified at e7bc1fa (owner
rulings-small-b)pnpm run checksrerun from a fresh clone, node 24.22.2,distremoved,CI=true,GITHUB_BASE_REF=campaign/integration: same output as above,Checks: 7 passed, 1 failed., the one failure being the approved@ts-expect-error0 -> 1 raise. CI's failing job shows the identical[suppressions]block and nothing else.tsc --removeCommentsinto separate dirs anddiff -rgivesemit identical, so theassert.rejects(CreateSubscription(...), InvalidSubscriptionRequestError, label)call and the passed value are unchanged.tsc --noEmitfail withsrc/tests/subscriptions-changes.test.ts(226,7): error TS2322: Type '"fortnight"' is not assignable to type '"day" | "month" | "year" | "week" | undefined'.(exit 2), so the directive is used and covers exactly that error.ValidateSubscriptionRequeston the builtdist:month -> accepted,fortnight -> rejected: true interval must be one of day, week, month, year.campaign/tools/api-diff-slot.sh origin/campaign/integrationat e7bc1fa:API: 1 packages, 3 entries unchanged,Runtime API: 1 packages, 2 entries unchanged,@ts-expect-error0 -> 1, all other suppression rows 0 -> 0.