8000 feat(workspace): add opt-in workspace foundation by simon-inkie · Pull Request #36 · simon-inkie/inkie-the-brain · GitHub
[go: up one dir, main page]

Skip to content

feat(workspace): add opt-in workspace foundation - #36

Merged
simon-inkie merged 4 commits into
mainfrom
feat/workspace-foundation
Nov 20, 2026
Merged

simon-inkie merged 4 commits into
mainfrom
feat/workspace-foundation

Conversation

@simon-inkie
@simon-inkie simon-inkie commented Nov 17, 2026 •
Copy link
Copy Markdown
Owner

Adds an opt-in workspace foundation with versioned roots, confined paths, authored and derived memory separation, validated provenance, and read-only context helpers. The build produces standalone workspace bundles; runtime integration follows separately. Existing legacy behaviour and public fixes are preserved.

Era level and coverage now follow the selected validated generation, including observer-first recovery after missing metadata or authored changes. Read-only access preserves persisted files and counters.

Validation: 550 tests passed, one platform skip across 43 files; build and authoritative typecheck passed. Independent source review and committed verification passed, with 184 additional API assertions and meaningful parent/removal controls. The corrective CodeRabbit review completed with zero findings. Privacy, licence and boundary checks passed.

Linux evidence is qualified by the documented filesystem and serial-refresh limits. Native macOS and Docker acceptance are pending CI; synthetic platform checks do not replace them. No migration or runtime cutover is included.

Refs #19.


Devin Review

Simon added 4 commits November 17, 2026 16:42
Signed-off-by: Simon <simon@inkie.ink>
Signed-off-by: Simon <simon@inkie.ink>
Signed-off-by: Simon <simon@inkie.ink>
@devin-ai-integration devin-ai-integration Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

Devin Review

Comment thread core/workspace.ts
Comment on lines +91 to +93
if (!inside(root,path,true)) fail('PATH_ESCAPES_ROOT','declared path escapes root');
if (seen.has(path)) fail('PATH_DUPLICATE','declared paths share a canonical target');
seen.add(path); if ((WORKSPACE_PATH_NAMES as readonly string[]).includes(name)) paths[name as WorkspacePathName] = path;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Authored state overwritten by overlapping roots

loadWorkspace accepts silos inside local/brain/state/silos, allowing derived paths to equal authored memory paths. A refreshDerivedMemoryState call then overwrites authored state instead of creating a disposable copy.

Learn more

Canonical root equality checks do not establish separation between authored and disposable storage. With paths.local = "device" and paths.silos = "device/brain/state/silos", both roots are distinct and pass validation. For memory under device/brain/state/silos/finch/memory, derivedMemoryPaths returns that same memory directory for disposable leaves. The refresh consequently replaces authored state with its computed runtime view.

Example: An authored live-state file contains only {"hotReflectionCount":4}. Refreshing live state writes defaults, runtime fields, and the configured-hot receipt into that authored file rather than a separate local copy.

Recommended fix: Validate canonical separation between authored roots and the disposable localBrain subtree before accepting a workspace, and preserve that separation during identity revalidation. Add a regression for nested roots that verifies refusal before any authored bytes change.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread core/workspace-fs.ts
const current = entryExists(target) ? lstatSync(target) : undefined;
if (before ? !current || !sameIdentity(before, current) : current !== undefined)
fail('WORKSPACE_IDENTITY_CHANGED', 'derived target changed before replacement');
if (bytes === null) unlinkSync(`/proc/self/fd/${parentFd}/${leaf}`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Derived deletion leaves dangling symlinks

For symlink-backed era or provenance files, atomicDerivedSync deletes the target but leaves a dangling link. Subsequent refreshDerivedMemoryState operations reject that link with PATH_DANGLING, blocking refresh and rendering.

Learn more

Final-file symlinks to confined regular files are accepted for derived operations. Deletion uses the canonical target's parent and leaf, so it removes the target without removing the original symlink. canonicalLoose then rejects the remaining entry as dangling. Refresh always removes existing provenance before replacing an era generation, so a valid symlink-backed receipt can make the operation invalidate its own future path checks.

Example: A derived provenance entry points to a valid JSON file under local/brain/cache. After authored era input changes, refresh deletes that cache file but leaves the provenance symlink. Publishing the replacement receipt fails with PATH_DANGLING, and later memory reads fail on the same entry.

Recommended fix: Give derived deletion explicit final-symlink semantics that leave the requested entry absent, not dangling. Retain and validate the requested entry's parent and identity before unlinking it. Add refresh regressions for symlink-backed provenance and deletion of symlink-backed era files, including successful subsequent reads.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +1 to +3
# Workspace foundation

Issue: #19
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Workspace handover outside required SPEC layout

The new handover uses a flat file instead of the per-issue folder required by the SPEC rules.

Learn more

The repository requires non-trivial changes to keep their SPEC in an issue-and-branch-named directory, with the document named SPEC.md. The current flat document does not follow that layout.

Example: A contributor looking for .specs/19-workspace-foundation/SPEC.md cannot find the workspace handover there.

Recommended fix: Move the document into the required per-issue directory and update references to its previous location.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@simon-inkie
simon-inkie merged commit cf3d175 into main Nov 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0