Repository navigation
P5 O10 M10 follow-up: an unenrolled mawsd answers status, keys and policy without loading its endpoint - #315
Conversation
…d policy without loading its endpoint The seam, the command line through a real daemon, and the built daemon's process scene hold that a read-only command over a state directory that holds nothing loads no module and answers byte for byte as the module started on it does (test/endpoint/presence.test.ts compares the two against the real module); every other command, argument or state directory is the module's. The packaged check's `endpoint status` now answers unenrolled with no load, and `enroll` with a non-code is the command that loads the chunk from app.asar. Each fails on M10's code (cbc9402): the module loads at the first read-only command. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…awsd no module (P5 Decision Log 114's lever (a)) M10 loaded the endpoint at the first `daemon.endpoint` command of any kind, so one `mawsd endpoint status` or `mawsd keys` on an unenrolled machine kept about 6 MiB resident until restart. Now `status`, `keys` and `policy`, bare or `--json`, are answered by the seam while the module is unloaded and the state directory is private and holds nothing: presence.ts renders them through answers.ts, the renderers the module's cli.ts now uses too, so both say the same bytes, and UNENROLLED_STATUS is the module's own endpointStatus over no state. Anything else (another command, other arguments, a directory holding any file or directory, or one the store would refuse) loads the module as before, which answers with its own parsing and refusals; a load under way is awaited. `legacy status` stays the module's: it counts key copies under stale-<time>/. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…h is the module's to answer `holdsNothing` passed a state directory at mode 0400 or 0600: `assertPrivateDirectory` looks only at the group and other bits and `readdirSync` needs only read permission. But the module's EndpointState.open lstats each state file inside it, gets EACCES and rethrows, so its start fails and its command line answers code 3, the endpoint has not started, where the seam answered a successful unenrolled reply. Now the seam also requires that the process can read and search the directory (accessSync R_OK | X_OK); anything that fails is the module's to answer, as before. The test sets a 0600 directory beside the 0750 one, expects no seam answer, and starts the real module on it to hold that its `keys` is not code 0 (skipped for root, which searches any directory). It fails on the previous code: the seam answers `keys` over the 0600 directory. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…ch is actually denied The case chmodded the state directory to 0600 and assumed that denies search, guarded only by a root check. On macOS chmod leaves inherited ACLs in place: a temporary directory carrying an owner `allow search,directory_inherit` ACL leaves the fixture searchable, so the seam rightly answers, the real module starts, and the test's `toBeNull()` failed falsely. Now the block asks `accessSync(X_OK)` after the chmod and runs its assertions only when that is denied; the check replaces the root guard, since root searches any directory too. The restore to 0700 stays in the `finally`. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…near PATH_MAX (O10 M10 follow-up's review) Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
docs/tech-debt-tracker.md: both sides appended a row; both kept. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…) into p5-o10-readonly Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…p5-o10-readonly The tracker's two new rows, the unloaded answers' PATH_MAX gap and session-plane's holdOrgKey set-up, both kept. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Codex Review SummaryThis 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. |
|
Landing set on a172fb1 (master d392c4d, no drift): run 40777141227 GREEN, 12/12 jobs. Class 1a (static, probes, unit 1-4/4), hosted e2e:default, e2e:desk-web-hub, e2e:supervisor-daemon, e2e:daemon-unit and packaged; no flaky lines. The tested tree equals the head's tree (da930f384). unit:darwin needs the mini, which is under a measured hold tonight; it runs once CI-opt slots it. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook) |
…up.sh missing-bus row Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
|
Post-landing: unit:darwin on a172fb1 passed too, run 40782939608 (EC2 Mac). Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook) |
P5 O10 M10's follow-up, owed in P5 Decision Log 124 (lever (a) of Decision Log 114). Before this change, an unenrolled
mawsdloaded its endpoint module for anydaemon.endpointcommand. That means onemawsd endpoint statusormawsd keyson a machine that never enrolled kept about 6 MiB resident until restart. Nowstatus,keysandpolicy(bare or--json) are answered without loading the module. This happens only when the endpoint's state directory is private, readable and searchable by the process, and holds nothing.What changed
src/endpoint/answers.ts(new): the three commands' renderers, from plain values. The module'scli.tsnow uses them too, so the seam's answer and the module's are the same bytes. It imports nothing at run time, since it ridesmawsd's run path.src/endpoint/presence.ts:unloadedAnswerandholdsNothing.assertPrivateDirectory), readable and searchable (accessSync(R_OK | X_OK)), and empty.src/mawsd/endpoint-seam.ts: asksunloadedAnswerbefore loading.src/endpoint/cli.tsandpolicy.ts: render throughanswers.ts.legacy statusstays the module's, because it counts key copies understale-<time>/.e2e/supervisor-packaged.spec.ts: the packaged expectation flips. A read-only command on the packaged, unenrolledmawsdno longer loads the endpoint.Tests
test/endpoint/presence.test.ts: the seam's answer equals the module's for each command and form over an unenrolled state. Each disqualifying case is covered:src/mawsd/endpoint-seam.test.ts,cli.test.tsandprocess-endpoint.test.ts: the module stays unloaded after a read-only command, and loads for anything else.Review
A doperpowers:reviewer-medium review over two rounds. Its findings were fixed in dfd9cd4 (the unsearchable directory) and ebab91f (that test's ACL guard). The remaining finding is logged in
docs/tech-debt-tracker.md(f76e26a): a state directory whose path is within a few bytes of PATH_MAX answers code 3 from the module where the seam would answer 0.Validation
Both runs below are on 696a1e4, before this merge of master:
e2e:supervisor-daemon,e2e:daemon-unitande2e:desk-web-hub. Green, with oneflaky: session-plane.spec.ts:124, the holdOrgKey set-up row master's tracker now carries.packagedandunit:darwin. Green.The landing set on this head (a172fb1, origin/master merged with #310 in it):
e2e:default,e2e:desk-web-hub,e2e:supervisor-daemon,e2e:daemon-unitandpackaged;unit:darwin, once tonight's measured series has left the mini.Run ids follow in a comment.
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)