Skip to content

Adapt Mocktioneer to edgezero v0.0.4 (extensible CLI, typed config, introspection routes)#110

Open
aram356 wants to merge 44 commits into
mainfrom
feature/edgezero-extensible-cli
Open

Adapt Mocktioneer to edgezero v0.0.4 (extensible CLI, typed config, introspection routes)#110
aram356 wants to merge 44 commits into
mainfrom
feature/edgezero-extensible-cli

Conversation

@aram356

@aram356 aram356 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Closes #115

What this PR does

Adapts Mocktioneer to the released edgezero v0.0.4, which lands the extensible CLI (stackpop/edgezero#269) and the pluggable introspection routes (#300). The design spec and implementation plan that opened this PR are included under docs/superpowers/; the implementation now follows them end to end.

Changes

  • Compat: pin the six edgezero-* git deps to the immutable tag v0.0.4; drop the include_str!(manifest) arg from every adapter run_app; migrate the Spin adapter to spin-sdk ~6.0 / wasm32-wasip2 (Fastly stays wasm32-wasip1).
  • Typed config: add a validated MocktioneerConfig (bid_cpm, range(exclusive_min = 0.0)), a gitignored mocktioneer.toml with a committed mocktioneer.toml.example template, and a mocktioneer-cli crate mirroring edgezero's generated <name>-cli (config validate/diff/push, auth/build/deploy/provision/serve).
  • Runtime (fail-loud): the OpenRTB (/openrtb2/auction) and APS (/e/dtb/bid) handlers read bid_cpm from the bound config store via edgezero's typed AppConfig extractor. A fresh deploy must config push once before those endpoints serve bids — until then they error. FIXED_BID_CPM = 0.20 is the shipped default value, not a runtime fallback. Other endpoints (static/creative/pixel) are unaffected.
  • Config storage: config push writes the whole struct as a single canonical-JSON blob envelope (SHA-gated for drift detection) under the store's key, per adapter (axum local file / cloudflare KV / fastly config store / spin KV).
  • Introspection: mount the framework-supplied /_mocktioneer/{manifest,config,routes} routes from edgezero_core::introspection (unauthenticated — restrict at the network/middleware layer; [environment.secrets] are redacted).
  • Plumbing: [stores.config] in the manifest + Spin runtime-config.toml; Dockerfile seeds the default config blob and binds 0.0.0.0; docs (wasip2, fail-loud typed config, introspection, edgezero-cli-vs-mocktioneer-cli); a config validate --strict --app-config mocktioneer.toml.example CI gate + a Docker smoke test.

Notes

  • Base is main, which already carries the strict-clippy + edgezero PR #257 adaptation (via PR Adopt edgezero strict-clippy gate and PR #257 API #108).
  • Deps pin to the released tag v0.0.4 (immutable), so no post-merge re-pin is needed.
  • Spin spin up is blocked upstream: the adapter compiles to wasm32-wasip2 and passes the wasmtime router contract tests, but spin up on current Spin runtimes fails to link because spin-sdk 6.0.0 pulls wasi:http@0.3.0-rc, which no released Spin provides. This is a spin-sdk/runtime ABI mismatch to resolve upstream; Fastly / Cloudflare / Axum are unaffected.

CI

fmt · clippy -D warnings · test --workspace · check --features "fastly cloudflare" · config validate --strict · Docker build + smoke · Playwright · docs ESLint/Prettier — all green.

aram356 added 23 commits June 14, 2026 00:47
…tures, pricing docs, docker, prettier exclusion, CLI story)
…I seed, dockerfile cache-hygiene, docs build-exclusion, broader CLI docs)
…t(?Send) test impl, spin release build in verify)
@aram356 aram356 marked this pull request as draft June 16, 2026 15:36
aram356 added 6 commits June 16, 2026 08:37
…n/typed-config, add spin to agent builds, fix stale pricing/cli comments
…ush prereq to quickstarts; patch spin in local overlay
@aram356 aram356 marked this pull request as ready for review July 2, 2026 04:28

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Reviewed PR #110 (feature/edgezero-extensible-cli) against main. The typed-config wiring is mostly coherent and CI is green, but I found two blocking deployment/runtime compatibility issues plus two medium follow-ups. Details are inline.

Comment thread Dockerfile
Comment thread edgezero.toml
Comment thread .claude/commands/check-ci.md Outdated
Comment thread crates/mocktioneer-core/src/routes.rs

@prk-Jr prk-Jr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review

Summary

Adapts Mocktioneer to the breaking edgezero #269 (extensible CLI): typed MocktioneerConfig with runtime bid_cpm resolution via the fail-loud AppConfig extractor, a mocktioneer-cli crate, a new Spin adapter (wasm32-wasip2), introspection routes, [stores.config] plumbing, and a workspace-wide clippy-restriction gate. All local CI gates pass. Solid, well-tested work — the only merge-relevant question is the edgezero dependency pin target.

Note: the PR description still reads "docs-only — design + plan, no implementation code yet." The branch now carries the full implementation (~6.5k insertions). Worth updating the body so reviewers see the real scope.

Findings

❓ Questions

  • edgezero dep pin (Cargo.toml:32): pinned to worktree-feature+introspection-routes rather than the feature/extensible-cli the docs describe. Reproducible today (Cargo.lock locks the SHA), fragile if that branch moves. See inline.

🌱 Seeds / 📌 Out of scope

  • Env-var security on Workers (routes.rs): MOCKTIONEER_TS_DOMAINS open-redirect allowlist and MOCKTIONEER_PULL_TOKEN resolve-auth are std::env::var-gated, so both no-op on Cloudflare. Pre-existing; candidate to fold into the new [stores.config]. See inline.
  • Stale PR description: says docs-only; is a full implementation.

⛏ Nitpicks

  • Dockerfile base drift (Dockerfile:39): runtime debian:stable-slim (rolling) vs builder bookworm (pinned). Pin bookworm-slim to match. Docker build not exercised by the local Rust CI.

🤔 Thoughts

  • The clippy-restriction mechanical sweep (literal suffixes, struct-field reordering, as _ imports, to_owned) is interleaved with the substantive logic changes, which makes the real diff harder to isolate. Future gate adoptions could land the reformat as its own commit/PR.

👍 Praise

  • Mediation is now deterministic: HashMapBTreeMap plus unwrap()let-else, with first-bidder-wins tie-break preserved (mediation.rs:160).
  • Constant-time bearer comparison over SHA-256 digests (avoids length leak); thorough is_valid_hostname rejecting IP literals / path / auth / port / fragment injection, with matching tests.
  • CI seeds a non-default bid_cpm and asserts it round-trips through config push — catches wiring regressions a default-value test would miss.
  • Spin adapter correctly gated to wasm32 with a #[expect(...)]-documented unsafe_code allowance, plus a wasip2 contract test in the CI matrix.

CI Status (run locally on this branch)

  • fmt: PASS
  • clippy (--workspace --all-targets --all-features -D warnings): PASS
  • tests (cargo test --workspace --all-targets): PASS

Comment thread Cargo.toml Outdated
Comment thread Dockerfile Outdated

@prk-Jr prk-Jr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review

Summary

Solid adaptation to edgezero #269: typed MocktioneerConfig with fail-loud AppConfig wiring on the OpenRTB/APS paths, a thin mocktioneer-cli over the edgezero-cli library, the Spin wasip2 migration, Docker config seeding + smoke test, and CI config gates — with the docs updated everywhere the fail-loud model is user-visible. No blocking code issues; the remaining asks are PR metadata and small polish (4 inline comments below).

Findings

📝 Notes

  • Stale PR title/body — please update before merge: the body still says "no implementation code yet… This PR is docs-only", but the branch now ships the full implementation (typed config + fail-loud AppConfig wiring, the mocktioneer-cli crate, Spin wasip2 migration, Docker config seeding + smoke test, CI config gates, introspection routes). Reviewers and the audit trail read the description first — please rewrite the title/body to describe what actually merges.

📌 Out of Scope

  • Re-pin tracking: the worktree-feature+introspection-routes pin is acknowledged as intentional (introspection routes only exist there). Suggest opening a tracking issue to re-pin to edgezero main once #269 + the introspection branch land, so a throwaway-named branch doesn't rot underneath a merged main (Cargo.toml:26-31).

🌱 Seeds

  • Introspection auth: /_mocktioneer/{manifest,config,routes} are unauthenticated by design and the docs warn about it correctly. A future option: a shared-token middleware for public deployments, so the route block can stay bound in edgezero.toml without a network-layer prerequisite.

👍 Praise

  • Fail-loud test coverage: seeded-cpm + missing-config tests on both the OpenRTB and APS paths, a CI step that round-trips a non-default 0.35 into the blob envelope, and a Docker smoke test that proves the 0.0.0.0 bind and an out-of-the-box auction. This is the right shape of evidence for a behavior-changing config model.
  • Docs discipline: the config-push prerequisite is surfaced on every quickstart, adapter, API, and integration page, and the MOCKTIONEER__* env-overlay semantics (applied at push time, not runtime) are spelled out precisely.

CI Status

  • fmt: PASS (verified locally)
  • clippy: PASS (per CI)
  • tests: PASS (per CI)

Comment thread edgezero.toml Outdated
Comment thread crates/mocktioneer-core/src/routes.rs
Comment thread Dockerfile Outdated
Comment thread crates/mocktioneer-adapter-spin/src/lib.rs Outdated
aram356 added 2 commits July 9, 2026 11:04
v0.0.4 (9e661ae5) is a superset release containing both the extensible
CLI (edgezero #269) and the pluggable introspection routes (#300),
replacing the transient worktree branch pin with a stable, durable tag.
…g, config_registry helper, drop dead unsafe_code allow
@aram356 aram356 requested a review from prk-Jr July 9, 2026 19:01
@aram356 aram356 changed the title Design + plan: adapt Mocktioneer to edgezero #269 (extensible CLI) Adapt Mocktioneer to edgezero v0.0.4 (extensible CLI, typed config, introspection routes) Jul 9, 2026

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Reviewed PR #110 at 0bd3e152 against main. The core typed-config and pricing flow is coherent, but this review found one high-risk release-workflow problem and three medium test/documentation gaps. Current CI is green; the previously identified Spin runtime ABI incompatibility also remains a known operational limitation.

Comment thread .github/workflows/docker.yml Outdated
Comment thread .github/workflows/test.yml
Comment thread crates/mocktioneer-core/src/routes.rs Outdated
Comment thread docs/guide/getting-started.md Outdated
aram356 added 2 commits July 10, 2026 21:57
…exact 503 config_out_of_date contract, fresh-clone getting-started validate
…apters

Adds a contract test to each adapter's existing wasm test binary that seeds a
non-default bid_cpm (0.35) in an in-process ConfigStore, injects it via the
service builder's with_config_handle, and dispatches POST /openrtb2/auction —
covering request translation, the config-store binding, the AppConfig extractor,
the auction handler, and response translation under the real wasm runtime
(Viceroy / wasm-bindgen). Runs in the existing adapter-wasm-tests CI matrix; no
new emulator infra. Spin equivalent waits on the upstream wasi:http ABI fix.

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Approved. The typed-config pricing path, adapter bindings, Docker behavior, and CLI wiring are coherent, and all current CI checks pass. I left two non-blocking P2 notes inline: preserving the existing public builder signatures and completing the Fastly remote config deployment instructions.

The previously documented Spin runtime ABI limitation remains an acknowledged operational constraint.

req: &OpenRTBRequest,
base_host: &str,
signature_status: SignatureStatus,
cpm: f64,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 — Preserve the existing public builder API

Adding the mandatory cpm argument here, and to build_aps_response, makes existing downstream calls fail with Rust E0061. The runtime wiring does not require breaking those public signatures. Please consider retaining the original functions as wrappers using FIXED_BID_CPM, and adding configured variants such as build_openrtb_response_with_cpm and build_aps_response_with_cpm for the handlers. The compatibility risk is limited because this crate is publish = false, so I am treating this as non-blocking.


```bash
cp mocktioneer.toml.example mocktioneer.toml
cargo run -p mocktioneer-cli -- config push --adapter fastly --local

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 — Document the corresponding remote Fastly setup

This correctly seeds Viceroy's local state, but the production deployment section below only runs deploy; it never provisions or pushes the remote Fastly Config Store. A user following that flow deploys fail-loud OpenRTB/APS endpoints without their required blob. Please add the first-deploy sequence using mocktioneer-cli provision --adapter fastly, mocktioneer-cli config push --adapter fastly --yes, and then deploy, plus a note to re-push after config changes.

@aram356 aram356 self-assigned this Jul 13, 2026
aram356 added a commit that referenced this pull request Jul 13, 2026
…dition 2024

The Spin description claimed wasm32-wasip2, but on main the adapter builds
wasip1: spin-sdk is 5.2, edgezero.toml declares wasm32-wasip1, and the CI
matrix runs the spin contract tests under wasip1 via wasmtime. wasip2 arrives
with the spin-sdk 6 migration in #110, which adds its own wasip2 CI entry.

Also update CLAUDE.md, which still declared Edition 2021.
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.

Adapt Mocktioneer to edgezero v0.0.4 (extensible CLI, typed config, introspection routes)

3 participants