T-J8US-remove-dead-exports-and-stale-validate-label
Status: closed/done · Impact: low · Complexity: small
The audit surfaced a few post-migration leftovers that are cosmetic or dead but worth clearing so the surface matches reality:
| Location | Issue |
|---|---|
plugin/lib/model/entity.ts:367 (scaffold) | exported but has no production caller (test-only; predates this work) |
plugin/lib/model/entity.ts:362 (ScaffoldResult) | exported alongside scaffold, same no-production-caller status |
plugin/lib/model/_common.ts:53 (SCHEMA_VERSION_PATTERN) | exported but used only in the same file |
plugin/lib/model/ops/validate.ts:758,767,779 | builds an OK/FAIL display label "<type>/schema.json" for a file that no longer exists for live types |
| Location | Role today |
|---|---|
plugin/lib/model/entity.ts | scaffold (367) and ScaffoldResult (362) are exported; the only callers are tests (entity.test.ts, site_manifest.test.ts) — no production caller |
plugin/lib/model/entities/_common.ts | SCHEMA_VERSION_PATTERN (53) is exported but used only same-file (76) |
plugin/lib/model/ops/validate.ts | Builds the OK/FAIL label <type>/schema.json (758) for resolved types, including live types whose schema.json no longer exists |
Approach
Section titled “Approach”Clear the post-migration leftovers; behavior-preserving.
scaffold/ScaffoldResult: tests still call them, so keep the export and add a comment marking them test-only (the AC-1 fallback) rather than deleting.SCHEMA_VERSION_PATTERN: drop theexport— it is used only at_common.ts:76.validate.ts:758: the label is correct for unregistered fixture types (a realschema.jsonon disk) but wrong for live types (contract-backed,schema.ts). Conditionalize — registered/live type →<type>/schema.ts; fixture type → keepschema.json. Leave the path-resolutionschema.jsonreferences (162/194/557/…); they resolve real fixture files.bunx tsc --noEmitclean; run the affected op and entity suites.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
plugin/lib/model/entity.ts | modify | Mark scaffold (367) and ScaffoldResult (362) test-only with a comment; callers are tests |
plugin/lib/model/entities/_common.ts | modify | De-export SCHEMA_VERSION_PATTERN (53) — make it module-local |
plugin/lib/model/ops/validate.ts | modify | Label live types <type>/schema.ts not <type>/schema.json (758); keep schema.json for fixture types |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1:
entity.ts’sscaffold(line 367) andScaffoldResult(line 362) are either removed or, if intentionally kept for tests, given a comment documenting that they are test-only. - AC-2:
_common.ts’sSCHEMA_VERSION_PATTERN(line 53) is de-exported (made module-local) since it is used only same-file. - AC-3: The OK/FAIL display label in
validate.ts(lines 758/767/779) no longer renders"<type>/schema.json"for live types — it names an artifact that actually exists (e.g.<type>/schema.ts). - AC-4:
bunx tsc --noEmitis clean and the affected op/entity suites pass.
Out of scope
Section titled “Out of scope”hydrateFrontmatter— that is a separate WIN task and is left alone here.