Skip to content

test(e2e): cover publish CLI chain writes (#1073) - #1273

Merged
thiras merged 5 commits into
mainfrom
test/1073-publish-e2e
Jul 18, 2026
Merged

thiras merged 5 commits into
mainfrom
test/1073-publish-e2e

Conversation

@altanoruc

@altanoruc altanoruc commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add an Anvil-backed e2e journey that drives the real decdn publish namespace create, claim, and assign binary paths
  • assert namespace ownership, namespaceOf claim state, the pending assignment, and the still-empty active origin set
  • expose getPendingAssignment in the e2e binding and make CLI subprocesses async/kill-on-drop so the overall timeout is authoritative

Impact

CI now covers the publish control-plane submit path against the deployed fixture contracts instead of relying only on output-formatting unit tests.

Validation

  • cargo check -p decdn-e2e --features anvil-e2e --test cli_publish
  • cargo clippy -p decdn-e2e --features anvil-e2e --test cli_publish -- -D warnings
  • cargo test -p decdn-cli publish (15 passed)
  • cargo test -p decdn-e2e --lib (3 passed)
  • cargo build -p decdn-node -p decdn-cli
  • cargo fmt -- --check
  • git diff --check

The live Anvil/Forge journey was compile-checked locally; this machine does not have anvil, forge, or cargo-nextest, so CI performs the live execution.

Closes #1073

Summary by CodeRabbit

  • New Features

    • Added support for viewing pending operator assignments, including proposed operators and activation time.
    • Added end-to-end coverage for namespace creation, claims, and operator assignment via the publish CLI.
  • Bug Fixes

    • Improved served-bytes smoke test validation to poll until the expected payload size is reached, then verify exact accounting to catch drift or missing redemptions.
  • Tests

    • Added an anvil-backed CLI publish end-to-end test gated behind the anvil-e2e feature.

@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: 93bbf77c-bd74-44e5-b581-30e567a5ad55

📥 Commits

Reviewing files that changed from the base of the PR and between 117aa45 and 9b53dd9.

📒 Files selected for processing (1)
  • crates/e2e/tests/smoke.rs

Walkthrough

Adds a pending-assignment binding, a gated Anvil-backed decdn publish end-to-end test, and stricter smoke-test polling for complete served-byte redemption.

Changes

Publish CLI end-to-end flow

Layer / File(s) Summary
Pending assignment contract binding
crates/e2e/src/bindings.rs
Adds getPendingAssignment, returning proposed operators and the readyAt deadline.
Publish workflow and chain assertions
crates/e2e/tests/cli_publish.rs
Adds the timed, feature-gated flow for namespace creation, claim submission, assignment proposals, receipt parsing, CLI execution, binary discovery, and on-chain verification.

Redemption accounting validation

Layer / File(s) Summary
Served-bytes polling
crates/e2e/tests/smoke.rs
Polls until served bytes reach the expected payload size, then retains the exact equality assertion.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant E2ETest
  participant DecdnCLI
  participant NodeFixture
  participant PublisherRegistry
  participant OriginAssignment
  E2ETest->>DecdnCLI: Create namespace
  DecdnCLI->>NodeFixture: Submit transaction
  NodeFixture->>PublisherRegistry: Create namespace
  PublisherRegistry-->>E2ETest: Return namespace_id
  E2ETest->>DecdnCLI: Submit claim
  DecdnCLI->>NodeFixture: Submit claim transaction
  E2ETest->>PublisherRegistry: Verify ownership and claim mapping
  E2ETest->>DecdnCLI: Assign operator
  DecdnCLI->>NodeFixture: Submit assignment proposal
  E2ETest->>OriginAssignment: Read pending assignment and active origins
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.73% (was 81.84%, ▼ 0.11%) — 49682/60791 lines

No coverage data for changed Rust files.

History
Commit Total Δ vs base
518e996 81.52% ● 0.00%
117aa45 81.61% ● 0.00%
9b53dd9 (HEAD) 81.73% ▼ 0.11%

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

Copy link
Copy Markdown
Contributor Author

Review — test(e2e): cover publish CLI chain writes (#1073)

Nice, focused e2e. The actual deliverable (the test + the read binding) is solid and, importantly, already green where it counts: CI's anvil e2e job runs cargo nextest run -p decdn-e2e --features anvil-e2e --test-threads 2 with no test filter, so publish_namespace_claim_assign_land_on_chain really did execute against the deployed fixtures and pass — not just compile-check.

What I verified against the source:

  • Binding is exact. getPendingAssignment matches OriginAssignment.sol (returns (address[] memory operators, uint256 readyAt)); the stored uint64 readyAt is implicitly widened to the declared uint256, so the alloy getPendingAssignmentReturn { operators, readyAt } decode is correct.
  • Propose-only semantics captured correctly. assign calls proposeAssignment (not activateAssignment), and the assertion split — non-empty pending.operators + non-zero readyAt vs. still-empty getOrigins — is exactly the right way to prove the write landed without bypassing the governance timelock.
  • Receipt parsing is robust. parse_namespace_id taking the last non-empty stdout line and requiring submitted == true lines up with write_namespace_outcome ("submitted": o.tx.is_some()); by default namespace create submits (only --dry-run skips), so the assertion holds.
  • kill_on_drop(true) + async Command + outer tokio::time::timeout making the overall budget authoritative is a real improvement over the synchronous slash_appeal.rs precedent it otherwise mirrors.

⚠️ Blocker: CI is red solely because of the two planning docs, not the code

markdownlint fails (and drags down the CI success gate) with 7× MD032/blanks-around-lists, all in docs/superpowers/plans/2026-07-17-issue-1073-publish-cli-e2e.md (lines 25, 29, 59, 63, 92, 95, 163) — the **Files:** / **Interfaces:** bold labels sit directly on top of a - list with no blank line between.

My recommendation is to drop both docs/superpowers/ files from this PR rather than lint-fix them:

  • The docs/superpowers/ directory doesn't exist on main — this PR would introduce it.
  • They're per-PR agent-workflow scaffolding (an implementation plan + design spec for this change), not project documentation. The plan also carries process meta-commentary — REQUIRED SUB-SKILL: superpowers:subagent-driven-development, "Preserve Claude's inherited edits… the user explicitly waived…" — that doesn't really belong in the tree.
  • Removing them keeps the PR to its actual deliverable (test + binding) and turns CI green with zero code changes.

If the team does want design docs checked in, then instead: add a blank line between each **Label:** line and the list under it (the 7 flagged spots) so MD032 passes, and consider adding docs/superpowers/** to the markdownlint ignore globs alongside .github/agents/**.

Everything else LGTM — once CI is green this looks good to merge.

Coverage stayed flat (81.52%) because the new lines are all behind the anvil-e2e feature, which the coverage job doesn't build — expected for this kind of gated e2e.


Generated by Claude Code

claude and others added 2 commits July 18, 2026 07:58
The docs/superpowers/ plan and design files were per-PR agent-workflow
scaffolding rather than project documentation, and were the sole cause of
the markdownlint (MD032/blanks-around-lists) CI failure. Removing them
keeps the PR to its actual deliverable -- the publish-CLI e2e test and the
getPendingAssignment binding -- and turns CI green with no code changes.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AcyKTsWWEM4hdSWiVGWBKq
The smoke test's served-bytes cross-layer check polled until the on-chain
counter advanced past zero, then asserted it equalled the 2 MiB payload.
But the paid client pays a cumulative voucher at each `voucher_interval_mb`
boundary plus a closing voucher, so a multi-interval payload is redeemed
on-chain in more than one step. Served-bytes is briefly observable at an
intermediate boundary (1 MiB) before it climbs to the 2 MiB total, and
under CI load the poll caught that intermediate value and failed the exact
-equality assertion (left: 1048576, right: 2097152).

Poll until served-bytes *reaches* the expected total instead of merely
past zero, then keep the exact-equality assertion so accounting drift that
overshoots the payload size is still caught. Correct the stale comment that
claimed a single-blob fetch redeems exactly one cumulative voucher.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-actions

Copy link
Copy Markdown

Contracts coverage

Line coverage: 88.95% (2495/2805 lines)
▲ +0.00pp vs base (88.95% → 88.95%)
Run: 29664953555

@thiras
thiras merged commit 0c92aed into main Jul 18, 2026
23 checks passed
@thiras
thiras deleted the test/1073-publish-e2e branch July 18, 2026 23: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.

test(e2e): drive decdn publish (namespace/claim/assign) against the anvil fixture

3 participants