M1 slice 1: amicode service — extension-host /amicode/profile with fork-parity fixtures - #463
Merged
Merged
Conversation
…ofile, golden-fixture parity with the fork M1 slice 1 of #451: the extension-host HTTP service that replaces the fork's /amicode/* routes at cutover (canonical opencode ships no custom routes — M0 gate (a)). Framework-free node:http server with the same per-boot Basic auth idiom as the opencode spawn (server_auth mint + header), exact-match route table, never-reject handlers. First ported route: GET/POST /amicode/profile — near-verbatim port of the fork's profile.ts (graceful identity synthesis, live Amico-remembers ranking, 10s cache, query-param POST contract). One documented superset: AMICODE_MOUNTS_FILE test seam (unset → fork-identical behavior). Parity proof: scripts/record_amicode_fixtures.mjs boots the vendored fork binary (v1.18.10-amicode.11) against a seeded sandbox and records golden request/response pairs; the contract test replays them against the port with the same seed and requires deep-equal responses. 7/7 green (incl. 401/404 behavior); full suite 1061/1061; typecheck clean.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
aarontrowbridge
marked this pull request as ready for review
August 20, 2026 20:23
This was referenced Aug 20, 2026
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.
Part of #451 (M1 — extension-host amicode service, slice 1 of the route port; not closing).
What's here
The first vertical slice of the M1 extension-host service — the layer that replaces the fork server's
/amicode/*routes at cutover (M0 gate (a): canonical opencode ships no custom routes):src/amicode_service/server.ts— framework-freenode:httpserver on 127.0.0.1 (ephemeral port), per-boot Basic auth using the SAME mint + header as the opencode spawn (server_auth.ts), exact-match route table mirroring the fork'srouter.addmounts, never-reject handlers (the fork's collapse-into-one-shape discipline). vscode-free so it boots in-process under vitest.src/amicode_service/profile.ts+roots.ts— near-verbatim port of the fork'sprofile.ts@ v1.18.10-amicode.11: graceful identity synthesis (name from the personal vault mount when the profile lacks one), platform-mix focus line, live "Amico remembers" ranking, 10s response cache, and the query-param POST contract (fields ride the URL, not a JSON body — a detail a naive port would silently break). One documented superset:AMICODE_MOUNTS_FILEas a test seam (unset → fork-identical).scripts/record_amicode_fixtures.mjs+scripts/amicode_fixture_seed.mjs— the golden-fixture recorder: boots the vendored fork binary against a deterministic seeded sandbox (unequal platform counts so sort order can't depend on readdir; pinned note mtimes) and records request/response pairs. Run by hand; CI replays committed fixtures without the binary.test/amicode_service_profile.test.ts— the parity proof: same seed, boot the PORT, replay every recorded request, require deep-equal responses.The recorded arc
Cold read (synthesized identity + stats + remembers) → edit focus → clear name (the mounts.toml fallback fires: "Test Personal") → warm read. All four byte-deep-equal between fork binary and port.
Verification
pnpm vitest run test/amicode_service_profile.test.ts— 7/7 (4 golden replays + pin-metadata + 401 + 404)pnpm test— 94 files, 1061/1061pnpm typecheck— cleanPattern for the remaining 17 modules
Each port slice: port the module(s) → extend the recorder's request list → re-record → contract test replays. Route count: 1 of 31 mounted (2 of 31 routes).
Not in this slice (deliberately)
Extension activation wiring (nothing consumes the service until the widget-frame slice moves consumers to it), CSP/origin widening, the
?auth_token=iframe flow.