Skip to content

fix(crates): restore the SAFETY comments on unsafe blocks - #4043

Merged
devswha merged 1 commit into
mainfrom
fix/restore-rust-safety-comments
Nov 17, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/restore-rust-safety-comments

Conversation

@devswha

@devswha devswha commented Nov 17, 2026

Copy link
Copy Markdown
Owner

What

#4038 (the comment pass over app/, crates/ and .github/) dropped the eight // SAFETY: comments in crates/pty-sidecar/src/pty.rs (6) and crates/ovis-tui/src/main.rs (2). That was wrong: each one states the libc or platform contract that makes its unsafe block sound, which the compiler cannot check and the code cannot say.

  • An all-zero siginfo_t or sigaction is valid, and waitid writes only into it.
  • kill and raise are async-signal-safe.
  • The environment is changed while only one thread runs.

These are platform facts, which the comment pass keeps, and the Rust convention for every unsafe block. This PR restores them word for word, each above the line it sat on before #4038. No code changes.

Validation

  • bun run check fast: passed.
  • git diff shows only the eight comment lines added.
  • No cargo here. GitHub's ovis-tui (clippy -D warnings) and pty-sidecar jobs build both crates.

🤖 Generated with Claude Code

#4038 dropped the eight `// SAFETY:` comments in crates/pty-sidecar and
crates/ovis-tui. Each states the libc or platform contract that makes its
unsafe block sound (an all-zero siginfo_t or sigaction is valid, kill and
raise are async-signal-safe, the environment is changed while one thread
runs), which the compiler cannot check and the code cannot say. They are
the platform facts the comment pass keeps, and the Rust convention for
every unsafe block. Restored word for word.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Documentation
    • Added safety notes describing environment access and process signal handling. No user-facing behavior changed.

Safety comments were added for environment access in the TUI and process and signal operations in the PTY sidecar. No executable behavior changed.

Changes: Safety Comment Restoration

Layer / File(s) Summary
Environment access conditions
crates/ovis-tui/src/main.rs
Comments document that secret removal occurs while the program is the only thread, and that no other thread accesses the environment during removal.
PTY process and signal safety
crates/pty-sidecar/src/pty.rs
Comments document siginfo_t and sigaction initialization assumptions, waitid output, and the async-signal-safe kill and raise calls.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Possibly related PRs

  • devswha/ovis#4038: Removes the safety comments that this PR restores in the same files.
Merge Risk: Minimal · up to 352e6

This change only adds explanatory safety comments and does not alter runtime behavior, so it carries no merge risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: restoring the SAFETY comments on unsafe blocks that an earlier comment pass removed. It is specific and matches the summary, objectives, and description. The 'fix(crat…
Description check Passed The description explains what was removed (#4038 dropped eight SAFETY comments across pty.rs and main.rs), why they matter, and what was restored. It includes a Validation section listing bun run chec…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: restoring the SAFETY comments on unsafe blocks that an earlier comment pass removed. It is specific and matches the summary, objectives, and description. The 'fix(crates):' scope is generic but does not make the title misleading.

Full details: Description check

Explanation

The description explains what was removed (#4038 dropped eight SAFETY comments across pty.rs and main.rs), why they matter, and what was restored. It includes a Validation section listing bun run check fast, the git diff check, and the note that cargo was not run locally. It does not follow the template's exact wording but covers its required content. The Change section does not link an issue, which is not required for a fix. The validation section does not state which checks were skipped beyond cargo, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ac48916 and 352e629.

Files selected for processing: 2

  • crates/ovis-tui/src/main.rs
  • crates/pty-sidecar/src/pty.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

@devswha
devswha merged commit 28dac95 into main Nov 17, 2026
38 of 39 checks passed
@devswha

devswha commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

Merge pass

Merged head 352e629b407c as 28dac95ef5f7 on GitHub's checks, with no unresolved review threads.

Reviewer Verdict Note
machine-proof CLEAR
supervisor-read CLEAR

Puts back the eight // SAFETY: comments on Rust unsafe blocks that #4038's comment pass removed, word for word. Under the owner's rule F, a SAFETY note is a comment no test can hold, so it is restored the same day. A machine check confirms the pull request adds comments only. A check that demands a SAFETY note on every unsafe block (clippy's undocumented_unsafe_blocks, which CI's -D warnings turns into a failure) follows as its own pull request.

@devswha
devswha deleted the fix/restore-rust-safety-comments branch November 17, 2026 14:05
devswha added a commit that referenced this pull request Nov 17, 2026
…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]>
devswha added a commit that referenced this pull request Nov 17, 2026
…4038) (#4080)

## What

#4038 (`app/`, `crates/` and CI) 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.

This PR touches workflows under `.github/`: every comment put back
inside a `run: |` block was a shell comment in that same place before.
It waits for a real review (AGENTS.md).

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 (findings accepted / lines)

| Kind | Findings | Lines |
|---|---|---|
| security | 302 | 706 |
| platform / protocol fact | 130 | 232 |
| measured value | 20 | 35 |
| attribution / non-prose | 3 | 7 |
| Rust SAFETY | 0 | 0 (all 9 already back from #4043) |
| trap (concrete breakage) | 76 | 173 |
| **total** | **531** | **1153** |

Of 642 HIGH/MEDIUM findings: 531 accepted, 26 traps declined, 29
rejected (5 are about the PR body or the
`scripts/ovis-site.test.ts` code change, not comments), 56 already back
on main (#4045, #4043).

### Security notes put back

### .github
- dependabot.yml — Bun, Node and herdr pinned (herdr by checksum);
actions pinned to commit SHAs
- actions/setup-ci — runner host's package copy is read-only to jobs
- beta.yml — attest job signs build provenance; write tokens run no
repository code (host-publish, desktop-publish)
- ci-flakes.yml — reads runs and logs, writes that one issue only;
GitHub-hosted with issues: write
- ci.yml — hosted_only: no Actions cache, since every job can write the
published artifacts; fork PRs stay GitHub-hosted (changes, fast,
aggregate, mac); actions: read for the route; hc pinned by version and
sha256
- cla.yml — pull_request_target runs from main with the base token,
never checks out the PR; who stands in for the opener, signatures only
from commit authors
- desktop.yml — only the Mac signing hook's secrets; Developer ID and
notary key, fail rather than ship unnotarized; Windows signing
certificate, unsigned SmartScreen fallback; feed job has no secret and
is read-only; attach job's write token runs no repository code
- growth-snapshot.yml — stars' dates never who; result encrypted because
public artifacts are downloadable
- hook-kill-tests.yml — one throwaway container, GitHub-hosted written
literally, a fork runs its own copy; cache only restored; no package
scripts, read-only mount, no network
- mac-dmg.yml — skips without signing secrets; gate reads the secrets,
GitHub-hosted
- omp-question-compat.yml — unpinned OMP release: never save the shared
cache
- pages.yml — validation, build, current and deploy jobs GitHub-hosted
and cacheless
- pr-title.yml — title read as data and never printed; fork PRs stay
GitHub-hosted
- pty-sidecar.yml / pty-sidecar-attach.yml — build provenance
attestation and the permissions it needs; a release cannot publish until
attested
- relay-deploy.yml — production approval, notice without Cloudflare
secrets; token never on self-hosted runners
- release-validate.yml — a skipped/failed job can stop a release, never
pass one; actions: read; only a whole yes passes; ci skipped only for a
verified yes; release run GitHub-hosted and cacheless
- release.yml — GitHub-hosted and no shared cache for preflight, server
build and publish; Ed25519-signed manifest, no secret in the build;
installer runs no host the manifest does not name; signing key reaches
one job, main-only environment, nothing published unsigned; provenance
attestation; checkout keeps no Git credential; files verified against
the committed key; shell build has no secret, deploy runs no repository
code; no checkout next to the deploy token; Cloudflare token never on
self-hosted runners; deploy tools from GitHub, not the build job; write
token stays out of build and deploy
- remote-bundles.yml — the published bundle builds GitHub-hosted with no
shared cache
- shell-preview.yml — by hand from main, production approval, never
touches app.ovis.sh; no secret in build; fixed non-production branch;
same token and cache rules as release
- windows-app.yml — GitHub-hosted, no shared cache; the only job with a
write token, never for a PR
- windows-terminal-qa.yml — GitHub-hosted only: a fork's PR never
reaches self-hosted runners

### app/android
- app/build.gradle — upload key outside the repo; never signs with part
of a key
- DirectSocket.java — never TLS, Noise proves the PC; private carrier
address only; Tailscale 100.64/10
- HerdrShellPlugin.java — url carries the pairing code; a PC's page
never gets the app link
- MainActivity.java — sign-in steps judged hop by hop; only a page of
this very PC counts; bridge only for Ovis, no public-http or https→http
hop; which app links open what; exported activity needs the alert's
proof
- OvisAuthPlugin.java — only a return naming the state; another app can
send this address
- OvisDirectPlugin.java — app origin only, private address only, Noise
proves the PC; an earlier page's open opens nothing; error page shares
the bridge
- PCStore.java — cookies in the WebView's store; pairing code kept in
memory only; relay PC by relay ID, pane in the fragment; selection
injected as JSON never code; scope checked segment by segment, no dot
segments, encoded `/` or `\`; only an Ovis origin gets the bridge;
probes never send the pairing code; insecure-hop rules; cleartext
exceptions (IPv4, IPv6, names); JSON depth bound; Capacitor compares
scheme and host only
- SaveImagePlugin.java — IS_PENDING hides the file until whole; one
folder per shared picture
- SavedImage.java — last path part, no leading dot; save budget
- PCStoreTest.java — strict JSON escapes; nesting deeper than the stack;
non-dotted IPv4 forms; relay ID never moves an alert; values reach the
page as they came
- AlertProof.java / PushStore.java / PushStoreTest.java — exported
activity, only our PendingIntents carry the proof; keys in private
preferences bound to token and PC key; receiving never creates or
replaces keys; constant-time compare; proof from 32 random bytes
- OvisMessagingService.java / OvisPushPlugin.java / PushKeys.java /
WebPushDecrypt.java — relay sends ciphertext; one endpoint per PC pinned
to its key; VAPID key; p256dh 65 bytes, auth 16 bytes; mismatch only on
a completed check; RFC 8188 header layout

### app/electron
- electron-builder.yml — prerm stops only the removing user's server;
Developer ID credentials; PTY host signed first; NSIS per user, no admin
- linux/before-remove.sh — "00 is root too", never root
- scripts/build.ts, scripts/runtimes.ts — downloads checked against
SHA-256 pins; cached copies only while they hash right; PTY host checked
against the release manifest
- scripts/e2e.ts — fresh temporary HOME; run-id marker; only this run's
app is driven; test certificate; cleanup ends only this run's processes
- scripts/notarize-dmg.mjs, scripts/sign-mac.mjs — notary key and
fail-closed rules; record takes the signed bytes' hash
- src/accountSignIn.ts (+ test) — loopback callback, only a return
naming the state; trusted account origins
- src/children.ts (+ test), src/appimage.ts — own hc session, never
another client's HC_SOCKET; loopback only, settings dropped; process
identity before any kill, reused pid left alone
- src/main.ts, src/preload.ts, src/openLink.ts — deep links and IPC only
to the server's own pages; windows a page opens carry no preload;
microphone, never camera; .deb as root only when asked; link values
limited and length-bound
- src/updates.ts (+ test) — .deb as root behind the prompt, no --allow-*
flags; electron-updater's shell escaping
- windows/replace-old-setup.ps1 — what proves an exe is the old app; a
Run value the user changed is theirs

### app/ios, app/mac
- HerdrBridgeViewController.swift — cookies in WebKit's store; relay PCs
share an origin; pairing code in memory only; insecure hops; cleartext
boundary; scope checks and `../` escape; strict JSON escapes; links
outside the PC go to Safari; bridge only for Ovis redirects
- HerdrShellPlugin.swift, OpeningWatch.swift — first page carries the
pairing code; home network or tailnet opens only from inside
- OvisDirectPlugin.swift — main frame of the app's origin only; private
ws:// allowlist; Noise proves the PC; per-call approval, dropped at
navigation
- OvisPushPlugin.swift, NotificationService.swift, PushKeys.swift,
WebPushDecrypt.swift, ScopePath.swift — endpoint pinned to the PC's key,
APNs token stays at the relay; relay never holds a reading key; SEC 2
scalar range; extension never rotates keys; no dot segments or encoded
separators
- carry-drafts.js, WebPage.swift — another port is another origin;
nothing sent by itself; drafts only to this Mac's server; navigation,
download and microphone grants by origin
- Model.swift, Run.swift, OvisMacTests.swift — installer only from
ovis.sh's HTTPS hosts; `*.ts.net` only; launcher identity, no symlink
escape; this user's processes only; log symlink handling
- build.sh — signing identity, keychain and notary key inputs; keychain
as one argument

### app/windows, app/web, crates
- app/web/connect.js, shell.js — warned public http address; relay PC
bound to its scope; no HTML sink with the native bridge; loopback and
cleartext exceptions; pairing code kept, offer origin and scope rules
- app/windows/release-attach.sh — GH_TOKEN, GH_REPO, RELEASE_TAG inputs
- LoginItem.cs — HKCU, no administrator, MSIX startup task
- MainForm.cs, Model.cs, Setup.cs, SetupTests.cs — an answer without the
token is not "Tailscale missing"; token sources and precedence; never
resend a refused token; linked checkout or fork never touched; stale pid
can name another program, unverified pid left alone
- Run.cs — only the child inherits the pipe and stdin; kills through the
checked handle; quotes refused
- crates/ovis-tui/prepare.sh — both commit ids checked
- crates/ovis-tui/src/main.rs, tests/no_core_start.rs — typed input not
sent after a reconnect; no core start (it would inherit the
environment); shell quoting
- crates/pty-sidecar/src/pty.rs — no bridge token in the child's
environment

## 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant