Repository navigation
refactor(msteams): consolidate Graph upload test fixtures - #118268
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 6:36 PM ET / 22:36 UTC. ClawSweeper reviewWhat this changesThis PR consolidates repeated Microsoft Graph mock routes, token setup, and upload invocation code in the Microsoft Teams Graph-upload test suite without changing production code. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 2 items remain Keep this PR open for normal maintainer review. Current main still has the pre-refactor 800-line Graph-upload test file, while this branch consolidates only its fixtures into 620 lines; the tested production upload path and its callers are unchanged. The patch is a sound cleanup on source review, but the supplied evidence is test/CI-only and several exact-head checks were still running. Priority: P3 Review scores
Verification
How this fits togetherMicrosoft Teams group-chat and channel file sends call the SharePoint upload flow, which acquires a Graph token, uploads content, optionally resolves members, and creates a sharing link. The changed test file supplies mocked Graph responses and asserts those upload, timeout, and sharing behaviors. flowchart LR
A[Teams attachment send] --> B[SharePoint upload flow]
B --> C[Graph token and upload request]
C --> D[Member lookup and sharing link]
E[Graph-upload test fixtures] --> F[Mocked Graph responses]
F --> G[Upload and timeout assertions]
G --> B
Before merge
Agent review detailsSecurityNone. PR surfaceTests -180. Total -180 across 1 file. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge after the exact-head test/CI evidence is complete and a maintainer accepts the test-only proof posture; retain the local helpers because they consolidate repeated setup without changing the SharePoint upload contract. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is a test-only refactor, not a report of broken runtime behavior. Source comparison does show a high-confidence review path because current main retains the pre-refactor test file. Is this the best way to solve the issue? Yes. The branch removes repeated test setup at the fixture layer while preserving all 21 named cases and leaving the Graph-upload implementation and its Teams callers untouched; duplicating helpers per case would retain the maintenance burden. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 474c4e671e9f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
The Microsoft Teams Graph-upload tests repeated route, authentication, upload, and timeout setup across nearly every case. That repetition obscured the behavior each case protects and made fixture maintenance needlessly error-prone.
This is a maintainer-requested code-cleanup lane toward the repository-wide LOC-reduction goal.
Why This Change Was Made
The suite now builds its Graph responses, fixed and aborting routes, upload calls, and private-recipient setup through small canonical test helpers. Production code and behavior are unchanged; all 21 test declarations and the full ordered assertion trace remain identical.
User Impact
No user-visible impact. This test-only refactor removes 180 net lines while retaining coverage for Graph authentication, filename conflict handling, upload limits, response bounds, sharing scopes, and abort deadlines.
Evidence
+167/-347, net -180 test LOC; production delta 0.extensions/msteams/src/graph-upload.test.ts— 21/21 passed.pnpm check:changed: passed.git diff --checkandoxfmt --check: passed.02ea76aff2cb50581392048031d580230355c26ad38e8f0be3c235c9bb30253cbefore and after.