Skip to content

setCloudKey: validate + save the cloud key, flip HP (command-palette flow) - #173

Merged
kateebonner merged 5 commits into
mainfrom
rchari/hp-cloud-key
Jul 20, 2026
Merged

setCloudKey: validate + save the cloud key, flip HP (command-palette flow)#173
kateebonner merged 5 commits into
mainfrom
rchari/hp-cloud-key

Conversation

@kateebonner

Copy link
Copy Markdown
Contributor

Raghav's key-entry flow (see the 7/18 handoff), reviewed per the handoff's "review + merge path" item — review executed by Kate's session with a dispatched reviewer.

Verdict: MERGE-WITH-NITS (no blockers). Branch suite: 630 passed / tsc clean; own tests 15/15 + 5/5. Verified-good: probe classification corroborated against the deployed authorizer semantics; cloud.json byte-shape exactly matches the CLI reader incl. slash normalization; 0600 at create + chmod for pre-existing files; entitlement grant preserves foreign codes; non-atomic write is exactly the accepted debt (ADR 0001 migrates it via #171).

Minors carried to #171 (which re-points this command at the Connections panel seam and rewrites the flow): success toast shown even when the HP flip write fails; switching-write with no watcher in no-binary sessions; rotation forces a re-prep when already HP; probe's false-positive lane on a wrong base URL (upgrades to identity echo via aws-infra#185); one vacuous leak test (the real adversarial coverage is genuine); Amico: vs Amicode: title prefix; prod URL duplicated between package.json and the constant.

Merge-forecast vs the Connections integration branch: clean (merge-tree verified, no overlapping hunks).

🤖 Generated with Claude Code

Rchari1 and others added 5 commits July 19, 2026 23:43
…ken-leak

Red: exercises the pure helpers a setCloudKey command will need —
- classifyValidation: 401→invalid, 403/404/200→valid, other→error
- buildCloudConfig: exact {base_url, token} shape remote_config.ts reads
- validateCloudKey: injected fetch (no live network), hits
  {url}/solves/__validate__/status with a Bearer header, token never in URL
- adversarial: token must never appear in any returned error/outcome string

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Green (15 tests). classifyValidation encodes the authorizer-before-handler
contract (401=invalid, 403/404/2xx=valid, else=error); buildCloudConfig emits
the exact {base_url, token} shape remote_config.ts reads (base_url trimmed to
match its normalization); validateCloudKey probes {url}/solves/__validate__/status
with a Bearer header via injectable fetch — token only in the header, never the
URL, and never in any returned error string.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mirrors writeSolverModeReady but writes {status:"switching"} — the same signal
the app's toggle POSTs — so the already-running watchSolverMode does the real
HP re-prep (entitlement + project + server restart) exactly once. Lets
setCloudKey flip to HP by reusing the existing switch machinery, not
reimplementing it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…key, flip HP

Wires the Connect Cloud command:
- showInputBox (password, ignoreFocusOut); empty/cancel → no-op
- validateCloudKey against the live Solve Service BEFORE saving: 401 → reject
  (error toast, no save); 403/404/2xx → valid; network/other → error, no save
- on valid, write ~/.amico/cloud.json {base_url, token} at mode 0600 (chmod
  enforced even if pre-existing) — the exact shape RemoteExecutor reads
- flip to HP: applyEntitlementForMode("hp", ~/.amico/amicode) + request a switch
  via writeSolverModeSwitching so the running watcher does the real re-prep once
- info toast "Cloud connected — Piccolissimo + Altissimo solves enabled."
Token rides only in the Authorization header + the on-disk file; never logged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…Url setting

- command "amicode.setCloudKey", title "Amico: Connect Cloud (Piccolissimo + Altissimo)"
- config amicode.cloudUrl, defaulting to the production Solve Service endpoint,
  so the base URL is configurable rather than hardcoded-only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kateebonner
kateebonner merged commit 0c4fde9 into main Jul 20, 2026
5 checks passed
kateebonner added a commit that referenced this pull request Jul 20, 2026
…branch

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants