Skip to content

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:

LocationIssue
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,779builds an OK/FAIL display label "<type>/schema.json" for a file that no longer exists for live types
LocationRole today
plugin/lib/model/entity.tsscaffold (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.tsSCHEMA_VERSION_PATTERN (53) is exported but used only same-file (76)
plugin/lib/model/ops/validate.tsBuilds the OK/FAIL label <type>/schema.json (758) for resolved types, including live types whose schema.json no longer exists

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 the export — it is used only at _common.ts:76.
  • validate.ts:758: the label is correct for unregistered fixture types (a real schema.json on disk) but wrong for live types (contract-backed, schema.ts). Conditionalize — registered/live type → <type>/schema.ts; fixture type → keep schema.json. Leave the path-resolution schema.json references (162/194/557/…); they resolve real fixture files.
  • bunx tsc --noEmit clean; run the affected op and entity suites.
LocationKindChange
plugin/lib/model/entity.tsmodifyMark scaffold (367) and ScaffoldResult (362) test-only with a comment; callers are tests
plugin/lib/model/entities/_common.tsmodifyDe-export SCHEMA_VERSION_PATTERN (53) — make it module-local
plugin/lib/model/ops/validate.tsmodifyLabel live types <type>/schema.ts not <type>/schema.json (758); keep schema.json for fixture types
  • AC-1: entity.ts’s scaffold (line 367) and ScaffoldResult (line 362) are either removed or, if intentionally kept for tests, given a comment documenting that they are test-only.
  • AC-2: _common.ts’s SCHEMA_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 --noEmit is clean and the affected op/entity suites pass.
  • hydrateFrontmatter — that is a separate WIN task and is left alone here.

← Back to Tasks