fix(reports): merge report writes onto origin's latest reports data - #581
Merged
Merged
Conversation
Writers (session save --push, Stop votes, member registration, auto-report) now sync the reports worktree under the reports lock before they read-merge-write, so the same member on two machines cannot lose an entry to a stale checkout. Closes Tencent#561
…g style Drop the init roster state machine, restore the original merge/restore comments in auto-report, and keep commitAndPushReports' docs and retry loop as they were. The write still happens after sync under the reports lock.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Same member, two machines:
session save --push, Stop-hook votes, member registration, and auto-report now sync the reports worktree under the reports lock before they read-merge-write. A stale local checkout can no longer drop the other machine's session, vote, or stats entry.commitAndPushReportsremains for tests and "files already sit in the worktree" writes. Production merge-writers go throughupdateReports. Read-only refresh (pushIfCreated: false) and HTTP reporting are unchanged.Closes #561
Type of Change
Test Plan
npx tsc --noEmitpassesnpx vitest runpasses (229 files, 3219 tests)npm run build&&npm run test:e2epasses (138 passed, 26 skipped live-provider tests)n: 12(notn: 11/ conflict)alice: A runsmembersfirst, then B/A/Bsession save --push --forcewithalice-b0/alice-a1/alice-b1. Origin month log contains all three.updateReportsdoes not run the callback when the reports lock is busyupdateReportswhen there are no pending vote deltasupdateReportswhen nothing is pending; does not truncate snapshots when push returns falseinitunit tests still pass (lock-busy / ensure failure is not treated as "already registered")Related Issues
Closes #561
Notes for Reviewers
2469f0b(fix/reports-writer-sync). That branch predates fix(reports): keep teamai-reports reads fresh and read-only #560 (stash-create sync), fix(stats): finish report bookkeeping after pull timeout #562 (pushIfUnchanged/ restore-on-failure), and fix(votes): persist upvote counts reliably across merge and hook dispatch #565 (vote merge).commitAndPushReportsAt. Sync uses the existing fix(reports): keep teamai-reports reads fresh and read-only #560stash createpath, not--autostash.refreshthen write is TOCTOU (lock released between them). Sync-after-write would rebase/reset under an uncommitted merge. Hence:lock → ensure → sync → write callback → commit → push → unlock.updateReportsreturns true (fix(stats): finish report bookkeeping after pull timeout #562).