Repository navigation
feat(desktop): read namespaced XML alike in REA and the exported verifier - #8994
Closed
earakely-scale wants to merge 134 commits into
Closed
earakely-scale wants to merge 134 commits into
earakely-scale wants to merge 134 commits into
Conversation
Add `capture-desktop-application`, a CLI-only, Linux and X11 capture that launches an installed desktop application, watches it while it is used and writes capture Evidence plus SHA-256 addressed content: - inventory: desktop entry, launch command, executable, package and its apt sources (or snap, flatpak, AppImage), Electron markers and candidate state directories; - session: the launched process tree, client windows from xprop with the first application window time and a window match, and files held open; - state: a stat walk of the home directory before launch, at checkpoints read from stdin, at stop and after exit, with created, modified, deleted and retyped paths and the content of changed files and state directories. It refuses non-Linux hosts, missing DISPLAY or xprop, a non-empty output folder and an application whose window is already open, and signals only processes it started. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cancelled captures - Launch through the owned provider path with a run token; release with SIGTERM, then the token-verified group cleanup, after every session. Processes without the token are never signalled; each records whether it carries it, and the session records whether cleanup was verified. - Report creations and deletions only where a walk listed the nearest existing directory; count the rest as unconfirmed. - Retain a file only when it is still the walked version, through owned no-follow reads; charge the budget only for new content; create files exclusively in a private output folder owned by the caller. - Walk content roots outside the home directory, compare paths in their physical spelling, and run executables from the caller's directory. - Refuse when the window list cannot be read, re-evaluate window ownership each sample, handle one queued request per sample with a bounded stdin queue, and write the capture with end reason `cancelled` on interruption. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Allow a capture cancelled before any requested checkpoint to hold only the baseline. - Retry an incomplete stop once; if cleanup is still unverified, write the capture and fail with the run token and process group as cleanup resources. - Classify path changes after a walk (ENOTDIR and other selected-file errors) as changed_since_walk instead of failing the capture. - Treat a non-directory ancestor as proof that nothing existed beneath it. - Report a before digest only for the file version it was read from. - Derive stderr_truncated from stderr's own byte counts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Content reads pass retainFailedClose, so a handle whose close fails stays owned by the content store; the capture retries those closes after it is written and fails with the output folder as the cleanup resource if one still cannot be closed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add inspect-desktop-application-state, a CLI command that reads a capture folder into the application's state: every retained or changed file with its role and reasons, a typed JSON view of each version (SQLite through the shared worker, dconf through a private dconf dump, JSON, XML, key files, text) and the kinds of change between versions (lines, values, keys, rows). Co-Authored-By: Claude Opus 5.5 <[email protected]>
When both the launched processes and a retained file's handle remain unresolved after the capture is written, one cleanup error now lists both reasons and both resource sets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add export-desktop-application, which writes an agentenv bundle with one computer_app environment from a capture folder and its state view: the apt package, a boot launch matched on the captured window class with a window ready check, owned paths from the state roles, a seed of the baseline files, data hooks that call agentenv's add/get/reset helpers with a typed JSON view on get, a skill, a README and a deploy smoke task. The desktop CLI commands now load their services lazily. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Read key files, XML attributes, dconf groups and SQLite tables into dictionaries without inherited properties, so captured keys such as __proto__ stay data. - Version databases with their write-ahead log as of each checkpoint, and stage only digest-verified bytes for the SQLite and dconf readers. - Detect the format per version, report format changes, keep JSON null and empty containers as values, keep XML text and preserved whitespace, and mark truncated views (including XML depth) and comparisons of them. - Number versions and changes by checkpoint index, decide baseline presence from the captured type, and keep tagged SQLite integers, text bytes and blobs distinct. - Carry the capture's limitations and omitted content forward, match state directories by their home path, index changes once per capture, keep failed handle closes owned, and finish the CLI through the shared owner. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cation-export # Conflicts: # src/application/desktop/DesktopApplicationState.test.ts # src/application/desktop/DesktopApplicationState.ts # src/application/desktop/desktopCapture.fixture.ts # src/cli/desktopCaptureCommands.ts
- Read coverage flags only from formats whose readers write them, so JSON fields named truncated stay data. - Fail a SQLite version whose write-ahead log existed but was not retained or does not match its digest, instead of reading the database alone. - Close retained content on every exit, including cancellation, and report a close that still fails together with the primary failure. - Finish the CLI with the canonical operation name. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cation-export # Conflicts: # src/cli/desktopCaptureCommands.ts
- Refuse packages not from the Ubuntu 24.04 archive, since the computer installs by name from that archive. - Start the launch command in the captured working directory. - Respell the home path only in files the state view read as text. - Report files that were not retained instead of dropping them silently. - Load captured dconf keys for apps that own no files. - Keep home-level files as owned paths; rename reserved Python class names. - Mark truncated SQLite and text views in the class's get view, and read file types the way the state view does. - Release the output tree through a resource scope, and read seeds through an owner closed on every exit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…L values - Stage database bytes in a private runtime root released through a resource scope, so a failed removal keeps its owner and is reported with the read's outcome. - Report cleanup facts and owners from desktop failures instead of wrapping them as a plain adapter error. - Record the state directories as walked, in their physical spelling, and match roles against both spellings, so files in a symlinked state directory are not mistaken for selected documents. - Keep whitespace-only XML leaf values; drop only formatting between elements. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep whitespace-only leaf values and xml:space="preserve" text in the generated get view; drop only formatting between elements. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…captures - Release retained-content handles whose close failed through a resource scope on every exit; a release that fails again reports the exact handle owners. A read that finished keeps its bytes when only its close failed. - Accept captures written before state directories were recorded, and say in the state view's limitations that symlinked state directories may be misclassed for them. - Compute each XML element's whitespace context once instead of scanning siblings for every text run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Try the captured working directory only when an argument is relative, and start the app even when that folder is missing. - Cut the generated XML view at REA's node and depth limits, and keep one unreadable file from failing data/get. - Accept Ubuntu 24.04 mirrors, not only the canonical hosts; PPAs and other repositories are still refused. - Read seeds through the retained-content owner's new signature. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Stage a retained -journal beside its database so the SQLite worker accepts an inactive journal and refuses a hot one; a -wal or -journal that existed but was not retained (including one omitted at the baseline) makes the version unreadable. - Keep tables that read when another fails, and let cancellation and unfinished cleanup propagate instead of becoming view errors. - Read text as a key file only when every line parses as one. - Rank a file named in a window title or selected by the caller as a document even when the application holds it open; match titles on file-name boundaries; leave the display name out of dconf matching. - Bound JSON and key file views (4 MiB, 500 levels, exact numbers) and report too-large, missing and altered retained content separately. - Add no version or change while a database stays absent. - Read staged databases in place instead of copying them again. - Give Evidence the same limitations as the result. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Load captured dconf keys without D-Bus: install dconf-cli, compile the existing and captured key files into the user database, and warn on failure instead of stopping the server. - Start relative-argument launches in the captured working directory, the home included, since the framework launches from the app folder; respell the home itself and option values under it. - Read views in a thread, skip files over 64 MiB, align the generated readers with the state view's, and close SQLite connections. - Never own the home or a shared base folder; map a symlinked state directory's files back to their home spelling. - Report omitted files and unretained opened folders. - Name the module so it cannot shadow another, and keep the class off the module's own names; derive names the bundle check accepts. - Write seeds as they are read, and remove an unpublished bundle on failure. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Ask the launch process group and token carriers to exit before killing them, on errors too; report incomplete cleanup with its facts. - Count descendants of the launch as started by the capture even when their environment cannot be read; treat a reused pid as a new process. - Follow symlinked desktop entries; name a flatpak's state after its application id; match flatpak windows by name only. - Stop on end of input; refuse empty, duplicate and reserved checkpoint names; require whitespace after the checkpoint keyword. - Stay on each walk root's device, and never walk or retain `/` or a directory containing the home; say so in the limitations. - Refuse a window manager that does not publish _NET_CLIENT_LIST. - Remove retained content when a capture fails before it is written. - Skip reading a file larger than the remaining content budget. - Record apt's archive origin for each package source. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lication-state # Conflicts: # docs/desktop-application-capture.md # src/cli/desktopCaptureCommands.ts
xfwm4 leaves _NET_CLIENT_LIST unset while it manages no windows, so the capture refused an ordinary desktop with nothing open. Read _NET_SUPPORTED with the list: an unset list means no windows when the window manager supports it, and the capture is refused only when it does not. `xprop`'s "no such atom" output now reads as unset too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ays once per diff - Both zip readers now read the central directory a record at a time, keep the first 1,000 file records and count the rest, then hand the library an archive whose directory holds only those. Directories are told apart as zip.js does, so the Python reader stops listing attribute-marked directories as files. 600,000 entries now peak at 1.3 MiB in Python (was 293.6 MiB) and need 24 MiB of heap in REA. - The exported Python zip reader moves to appExportPythonZip.ts. - Diffs look members up through an index built once per compared array, so 20,000 selector keys against 20,000 members take 31 ms, not 5.4 s. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The exported module now takes both split-out readers, the XML one and the zip one. The zip test's peak helper uses the shared Python harness. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 5, 2026
Merged
…ip64 locators without sentinels - The diff resolves all of a record's selector-shaped keys in one lookup: conditions are normalized per field, selectors grouped by field set, and only the values asked for are kept, so retained memory grows with the keys, not members times field sets (68 MB to 5.5 MB, 76 MB to 4.9 MB on the reported cases). - Both zip readers follow a Zip64 locator just before the end record whatever the classic record holds, as zipfile does, so valid Zip64 archives with ordinary classic values read again. The exported module's synthetic tail carries a real Zip64 end record, so bytes that only look like a locator no longer make zipfile refuse it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
earakely-scale
added a commit
to earakely-scale/rea
that referenced
this pull request
Nov 5, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
earakely-scale
added a commit
to earakely-scale/rea
that referenced
this pull request
Nov 5, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
earakely-scale
added a commit
to earakely-scale/rea
that referenced
this pull request
Nov 5, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
3 tasks done
… and refuse oversized and deep text before building a view - Pairing: an element with an identifier (name, id, xid, *:id) pairs only by it, so an unchanged id still names an edited element instead of a removal and an addition, and two objects of one type are never paired as a rename. Selectors keep the tag apart from each attribute condition and spell only the chosen one, so a long tag with many attributes no longer multiplies. - Size: REA's detection and the exported reader decide JSON with a scanner that builds no value, and refuse a view over the parsed-view limit before building it, in files and zip entries alike. - Deep text: the exported reader confirms the whole text is JSON before reporting a nesting depth error, as REA reads it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> # Conflicts: # docs/specs/desktop-app-environments/document-views/spec.md
earakely-scale
added a commit
to earakely-scale/rea
that referenced
this pull request
Nov 5, 2026
…-checks branch Co-Authored-By: Claude Opus 5.5 <[email protected]>
earakely-scale
added a commit
to earakely-scale/rea
that referenced
this pull request
Nov 5, 2026
…building Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ntified elements choose only their identifiers Identity-first pairing also dropped an identified sibling's other attributes from the counts that prove a selector names one member, so a shared attribute such as `color` or `fill` could be chosen though it matched two siblings: the diff reported present elements removed and drafts lost their checks. Counting now covers every attribute of every sibling; only the choice is limited to an identified element's tag and identifiers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
earakely-scale
added a commit
to earakely-scale/rea
that referenced
this pull request
Nov 6, 2026
… text-checks branch Co-Authored-By: Claude Opus 5.5 <[email protected]>
earakely-scale
added a commit
to earakely-scale/rea
that referenced
this pull request
Nov 6, 2026
… for building Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
|
Closing as superseded: the changes here landed on main through #9037 ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Desktop task checks can now point into namespaced XML, such as Inkscape SVGs and the
content.xmlinside LibreOffice and other ODF documents. Before this change, the export refused such checks because REA's view and the exported Python reader spelled namespaced names differently.Problem and expected behavior
A five-app scorecard on #8988 hit this on two apps. Inkscape saves
poster.svgwith the SVG namespace both as the default and assvg:, plusinkscape:andsodipodi:attributes. Writer savescontent.xmlwithoffice:,text:andstyle:names. REA's TypeScript view kept names as the document spells them (text:p,sodipodi:docname). The exported reader used ElementTree, which spells them{urn:oasis:names:tc:opendocument:xmlns:text:1.0}p. A check written against REA's view therefore could not pass in the verifier, so export refused it. The only checks left for these apps were that a file exists.After this change, the export accepts these checks, and both evaluators fail them before the edit and pass them after:
[ {"id": "headline", "kind": "value_equals", "file": "Pictures/poster.svg", "pointer": "/root/children/[name=g][@inkscape:label=Layer 1]/children/[name=text][@id=headline]/children/[name=tspan]/children/0", "value": "Summer Bake Sale"}, {"id": "date", "kind": "value_equals", "file": "Documents/flyer.odt", "pointer": "/entries/[name=content.xml]/view/root/children/[name=office:body]/children/[name=office:text]/children/[name=text:p][@text:style-name=Subtitle]/children/0", "value": "Monday 24 November"} ]Change and scope
xmlnsandxmlns:PREFIXattributes, in document order.{uri}localin both: it would change every existing view and pointer, and it cannot be mapped back to a prefix when a document binds one namespace twice, as Inkscape does.xml.parsers.expatreplaces ElementTree, in two passes:xmlns:p="",a:b:c, and a processing-instruction target with a colon. DOCTYPEs are still refused.xml:spacerules. It builds only the nodes it keeps, where the old code built a tree of the whole file.namesXmlNamespace. The task draft no longer skips namespaced XML, in plain files or in zip entries. For the.odtit suggests[name=text:p][@text:style-name=Subtitle].document-viewsandtasksspecs, with the "XML names / CDATA" known difference removed.Contract and boundary impact
appExportPython.ts; REA's own view is unchanged.Expected effects:
Evidence and regression coverage
All 11 new or changed behavior tests fail on the parent commit and pass here. The refactored zip and FreeCAD tests pass on both.
tests/boundary/providers/desktopXmlPython.test.ts, new):.odtviews are equal between the readers;xml:attributes,xmlns="", and documents both parsers refuse;.odtentry view indesktopZipPython.test.tsis now fully equal. The Python harness is shared intests/support/desktopExportPython.ts.DesktopArchiveTask.test.tsexports a[name=text:p]check;appTaskDraft.test.tsdrafts prefixed selectors in a zip entry and in a plain XML file.tests/fixtures/inkscape/andtests/fixtures/libreoffice/, before and after saves made by Inkscape 1.2.2 and LibreOffice 24.2.7.2 on Ubuntu 24.04, each with a README.Document.xmlfixtures. The other 15 differ only in namespaced names,xml:attributes or CDATA, and each now equals REA's view.For evidence-bearing changes:
Validation performed
npm run typecheck,lint,lint:typed,format:check,build:cachedthenknip,jscpd,docs:check,docs:build,verify:test-discoveryandverify:architecture-guards.data/reset. Claude Code with Sonnet 5.5 passed 3 of 3 runs on each.Compatibility, safety, and release
Known gaps:
str.strip()against JStrim(). They disagree only for U+FEFF and U+0085. This predates the change.Author readiness
Human owner: @earakely-scale
Before merge
type(scope): outcome.🤖 Generated with Claude Code