fix(memory-ingest): switch writer to gbrain put, retire legacy put_page#1341
Open
AZ-1224 wants to merge 1 commit intogarrytan:mainfrom
Open
fix(memory-ingest): switch writer to gbrain put, retire legacy put_page#1341AZ-1224 wants to merge 1 commit intogarrytan:mainfrom
gbrain put, retire legacy put_page#1341AZ-1224 wants to merge 1 commit intogarrytan:mainfrom
Conversation
…_page` gbrain v0.27 retired the flag-based `put_page --slug X --title Y` form for the positional `put <slug>` (content via stdin, YAML frontmatter for metadata). Against any current gbrain, the writer returned `[put-error] Unknown command: put_page` for every page; bulk ingest produced 0 successful writes. Switch `gbrainPutPage` to `gbrain put <slug>`, injecting `title`/`type`/`tags` as YAML frontmatter when the page body does not already start with one (the transcript builder already prepends frontmatter on its own; artifact pages get the writer-side injection). Also bump `gbrainAvailable()` to probe `gbrain --help` for the `put` subcommand. If a future gbrain renames or removes it, every page now fails fast with one clean error instead of N copies of "Unknown command". Regression coverage: two new tests in `test/gstack-memory-ingest.test.ts` stand up a fake `gbrain` shim on PATH. The first asserts the writer hits `put <slug>` with stdin body + frontmatter and never invokes `put_page`; the second points the writer at a legacy-only shim and asserts the availability probe surfaces a single missing-subcommand error. Tested on gbrain v0.27.0 (61/62 pages ingested cleanly post-patch; the one failure was a within-batch slug collision unrelated to the writer). Reproduced by: bun ~/.claude/skills/gstack/bin/gstack-memory-ingest.ts --bulk # before: every page errors `[put-error] ... Unknown command: put_page` # after: pages land via `gbrain put <slug>`
9 tasks
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.
Summary
bin/gstack-memory-ingest.tscalls the legacy flag-basedgbrain put_page --slug X --title Y --type Z --tags Tform. gbrain v0.27 retired it for the positionalput <slug>(content via stdin, YAML frontmatter for metadata). Against any current gbrain, every page errors[put-error] ... Unknown command: put_pageand bulk ingest produces 0 successful writes.This PR:
gbrainPutPageto invokegbrain put <slug>, injectingtitle/type/tagsas YAML frontmatter when the page body does not already start with one. The transcript builder already prepends frontmatter; the writer-side injection only fires for raw artifact pages.gbrainAvailable()to probegbrain --helpfor theputsubcommand. If a future gbrain renames or removes it, the script fails fast with one clean error rather than N copies of "Unknown command: ...".test/gstack-memory-ingest.test.tsthat stand up a fakegbrainshim on PATH:gbrain put <slug>with stdin body + frontmatter and never invokesput_page.puterror from the availability probe.Scope is intentionally tight: one function rewrite, one availability probe, two tests. No refactor of the writer abstraction.
Repro (before the fix)
Verified
bun test test/gstack-memory-ingest.test.ts— 17/17 pass (15 existing + 2 new regression tests).Notes
V1.5 NOTEblock at the top of the file referencedput_pagein prose. Updated to describe the currentgbrain put <slug>(stdin, frontmatter) shape so the doc stays accurate; the futureput_fileblob-routing TODO is unchanged.// ── Writer (calls gbrain put_page) ──updated to// ── Writer (calls \gbrain put`) ──`.Test plan
bun test test/gstack-memory-ingest.test.tspasses--bulkrun on a real gbrain v0.27.0 install ingests pages successfullyput_page(verified: rolling back the writer makes the new test fail)Need help on this PR? Tag
@codesmithwith what you need.