Skip to content

feat(emulator): declare every emulator the repo ships (#1345) - #1368

Merged
lex00 merged 2 commits into
mainfrom
feat/emulator-capability
Aug 3, 2026
Merged

lex00 merged 2 commits into
mainfrom
feat/emulator-capability

Conversation

@lex00

@lex00 lex00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Closes #1345. Part of #1340.

The gap

chant emulator up --all booted one of the four emulators in this repo.

azure's floci-az and gcp's floci-gcp already built the exact EmulatorSpec the capability wants — same emulatorLifecycle helper, same name/image/port/health path — and neither set plugin.emulator. fly could not declare at all: it ships two emulators (mudflaps for the Machines API, spritzer for Sprites) and the field held exactly one.

Meanwhile local-testing/ presents all three clouds as equal local targets, which is true of the ops and was false of the capability.

What changed

emulator takes a capability or a list of them, and chant emulator reports one line per emulator rather than per lexicon:

✓ aws: chant-floci up on http://localhost:4566
✓ azure: chant-floci-az up on http://localhost:4577
✓ gcp: chant-floci-gcp up on http://localhost:4588
✓ fly: chant-mudflaps up on http://localhost:4280
✓ fly: chant-spritzer up on http://localhost:4290

Endpoint vars now come from the lexicon — and this fixes a live bug

LEXICON_ENDPOINT_ENV_VAR was a hand-maintained map in core naming the ambient var a --live read honors. It listed two of the four lexicons that have one, and its module doc asserted:

azure — resolves via the az CLI's own logged-in subscription/session context; no ambient endpoint var exists to miss.

lexicons/azure/src/describe-resources.ts:142 and deep-observe.ts:256 both read process.env.AZURE_ENDPOINT_URL on every call. So --live --env floci against azure silently read real Azure rather than the emulator.

The vars are derived from each lexicon's own emulator.env() now, by probing with a sentinel and keeping the keys whose value is the endpoint — so credentials that env() legitimately returns (AWS_ACCESS_KEY_ID: "test") are handed to --json consumers but never injected into a --live read's shell. A lexicon with no emulator contributes nothing, the same answer the map gave for k8s, gcp and temporal.

Images are pinned

floci, floci-az and floci-gcp all tracked :latest. Each spec now names a released tag verified to exist, plus the upstream repo it comes from:

was now
aws floci/floci:latest floci/floci:1.5.34
azure floci/floci-az:latest floci/floci-az:0.10.0
gcp floci/floci-gcp:latest floci/floci-gcp:0.5.0

Freshness generalizes out of fly

fly's private emulator-freshness.ts becomes scripts/check-emulator-freshness.ts, driven by the declared specs rather than a hardcoded pair, and reporting any emulator still on a floating tag. Run against this branch:

✓ chant-floci: pinned 1.5.34 is current (latest 1.5.34)
✓ chant-floci-az: pinned 0.10.0 is current (latest 0.10.0)
⚠ chant-mudflaps: pinned 0.4.1, latest 0.5.0 — behind
✓ chant-spritzer: pinned 0.4.1 is current (latest 0.4.1)
✓ chant-floci-gcp: pinned 0.5.0 is current (latest 0.5.0)

mudflaps is left alone deliberately — per the #808 policy a pin moves when a consuming test needs the newer emulator, not because a release happened. The weekly workflow now opens that notice for all five instead of two.

Note for reviewers

createMockPlugin gained an emulator option, and the handler tests that exercise --live endpoint injection now declare one. That is not test bookkeeping: a mock without an emulator gets no injection, which is exactly what a real lexicon without one would get. The old behavior keyed off the string "aws".

Verification

  • 10347 tests pass, 12/12 lexicons green
  • The freshness script runs against all five emulators live
  • Main docs site builds; EmulatorCapability has an authoring page for the first time

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jp6SP7ZiavhoEB1AFuwwoJ

lex00 and others added 2 commits August 2, 2026 19:25
`chant emulator up --all` booted one of the four emulators in this repo.
azure's floci-az and gcp's floci-gcp built the exact `EmulatorSpec` the
capability wants — same `emulatorLifecycle` helper, same name/image/port/health
— and never set `plugin.emulator`. fly could not declare at all: it ships two
emulators, and the field held exactly one.

So `emulator` now takes a capability or a list of them, `chant emulator`
reports one line per emulator rather than per lexicon, and all five are
declared: Floci, floci-az, floci-gcp, mudflaps, spritzer.

Three things follow.

**Endpoint vars come from the lexicon.** `LEXICON_ENDPOINT_ENV_VAR` was a
hand-maintained map in core naming the ambient var a `--live` read honors. It
listed two of the four lexicons that have one, and its module doc asserted
azure had none — while `describe-resources.ts` and `deep-observe.ts` both read
`AZURE_ENDPOINT_URL` on every call, so `--live --env floci` against azure
silently read real Azure. The vars are now derived from each lexicon's own
`emulator.env()`, picking out the keys whose value *is* the endpoint so
credentials are not injected alongside it. A lexicon with no emulator
contributes nothing, which is the same answer the map gave for k8s, gcp and
temporal.

**Images are pinned.** floci, floci-az and floci-gcp tracked `:latest` — an
image that moves underneath a passing local suite with nothing in the repo
recording what changed. Each spec now names a released tag and the upstream
repo it comes from.

**Freshness generalizes.** fly's private freshness checker becomes
`scripts/check-emulator-freshness.ts`, driven by the declared specs rather than
a list of two, and reporting any emulator still on a floating tag. It found
mudflaps one minor behind, which is left alone: per the #808 policy a pin moves
when a consuming test needs the newer emulator, not because a release happened.

`EmulatorCapability` had no authoring documentation at all; it has a page now,
including why having an emulator is not declaring one.

Refs #1340.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jp6SP7ZiavhoEB1AFuwwoJ
…ests

`applyLiveEndpoint` takes plugins rather than lexicon names now (#1345); two
call sites in its own test still passed strings. Missed locally because
tsconfig.build.json excludes tests and CI typechecks tsconfig.json.
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.

Lexicon contract: three lexicons ship an emulator without declaring the emulator capability

1 participant