Skip to content

Add shared identity conformance fixtures and Fastly coverage - #1613

Open
prk-Jr wants to merge 3 commits into
spec/edgezero-pr275-migrationfrom
feat/1586-identity-conformance
Open

prk-Jr wants to merge 3 commits into
spec/edgezero-pr275-migrationfrom
feat/1586-identity-conformance

Conversation

@prk-Jr

@prk-Jr prk-Jr commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a shared identity conformance suite: one set of scenarios that checks an adapter never issues an Edge Cookie (ts-ec) without its stored record, and never drops an existing identity when geo is unavailable.
  • Runs all nine scenarios on Fastly through the real router, the production finalization callback and the full HTML body. Storage, origin and platform metadata are test fixtures, and native controls prove the assertions reject broken results.
  • Adds a CI launcher that fails if the selected adapter's test is missing or runs zero tests, and that refuses adapters that have no runner yet.

This PR adds tests and test infrastructure only. It changes no production identity behavior and adds identity to no other adapter.

Stacked on #1506 (spec/edgezero-pr275-migration, baseline cc811fc7aa0d234e447a868af5b8ab4ea359326a). Retarget to main after the cutover merges.

Changes

File Change
.github/workflows/test.yml Run the Fastly conformance suite, the launcher tests and the native rejection controls.
crates/trusted-server-adapter-fastly/src/identity_conformance.rs Run the shared scenarios through the actual Fastly application path with deterministic platform fixtures.
crates/trusted-server-adapter-fastly/src/main.rs Share the finalization callback between production and the runner; add a test-only identity store seam.
crates/trusted-server-adapter-fastly/src/platform.rs Add a test-only failed geo lookup fixture.
crates/trusted-server-core/src/ec/kv_backend.rs Expose the existing in-memory store behind the test/test-utils gates.
crates/trusted-server-core/src/test_support.rs Expose the conformance test-support module.
crates/trusted-server-core/src/test_support/identity_conformance.rs Shared scenarios, recording/failing store, cookie replay and expiry checks, and rejection controls.
crates/trusted-server-integration-tests/README.md How to run the suite, what it covers, and what it does not (including post-delivery work).
docs/superpowers/specs/2026-11-16-identity-conformance-design.md Approved design, feasibility limits, delivery boundaries and review log.
docs/superpowers/plans/2026-11-16-identity-conformance.md Implementation steps, progress and dependent follow-up work.
scripts/test-identity-conformance.mjs Require the selected adapter's exact conformance test to exist and pass.
scripts/test-identity-conformance.test.mjs Reject unavailable or unknown adapters and missing or zero-test runs.

Closes

Does not close an issue. This is the first slice of #1586, which cannot close until other planned work lands.

#1586 asks for three things. Where each one stands:

#1586 acceptance criterion Status Waiting on
The suite passes on each supported adapter (MVP: Fastly and Axum) Fastly: done in this PR. Axum: not yet #1574 adds identity to Axum. Axum has no identity feature today, so there is nothing to run the suite against yet. #1574's own criteria require running this suite.
Startup fails on an unsupported adapter when identity is configured Not started An "identity enabled" setting, delivered by #1600 and #1587. Using today's ec.ec_store instead would break startup for existing Axum, Cloudflare and Spin configs.
SH-5: no adapter calls EC code directly; one shared app runs everywhere Not started #1600 moves identity into one shared app in core. Until then, Fastly's own adapter code still calls EC generation and finalization directly.

Order of the remaining work: #1506 → #1600 → #1574, then the startup check and the SH-5 check. Cloudflare follows in #1588.

Spec

Spec: Identity conformance design

Plan: Identity conformance implementation plan

Both documents include two review rounds. The missing-browser-metadata scenario reflects today's browser gate and must change when #1592 permits absent JA4.

What the suite does not cover

  • Post-delivery work. The suite stops when the finalized response is delivered. Telemetry and EC pull sync are not run, so its release-ordering checks cover writes made during finalization only.
  • Real browser fingerprints. Local Viceroy provides no JA4, so the unmodified build cannot create a fresh identity over local HTTP. Fresh creation on the real ingress needs a deployed service.
  • Other adapters. Axum, Cloudflare and Spin are rejected explicitly by the launcher until their runners exist.

Test plan

Local checks use Rust 1.98.1, Node 24.20.0 and Viceroy 0.21.0.

  • cargo test-fastly && cargo test-fastly-reuse && cargo test-axum && cargo test-cloudflare && cargo test-spin
  • Target-matched adapter clippy aliases, including Cloudflare/Spin WASM, plus cargo clippy-cli && cargo clippy-codegen
  • cargo fmt --all -- --check
  • JS tests: 80 files / 3,299 tests passed, no type errors
  • JS format, full docs format, Markdown outside docs, and changed JS/YAML format
  • Fastly suite (nine scenarios), five launcher tests, and eight native rejection controls
  • Integration parity: 33 tests passed
  • Native template build-digest test and lint
  • WASM clock lint, CI Node pin tests/guard, and URL-host lint against the stacked base
  • Documentation proposal and release producer tests/shellcheck
  • Fastly absolute-deadline network fixtures: six tests passed
  • Cloudflare and Spin deadline fixture builds, lint and runtime probes (Wrangler 4.83.0, wasm-bindgen 0.2.126, Spin 4.1.0)
  • Headless Chrome lifecycle check (below)
  • Hosted CI on the latest PR revision

Negative controls. Disconnecting finalization made the suite fail the missing-cookie check. Treating missing geo as consent withdrawal made it fail at "should retain the reader's cookie". Both pass again when restored. Native controls also reject late writes, late failures, expired cookies and tombstones counted as live records.

Headless Chrome. Real Chrome through the local hostname proxy to the publisher page, with us_privacy=1YNN (Viceroy's default location is a US state that needs a consent signal):

Step Build Result
Fresh visit Unmodified release No ts-ec; consent allowed, refused at the bot gate (ja4=None)
Fresh visit Test build with a fixed JA4 One ts-ec and a live record for the same ID
Reload Test build Same cookie, record still live
GPC (Sec-GPC: 1) Test build Cookie deleted, record tombstoned
Next visit with GPC Test build Nothing created
Existing identity, no geo Test build Cookie and record kept across two visits

The test build differs from the reviewed code only by a one-line fixed JA4 fallback, so this proves the lifecycle mechanics, not the real production ingress. Server-side DataDome protection was disabled in the disposable local config, protected image assets were blocked, and only the HTML document was checked.

The supplemental native core --all-targets --features test-utils clippy run reports the pre-existing result_large_err lint in run_pre_dispatch_hook, reproduced on the unchanged cutover base. This PR does not touch it.

Checklist

@prk-Jr prk-Jr self-assigned this Nov 16, 2026
@prk-Jr prk-Jr linked an issue Nov 16, 2026 that may be closed by this pull request
3 tasks
…al before writes

The Fastly runner now uses the production native request read and prepare,
replacing only the client IP, geo result and JA4-backed device signals that
Viceroy cannot supply. Refused scenarios must stop before any write attempt,
with a native control proving the check rejects one. Docs describe the
failed-geo fixture and record current progress.
@prk-Jr
prk-Jr marked this pull request as ready for review November 17, 2026 05:28

This branch has not been deployed

No deployments
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.

Identity conformance suite that runs against each adapter, Fastly and Axum first

1 participant