Skip to content

refactor(storage): add context offload root authority - #4165

Merged
likun666661 merged 2 commits into
mainfrom
refactor/context-offload-root-authority
Aug 29, 2026
Merged

refactor(storage): add context offload root authority#4165
likun666661 merged 2 commits into
mainfrom
refactor/context-offload-root-authority

Conversation

@likun666661

Copy link
Copy Markdown
Member

Summary

  • Add the authenticated, interactive Storage Root write facade for the SQLite context-offload Store.
  • Single-flight one writer per authentic write lease and bind that writer to one immutable limits snapshot; a second open cannot silently change owner caps or Session/workspace quotas.
  • Snapshot caller-owned bytes, owner identities, and copy-reference arrays before the asynchronous lease check, so mutations after admission cannot change the accepted operation.
  • Drain admitted operations during close, reject new work after close or root revocation, and serialize close/reopen so two SQLite writer handles cannot overlap for one lease.

This is a stacked, storage-only follow-up to #4159. Its base is refactor/context-offload-bounded-lifecycle; it should be rebased to main after #4159 merges.

The facade remains internal to @maka/storage in this slice. It is intentionally not published as a package subpath and not added to StorageWriterComposition until a real reader-first consumer lands, so this PR does not open the database during Host Ready or emit new durable references.

Refs #4071
Depends on #4159

Verification

  • npm --workspace @maka/core run build
  • npm --workspace @maka/storage run build
  • NODE_NO_WARNINGS=1 node --test packages/storage/dist/__tests__/context-offload-store.test.js packages/storage/dist/__tests__/sqlite-context-offload-store.test.js — 20/20 pass
  • NODE_NO_WARNINGS=1 node --test --test-reporter=dot "packages/storage/dist/**/*.test.js" — full storage suite passes
  • npx biome check on all changed TypeScript files
  • npm run check:asf-headers

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool and scope: OpenAI Codex contributed repository inspection, authority-boundary design, implementation, tests, and PR text. The commit includes the required Generated-by trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes
  • No — the new authority remains unwired to production consumers

Base automatically changed from refactor/context-offload-bounded-lifecycle to main August 29, 2026 10:48
@likun666661
likun666661 force-pushed the refactor/context-offload-root-authority branch from 1b04f66 to b9662fb Compare August 29, 2026 10:49

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@likun666661
likun666661 merged commit e520561 into main Aug 29, 2026
2 checks passed
@likun666661
likun666661 deleted the refactor/context-offload-root-authority branch August 29, 2026 11:07
saltand pushed a commit to saltand/maka-agent that referenced this pull request Aug 31, 2026
* refactor(storage): add context offload root authority

Generated-by: OpenAI Codex

* test(storage): cover concurrent context offload opens

---------

Co-authored-by: likun <kunli@alva.xyz>
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.

2 participants