Skip to content

Commit e11d901

Browse files
committed
test(repo-guards): cover Markdown, plist and + paths in the ADR citation guard
Address review: scan .md and .plist citations and paths with +, state the guard's exact scope in FORMAT.md, qualify ADR 0012's in-place overwrite rule with --force, and keep perf capture's missing failed-finish test listed in ADR 0024.
1 parent 402ec6d commit e11d901

4 files changed

Lines changed: 23 additions & 9 deletions

File tree

‎docs/adr/0012-interactive-replay.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Seven normative rules govern it:
152152
Every teardown commits if and only if the state is `COMPLETE`.
153153
Before `COMPLETE`, teardown publishes nothing, and idle-reap or shutdown leaves a `REPAIR_SESSION_EXPIRED` tombstone.
154154
An armed replay skips a terminal source `close` and marks the transaction `COMPLETE`.
155-
Publication writes `<original-stem>.healed.ad` beside the original unless the caller names a path. The original is never overwritten in place.
155+
Publication writes `<original-stem>.healed.ad` beside the original unless the caller names a path. The original is never overwritten in place unless the caller names it as the target with `--force`/`--overwrite`.
156156
Without `--force`/`--overwrite`, one exclusive `linkSync` publishes the file and refuses a pre-existing target, for repair and ordinary `--save-script` recording alike; with the flag, publication replaces the target atomically.
157157

158158
Inside an armed repair segment, out-of-band observation-only commands are excluded from the healed script by default.

‎docs/adr/0024-screen-recording-provable-signal.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Six rules make the table operational:
7070
Forced cleanup is never inferred from "finish threw".
7171
The mechanism is in the shared coordinator (`packages/capture-kit/src/durable-capture/transitions.ts`).
7272
But each kind must earn its scope.
73-
Each of app-log and audio-probe gets its own failed-finish test that proves what its retry needs; perf capture already has one.
73+
Each of app-log, audio-probe, and perf-capture gets its own failed-finish test that proves what its retry needs; perf capture already preserves retry material but has no such test yet.
7474
A kind whose retry needs nothing keeps its current disposal explicitly.
7575
The Android data loss alone establishes the rule for recording only.
7676

‎docs/adr/FORMAT.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Do not repeat general repo guidance that `AGENTS.md` already gives.
4444

4545
## The record stays current
4646

47-
An ADR states the current truth. It is not a log of the discussion around the decision. A repo guard fails when an ADR cites a repository file that does not exist. An optional dated "Decision history" line records a real change of direction. If the direction really changed, you may add one such line with its reason and a link.
47+
An ADR states the current truth. It is not a log of the discussion around the decision. A repo guard fails when a backticked repository path or test file name in an ADR does not match a tracked file. An optional dated "Decision history" line records a real change of direction. If the direction really changed, you may add one such line with its reason and a link.
4848

4949
## Before you amend
5050

‎test/repo-guards/adr-citations.test.ts‎

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@ import { listTrackedRepoFiles } from '../../scripts/layering/tracked-sources.ts'
77

88
/**
99
* An ADR states the current truth (docs/adr/FORMAT.md), so every repository file it cites must
10-
* exist. A citation is a backticked token with a source or config extension:
10+
* exist. A citation is a backticked token with a source, config, or Markdown extension:
1111
*
1212
* 1. a repository path (it contains `/`) must name a tracked file;
1313
* 2. a bare test file name (`*.test.ts` and similar) must match a tracked file's name.
1414
*
1515
* Absolute and home paths (device or host files), globs, and bare non-test names (runtime state
16-
* files such as `daemon.json`) are not repository citations.
16+
* files such as `daemon.json`) are not repository citations. Markdown links are checked by
17+
* `pnpm check:doc-links`, not here.
1718
*/
1819

1920
const ADR_DIR = 'docs/adr';
20-
const CITED_EXTENSIONS = 'ts|mts|cts|mjs|cjs|js|swift|kt|java|json|sh|yml|yaml|py';
21-
const CITATION = new RegExp(`\`([A-Za-z0-9_./@{}*-]+\\.(?:${CITED_EXTENSIONS}))\``, 'g');
21+
const CITED_EXTENSIONS = 'ts|mts|cts|mjs|cjs|js|swift|kt|java|json|sh|yml|yaml|py|md|plist';
22+
const CITATION = new RegExp(`\`([A-Za-z0-9_./@{}*+-]+\\.(?:${CITED_EXTENSIONS}))\``, 'g');
2223
const TEST_FILE = /\.test\.[a-z]+$/;
2324

2425
type Citation = Readonly<{ adr: string; token: string }>;
@@ -74,16 +75,29 @@ test('the citation scan rejects missing paths and test names, and skips non-repo
7475
'`commands/runtime-types.ts`',
7576
'`kept.test.ts`',
7677
'`gone.test.ts`',
78+
'`apple/Sources/Kept+Ext.swift`',
79+
'`apple/Sources/Gone+Ext.swift`',
80+
'`docs/evidence/gone.md`',
7781
'`daemon.json`',
7882
'`/sdcard/marker.json`',
7983
'`src/platform-runtime-*.ts`',
8084
].join('\n'),
8185
},
8286
],
83-
['packages/a/src/kept.ts', 'packages/a/src/__tests__/kept.test.ts'],
87+
[
88+
'packages/a/src/kept.ts',
89+
'packages/a/src/__tests__/kept.test.ts',
90+
'apple/Sources/Kept+Ext.swift',
91+
],
8492
);
8593
assert.deepEqual(
8694
stale.map(({ token }) => token),
87-
['packages/a/src/gone.ts', 'commands/runtime-types.ts', 'gone.test.ts'],
95+
[
96+
'packages/a/src/gone.ts',
97+
'commands/runtime-types.ts',
98+
'gone.test.ts',
99+
'apple/Sources/Gone+Ext.swift',
100+
'docs/evidence/gone.md',
101+
],
88102
);
89103
});

0 commit comments

Comments
 (0)