Skip to content

Restore Secret Buckets From the Bootstrap Before the GitHub Step - #4246

Merged
ptr727 merged 6 commits into
developfrom
feature/bootstrap-secrets-4242
Nov 17, 2026
Merged

ptr727 merged 6 commits into
developfrom
feature/bootstrap-secrets-4242

Conversation

@ptr727

@ptr727 ptr727 commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • bootstrap.sh --secrets LIST and bootstrap.ps1 -Secrets LIST take bucket names separated by commas, each of lowercase letters, digits, and hyphens that start with a letter or digit.
  • On its own, --secrets is an action. It installs op and the interpreter through the tools installer, then pulls exactly the named buckets into the home directory through the new host-setup/linux/restore-secrets.sh and host-setup/windows/restore-secrets.ps1, which run scripts/secrets_sync.py pull.
  • With --host or --dev it is a step of the stand-up, not a second action. It runs after the tools step and before setup-github --configure, so a restored ~/.ssh/id_ed25519 is the key that step keeps. --host adds only op first, since the profile installed the interpreter, and --dev adds nothing.
  • With any other action it is refused. A root or elevated run is refused, since the sync refuses root.
  • Only the named buckets are pulled. Nothing is derived from the host name or a file prefix. --yes and --dry-run pass through to each tool. The sync still signs in to op under its own dry run, and the README says so.
  • scripts/secrets_sync.py is unchanged.

Documented in host-setup/README.md, the two platform READMEs, scripts/README.md "secrets_sync.py", docs/host-setup.md, and the cold-start diagram in docs/fleet-map.md.

Verification

  • Unit suite before: 4398 tests. After: 4469 tests, all passing (12 skipped, as before this change on this host).
  • New coverage: tests/test_restore_secrets.py (both scripts, stub op and stub sync, no real op, sudo, ~/.secrets, or ~/.ssh), end-to-end bootstrap.sh cases in tests/test_bootstrap.py with stub tools recording full argument lists, and PowerShell cases that run bootstrap.ps1's own functions against stub tools. A test checks that the tool names both loaders hand install-tools are managed tools.
  • Windows: unit-tested only, on pwsh under Linux. Native Windows verification is out of scope and stays with Verify the op Host Tool and secrets_sync.py Natively on Windows #4188. In particular, whether the process PATH sees an op that winget installed moments earlier is unconfirmed there.
  • Three local strict-review passes were recorded. The first two found real defects (a wrong tool name that stopped every Linux --secrets run, false comments and docs, a redundant install, a parameter position, documentation lists made stale), all fixed.

Notes

  • The comments label is applied for the why-comments this change adds to the loaders and the two new scripts.

Closes #4242

🤖 Generated with Claude Code

ptr727 and others added 3 commits November 16, 2026 17:53
A rebuilt host has no op and no checkout until the bootstrap has run, and its own SSH key may already be escrowed in a secret bucket. Restoring after the GitHub step would overwrite the key that step just registered.

bootstrap.sh --secrets LIST and bootstrap.ps1 -Secrets LIST take bucket names separated by commas. On its own the option installs op and pulls exactly the named buckets through the new restore-secrets scripts, which drive scripts/secrets_sync.py. Given with --host or --dev it runs after the tools step and before the GitHub step, so a restored key is the one setup-github keeps. Any other action refuses it, and so does a root or elevated run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Linux loader named python3 where the installer manages python, so every --secrets run stopped at the install step. A test now checks that the tool names both loaders hand the installer are managed tools.

A stand-up installs only op for the restore, since the profile already installed the interpreter. The PowerShell refusal names the actions given, -Secrets follows -FromTree so no earlier parameter moves, and the host doc states what a late pull does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The host-setup README and the Linux README list the restore pair among the programs a tree must hold, and every text naming the --secrets action says it installs the interpreter too. The README states that a dry run still reaches the sync's own sign-in. The missing-interpreter message no longer sends the user back to the tools step, which cannot raise a distro's version. The Windows dev stand-up test now counts the tools steps and orders the restore after them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings November 17, 2026 02:02
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 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 21 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

Commits

Reviewing files that changed from the base of the PR and between d921ae7 and 925dcc9.

Files selected for processing: 13

  • docs/fleet-map.md
  • docs/host-setup.md
  • host-setup/README.md
  • host-setup/bootstrap.ps1
  • host-setup/bootstrap.sh
  • host-setup/linux/README.md
  • host-setup/linux/restore-secrets.sh
  • host-setup/windows/README.md
  • host-setup/windows/restore-secrets.ps1
  • scripts/README.md
  • tests/test_bootstrap.py
  • tests/test_cli_usage.py
  • tests/test_restore_secrets.py
  • 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

@ptr727

ptr727 commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 54c928c1f4bd0605f5ffcd4e91a1b6dfa97d7d43, the content this pull request carries at that commit against develop, and it recorded 0 findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical stale-PATH failures can prevent first-run secrets restoration on fresh hosts, and the dry-run commands may report interpreters different from those actually selected.

4 open issues
What changed in this PR

Adds bootstrap support for restoring named 1Password secret buckets before GitHub setup, allowing rebuilt hosts to reuse escrowed SSH keys.

Changes:

  • Adds Linux and Windows restore scripts that validate bucket names and invoke secrets_sync.py pull.
  • Integrates --secrets and -Secrets into standalone and host/development bootstrap flows.
  • Adds unit, bootstrap, CLI, documentation, and cold-start diagram coverage.
File Description
tests/​test_restore_secrets.py Tests Linux and PowerShell restore-script behavior with isolated tool and sync stubs.
tests/​test_cli_usage.py Registers the new restore scripts for CLI usage validation.
tests/​test_bootstrap.py Tests bootstrap dispatch, ordering, validation, failure handling, and managed tool behavior.
scripts/​README.md Documents bootstrap-based secret restoration for secrets_sync.py.
host-setup/​windows/​restore-secrets.ps1 Implements Windows restoration of named secret buckets.
host-setup/​windows/​README.md Documents the Windows secret restoration script.
host-setup/​README.md Documents the cross-platform bootstrap secret-restoration workflow and ordering.
host-setup/​linux/​restore-secrets.sh Implements Linux restoration of named secret buckets.
host-setup/​linux/​README.md Documents the Linux secret restoration script and its dependencies.
host-setup/​bootstrap.sh Adds Linux --secrets parsing and integration with standalone and stand-up flows.
host-setup/​bootstrap.ps1 Adds Windows -Secrets parsing and integration with standalone and stand-up flows.
docs/​host-setup.md Documents restoring secrets before GitHub configuration during host setup.
docs/​fleet-map.md Updates the cold-start flow to show the optional secret-restoration step.

Review effort: Lite

Comment thread host-setup/bootstrap.ps1 Resolved
Comment thread host-setup/windows/restore-secrets.ps1 Resolved
Comment thread host-setup/linux/restore-secrets.sh Resolved
Comment thread host-setup/windows/restore-secrets.ps1 Resolved
The Windows restore runs in a fresh process after the tools installer changed the user and machine PATH, so it appends those entries before it looks for op. The restore's dry run names no interpreter, since the real run picks one at run time. The PowerShell restore function takes a singular noun, which the lint rule on cmdlet nouns requires.

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

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.03%. Comparing base (d921ae7) to head (925dcc9).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4246   +/-   ##
========================================
  Coverage    78.03%   78.03%           
========================================
  Files           42       42           
  Lines        15381    15381           
========================================
  Hits         12002    12002           
  Misses        3379     3379           
Flag Coverage Δ
python-3.13 78.03% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The Windows dry-run case without op now checks the printed arguments as the Linux case does, so a dropped or garbled argument list fails it.

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

ptr727 commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 7d7d213bb7ddeb5b48f13a78f625e435001e545a, the content this pull request carries at that commit against develop, and it recorded 0 findings.

The cases run the bash script under a PATH of symlinked stubs, which Git Bash on a Windows runner cannot use for commands with no extension, so every case stopped at the script's first line. The PowerShell script cases already run only on a POSIX host, so the Windows runner now skips both classes.

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

ptr727 commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 925dcc9346421907f81889060a20e984e035e4b0, the content this pull request carries at that commit against develop, and it recorded 1 finding.

@ptr727

ptr727 commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit d324114 into develop Nov 17, 2026
13 checks passed
@ptr727
ptr727 deleted the feature/bootstrap-secrets-4242 branch November 17, 2026 02:53
ptr727 added a commit that referenced this pull request Nov 17, 2026
…trap Secret Restore (#4255)

## Summary

Promotes `develop` to `main`. It carries nine changes:

- [#4247](#4247): retires
the `CLAUDE.md` pointer file, the second half of #4074. The hub's copy
and its `spec/files.json` entry are gone, and a `retire` gap records
why. The audit now reports a retired path the hub no longer tracks. A
copy matching a past hub revision is reported for deletion, and any
other copy is reported for the maintainer. It merged on the maintainer's
go-ahead after reading its diff, which touches
`host-setup/agent-safety/README.md`.
- [#4256](#4256): that
match compares line endings alone, so a retired copy differing in an
action pin or a `needs:` list goes to the maintainer. It answers a
Copilot finding on this promotion.
- [#4260](#4260): the
audit run stamp names the commits it read. HEAD carries `-dirty` where
the read paths differ from it, and `main <sha>` is added where the
fetched `main` differs.
- [#4259](#4259):
`pr-review-conduct` states the `pr_review.py` spelling rule once for
every call a fleet skill prints. Under a restricted uv cache, a merge or
a branch delete is reported to the maintainer as a blocked write.
- [#4261](#4261):
`validate-task.yml` takes a `test-matrix-file` input, read through the
same validation as `test-matrix`.
- [#4257](#4257): the
pre-commit snippet says to exclude `hub_fetch_run.py` from a
repository's own ruff with `force-exclude = true`. The short-form
`AUDIT.md` snippet drops its two hub-audit authority sentences.
- [#4246](#4246):
`bootstrap.sh --secrets` and `bootstrap.ps1 -Secrets` restore named
secret buckets, on their own or as a step of a `--host` or `--dev`
stand-up.
- [#4250](#4250): `host-*`
buckets in `scripts/secrets_sync.py` may each hold the same
home-relative title.
- [#4258](#4258): a dry
run with no 1Password account is refused rather than enrolling one, and
the root-refused secrets tests skip on a root runner. It answers two
CodeRabbit findings on this promotion.

Hosts already carry the load-both setting the retirement relies on, from
the 2.0.1483 kit.

Closes #4074
Closes #4236
Closes #4238
Closes #4239
Closes #4242
Closes #4243
Closes #4248
Closes #4249

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants