[PR #5800] [MERGED] feat(environment): answer list filters, search, sorting and paging from the state #7072

Closed
opened 2026-11-01 21:45:10 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5800
Author: @earakely-scale
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @gensokyo-dev

Base: main ← Head: feat/environment-list-queries


📝 Commits (10+)

  • ad439bd feat(environment): extract the initial state a capture's reads observed
  • 7a668b7 Merge main into feat/environment-state-view
  • f2c9a2e fix(environment): bound state at redacted writes; infer identity only from items
  • 2999128 fix(environment): keep first sightings, one list pointer and linear field unions
  • a5c7b92 fix(environment): keep post-write values and partial lists out of the initial state
  • 4e93547 docs(environment): scope item-shaped and deleted written paths out of documents
  • aba9cb1 fix(environment): count writes in flight when a value changes between reads
  • 856c8c0 Merge main into feat/environment-state-view
  • 55480bd chore: merge main (5fa4defc) into environment state view
  • 9fee36d fix(environment): catch cross-tool changes across writes; read only item totals

📊 Changes

28 files changed (+2809 additions, -368 deletions)

View changed files

📝 docs/agent-environments.md (+10 -10)
➕ docs/specs/agent-environments/list-queries/plan.md (+14 -0)
➕ docs/specs/agent-environments/list-queries/spec.md (+86 -0)
➕ docs/specs/agent-environments/list-queries/tasks.md (+11 -0)
➕ docs/specs/agent-environments/list-queries/verification.md (+233 -0)
📝 docs/web-network-captures.md (+28 -0)
📝 src/application/environment/environmentStateAnswer.test.ts (+14 -0)
📝 src/application/environment/environmentStateAnswer.ts (+96 -132)
➕ src/application/environment/environmentStateCallLines.ts (+152 -0)
📝 src/application/environment/environmentStateCollections.ts (+2 -5)
📝 src/application/environment/environmentStateWriteAnswer.test.ts (+145 -17)
📝 src/application/environment/environmentStateWriteAnswer.ts (+1 -2)
📝 src/application/environment/environmentTools.test.ts (+13 -0)
📝 src/application/environment/environmentTools.ts (+1 -1)
📝 src/contracts/analysisViewToolContracts.ts (+1 -1)
📝 src/domain/analysisView/EnvironmentStateWriteSimulation.test.ts (+97 -0)
📝 src/domain/analysisView/EnvironmentStateWriteSimulation.ts (+48 -34)
➕ src/domain/analysisView/environmentStateCheckedLines.ts (+205 -0)
📝 src/domain/analysisView/environmentStateGate.ts (+127 -19)
➕ src/domain/analysisView/environmentStateListQuery.test.ts (+344 -0)

...and 8 more files

📄 Description

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.source versus the retained envelope's replay.exact_match without changing either fact.

Validation

  • Pinned Node 24.18.0/npm 11.16.0; check:fast, runtime build, docs/README and format checks passed.
  • Final head 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.
  • Real read-only GitHub labels: three captured requests, independent held-out native 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.
  • An actual owned minimal HTTP books application produced 7/8-request HAR sessions. CLI/MCP agree that an update excluded from the successful page stays unconfirmed, and only a later item witness confirms it. This is controlled native-HTTP verification, not third-party application-write fidelity.
  • Equivalent completed task: two reads/client slicing on main versus one modeled read; structured reply bytes 13,282 → 1,383, catalog 1,057 → 1,090 bytes. Latest same-base serial comparison (e93e3b1e7 versus 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.
  • Actual Codex CLI: all three sessions returned correct facts and provenance. Baseline two calls, 94,649 input/66,816 cached/246 output tokens; initial candidate still two calls, 79,752/59,904/284. With clarified catalog and unchanged prompt: one call, 53,308/46,848/205. Whole-session usage includes common runner context, not reply-byte estimates. Initial candidate's extra call is retained, not hidden. Final task 27.65s wall/19.56s CPU/952.25MiB sampled family RSS; all observed children exited.

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

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

The contributor's existing readiness declarations above are preserved, not newly attested by the integration agent.

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.

🔄 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/5800 **Author:** [@earakely-scale](https://github.com/earakely-scale) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Base:** `main` ← **Head:** `feat/environment-list-queries` --- ### 📝 Commits (10+) - [`ad439bd`](https://github.com/morluto/rea/commit/ad439bd2f26c61b442dcf758c2bb149e49657929) feat(environment): extract the initial state a capture's reads observed - [`7a668b7`](https://github.com/morluto/rea/commit/7a668b73f4783b42eb0e8ce1eeff079f86d53e22) Merge main into feat/environment-state-view - [`f2c9a2e`](https://github.com/morluto/rea/commit/f2c9a2e4462a7162224bec209f21dfa2622abe39) fix(environment): bound state at redacted writes; infer identity only from items - [`2999128`](https://github.com/morluto/rea/commit/2999128baedceabc738e9a5aa69bfcfec39a55f1) fix(environment): keep first sightings, one list pointer and linear field unions - [`a5c7b92`](https://github.com/morluto/rea/commit/a5c7b9236c48094bc4af24ae055e8d67e3968477) fix(environment): keep post-write values and partial lists out of the initial state - [`4e93547`](https://github.com/morluto/rea/commit/4e93547c846444e891e2a2267425c316e6ee5218) docs(environment): scope item-shaped and deleted written paths out of documents - [`aba9cb1`](https://github.com/morluto/rea/commit/aba9cb15c8836b7592a51743d79bceab4dfd99af) fix(environment): count writes in flight when a value changes between reads - [`856c8c0`](https://github.com/morluto/rea/commit/856c8c0b50ec11e4ba96cb6172b7cfe01ef6829f) Merge main into feat/environment-state-view - [`55480bd`](https://github.com/morluto/rea/commit/55480bdf7e3275e3be8903e53baabe28be81a9a9) chore: merge main (5fa4defc) into environment state view - [`9fee36d`](https://github.com/morluto/rea/commit/9fee36d3155145fa8e568b34713e0e68c7675216) fix(environment): catch cross-tool changes across writes; read only item totals ### 📊 Changes **28 files changed** (+2809 additions, -368 deletions) <details> <summary>View changed files</summary> 📝 `docs/agent-environments.md` (+10 -10) ➕ `docs/specs/agent-environments/list-queries/plan.md` (+14 -0) ➕ `docs/specs/agent-environments/list-queries/spec.md` (+86 -0) ➕ `docs/specs/agent-environments/list-queries/tasks.md` (+11 -0) ➕ `docs/specs/agent-environments/list-queries/verification.md` (+233 -0) 📝 `docs/web-network-captures.md` (+28 -0) 📝 `src/application/environment/environmentStateAnswer.test.ts` (+14 -0) 📝 `src/application/environment/environmentStateAnswer.ts` (+96 -132) ➕ `src/application/environment/environmentStateCallLines.ts` (+152 -0) 📝 `src/application/environment/environmentStateCollections.ts` (+2 -5) 📝 `src/application/environment/environmentStateWriteAnswer.test.ts` (+145 -17) 📝 `src/application/environment/environmentStateWriteAnswer.ts` (+1 -2) 📝 `src/application/environment/environmentTools.test.ts` (+13 -0) 📝 `src/application/environment/environmentTools.ts` (+1 -1) 📝 `src/contracts/analysisViewToolContracts.ts` (+1 -1) 📝 `src/domain/analysisView/EnvironmentStateWriteSimulation.test.ts` (+97 -0) 📝 `src/domain/analysisView/EnvironmentStateWriteSimulation.ts` (+48 -34) ➕ `src/domain/analysisView/environmentStateCheckedLines.ts` (+205 -0) 📝 `src/domain/analysisView/environmentStateGate.ts` (+127 -19) ➕ `src/domain/analysisView/environmentStateListQuery.test.ts` (+344 -0) _...and 8 more files_ </details> ### 📄 Description ## 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.source` versus the retained envelope's `replay.exact_match` without changing either fact. ## Validation - Pinned Node 24.18.0/npm 11.16.0; `check:fast`, runtime build, docs/README and format checks passed. - Final head `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](https://github.com/morluto/rea/actions/runs/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. - Real read-only GitHub labels: three captured requests, independent held-out native `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. - An actual owned minimal HTTP books application produced 7/8-request HAR sessions. CLI/MCP agree that an update excluded from the successful page stays unconfirmed, and only a later item witness confirms it. This is controlled native-HTTP verification, not third-party application-write fidelity. - Equivalent completed task: two reads/client slicing on main versus one modeled read; structured reply bytes 13,282 → 1,383, catalog 1,057 → 1,090 bytes. Latest same-base serial comparison (`e93e3b1e7` versus 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. - Actual Codex CLI: all three sessions returned correct facts and provenance. Baseline two calls, 94,649 input/66,816 cached/246 output tokens; initial candidate still two calls, 79,752/59,904/284. With clarified catalog and unchanged prompt: one call, 53,308/46,848/205. Whole-session usage includes common runner context, not reply-byte estimates. Initial candidate's extra call is retained, not hidden. Final task 27.65s wall/19.56s CPU/952.25MiB sampled family RSS; all observed children exited. [Current integration evidence and historical contributor measurements](docs/specs/agent-environments/list-queries/verification.md). 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 - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. The contributor's existing readiness declarations above are preserved, not newly attested by the integration agent. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:45:10 +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#7072
No description provided.