Skip to content

feat(id): wire serve loaded budgets into WorldProtocol (#2247) - #8240

Merged
dezren39 merged 3 commits into
mainfrom
queue/9172-2247-serve-budgets
Nov 10, 2026
Merged

dezren39 merged 3 commits into
mainfrom
queue/9172-2247-serve-budgets

Conversation

@dezren39

@dezren39 dezren39 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Wire the loaded server config's id(comms): budgets — app-wide, per-IP, per-ID, and per-counterparty overrides (P1 of #2032) #2247 budget policy into the production WorldProtocol that id serve registers: cmd_serve now builds the protocol through a new world_protocol_for helper, which passes started.config.budgets().clone() to WorldProtocol::with_budgets when --server-config was given, and keeps with_local_node (coded defaults) when it was not.
  • Before this, the [budgets] table was parsed and held at startup scope (_started_server_config) but never reached the protocol, so configured per-counterparty caps were inert in production. The binding is renamed to started_server_config now that it has a live consumer.

Tests — status (2026-11-10, task 9172, lane code-m)

  • New tests: serve_world_protocol_enforces_configured_budgets (a config with per_peer_bytes_per_hour plus a [[budgets.counterparty]] row produces a protocol whose evaluator carries exactly that policy; the counterparty row replaces the peer's limits via limits_for_peer; a 600-byte charge against the 500-byte window is refused RefusalReason::BudgetExhausted — frame dropped, peer not disconnected) and serve_world_protocol_defaults_budgets_without_config (no config → BudgetPolicy::default()).
  • The new tests have not run yet: the id lib test target does not compile on current main for an unrelated, pre-existing reason — pkgs/id/src/world_store.rs tests use JOURNAL_VERSION_EXECUTION_PROFILE unqualified (E0599, sole error in the build; serve.rs itself compiles with no errors). That break is issue id: lib test does not compile on main - ChainExt initializers missing rotation field (event_store/sync.rs, log_sync.rs) #7081, already owned by task 14503. When it lands: cargo test --manifest-path pkgs/id/Cargo.toml --lib serve_world_protocol and --lib budget, then merge this PR.

Scope per task 9172: no parser or BudgetPolicy semantics changed; #5119 pull-gate/freshness untouched.

Refs #2247 (the config/parser surface landed earlier; this is the serve wiring remainder).

…col (#2247)

The [budgets] table was parsed at startup and held in
_started_server_config, but cmd_serve built the production protocol
with with_local_node, which hard-wires BudgetPolicy::default() — so
configured per-counterparty caps were inert. cmd_serve now builds
the protocol through world_protocol_for, which passes the loaded
config budgets to WorldProtocol::with_budgets when a config was
given and keeps the coded defaults otherwise.

Tests: serve_world_protocol_enforces_configured_budgets (configured
policy incl. a counterparty override reaches the evaluator and an
over-cap charge is refused BudgetExhausted) and
serve_world_protocol_defaults_budgets_without_config. NOTE: the id
lib test target does not compile on current main for an unrelated
reason (world_store.rs tests use JOURNAL_VERSION_EXECUTION_PROFILE
unqualified — #7081, task 14503); cargo check --lib is clean and
serve.rs itself compiles with no errors.
@dezren39
dezren39 requested a review from a team as a code owner November 10, 2026 20:35
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-10T20:35:56.956656Z
We couldn’t complete this review. Comment @codex review to try again.
2c717c4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b2d2716e-1d62-4d6b-932f-18fafce4d3e7
Commits

Reviewing files that changed from the base of the PR and between 6c154d2 and c06163f.

Files selected for processing: 1

  • pkgs/id/src/commands/serve.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…getPolicy; world spawn needs a tokio runtime
@dezren39

Copy link
Copy Markdown
Member Author

Verification update (task 9172, lane code-m): cargo check --manifest-path pkgs/id/Cargo.toml --lib completed clean on this branch (Finished dev profile in 13m 48s; warnings only) — the production wiring compiles. The two new unit tests remain unrun only because the lib test target does not compile on current main (world_store.rs E0599, issue #7081 / task 14503). Task 9172 is parked until that lands; resume = run --lib serve_world_protocol + --lib budget, then merge.

@dezren39
dezren39 merged commit 1f9c97c into main Nov 10, 2026
2 of 7 checks passed
@dezren39
dezren39 deleted the queue/9172-2247-serve-budgets branch November 10, 2026 22:23
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.

1 participant