Skip to content

fix(reports): merge report writes onto origin's latest reports data - #581

Merged
jeff-r2026 merged 2 commits into
Tencent:mainfrom
jimpablo:fix/561-reports-writer-sync
Sep 16, 2026
Merged

jeff-r2026 merged 2 commits into
Tencent:mainfrom
jimpablo:fix/561-reports-writer-sync

Conversation

@jimpablo

Copy link
Copy Markdown
Contributor

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.

commitAndPushReports remains for tests and "files already sit in the worktree" writes. Production merge-writers go through updateReports. Read-only refresh (pushIfCreated: false) and HTTP reporting are unchanged.

Closes #561

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature causing existing behavior to change)
  • Documentation only
  • Refactor / internal cleanup

Test Plan

  • npx tsc --noEmit passes
  • npx vitest run passes (229 files, 3219 tests)
  • npm run build && npm run test:e2e passes (138 passed, 26 skipped live-provider tests)
  • Added/updated tests for the change
    • Real-git: stale checkout reads origin then writes n: 12 (not n: 11 / conflict)
    • Built CLI, two HOMEs, same alice: A runs members first, then B/A/B session save --push --force with alice-b0 / alice-a1 / alice-b1. Origin month log contains all three.
    • updateReports does not run the callback when the reports lock is busy
    • Stop hook skips updateReports when there are no pending vote deltas
    • Auto-report skips updateReports when nothing is pending; does not truncate snapshots when push returns false
  • init unit tests still pass (lock-busy / ensure failure is not treated as "already registered")

Related Issues

Closes #561

Notes for Reviewers

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.
@jeff-r2026
jeff-r2026 merged commit 57586c9 into Tencent:main Sep 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(reports): report writers merge into a stale teamai-reports worktree

2 participants