Skip to content

fix(read): surface bare index id, not file stem, on the read path (U1b)#2

Merged
JustMaier merged 1 commit into
mainfrom
fix/decorated-id-read-path
Jul 3, 2026
Merged

fix(read): surface bare index id, not file stem, on the read path (U1b)#2
JustMaier merged 1 commit into
mainfrom
fix/decorated-id-read-path

Conversation

@JustMaier

Copy link
Copy Markdown
Owner

Follow-up to #1. Issue 1 routed id derivation through id_for_path on the write/index side, but the read path still took id from the file stem: Collection::get/list and typed get_document/list_documents returned read_document's stem id, so get_dynamic/list_dynamic (and validate_all, doc_to_json) reported {id}-{title} — breaking ref JOINs keyed on the bare id and forcing consumers back to bare {id}.md.

Fix: all four read sites already fetch the authoritative index record; use record.id for the returned Document instead of the file stem. Views need no change (they read the index table, already correct).

Found by Donovan's live worker probe against main (2d08aee). Verified: reviewed by liz + arabella; Donovan's app-level ref-JOIN round-trip green against this branch (insert/list/get ids all equal the bare ulid, JOIN populates).

+1 regression test (dynamic get, dynamic list, typed get for a decorated {id}-{title}.md schema). 147 grounddb / 169 workspace green, 0 new warnings.

🤖 Generated with Claude Code

Issue 1 routed id derivation through id_for_path on the write/index side
(insert, boot scan, watcher reindex, delete guard), so the documents index
holds the bare id for a decorated path like {id}-{title}.md. But the READ
path still took the id from the file stem: Collection::get/list and the
typed get_document/list_documents returned read_document's stem-derived id,
so get_dynamic/list_dynamic (and validate_all, doc_to_json) reported
"{id}-{title}" as the id. Downstream ref JOINs key on the bare id, so a
decorated stem produced an empty view — forcing consumers back to bare
{id}.md filenames.

Fix: all four read sites already fetch the authoritative index record; use
record.id for the returned Document instead of the file stem. Views need no
change — they read the documents index table, whose id column was already
correct.

Found by Donovan's live worker probe against main (2d08aee). Adds a
regression test asserting get_dynamic, list_dynamic, and the typed read all
return the bare id for a decorated {id}-{title}.md schema.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JustMaier
JustMaier merged commit 0407e1e into main Jul 3, 2026
1 check passed
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