Skip to content

orb(federated): the documented peer rate limit is inert at every real call site, push mode is a no-op configuration, and the ingest comments still claim a fail-open that #9046 removed #9166

Description

@JSONbored

Problem

Two dead-code/documentation defects in the federated collector that mislead an operator about what is
actually running.

1. The rate limiter is inert at every real call site

RATE_LIMIT = { limit: 6, windowMs: 60_000 } (src/orb/federated-collector.ts:40) is documented as "a
best-effort background sync has no business hammering a peer's collector"
. But rateLimitAllows opens
with if (!opts.bucket) return true; (:78-81) and bucket is caller-owned.

The only production caller is buildFederatedBenchmark, which forwards opts straight through from
src/api/routes.ts:1716, where the object is { now, timeoutMs: 5_000, maxAttempts: 1 }no bucket.
A repo-wide grep for bucket: finds it exclusively in test/unit/federated-collector.test.ts.

So the documented abuse protection is inert at 100% of real call sites. With the feature enabled, every
maintainer dashboard refresh issues an unthrottled GET at the peer collector — N maintainers hitting
refresh is N requests/second, not 6/minute.

Fix: hold a module-level LocalRateBucket inside federated-collector.ts and default to it, rather
than making the limiter opt-in from the caller.

2. collectorMode: "push" is a configuration that does nothing

pushFederatedBundle has zero production callers — only test/unit/federated-collector.test.ts. And
resolveCollectorEndpoint(m, "pull") returns null for a push-configured manifest. So an operator who
configures push-only gets a silently no-op feature with no warning anywhere.

Fix: wire pushFederatedBundle into the export tick, or delete it along with the push/both modes
and reject those values in manifest validation.

3. Stale comments contradict the post-#9046 code

src/api/routes.ts:4399-4400 and :6608-6610 still describe the ingest gate as "unset ⇒ OPEN ingress /
FAIL-OPEN by default"
. isAuthorizedIngest two lines below now begins if (!configuredToken) return false;. A reader auditing the auth posture from the comments reaches the opposite conclusion from the
code.

Impact

Low individually, but this is the class that produced #9049 and #9040 — a control that reads as configured
and does nothing, plus comments that actively mislead the next auditor. Worth clearing while the
federated feature is still inert and the change is free.

Requirements

As above, per part. Add a test asserting the rate limiter engages with no caller-supplied bucket, and
delete or wire the push path rather than leaving it half-present.

Test Coverage Requirements

99%+ patch coverage, branch-counted; both arms of the default-bucket path.

Links & Resources

maintainer-only — dead controls and doc accuracy.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions