Skip to content

nixos: vendor the oc-password-sync script into the flake (code#3724 reconciliation) - #4170

Merged
dezren39 merged 1 commit into
mainfrom
fix/oc-password-sync-vendor-3724
Nov 2, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/oc-password-sync-vendor-3724

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

What this is

The last loose end of the 2026-11-01 flake fold for oc-password-sync. The fold (PR #3722) moved the units into the flake, but the thing the service actually runs — the script at ~/.local/bin/oc-password-sync.sh — stayed an unmanaged operator file. Worse, the corrected code#3724 logic (drift judged against the running OpenChamber process's /proc/<MainPID>/environ, fallback to the last-synced hash in ~/.local/state/openchamber/password-sync.state, restart + verify on drift) existed only in that laptop file. Nothing in version control held it; a rebuilt home would have left the folded unit pointing at a missing file.

This PR makes the repo the durable home of that behavior:

  • nixos/home/oc-password-sync.sh — the script, vendored byte-identical to the verified live file (sha256 fc47b0d0ca4766a65a8a9225c865f59a920176a274e259adaa44d2f57d0a5df3 on both sides at the time of the change).
  • nixos/home/oc-password-sync.nix — provisions it via home.file at the exact path ExecStart references, and records the history in the header. ExecStart and both units are unchanged — deliberately not the writeShellScriptBin + store-path pattern used by sibling modules, because the fold's discipline was byte-equivalence of the units and ~/.local/bin/oc-password-sync.sh is also the documented manual-invocation path. At the next activation home-manager renames the operator file to *.backup (backupFileExtension is set) and links the store copy; the bytes are identical, so behavior cannot change.

Reconciliation of the record (why #3724 stays closed)

The fold-completion notes (laptop-hygiene Addendum 12) recorded the live .service as "still fails on trigger for the known pre-existing missing drop-in, code#3724". That was a stale reading — the journal tells the real story:

  • Zombie-script failures (FileNotFoundError on the retired openchamber.service.d/external-opencode.conf): 05:07, 05:11, 05:55, 08:12 CST — all before the fix.
  • After the 10:52 rewrite (the Addendum-8 fix): successes at 10:52:57 and 10:53:05.
  • Post-fold, through the flake unit now in /nix/store: successes at 22:09:28 and 22:16:12.
  • Fresh re-verification 2026-11-01 22:25–22:26 CST: a same-content rewrite of service-prod.json fired the .path → service Result=success, ExecMainStatus=0; OpenChamber MainPID unchanged, active, HTTP 200. A dry-run drift test (temp JSON, OC_DRY_RUN=1) printed drift detected (dry run), exit 0, OpenChamber untouched.

So the layer Addendum 8 fixed (the operator script) is the layer the live unit executes, before and after the fold; the #3724 closure was correct. What was actually missing — and what this PR fixes — is only the durability layer: the fixed behavior had no home in the repo.

Effect on live behavior

None on merge or on primary pull: the unit executes an operator path, not a checkout path, and the bytes at that path already equal the vendored copy. The change takes effect at the next NixOS/home-manager activation, when home.file assumes the path. Until then the operator copy at ~/.local/bin/oc-password-sync.sh is left exactly as-is — it is identical, not divergent, so there is nothing to reconcile by hand and nothing is deleted.

Verification

Refs code#3724, code#3720.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

The folded module declared units whose ExecStart target
(~/.local/bin/oc-password-sync.sh) the flake did not provide: the
script — including the corrected code#3724 drift logic — existed
only as an unmanaged operator file on the laptop.

Vendor the script beside the module (byte-identical to the verified
live file, sha256 fc47b0d0…) and install it at the referenced path
via home.file. ExecStart and both units are unchanged, so the next
activation swaps the operator file for the store copy with zero
behavior change.
@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 04:27
@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 94b279e4-dc2b-4326-808b-cdbeb38594e4
Commits

Reviewing files that changed from the base of the PR and between f2006aa and 5daff0c.

Files selected for processing: 2
  • nixos/home/oc-password-sync.nix
  • nixos/home/oc-password-sync.sh
  • 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T04:29:34.881928Z 5daff0c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit e1fc851 into main Nov 2, 2026
1 check passed
@dezren39
dezren39 deleted the fix/oc-password-sync-vendor-3724 branch November 2, 2026 15:37
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