Fix flake in TestMaterialIntakeAttachmentOnlyLifecycle by waiting on the same gates materialExisting uses (CardDone + materialActive released) instead of systemTexts.
deliverNotices runs before defer materialKeyRelease, so notice-first waits could still see the in-memory key and get pending dedup.
Why
CI test / test-pg had intermittent failures on this case (same code red/green). No production change.
Evidence
SELF: go test ./internal/runmgr/ -run TestMaterialIntakeAttachmentOnlyLifecycle -count=20 (pass)
Test plan
Local stress -count=20
Backend CI green on this PR
## Summary
- Fix flake in `TestMaterialIntakeAttachmentOnlyLifecycle` by waiting on the same gates `materialExisting` uses (`CardDone` + `materialActive` released) instead of `systemTexts`.
- `deliverNotices` runs before `defer materialKeyRelease`, so notice-first waits could still see the in-memory key and get pending dedup.
## Why
CI `test` / `test-pg` had intermittent failures on this case (same code red/green). No production change.
## Evidence
- SELF: `go test ./internal/runmgr/ -run TestMaterialIntakeAttachmentOnlyLifecycle -count=20` (pass)
## Test plan
- [x] Local stress `-count=20`
- [ ] Backend CI green on this PR
Why: TestMaterialIntakeAttachmentOnlyLifecycle flaked when waiting on
systemTexts; deliverNotices runs before defer materialKeyRelease, so
done-dedup still saw the in-memory key and returned pending.
Evidence: go test ./internal/runmgr/ -run TestMaterialIntakeAttachmentOnlyLifecycle -count=20
Impact: Aligns the wait with materialExisting gates; no production change.
Refs: fix/material-intake-lifecycle-flake
Co-authored-by: Cursor <cursoragent@cursor.com>
weichen
merged commit 5e8ada727c into main2026-10-12 06:32:43 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
TestMaterialIntakeAttachmentOnlyLifecycleby waiting on the same gatesmaterialExistinguses (CardDone+materialActivereleased) instead ofsystemTexts.deliverNoticesruns beforedefer materialKeyRelease, so notice-first waits could still see the in-memory key and get pending dedup.Why
CI
test/test-pghad intermittent failures on this case (same code red/green). No production change.Evidence
go test ./internal/runmgr/ -run TestMaterialIntakeAttachmentOnlyLifecycle -count=20(pass)Test plan
-count=20