refactor(core): single Record-production module owns file→Record and path classification#209
Merged
Conversation
…path classification
"File → validated Record" had three parallel VFile→EntryNode
implementations and three divergent path→Collection matchers spread
across schema.ts, contentGraph.ts, export/json.ts, and
source-filesystem. A file could be classified differently (or
invisibly) depending on which code path saw it, and the plugin contract
(_path/_filename stamping, capture spreading, extension routing) lived
only in folklore.
New packages/core/src/records/ module is the single owner:
- produceRecords(files, config): extension-routed transform +
authoritative source-context stamping (moved from schema.ts).
- validateRecords(records, config): ID validation + reference
validation; diagnostic text byte-identical to before (validation
snapshot suites unchanged).
- classifyPath(path, config) → { collection, captures } | undefined:
THE path→Collection matcher, with documented complete-path grammar
([name]suffix, *, recursive **) and case-insensitive extension
allowlisting. Stable interface for the future watch coordinator.
Consumers rewired: generateSchema's non-graph path,
buildContentGraph/patchContentGraph (watch reindex now applies path
captures instead of silently dropping them), export/json.ts (single
fetch; no more schema build as a validation side effect), and
source-filesystem's fetchPaths via a matchPath adapter isomorphic to
classifyPath (fixes ** blindness in the old exact-depth matcher; dead
getCaptureData deleted; no runtime core import added). Plugin contract
written down in types.ts (SourceContextFields, Transformer/Source doc
contracts) and "Record production" added to docs/glossary.md.
Test plan: new AVA suites for produce/validate/classify plus a
core-side parity test locking fetchPaths capture semantics to
classifyPath; regression tests cover exactly the cases the three old
matchers disagreed on. Full suite green: pnpm verify (243 AVA incl. 9
liveSchema reload tests + validation snapshots unchanged, 52 vitest).
Co-authored-by: Cursor <[email protected]>
Change-Id: If11d80de2f72869ee208feb0990f979e4ab7a48d
Collaborator
Author
|
This pull request is part of a Mergify stack:
|
This was referenced Jul 17, 2026
Merged
Collaborator
Author
|
@Mergifyio queue |
Contributor
Merge Queue Status
This pull request spent 19 minutes 50 seconds in the queue, including 3 minutes 16 seconds running CI. Required conditions to merge
|
Base automatically changed from
stack/tonyketcham/feat/unified-watch-effort-graph/loadconfig-returns-initialized--0bf57aa7
to
main
July 18, 2026 08:51
…graph/single-record-prod-module-owns-file-record-path--f11d80de
tonyketcham
deleted the
stack/tonyketcham/feat/unified-watch-effort-graph/single-record-prod-module-owns-file-record-path--f11d80de
branch
July 18, 2026 08:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
"File → validated Record" had three parallel VFile→EntryNode
implementations and three divergent path→Collection matchers spread
across schema.ts, contentGraph.ts, export/json.ts, and
source-filesystem. A file could be classified differently (or
invisibly) depending on which code path saw it, and the plugin contract
(_path/_filename stamping, capture spreading, extension routing) lived
only in folklore.
New packages/core/src/records/ module is the single owner:
authoritative source-context stamping (moved from schema.ts).
validation; diagnostic text byte-identical to before (validation
snapshot suites unchanged).
THE path→Collection matcher, with documented complete-path grammar
([name]suffix, *, recursive **) and case-insensitive extension
allowlisting. Stable interface for the future watch coordinator.
Consumers rewired: generateSchema's non-graph path,
buildContentGraph/patchContentGraph (watch reindex now applies path
captures instead of silently dropping them), export/json.ts (single
fetch; no more schema build as a validation side effect), and
source-filesystem's fetchPaths via a matchPath adapter isomorphic to
classifyPath (fixes ** blindness in the old exact-depth matcher; dead
getCaptureData deleted; no runtime core import added). Plugin contract
written down in types.ts (SourceContextFields, Transformer/Source doc
contracts) and "Record production" added to docs/glossary.md.
Test plan: new AVA suites for produce/validate/classify plus a
core-side parity test locking fetchPaths capture semantics to
classifyPath; regression tests cover exactly the cases the three old
matchers disagreed on. Full suite green: pnpm verify (243 AVA incl. 9
liveSchema reload tests + validation snapshots unchanged, 52 vitest).
Co-authored-by: Cursor [email protected]
Depends-On: #208