setCloudKey: validate + save the cloud key, flip HP (command-palette flow) - #173
Merged
Conversation
…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
added a commit
that referenced
this pull request
Jul 20, 2026
…branch Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
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.jsonbyte-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:vsAmicode: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