Repository navigation
fix(recall): include pending local votes in index builds - #1276
Conversation
The PR description documents sufficient testing, including representative built real-CLI runs. Its tested commit differs from the review head; under the review rules, that is a note, not a blocker. Reviewed only the specified diff; did not run, build, or install PR code. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
@MertensMing Approving with notes. We built this head and main (d60e68f5), gave feedback against a local git team repo, and ran pull twice.
| Build | Reporting | Index votes after the first pull, then the second |
|---|---|---|
main |
disabled | 0, 0 |
main |
enabled | 0, 1 |
| this head | disabled | 1, 1 |
| this head | enabled | 1, 1 |
The new e2e test fails all 4 cases against main's build. The PR's three e2e files pass on this head, 34 tests.
[P2 non-blocking] In a --single-branch or shallow clone of the reports branch, the index drops the member's own last confirmed votes until the next fetch. readIndexVoteFiles (src/votes.ts:558) reads confirmed votes only from refs/remotes/origin/teamai-reports, and in such a clone a push does not move that ref. Once the pending deltas are confirmed and cleared, a rebuild that does not fetch first misses that batch. That covers the rebuild after contribute and the recall rebuild of a missing index. pull and viz fetch, so they are fine. We measured it: a full clone shows 2 votes (RELEVANT 6.7), and a single-branch clone on this head shows 1 (NOT_RELEVANT 1.9). Reading the reports worktree's HEAD^{commit} instead gave 2 votes in both clones, the #1233 repro still behaved, and the e2e files passed. Please check that HEAD cannot hold a commit whose deltas are still counted as pending before taking that route.
[P3 nit] The CI comment's legacy v1 conversion needs a v1 votes file for the same member on the reports branch, and any earlier sync would already have converted it. Delivery does the same conversion, so the index shows what delivery would produce.
[P3 nit] The parse-error log no longer names which votes file is corrupt. votesDir is still passed by four callers, but the build ignores it.
[P3 nit] The unconfirmed e2e case writes an extensionless hook that uses require. It fails when a package.json with "type": "module" sits above the test's temp directory.
The index read holds the votes lock while it reads each member's file. 200 member files took 990 ms, and a writer gives up after about 2.5 s, so this only matters for very large teams.
* fix(recall): include pending local votes in index builds * test(recall): retain local votes in foreign checkout isolation case
Summary
Local feedback now affects the next index rebuild even when reporting is disabled or a push fails. Pull, recall rebuilds, contribute and scoped viz share confirmed team votes plus undelivered local deltas, including first-vote and HTTP cases.
The reader pins the reports origin commit, uses delivery IDs to avoid double-counting, and falls back to confirmed counts immediately when the votes lock is busy. Independent delivery snapshots and detached legacy YAML aliases prevent new feedback from mutating an old receipt and being lost. Upload, retry and confirmation/cleanup protocols are unchanged.
Type of Change
Test Plan
Verified head 8d1025b, rebased onto d60e68f, with Node 20.19.5:
npx vitest run --config vitest.e2e.config.ts src/__tests__/e2e/index-local-votes-1233.test.ts src/__tests__/e2e/votes-sync-retry-1027.test.ts --retry=0The CLI tests use an isolated local Git origin. With reporting enabled, disabled or rejected, feedback followed by the first pull changes indexed votes from 0.3 to 1.3 and increases the numeric recall score; repeated pulls stay stable. They also verify lock-busy fallback/recovery, recall/contribute rebuilds, and #1027 push-failure retries. A post-receive hook holds the local votes lock after a real push to leave confirmation pending; after releasing it, new CLI feedback is retained on subsequent pulls (2.3). The hook never edits vote data.
Earlier full-suite testing had four timeouts that passed on serial rerun and one ZCode registered-entry assertion also reproduced on unmodified upstream 2aa8a8a. The full suite was not rerun on this final head; other providers and agents are left to CI.
Related Issues
Fixes #1233.
Notes for Reviewers
The small snapshot changes in votes.ts are needed to preserve new feedback while a delivered stage awaits confirmation. No new commands or changes to the delivery protocol. Adoption votes created after a rebuild remain for the next rebuild.