Warn when the membership walk stops at its page cap #427

Merged
robbertbos merged 1 commit from mm-membership-cap-warning into main 2026-09-24 19:58:21 +00:00
Owner

Closes #402. When list_my_channel_memberships reaches its cap of 50 pages of 200, it now asks for one page more (page 50) and logs mm_memberships_truncated (with pages and memberships) only if that page holds memberships it has not seen yet. The rows of that page stay out of the result, so the cap still bounds what is returned. A walk that ends exactly on 10,000 memberships, or a server that serves repeats past the cap, stays silent; a short page or a page with nothing new stops the walk before the cap and never makes the extra request. The page fetch moved into _membership_page so the extra request shares the 401/4xx handling.

Tests: the cap test asserts the warning and 51 requests; a parametrized test covers ending exactly on the cap (empty page and only-repeats page after it); a normal multi-page walk logs nothing. mattermost.py had no logger yet; it gets a structlog one, like most modules. The line carries request_id through the middleware, which links it to the request line with the pseudonymous user id.

No CHANGELOG entry: an ops log line, nothing a user sees.

Closes #402. When `list_my_channel_memberships` reaches its cap of 50 pages of 200, it now asks for one page more (page 50) and logs `mm_memberships_truncated` (with `pages` and `memberships`) only if that page holds memberships it has not seen yet. The rows of that page stay out of the result, so the cap still bounds what is returned. A walk that ends exactly on 10,000 memberships, or a server that serves repeats past the cap, stays silent; a short page or a page with nothing new stops the walk before the cap and never makes the extra request. The page fetch moved into `_membership_page` so the extra request shares the 401/4xx handling. Tests: the cap test asserts the warning and 51 requests; a parametrized test covers ending exactly on the cap (empty page and only-repeats page after it); a normal multi-page walk logs nothing. `mattermost.py` had no logger yet; it gets a structlog one, like most modules. The line carries `request_id` through the middleware, which links it to the request line with the pseudonymous user id. No CHANGELOG entry: an ops log line, nothing a user sees.
Warn when the membership walk stops at its page cap
All checks were successful
CI / release-scripts (pull_request) Successful in 12s
security-scan / SBOM (trivy) (pull_request) Successful in 14s
security-scan / Python SAST (bandit) (pull_request) Successful in 30s
security-scan / JS SCA (npm audit) (pull_request) Successful in 35s
security-scan / Filesystem scan (trivy fs) (pull_request) Successful in 31s
security-scan / Python SCA (pip-audit) (pull_request) Successful in 50s
CI / pre-commit (pull_request) Successful in 2m2s
test-build / build (frontend) (pull_request) Successful in 1m35s
test-build / build (backend) (pull_request) Successful in 1m59s
test-build / build (pull_request) Successful in 0s
CI / backend-test (pull_request) Successful in 7m13s
CI / e2e (pull_request) Successful in 15m31s
CI / frontend-test (pull_request) Successful in 1m2s
f880a0e7c7
list_my_channel_memberships stops after 50 pages of 200. Past 10,000
memberships it dropped the rest without a word: an incomplete Postvak
and no error anywhere. The walk now logs mm_memberships_truncated when
it leaves on the cap rather than on a short or repeated page.
robbertbos scheduled this pull request to auto merge when all checks succeed 2026-09-23 21:56:59 +00:00
robbertbos force-pushed mm-membership-cap-warning from f880a0e7c7
All checks were successful
CI / release-scripts (pull_request) Successful in 12s
security-scan / SBOM (trivy) (pull_request) Successful in 14s
security-scan / Python SAST (bandit) (pull_request) Successful in 30s
security-scan / JS SCA (npm audit) (pull_request) Successful in 35s
security-scan / Filesystem scan (trivy fs) (pull_request) Successful in 31s
security-scan / Python SCA (pip-audit) (pull_request) Successful in 50s
CI / pre-commit (pull_request) Successful in 2m2s
test-build / build (frontend) (pull_request) Successful in 1m35s
test-build / build (backend) (pull_request) Successful in 1m59s
test-build / build (pull_request) Successful in 0s
CI / backend-test (pull_request) Successful in 7m13s
CI / e2e (pull_request) Successful in 15m31s
CI / frontend-test (pull_request) Successful in 1m2s
to 22f8f7edef
Some checks failed
CI / release-scripts (pull_request) Successful in 8s
security-scan / SBOM (trivy) (pull_request) Successful in 9s
security-scan / JS SCA (npm audit) (pull_request) Successful in 14s
security-scan / Filesystem scan (trivy fs) (pull_request) Successful in 23s
security-scan / Python SAST (bandit) (pull_request) Successful in 24s
security-scan / Python SCA (pip-audit) (pull_request) Successful in 43s
CI / frontend-test (pull_request) Successful in 1m15s
test-build / build (frontend) (pull_request) Successful in 1m19s
test-build / build (backend) (pull_request) Successful in 1m27s
test-build / build (pull_request) Successful in 0s
CI / pre-commit (pull_request) Successful in 1m47s
CI / backend-test (pull_request) Successful in 3m15s
CI / e2e (pull_request) Has been cancelled
2026-09-24 19:47:17 +00:00
Compare
robbertbos force-pushed mm-membership-cap-warning from 22f8f7edef
Some checks failed
CI / release-scripts (pull_request) Successful in 8s
security-scan / SBOM (trivy) (pull_request) Successful in 9s
security-scan / JS SCA (npm audit) (pull_request) Successful in 14s
security-scan / Filesystem scan (trivy fs) (pull_request) Successful in 23s
security-scan / Python SAST (bandit) (pull_request) Successful in 24s
security-scan / Python SCA (pip-audit) (pull_request) Successful in 43s
CI / frontend-test (pull_request) Successful in 1m15s
test-build / build (frontend) (pull_request) Successful in 1m19s
test-build / build (backend) (pull_request) Successful in 1m27s
test-build / build (pull_request) Successful in 0s
CI / pre-commit (pull_request) Successful in 1m47s
CI / backend-test (pull_request) Successful in 3m15s
CI / e2e (pull_request) Has been cancelled
to 78b745c63b
All checks were successful
security-scan / SBOM (trivy) (pull_request) Successful in 16s
CI / release-scripts (pull_request) Successful in 16s
security-scan / Filesystem scan (trivy fs) (pull_request) Successful in 21s
security-scan / JS SCA (npm audit) (pull_request) Successful in 22s
security-scan / Python SAST (bandit) (pull_request) Successful in 27s
security-scan / Python SCA (pip-audit) (pull_request) Successful in 45s
CI / pre-commit (pull_request) Successful in 1m13s
test-build / build (frontend) (pull_request) Successful in 1m14s
CI / frontend-test (pull_request) Successful in 1m18s
test-build / build (backend) (pull_request) Successful in 1m18s
test-build / build (pull_request) Successful in 0s
CI / backend-test (pull_request) Successful in 3m10s
CI / e2e (pull_request) Successful in 5m15s
tag-release / release (push) Successful in 7s
publish-and-stage / decide (push) Successful in 8s
publish-and-stage / build (frontend) (push) Has been skipped
publish-and-stage / build (backend) (push) Has been skipped
publish-and-stage / build (push) Successful in 0s
publish-and-stage / deploy-staging (push) Has been skipped
CI / release-scripts (push) Successful in 12s
security-scan / SBOM (trivy) (push) Successful in 12s
security-scan / Filesystem scan (trivy fs) (push) Successful in 15s
security-scan / JS SCA (npm audit) (push) Successful in 16s
security-scan / Python SAST (bandit) (push) Successful in 20s
security-scan / Python SCA (pip-audit) (push) Successful in 42s
CI / pre-commit (push) Successful in 57s
CI / frontend-test (push) Successful in 57s
CI / backend-test (push) Successful in 2m52s
CI / e2e (push) Successful in 4m52s
2026-09-24 19:53:03 +00:00
Compare
robbertbos deleted branch mm-membership-cap-warning 2026-09-24 19:58:21 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
robbertbos/waggle!427
No description provided.