Repository navigation
feat(desktop): name a record by a nested field or a child's attribute - #9185
Conversation
[High impact] The changes reach shared capture, export, task-drafting, and grading paths for desktop app workflows. The PR needs fixes for generated-ID filtering and the still-open exported XML reader mismatch before merging. FindingsFix with agent prompt### Issue 1
src/domain/desktop/appTaskDraft.ts:297-304
The new filter treats every GUID-valued field as a generated record ID. Changing a JSON `selectedAccount` setting-or an INI key holding an existing profile's ID-therefore loses its check. With another edit present, the task can pass without switching accounts.
The reverse mismatch also exists: `pairRecordsById` treats `ID_329023692` as generated, but this narrower filter keeps an exact check for it, so another run's new ID fails.
Carry the chosen ID field and its generated-ID decision into drafting. Do not classify every field by its value alone.
### Issue 2
src/domain/desktop/stateFormats.ts:undefined-253
`map.dat` files starting with names such as `<Ϳ>` or `<𐀀>` now use XML checks in TypeScript, but the exported reader still uses `expat`, which rejects these valid XML names. `_text_view` then falls back to text. A check at `/root/...` can pass during export and fail against the same saved document in the bundle.
Make the two readers support the same names, and add a parity case outside the older Unicode name ranges.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThe PR adds nested-field and child-attribute selectors and expands desktop task drafting, capture, and export behavior.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
Capture[Captured files] --> Views[Typed document views]
Views --> Pair[Pair and name records]
Pair --> Draft[Checks, values, and guards]
Draft --> Export[Validate seed and end]
Export --> Bundle[Exported bundle]
Bundle --> Saved[Wait for saved files]
Saved --> Grade[Python verifier]
Reviews (11) · Last reviewed commit: "Merge remote-tracking branch 'live-5600/..." · Reviewed by Greptile |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
@morluto this one is ready for review. It merges cleanly into main, and all checks pass. It's stacked on #9132. It lets a selector's One known edge case is left for a follow-up: a record added to a top-level JSON array that repeats another record's fields gets no suggested check, because a top-level array can't be counted yet. |
# Conflicts: # docs/desktop-build-computer.md # docs/desktop-build-witness.md # docs/specs/desktop-app-environments/build-witness/spec.md # src/domain/desktop/appTaskChecks.fixture.ts # src/domain/desktop/appTaskChecks.test.ts # src/domain/desktop/appTaskChecks.ts # src/domain/desktop/appTaskPython.ts
…d-batch-followups
# Conflicts: # src/domain/desktop/appTaskDraftNoise.test.ts
# Conflicts: # src/application/desktop/DesktopApplicationExport.ts # src/application/desktop/DesktopBuildComputers.ts # src/desktop/AgentEnvComputer.ts # src/domain/desktop/stateRoles.ts
# Conflicts: # docs/desktop-application-tasks.md # docs/desktop-build-witness.md # docs/specs/desktop-app-environments/build-witness/spec.md # src/domain/desktop/appTaskDraftNamed.ts # src/domain/desktop/appTaskDraftNoise.ts # src/domain/desktop/appTaskDraftValues.test.ts
# Conflicts: # src/domain/desktop/appTaskDraftNamed.ts # src/domain/desktop/appTaskDraftNoise.ts
# Conflicts: # src/composition/capabilityServices.ts
# Conflicts: # .agents/skills/reverse-engineer-anything/references/desktop-build.md # docs/desktop-application-capture.md # docs/desktop-application-export.md # docs/desktop-application-state.md # docs/desktop-application-tasks.md # docs/desktop-build-computer.md # docs/desktop-build-witness.md # docs/specs/desktop-app-environments/build-witness/spec.md # docs/specs/desktop-app-environments/build-witness/verification.md # src/application/desktop/DesktopApplicationCapture.ts # src/application/desktop/DesktopApplicationExport.test.ts # src/application/desktop/DesktopApplicationExport.ts # src/application/desktop/DesktopBuildBundle.ts # src/application/desktop/DesktopBuildCapture.ts # src/application/desktop/DesktopBuildComputers.ts # src/application/desktop/DesktopBuildOutputRead.test.ts # src/application/desktop/DesktopBuildSummary.ts # src/application/desktop/DesktopBuildWitness.test.ts # src/application/desktop/DesktopExportFiles.ts # src/application/desktop/DesktopExportLaunch.ts # src/application/desktop/DesktopGzipDocument.test.ts # src/application/desktop/DesktopTaskDraft.ts # src/application/desktop/DesktopTaskDraftNotes.test.ts # src/application/desktop/DesktopTaskExport.test.ts # src/contracts/desktopBuildToolContracts.ts # src/desktop/DesktopApplicationSession.test.ts # src/domain/desktop/appExport.test.ts # src/domain/desktop/appExport.ts # src/domain/desktop/appExportPython.ts # src/domain/desktop/appExportUnowned.test.ts # src/domain/desktop/appExportUnowned.ts # src/domain/desktop/appTaskChecks.fixture.ts # src/domain/desktop/appTaskChecks.ts # src/domain/desktop/appTaskDraft.fixture.ts # src/domain/desktop/appTaskDraft.ts # src/domain/desktop/appTaskDraftAdded.test.ts # src/domain/desktop/appTaskDraftAdded.ts # src/domain/desktop/appTaskDraftFileNotes.test.ts # src/domain/desktop/appTaskDraftFileNotes.ts # src/domain/desktop/appTaskDraftGuards.test.ts # src/domain/desktop/appTaskDraftGuards.ts # src/domain/desktop/appTaskDraftLineGuards.ts # src/domain/desktop/appTaskDraftNamed.ts # src/domain/desktop/appTaskDraftNoise.test.ts # src/domain/desktop/appTaskDraftNoise.ts # src/domain/desktop/appTaskDraftNotes.ts # src/domain/desktop/appTaskDraftPositional.test.ts # src/domain/desktop/appTaskDraftScalars.ts # src/domain/desktop/appTaskDraftText.ts # src/domain/desktop/appTaskDraftTextAdded.test.ts # src/domain/desktop/appTaskDraftValues.test.ts # src/domain/desktop/appTaskDraftValues.ts # src/domain/desktop/appTaskPython.ts # src/domain/desktop/attributeRank.ts # src/domain/desktop/desktopCapture.test.ts # src/domain/desktop/desktopCapture.ts # src/domain/desktop/positionalKeys.ts # src/domain/desktop/runtimeFiles.ts # src/domain/desktop/seedDocument.test.ts # src/domain/desktop/seedScrub.ts # src/domain/desktop/selectorCandidates.ts # src/domain/desktop/stateChanges.ts # src/domain/desktop/stateFormats.ts # src/domain/desktop/stateRoles.test.ts # src/domain/desktop/stateRoles.ts # src/domain/desktop/viewPointer.test.ts # src/domain/desktop/viewPointer.ts # tests/boundary/mcp/buildCaptureDraftMcp.test.ts # tests/boundary/mcp/buildCaptureRetryMcp.test.ts # tests/boundary/mcp/buildComputerMcp.test.ts # tests/boundary/providers/desktopExportPython.test.ts # tests/fixtures/buildCaptureFakes.ts
# Conflicts: # .agents/skills/reverse-engineer-anything/references/desktop-build.md # docs/desktop-application-tasks.md # docs/desktop-build-witness.md # docs/specs/desktop-app-environments/tasks/spec.md # src/domain/desktop/appTask.ts # src/domain/desktop/appTaskChecks.fixture.ts # src/domain/desktop/appTaskChecks.test.ts # src/domain/desktop/appTaskChecks.ts # src/domain/desktop/appTaskDraft.ts # src/domain/desktop/appTaskDraftAdded.ts # src/domain/desktop/appTaskDraftAlternatives.ts # src/domain/desktop/appTaskDraftAttributeText.ts # src/domain/desktop/appTaskDraftCounts.ts # src/domain/desktop/appTaskDraftFileNotes.ts # src/domain/desktop/appTaskDraftGuards.test.ts # src/domain/desktop/appTaskDraftGuards.ts # src/domain/desktop/appTaskDraftItems.ts # src/domain/desktop/appTaskDraftJson.test.ts # src/domain/desktop/appTaskDraftJson.ts # src/domain/desktop/appTaskDraftLineGuards.test.ts # src/domain/desktop/appTaskDraftMemberCount.ts # src/domain/desktop/appTaskDraftMirrors.ts # src/domain/desktop/appTaskDraftNamed.ts # src/domain/desktop/appTaskDraftNested.ts # src/domain/desktop/appTaskDraftNoise.ts # src/domain/desktop/appTaskDraftPositional.test.ts # src/domain/desktop/appTaskDraftSteps.ts # src/domain/desktop/appTaskDraftText.ts # src/domain/desktop/appTaskDraftTree.ts # src/domain/desktop/appTaskDraftValues.test.ts # src/domain/desktop/appTaskDraftValues.ts # src/domain/desktop/appTaskPython.ts # src/domain/desktop/appTaskPythonPointer.ts # src/domain/desktop/jsonRecordPairing.ts # src/domain/desktop/memberPairing.ts # src/domain/desktop/selectorCandidates.test.ts # src/domain/desktop/selectorCandidates.ts # src/domain/desktop/stateChanges.ts # src/domain/desktop/viewPointer.ts # src/domain/desktop/viewSelector.ts
* fix(cli): record the caller HAR path in environment-build evidence environment-build inspected a HAR without the caller path that inspect-web-network-capture records, so the published evidence.json omitted caller_input_path and failed the byte-for-byte portable check. Also update three stale portable expectations that already fail on main: the no-reader verifier digest matches the #9185 selector parent, uncapped IDA callee pages report complete discovery, and a CLI refusal of a malformed artifact inspection includes the undelivered source closure. * fix: restore portable docs, alias, offset, and Windows cleanup checks The witness page linked task anchors that were never written, so any docs-touching PR failed the route check. A selected state directory was restored as a dangling symlink by a duplicated helper. An empty safetensors file reports the extent as outside the file before offset conversion. Windows cleanup refusal uses the runtime's in-progress message. * fix(cli): keep the caller's HAR spelling in environment-build evidence inspect-web-network-capture records the path the caller typed. The one-shot build had already absolutized that path, so a relative capture disagreed with the three-step bundle. The byte-for-byte check now runs from the capture directory and requires caller_input_path grafana.har. * fix(desktop): create alias targets only for directory selections A missing settings file was created as a directory because the helper treated any absent path as a directory. The capture's selected path kind now travels with the alias, and only a directory alias creates its target. An absent file alias stays a file the app can create. * fix(desktop): keep legacy alias kind unknown Captures written before selected_paths.kind leave the alias unknown. Defaulting those to a directory makes an omitted settings file a directory, so a later write through the alias fails with EISDIR. * fix(desktop): keep alias kind a file, directory, or unknown The export plan was widening a missing selected path kind to string. Record file or directory only when the capture says so, and unknown otherwise. * fix(desktop): narrow a missing alias kind to unknown The selected path kind was widened to string, so the export plan could not keep the file, directory, or unknown distinction. * test(desktop): expect alias kind in the rendered app module The export now records whether a selected alias is a directory. The rendered STATE_ALIASES tuples include that kind. * fix(ghidra): reject an oversized Windows TCP endpoint as invalid The POSIX read maps a record past the compact endpoint bound to "Ghidra TCP endpoint is invalid". The Windows lease reported that same bound as a generic observation failure, so an expanded endpoint failed the Windows lane with a different message. * fix(desktop): create a legacy alias when a child proves it is a directory A capture written before selected path kind can still nest one alias inside another. That parent is a directory. A legacy leaf stays unknown so a missing settings file is not created as a directory. * fix(desktop): restore selected aliases when the app owns no files An empty state directory does not become an owned path, so the class was ownless and never called _ensure_state_aliases. The ownless class now restores aliases whenever the export recorded some. * fix(desktop): create the parent of a missing file alias A file alias must stay a file. When its parent directory was not seeded, the symlink was dangling and a write through it failed with ENOENT. * ci: retrigger checks after an unrelated Windows timeout The Windows lane timed out in webModuleCli, which this diff does not touch, and the rerun API is unavailable. * test(evidence): preserve complete CLI refusal diagnostics --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: gensokyo-dev <[email protected]>
Summary
A selector's
>condition takes a path. A task can now name a record whose id the app generates by a field inside it, in JSON as it already could in XML, and can name an XML element by a child's attribute. The task draft uses both forms.Problem and expected behavior
Two request-built apps hit the gap:
{"uid": "<32 hex, generated>", "format": "BOOK", "data": {"Title": …}}, sorted by uid.<object id="submit_button">under an attribute-less<child>.<child>by that id, so the draft fell back to[>packing=TrueTrue1], which a moved button fails.After this change:
[>data/Title=The Silk Roads]([>data~1Title=…]in a pointer)data.Titleis the value[>A/B=VALUE][>object@id=submit_button]objectwhose attributeidis the valueA path has at most three steps. Only strings are compared, as in every condition today. A
>condition with one step and no@reads exactly as before.The draft:
[format=BOOK][>data~1Title=The Silk Roads], and checks its other fields through that selector;[name=child][>object@id=submit_button]and[>object@id=cancel_button].Change and scope
viewSelector.ts: the path, with at most 3 steps and no empty one; a longer or malformed path is refused at parse.viewPointer.ts: matching, for both XML and JSON members.appTaskPythonPointer.ts: the exported verifier's same rules.jsonRecordPairing.tsnames a record that only one end holds, and whose id the app generated, by its kind field plus its first name-like string field. Fields are searched nearest first, up to 3 keys deep, and the field must name the record alone at its end and nothing at the other.selectorCandidates.tsranks a child's own text first, then a child's id or name attribute, then text joined from a child's elements.appTaskDraft.tsandappTaskDraftJson.tsskip a check of a field the selector already reads, unless no other check reads that record, so a new record holding only its name is still checked.>table and the draft rules indesktop-application-tasks.md;[>KEY=…]reads a JSON member's own field; before, it matched nothing in JSON.The design and its decisions (1a 2a 3a 4a 5a, decided 2026-11-06) are in the desktop-environments design note "name a record by a nested field or a child's attribute".
Contract and boundary impact
matchingaccepts and documents[>PATH=VALUE]. No new inputs.docs/public/product-catalog.json), package, or installation impact: none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
Tests added or updated: 10 tests fail on the base sources and pass now:
matching;Base reproduction or other evidence: a 38-app replay of request-built drafts. Only TreeLine and Glade change:
by_positionnote is gone.User-visible CLI/MCP output (if applicable): draft suggestions only, shown above.
Real apps: TreeLine and Glade were rebuilt from their original requests on an arm64 build computer running
04c89d52e. Both witnesses held on the first try.[format=BOOK][>data~1Title=The Clockwork Ocean]and checked its Author and Copyright through it. Before this PR, every suggestion for that request was positional.[>object@id=submit_button]and[>object@id=cancel_button], with a count guard on the action area, and all three were kept unchanged. Before this PR, it drafted packing-based selectors.dac1ec92ecloses what TreeLine's draft still lacked against the build agent's hand-written checks:children: [], which every book holds;A test on the real seed reproduces the old draft at the base and the new one here.
236780baefixes the review findings, each with a test that fails atdac1ec92e:Remaining proof gaps:
236780bae, because its harness was lost. The new tests cover the three cases it changes.For evidence-bearing changes:
Validation performed
After
eea99c7c72: all 555 desktop domain tests andnpm run typecheckpassed locally. The new root-array test covers draft generation, additions, removals, guards, and check evaluation. No new real-app run was performed; the stacked branch currently conflicts with the base.npx oxfmt --check .: passed. oxlint on the changed files: no diagnostics.npm run typecheck: no errors outside the API-contract files, which fail only on a dependency missing locally.The desktop, build MCP, desktop CLI and provider test selection plus the advertised-pattern test: 1,222 passed. 20 failed, all in two suites that fail on the base locally because a build is missing.
npm run verify:module-boundaries: passed. The skill reference check and README consistency (9/9): passed.After
236780bae:src/domain/desktop,src/application/desktop, the build MCP tests and the advertised-pattern test: 801 passed, 12 skipped, none failed. oxlint on the changed files: no diagnostics.Compatibility, safety, and release
>key with/or@now reads a path instead of an odd child name. No REA draft has written such a key.[>KEY=…]now matches the member's own field.Maintainer follow-up
Selectors now carry the declared document format across every producer and consumer instead of inferring XML semantics from object shape. ZIP traversal selects archive metadata as JSON and switches to the entry format only at its view. Comparisons retain each side's format and use resolvable positional pairing if entry formats differ. Python member-count evaluation resolves format once outside the member loop. Parent ITEXT, relationship-ID, multiline-text, alias and caller-selected-path repairs are retained. The JSON-shaped XML, ZIP metadata traversal and format-change regressions failed before repair; TypeScript and generated Python now agree. Additional checks passed:
npm run docs:check.At head
9072516c2f, the affected tests below completed with 718 passed (718);npm run check:fast,npm run format:checkandgit diff --checkpassed. This includes the updated parent stack and main through25d3c7237f. Checks use source/domain and controlled boundary fixtures; no real desktop provider qualification was performed. Current-head CI and review remain required before auto-merge.Author readiness
Human owner: @earakely-scale
Before merge
type(scope): outcome.🤖 Generated with Claude Code