Repository navigation
refactor(shared): drop comments the code can say, keep the API contract docs - #4036
Conversation
…ct docs The first area of a repo-wide comment pass. About 2,400 comment lines in shared/ go; doc comments that define the HTTP/WS API and notes on behaviour we cannot change (herdr, browsers, specs, vendored e2ee) stay. Where a comment explained a surprise of our own, a rename, a shared constant or a test now says it: updateIpcMessage beside its reader, accountServiceOff, isAccountKeyEncoding/isListKeyEncoding, MUX_SETUP_MS, a relay test that pairing ends under IDLE_MS, and the telemetry pin's rule as its failure message. shared/vendor/ and shared/telemetry.ts are untouched. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Merge passMerged head
The owner's refactor, merged by the merge pass on his word. Its claim is that it drops comments the code can say. A machine proof checked it: every changed file printed by the TypeScript compiler with comments removed, at the merge base and at this head. 63 of the 94 files are byte-identical. The other 31 change code so it says what the comments said, and that code delta (227 lines) was read by a fresh reviewer: renamed functions and parameters, named constants each equal to the literal they replace ( After this merge, a fresh reviewer reads the deleted comments for any reason the code cannot say; any such line comes back in a small pull request. |
…orm facts (#4038) ## What The second area of the repo-wide comment pass (after #4036): `app/`, `crates/` and `.github/`. About 2,500 comment lines go. Comments that explain a code surprise of our own were removed, and where a rename or a named constant could say the same thing, the code now says it. What stays is behaviour we cannot change, each checked against its source where one was available: - **Platforms and frameworks:** Capacitor 8.5/8.6, WebKit, WebView/Chromium, Electron and electron-updater, electron-builder. - **Operating systems:** launchd, POSIX/Linux signals and `waitid`, macOS `poll`, Windows/cmd/PowerShell. - **Specs:** RFC 8291/8188/6455/5869. - **Services:** GitHub Actions semantics (called workflows, `needs` skips, required check names), Apple notarization, Cloudflare Pages. Also kept: the MIT header of the QR port, `swift-tools-version`, the `# vX.Y.Z` comments on pinned actions (`scripts/ci-setup.test.ts` and Dependabot read them), and the pedantic `SC2016` suppressions. Not touched: the Capacitor-generated Gradle files and `CapApp-SPM/Package.swift`. Every comment-only change was checked against `origin/main`: - **TypeScript and JavaScript:** by syntax tree. - **Java, Swift, C#, Rust and Gradle:** comments stripped, with char literals and Swift `"""` strings handled. - **YAML, shell and PowerShell:** whole-line comments dropped. Only the files listed below differ in code. ## Code changes (mechanical, no behaviour change) - **Rust (`crates/pty-sidecar`):** - `parse_int` → `js_parse_int` and `clamp` → `js_dimension` (both copy JavaScript's parsing). - `Pushed::Overflowed`/`Dropped` → `FirstOverflow`/`StillOverflowing`. - `finish(…, unexited)` → `finish(…, code_if_never_exited)`. - **Android:** - `DirectSocket.MAX_CLOSE_REASON_BYTES` (123, RFC 6455) and `MAX_BASE64_MESSAGE` replace two bare expressions. - `PCStore.JS_TRIM_WHITESPACE` names the regex that copies JavaScript's `trim()`. - `HerdrShellPlugin.showingConnectScreen()`. - **iOS:** `p256GroupOrder`, `expandOneBlock` (HKDF-Expand of one block), `NotificationService.deliverOnce`. - **Windows:** `QrCode` tables renamed `LevelMEccLength`/`LevelMBlockCount`, and `ByteModeIndicator` named. - **Electron:** - `awake.ts` re-exports the server's `DESKTOP_ACTIVITY_FILE` instead of a second copy. - `preload.ts` names its `isConnectionScreen` gate. - `signHost` → `signHostAndRecordHash`. - The test helper `escaped` → `electronUpdaterEscaped`. - **`.github/workflows/mac-dmg.yml`:** dropped a `shellcheck disable=SC2046`. Nothing reads it, since `actionlint` runs with `-shellcheck=`. ## Left open (redesigns, not done here) - **pty-sidecar:** - `EXIT_PAUSED_LIMIT` silently depends on the server's `OUTPUT_PAUSE_MAX_MS`. - `master.write_all`'s error is dropped, which only `pump` noticing EIO makes safe. - The `EXIT_QUIET` wait in `pump` could be a named function. - `self.partial = Vec::new()` frees up to 17 MiB without saying so. - **`mac-dmg.yml`:** `security list-keychains … $(…)` relies on word splitting; it should be a `mapfile` array (macOS-only, not testable here). - **Android:** - `MainActivity.pageBytes` and `OpeningWatch.permille` use -1/0 sentinels. - `answerDelay` and `PCStore.answerBy` hand over a deadline through a mutable static. - `followRedirect` needs an outcome type. - `PCStore.Check.kind` is a string where it should be an enum. - The private address ranges are duplicated in `PCStore.publicHttp` and `DirectSocket.carrier`. - `PushKeys.proof` could be `halvesMatch`, and `WebPushDecrypt.HEADER_BYTES` built from RFC 8188 fields. - **Values duplicated between languages:** - Java and TS: `'ovis-page-leaving'`, `'ovis-select-pane'` and `MIN/MAX_BRIDGE_PROTOCOL` (vs `shared/machines.ts`). - Electron and `src/lib/deepLink.ts`: `openLink.ts NAMES`. - `app/web/shell.js homeHost` vs `OpeningWatch.swift` and `error.html`. - `connect.css` vs `shell.css`: the palette. - **Electron:** - `Saved.server.bun` names the server binary. It is a saved field, so a rename needs a migration. - `endLeftover` hides the old `server/index.ts` branch. - `sign-mac.test.ts serverHost` uses a run-time `import()` to dodge the typecheck. - `connect.js updateTold` guards an ordering race. - The beta + win32 branch in `updates.ts` should be a per-platform feed set. - **Other platforms:** - iOS: `PushKeys.getOrCreate` should split reader and owner, and `ScopePath.clean`'s name hides "only when a browser loads it as written". - Windows: `Model.PluginCommand` changes `HERDR_PLUGIN_STATE_DIR` for the whole process for the old plugin id. - mac: `carry-drafts.js` takes seven positional parameters. - Linux: `before-remove.sh` re-reads the uid so that `00` counts as root. - `crates/ovis-tui/prepare.sh ask`: a failed git query counts as work. ## Validation - `bun run check fast`: passed (18,560 unit tests, typecheck, build, workflow syntax, generated files). `scripts/pty-sidecar.test.ts` needs the crate committed: it refuses uncommitted crate sources by design. - `actionlint -shellcheck=` (1.7.12) on every edited workflow: passes. The 19 `scripts/*` tests that read workflow files pass. - `bun test app/electron/scripts/sign-mac.test.ts`: passes. - Comment-only check as above. The code differences are exactly the changes listed. - Not run here: cargo (no toolchain on this PC), Gradle, Xcode, the C# build. GitHub's runners build `crates/` and `app/`, so this PR waits for them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
…ep platform facts (#4040) ## What The third area of the repo-wide comment pass (after #4036 and #4038). It covers: - `relay/`, `push-relay/` and `integrations/` - `telemetry/`, except `worker.ts`, whose bytes are pinned to the deployed Worker - `site/demo/`, `ovis-site/` and `public/sw.js` - the installers (`install.sh`, `install.ps1`) and the root config (`vite.config.ts`, `bunfig.toml`, `herdr-plugin.toml`, `.coderabbit.yaml`) About 1,850 comment lines go. Comments that explain a code surprise of our own were removed, and where a rename or one helper could say the same thing, the code now says it. What stays is behaviour we cannot change: - **Services:** Cloudflare Workers and Durable Objects, APNs and FCM, Cloudflare Pages. - **Browsers:** iOS notifications, Safari push, Chrome's PDF viewer. - **POSIX shells under `curl | sh`:** SIGTTIN, `set -e` inside conditions, Rosetta's `uname -m`, busybox and uutils races, systemd and launchd. - **Windows:** PowerShell 5.1 and cmd. - **Specs and tools:** RFCs 8030, 8032, 8292 and 6455, and xterm, herdr and the agents that the demo's fake server copies. Also kept: - the installers' usage headers, which are their public contract - the licence credits (LobeHub Icons, Simple Icons) - every comment inside text the installers write out (the `ovis` launcher, `run.sh`/`run.ps1`, the inline JS) - the comment whose address `scripts/ovis-site.test.ts` tells people to read Every comment-only change was checked against `origin/main`: - **TypeScript and JavaScript:** by syntax tree. - **CSS:** comments stripped. - **Shell, PowerShell, TOML and YAML:** whole-line comments dropped. I read the few trailing `# …` comments and C# comments inside `install.ps1`'s Add-Type strings by hand. ## Code changes (mechanical, no behaviour change) - `relay/core.ts`: `oldestToMakeRoom(list, max)` replaces three copies of `list.slice(0, Math.max(0, list.length - MAX + 1))`. - `site/demo/transport.ts`: builds the view key from `PANE_VIEW_KEY_PREFIX` and `paneStorageId(LOCAL_MACHINE, …)` instead of writing `ovis:view:` by hand. - `install.sh`: - `INSTALL_LOCK_WAIT` → `INSTALL_LOCK_WAIT_SECONDS`. `scripts/install-binary.test.ts` follows. - Dropped the `shellcheck disable=SC2086` on `foreground_ids`. No shellcheck runs on the installers, and the split it hid is listed below. - `vite.config.ts`: `xtermSource` → `patchedXtermSource`. ## Left open (redesigns, not done here) - **`relay/`:** - `Room.open` and `Room.sweep` each work out when a socket was last heard from. - `Room.authorize` buries "the stricter pass wins on a tie". - `sweepPass`'s warm-first order is only a sort. - `pair-room.ts ATTEMPT_BYTES`/`PAIR_CLOSE` copy `shared/relay-pair-code.ts` and are kept equal only by a test. - The `pass_kid === undefined` compatibility branch. - Info is written before a refusal so that `owns()` handles the close. - `worker.ts PASS_CHECKED` trusts a header that `handle` strips and sets again. - `RelayRoom`'s `send` uses `queueMicrotask` to avoid re-entering `Room`. - **`push-relay/worker.ts register`:** the limiter order could be one named gate. - **`public/sw.js`:** - `BUILD`, `BUILD_FILES` and `RELAY_RESOURCES` are build-stamped placeholders. A rename needs `scripts/service-worker-build.ts` with it. - `isPage` really checks for the shell fallback. - `keepShell` both fills the new cache and retires the old ones. - `FRESH_SHELL` is the only link to `requestFreshShell`. - A port message without `status` means "selected". - `answerButtons` mixes the "can't reach the PC" check into validation. - Two tap paths race through module-level maps. - `query` copies `pageSearch`. - The hosted shell's `#` deep link has no builder. - `openRelayDatabase` copies the schema in `src/lib/relay/device.ts`. - **`ovis-site/assets/platform.js`:** `DESKTOP.mac` has no `tip` on purpose, the `*_ALT` English text doubles as a translation key, and `macArch()` without an argument means "Apple silicon". - **`site/demo/`:** - `agentScreens.bottom` must match what `src/lib/inputRow.ts` parses, and the cursor offsets are magic. - `fixtures.RESUME_FLAGS` copies `server/session-history.ts`. - `layOutRoster` and the timestamp `shift` could be named steps. - `later` fires only while the socket is open. - **`install.sh`:** - `foreground_ids` relies on word splitting. - `gh_api` copies `bounded`'s watcher, and the "capture under `bounded`" pattern is written three times. - `release_js`, `rust_host_runs`, `node_fits` and `find_core` copy checks in `scripts/plugin.ts`, `server/pty/` and `server/herdr-core/discovery.ts`. - `launcher_text`, `add_reads_answers` and `node_link` tell what a release can do by grepping its source. - `add_pc` uses seven early returns that set flags. - `manifest_entry` parses signed JSON with `sed`. - `install_lock` is hand-rolled. - `ref_not_moved` is not explained by its code. - Exit codes `22 | 37` should be narrowed to a 404. - **`install.ps1`:** - Ed25519 points travel as `BigInteger[]`. - `Enter-InstallLock` has a known race with three installs at once. - `$herdrState` copies `scripts/plugin-state.ts`. - `Get-RecordedServer`, the inline git reader, and about 180 lines of top-level repair logic. - **`vite.config.ts`:** `dirty` mixes "dirty" with "could not tell", and the plugin order (`themeBootstrapBuild` first) is not enforced. ## Validation - `bun run check fast`: passed (18,563 unit tests, typecheck, build, generated files). - `bun test relay/`: 891 pass. `scripts/install*` tests: 203 pass. `scripts/install-binary.test.ts` passes after the rename. `scripts/ovis-site.test.ts`, `scripts/conventions.test.ts`, the `sw.js` and demo tests: all pass. - `sh -n install.sh` passes. `install.ps1` was not parsed here (no `pwsh`); GitHub's Windows runner runs it. - Comment-only check as above. The code differences are exactly the changes listed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: sisyphus-dev-ai <[email protected]>
## What Part 1 of 5 for `scripts/` in the repo-wide comment pass (after #4036, #4038 and #4040). This part covers: - the a–ci browser regressions and QA scripts - the build and check tooling: `check.ts`, `check-report.ts`, `build-cache.ts`, `build-xterm.ts`, `build-site.ts`, `build-server.ts`, `ci-browser*.ts`/`.sh`, `ci-flakes-issue.ts` - the installer tests (`install-*.test.ts`) - the inbox regressions and the join kit (`scripts/join/`) About 3,450 comment lines go. The usage headers of `check.ts`, `ci-browser-parallel.ts`, `ci-browser-timings.ts` and `ci-flakes-issue.ts` went: `docs/development.md` already documents those commands and their variables. What stays: - **Machine-read comments:** every `// fixed wait:` (`scripts/fixed-sleeps.ts` reads them), and the `@ts-expect-error` on `app/web/shell.js`'s import. - **The join kit's contract:** the usage and exit-code block of `join.sh`. - **Behaviour we cannot change:** POSIX shells and job control, Linux `/proc` and zombies, socket path limits, `ps` locale, git, Vite, TypeScript, xterm, Playwright, Chromium and WebKit, `@legendapp/list` (checked in its source), and GitHub's API limits. Every comment-only change was checked against `origin/main`: TypeScript by syntax tree, shell with whole-line comments dropped. No test, script or doc reads a deleted comment: each agent searched `*.test.ts`, `scripts/` and `docs/` for a phrase of every comment before deleting it. ## Code changes (mechanical, no behaviour change) - `scripts/inbox-mode-demo-regression.ts`: the drawer's second-tap wait takes `SECOND_TAP_MS` from `src/lib/useSidebarLayout.ts` (passed into `waitForFunction`) instead of a bare `400`. - `scripts/join/join.sh`: dropped a `shellcheck disable=SC2086`. No shellcheck runs on scripts, and the split it hid is listed below. ## Left open (redesigns, not done here) - **`check.ts`:** - `HERDR_TEST_SHARDS` defaults to 1 because timing-bound contract tests fail four at a time. - `askTicket` ranks a lock without a ticket at `-Infinity`. - `takeTicket` bumps `queuedAt + 1` for a clock set back. - `retire` leaves a known window for two claims. - `acquire` checks the queue twice, and `alone` treats a pre-slot holder as owning the PC. - **`ci-browser-parallel.ts stopRun`:** its refused/unmarked/seen sets and the grace after SIGKILL. - **`ci-browser.sh`:** the scripts whose evidence code changes what they check are an unnamed case list. - **`check.test.ts descendant`:** relies on when a SIGTERM handler takes effect. - **`build-cache.ts`:** the cache's event rule, the `shared/vendor/*/dist` regex, "stop waiting once another job holds the lock", and the per-run lock name. - **`build-server.ts artifact`** (a lazy import so sign and verify run without packages), and **`build-site.ts`**'s `/icons/` rewrite (the client could use relative paths). - **`app-shell.test.ts`:** the `@ts-expect-error` goes once `app/web/shell.js` has a declaration file. - **Unnamed timings and duplicated values:** - `android-ime-regression.ts` has a bare typing pace. - `install-hint-demo-regression.ts HOLD_DEMO_TURN` copies a 4500 ms hold from `site/demo/transport.ts`, and so do several other scripts. - `NO_RESIZE_WAIT_MS` is a bare 1 s. - Several fixed waits for "frames to have gone out" in `inbox-mode-demo-regression.ts` could poll `window.inboxFixture.frames`. - `join.contract.test.ts` sleeps 2 s where it could use `DWELL_MS`. - **`inbox-mode-*-regression.ts`:** pass their part through `INBOX_MODE_PART`, where the main script could export `run(part)`. - **`join.sh`:** - Globals carry results: `$pid`, `j_b`, `j_got`. - `j_refusal` and `J_HERDR_REFUSED` match the server's English sentences instead of a reason code. - `j_remove`'s return codes 0–4 have no names. - `$J_PROFILE_ENV $J_PREVIEW_ENV` are left unquoted on purpose. - The 37/38/39 decision could be a function. - **`join.contract.test.ts`:** the flag files under `/var/tmp/fake-*` are declared nowhere, and `serveHerdr` takes a positional boolean. ## Validation - `bun run check fast`: passed (18,567 unit tests, typecheck, build, generated files). - Unit tests of every touched test file and of the modules that import a touched one: all pass (349 + 405 + 203 + 15, plus `scripts/conventions.test.ts`). - `sh -n` on `join.sh`; `SECOND_TAP_MS` imports from a plain Bun script (`400`). - Not run here: the browser regressions themselves (their code changed only in the one wait above) and `join.contract.test.ts` (needs containers). CI's browser jobs run the regressions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: sisyphus-dev-ai <[email protected]>
…C of the comment pass) (#4045) ## Why The owner's rule F (comment pass of #4036 and #4038): a deleted comment whose reason no test can hold (pile C: a platform fact CI does not run, a race too rare to test, a policy behind a chosen workflow value, a Rust `# Safety` contract) goes back as a comment, the same day. ## What 75 comments in 43 files, put back word for word from e3776cd (#4036) and dad4ce6 (#4038), each above the code it belonged to, in its original style (`//`, `///`, `/** */`, `#`). - The eight `// SAFETY:` notes in crates/pty-sidecar/src/pty.rs and crates/ovis-tui/src/main.rs are left to #4043. The `# Safety` doc of `forget_ovis_secrets` (not in #4043) is restored here. - Skipped: none. Every anchor still exists on main. - Where the listed text lacked its own delimiters, the old block's delimiter lines came back with it (the `/**` / `*/` of 12 Javadoc and JSDoc blocks, one C# `</summary>`). - Three workflow entries were listed as a part of a sentence. Each is put back as the whole old sentence: - desktop.yml: from "With a release tag" (old lines 6-11). - ovis-tui.yml: through "binaries are not built here yet ..." (old lines 2-5). - release-validate.yml: old lines 73-82, which replace the one-line rewording of its last two lines. - dependabot.yml also gets back its `#` paragraph break (old line 5). ## Proof A machine check compares origin/main with this head once comments are removed: - TypeScript and JavaScript: 9 of 9 files are identical. - Other files: 34 of 34 are identical. For workflows, this compares the parsed YAML with run-script comment lines dropped. - Not identical: 0 files. No code line changes. --------- Co-authored-by: sisyphus-dev-ai <[email protected]>
) ## What #4036 (`shared/`) was part of the repo-wide comment pass and merged before the owner's rule for comment-removal PRs: security notes, platform facts, measured values, third-party attribution, Rust SAFETY notes and traps that name a concrete breakage stay. This PR puts back what it dropped of those, word for word where the code is unchanged, on today's `main`. How the notes were picked: a Codex adversarial review (gpt-6.2-sol, reasoning high) of the merged commit against its parent listed every deleted comment it took for a kept kind; each finding was checked against the code before the pass and today's file, and put back only when it is one of those kinds. A trap came back only when it names what the obvious change would break. Notes whose code has since moved sit on that code now; notes whose code is gone, or that are no longer true, stay out. Comments only: no code changes. The refactor-merge kit's `proof.sh` checks that every file is identical once comments are removed. ## Details ### Lines restored per kind (approximate; a block that mixes kinds is counted under its main kind) | Kind | Findings accepted | Lines | |---|---|---| | Security | 285 | ~850 | | Platform fact | 87 | ~178 | | Measured value | 15 | ~46 | | Trap (names a concrete breakage) | 22 | ~60 | | Attribution | 1 (plus agent-catalog's "copied from the vendor's docs", counted under security) | 1 | | Not flagged by Codex but under the rule | 3: agent-catalog `parseVersion`, the supported-agents "protocol.ts reads `process.env`" note, the relay-mux `p256Spki` key format | ~4 | 70 files: all in `shared/`. The one finding outside `shared/` (server/update-api.ts) is placed on `updateIpcMessage` in shared/update.ts, where that code moved. ### Declined, rejected, skipped - 32 trap findings declined. They give a design reason, describe the code, or name a test target. Examples: - card-text and portal: "src/lib/i18n.test.ts reads this map" - markdown: "not with a lookbehind" (src/conventions.test.ts already enforces it) - relay-channel: "answered in AUTH_OK, never selected in WELCOME" - 9 findings rejected, and 2 already on main: - rejected: the rename already says it (`linkPageAcceptsLabelAndOs`); the code computes it (`REFS_KEY_EXTRA`); the rule moved into a test's failure message (telemetry-notice); a moved `PaneContext` declaration and a helper rename (code, not comments); the SPKI note now sits beside the imported constant; and others - already on main: relay-channel `carrierOpen` and relay-pair-sas "compared in constant time" - 5 findings about the PR body and 1 LOW finding were left alone. - 2 stale sentences were left out: - relay-pair-code's header said "the PC shows eight characters", but the code is ten - pagePolicy said the page may load from https, but the policy has no https source ### Security notes put back (file, a few words) - access.ts: Portal identity in `/api/health` - account-asker.ts: the anti-phishing "Who is asking" header; bidi controls; the signed label form - account-records(.test).ts: signed by the account key; prefix differs from AUTH at the sixth byte; the signed field order; the WebCrypto curve check; parse says nothing about the signature; signing bytes; the signer's public half; verify never throws; the device id; link signer = key; the AUTH input - account-service-fake(.test).ts: what the real service must check; reauth window; code in the fragment, never in logs; the exact redirect allowlist; the PC key derives `server_id`; the admission key and its TTL; link tokens spent, then redeemed by the same sign-in; refresh reuse revokes the family; a poll without the verifier moves nothing; device-code sign-ins cannot delete the account; a removed method ends its sign-ins; an unforgeable relay key; per-account mailboxes - account-list-entry/signers (+tests): byte-exact bodies; domain prefixes; canonical base64url and keys; the curve check; ECDSA r/s range; read-once snapshots; the list id; who may sign (`adds`, `power`, `ends`); rows never deleted; proof admission rules; stop when behind; no shorter replay; own-row lookup, never the prototype; saved state as trusted as the private key; never adopting entries from a POST answer - agent-catalog(.test).ts: only the vendor's own command and package; byte-exact approved commands; HTTPS with a path; every package and flag checked; nothing appended in any shell; dsh-tui asks for its own key - compact-agents.ts: prototype keys; a PC cannot forge the encoder's markers - gjc-native.ts: shape only; readers check process identity - launch-rules.ts: control characters in queued messages and arguments - markdown.ts, markdownHtml.ts, pane-tokens.ts, visualization(.test).ts: no network-share links; encoded `%3A12` names the file; never markup put on the page; script and style hold no text; token values are never markup; bidi and invisible characters stripped from names; the card names the path's last part - pi-ask-bridge.ts: a socket only the user can open - portal(.test).ts: the OIDC secret is never carried; ASCII names through the header; `sub:` case; issuer form; Ethereum with no wallet refused; an email-shaped id is still an id - secret-prompt(.test).ts: yes/no is no secret; deliberately narrow; API-key shapes; an answer sent again goes to a shell; older servers refuse newer prompts - submit-outcome.ts: agent-only and hold-only messages are never sent to a bridge that cannot keep them - telemetry-notice(.test).ts, telemetry.test.ts: the notice-version consent gate; counts only once disclosed; every disclosure must say so; no free text becomes a name - update.ts: the exact revision the person saw; only the asker may cancel (`install_id`); old supervisors ignore the new IPC types - user-fonts.ts: fonts only from the state folder; voice.ts: the key stays on the server, 0600, never returned; the recorder is not trusted - web-policy.ts: every CSP directive's reason (default, script, style, img, font, connect, media, frame, worker, object, base, form-action, frame-ancestors); the hosted shell's changes; the account origin; the sandboxed page policy; no https for page scripts - relay-*: Noise NK then device admission; pinned-key probes; only a pairing device hears the new-session refusal; one guess per tap or exchange; CPace password never leaves either end; nameplate vs 35-bit password; commit-then-reveal SAS with its bias bound; relay passes (header never in a URL, lifetime, skew, audience, signature covers the whole payload, cheap checks first); server-proof scopes and 4401 reasons; a self-certifying id; untrusted JSON and frame gates before parsing; Tailscale and private carrier formats; region hints only between Ovis relays; private storage of device keys; e2ee downgrade, replay, tamper and size limits ## Validation - `bun run check fast`: passed (18,593 unit tests, typecheck, build, generated themes and types). - `proof.sh` (comments only), `ready.sh` (required checks, threads, CodeRabbit, main) before the merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
) ## What #4063 (`server/`, part 6 of 8) was part of the repo-wide comment pass and merged before the owner's rule for comment-removal PRs: security notes, platform facts, measured values, third-party attribution, Rust SAFETY notes and traps that name a concrete breakage stay. This PR puts back what it dropped of those, word for word where the code is unchanged, on today's `main`. How the notes were picked: a Codex adversarial review (gpt-6.2-sol, reasoning high) of the merged commit against its parent listed every deleted comment it took for a kept kind; each finding was checked against the code before the pass and today's file, and put back only when it is one of those kinds. A trap came back only when it names what the obvious change would break. Notes whose code has since moved sit on that code now; notes whose code is gone, or that are no longer true, stay out. Comments only: no code changes. The refactor-merge kit's `proof.sh` checks that every file is identical once comments are removed; lint directives (which it counts as code) stay out. ## Details ### Lines restored per kind (approximate; a block that mixes kinds counts under its main kind) | Kind | Findings accepted | Lines | |---|---|---| | Security | 648 | ~1043 | | Platform fact | 303 | ~538 | | Measured value | 35 | ~65 | | Trap (names a concrete breakage) | 147 | ~283 | | Attribution | 2 ("#2503 review by @jpcarranza94", "order by @jpcarranza94 in #2503") | ~2 | | Not flagged by Codex, under the rule | 11 (mirrors of flagged notes, plus 3 more; see below) | ~14 | | LOW "cut mid-sentence" fixes | 2 | 2 | The 1,336 HIGH and MEDIUM findings break down as: - 1,135 accepted - 149 traps declined - 52 rejected: all 37 "false body claim" findings, including the two on files the PR never changed (scripts/omp-question-compat.ts, server/dispatch.ts), and 15 others Of the 5 LOW findings, three cut kept comments now read whole: - process-start.test.ts "never after the process started ...", restored so "... and close" has its first half - prompt.test.ts "An inert child supplies a real process environment ...", restored so "it says so once it runs" has its subject - runtime-move-service.contract.test.ts:42, fixed by restoring :39 The other two are left: plugins.contract.test.ts:12 still reads whole, and pty-host.mjs:72 is answered by the restored EIO note. The not-flagged notes include: - relay-pc.ts: "DIRECT_PORT, not imported: that module listens" - pi-models.ts: the 4 MiB catalog cap - pi-delivery.test.ts: the sparse 200 MiB hole - relay-pc.contract.test.ts: "port 1 on loopback refuses at once" - portal.test.ts: `CHILD_MS` - identity.ts: the `public_key` encoding - repo-log.ts `commitsOf` - rpc-diagnostics.test.ts: the connect wait ### Declined, rejected, left out - **149 trap findings declined.** They give a design reason, describe the code, or name a test target. Examples: - pending-input.ts:95: "never evict an in-flight send" names no breakage. - prompt.ts:1833/1909: "a move is a new asking, begun before its first key" describes the code. - push.test.ts:414, 477, 1124, 1299 and process-owner.test.ts:100/107: "regression (fails on ...)" notes that name the test target. - session.ts:271: "relay hints are answered in AUTH_OK, not WELCOME", declined as #4036 declined it. - **15 rejected besides the body claims.** Examples: - pi.contract.test.ts:139 is a duplicated line; the identical line above it survives. - request-log.test.ts Given/When/Then lines whose test names already say it. - pending-input.ts:328 "its held messages stay with their owners" narrates `forget`. - pi-session-label.ts:163 "native falsy preambles" was left out as unsure. - **Stale.** process-start.ts:27 keeps only its first sentence. The "btime stays put when the clock is stepped" clause is false, as the merged PR's body says. - **Narration trimmed** from mixed blocks; the kept sentences are word for word. Examples: - pi-session-metadata.ts header: only the checked-descriptor sentence - openRelayPcTunnel: only the 127.0.0.1-behind-a-token paragraph - piBranchSegments and piAbandonedTurns docs - the preferences.ts header - many prompt.ts blocks - remote-host.ts and runtime-move-lock.ts headers ### Security notes put back (short) - **pending-input / pending-requests:** a recycled PID is no match; agent-only kept on a saved copy's resend; held messages never offered to automatic delivery; a moved send waits for an explicit Send; withdrawal receipts outlive the owner's close; retired submit ids cannot run again. - **pi.ts / pi-ask-bridge.ts:** sessions only inside the store, links resolved; the extension socket must be the user's own in the process's own agent dir; a pi that left the front, or shares it, no longer speaks for the pane; an unread environment names no profile; a stale report from the bridge's profile is not valid; `unknown` is never room for keys; the extension re-checks createdAt and the session. - **pi-delivery / pi-session-* / pi-tree / pi-large-history:** - delivery proof: - the descriptor and the path must name the captured append-only prefix - the log is not an integrity checksum for arbitrary edits - checked descriptor, never a reopened path: - null refuses an identity - a parser stays private until its key is re-checked - instrumentation counts only, never labels or paths - escapes and controls always take the checked path - repeated ids are never trusted - abandoned records stay unreachable - pictures need real raster bytes and a drawn call - **pi.test / pi.contract.test:** cursors from another conversation or file are refused; image refs stay in their store; escaped JSON is still a clear; a pane's profile, never the bridge's own environment. - **relay-pc.ts and its tests:** - Pairing: - Noise NK pairing like a phone, revocable - only one first channel pairs, and only through the relay - a vouched pairing sends nothing and counts nothing - members compare digits, never B's screen - a ticket is good once - The key: - the PKCS#8 key is the only secret - mode 0600, kept only after AUTH_OK - no key is written after removal - Dialing: - only dialable carriers are kept and dialed - a revoked PC stops for good - Updates: install pinned to the release shown, cancelled only by the asker. - Who may pair PCs: the owner from a direct, driving window only. - **relay/** (C1, C2): - Admission and pairing: - admission limits - identity rotation and the key-derived server_id - drive authority and the origin gate on routes - WS_OPEN, PAIR and PAIR_REQUEST refusals on direct carriers - SAS binding and both-confirm rules - pair-code single use, timing-safe M1 - the pairing window, caps and closes - Relay passes: - passes only to Ovis's relays, in headers, never in the URL - grace and enforce rules - The direct listener: - gate caps, head deadline, the gate header secret - loopback only behind the gates - **push.ts / push tests / push.fake.ts:** - Storage: - push-keys.json privacy - endpoints stored as hashes - retired marks per owner - Who sees and acts: - status only to the owning key holder - a watching device gets no buttons - the open LAN gets no status - buttons approve only what the alert shows - Delivery: - no plain-http endpoint but the loopback fake - a denied send records nothing - revocation clears marks and history - **portal.ts / portal.test.ts:** the `PORTAL_ENV` allowlist; recovery bound to pid and identity; never stop another server's Portal; per-launch proof; the bearer link is never kept or logged; visitor identity headers dropped. - **preferences, pull-request, preview, profile-marker, project-favicon, ping, plugins:** - an oversized body is refused unread - gh's error text is stripped of escapes - `OVIS_PREVIEW` is no security boundary - the marker file is 0600 and a regular file only - favicon roots must be absolute - `agent_only` passes through the relay - a header-less POST never reaches a plugin route - **private-state, process-*, pty/*, remote-*, repo-*, request-log, route-envelope, rpc-guard, runtime-move-*:** - The PTY host: - vouched for by SHA-256 and version - a private CLI gets no server credentials - Remote PCs: - remote bundles verified, never kept partial - chosen sockets validated before any ping - byte caps counted after decompression - Git: refnames, revisions and paths validated; untracked files never followed out of the repository. - Headers and logs: CRLF injection cannot forge log fields. - Route checks: - every check runs before herdr is reached - a watching device and other sites learn no files - Runtime moves: - flock-held move lock, holder proven by token - the bridge token opens no runtime switch ## Validation - `bun run check fast`: passed (18,593 unit tests, typecheck, build, generated themes and types). - `proof.sh` (comments only), `ready.sh` (required checks, threads, CodeRabbit, main) before the merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
What
The first area of a repo-wide comment pass (
/no-comments), one PR per area: this one isshared/. About 2,400 comment lines go. Comments that explain a code surprise of our own were removed, and where a rename or one constant could say the same thing, the code now says it. Comments that stay:/api/*,/ws).docs/guide.mdtells scripts to call it with a device token, and Ovis servers of other versions call each other through it.sockaddr_un, and agents' screen layouts.Not touched:
shared/vendor/, andshared/telemetry.ts, whose bytesscripts/telemetry-deployed.test.tspins.Every comment-only change was checked by comparing each file's syntax tree with
origin/main(comments and JSX comment braces left out). Only the files listed below differ in code.Code changes (mechanical, no behaviour change)
shared/web-policy.ts: the hosted shell'sconnect-srcnamesDEFAULT_ACCOUNT_SERVICEinstead of a second copy of the address.accountServiceOff()is now the one check forOVIS_ACCOUNT_SERVICE_URL=off.accountServiceOrigincalls it instead of relying onnew URL("off")throwing, andserver/account/mailbox.tsuses it too.shared/update.ts:updateIpcMessage()writes the update IPC messages next toreadUpdateIpcRequest(), which reads them.server/update-api.tssends what it returns, so the message names live in one place.isAccountKey→isAccountKeyEncodingandisListKey→isListKeyEncoding(neither checks the curve;isListPointdoes).argumentText→hasNoControlCharacters.oneSpelling→canonicalBase64Url.FIELDS→SIGNED_FIELDS.PREFIX→HTTPS_URL_WITH_PATH.fullSnapshot→withoutCompactMarkers.shown→oneLineMiddleCut.alertStatus(…, waiting)→alertStatus(…, backgroundWorkRuns).offer/drop/spend/linkPageTakesRequester→offerSignIns/dropQueuedRecords/withinRateLimit/linkPageAcceptsLabelAndOs.ACCOUNT_LABEL_MAXinaccountLabel.SPKI_PREFIX/SPKI_BYTES, exported fromaccount-records.tsand imported byaccount-list-entry.ts.MUX_SETUP_MS, used by both the mux setup timer andADMISSION_MS.PAIR_APPROVAL_GRACE_MS(5 s).REFS_KEY_EXTRA("agent_refs".length - "agents".length, was a bare4).AWS_SECRET_KEY_LENGTHandDIGITLESS_KEY_LENGTH(40 each).relay/pair-room.test.tschecks thatPAIR_APPROVAL_MSstays under the relay'sIDLE_MS.shared/telemetry-notice.test.ts's hash pin fails with the rule that was in its comment: a new kind of data needs a newNOTICE_VERSIONand the owner's word.Left open (redesigns, not done here)
account-records.ts: three label normalizers disagree. They arechecks.label,accountLabelandnormalizeLabelinserver/devices.ts, and onlyaccountLabeldrops bidi controls. One normalizer would change what is refused.account-records.ts signAccountRecord: it trusts the caller thatrecord.signermatches the private key. It could take the signer from the key pair instead.account-list-entry.ts:EntryBody.issued_at(seconds) andEntryBody.v(the level) are bare numbers.verifySignature/entryHoldscopy their input before theawait; that could be a named step.account-list-signers.ts:plain*read-once snapshots have no type of their own.rowOfguards a plain object withObject.hasOwnwhere aMapwould do.SignerRow.byusesnullto mean "let in by a proof".needs_replaycarries two meanings.KeyProof,ShownAnswer.after,asks_afterandreadSignersStateinput need narrower or branded types.shownEntries/replayEntrieshave long contracts that could be split into named steps.card-text.ts CARD_TEXT:src/lib/i18n.test.tsreads it with a regex over the source.conversation-search.ts:searchedTurnChanged,pickedTurnandpickSettledneed named predicates.input-row.ts: the recognizers fill an optionaltypedout-array,REPORTS_TYPEDis kept by hand, andtypedDraft's rule has no name.machines.ts:OWN_UPDATE_OFFERis told from an error by a string prefix; it needs a typed field.paneStorageIdkeeps local keys unprefixed and remote ones withremote:.markdown.ts ListItem.number: when it is present is not visible in its type.preferences.ts normalizeThemeChange: it holds the old single-palette migration.relay-pass.ts RELAY_NEW_SESSIONS_CLOSE: 4403 is also other hosts' "forbidden".relay-mux.ts relayOrigin: it copiesisWssOriginto avoid an import cycle (and allows 256 characters whereisWssOriginallows 255).relay-channel.ts openRelayChannel: a 250-line closure state machine.secret-prompt.ts:ASKS_CHOICEandlooksLikeKeyneed named parts.submit-outcome.ts submitNotTyped: server and browser codes are in one list.skill-syntax.ts chipForms: depends on the{bare}string thatsrc/lib/skillMentions.tsreplaces.supported-agents.ts: nothing tiesSUPPORTED_AGENT_KINDSto the list indocs/guide.md.web-policy.ts: the hosted shell's CSP has no room for a self-hosted account service.Validation
bun run check fast: passed (18,556 unit tests, typecheck, build, generated files).bun test shared/ relay/pair-room.test.ts server/update-ipc.test.ts server/account/ src/lib/account/ src/components/RelaySignIn*.tsx src/lib/relay/channel.test.ts src/lib/i18n.test.ts scripts/plugin-link.test.ts: all pass.origin/main. The only code differences are the changes listed above.The HTTP/WS contract and authentication code are touched only by renames and comments, so no wire format changes.
🤖 Generated with Claude Code