Skip to content

feat(environment): serve sorted creates, listed references and toggles - #7600

Merged
morluto merged 102 commits into
morluto:mainfrom
earakely-scale:feat/environment-item-writes
Oct 29, 2026
Merged

morluto merged 102 commits into
morluto:mainfrom
earakely-scale:feat/environment-item-writes

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #7539 (#7332 is merged); its own changes are its feat, fix and docs commits, merged with #7539's head
3b800a10.

Summary

Over 148 recorded captures, #7539 withholds 302 of 694 write plans. A short diagnosis of the largest clusters found
three gaps REA could close:

  • A create's sort learned too late. Grafana lists folders by title. A fresh recording's first scratch folder sorted
    after the seeded one, so the create plan settled on last; the second sorted before the first, the list after it
    contradicted the plan, and the folder update and delete after that went unconfirmed.
  • Lists of references. Homebox creates an item from parentId and tagIds and answers with parent and tags
    objects. REA modelled a parent but not a list of tags, and a create that sent null and [] disagreed with one
    that named both.
  • Toggles. Miniflux stars and unstars an entry with a body-less PUT /v1/entries/{id}/bookmark. Chromium exposes
    no body for it, which REA read as unusable, and a call flipping the flag back was taken to contradict the call that
    set it.

This PR:

  1. Places a create again by a field a later whole listing in collection order shows it sorted by, after one such
    listing placed it last, the type's id field last among the candidates.
  2. Learns a reference with many for a field holding one object per id a sent list names, in order, and lets a
    create that sent the member as null or [] agree with one that named entities. Serving accepts a null id only
    where a recorded create sent one.
  3. Reads a scenario request's body as absent when Playwright exposed none and the request names no Content-Type.
    Every POST, PUT or PATCH whose body the captures retained names one (835 of 835).
  4. Adds a toggle rule: an item action a later call shows flipping back a boolean an earlier call set, when no call
    found it set already, flips the field on each served call.
  5. Asks recordings to run an action twice in a row on one object, reading it back after each, which shows whether it
    sets or flips (skill 55).

Results:

  • Over the 148 captures, served writes go from 392 to 399 and none goes from served to withheld, and no served plan
    changes: Grafana's folder create, update and delete in a fresh recording, Homebox's item create in another, and
    Miniflux's bookmark toggle in three recordings. Views are unchanged.

Problem and expected behavior

  • A create placed last whose later listing shows the collection sorted by a field should take that sort.
  • A create that names entities by a list of ids should store them, and one that names none should store the empty
    value, as a single reference does.
  • A body-less action recorded through a browser should be modelled as body-less.
  • An action that flips a boolean should be served as a toggle once the recording shows it flipping both ways.
  • Captures that need none of this should build the same plans as before.

Change and scope

  • Sorted creates (EnvironmentStateWriteSimulation.ts): #settledInserts keeps creates another read placed;
    #narrowInserts adds the sorts a listing's items show; #retryInsert retries a placed create's sorted candidates.
  • Listed references (environmentStateWriteReferences.ts, environmentStateWriteRules.ts,
    environmentStateView.ts, environmentStateWriteCreateCalls.ts): listReferenceRule, many, emptyReference;
    mergedField and released let an empty reference agree.
  • Hidden bodies (scenarioCaptureRecords.ts): unsentBody gives such a request a bodySize of 0.
  • Toggles (environmentStateWriteCalls.ts, environmentStateWriteEffects.ts, environmentStateWriteApply.ts,
    environmentStateWriteVerdict.ts): toggledRules, serving and the action verdict.
  • Skill (version 55) and docs: docs/web-network-captures.md, docs/agent-environments.md,
    docs/specs/agent-environments/write-sorts-references-toggles/.

Not included: the order an application gives a list read with no sort parameter when it is not state order
(Miniflux lists starred entries by published_at, which keeps the toggle withheld in two recordings); Homebox's
assetId numbering and item updates; Linkding renumbering bundles after a delete.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the environment-state write model and scenario capture records.
  • Contribution scope fit and linked maintainer decision: within the environment-state writes of [Design] Project captures into an environment manifest, serve it over streamable HTTP, export agent-environment bundles #4933.
  • CLI and MCP/tool-catalog contract: environment-state views may carry reference.many and toggle rules. The
    compact MCP catalog stays under its frame.
  • Provider, bridge, target-format, or platform compatibility: unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: a scenario request whose body was not exposed and that
    names no Content-Type is projected with bodySize: 0 for the manifest and state views; replay records are
    unchanged. Views with the new members are refused by earlier REA versions, whose schemas are strict.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: skill version 54 to 55, on feat(environment): serve writes whose calls send different members #7539's 54.

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 (#7539 at 3b800a10 against this branch, 148 captures): 694 plans; served 392 and 399; no write from
served to withheld; no served plan changes; five withheld plans explain more; views unchanged (3,188).

  • Tests added: src/domain/analysisView/environmentStateItemWrites.test.ts,
    src/application/environment/environmentStateItemWritesAnswer.test.ts and a case in
    src/domain/analysisView/scenarioCaptureRecords.test.ts, with fixtures in tests/fixtures/environmentStateItemWrites.ts
    and tests/fixtures/browserScenarioCapture.ts. The twelve behaviour tests fail on feat(environment): serve writes whose calls send different members #7539 at 3b800a10; the three
    that guard toggles and null ids pass there too.
  • Remaining proof gaps: see "Not verified" in the spec folder's verification.

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

  • npm run -s check:fast, format:check, knip, scan:todos, docs:check, verify:test-discovery,
    mcp-catalog:check and jscpd: passed.
  • npx vitest run --project domain --project services: 11,886 passed, 6 skipped, merged with 3b800a10. An earlier run failed a
    SetupRegistrationPrewarm runner test that outran its 5-second timeout; alone it passes here and on feat(environment): serve writes whose calls send different members #7539.
  • npm run -s test:focused -- environment build, export and serve CLI, analysis-view CLI and MCP, environment serve
    MCP boundaries: 7 files, 81 passed. outputSchemaProfile, toolSchemaValidity, mcpSchemaValidation,
    outputSchemaSemanticConstraints and analysisViewMcp: 5 files, 54 passed.
  • The twelve new behaviour tests fail on feat(environment): serve writes whose calls send different members #7539 at 3b800a10 and pass here.

Review round (Greptile on 4e777d28, five findings):

  • Fixed here in 8cf5e046: a sort an earlier whole listing ruled out came back from a later listing once the entity
    that ruled it out was deleted; and a create sending a reference's member empty after a later create added the
    reference was withheld. Both tests fail on 4e777d28.
  • In the stack: the made-object count was already covered by 308aebf0 (feat(environment): serve query numbers, counted values and made objects #7332); the update default and the read clock
    spelling are fixed by feat(environment): serve writes whose calls send different members #7539's 174a0ff2, merged here.
  • Greptile's re-review on f7c1bfe9 found one more, fixed here: a served create that left out a reference's member
    stored null where the create the plan observes left it out and stored no such field.
  • Greptile's next re-review found two more in feat(environment): serve writes whose calls send different members #7539's code, fixed by its 3b800a10, merged here: sent sequence
    numbers are remembered alike in replay and serving, and update clocks are stored in the plan's one kept spelling.
  • Census unchanged: 392 and 399.
  • Census as above, on macOS with Node v24.22.1.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; views with the new members are refused by earlier versions.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; built from existing recordings.
  • Package or release metadata impact: skill version 55.
  • Security, privacy, process, or containment review: no new credential handling. A served toggle flips a boolean the
    state holds; a served create stores the entities a call's ids name.

Author readiness

Human owner: @earakely-scale

  • 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.

🤖 Generated with Claude Code

earakely-scale and others added 30 commits October 26, 2026 08:48
…m fields

- A create member a recording sent empty ("", null, false, [] or {}) is no
  longer required; a call that leaves it out is applied as sending that value
  (body.blank).
- List views render envelope members that list the listed entities' ids
  (Paperless's `all`), so creates in such collections are confirmed.
- Updates move their entity in collections kept sorted by a field they write,
  and a failed whole-collection read after an update can teach that order.
- A later create that stores an unruled field otherwise is withheld at the
  create, and an item read may fill values a create's answer had not loaded.
- An unsent field respelled between null, [] and {} is unchanged.
- The skill asks for one create with every field and one with only what a
  person must give.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Agents guessed capture keys (artifacts, dom, final) to see pages behind
sign-in, which inspect_web_page cannot reach.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A create that fills only what a person must give sends `null` where the
full create sent a string, and `null` or `false` for the same flag. The
merged plan now accepts each recorded empty value, and a call that leaves
the member out is applied as the earliest call sent it.

Also adds the spec folder for this change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Agents read "the form" as a cue to write through the UI, where some
applications' request bodies are not exposed; a body-unusable UI write
now re-records once with request steps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Bulk updates move their entities in turn against the others' earlier
  values and install the final order once, as replay does.
- A member's recorded empty values stay accepted once a later call teaches
  its default; a left-out member with a default keeps the default.
- Write answers spell empty lists and maps as their recorded answers did.
- A rename can teach a sort when the creates chose one by a field the
  update did not write, such as ids that ascend with titles.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- An item read whose object is marked deleted (deleted, isDeleted or
  is_deleted true) agrees with an absent entity, as EspoCRM answers a
  deleted record; such an object never seeds or adopts an entity.
- maxSize, max_results and maxResults are page sizes, for whole-collection
  list lines and the list query's limit role.
- An item view also shows the fields only reads after its type's first write
  show, when no initial entity holds them (Vikunja's task subscription),
  without requiring them; write answers leave such a field out for entities
  without it, and it no longer withholds the write as incomplete-entities.
- The skill asks updates to change the fields a person would change, and
  expects a deleted object to read back as 404 or marked deleted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d create's order

- A write answer spells an empty list or map the call did not send as its
  recorded answer did; one the call sent is answered as sent, so a create
  sending `[]` is not answered `null` because the first recorded create was.
- A read listing the whole collection that placed a create leaves the create
  only the sorted inserts whose order that read follows, so a later rename
  cannot teach a sort an earlier read ruled out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… show

A bulk update's answer renders each entity with the same allowance a single
update's answer has: a field only reads after the type's first write showed,
which no initial entity holds, is left out for an entity without it, so a
bulk update of a seeded task is no longer refused for lacking it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The agent trajectories show gpt-oss passes it by creating a replacement contact
and deleting the original, since the served update refuses emailAddress; the
update itself is refused in both builds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eted

An application that soft-deletes still answers a deleted record by id, marked
deleted. Serving now keeps an entity a served delete removed from a type whose
recorded item reads show that, until a reset or load and within the size
data/add loads, and answers a read of it with its last fields and the flag
true, instead of refusing the read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…th sent members, narrow inserts only on collection-order reads

- A create whose item read loaded values its answer had not records them
  (`observation.read.unloaded`), and a served create's answer keeps them as
  the recorded answer showed them, a zero-time owner included, while the state
  holds the read's.
- Replay checks a bulk update's recorded answers with each target's sent
  members, as serving answers them, so echoed `null` and `[]` no longer make
  the plan body-unusable.
- A whole-collection read whose query sorts it shows the query's order, so it
  no longer narrows a create's sorted insert candidates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A query parameter accepts a number or boolean, which serving sends as its
  JSON text, as agents send page sizes and flags.
- A sequence may start at the value its first create took above every value
  its type held (Vikunja's per-project task index), and a later create's
  composed, template or started-sequence rule is adopted when it also spells
  the first create's value.
- A made-object rule explains an object the application makes with each
  created entity: members the request stamped, members holding the entity's
  own id, and counts one past the held objects' values.
- A create's answer names the id of the one object a one-element array member
  holds, so bulk creates link to their type.
- The skill reads each listed object by id before writing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A create linked to its type's own collection, whose path has no parameters,
accepts any path values when its plan stores each one in a field, as a Vikunja
task stores its project; replay and serving apply it alike.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ities reaches it

Serving moves only the entities a write changes in a collection kept sorted,
so replay now tries a sort after a rename only when the entities no write the
read exercised changed already follow it. Seeded folders listed out of title
order no longer teach a title sort that serving would answer with another
order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cho, and learn no sort from query-sorted reads

- A served create keeps a value its recorded answer had not loaded unless the
  call sent that member and the plan stores it as sent, so a create sending
  `active: false` is answered `false` as recorded while the state holds the
  read's `true`.
- A rename no longer teaches a sort from a whole-collection read its query
  sorts, whose ties need not follow the collection's own order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rve by it

Extraction now records the member later item reads set true on a record the
application soft-deleted, and the item view carries it as `deleted_flag`.
Serving reads that fact instead of scanning recorded bodies itself, so one
owner decides what a soft delete looks like.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

earakely-scale and others added 2 commits October 27, 2026 16:51
…e clocks by serving's rule

A default a PUT learns must also agree with what the read after an earlier or
the current call showed for the member its answer left out, so a call whose
read showed the member kept withholds a later clearing default.

Replay and serving now choose an update clock's stored spelling by one rule,
readSpellsCoarser: the read after it at a coarser precision in the same zone
and separator. A read in another zone or separator is no longer adopted by
replay, which serving could not store, and a create's plain clocks stay as
answered, as serving makes them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ded references

A sort a whole listing that placed a create did not follow stays ruled out for
that create, though the entity that showed it is later deleted. A create that
sends a reference's member empty after a later create added the reference
agrees with it, as with a reference the first create showed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@earakely-scale

earakely-scale commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Review rounds from 4e777d28 to 82735f27: Greptile is at 5/5, and all ten threads are answered and resolved.

earakely-scale and others added 4 commits October 27, 2026 17:09
Main squash-merged morluto#7332 (308aebf), which this branch already holds, so the
merge takes 308aebf as its base.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A create the plan observes that left out a reference's member stored no such
field, so a served call leaving the member out stores none either, though a
later recorded create sent it empty; a call sending it empty still stores that.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
earakely-scale and others added 3 commits October 27, 2026 17:36
…e update clocks by the kept read

Replay now keeps the largest value a sequence took, as serving's commitWrite
does, so a lower sent value no longer lowers the next number.

Serving stores every update's clocks in the spelling of the read the plan
keeps as observation.read; replay now does the same through
readSpelledClocks, instead of adopting each update's own read, so a later
update whose read spells its clock otherwise contradicts the plan. The plain
clock branch of restampedFields, which no caller used any more, is gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep the merged member-write behavior from morluto#7539 and retain this
branch's sorted creates, listed references, and toggles.
Do not adopt a sort an earlier update already ruled out. Learn a list
reference only when every element shows the same nonempty fields. Promote
a toggle only when every call started from a boolean.
The mixed-field case uses the held tag's color, so rejection comes from
the field set rather than a value the recording never stored.
The compare_bundles rejection reports each relative path as an
invalid_format issue instead of one joined diagnostic sentence.
Relative bundle paths and rejected ABI selectors are reported as
input issues on those fields, not as one joined diagnostic sentence.
@morluto
morluto merged commit 51ad845 into morluto:main Oct 29, 2026
41 checks passed
@morluto morluto mentioned this pull request Nov 11, 2026
3 tasks done
@morluto morluto added enhancement New feature or request area: setup Setup, packaging, upgrade, install, Doctor, and client registration labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: setup Setup, packaging, upgrade, install, Doctor, and client registration enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants