[PR #7034] [MERGED] feat(environment): learn creates from every call, with sorted arrays and referenced entities #7592

Closed
opened 2026-11-03 13:38:57 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7034
Author: @earakely-scale
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @morluto

Base: main ← Head: feat/environment-create-calls


📝 Commits (10+)

  • a1edeaf feat(environment): explain values an application derives from other fields
  • 8ce1127 docs(environment): record the derived-values verification
  • 38a74a4 feat(environment): learn a create plan from every call
  • 1ec053e chore: merge main into derived values
  • 043053d feat(environment): sorted arrays, referenced entities and nested view keys
  • a80a96f fix(environment): keep clock spellings, linked ids and word boundaries honest
  • 1e6c02c test(environment): keep a same-width fixed clock out of trimming
  • 9671b18 docs(environment): record the create-calls verification
  • e5ab2c6 Merge main into the create-calls branch
  • de930a0 docs(environment): note the create-calls census on current main

📊 Changes

29 files changed (+1844 additions, -156 deletions)

View changed files

📝 docs/agent-environments.md (+7 -2)
➕ docs/specs/agent-environments/write-create-calls/plan.md (+12 -0)
➕ docs/specs/agent-environments/write-create-calls/spec.md (+48 -0)
➕ docs/specs/agent-environments/write-create-calls/tasks.md (+10 -0)
➕ docs/specs/agent-environments/write-create-calls/verification.md (+61 -0)
📝 docs/web-network-captures.md (+24 -4)
📝 src/application/environment/environmentStateBulkAnswer.ts (+2 -0)
📝 src/application/environment/environmentStateDerivedAnswer.test.ts (+98 -0)
📝 src/application/environment/environmentStateWriteAnswer.ts (+17 -1)
📝 src/domain/analysisView/EnvironmentStateWriteSimulation.ts (+1 -0)
➕ src/domain/analysisView/environmentStateCreateCalls.test.ts (+217 -0)
📝 src/domain/analysisView/environmentStateGate.ts (+1 -80)
📝 src/domain/analysisView/environmentStateRules.ts (+22 -5)
📝 src/domain/analysisView/environmentStateView.ts (+22 -2)
➕ src/domain/analysisView/environmentStateViewSpellings.ts (+140 -0)
📝 src/domain/analysisView/environmentStateWriteApply.ts (+54 -8)
📝 src/domain/analysisView/environmentStateWriteCalls.ts (+7 -5)
📝 src/domain/analysisView/environmentStateWriteChanges.ts (+23 -2)
📝 src/domain/analysisView/environmentStateWriteCopies.ts (+2 -1)
📝 src/domain/analysisView/environmentStateWriteCreate.ts (+144 -34)

...and 9 more files

📄 Description

Summary

Builds on #7025, now merged into main. This PR adds create-call widening, sorted echoes, referenced entities, and nested view projections.

With #7025, the creates that prompt-built and published environments still withheld failed for reasons the write
model did not cover:

  • Learned from the first call only. A create plan came from the tool's first call alone, so a later call that sent
    a member the first did not (Linkding's shared), or left one out, was refused even where it otherwise agreed.
  • Sorted arrays. Linkding stores tag_names sorted, so a call that sent its tags in another order did not echo
    them.
  • Embedded entities. Homebox's item create answers its parent and type as whole objects (parent, location,
    entityType) beside the parentId and entityTypeId it sent. Kept as constants, they pinned those members.
  • Lighter list objects. Some lists show objects with fewer keys than an entity holds: Homebox lists an item's parent
    without the parent's own type, and Keycloak lists a user's access with one key. A created entity rendered its object
    whole, so the list check failed.

This PR handles each:

  1. A later create that agrees with the plan widens it, with defaults for members a call leaves out.
  2. A sorted echo.
  3. A reference rule that repeats the entity a sent member names, as the state holds it.
  4. A view member, nested_fields, that renders written objects with the keys the view shows.

Results on the same captures, against the #7025 baseline, with both models:

  • Linkding bookmark creates (one with two tags) go from 0/2 to 2/2.
  • Keycloak's user create and email update, from the published capture, go from 0/2 to 2/2.

Census of 69 recorded captures on current main (main plus #6967 for timed scenarios):

  • Served writes go from 124 to 132 with both branches, of which 3 are this PR's.
  • No write goes from served to withheld.

Problem and expected behavior

  • A later create that only adds or leaves out an optional member should widen the plan instead of being refused, and a
    served create that leaves the member out should store what the application stored.
  • A member the application stores sorted should be served sorted.
  • An object that repeats a named entity should follow whichever held entity the call names, and the call should be
    refused when it names none.
  • A list that shows nested objects with fewer keys should show a created entity's objects the same way.
  • Plans and views that need none of this must not change.

Change and scope

  • Every call (environmentStateWriteCreateCalls.ts, environmentStateWriteCreate.ts):
    • Each later create is explained on its own and merged when both calls show the same fields. The exception is a
      reference whose member one call did not send.
    • Every field both calls rule they must rule alike, and a field neither rules must hold one value.
    • Members either call sent are accepted, and only those every call sent are required.
    • An echoed member a call left out takes the value that call stored (body.defaults).
    • A later create that disagrees leaves the plan as it was. Merged rules keep the plan's order.
  • Sorted arrays:
    • An echo is sorted when the application stored the sent strings in code-point order, and serving stores them
      sorted.
    • A plain echo and a sorted one agree in update and create plans, and the plan keeps the sorted one.
  • References (environmentStateWriteReferences.ts):
    • A created or updated object field holding fields of the entity a sent member names is a reference (member, type,
      fields). Among several such members, the one named like the field wins.
    • The member is accepted with any value and no longer pinned as naming a nested object.
    • Replay and serving look the entity up in the state they hold. Serving refuses a call naming one the environment
      does not hold, and the field is absent when the call does not send the member.
  • Nested view keys: the gate's spelling learner (moved to environmentStateViewSpellings.ts) also notes the keys a
    view shows of object fields. It emits nested_fields when they are always the same and fewer than stored, and
    rendering applies them to stored objects the view never recorded.
  • Docs and spec: the write-plan rules and view members, and docs/specs/agent-environments/write-create-calls/.

Not included:

  • lists that filter or sort without saying so. Homebox's item list answers items only, by name, from a line with no
    parameter. That is why Homebox's item create, now fully explained, is still withheld.
  • recording gaps such as a bookmark made through the UI.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the environment-state view's write plans and entity views
    (src/domain/analysisView), and served write answers (src/application/environment).
  • Contribution scope fit and linked maintainer decision: within the existing environment-state write model. It
    reads recorded captures only and adds no new target interaction.
  • CLI and MCP/tool-catalog contract:
    • No tool or argument changes.
    • environment-state write plans may carry body.defaults, echo.sorted and a reference rule, and its entity
      views may carry nested_fields.
  • Provider, bridge, target-format, or platform compatibility: unchanged.
  • Evidence, artifact, provenance, or reconstruction contract:
    • State views and bundles built by this version may hold the new members. Earlier REA versions refuse them, because
      the schemas are strict.
    • Earlier views parse unchanged.
  • Target selection, authority, upstream behavior, and cleanup details: unchanged.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

Write plans over 69 recorded captures: the 50 published captures, 18 Claude Code recorded from a prompt and one
timed Grafana recording.

Captures Write plans Served before both PRs With #7025 With this PR
50 published 187 68 68 70
19 recorded from a prompt 120 56 61 62
  • This PR's gains:
    • Keycloak's published user create and update. Its user list shows access with one key, so a created user now lists
      as recorded and the plan's sorted insert checks.
    • The round-4 Linkding bookmark create, whose tags the application stores sorted.
  • No regressions: no write goes from served to withheld.
  • Explained but still withheld:
    • Homebox's item create merges with the location create, gets references for parent, location and entityType,
      and accepts parentId and entityTypeId with any value. Its read-back list filters and sorts implicitly.
    • Linkding's create whose later call sends shared merges, but is withheld as side-effect: the recording also added
      a bookmark through the UI.
  • Re-checked on current main: after merging main ed79bf93, which bounds create learning, the census reproduces
    124 → 132.

Served write tasks on the same captures, rebuilt by the #7025 baseline and by this PR, with
fireworks_ai/gpt-oss-120b and fireworks_ai/glm-5p3-flash. Each task checks its result from the environment's state,
including that nothing else changed:

Capture Tasks Baseline (gpt-oss, GLM) This PR (gpt-oss, GLM)
Linkding, recorded round 4 2 bookmark creates, one with two tags 0/2, 0/2 2/2, 2/2
Keycloak, published capture create a user, change another user's email 0/2, 0/2 2/2, 2/2

Tests added:

  • View:
    • a later create widening the plan with a default;
    • one storing a member otherwise stays unexplained;
    • sorted tags give a sorted echo;
    • a create embedding the shelf its shelf_id names gives a reference, and its list learns nested_fields.
  • Serving:
    • defaults and sent members are stored;
    • a create embeds the named shelf, lists it with the listed keys, and is refused for an unheld shelf;
    • sent tags are stored sorted.
  • Unit: references (tie-break by name, too few keys, a disagreeing value, an unheld entity) and merges (a differing
    constant, a fixed and accepted member, a reference one call shows alone).
  • Review round (each fails on 5f94e465):
    • a reference an earlier create added survives later creates that leave it out, and agrees when it returns;
    • a create answers with the shelf only when it names one, whichever recorded create came first;
    • an update that repeats the shelf id it already holds keeps the reference;
    • an id naming shelves in two collections teaches no reference and is refused when served;
    • tags an earlier create stored out of order are never sorted;
    • nested keys learned in any order keep the first order;
    • a later create that leaves the shelf out yet stores another shelf than the default is withheld (fails on
      14574146);
    • a later create's trimmed clock is not merged when a held entity showed that clock at a fixed width (fails on
      14574146).

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Current update (921b00a03, based on main 4b045e8f2):

  • Resolved all 12 conflicted files when merging main in 44fab62e8, preserving this PR's additional rules and tests.
  • Fixed the remaining contradictory-reference review finding at the create-rule agreement boundary. Observed references must equal the object rebuilt from held state whether their member was sent or omitted; the duplicate reference branch in default validation was removed.
  • Environment domain/application suites: 60 files, 1,373 passed.
  • Built environment build/compare/serve CLI and served-writes MCP boundaries: 4 files, 18 passed, including the new public MCP check that a contradicted create is not listed.
  • Final focused rerun of create-call, derived-answer, and served-writes MCP tests: 26 passed.
  • npm run check:fast and npm run docs:check: passed (docs includes 9 README checks).
  • Before the fix, wrong-name, wrong-id, and null reference observations all incorrectly left the create served. Those three domain cases and the application plan assertion failed against the merged pre-fix code and pass after the fix. Reordered object keys remain accepted, and recording fallback leaves state unchanged.
  • Local platform: macOS, Node 24.22.1/npm 11.16.0. Prior 69-capture census, model tasks, and Docker agentenv verification were not rerun for this update.
Small view-derivation cost sample

One 11-record reference-create capture; one first derivation and 30 warm derivations per fresh process. Evidence construction/imports excluded; one process and no children. Small noisy sample, with no optimization claim.

Measurement Before After
First elapsed / CPU 14.07 / 16.94 ms 14.32 / 17.64 ms
Warm mean elapsed / CPU 1.62 / 2.60 ms 2.16 / 5.14 ms
Peak process-family RSS 275.81 MiB 257.73 MiB

Agent token usage and larger end-to-end workflows were not measured.

Earlier author validation (historical commits):

Run on macOS with Node v24.22.1 at 043053d1 (main 79845063, #7025 8ce1127b and this PR's first two commits).
After merging main, the environment suites and census were run again.

  • npm run -s typecheck, lint, format:check, docs:check, mcp-catalog:check, verify:test-discovery and
    scan:todos, and npx knip: passed.
  • npx vitest run --project domain --project services --project adapters: 17,258 passed and 1 failed ("stops Inspector
    target authorization after the current stat settles"), which fails the same way on main in this environment.
  • npm run test:focused -- the environment build, export and serve CLI boundaries, the analysis-view CLI and MCP
    boundaries, the environment serve, served-writes and bundle MCP boundaries, MCP schema validation and output schema
    constraints: 10 files, 82 passed.
  • After merging #7025's review head 09c48c59 (which brings main through 955c7c80): the environment domain and
    application tests, 1,667 passed; npx vitest run --project domain --project services --project adapters, 17,380
    passed and the same one failed; lint, format, docs, test discovery and knip passed.
  • Census against main 9b3a6332 with #6967: 124 served there, 132 with this branch, every plan identical to before
    the merge.
  • After the review fixes (aa52b6a9) and merging main 42577617 and #7025's head 96783c72 (9a76fccc):
    npm run check passed; the environment domain and application tests, 1,691 passed; npx vitest run --project domain --project services --project adapters, 17,406 passed and the same one failed; census: 132 served, every plan
    identical to before the review round (main 42577617 serves 124, as measured for #7025).
  • After merging main 2acdd541 (which fixes main's managedBundleReadGuards failure) and #7025's head 94f17534
    (d6d3d23e): npm run check passed; the environment domain and application tests, 1,706 passed; census: 132
    served, every plan identical.
  • After merging #7025's head 3705faeb and the second review round (d64c9d38): npm run check and docs:check
    passed; the environment domain and application tests, 1,711 passed; census: 132 served, every plan identical.
  • After merging main aced9fa9 and #7025's heads aeae47f7 and 5fd87e9c (8a4eb598): npm run check passed; the
    environment domain and application tests and the compare CLI boundary, 1,736 passed; census: 132 served, every plan
    identical.

Compatibility, safety, and release

  • Breaking changes or migration steps: none for callers. Bundles and state views built by this version need it or
    later to serve.
  • Real Hopper/Ghidra, browser, or OS coverage: recordings from real applications on Ubuntu 24.04. Gates ran on
    macOS.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: reads recorded captures only. A reference repeats fields of an
    entity the environment already holds.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

Part of #4933.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/7034 **Author:** [@earakely-scale](https://github.com/earakely-scale) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `feat/environment-create-calls` --- ### 📝 Commits (10+) - [`a1edeaf`](https://github.com/morluto/rea/commit/a1edeafdd58558e766cee3f8eda6d007c216d41c) feat(environment): explain values an application derives from other fields - [`8ce1127`](https://github.com/morluto/rea/commit/8ce1127b5d09c47b0139235f02db2512704c5b77) docs(environment): record the derived-values verification - [`38a74a4`](https://github.com/morluto/rea/commit/38a74a49e68460d6d24e81a30d4bd8df6cebebd8) feat(environment): learn a create plan from every call - [`1ec053e`](https://github.com/morluto/rea/commit/1ec053e35830f25be80fdca489884a639ae74348) chore: merge main into derived values - [`043053d`](https://github.com/morluto/rea/commit/043053d1eb3d7b921c01c9da376a8e5cbbb60881) feat(environment): sorted arrays, referenced entities and nested view keys - [`a80a96f`](https://github.com/morluto/rea/commit/a80a96fc017f63db9bcb5a60009e23ce9d0207da) fix(environment): keep clock spellings, linked ids and word boundaries honest - [`1e6c02c`](https://github.com/morluto/rea/commit/1e6c02c04e930642090d27f1d351adb4ad0876f4) test(environment): keep a same-width fixed clock out of trimming - [`9671b18`](https://github.com/morluto/rea/commit/9671b18196f6f4a1290c7b2cba1230c3941508a9) docs(environment): record the create-calls verification - [`e5ab2c6`](https://github.com/morluto/rea/commit/e5ab2c6f986459afc8bd7ba3151adbf081b3a215) Merge main into the create-calls branch - [`de930a0`](https://github.com/morluto/rea/commit/de930a00290cb306087c668a13ecdc1845b538f5) docs(environment): note the create-calls census on current main ### 📊 Changes **29 files changed** (+1844 additions, -156 deletions) <details> <summary>View changed files</summary> 📝 `docs/agent-environments.md` (+7 -2) ➕ `docs/specs/agent-environments/write-create-calls/plan.md` (+12 -0) ➕ `docs/specs/agent-environments/write-create-calls/spec.md` (+48 -0) ➕ `docs/specs/agent-environments/write-create-calls/tasks.md` (+10 -0) ➕ `docs/specs/agent-environments/write-create-calls/verification.md` (+61 -0) 📝 `docs/web-network-captures.md` (+24 -4) 📝 `src/application/environment/environmentStateBulkAnswer.ts` (+2 -0) 📝 `src/application/environment/environmentStateDerivedAnswer.test.ts` (+98 -0) 📝 `src/application/environment/environmentStateWriteAnswer.ts` (+17 -1) 📝 `src/domain/analysisView/EnvironmentStateWriteSimulation.ts` (+1 -0) ➕ `src/domain/analysisView/environmentStateCreateCalls.test.ts` (+217 -0) 📝 `src/domain/analysisView/environmentStateGate.ts` (+1 -80) 📝 `src/domain/analysisView/environmentStateRules.ts` (+22 -5) 📝 `src/domain/analysisView/environmentStateView.ts` (+22 -2) ➕ `src/domain/analysisView/environmentStateViewSpellings.ts` (+140 -0) 📝 `src/domain/analysisView/environmentStateWriteApply.ts` (+54 -8) 📝 `src/domain/analysisView/environmentStateWriteCalls.ts` (+7 -5) 📝 `src/domain/analysisView/environmentStateWriteChanges.ts` (+23 -2) 📝 `src/domain/analysisView/environmentStateWriteCopies.ts` (+2 -1) 📝 `src/domain/analysisView/environmentStateWriteCreate.ts` (+144 -34) _...and 9 more files_ </details> ### 📄 Description ## Summary Builds on #7025, now merged into main. This PR adds create-call widening, sorted echoes, referenced entities, and nested view projections. With #7025, the creates that prompt-built and published environments still withheld failed for reasons the write model did not cover: - **Learned from the first call only.** A create plan came from the tool's first call alone, so a later call that sent a member the first did not (Linkding's `shared`), or left one out, was refused even where it otherwise agreed. - **Sorted arrays.** Linkding stores `tag_names` sorted, so a call that sent its tags in another order did not echo them. - **Embedded entities.** Homebox's item create answers its parent and type as whole objects (`parent`, `location`, `entityType`) beside the `parentId` and `entityTypeId` it sent. Kept as constants, they pinned those members. - **Lighter list objects.** Some lists show objects with fewer keys than an entity holds: Homebox lists an item's parent without the parent's own type, and Keycloak lists a user's `access` with one key. A created entity rendered its object whole, so the list check failed. This PR handles each: 1. A later create that agrees with the plan widens it, with defaults for members a call leaves out. 2. A `sorted` echo. 3. A `reference` rule that repeats the entity a sent member names, as the state holds it. 4. A view member, `nested_fields`, that renders written objects with the keys the view shows. **Results on the same captures**, against the #7025 baseline, with both models: - Linkding bookmark creates (one with two tags) go from 0/2 to 2/2. - Keycloak's user create and email update, from the published capture, go from 0/2 to 2/2. **Census of 69 recorded captures on current main** (main plus #6967 for timed scenarios): - Served writes go from 124 to 132 with both branches, of which 3 are this PR's. - No write goes from served to withheld. ## Problem and expected behavior - A later create that only adds or leaves out an optional member should widen the plan instead of being refused, and a served create that leaves the member out should store what the application stored. - A member the application stores sorted should be served sorted. - An object that repeats a named entity should follow whichever held entity the call names, and the call should be refused when it names none. - A list that shows nested objects with fewer keys should show a created entity's objects the same way. - Plans and views that need none of this must not change. ## Change and scope - **Every call** (`environmentStateWriteCreateCalls.ts`, `environmentStateWriteCreate.ts`): - Each later create is explained on its own and merged when both calls show the same fields. The exception is a reference whose member one call did not send. - Every field both calls rule they must rule alike, and a field neither rules must hold one value. - Members either call sent are accepted, and only those every call sent are required. - An echoed member a call left out takes the value that call stored (`body.defaults`). - A later create that disagrees leaves the plan as it was. Merged rules keep the plan's order. - **Sorted arrays:** - An `echo` is `sorted` when the application stored the sent strings in code-point order, and serving stores them sorted. - A plain echo and a sorted one agree in update and create plans, and the plan keeps the sorted one. - **References** (`environmentStateWriteReferences.ts`): - A created or updated object field holding fields of the entity a sent member names is a `reference` (member, type, fields). Among several such members, the one named like the field wins. - The member is accepted with any value and no longer pinned as naming a nested object. - Replay and serving look the entity up in the state they hold. Serving refuses a call naming one the environment does not hold, and the field is absent when the call does not send the member. - **Nested view keys:** the gate's spelling learner (moved to `environmentStateViewSpellings.ts`) also notes the keys a view shows of object fields. It emits `nested_fields` when they are always the same and fewer than stored, and rendering applies them to stored objects the view never recorded. - **Docs and spec:** the write-plan rules and view members, and `docs/specs/agent-environments/write-create-calls/`. **Not included:** - lists that filter or sort without saying so. Homebox's item list answers items only, by name, from a line with no parameter. That is why Homebox's item create, now fully explained, is still withheld. - recording gaps such as a bookmark made through the UI. ## Contract and boundary impact - **Semantic owner and earliest changed stage:** the environment-state view's write plans and entity views (`src/domain/analysisView`), and served write answers (`src/application/environment`). - **Contribution scope fit and linked maintainer decision:** within the existing environment-state write model. It reads recorded captures only and adds no new target interaction. - **CLI and MCP/tool-catalog contract:** - No tool or argument changes. - `environment-state` write plans may carry `body.defaults`, `echo.sorted` and a `reference` rule, and its entity views may carry `nested_fields`. - **Provider, bridge, target-format, or platform compatibility:** unchanged. - **Evidence, artifact, provenance, or reconstruction contract:** - State views and bundles built by this version may hold the new members. Earlier REA versions refuse them, because the schemas are strict. - Earlier views parse unchanged. - **Target selection, authority, upstream behavior, and cleanup details:** unchanged. - **Generated metadata, package, or installation impact:** none. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage **Write plans over 69 recorded captures:** the 50 published captures, 18 Claude Code recorded from a prompt and one timed Grafana recording. | Captures | Write plans | Served before both PRs | With #7025 | With this PR | | ------------------------- | ----------- | ---------------------- | ---------- | ------------ | | 50 published | 187 | 68 | 68 | 70 | | 19 recorded from a prompt | 120 | 56 | 61 | 62 | - **This PR's gains:** - Keycloak's published user create and update. Its user list shows `access` with one key, so a created user now lists as recorded and the plan's sorted insert checks. - The round-4 Linkding bookmark create, whose tags the application stores sorted. - **No regressions:** no write goes from served to withheld. - **Explained but still withheld:** - Homebox's item create merges with the location create, gets references for `parent`, `location` and `entityType`, and accepts `parentId` and `entityTypeId` with any value. Its read-back list filters and sorts implicitly. - Linkding's create whose later call sends `shared` merges, but is withheld as `side-effect`: the recording also added a bookmark through the UI. - **Re-checked on current main:** after merging main `ed79bf93`, which bounds create learning, the census reproduces 124 → 132. **Served write tasks** on the same captures, rebuilt by the #7025 baseline and by this PR, with `fireworks_ai/gpt-oss-120b` and `fireworks_ai/glm-5p3-flash`. Each task checks its result from the environment's state, including that nothing else changed: | Capture | Tasks | Baseline (gpt-oss, GLM) | This PR (gpt-oss, GLM) | | --------------------------- | ------------------------------------------- | ----------------------- | ---------------------- | | Linkding, recorded round 4 | 2 bookmark creates, one with two tags | 0/2, 0/2 | 2/2, 2/2 | | Keycloak, published capture | create a user, change another user's email | 0/2, 0/2 | 2/2, 2/2 | **Tests added:** - **View:** - a later create widening the plan with a default; - one storing a member otherwise stays unexplained; - sorted tags give a sorted echo; - a create embedding the shelf its `shelf_id` names gives a reference, and its list learns `nested_fields`. - **Serving:** - defaults and sent members are stored; - a create embeds the named shelf, lists it with the listed keys, and is refused for an unheld shelf; - sent tags are stored sorted. - **Unit:** references (tie-break by name, too few keys, a disagreeing value, an unheld entity) and merges (a differing constant, a fixed and accepted member, a reference one call shows alone). - **Review round** (each fails on `5f94e465`): - a reference an earlier create added survives later creates that leave it out, and agrees when it returns; - a create answers with the shelf only when it names one, whichever recorded create came first; - an update that repeats the shelf id it already holds keeps the reference; - an id naming shelves in two collections teaches no reference and is refused when served; - tags an earlier create stored out of order are never sorted; - nested keys learned in any order keep the first order; - a later create that leaves the shelf out yet stores another shelf than the default is withheld (fails on `14574146`); - a later create's trimmed clock is not merged when a held entity showed that clock at a fixed width (fails on `14574146`). For evidence-bearing changes: - [ ] Observed, derived, and inferred claims remain distinguishable. - [ ] Artifact identity, source provenance, and failed attempts remain preserved. - [ ] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed Current update (`921b00a03`, based on main `4b045e8f2`): - Resolved all 12 conflicted files when merging main in `44fab62e8`, preserving this PR's additional rules and tests. - Fixed the remaining contradictory-reference review finding at the create-rule agreement boundary. Observed references must equal the object rebuilt from held state whether their member was sent or omitted; the duplicate reference branch in default validation was removed. - Environment domain/application suites: 60 files, **1,373 passed**. - Built environment build/compare/serve CLI and served-writes MCP boundaries: 4 files, **18 passed**, including the new public MCP check that a contradicted create is not listed. - Final focused rerun of create-call, derived-answer, and served-writes MCP tests: **26 passed**. - `npm run check:fast` and `npm run docs:check`: passed (docs includes 9 README checks). - Before the fix, wrong-name, wrong-id, and null reference observations all incorrectly left the create served. Those three domain cases and the application plan assertion failed against the merged pre-fix code and pass after the fix. Reordered object keys remain accepted, and recording fallback leaves state unchanged. - Local platform: macOS, Node 24.22.1/npm 11.16.0. Prior 69-capture census, model tasks, and Docker agentenv verification were **not rerun** for this update. <details> <summary>Small view-derivation cost sample</summary> One 11-record reference-create capture; one first derivation and 30 warm derivations per fresh process. Evidence construction/imports excluded; one process and no children. Small noisy sample, with no optimization claim. | Measurement | Before | After | | --- | ---: | ---: | | First elapsed / CPU | 14.07 / 16.94 ms | 14.32 / 17.64 ms | | Warm mean elapsed / CPU | 1.62 / 2.60 ms | 2.16 / 5.14 ms | | Peak process-family RSS | 275.81 MiB | 257.73 MiB | Agent token usage and larger end-to-end workflows were not measured. </details> Earlier author validation (historical commits): Run on macOS with Node v24.22.1 at `043053d1` (main `79845063`, #7025 `8ce1127b` and this PR's first two commits). After merging main, the environment suites and census were run again. - `npm run -s typecheck`, `lint`, `format:check`, `docs:check`, `mcp-catalog:check`, `verify:test-discovery` and `scan:todos`, and `npx knip`: passed. - `npx vitest run --project domain --project services --project adapters`: 17,258 passed and 1 failed ("stops Inspector target authorization after the current stat settles"), which fails the same way on main in this environment. - `npm run test:focused --` the environment build, export and serve CLI boundaries, the analysis-view CLI and MCP boundaries, the environment serve, served-writes and bundle MCP boundaries, MCP schema validation and output schema constraints: 10 files, 82 passed. - After merging #7025's review head `09c48c59` (which brings main through `955c7c80`): the environment domain and application tests, 1,667 passed; `npx vitest run --project domain --project services --project adapters`, 17,380 passed and the same one failed; lint, format, docs, test discovery and knip passed. - Census against main `9b3a6332` with #6967: 124 served there, 132 with this branch, every plan identical to before the merge. - After the review fixes (`aa52b6a9`) and merging main `42577617` and #7025's head `96783c72` (`9a76fccc`): `npm run check` passed; the environment domain and application tests, 1,691 passed; `npx vitest run --project domain --project services --project adapters`, 17,406 passed and the same one failed; census: 132 served, every plan identical to before the review round (main `42577617` serves 124, as measured for #7025). - After merging main `2acdd541` (which fixes main's `managedBundleReadGuards` failure) and #7025's head `94f17534` (`d6d3d23e`): `npm run check` passed; the environment domain and application tests, 1,706 passed; census: 132 served, every plan identical. - After merging #7025's head `3705faeb` and the second review round (`d64c9d38`): `npm run check` and `docs:check` passed; the environment domain and application tests, 1,711 passed; census: 132 served, every plan identical. - After merging main `aced9fa9` and #7025's heads `aeae47f7` and `5fd87e9c` (`8a4eb598`): `npm run check` passed; the environment domain and application tests and the compare CLI boundary, 1,736 passed; census: 132 served, every plan identical. ## Compatibility, safety, and release - **Breaking changes or migration steps:** none for callers. Bundles and state views built by this version need it or later to serve. - **Real Hopper/Ghidra, browser, or OS coverage:** recordings from real applications on Ubuntu 24.04. Gates ran on macOS. - **Package or release metadata impact:** none. - **Security, privacy, process, or containment review:** reads recorded captures only. A reference repeats fields of an entity the environment already holds. ## Author readiness Human owner: <!-- @GitHub-handle --> - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. ## Before merge - [ ] This PR addresses a concrete problem or an agreed enhancement. - [ ] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [ ] The PR has one focused outcome and the title follows `type(scope): outcome`. - [ ] Related issue is linked, or the reason for not linking one is stated above. - [ ] Tests cover changed observable behavior and meaningful failure paths. - [ ] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. - [ ] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. Part of #4933. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 13:38:57 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7592
No description provided.