Skip to content

docs: fix ARCHITECTURE.md drift — rate limiting, limits, pipeline, counts - #4336

Open
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:docs/4210-architecture-drift
Open

docs: fix ARCHITECTURE.md drift — rate limiting, limits, pipeline, counts#4336
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:docs/4210-architecture-drift

Conversation

@iroiro147

Copy link
Copy Markdown
Contributor

Summary

Fixes multiple categories of documentation drift in ARCHITECTURE.md identified in #4210. Every claim was verified against the current codebase before editing.

Changes

1. Rate limiting — doc stated the opposite of the code

The doc claimed "No Redis-backed rate limiter exists anywhere in the codebase — rate limiting is not currently enforced." The code has a Redis-backed limiter wired and enforced:

  • crates/buzz-pubsub/src/rate_limiter.rsRedisRateLimiter
  • crates/buzz-relay/src/state.rs:584,713 — wired as admission_rate_limiter
  • crates/buzz-relay/src/connection.rs:615,638 — enforced on WS connect + per-message
  • crates/buzz-relay/src/api/bridge.rs:30 — enforced on the HTTP bridge

Fixed: Updated the buzz-auth "Does NOT" section, the buzz-pubsub section, and Known Limitations row #2 to accurately describe the enforcement surface.

2. Client-facing limits were stale

Limit Doc (old) Code (actual)
MAX_FRAME_BYTES 65,536 524,288 (512 KiB)
DEFAULT_MAX_PAGE_LIMIT 500 1,000
NIP-11 max_content_len (undocumented) 65,536 (clarified as separate value)

Fixed: All three occurrences in the doc (summary line, env var table, security table) plus the historical query cap description.

3. Search pipeline description stale

  • The search_index_tx bounded worker queue no longer exists — FTS is a generated search_tsv column populated by the DB insert itself (comment at crates/buzz-relay/src/handlers/event.rs:502-506).
  • The privacy exclusion list changed: migrations/0001 had 5 kinds (1059, 30300, 30622, 44100, 44101); migrations/0008_fresh_install_search_allowlist.sql flips fresh installs to a positive allowlist (kind IN (0, 9, 40002, 45001, 45003)).
  • Pipeline steps 8-9 and 11-12 now run inside a spawned task (dispatch_persistent_event).

Fixed: Updated pipeline step 10, the fire-and-forget description, the state struct snippet, and the privacy exclusion description.

4. Stale counts

Count Doc (old) Code (actual)
ALL_KINDS (§2) 127 129
ALL_KINDS (§6) 80 129
relay.rs LOC 3,143 ~6,200
main.rs LOC 2,457 3 (now a shim; logic in lib.rs ~6,700)
e2e e2e_relay.rs tests 27 ~54
e2e total 134 stale (files moved to buzz-test-client)

Fixed: Updated all counts; added approximate qualifier and note about main.rs → lib.rs split and e2e file relocation. Per the reporter's suggestion, exact LOC/test numbers are now marked approximate.

Verification

  • All code references verified against current main (28ae6cd).
  • Docs-only change — no compilation or tests affected.

Closes #4210.

…unts

Addresses block#4210. Four categories of drift corrected:

1. Rate limiting claim inverted: doc said "no rate limiter exists"
   but code has RedisRateLimiter wired and enforced on WS connect,
   per-message, and HTTP bridge (buzz-pubsub + buzz-relay).

2. Stale client-facing limits: MAX_FRAME_BYTES is 524,288 (512 KiB)
   not 65,536; DEFAULT_MAX_PAGE_LIMIT is 1,000 not 500. Clarified
   that NIP-11 max_content_len (65,536) is a separate value.

3. Search pipeline description stale: search_index_tx mpsc no longer
   exists — FTS is a generated search_tsv column populated by the
   DB insert itself. Updated pipeline steps and state struct.
   Privacy exclusion list now documents both the original 0001
   exclusion (1059, 30300, 30622, 44100, 44101) and the 0008
   fresh-install positive allowlist (0, 9, 40002, 45001, 45003).

4. Stale counts: ALL_KINDS is 129 not 127; buzz-acp LOC table ~2x
   off (main.rs is now a 3-line shim, logic in lib.rs); e2e tests
   moved to buzz-test-client crate with different counts.

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
@iroiro147
iroiro147 requested a review from a team as a code owner August 2, 2026 14:36
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.

ARCHITECTURE.md drift: rate-limiting claim inverted, stale limits and pipeline description

1 participant