feat(cli): sync existing apps into local checkouts #502

Open
anton wants to merge 1 commit from feat/apps-sync into main
Owner

Summary

  • Add caution apps sync <APP_ID> to restore an existing app's local link in the current Git checkout. The CLI creates .caution if necessary and writes the supported ID-only .caution/deployment.json; live app details continue to come from the API.
  • Verify the authenticated API response and its Git URL match the requested UUID before changing the link. Add or repair the caution remote, replacing stale/multiple fetch and push URLs with the API-provided URL.
  • Preserve origin, caution.hcl, trusted hashes, secrets, and other local files. Do not create an app, fetch/push source, or deploy anything.

Test plan

  • cargo +1.96.1 test --locked -p cli --test apps_sync — 4 passed. Real CLI subprocesses and Git/filesystem operations against an explicitly synthetic loopback API cover initial creation, repeated sync, stale links and remote URLs, preservation, bad/missing IDs, API failures/mismatched responses, non-worktrees, and native Git config-lock failure.
  • RUSTUP_TOOLCHAIN=1.96.1 make test — 1,441 Rust and 89 Python tests passed; 52 Rust tests ignored by the regular suite.
  • cargo +1.96.1 clippy --locked -p cli --all-targets -- -D warnings — passed on commit 5cc219283cc8caa859abe1847be9af3aecba7376; the full make test suite was also rerun successfully on that exact commit.
  • rustfmt +1.96.1 --check --edition 2024 src/cli/src/apps/sync.rs src/cli/tests/apps_sync.rs and scoped Git whitespace checks — passed.

Boundaries

Independent review passed with no blocking findings. This restores the local app link, not source code, deployment snapshots, or verification/secrets material. If intentionally switching apps, existing app-specific trust and quorum files remain; verify the selected app before using them. Every Git command checks its exit status. If the later metadata write fails after Git was updated, the error explicitly reports that partial state and advises retrying; this is not a cross-file transaction.

No deployed-stack/cloud E2E was run: this is a local CLI change using the existing read-only app endpoint, and no branch deployment was requested. Nothing was merged or deployed.

## Summary - Add `caution apps sync <APP_ID>` to restore an existing app's local link in the current Git checkout. The CLI creates `.caution` if necessary and writes the supported ID-only `.caution/deployment.json`; live app details continue to come from the API. - Verify the authenticated API response and its Git URL match the requested UUID before changing the link. Add or repair the `caution` remote, replacing stale/multiple fetch and push URLs with the API-provided URL. - Preserve `origin`, `caution.hcl`, trusted hashes, secrets, and other local files. Do not create an app, fetch/push source, or deploy anything. ## Test plan - `cargo +1.96.1 test --locked -p cli --test apps_sync` — 4 passed. Real CLI subprocesses and Git/filesystem operations against an explicitly synthetic loopback API cover initial creation, repeated sync, stale links and remote URLs, preservation, bad/missing IDs, API failures/mismatched responses, non-worktrees, and native Git config-lock failure. - `RUSTUP_TOOLCHAIN=1.96.1 make test` — 1,441 Rust and 89 Python tests passed; 52 Rust tests ignored by the regular suite. - `cargo +1.96.1 clippy --locked -p cli --all-targets -- -D warnings` — passed on commit `5cc219283cc8caa859abe1847be9af3aecba7376`; the full `make test` suite was also rerun successfully on that exact commit. - `rustfmt +1.96.1 --check --edition 2024 src/cli/src/apps/sync.rs src/cli/tests/apps_sync.rs` and scoped Git whitespace checks — passed. ## Boundaries Independent review passed with no blocking findings. This restores the local app link, not source code, deployment snapshots, or verification/secrets material. If intentionally switching apps, existing app-specific trust and quorum files remain; verify the selected app before using them. Every Git command checks its exit status. If the later metadata write fails after Git was updated, the error explicitly reports that partial state and advises retrying; this is not a cross-file transaction. No deployed-stack/cloud E2E was run: this is a local CLI change using the existing read-only app endpoint, and no branch deployment was requested. Nothing was merged or deployed.
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/apps-sync:feat/apps-sync
git switch feat/apps-sync
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
public/platform!502
No description provided.