fix(msteams): cap team-group-id cache with pruneMapToMaxSize#101964
fix(msteams): cap team-group-id cache with pruneMapToMaxSize#101964sunlit-deng wants to merge 3 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 8, 2026, 8:15 AM ET / 12:15 UTC. Summary PR surface: Source +3, Tests +24. Total +27 across 2 files. Reproducibility: yes. Source inspection shows current main stores distinct successful Teams Graph lookups in a TTL-only Map, and the PR test/proof exercises the 501-entry overflow path. Review metrics: none identified. 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:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused cache cap after a branch refresh confirms exact-head CI and mergeability. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main stores distinct successful Teams Graph lookups in a TTL-only Map, and the PR test/proof exercises the 501-entry overflow path. Is this the best way to solve the issue? Yes. Pruning immediately after successful cache insertion with the existing SDK helper is the narrow maintainable fix and avoids duplicating local LRU code or adding configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4bf70be01a21. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +3, Tests +24. Total +27 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
Review history (13 earlier review cycles; latest 8 shown)
|
ac886fd to
9ea8b96
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
9ea8b96 to
97b9c8c
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
97b9c8c to
0b00562
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
0b00562 to
4fc07a4
Compare
4fc07a4 to
a24f15d
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…upId Exercises the real resolveTeamGroupId with 501 unique team IDs, proving pruneMapToMaxSize caps at 500 and evicts oldest by insertion order. Negative control confirms raw Map would grow to 501 without the cap.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
2 similar comments
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
Landed the reviewed fix as #102814 in commit f6b9901. The original fork branch could not be refreshed safely: GitHub's signed Thank you @sunlit-deng for the fix and regression coverage. |
Thanks Peter, appreciate you landing this and preserving the co-author credit. I’ve refreshed my other open PR branches and kept maintainer edits enabled. |
What Problem This Solves
The
teamGroupIdCacheMap inresolveTeamGroupIdhad TTL-based expiry (10 min) but no size cap. A large Teams workspace with many distinct team IDs could accumulate entries faster than the TTL window, allowing unbounded growth.Why This Change Was Made
Added a 500-entry cap via
pruneMapToMaxSize— the shared SDK helper already used by 11 other files. The cap is applied after each successful cache insert.User Impact
No change for normal usage. Memory usage bounded at ~500 entries regardless of workspace size.
Evidence
Real-path proof — exercises the full
resolveTeamGroupId→fetch→fetchGraphJson→.set()→pruneMapToMaxSizeproduction pipeline withtsx(mocks onlyglobalThis.fetch, everything else is production code):resolveTeamGroupIdgoes through productionfetch→fetchGraphJson→setpathpruneMapToMaxSizeline atgraph-thread.ts:89→ oldest evictedresolveTeamGroupId: cache stays at 500groupIdwithout Graph fetchproof-live.ts
Vitest — 27/27 passed including cache cap regression:
AI-assisted: built with Codex