Skip to content

M1 Phase 3: index contracts and batch-2 cards T-0009 to T-0020 - #4

Merged
bketelsen merged 6 commits into
mainfrom
m1/phase3
Oct 16, 2026
Merged

bketelsen merged 6 commits into
mainfrom
m1/phase3

Conversation

@bketelsen

@bketelsen bketelsen commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Phase 3 of plan 0003: the index contracts, and the batch-2 cards T-0009 to T-0020. No card has been run.

What's here

  • internal/markdown: Parse(note []byte) Doc, with the Doc types exactly as the spec's "Parse output" table defines them. It uses goldmark v1.8.6 (released 2026-09-03) with GFM, footnotes and an empty Obsidian extension. goldmark's link parser is wrapped to record where each link ends, because goldmark doesn't keep that. fixtures_test.go reads the spec's 14 ### F.. fixtures and compares a Doc part by part, so each parser card checks only its own fields. T-0002's 35 cases move into T-0011's given test, now over Parse.
  • 0001_init.sql, edited in place: files (with the lower-cased name that markdown.Resolve looks up), notes, props, tags, links (with dest_id, and a name that decides when a link must resolve again), headings, blocks, tasks, and versions, which outlive their file. notes_fts is FTS5 with stored content, plus a trigger so cascades remove its rows.
  • schema/rpc/note.yaml (callers local): 12 methods and durable changed/moved/removed events. vault.yaml gains status, reindex and a scan event. make gen has run.
  • Stubs: the engine answers every new method with unavailable until Phase 4. rpctest.Options.Note lets client tests use a fake. The store API exists as signatures with doc comments in files.go, index.go, search.go, queries.go and versions.go.
  • Cards T-0009 to T-0020 under docs/tasks/todo/: vaultgen realism plus the command, three parser cards, template expansion, five store cards and two notesctl cards. The plan's Phase 5 table gives their order.
  • Deleting a note (the plan's open question): the file is unlinked and a deletion version is recorded. Versions stay 30 days and note.revert restores the file. A delete names its base, and a stale one is refused, because an edit beats a delete. This follows from ADR-0003, ADR-0005 and ADR-0006, so there is no new ADR; it is recorded in the plan and in vault.md. notesctl write's input is settled too: stdin or --file, with --base required.

How it was checked

  • I checked each card in order in a scratch worktree of this branch merged with m1/cards (batch 1, since merged as feat: M1 batch 1, cards T-0004 to T-0008 #3). At each step the card's given tests and a reference implementation were in place on top of the previous cards' references, and both the acceptance command and make verify passed. The references are deleted.
  • The checks found mistakes in my own given tests, not in the spec, and I fixed them. One was four test names starting with TestIndexNote, which make test would skip; repocheck refused them. Writing the references also settled a few spec rules (tags at a block's start, empty link destinations, setext heading text), now written into docs/specs/markdown.md.
  • make verify exits 0 on this branch, stubs in place.
  • Not run: make ui-check. The nsl machine frostnotes doesn't exist on this host, so the regenerated app/src/rpc/gen/api.ts hasn't been type-checked.

Merging

🤖 Generated with Claude Code

bketelsen and others added 6 commits October 16, 2026 16:40
internal/markdown gets Parse and Doc as docs/specs/markdown.md's output
table defines them, goldmark v1.8.6 with GFM, footnotes and an empty
Obsidian extension, and a fixture reader for the spec's F fixtures.
0001_init.sql gains the index tables and notes_fts. schema/rpc/note.yaml
adds the note domain and vault.yaml the scan status and reindex; the
engine answers each new method unavailable until Phase 4.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
files.go, index.go, search.go, queries.go and versions.go hold the store
API that batch 2's cards implement, each with its doc comment and a body
that fails until its card lands. tags gains an ord column to keep a
note's tag order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Twelve cards for Phase 5, each checked in order against a reference on
top of the batch-1 cards with make verify green, the references then
deleted: realistic vaults and the vaultgen command; the three parser
cards (T-0002's 35 cases move into T-0011's given test, over Parse);
template expansion; five store cards; two notesctl cards that test
against a fake note service.

Plan 0003 resolves deleting a note (unlink, a deletion version, versions
kept 30 days, a stale base refused; no ADR, as it follows ADR-0003,
0005 and 0006) and notesctl write's input (stdin or --file, --base
required). The spec records the rules the references settled, and
vault.md the index as built.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	docs/plans/0003-m1-headless-vault.md
The planning session's measurements of T-0008's vaults (9 folders, about
300 bytes a note, 2 attachments and quoted dates, at 666 and at 5,000
notes) add two checks to T-0009's given test: every created: line is an
unquoted date, and attachments grow with the vault. The folder ceiling
at 100 notes rises to 25, since one seed of the reference reached 20.
Re-checked against the reference with make verify green.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bketelsen
bketelsen marked this pull request as ready for review October 16, 2026 21:13
@bketelsen
bketelsen merged commit 1124b49 into main Oct 16, 2026
4 checks passed
@bketelsen
bketelsen deleted the m1/phase3 branch October 17, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant