Skip to content

test(e2e): cover default-open origin journey - #1278

Merged
thiras merged 3 commits into
mainfrom
test/1043-default-open-e2e
Jul 18, 2026
Merged

thiras merged 3 commits into
mainfrom
test/1043-default-open-e2e

Conversation

@altanoruc

@altanoruc altanoruc commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add a default-open E2E journey that acquires an unclaimed blob from namespace zero
  • migrate the blob to a namespace after the claim timelock and assert canonical directory resolution inputs
  • prove the verified local cache still serves the blob without consulting either origin after migration

Validation

  • TDD red: the feature target initially failed with 13 missing fixture helper errors
  • cargo test -p decdn-e2e — 3 passed, 0 failed
  • cargo test -p decdn-e2e --features anvil-e2e --test g_origin_04_default_open --no-run — passed
  • cargo clippy -p decdn-e2e --features anvil-e2e --test g_origin_04_default_open -- -D warnings — passed
  • cargo fmt --all -- --check — passed
  • git diff --check — passed
  • GitHub CI — full matrix passed, including broad Rust tests and live Anvil E2E

Notes

  • The live Anvil journey was not runnable locally because the sandbox denied TcpListener::bind with Operation not permitted; the authoritative CI Anvil job passed.

Closes #1043

Summary by CodeRabbit

  • New Features

    • Added support for configuring pull-through cache nodes with discovery peers.
    • Added governance and publisher-namespace operations, including origin authorization, content claims, assignment proposals, and timelock activation.
    • Paid content fetches now include signed client binding information.
  • Bug Fixes

    • Preserved cached content serving when migrating content from default-open origins to assigned namespaces.
  • Tests

    • Added end-to-end coverage for default-open origin migration and continued cached serving.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: e93cb47e-773c-4f13-bf32-5a31e2012f8c

📥 Commits

Reviewing files that changed from the base of the PR and between c574ef9 and 1da7448.

📒 Files selected for processing (5)
  • crates/e2e/src/bindings.rs
  • crates/e2e/src/chain.rs
  • crates/e2e/src/client.rs
  • crates/e2e/src/node.rs
  • crates/e2e/tests/g_origin_04_default_open.rs

Walkthrough

The E2E fixtures now support origin assignment governance, pull-through cache discovery, signed client bindings, and timelocked assignment activation. A new gated test validates cached content after migration from the default-open origin set to an assigned namespace.

Changes

Default-open origin migration

Layer / File(s) Summary
Origin assignment helpers
crates/e2e/src/bindings.rs, crates/e2e/src/chain.rs
Adds OriginAssignment bindings and ChainFixture helpers for origin queries, content claims, assignment proposals, and timelock activation.
Pull-through cache configuration
crates/e2e/src/node.rs
Adds pull-through cache launching, authorized-origin settings, discovery peer TOML rendering, and matching renderer assertions.
Signed client fetch context
crates/e2e/src/client.rs
Signs and attaches a client binding to ChannelContext before tracked paid fetches.
Default-open migration scenario
crates/e2e/tests/g_origin_04_default_open.rs
Adds G-ORIGIN-04 coverage for caching, settlement, namespace migration, authorization changes, and unchanged delivery counters on cached re-serving.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GOriginTest
  participant NodeFixture
  participant ClientFixture
  participant ChainFixture
  participant FeeRouter
  GOriginTest->>NodeFixture: launch default-open origin and pull-through cache
  GOriginTest->>ClientFixture: fetch content and retain cached bytes
  GOriginTest->>ChainFixture: claim content and activate namespace assignment
  ChainFixture->>FeeRouter: read bytesPerEpoch baselines
  GOriginTest->>ClientFixture: re-fetch cached content
  GOriginTest->>FeeRouter: verify delivery counters remain unchanged
Loading

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 17, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 81.34% (was 81.49%, ▼ 0.16%) — 48623/59781 lines

File Coverage Lines Δ
crates/e2e/src/chain.rs 1.29% 11/853 ▼ 0.17%
crates/e2e/src/client.rs 0.00% 0/158 ● 0.00%
crates/e2e/src/node.rs 22.22% 68/306 ▲ +2.92%
History
Commit Total Δ vs base
ea9e673 81.32% ▼ 0.18%
7812eb4 81.32% ▼ 0.18%
1da7448 (HEAD) 81.34% ▼ 0.16%

@altanoruc
altanoruc marked this pull request as ready for review July 18, 2026 04:24

Copy link
Copy Markdown
Contributor Author

Review — G-ORIGIN-04 default-open migration E2E

Test-only PR (+383/−15, 5 files, no production code touched). Adds the OriginAssignment governance/publisher fixture surface and a gated journey proving a cached blob keeps serving locally after its hash migrates from the default-open origin set to an assigned namespace. LGTM — clean and well-reasoned; only minor nits below.

What it does

  • bindings/chain: assignmentTimelock + addDefaultOpenOperator on the OriginAssignment binding, plus 7 ChainFixture helpers (origins, content_namespaces, is_authorized_origin, claim_content, propose_assignment, activate_assignment_after_timelock, add_default_open_operator).
  • node: launch_pull_through_cache + launch_configured, rendering node_to_node_pull_through_enabled / pull_through_require_authorized_origin and [network.discovery.peers.<id>] entries.
  • client: attaches a signed client binding to ChannelContext before the paid fetch.
  • test: G-ORIGIN-04 — acquire via pull-through from default-open A → claim+assign the hash to B after the timelock → re-fetch and assert neither A nor B gains a delivery.

Strengths

  • New chain helpers faithfully mirror existing patterns: impersonate + raw_provider + .from(timelock) for governance calls, provider_for(owner) for owner txns, ensure_mined wrapping, .context() on every await.
  • Config keys verified against the real schema in crates/common — not silently-ignored keys — and the render_config unit test asserts they parse (deny_unknown_fields would have caught a typo).
  • Client-binding fix is correct: binds the client's own endpoint NodeId under the (chain_id, capacity_bond) domain, exactly as sign_client_binding documents. This is the ADR 005 binding whose absence (client_binding: None) previously blocked reactive origin pulls — the old node.rs comment called that out.
  • The migration assertion is genuinely discriminating: after the claim, A is de-authorized for the hash and B becomes the authorized origin, so a cache re-pull would increment B's bytesPerEpoch. Asserting that neither A nor B moves therefore proves the bytes were served from local cache, not re-fetched — a weaker "bytes match" check wouldn't distinguish the two.
  • Flake defenses are deliberate: baseline_epoch is pinned once and both before/after reads target that fixed epoch bucket (robust to an epoch boundary crossing mid-fetch); wait_for_origin_settlement reads on-chain withdrawnAmount directly rather than trusting the settlement_eligible upper-bound flag, making the baseline deterministic.
  • Conventions consistent with slash_appeal.rs (cfg gate, allow-list, MIB, OVERALL_TIMEOUT, single run()).
  • CI fully green, including the anvil e2e job (~12 min) — the gated journey actually executed end-to-end, not just compiled.

Minor suggestions (non-blocking)

  1. Implicit funding coupling — claim_content and propose_assignment call provider_for(owner) without fund_eth, unlike create_namespace which funds the owner. They only work because the journey always runs create_namespace (which funds) first. A one-line fund_eth in each, or a doc note that they assume a funded owner, would make them safe to reuse standalone.
  2. Duplicated EPOCH_LENGTH_SECS — also defined privately in chain.rs. The test inlines the raw bytesPerEpoch(op, epoch) call because the existing served_bytes helper recomputes the epoch from head each call (which would defeat the pinned-epoch comparison), so this is reasonable — but a chain.bytes_per_epoch_at(op, epoch) helper would remove the constant duplication.
  3. Discovery-peer render hardcodes 127.0.0.1:{port} while the tuple only carries (PublicKey, u16). Fine for a localhost fixture; just baking in the localhost assumption.
  4. Coverage −0.16% is the expected artifact of E2E fixture code (chain.rs/client.rs) not being exercised under the unit-coverage job — the anvil e2e job covers it. Not a real gap.

Risk

Contained to test infrastructure; no runtime code changed. Anvil/E2E tests are inherently heavier and load-sensitive, but the 900s overall / 90s settlement budgets look adequately padded and the pinned-epoch + settlement-wait designs specifically target the two most likely flake sources.


Generated by Claude Code

@thiras
thiras merged commit 893b0ed into main Jul 18, 2026
23 checks passed
@thiras
thiras deleted the test/1043-default-open-e2e branch July 18, 2026 20:28
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.

e2e G-ORIGIN-04: default-open serve path

2 participants