fix(memory-ingest): store the normalized git_remote so unattributed pages hit the policy filter

buildTranscriptPage wrote the normalized '_unattributed' sentinel into the page FRONTMATTER but stored the raw resolved remote ('' when unresolvable) on the page object. The policy filter fast-paths !p.git_remote, so under --include-unattributed an explicit '_unattributed → deny' (or read-only) policy never applied to exactly the pages it names — they ingested unpoliced. The stored value now matches the frontmatter.

Regression test (fails on v1.68.3.0): seeds the REAL bin/gstack-gbrain-repo-policy store with '_unattributed → deny' through its own set verb, ingests an unresolvable-remote session with --include-unattributed, and asserts nothing reaches gbrain — pre-fix the '' remote bypassed the filter and the import ran. A fake echoing tiers would pass on both sides of the fix; the real helper prints 'none' for unknown keys, so only a genuinely applied deny distinguishes the two.

Fixes #2353
This commit is contained in:
Garry Tan
2026-08-22 02:11:30 +00:00
parent 1cbb3cbfd6
commit 88209d542a
2 changed files with 43 additions and 1 deletions
+5 -1
View File
@@ -788,7 +788,11 @@ function buildTranscriptPage(path: string, session: ParsedSession): PageRecord {
source_path: path,
session_id: session.session_id,
cwd: session.cwd,
git_remote: remote,
// Store the normalized sentinel, matching the frontmatter above: a raw ""
// is falsy and slid through the policy filter's !p.git_remote fast-path,
// so under --include-unattributed a `_unattributed → deny` policy never
// applied to exactly the pages it names (#2353).
git_remote: remote || "_unattributed",
start_time: session.start_time,
end_time: session.end_time,
partial: session.partial,