Repository navigation
Commit 085fbf8
committed
#1912 knip: the publish primitive has no production consumer yet, so tag it instead of blanking the module
The knip check on this PR has two steps. CI's 'Run knip checks' passes; 'Run production Knip checks'
failed on 1fb5fcc with one finding, and it reproduces locally on a real install:
Unused exports (1)
safeWriteText function src/services/file-safety/safeWriteText.ts:392:23
Why: in production mode Knip does not count test usage, and nothing in the shipped extension imports the
function. u3's head 9713c4a passed the same step because its src/utils/safeWriteJson.ts imported
safeWriteText at line 11 - the JSON writer delegated to the primitive. The seam ruling resolved the
safeWriteJson conflict pair to main's replacement protocol instead, so that import is gone and the
primitive's only remaining importers are its own unit tests. grep over src, packages and apps at this head
finds zero production importers outside the module: observationRegistry.ts and Task.ts perform no file
writes at all, and every McpHub write is JSON, which is safeWriteJson's job. So the export is real, the
consumer is later in the merge order (the guardedWrite migration), and the missing consumer is the price
of the seam ruling rather than a mistake in the graft.
What was measured before choosing the fix. knip 5.88.1's schema has no per-symbol ignore: ignoreExports
is not a key, and ignoreExportsUsedInFile is already true at the top of knip.json - it does not cover this
export because the function is not referenced inside its own file. The only config knob that would clear
the finding is ignore, and that blanks this whole 973-line module in both knip views, hiding any future
finding in it too. The alternative of shipping the export from the unit that adds its consumer would move
2,323 lines of the primitive's evidence out of this PR, which is the opposite of keeping both feature sets.
Chosen fix: tag the export @internal, which is what the repository already does 38 times at main - for
example src/api/providers/utils/abort-signal.ts:254, apps/cli/src/lib/task-history/index.ts:11 and
apps/cli/src/lib/storage/credentials.ts:16 - and which knip honours by default. The claim is true: the
symbol is not part of any shipped API surface, it is repo-internal, and no shipped entry reaches it yet.
stripInternal is set nowhere in this repository, so the tag does not remove the declaration from any
generated type surface. The tag is a comment: no executable line changed.
After it, on the committed tree with the pinned node 22.23.4 and a real install: knip --production exit 0
and knip --treat-config-hints-as-errors exit 0 (measured before this commit, logs S364-knip-production and
S364-knip-default), tsc 0 errors, eslint on the file with --max-warnings=0 --prune-suppressions exit 0 with
no count moved, prettier unchanged, and the services shard unchanged at 5 failed | 1705 passed | 1 skipped
(services/rules EPERM only). The full five-shard gate on the resulting head is in the push report.
If the maintainers would rather this PR not carry the tag, the alternatives are the knip.json ignore line
or holding the export until the guardedWrite migration lands; both are one decision away and neither
changes the graft.1 parent 22a4ba7 commit 085fbf8
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
392 | 402 | | |
393 | 403 | | |
394 | 404 | | |
| |||
0 commit comments