Skip to content

refactor(storage): own structured mutation commit effects - #2194

Merged
Jurij89 merged 3 commits into
fix/2162-close-leased-raw-mutationsfrom
refactor/2188-storage-owned-mutation-effects
Aug 9, 2026
Merged

refactor(storage): own structured mutation commit effects#2194
Jurij89 merged 3 commits into
fix/2162-close-leased-raw-mutationsfrom
refactor/2188-storage-owned-mutation-effects

Conversation

@Jurij89

@Jurij89 Jurij89 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Move structured-mutation graph-effect interpretation behind one pure Storage-owned effect snapshot.
  • Capture the canonical touched graph set and structural no-op classification before the first await, so caller mutation cannot redirect cache invalidation after a backend commit.
  • Keep execution in the existing Agent invalidation wrapper and apply effects only after successful potentially-mutating operations; structural no-ops and failures do not churn the Context Graph projection cache.
  • Keep the existing structuredMutation capability and public helper exports intact; this adds no callback runner, capability protocol, wrapper layer, scheduler work, or background component.

Related Work

Data Flow

sequenceDiagram
    participant A as Agent cache wrapper
    participant S as Pure Storage effect model
    participant B as Structured mutation backend
    A->>S: capture effects from mutation
    S-->>A: frozen scope and no-op classification
    A->>B: execute original mutation with original receiver/options
    alt commit succeeds and may mutate
        B-->>A: success
        A->>A: invalidate list and touched projections
    else structural no-op or failure
        B-->>A: no-op success or error
        A->>A: no cache effect
    end
Loading

Files Changed

Area Change
packages/storage/src/bounded-structured-mutation.ts Adds the pure immutable effect snapshot and its contract.
packages/storage/src/index.ts Exports the Storage-owned snapshot while retaining existing public helpers.
packages/agent/src/dkg-agent-base.ts Consumes the snapshot without decoding the mutation vocabulary and retains execution ownership.
packages/storage/test/bounded-structured-mutation.test.ts Covers all six mutation kinds, structural no-op classification, immutability, and caller mutation after capture.
packages/agent/test/replace-subject-agent-wrapper.test.ts Proves success-only invalidation, original graph scope, exact options forwarding, and bound receiver semantics.

Test Plan

  • Dependency-aware Agent build, including Core, Storage, Query, Chain, Publisher, Random Sampling, Agent type tests, and package-root checks
  • Storage and Agent builds after the review simplification
  • bounded-structured-mutation.test.ts: 19 passed
  • replace-subject-agent-wrapper.test.ts: 4 passed
  • All six structured mutation variants capture the same target graph as before
  • Structural no-op and failed mutation paths produce no cache invalidation
  • Caller mutation after dispatch cannot redirect the captured effect
  • Agent forwards the exact options object and invokes the inner method with its store receiver
  • git diff --check; generated EVM deployment output restored before commit

Comment thread packages/storage/src/bounded-structured-mutation.ts Outdated
Comment thread packages/storage/src/bounded-structured-mutation.ts Outdated

@otReviewAgent otReviewAgent 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.

Review Agent completed this review and found no issues.

@Jurij89
Jurij89 merged commit fed571a into fix/2162-close-leased-raw-mutations Aug 9, 2026
5 checks passed
Jurij89 added a commit that referenced this pull request Aug 9, 2026
* fix(storage): close leased raw SPARQL mutations

* test(storage): prove leased staging cleanup remains open

* test(storage): inventory all first-party store consumers

* fix(storage): preserve legal leased SPARQL reads

* refactor(core): centralize read-only SPARQL admission

* fix(storage): make leased capabilities truthful

* fix(storage): preserve escaped prefixed reads

* fix(storage): catch untyped raw store aliases

* refactor(storage): own structured mutation commit effects (#2194)

* refactor(storage): own structured mutation effects

* refactor(storage): keep mutation effects pure

* refactor(storage): model mutation no-ops explicitly

---------

Co-authored-by: Jurij Skornik <jurij.skornik@gmail.com>

---------

Co-authored-by: Jurij Skornik <jurij.skornik@gmail.com>
Jurij89 added a commit that referenced this pull request Aug 9, 2026
…2207)

Recover the reviewed #2187/#2194/#2196/#2197 stack onto the actual integration line, preserve the current integration gates, and close the escaped-hash leased-query bypass found during recovery review.
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