[feature] project env vault: pb env with synced/local layers, pull-only Infisical sync, portable manifest - #2
Merged
Conversation
…ly Infisical sync, account guard
…t; machine-local attachments + committed .patchbay.toml marker resolve directories
|
Contributor
Author
|
@yui0303 AI check 沒問題(585 tests 綠、clippy -D warnings 乾淨、Sonar pass、MCP smoke PASS),可以 review/merge。CI 三個 check 都已綠;merge 被 org ruleset 的 1-approval 要求擋住,approve 後我這邊會掛 auto merge 讓它自動進。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
The project env vault —
pb env: per-project environment variables managed like.env/.env.local/.env.production, but with no plaintext files, a synced layer pulled from Infisical, and a portable manifest that travels between machines.Design
flowchart LR subgraph portable["portable (travels between machines)"] M["projects.json\nids · environments · sync pin\n(no absolute paths — test-enforced)"] MK[".patchbay.toml in the repo\nproject = "pathors"\n(committed, resolves any clone/worktree)"] end subgraph machine["machine-local (stays put)"] A["attachments.json\ndir → project overrides"] K["Keychain\nenv:<project>/<env>/<layer>\none blob per layer"] end I[Infisical] -- "pb env pull\n(pull-only, account-guarded)" --> Ksyncedis replaced wholesale bypb env pull;localis hand-set, never pushed, never touched by a pull, and wins on merge —.env.localsemantics. patchbay has no push code path at all: a local experiment can never be promoted into the team's shared set.projects.jsonis a fully portable manifest (a test greps the raw file to prove no machine path leaks in). Directories resolve via machine-local attachments first, then via the committed.patchbay.tomlmarker — so every clone and every git worktree of a repo shares one project's environments with zero setup. New machine = copyprojects.json→ clone →pb env pull.pullrefuses under any other login with the exact fix (pb use infisical <email>) instead of surfacing Infisical's misleading wrong-org 403.trueis the value).list_env_projects,list_env_vars(tier 1, metadata),pull_env(tier 2),set_env_var(writes the local layer, likestore_key). Deliberately no tool returns a value —PATCHBAY_ALLOW_SECRET_READdoes not unlock one.Full rationale:
docs/env-vault.md.Verification
cargo test --workspace: 585 passing (481 core / 73 cli / 30 mcp / 1 doctest);cargo clippy --workspace --all-targets -- -D warningsclean;crates/patchbay-mcp/smoke.shPASS (tool set updated).PATCHBAY_CONFIG_DIR: init auto-adopts.infisical.jsonand pins the active account; a copied checkout resolves through the marker from a subdirectory; a "machine B" without the manifest gets the explicit bring-your-projects.json error, and works after copying it; wrong-accountpullrefuses with the switch hint. No real keychain/network touched.mainafter v0.2.0: instructions renumbered around the migration point, five routers merged, smoke tool set extended.Follow-up (tracked separately)
pb exportshould carryprojects.jsonin the migration bundle (attachments and local-layer values deliberately excluded).