summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/hooks/reader/verification.ts
diff options
context:
space:
mode:
authorMorgan Lunt <morganl@anthropic.com>2026-09-25 11:28:44 -0700
committerMorgan Lunt <morganl@anthropic.com>2026-09-25 11:28:44 -0700
commitd49ccb3844876e35262a32f145b7b717646da733 (patch)
treecbaefc469ac837a85ac154e797fff20dd1905d62 /plugins/code-modernization/hooks/reader/verification.ts
parentd3a40f72165764888f9a57a3e93db86e88f8e063 (diff)
code-modernization: a rule is tested only if a test that ran backs it
A rule named only by a skipped or pending test no longer counts as covered. It is listed as "named, not run" and fails the rules check. A test-only folder is listed as tooling and gets no verdict. The verify command tries malformed records only when the person asked for exact behavior, so a proof loop has an end. The report parses rule headings and fields in linear time, and the report and pane show the new status.
Diffstat (limited to 'plugins/code-modernization/hooks/reader/verification.ts')
-rw-r--r--plugins/code-modernization/hooks/reader/verification.ts20
1 files changed, 17 insertions, 3 deletions
diff --git a/plugins/code-modernization/hooks/reader/verification.ts b/plugins/code-modernization/hooks/reader/verification.ts
index c1d6e556..94ef6666 100644
--- a/plugins/code-modernization/hooks/reader/verification.ts
+++ b/plugins/code-modernization/hooks/reader/verification.ts
@@ -30,6 +30,8 @@ export type ProofEntry = {
export type Verification = {
overall: Verdict | null
entries: ProofEntry[]
+ /** Built folders that hold only test code and the files that build it: the pack lists them and judges none, so the pane says nothing of them. */
+ tooling: { track: TrackKey; name: string }[]
}
/** How the module is standing with the proof, for a chip and for the next step. */
@@ -112,8 +114,18 @@ export function parseVerification(text: string): Verification | null {
}
const overall = isRecord(raw.overall) && typeof raw.overall.verdict === 'string' && VERDICTS.includes(raw.overall.verdict) ? (raw.overall.verdict as Verdict) : null
+ const tooling: Verification['tooling'] = []
- return { overall, entries }
+ for (const item of (Array.isArray(raw.toolingOnly) ? (raw.toolingOnly as unknown[]) : []).slice(0, MAX_ENTRIES)) {
+ const name = isRecord(item) && typeof item.name === 'string' ? plain(item.name, MAX_NAME) : ''
+ const track = isRecord(item) && typeof item.track === 'string' && Object.hasOwn(TRACK_OF, item.track) ? TRACK_OF[item.track] : undefined
+
+ if (name !== '' && track !== undefined) {
+ tooling.push({ track, name })
+ }
+ }
+
+ return { overall, entries, tooling }
}
/** The pack stamps minutes; a file written in the same minute as the check is not newer than it. */
@@ -121,7 +133,7 @@ const SLACK_MS = 90_000
/**
* Where a built module stands with the proof. Null when it has no notes and no verdict, so nothing is claimed of a
- * module still being built.
+ * module still being built, and null for a folder the pack lists as test tooling (only test code and build files: nothing to prove).
*
* @param verification the file, or null when there is none
* @param track the track the pane follows
@@ -139,7 +151,9 @@ export function proofOfModule(
const entry = verification?.entries.find(candidate => candidate.track === track && candidate.name.toLowerCase() === plain(name, MAX_NAME).toLowerCase())
if (entry === undefined) {
- return hasNotes ? { state: 'none', reason: '' } : null
+ const isTooling = verification?.tooling.some(item => item.track === track && item.name.toLowerCase() === plain(name, MAX_NAME).toLowerCase()) === true
+
+ return hasNotes && !isTooling ? { state: 'none', reason: '' } : null
}
if (entry.atMs !== null && changedAtMs > entry.atMs + SLACK_MS) {