Repository navigation
fix(mattermost): cap outbound and monitor resource caches - #101740
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 8, 2026, 2:33 AM ET / 06:33 UTC. Summary PR surface: Source +61, Tests +50. Total +111 across 5 files. Reproducibility: yes. source-reproducible: current main and v2026.6.11 store Mattermost cache entries in Maps without max-entry pruning. I did not establish a live high-cardinality Mattermost gateway run. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land one coordinated Mattermost cache-cap change that keeps the broad monitor/outbound/opaque coverage, reconciles outbound cap values and tests with #101800, and includes redacted real Mattermost or gateway proof. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main and v2026.6.11 store Mattermost cache entries in Maps without max-entry pruning. I did not establish a live high-cardinality Mattermost gateway run. Is this the best way to solve the issue? Unclear as a landing path: bounding the plugin-local caches with the shared helper is the right code shape, but this branch should reconcile proof, cap values, and outbound tests with the overlapping PR before merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c46e76cff724. Label changesLabel justifications:
Evidence reviewedPR surface: Source +61, Tests +50. Total +111 across 5 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (10 earlier review cycles; latest 8 shown)
|
ca7f7eb to
44b772b
Compare
|
@clawsweeper re-review — branch rebased to single commit on latest main, proof scripts removed from repo, PR body updated with Real behavior proof (Vitest regression output). |
|
🦞🧹 I asked ClawSweeper to review this item again. |
44b772b to
b32fac5
Compare
|
Squashed to a single commit and rebased on latest Test run @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
95aeb01 to
4486068
Compare
|
Maintainer repair complete; this is land-ready. What changed:
Evidence:
Known proof gaps: none blocking. The release-prep changelog owns the central Mattermost memory-bound entry and contributor credit. A live Mattermost server run adds little to this deterministic in-memory bound; eviction returns to the already-tested API-resolution path. Thanks @hugenshen for finding and fixing the remaining Mattermost cache-retention surfaces. |
|
Merged via squash.
|
Co-authored-by: NIO <[email protected]>
What Problem This Solves
Mattermost kept six process-local resource caches without cardinality bounds:
Long-lived gateways that encounter many distinct servers, credentials, channels, or users could therefore retain those entries indefinitely. The opaque-target classifier is no longer part of this PR because #103258 already landed its canonical cap on
main.Why This Change Was Made
The remaining cache owners now use the shared
pruneMapToMaxSizeplugin SDK helper after successful writes:Reads intentionally do not refresh insertion order. A newly resolved write moves that key to the newest position before pruning, which also gives deterministic behavior when concurrent misses resolve out of order. Existing five-minute channel and ten-minute user TTL behavior is unchanged.
User Impact
Mattermost gateways now keep these lookup caches within fixed memory bounds. Eviction is transparent: a later lookup follows the existing API-resolution path and repopulates the entry. Configuration, routing, send behavior, and public plugin APIs are unchanged.
Evidence
Exact repaired head:
4486068b493f2c7289b2b8015ade713d349415f9.Deterministic regressions fill every cache to its cap, prove the oldest entry is evicted, and prove the newest entry remains cached.
Monitor tests cover both channel and user caches and the exact TTL boundary.
Fresh post-rebase Codex autoreview: no accepted or actionable findings, confidence 0.90.
Hosted CI run
29072789577: 43 jobs succeeded and 12 conditional jobs skipped, with no failures.CodeQL Critical Quality run
29072789602: the selected channel-runtime boundary passed.Blacksmith Testbox-through-Crabbox run
29073327959(tbx_01kx5am65jxqh2wswd42ms2cwe): both touched files passed, 2 files / 48 tests.AI-assisted
I understand what the code does
Change is focused and does not mix unrelated concerns