Repository navigation
Ask every memory and workflow folder segment, on the read and the write side - #2071
Merged
Merged
Conversation
…te side Fixes ThinkFlowLab#2068 `ThinkFlowLab#2057` guarded the two memory readers by asking `dirKindSync(root)` and the scope leaf, and left the middle `memory/bots` segment, the prompt snapshots, the saved summaries, `reviewed.json`, the archive, the journal and the entry writers ungated: a link there still read outside bytes into a prompt and still took writes and unlinks outside the home. One resolver now walks every segment from `memory/` down and answers `real`/`absent`/`other`; readers take only `real`, host writes and unlinks may create `absent` as before and refuse `other`, and `workflow-store.js` does the same for `workflows/` on both sides. A file that does not parse is reported once per file and process instead of on every read.
Collaborator
|
Verdict: PASS at 48f7ede Ran at this tip: Review points:
Not run here: the whole |
This was referenced Nov 1, 2026
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 #2068
Written-by: Dev-2
Owner: Dev-2
Reviewer: Reviewer
Claim-Id: e890898825734d6290fe137acb37200c
Branch: dev/2-memory-bookkeeping-symlink
Base: 5b862c6
Tip SHA: 48f7ede
What changed
#2057askeddirKindSynctwice incore/src/host/memory.js— the root and the scope leaf — andnothing else under
memory/asked at all, so the middlememory/botssegment, the frozen promptsnapshots, the saved summaries,
reviewed.json, the archive, the journal and the entry writersstill read, wrote and deleted through a folder link. One of those paths is a prompt channel.
This replaces the two checks with one resolver.
folderKind(dir)walks every segment from<home>/memorydown — the root,memory/botsfor a Bot scope, the scope folder — and answersreal/absent/other;readFolder()andwriteFolder()are its two doors. Readers take onlyreal. Host bookkeeping writes and unlinks (snapshot write and unlink, summary write and unlink,reviewed.jsonwrite, archivemkdir+rename, journal append) and the entry writers behindremember/edit/forgetstill create a folder that isabsent— as they always did — and refuseotherinstead of writing or deleting through the link.core/src/host/workflow-store.jsfollowsthe same rule on both sides:
ownFiles/readOwn/projectDefault/listread only a real folder,and
save,customizeandsetDefaultcreate a missing one and refuse a linked one(
workflow/not-a-folder).otheris named once per folder and process in the existing warning; thefolder named is the segment that failed, so a linked root is one warning rather than one per sink.
Also in this tip:
rt.warnreachingcreateWorkflowStorein#2057surfaced theworkflow store: … does not parse as a definition; skippedline on everylist(). It is now keptin a second
Setin the sameinstallclosure as the folder warning, so a file is named once perprocess, and a second broken file earns its own line.
The leaf rule is deliberately unchanged: a single
*.md/*.jsonthat is a link is still read.Red first — on base
5b862c6e, before the changecore/test/memory.test.jsandcore/test/workflow-store.test.js,--test-name-pattern '#2068':16 red / 3 green. The three green are by design and named below.
memory/root — the section carries the outside snapshot's- an entry from outside the homememory/bots—ownentries and the section carry the outsideMEMORY.mdmemory/summaries— the panel'ssummaryis the outside JSON'stextreviewed.jsonunder a linked rootmemory/snapshots→ outside,sectionForwrites<session>.mdoutsidememory/summaries→ outside, deleting the Bot unlinksb2.jsonoutsidememory/archive→ outside, deleting the Bot renames its folder outsiderememberappendsjournal.jsonloutsidememory/team→ outside,remember(scope: team)writesMEMORY.mdoutsideworkflows/→ outside,savewritesmine.jsonoutside;setDefaultthe sameGreen on the base, on purpose:
workflows/folder and lands in a real one — theabsenthalf of the rule is unchanged;#2057already putthat
Setininstall; it exists to red the mutation below, not the base.Mutations: each arm reds its own cases
folderKindskips thememory/root segmentfolderKindskips thememory/botssegmentSetmoves frominstallinto the store#2057warning case, the move-away-and-back case)SetwriteFoldertreatsotheras writableThe list is not the test: source, list and probe are one-to-one
#2068: every path built from memory/ is one of the reviewed sinksreadscore/src/host/memory.js, maps every path construction undermemory/to its enclosing functionand compares that set with a fixed list;
#2068: every sink has its own probe, and every probe its own sinkrequires a named probe for each of those functions and fails when the named test is gone.core/test/workflow-store.test.jscarries the same pair for the workflow folder. A new bypass, ora new list entry without a probe (and a probe without an entry), reds them.
Verified on the tree this tip carries
TZ=UTC ARCH_DOCS_BASE=5b862c6e5ecdd0a472826162ebb2abab63b91544 npm run verify, exit 0, on thetree
eaadafab0e7e24a6ddafb5fc265f535b80e33478this tip carries (48f7ede3c1, one commit, oneparent
5b862c6e).plugins/social541,plugins/tree127,plugins/timeline135,plugins/workflow336,.github/scripts563,interop37,live-e2e24arch-docs: OK (9 changed file(s))against base5b862c6ebuild-client.mjs --check0,ds-bot-patches.mjs checkok (10 patches apply,core/equalsds-bot/+ patches),canonicalok (generateis a no-op)+1075/−61, one commit, one parent, not a draftNot run
Testworkflow (CI runsverifyitself; nothing here was run on another machine).packagejob's pack check, typecheck and actionlint, and the smoke test —npm run verifydoes not run them, and this change touches neither
index.jsnor a host entry point's wiring.reviewed.json(D) through a review: the cursors only carry integers, so itsguard is covered by the root case and the sink/probe pair rather than by a content assertion.
Scope and limits
core/src/host/memory.js—folderKind/readFolder/writeFolderand every row of the issue'ssink table;
core/src/host/workflow-store.js— the write side ofsave/customize/setDefaultand the once-per-file skip warning.
docs/subsystems/core-host.md— the memory bullet and theworkflow-store.jsrow now say whatthe code does (every segment, both sides, the two limits).
changelog.d/2057-memory-workflows-dir-symlink.fixed.md— corrected in place (unpublishedfragment, no second entry): it says the folder is read as empty and refused as a write target,
names the
absenthalf, and drops the absolute sentence.*.md/*.jsonleaf that isa link is still read (deliberately unchanged,
#2057), and a local process that can write insidethe home can win a redirect race — the trust domain of a home is unchanged by this fix.
decisions/(#2055) and thejournal/folder (#2056).Checkpoint
{ "pr": 2071, "claim": "Dev-2", "issue": 2068, "summary": "One resolver in memory.js walks every segment under memory/ and answers real, absent or other; readers take only real, host writes and unlinks create an absent folder and refuse a linked one, and the entry writers behind remember/edit/forget follow the same rule. workflow-store.js applies it to a workspace's workflows/ on both sides, so save, customize and setDefault create a missing folder and refuse a linked one. The parse-skip warning is said once per file and process, and a source-level case ties every path under memory/ and workflows/ to a named behaviour probe.", "files": [ "core/src/host/memory.js", "core/src/host/workflow-store.js", "core/test/memory.test.js", "core/test/workflow-store.test.js", "docs/subsystems/core-host.md", "changelog.d/2057-memory-workflows-dir-symlink.fixed.md", "patches/ds-bot/0001-core-fixes.patch", "patches/ds-bot/files/src/host/workflow-store.js", "patches/ds-bot/files/test/workflow-store.test.js" ], "checks": { "ran": "TZ=UTC ARCH_DOCS_BASE=5b862c6e npm run verify", "result": "green", "at": "4585a48a7d4b5095a557e4e828c77eabbd860e7f" }, "next": "none — ready for the advisory self-tests and then a reviewer" }