Repository navigation
refactor(vault): resize VaultProvider to note-file operations - #123
Merged
Merged
Conversation
Move sortCounts, READ_BATCH_SIZE, and the frontmatter scan out of FsVaultProvider into src/lib/obsidian/vault-aggregates.ts as listTags(reader) and listProperties(reader). The module lives under src/lib/ because computeVaultOverview does, and nothing under src/lib/ may import src/modules/. FsVaultProvider.listTags / listProperties delegate for now, so nothing outside the module changes yet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…alone
ComputeVaultOverviewDeps narrows to { reader, graph, readConventions } and
calls listTags/listProperties directly, so the overview no longer needs a
VaultProvider. Both callers — the get_vault_overview tool and the
vault://overview resource — stop passing entry.provider in the same commit.
The four overview suites now seed tags and properties through the reader
instead of stubbing provider aggregates. headless-overview.test.ts gains a
parity case pinning the full snapshot literal captured from the
provider-backed implementation over the same vault, field for field and order
for order.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Drop listTags / listProperties from the VaultProvider interface and from FsVaultProvider, leaving the six methods that each open exactly one note file over the vault root. The list_tags and list_properties tools now call the vault-aggregates free functions with entry.reader. Ships with every call site the type change breaks, in one commit: the makeProvider stub in test/operations/tools/_helpers.ts plus the three further VaultProvider stubs in server-modules, operations-module, and tools tests, and the two inert `as never` provider stubs in the prose suites. The two disk suites move to test/lib/obsidian/ and retarget to the free functions rather than being deleted — they pin ~25 YAML- and disk-level cases (scalar tags, '#alpha' stripping, empty tags: [], broken frontmatter, nested-object and array properties, >32-note batching) that a fake reader cannot reach. The scope-exclusion cases in vault-scope-e2e.test.ts retarget the same way, keeping their real scoped FsVaultReader. Also sweeps OperationsToolHandlers and the seven *ToolInput types that existed only to feed it — dead since the tool builders took over. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Refs #114 — group 2 of 3 for
consolidate-vault-writes(PR 1 was #122).VaultProvidersheds its two vault-wide aggregates and is left with the sixmethods that each open exactly one note file over the vault root.
listTagsandlistPropertiesbecome free functions over aVaultReaderinsrc/lib/obsidian/vault-aggregates.ts— undersrc/lib/becausecomputeVaultOverviewis, and nothing undersrc/lib/may importsrc/modules/.list_tags,list_properties, andget_vault_overviewreturn identicalpayloads. Only the call site moved. No schema, output shape, or error-code
change.
Commits
derive tag and property aggregates from the reader— newvault-aggregates.ts; the provider delegates for now, so nothing outside themodule changes.
compute the vault snapshot from reader and graph alone—ComputeVaultOverviewDepsnarrows to{ reader, graph, readConventions },with both callers (the
get_vault_overviewtool and thevault://overviewresource) updated in the same commit.
resize VaultProvider to note-file operations— the type change, withevery call site it breaks.
Payload parity is pinned, not assumed
headless-overview.test.tsgains a case asserting the full overview literal —every field, in order — captured from the provider-backed
computeVaultOverviewover that exact vault before the aggregates moved.Two deviations from the plan's Group 2 text
The two
fs-vault-providerdisk suites are retargeted and moved, notdeleted. The plan called them superseded by the new fake-reader suite. They
are not: between them they pin ~25 YAML- and disk-level cases a fake reader
cannot reach — scalar
tags:,'#alpha'stripping, emptytags: [], brokenfrontmatter, nested-object and array-valued properties, >32-note batching,
nested folders. They now live in
test/lib/obsidian/asvault-aggregates-{tags,properties}-disk.test.ts, driving the free functionsover a real
FsVaultReader, every case preserved verbatim. The newvault-aggregates.test.tscovers aggregation semantics plus the reader-errorbranch that disk tests cannot reach.
Scope exclusion needed no relocation. The plan said to move that case out of
fs-vault-provider/list-tags.test.tsintoheadless-overview.test.ts. It wasnever there — it lives in
vault-scope-e2e.test.ts, which already builds a realscoped
FsVaultReader. Those two cases retarget to the free functions in place.Every retargeted assertion was checked case by case against what it asserted
before; the suite count is unchanged at 1371 because nothing was dropped.
Call sites the plan did not list
The typecheck gate found three further
VaultProviderstubs beyondtest/operations/tools/_helpers.ts— inserver-modules.test.ts,operations-module.test.ts, andtools.test.ts— plus two inertas neverstubs in the prose suites. All resized in the same commit as the type change.
Dead-code sweep
src/modules/operations/types.tscarriedOperationsToolHandlers, whose lastconsumer went away in group 1. Removed, along with the seven
*ToolInputtypesthat existed only to feed it (
CreateNoteToolInput,EditNoteToolInput,ReadNotesToolInput,ReadDailyToolInput,RemovePropertyToolInput,ListTagsToolInput,ListPropertiesToolInput).SetPropertyToolInput,ContentMode, and theReadNotesResult*types stay — all still live.Acceptance
grep -rn "function makeProvider" test/→ exactly two: the stub intest/operations/tools/_helpers.ts, the real-module builder intest/operations/fs-vault-provider/_helpers.ts.grep -rn "implements VaultProvider" src/→ one,FsVaultProvider.VaultProviderhas six methods.listTags/listPropertiesinsrc/appear only invault-aggregates.ts,vault-overview.ts, and the two list tools — none invault-provider.tsorfs-vault-provider.ts.npm test(1371 passed),npm run lint,npm run typecheck,npm run buildall pass.
Group 3 (the ADR and the docs sweep) follows after review.
🤖 Generated with Claude Code