feat(parser): reusable source-set framework#877
Open
mariusvniekerk wants to merge 6 commits into
Open
Conversation
Collaborator
Author
|
This change is part of the following stack:
Change managed by git-spice. |
This was referenced Jun 26, 2026
Introduce the SourceSet bases (JSONL, directory JSONL, single-file, multi-session container, sibling-metadata, SQLite fan-out), the functional with*() option set, the generic SourceSet provider/factory plumbing, and the virtual-path and source-identity helpers up front, so every provider migration constructs its source set through options instead of a struct literal.
SQLiteFanoutSourceSet had no production callers -- it was referenced only by its own definition and duplicated multiSessionContainerSourceSet. The package-level helpers it relied on (cleanJSONLRoots, addJSONLSource, sortJSONLSources, and friends) are defined and used elsewhere, so removing it orphans nothing.
… order pathIsUnderRoot took (path, root), reversing the root-first convention used by pathUnderRoot(root, candidate) and relUnder(dir, child). Its only caller already had root and path available, and pathUnderRoot has the same containment semantics (root==path is not "under"; rejects ".." escape; handles trailing separators via filepath.Clean). Drop the duplicate and repoint the caller so all containment checks share one root-first helper.
Providers whose transcript freshness depends on a sidecar file had no base-level hook: only the SiblingMetadataSourceSet wrapper handled companions, forcing a separate wrapper type instead of a plain option. Add withCompanionFiles(transcriptPath -> companions) so the JSONLSourceSet base folds companions into the three places they matter: their basenames join the watch-plan include globs, their size/mtime (and content when hashing is enabled) fold into the SourceFingerprint, and a changed companion path maps back to its owning transcript so a sidecar write re-parses the session. The wiring reuses the existing sibling-metadata helpers rather than adding a third independent sidecar mechanism.
writeSourceFile and the generic source-set tests were introduced by the qwenpaw migration but are framework-level helpers used by ~20 provider test files. Placing them on the source-set-framework branch lets every family branch build its tests.
The reusable source-set scaffolding (functional options, source-set constructors, and the generic source-set provider/factory) was unexported. Because providers don't consume it until higher branches in the stack, staticcheck's unused linter flagged ~62 of these symbols as dead at every mid-stack branch, and the always-run golangci-lint pre-commit hook failed on each such commit. Exporting the API makes the unused analyzer ignore them (it never reports exported identifiers), eliminating the spurious findings stack-wide with no import cycle.
roborev: Combined Review (
|
2419b16 to
b2aa4b8
Compare
37dc43b to
f708cf2
Compare
roborev: Combined Review (
|
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.
Adds the reusable source-set bases and functional options that concrete providers compose for discovery, lookup, fingerprinting, and changed-path classification. The framework symbols are exported so they can be consumed across the package without tripping unused-symbol lint at intermediate branches in the stack.
Also adds the
WithCompanionFilesoption, unifies the path-under-root helper onto a single root-first signature, and removes the deadSQLiteFanoutSourceSet.Where to look:
internal/parser/jsonl_source_set.go,single_file_source_set.go, and the source-set base types.