feat: add SOPS secret add/delete with darwin-rebuild verification and commit - #655
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
🎨 Storybook previewUpdated for 6593ba3
|
📋 PR Overview
🔬 Coverage
|
There was a problem hiding this comment.
Warning
The Delete button is rendered unconditionally for all secrets regardless of secret.decryptionCapability, but delete_sops_secret on the backend calls decrypt_sops_file internally — it must decryp...
apps/native/src/components/widget/secrets/secret-detail-view.tsx:248
1 finding(s) posted as inline comments.
There was a problem hiding this comment.
Pull request overview
This PR wires the previously mocked SOPS "add secret" and "delete secret" flows to real Rust backend implementations, replacing frontend simulations. On the backend it encrypts/decrypts the shared secrets/secrets.yaml via sops, declares/removes the secret in the nix-darwin module through the semantic Nix AST editor, verifies with darwin-rebuild dry-run, and commits only the two managed files. It also extracts reusable path helpers and a multi-file commit helper, and refactors ensure_secret to share them.
Changes:
- New
secrets::secrets_management::add_secret/delete_secret(SOPS only) with clean-repo precondition, dry-build verification, post-edit vault re-verification, and best-effort rollback; exposed via newsecrets.addSecret/secrets.deleteSecretoRPC procedures and sharedAddSecretResult/DeleteSecretResulttypes. - Reusable helpers:
git::commit_files(selective multi-file commit),file_opspath helpers (repo_relative_path,repo_relative_path_string,relative_path_between), andnix_file_editor::remove_attrpath;ensure_secretrefactored onto the shared relative-path helper. - Frontend: un-hides the Add-secret button, backend-owns the add flow with error surfacing in the apply sheet, adds a delete confirmation dialog in the detail view, and simplifies the add form to SOPS-only.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
apps/native/src-tauri/src/secrets/secrets_management.rs |
Core SOPS add/delete: encrypt/decrypt over stdin, YAML edit, module declaration edit, build verify, commit, rollback, plus tests. |
apps/native/src-tauri/src/orpc/secrets.rs |
New addSecret/deleteSecret procedures and shared Git-state refresh after mutation. |
apps/native/src-tauri/src/shared_types/secrets_management.rs |
Adds AddSecretResult/DeleteSecretResult specta types. |
apps/native/src-tauri/src/git/exec.rs / git/mod.rs |
Generalizes commit_file into commit_files for selective multi-file commits; exports it; adds a test. |
apps/native/src-tauri/src/evolve/file_ops.rs |
Adds repo-relative and lexical relative-path helpers with tests. |
apps/native/src-tauri/src/evolve/nix_file_editor.rs |
Adds remove_attrpath for structural attrpath removal with tests. |
apps/native/src-tauri/src/evolve/ensure_secret.rs / evolve/mod.rs |
Reuses shared path helper; exports GitignoreChecker. |
apps/native/src/ipc/orpc-bindings.ts |
Generated TS bindings for the new inputs/results and procedures. |
apps/native/src/components/widget/secrets/*.tsx |
Wires add flow, delete confirmation dialog, apply-sheet error display; SOPS-only add form. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
cae401a to
55c957d
Compare
f4ee943 to
6593ba3
Compare
f45afc8 to
6500519
Compare






Summary
Hooks up the original storybook mocks end-to-end for SOP secret add and delete operations. (Age will be forthcoming.)
Includes some fileops and nix editor refactorings and enhancements for reusable/recurring patterns.
Screenshots:
Test Plan
New unit tests as appropriate, plus manual testing e2e.
Docs