Repository navigation
feat(environment): answer list filters, search, sorting and paging from the state - #5800
Conversation
Add the environment-state analysis view. From the parents the environment manifest accepts, it extracts the data the capture's reads observed before the first related write: entity types with an identity field (proved by a path parameter or inferred from an identity name), entities with their recorded values and provenance, documents for written non-entity paths, and a render plan per read tool that is kept only when it reproduces the tool's latest initial recordings from the state; every other read tool is a recorded view with the reason. The Evidence is always inferred. Response-body decoding moves to a domain owner shared with replay, exact JSON parsing moves to the owner of the exact-number policy, the manifest and state views share parent admission and record grouping, and projectAnalysisView takes its accumulators as one object. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the IL2CPP metadata view's edits to the shared refusal message and the inspect_analysis_view description alongside the environment-state view. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… from items A scenario write whose URL was redacted has no request line, so it was dropped and reads after it counted as initial state. Such a successful write now joins the timeline with an empty path, whose root relates to every type, so it ends every type's state; a limitation counts them. A list whose recordings were all empty passed the "every listed item carries it" check vacuously and published an identity field nothing showed; it now needs at least one item, else the view stays recorded as no-identity. A value that differed between two request lines of one item tool, such as a query variant, was called volatile, and the gate then substituted each recording's own value; only repeats of one request line now show volatility, so differing lines go through fields-differ. List membership is compared only while a list can still be the whole collection, and merged entities are indexed by type and collection once, so paged captures no longer cost pages times entities (8,000 pages of 40,000 entities: 5.7 s to 0.23 s). Docs and the tool contract say scenario state keeps the capture's redaction markers and how redacted writes bound it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ield unions Entities took the order of the first plan observed, and item plans run before list plans, so a complete list read before its detail reads came out reordered and lost "all" membership; each entity now keeps its earliest recorded sighting. A list plan reused the first recording's pointer for later recordings, so a later response that was itself an entity wrapping a list was read as that list; every recording must now locate the same list. The field union scanned its ordered list for every key, quadratic in an object's width; a set now answers membership. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… initial state A value that changed between repeats of one request line was named volatile whenever no write under the type's own root lay between, so a write under another root (for example POST /api/dashboards/db before a second GET /api/search) left its effect in the initial state. Any recorded write between the two observations now leaves every tool of the type recorded with reason fields-differ instead. A list was published with membership "all" even when a total or count envelope member exceeded the number it listed. Such a counter now makes the membership "recorded". Also drop a stale doc comment on ObservedEntity.order. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… documents State documents are held only for list-shaped paths a POST, PUT or PATCH tool writes. Reads of item-shaped written paths and of paths that are only deleted stay recorded views; the guide now says so and the spec defers them to a later increment of morluto#4933. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… reads The volatility check compared write start positions with the two reads, so a write already in flight when the earlier read started was missed and its effect was named volatile. A write now counts when its interval overlaps the span from the earlier read's start to the later read's end. The check also ran once per changed field and scanned every write. It now runs once per pair of observations, answered by a binary search over the writes in timeline order and the latest end among each prefix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the inspect_analysis_view description conflict with morluto#3634 by keeping main's inventory wording and adding the environment-state sentence. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The inspect_analysis_view contract text conflicted: main's Godot PCK and inventory wording and this branch's environment-state sentence touch separate parts of it and are both kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tem totals A value that changed across a write was caught only between repeats of one tool's request line, so a list read before a write and an item read after it put the post-write value into the initial state. Changes are now classified per entity in timeline order after observation: across any recorded write, a change between repeats of a line or between two lines of the type rewrites the type (every tool recorded as fields-differ); with no write between, a repeat's change is volatile. The classification lives in environmentStateMerge.ts. Any numeric member whose name contained "total" or "count" counted as an item total, so total_pages, account_id or page_count made complete lists partial. Item totals are now members whose name tokens include total or count and none of page, pages or per; a string of digits counts as a number; and a set has_more, next or next-page token member also marks the list partial. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolved against both sides' intent: the shared templateRulesSchema keeps main's description naming sibling-pair-variance; scenario admission keeps main's derived-text reservation and this branch's response-body requirement for the state view; the MCP test keeps the state test and main's renamed file-source manifest test; the contract text keeps both insertions. main's new scenario admission test passes the view kind the state view added to admitScenarioCaptureParent. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # src/contracts/analysisViewToolContracts.ts # src/domain/analysisView/scenarioCaptureRecords.ts # tests/boundary/mcp/analysisViewMcp.test.ts
`environment-serve --state <state.json>` serves an environment from the initial state an environment-state view extracted. Read tools whose views are state-backed answer from a live state store: item views render the held entity into the recorded envelope, list views render the collection or the recorded members, and document views return the held value; a missing entity or one lacking a required field is refused, and requests the state cannot answer fall back to their recordings with the reason. The /agentenv data plane implements data/reset, data/add (a rea-state/v1 document as a data part, base64 bytes, a file:// path or an https URL, validated and replaced atomically) and data/get, and the card advertises those operations and an intake declaration. Stage 1 is read-only: write tools are not served in state mode. Without --state nothing changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… responses
The environment-state view now holds every non-entity GET read with one
initial request line as a read-only document, infers identity from an
`...Id`/`..._id` field every listed item carries distinctly when no fixed
identity name does, and locates single entities wrapped in a one-element
array (`{"posts":[{...}]}`). Served tool descriptions say what each tool
returns, from its own recorded exchanges, and tools carry MCP annotations
(read-only, destructive, idempotent, closed world). On 44 recorded captures
the state renders 1,016 of 1,258 read tools, up from 710.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-state-serve Keep the state view's redacted-write bound beside the serve path's shared body-usability rule, and restore the test imports both sides use. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-state-coverage Keep the view's rewritten-type refusal, one-list rule and earliest-sighting order beside the read-only document and suffix-identity rules: identity is still inferred only from listed items, and a read that is no list becomes a document. The two view tests about such reads now expect documents. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… review fixes Co-Authored-By: Claude Opus 5.5 <[email protected]>
… review fixes Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t-state-coverage morluto#5319 is on main as one squashed commit with the same content as the branch this work was stacked on, so the branch's side of each overlapping hunk is kept; morluto#5349's analysis-view changes merge as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t-state-serve morluto#5319 is on main as one squashed commit with the same content as the branch this work was stacked on, so the branch's side of each overlapping hunk is kept; morluto#5349's analysis-view changes merge as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ed value identifies built every value before checking, so a wide first item followed by many sparse items cost a full scan per suffix-named field. It now returns at the first missing or repeated value; a regression test counts reads over a 2,000-field item and 5,000 empty ones. Co-Authored-By: Claude Opus 5.5 <[email protected]>
environment-serve derives the environment state at startup by running the environment-state view in-process on the capture with the manifest's template rules, so an environment comes with its state and a user supplies nothing extra. The derived Evidence is the same one inspect-analysis-view produces by hand. --state is removed; --replay-only serves exactly the stateless replay of main. When the state cannot be derived, or its catalog does not fit the discovery budget, the server starts in replay mode, logs the reason and reports it in the stop summary's `state`. Exported bundles serve the state by default too: export derives it the same way, so the verifier's tool count and checked answer match what is served, and the README describes the served mode. BREAKING CHANGE: environment-serve answers read tools from the derived state and does not serve write tools unless --replay-only is given; the stop summary reports `state` instead of `state_evidence_id`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…intake on stop - One /agentenv response is held to 64 MiB: replies are measured as they are produced and one past the budget becomes a -32000 error stating it. - Every message of a batch enters the arrival-order queue on arrival, so another request's reset never lands between them. - Stopping the server, or a caller leaving, cancels the active download and answers queued calls `cancelled` without running them. - file:// URIs name only this host: another host or a network share is refused before anything is opened. - A loaded view value may not give an entity another identity. - List answers refuse a member lacking a field every recording carried, as item answers do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the state A recorded body at the JSON depth limit was accepted by extraction, then nested a few levels deeper as a document or entity value, so sealing the state Evidence threw and environment-serve and environment-export stopped instead of falling back. stateBodyJson, the one rule extraction and serving share, now treats a body nesting deeper than the limit minus 16 levels as unusable, so its tool stays a recorded view. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… into feat/environment-state-coverage Keep main's tool description and change only its environment-state documents clause to this branch's rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ted books, and rank query lines as replay does A call whose two parameters take one sort, direction or paging role is refused when learning a query and replays its recording, as serving's name order would answer it otherwise. A failed query-line read also covers the held books it listed that the state's answer leaves out. An unsorted answer of one match shows nothing of where a create put it. The gate picks a read's query line by verbatim path values, then the query values it shares with the read, then record order, as replay picks its exchange. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… lines Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ueries This brings in morluto#5600 at 90d9022. writtenFieldChecks, which this branch keeps in the attribution module, takes morluto#5600's rule that volatile fields check no write. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tion of unmodelled writes This keeps the read checks under the line limit after morluto#5600's additions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ueries Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er its object A replacement claims only the members it wrote or removed, but it now overwrites every earlier effect under its object, so a merge that wrote the object it replaces loses its confirmation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Both sides named unmodelled writes as modelled ones do and dropped volatile fields from members-only checks; this keeps the taint that also resolves collection-level writes through heldCollection, and one volatile filter. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… lines Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ueries This brings in morluto#5600 at 3f1f825. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ist queries morluto#5600 landed on main as a squash, so this merge takes 3f1f825, the write-plan commit this branch last merged, as its base. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…antics Preserve current main membership and path ownership; unify decoded query constraints, reject unsupported search syntax and ambiguous page conventions, and update counters only in their observed envelopes. Validate real held-out GitHub pagination and actual Codex workflows. Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
|
Maintainer integration pushed as 665ec74, based on current main 2c3dd94. The actual delta is 28 files (base metadata refreshed); all five prior threads have explicit repair/attribution explanations. 618 adjacent source tests, 80 CLI/MCP/schema boundary tests, repeated regressions and a real native held-out GitHub pagination workflow passed. Three actual Codex task traces and measured costs/limitations are recorded in docs/specs/agent-environments/list-queries/verification.md. CI is running; no complete-CI pass is claimed yet. @greptileai please review this exact head and actual current-main delta; the initial automated review was cancelled during metadata refresh. |
Treat missing members as unknown rather than negative evidence. Reject actual conflicting counts and preserve per-envelope omission. Add fail-before/pass-after service coverage for local state changes and contradictory counts. Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
|
Independent read-only Codex review found a further attributable omission bug after 665ec74: intersecting query-total names treated an absent member as contrary evidence. A new regression failed on that head (1 failure/41 passes). The follow-up now learns present agreeing totals, rejects genuinely contradictory counts, and keeps absent/unknown envelope fields untouched. The updated 527-test adjacent batch, 92 catalog/schema/server source tests, three 100-test stability runs and native held-out public CLI/MCP workflow pass. Runtime public task: 9.79s wall/15.33s CPU/507.33MiB sampled process-family RSS; no speedup claim. Prior CI is superseded by this source correction, not misreported as final-head success. Please review the new exact head; existing baseline write issues remain separately attributed. |
|
Latest main e93e3b1 added APK signing while the previous checks ran. Integrated it as 1c9bb2e; sole conflict resolved from main with only the existing environment-query description clause added. Actual PR delta remains 28 files; APK implementation, shared workflows, skill sources and package scripts match main. This integration passes 619 source tests, 36 compiled service/schema boundary tests, pinned build/static/docs/format checks and native held-out public pagination (10.52s wall/16.60s CPU/489.10MiB sampled family RSS, all observed children exited). The full 80-boundary set passed on preceding 02ff630. Independent targeted Codex re-review found no remaining omission defect (source review, not runtime coverage). Current CI is 39774898178; older successful CI is not substituted for it. |
Share reproducible total interpretation between inference and projection. Retain number versus canonical decimal-string type; leave unknown, padded and unsafe representations recorded. Reproduce the stale string total before fixing it and verify the shared service boundary. Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
|
Final representation correction is 62a9adf. A direct regression reproduced total:"3" remaining "3" after removing an entity (1 failure/42 passes); inference and projection now share queryTotalCount and preserve canonical string vs numeric type. Unknown/padded/unsafe representations are not assigned a formatting rule. This head passes 621 adjacent source tests, three 102-test query/write runs, 36 compiled service/schema boundaries, pinned static/build/docs/format checks and native held-out pagination. Targeted independent Codex source re-review found no definite remaining introduced representation defect; it did not claim runtime verification. The latest public sample was slower (20.13s wall/28.72s CPU/492.53MiB sampled family RSS), so a paired fresh-main control is being measured and no speedup is claimed. Current CI is 39776472358; no older CI is substituted. Existing contributor readiness is preserved, not newly attested, and no Co-authored-by was added. |
Return the successful check instead of a boolean and refresh coverage, exercised writes and blocked-target guards before confirmation and pending cleanup. Prove an excluded update stays pending and only a later actual read can confirm it. Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
|
Additional current-head public verification completed: an actual owned minimal HTTP books application produced two observed HAR sessions (7 and 8 real sequential requests). After PATCH book 2 and creating Alpha, the native limit=2 response lists only IDs [3,1]. Public CLI and MCP extraction agree byte-for-byte on normalized facts/Evidence: create is confirmed by read 6; the excluded patch stays unconfirmed without a later witness and is confirmed only by item read 7 when present. This directly verifies the retry fix through real capture admission and both public adapters, not only source helpers. The tiny owned fixture is not third-party application-write fidelity. Whole task 12.62s wall/18.79s CPU/927.60MiB 500ms sampled process-family RSS; no surviving observed descendants, native listeners/MCP child closed. Greptile check 119823565061 completed on exact e27e63f, no unresolved review threads at the time checked. Current CI 39778527490 still pending; no merge claimed. |
|
Merged normally (no bypass) as 293832b at 12:41:32 UTC. Original primary author Edgar Arakelyan retained; no Co-authored-by, only truthful Kogasa Assisted-by for fail-before/pass-after guards. The entire actual merge tree 55a20628f6d6aa7016b6cb7e009cd2c957b3502b equals reviewed e27e63f. Exact-head CI 39778527490 passed all selected lanes and all 8 shards; Greptile119823565061 completed, all threads resolved with root/fix/validation explanations. Skipped Apple/Windows-capability/provider lanes are not claimed qualified. Rebuilt ACTUAL MERGE and reran 623 source tests plus both public workflows: retained native GitHub pagination 10.38s wall/16.60s CPU/493.43MiB sampled process-family RSS; actual owned HTTP witness sessions 10.97s/16.94s/937.98MiB. CLI/MCP facts and Evidence agree, unobserved updates remain unconfirmed and later item witnesses confirm them. All observed children/native listeners closed. No third-party application-write or exhaustive provider/scale claim. Original slower samples and failed attempts remain recorded; no universal speedup claim. |
Summary
Part of #4933; integration tracking: #6262. Builds on merged #5600 and #5787.
Learn a list's supported filters, plain substring searches, sorting and paging from retained recordings, then evaluate new values against local state. Unsupported values replay with an explicit reason; computed replies retain Evidence and distinguish
state.membership: "query"from whole/recorded membership.The integration preserves current main's zero-position whole-list guard and path decoder. It fixes three attributable review findings (unsupported search syntax, repeated identical constraints and stale query-only counters), ambiguous empty-page convention inference, and counter omission across envelopes. Independent Codex review found one further query-total omission case; a failing service regression now protects it, distinguishing absence from a genuinely contradictory count. Query normalization has one URL-boundary owner shared by learning, selection and write checks. The catalog clarifies
state.sourceversus the retained envelope'sreplay.exact_matchwithout changing either fact.Validation
check:fast, runtime build, docs/README and format checks passed.e27e63f9: 623 adjacent source tests and pinned static/build/docs/9 README checks pass; three 161-test retry/write runs and 8 compiled served-workflow boundaries pass. Nine regression assertions failed before correction. Retry success carries its full CheckOutcome through confirmation/placement/pending cleanup; targeted independent source re-review finds no definite remaining defect. Earlier integration also passed 36 service/schema boundaries and the complete 80-boundary set. Exact-head CI 39778527490 passed all selected lanes, including 8 shards, real agentenv, Linux native package and portable tests; unselected providers/platforms are not claimed qualified. Greptile completed exact head; no unresolved threads remain.per_page=3&page=2, and repeated full observation proving snapshot consistency. CLI/MCP agree; local serving returns exactly the held-out three facts with Evidence. No GitHub mutation.e93e3b1e7versus final head): main 10.07s wall/15.67s CPU/490.34MiB sampled family RSS, candidate 10.04s/15.48s/498.06MiB; three warm reads also agree. An earlier 20.13s candidate sample is retained. No speedup or slowdown attribution from single samples; OS caches/load uncontrolled.Current integration evidence and historical contributor measurements. Prior fifty-capture/six-application reports are historical contributor evidence, not rerun here. Real application-write fidelity, exhaustive query syntax/scale and deep providers remain unverified. Two unchanged-main write findings are attributed separately in #6262, not claimed fixed here.
Compatibility and safety
Merged normally as
293832bafc9a054914ec514fe906dd4936c7a372, original primary author retained, no bypass or Co-authored-by. Entire actual merge tree equals the reviewed head. Actual-merge rebuild, all 623 source tests, retained GitHub pagination and both native HTTP witness scenarios passed again; details in the closing verification comment.Additive optional query facts, existing states remain loadable; local retained Evidence only. No new provider, target execution or application mutation authority. Resource search remains bounded; no generic cache or duplicated CLI/MCP implementation.
Author readiness
Human owner: @earakely-scale
The contributor's existing readiness declarations above are preserved, not newly attested by the integration agent.
Before merge
type(scope): outcome.