refactor(macos): derive macOS surface routing from one owner table - #2886
Conversation
Size Report
Startup median (7 runs, lower is better):
|
|
Reviewed at 086d44e. The routing logic looks sound. Could the owner table, Not blocking: the crop refusal now names a different target for I did not run typecheck or tests, and I did not repeat the live macOS runs; I rely on the reported results. Smoke Tests was still running at review time. If it is the macOS job, it covers this diff directly ( |
086d44e to
d5e451d
Compare
|
Addressed the 11:36Z review. Rebased onto
Gate on |
…wner Add a SessionSurface-keyed MACOS_SURFACE_BACKENDS table in contracts with macOsSurfaceBackend and a table-derived MacOsHelperSurface brand. The platform-apple snapshot, screenshot, readText, press, runtime capture and native find sites, and the daemon crop classifier, now read it. The crop classifier now reports frontmost-app as macos-helper (the helper captures it) and a surface-less macOS session as macos-app-window (every route serves it through the runner). Helper entry points require an owner-routed surface. Fixes #2880
d5e451d to
f828155
Compare
|
Routing now derives from the one owner table, checked against f828155. The CI is green on all 18 checks, and the delta since that review is one test-only commit in I did not rerun the fifth-surface tsc experiment myself; the closure above is inferred from the constraint and the indexing sites, so does that inference hold if a surface is added without adding an indexing site, or is the Live macOS validation is carried over from 086d44e. The routing code is byte-identical since then per the range-diff, so nothing here needed a fresh run at this commit. The surface-less macOS row still has no CLI-reachable path and is covered by unit tests only — is that gap intentional, or worth one integration test so it isn't unit-only forever? Nothing here blocks merge. |
|
Summary
Adds one owner table for "which backend serves a macOS surface":
MACOS_SURFACE_BACKENDS(packages/contracts/src/session-surface.ts,satisfies Record<SessionSurface, MacOsSurfaceBackend>) withmacOsSurfaceBackendand a table-derivedMacOsHelperSurfacebrand,re-exported from
@agent-device/contracts/session. Every platform-applerouting site (snapshot, screenshot +
--fullscreenrefusal, readTextAtPoint,press, runtime capture, native find admission) and the daemon crop
classifier now read it instead of restating
surface !== 'app'locally.Helper entry points now require a branded, owner-routed surface instead of
an optional one, closing off bypass call sites.
Behavior fix: the crop classifier called
frontmost-appmacos-app-window(wrong — the helper captures it) and a surface-less macOS session
macos-helper(wrong — every route treats it asapp). Both crop cellsstay
rejected, so today's only visible effect is the refusal message'starget name; refusal code and
details.reasonare unchanged.Closes #2880
17 files touched (16 plus a CHANGELOG line). Net production lines: +33 (issue estimate 0–15).
Validation
Rebased onto
mainatefce352650. Tested atd5e451d69f.pnpm check:affected --run: exit 0, all runnable checks passed: format, lint, typecheck, layering, fallow, build, and 480 files / 3589 tests. An earlier run at load average 400 hit 5 s timeouts. Each timed-out file passed alone, andsettle-observationfailed the same way on origin/main.classifier and the operation host all pass: 98 tests. The loader refusal test now asserts the
message too. Changing the guard's text fails both refusal cases.
086d44eb5e: live macOS desktop/menubar/frontmost-app/Calculator sessions via CLI,with
--debugroute evidence. The frontmost-app capture was confirmed on the helper, and the croprefusal text was checked before and after the fix. The surface-less macOS row cannot be reached
from the CLI and is unit-tested only. The code on those routes has not changed since then.
Owner-table typecheck evidence (#2880)
Run with
tsc -b packages/xml packages/kernel packages/contracts packages/platform-appleafter adding a fifthmember
'window'toSESSION_SURFACES.Unclassified (no
MACOS_SURFACE_BACKENDSentry): production and the test literal maps fail.Classified as
window: 'xctest': production compiles. Only the test literal maps fail, because theyrestate the expected table on purpose.
The daemon crop test's literal map (
src/, roottsc -p tsconfig.json) has the sameRecord<SessionSurface, MacOsSurfaceBackend>shape. I did not run that step for this experiment.Remaining risk: the fix is latent until a macOS crop cell is flipped to
accepted.