Skip to content

refactor(msteams): exercise real attachment and ingress owners - #156393

Open
vincentkoc wants to merge 13 commits into
mainfrom
test/msteams-suite-cleanup-20260923
Open

vincentkoc wants to merge 13 commits into
mainfrom
test/msteams-suite-cleanup-20260923

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Teams tests duplicated parts of the inbound runner and attachment policy, while the test isolation guard treated SQLite file URIs as literal paths.

User Impact

No user-visible production change. This strengthens internal tests and private test support; production LOC delta is zero. The published correction passed the test-line budget. Its required CI gate failed on the Feishu storage-error test.

Why This Change Was Made

The fixtures now use the real public inbound runner and isolated session persistence, with dispatch injected at its existing per-turn boundary. Cleanup joins session work and canonical SQLite cleanup before deleting owned roots, while explicit runtime-config reload snapshots remain intact.

Attachment checks assert ordered saved results and adapter forwarding without duplicating media policy or replacing the existing real SharePoint storage path. The SQLite guard checks NUL before canonical decoding and retains physical containment and original opener arguments. Superseded suites and the retired SQLite coordinator remain removed.

The earlier correction at f7a21e31e0976f3ea1de083cede24f7965fd8200 used frozen base 91d08c31d14cd85be17e5ecb4d8a0ec075ef53bb. It changed 15 test and private-support source files (+500/−197 lines) and the test-line allocation.

Evidence

Published correction

Signed 069eba71 integrates main 179a01b0. The correction preserves the real exports in both partial mocks and updates the state-path guard test to spy on the helper’s current module. Independent source review confirmed the Teams account and reload assertions and all four private SQLite exports survived integration.

  • All 128 cases in the ten changed suites passed. Six adjacent suites passed all 49 cases, for 177 total.
  • The native test-line budget passed using the original 291-line allocation. The mock-export and line-cap checks, scoped formatting and lint, the selected core test type shards, and the extension test type project passed.
  • The dependency and export scans exited 1. They identified four exports in users-role.ts and restart-sentinel-store.ts; both files match the selected main. The unused-file command also exited 1. Its production scan reported zero entries. Its full-tree scan identified scripts/tool-operations.ts, which is byte-identical to the selected main. The merged Knip input correction registers the CLI that generates the Swift catalog.
  • The hosted CI run completed with 56 successful jobs and 27 skips. The Feishu shard passed 183 of 184 cases. Its failing storage-error test expected zero stream iterator calls and saw one. A separate run of that test on this exact commit reproduced the failure. The entire Feishu source tree matches selected main and the failure was previously reproduced on main. The baseline ratchets passed. The required aggregate check is red. The native review finding remains open.
  • Main subsequently updated the Feishu storage-error expectation. The same named test passed on that change. The published Teams head 069eba71 predates the fix, so a refreshed Teams revision still needs its own required CI. Feishu fix · Passing storage-error case

Earlier revisions

  • Behavioral proof: e9275a6 passed 181/181 cases across 16 modules with native --maxWorkers=1, zero filtered cases or unhandled/module errors. Both test invocations and the separate report merge completed, with all native process groups joined.
  • Unchanged guard proof: f57774c passed 11/11 URI/containment cases. This earlier receipt is reused; those cases were not rerun on D or E.
  • Final static checks: E passed repaired-path Oxlint and the full plugin-test type lane. Passing D core lint/core types/core-test types/plugin production types are retained for unchanged applicable source. E changes only truthful core-managed generic typing, Promise collection typing/equivalent iterable use, braces and a dead initializer; the 181-case run remains D evidence.
  • Final source review: one complete review of E and its whole owner/caller context found no actionable findings. This was source-only, not another runtime or CI run.
  • Environment: Darwin arm64, pinned Bun 1.4.4-canary.1+191755ec1, Node 26.12.1 launcher. The remote backend stopped before receiver/tests; normal trusted-source local fallback supplied these results. No Linux, native Windows or live Teams proof is claimed.
Per-file single-worker timings

These are original native report start/end intervals, not a baseline comparison or speed claim. The complete D command took 43.368s including native preparation/reporting.

D test file under extensions/msteams/src Passed cases Seconds
monitor-handler/message-handler.media.test.ts 7 1.510
monitor-handler/message-handler.ingress-lifecycle.test.ts 6 2.256
monitor-handler/message-handler.bot-threads.test.ts 8 0.740
monitor-handler/message-handler.authz.test.ts 34 5.910
attachments.test.ts 21 0.052
approval-handler.runtime.test.ts 6 0.011
approval-card-submit.test.ts 10 0.011
monitor-handler.adaptive-card.test.ts 15 0.759
feedback-reflection.test.ts 5 0.028
attachments.graph.test.ts 21 0.044
monitor-handler.feedback-authz.test.ts 6 0.012
monitor-handler/inbound-content.test.ts 14 0.011
monitor-handler/access.participant.test.ts 3 0.007
monitor-handler/reaction-handler.test.ts 10 0.020
attachments/bot-framework.test.ts 11 0.015
attachments/remote-media.test.ts 4 0.004

The retained C src/test-utils/state-path-guard.test.ts result was 11 cases in 0.026s. The Windows-shaped filename case verifies producer/decoder assertions on this host, not Windows execution. CI seconds will be recorded when a qualifying current-head run exists.

Budget and remaining gates: the actual pre-grant counter ran on staged candidate source before C was signed: 6,442,408 lines against 6,441,800, +253 counted test lines, exit 1. Final E has +289 counted lines and the exact 289 allowance; the shared scalar baseline is unchanged. Frozen-input arithmetic gives 6,442,444 against a credited 6,442,089, leaving 355 over. That final total is derived, not a claimed E counter run. The zero-growth baseline would warn/pass, so this is not classified as inherited failing CI.

Current-head CI, its required deadcode dependency/unused-file/export phases, remaining native guards, and ordinary security/review/writer/merge gates are pending. No exception or budget waiver is requested.

The prior review's rank-up requests are addressed by current SQLite ownership, composed-candidate proof and the measured file timings above; available CI cost remains pending. That original-head review does not cover E.

Named follow-up: the existing ingress retry fixture acquires resources before its try/finally and stops them sequentially. This patch does not claim universal failure-safe acquisition for that unchanged fixture.

@vincentkoc vincentkoc self-assigned this Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review September 23, 2026 09:15
@openclaw-barnacle openclaw-barnacle Bot added channel: msteams Channel integration: msteams size: XL labels Sep 23, 2026
@vincentkoc
vincentkoc marked this pull request as draft September 23, 2026 09:46
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR replaces duplicated Teams test behavior with canonical inbound owners and teaches the test isolation guard to recognize SQLite file URIs.

Example: A test opens file:/tmp/owned/state.sqlite?mode=rw inside its isolated home.

  • Before: The guard treats the URI as a literal filesystem path and rejects the owned database.
  • After: The guard checks the decoded physical path and forwards the original URI and options to SQLite.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful owner-level harness coverage and reusable prior-head proof, with two confirmed current-head validation defects.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-only PR records 181 passing native cases on its immediate predecessor and 11 URI cases on an earlier unchanged guard revision; inspected final-head changes preserve those runtime paths.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Duplicated fixture behavior could let Teams tests pass while shared inbound execution or session persistence regressed.
Reason: The maintainer-authored direction removes competing test implementations and strengthens observable persistence and lifecycle coverage without changing production behavior.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep open: this maintainer-authored refactor improves test ownership, but current-head CI confirms two actionable ratchet failures.

Priority: P3
Reviewed head: f7a21e31e0976f3ea1de083cede24f7965fd8200

Before merge

  • Resolve positive test growth before retaining this allocation (P2) - The 289-line allocation matches this PR's counted growth but leaves the tree 355 lines above its effective ceiling according to the recorded frozen-input totals. The checker fails whenever the tree is over ceiling and net growth is positive; the unchanged base instead qualifies for its non-growing notice. Current-head CI confirms test-lines failed. Consolidate the added test/support lines to a non-growing change and remove the corresponding allocation, or integrate a concrete budget-debt repair; increasing this allocation beyond net growth is rejected by the same checker.
  • Declare isolation for the changed closed mock factories (P2) - This replacement changes the reply-dispatcher factory's token fingerprint, and removing async from the media-runtime factory in attachments/remote-media.test.ts changes that fingerprint too. Both remain closed mocks without an adjacent isolation declaration, while config/test-mock-exports-baseline.txt retains their old fingerprints. The exact-head check annotations confirm mock-exports failed. Preserve real exports where appropriate, or explain the intentional transport/storage isolation immediately above each mock and prune their obsolete baseline entries.

Findings

  • [P2] Resolve positive test growth before retaining this allocation — config/test-lines-allocations/msteams-oracle-custody-156393.txt:1
  • [P2] Declare isolation for the changed closed mock factories — extensions/msteams/src/monitor-handler/message-handler-mock-support.test-support.ts:20-23

Tests

  • Missing end-to-end proof: No shipped Teams run is supplied or required for this private test refactor; the URI regression's red-on-base execution is not recorded.
Agent review details

How this fits together

Teams test fixtures feed synthetic activities into the shared inbound runner, observe dispatch and session persistence, and close database resources before removing isolated directories.

flowchart LR
 A[Synthetic Teams activity] --> B[Teams message handler]
 B --> C[Shared inbound runner]
 C --> D[Isolated session persistence]
 C --> E[Injected dispatch boundary]
 D --> F[Canonical session cleanup]
 G[SQLite URI guard] --> D
Loading

Technical review

Best possible solution:

Keep the canonical-owner fixtures and URI guard, repair the changed mock declarations, and consolidate test growth until the existing budget passes.

Do we have a high-confidence way to reproduce the issue?

Source establishes literal URI checking and duplicated inbound execution on the base; current-head CI independently confirms the two ratchet failures, without running target code during this review.

Is this the best way to solve the issue?

Using existing inbound, persistence, decoding, and cleanup owners is the smallest coherent approach; no additional production machinery is needed.

Full review comments:

  • [P2] Resolve positive test growth before retaining this allocation — config/test-lines-allocations/msteams-oracle-custody-156393.txt:1
    The 289-line allocation matches this PR's counted growth but leaves the tree 355 lines above its effective ceiling according to the recorded frozen-input totals. The checker fails whenever the tree is over ceiling and net growth is positive; the unchanged base instead qualifies for its non-growing notice. Current-head CI confirms test-lines failed. Consolidate the added test/support lines to a non-growing change and remove the corresponding allocation, or integrate a concrete budget-debt repair; increasing this allocation beyond net growth is rejected by the same checker.
    Confidence: 0.99
  • [P2] Declare isolation for the changed closed mock factories — extensions/msteams/src/monitor-handler/message-handler-mock-support.test-support.ts:20-23
    This replacement changes the reply-dispatcher factory's token fingerprint, and removing async from the media-runtime factory in attachments/remote-media.test.ts changes that fingerprint too. Both remain closed mocks without an adjacent isolation declaration, while config/test-mock-exports-baseline.txt retains their old fingerprints. The exact-head check annotations confirm mock-exports failed. Preserve real exports where appropriate, or explain the intentional transport/storage isolation immediately above each mock and prune their obsolete baseline entries.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9b0d7717c56e.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm check:test-mock-exports --base 91d08c3 --no-merge-base
  • pnpm check:test-lines-ratchet --base 91d08c3 --no-merge-base
  • pnpm test extensions/msteams/src/attachments/remote-media.test.ts --maxWorkers=1
  • pnpm test extensions/msteams/src/monitor-handler/message-handler.ingress-lifecycle.test.ts --maxWorkers=1
  • pnpm test extensions/msteams/src/monitor-handler/message-handler.authz.test.ts --maxWorkers=1

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 165a054 adds src/test-utils/state-path-guard.ts:8 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 165a0543c148; files: src/test-utils/state-path-guard.ts)

PR surface

Source +3, Tests +300, Other +1. Total +304 across 16 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 4 1 +3
Tests 14 496 196 +300
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 16 501 197 +304

Review metrics

Metric Value Why it matters
Production versus test growth Production +0/-0; tests/private support +500/-197, net +303. Growth replaces duplicated execution with real owner coverage and adds URI isolation checks; 289 lines count toward the unresolved test budget.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This changes internal tests and private support without changing shipped user behavior.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-23T10:07:21.013Z sha 3db2283 :: needs changes before merge. :: none
  • reviewed 2026-09-27T04:48:30.365Z sha 21e2373 :: needs changes before merge. :: none
  • reviewed 2026-10-02T09:31:23.107Z sha 21e2373 :: blocked before merge. :: none

Reviewed November 3, 2026, 5:00 PM ET / 22:00 UTC (Revision 4).

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 27, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Current-main integration handoff, 2026-10-02, for head 21e2373c4e50337ee24df6182dc9dd87954d9ae4. Preserve the draft and the existing writer's final-approval hold.

The exact contribution against audited main 4ad3766a2169740ea369afd08f65a1db11ccbfb5 is 20 paths. Source-only merge inspection identified eight conflicts: seven extensions/msteams/src/monitor-handler/message-handler.*.test.ts files (authz, bot-threads, conversation-authz, history, ingress-lifecycle, media, thread-parent) and src/plugin-sdk/sqlite-runtime-testing.ts. This is integration evidence, not a whole-PR correctness or runtime verdict.

The substantive integration issue is the candidate's withStateDatabaseCoordinatorRuntimeDirectory re-export and its use in extensions/msteams/src/monitor-handler.test-helpers.ts. Main deliberately removed that coordinator in PR157413, commit 8b16e5328ecde96f7fe48aa637fec18cfde3fd47. Do not restore the retired coordinator to resolve the conflict. Adapt the fixture to current SQLite lifecycle ownership, preserving current session-store temp-directory and joined worker-cleanup support.

The reviewed path-guard hardening remains a distinct residual, not a proven duplicate. The Teams fixture, SQLite SDK helper and production path-guard blobs are unchanged between the audited main and subsequently observed main 49814ae3c13faea64f14fdeeba64c14324977b8d.

Next: the existing writer should reconcile these boundaries, preserve newer main assertions and cleanup, then qualify the composed candidate remotely. Keep the existing single-worker cost/proof request and failed aggregate disposition explicit. No application tests were run for this handoff; previous proof retains its original source binding. This note does not authorize a readiness transition or claim full supersession.

@vincentkoc
vincentkoc marked this pull request as ready for review November 3, 2026 21:51
@clawsweeper

clawsweeper Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment @clawsweeper review. Please avoid repeated requests while a review is queued or running; agents should not request reviews automatically.

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review current head f7a21e3. The PR body records current owner integration, per-file single-worker timings, prior-head behavioral proof, and the unresolved test-line budget limitation.

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Nov 3, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: msteams Channel integration: msteams P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant