fix(msteams): bound team group lookup cache#102814
Conversation
Co-authored-by: sunlit-deng <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 9:16 AM ET / 13:16 UTC. Summary PR surface: Source +4, Tests +31. Total +35 across 2 files. Reproducibility: yes. at source level: drive current main Review metrics: none identified. Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this focused cache cap after a current-main refresh and exact-head checks, then close the superseded source PR with contributor credit preserved. Do we have a high-confidence way to reproduce the issue? Yes, at source level: drive current main Is this the best way to solve the issue? Yes. Pruning the existing Map immediately after successful insertion with the shared helper is narrower than adding local LRU logic or a config knob, and it preserves cache hit, miss, TTL, and fallback behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3fd52514e35f. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +4, Tests +31. Total +35 across 2 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
|
|
Land-ready maintainer proof:
This is the clean current-main replacement for #101964; |
|
Merged via squash.
|
Co-authored-by: sunlit-deng <[email protected]>
What Problem This Solves
Microsoft Teams team/group lookups accumulated one cache entry per distinct lookup until TTL expiry. High-cardinality or adversarial traffic could therefore grow the process-local map without a hard bound.
This is a maintainer-owned replacement for #101964. GitHub's signed fork-update API rejected the rebased contributor branch because the stale fork-to-main tree payload exceeded its 45 MB limit.
Why This Change Was Made
Cap the existing TTL cache at 500 entries with the shared
pruneMapToMaxSizehelper after every successful insertion. The behavior stays single-path: cached hits, misses, null fallbacks, and TTL semantics are unchanged; only the oldest excess entries are removed.The regression exercises the real
resolveTeamGroupIdpath through 501 distinct successful lookups, proves the cache remains at 500, confirms the oldest entry is evicted, and verifies a later lookup fetches and reinserts it. The patch is preserved as one maintainer commit withsunlit-dengas co-author.User Impact
Long-running Teams gateways now keep this lookup cache bounded instead of retaining an arbitrary number of tenant/team combinations until expiry.
Evidence
oxfmt --checkpassed for both touched files.git diff --check origin/main...HEADpassed.Supersedes #101964 while preserving contributor credit.