Skip to content

Remove legacy entry point, canary routing, and flag plumbing#744

Draft
prk-Jr wants to merge 13 commits into
feature/edgezero-pr19-cutover-canaryfrom
feature/edgezero-pr20-legacy-cleanup
Draft

Remove legacy entry point, canary routing, and flag plumbing#744
prk-Jr wants to merge 13 commits into
feature/edgezero-pr19-cutover-canaryfrom
feature/edgezero-pr20-legacy-cleanup

Conversation

@prk-Jr

@prk-Jr prk-Jr commented May 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Deletes legacy_main, route_request, HandlerOutcome, and all canary flag-reading machinery (edgezero_enabled / edgezero_rollout_pct) now that EdgeZero has reached full functional parity and the cutover canary (PR19) is merged.
  • Removes the error module, the legacy route_tests file, and unused compat functions that only existed to support the old code path.
  • Simplifies main to a direct trampoline into edgezero_main, removing ~710 lines of dead code and the two config-store keys from fastly.toml.

Changes

File Change
crates/trusted-server-adapter-fastly/src/main.rs Delete legacy_main, route_request, HandlerOutcome, flag constants, and all associated imports (~710 lines removed)
crates/trusted-server-adapter-fastly/src/error.rs Delete entire module (only used by legacy path)
crates/trusted-server-adapter-fastly/src/route_tests.rs Delete legacy route test file
crates/trusted-server-adapter-fastly/src/compat.rs Remove legacy-only compat functions; keep Fastly↔EdgeZero conversion helpers
crates/trusted-server-adapter-fastly/src/platform.rs Remove build_runtime_services (legacy-only)
crates/trusted-server-adapter-fastly/src/app.rs Remove runtime_services_for_consent_route and build_state (legacy-only); update imports
crates/trusted-server-adapter-fastly/src/middleware.rs Clean up unused imports left behind by legacy removal
fastly.toml Remove edgezero_enabled and edgezero_rollout_pct config-store entries
docs/superpowers/plans/2026-05-27-pr20-legacy-cleanup.md Add plan document for this cleanup

Closes

Closes #501

Test plan

  • cargo fmt --all -- --check
  • cargo clippy-fastly
  • cargo clippy-axum
  • cargo test-fastly — 48 tests passed, 0 failed
  • cargo test-axum — 20 tests passed, 0 failed
  • JS tests: cd crates/js/lib && npx vitest run — 291 tests passed
  • JS format: cd crates/js/lib && npm run format
  • Docs format: cd docs && npm run format

Checklist

  • Changes follow CLAUDE.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses log macros (not println!)
  • No secrets or credentials committed

prk-Jr added 13 commits May 27, 2026 19:27
route_tests.rs tested route_request() and HandlerOutcome, which are
legacy-path only. Equivalent EdgeZero dispatch coverage exists in
app.rs. Part of #501 legacy entry point cleanup.
Remove legacy_main(), route_request(), HandlerOutcome, and all flag-reading
machinery (edgezero_enabled / edgezero_rollout_pct). Entry point is now
a direct trampoline to edgezero_main(), which opens the config store
internally. Part of #501 legacy entry point cleanup.
Remove from_fastly_request(), to_fastly_response_skeleton(), and their
build_http_request() helper from compat.rs — all were only called from
legacy_main(). Delete error.rs entirely (to_error_response() was its only
export; only caller was legacy_main()). Part of #501.
Remove 14 canary-routing test functions and the JA4 debug test (if not
already removed). Strip all imports that were only consumed by deleted
code. Part of #501.
build_runtime_services() was the legacy-path per-request service factory.
The EdgeZero path uses build_per_request_services() in app.rs instead.
Remove the dead function, its noop_kv_store() test helper, and its tests.
Part of #501.
middleware.rs referenced deleted finalize_response() and route_request().
app.rs referenced deleted http_error_response() and route_request().
platform.rs had an orphaned section header after build_runtime_services
was removed. Part of #501.
Update middleware.rs module doc from 'dual-path' to 'EdgeZero entry
point'. Update two prose mentions of route_request in app.rs to
describe current EdgeZero behavior. Part of #501.
The app no longer reads these config store keys. Remove them from the
local dev config store. The trusted_server_config store itself stays —
it is still opened by open_trusted_server_config_store(). Part of #501.
Add backticks around EdgeZero in doc comments to satisfy doc_markdown
lint. Remove unused Arc import from platform.rs test module leftover
from build_runtime_services deletion. Part of #501.
@prk-Jr prk-Jr self-assigned this May 29, 2026

@aram356 aram356 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

This PR cleanly removes the legacy Fastly entry point, canary routing, and the EdgeZero flag plumbing (~710 lines of dead code). The deletions themselves are well-scoped and correct. However, the cutover is not mergeable as-is: it turns three previously-green CI checks red — cargo test, integration tests, and browser integration tests — and the integration failures indicate the EdgeZero path is not at the "full functional parity" the description claims. I confirmed on the base branch (5f81e80) that all three checks pass, so this PR introduces all three failures.

1 of the inline comments below carries a one-click GitHub suggestion. The two blocking findings are cross-cutting — their fixes live outside this PR's diff — and are described in full in the Cross-cutting / body-level findings section.

Non-blocking

⛏ nitpick

  • middleware.rs module doc still references "the legacy entry point" — see inline at crates/trusted-server-adapter-fastly/src/middleware.rs:4

Cross-cutting / body-level findings

  • 🔧 cargo test fails — stale admin_endpoints_match_fastly_router parity test. The core test at crates/trusted-server-core/src/settings.rs:2057 does include_str!("../../trusted-server-adapter-fastly/src/main.rs") and asserts every Settings::ADMIN_ENDPOINTS literal (/admin/keys/rotate, /admin/keys/deactivate) appears in main.rs. The base main.rs carried those literals in the legacy router match arms (e.g. (Method::POST, "/admin/keys/rotate") => …); this PR deletes the legacy router, so the new main.rs contains zero /admin/ occurrences and the assertion fails — the wasm test binary aborts (SIGABRT, exit 134). This is deterministic, not a flake. The test's premise (admin routes hard-coded in main.rs) is obsolete now that EdgeZero routes them via config [[handlers]], already enforced by validate_admin_coverage / from_toml_rejects_config_without_admin_handler. Fix: update or remove that core test in the same change set — it lives outside this PR's diff, so it can't be expressed as a GitHub suggestion.

  • 🔧 integration tests + browser integration tests fail — EdgeZero-only cutover is not at parity. On the base branch, main() read edgezero_enabled (default "false") and routed to legacy_main, so both suites only ever exercised the legacy path there — and passed (verified on base commit 5f81e80: all three checks green). This PR removes the fallback and forces all traffic through EdgeZero, and now: integration teststest_all_combinations panics with "Script tag not found in HTML" (tests/common/assertions.rs:66) — the EdgeZero path serves HTML without the injected TS publisher <script>; browser integration tests"Service … not ready after 30 attempts" — the EdgeZero-only server never becomes ready. This contradicts the PR / plan-doc claim that EdgeZero has reached full functional parity. The PR-body test plan lists cargo test-fastly (48 passed) and JS, but not the workspace cargo test, integration, or browser suites — the exact gates now failing. Resolve the EdgeZero parity gap (or confirm these suites pass against EdgeZero) before removing the legacy fallback.

CI Status

  • cargo fmt: PASS
  • format-typescript: PASS
  • format-docs: PASS
  • vitest: PASS
  • cargo test (axum native): PASS
  • cargo test (cross-adapter parity): PASS
  • cargo check/build (spin native + wasm32-wasip1): PASS
  • cargo check (cloudflare native + wasm32-unknown-unknown): PASS
  • prepare integration artifacts: PASS
  • cargo test: FAIL — see body finding #1
  • integration tests: FAIL — see body finding #2
  • browser integration tests: FAIL — see body finding #2

No checks are marked required under branch protection on this branch; per CLAUDE.md's CI gates these are still PR gates, so the failures are merge-blocking in practice.

//!
//! Provides two middleware types that mirror the finalization and auth logic
//! from the legacy [`crate::finalize_response`] and [`crate::route_request`]:
//! used in the legacy entry point:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nitpick — Line 1 already states this module is for the EdgeZero entry point, but this line still says "the legacy entry point," which no longer exists after this PR. Small doc-accuracy fix:

Suggested change
//! used in the legacy entry point:
//! used by the `EdgeZero` entry point:

@prk-Jr prk-Jr marked this pull request as draft June 16, 2026 14:26
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.

2 participants