mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-13 16:03:04 +08:00
test+fix(memory-ingest): strengthen regression tests, fix inject for malformed-close frontmatter
Imports the shim-based regression tests from PR #1341 (Alex Medina) and strengthens them to assert title, type, and tags actually arrive in put stdin — not just `agent: claude-code`. Asserting the metadata fields matches the regression class that's caused this fix wave: writers can "succeed" while metadata is silently lost. The original PR #1341 tests would have passed even with title/type/tags missing. Strengthening the test surfaced a deeper issue. buildTranscriptPage joins frontmatter array elements with "\n" and does not append a trailing newline, so the close fence is "\n---<content>" directly, not "\n---\n". PR #1328's inject branch searched for "\n---\n" and never matched — which means even with PR #1328 alone, transcript pages were landing in gbrain with no title/type/tags. Two-line fix: search for "\n---" only, since the inject lands before the close fence regardless of what follows it. Also imports PR #1341's V1.5 NOTE doc-block update and the section comment refresh so the prose stays accurate against the new writer shape. Co-Authored-By: Alex Medina <oficina@puntoverdemc.com>
This commit is contained in:
@@ -786,7 +786,12 @@ function gbrainPutPage(page: PageRecord): { ok: boolean; error?: string } {
|
||||
// land in gbrain with empty title/type/tags.
|
||||
let body = page.body;
|
||||
if (body.startsWith("---\n")) {
|
||||
const end = body.indexOf("\n---\n", 4);
|
||||
// Locate the closing --- delimiter. buildTranscriptPage joins with "\n"
|
||||
// and does not append a trailing newline, so the close fence looks like
|
||||
// "...\n---" followed directly by body content (no "\n---\n" pattern).
|
||||
// Match the close on "\n---" only — the inject lands BEFORE the close
|
||||
// fence, inside the frontmatter block, regardless of what follows it.
|
||||
const end = body.indexOf("\n---", 4);
|
||||
if (end > 0) {
|
||||
const inject = [
|
||||
`title: ${JSON.stringify(page.title)}`,
|
||||
|
||||
Reference in New Issue
Block a user