Repository navigation
fix(sync-gbrain): thread GSTACK_MEMORY_INGEST_SOURCES through as --sources - #2997
Closed
harshitgavita-07 wants to merge 1 commit into
Closed
harshitgavita-07 wants to merge 1 commit into
harshitgavita-07 wants to merge 1 commit into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
Contributor
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.
Fixes #2922
Problem
runMemoryIngest()inbin/gstack-gbrain-sync.tsbuilds thegstack-memory-ingestchild argv as["run", ingestPath, "--bulk"|"--incremental", ("--quiet")?]and never appends--sources. Since the ingest script defaults to walking every memory type (ALL_TYPES) and only narrows via that flag, a brain that also registers the curated~/.gstacktree as a federated git-backed source gets a second copy of every design doc, eureka, learning and timeline written into thedefaultsource on every sync. Deleting the duplicates doesn't help; the next full walk recreates them.Fix
Thread a new
GSTACK_MEMORY_INGEST_SOURCESenv var through as--sources:resolveMemoryIngestSources()(exported, next toresolveStageTimeoutMs) parses the comma-separated value, validates tokens against the ingest types, drops unknown ones with a stderr warning, and falls back to a full walk (not a stage failure) when nothing valid remains.runMemoryIngest()appends--sources <subset>to the child argv when the env names a valid subset. Unset/empty keeps today's behavior.MEMORY_INGEST_TYPESmirrors the ingest script'sALL_TYPES; a test pins the two lists together so a new memory type can't silently drift.This follows the issue's suggested minimal fix (a config key threaded through as
--sources), using the repo's existingGSTACK_*env-var convention, e.g./sync-gbrainoperators can now runGSTACK_MEMORY_INGEST_SOURCES=transcriptto stop re-duplicating curated pages instead of hand-invoking the ingest script.Verification
test/regression-2922-memory-ingest-sources.test.ts: 10 tests covering unset/empty, valid subsets, trimming, dedup, unknown-token filtering, all-invalid fallback, the--sourcesargv wiring, and the ALL_TYPES drift guard. All pass.bun test test/gstack-gbrain-sync.test.ts test/regression-1611-gbrain-sync-resume.test.ts test/gbrain-sync-skip.test.ts— 92/92 pass.