Repository navigation
fix(init): preserve member registration failure reasons - #1272
Conversation
Signed-off-by: ydflow <314143294+ydflow@users.noreply.github.com>
|
No findings in the specified PR diff. The PR description documents sufficient testing, including two post-build real-CLI runs covering registration failure and a busy reports lock. The stated baseline failures and deferred provider/agent coverage do not warrant a blocking finding. Review was read-only; I did not run, build, or install anything from the PR. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
@ydflow Approving with notes. We built this head and main (d60e68f5) and ran single-repo teamai init . --provider git --agent claude --force in an isolated HOME.
| Case | main |
this head |
|---|---|---|
Commit fails before the member callback (missing gpg.program) |
exit 0, no warning | exit 0, the warning names cannot exec '.../missing-signer' |
| Push fails (unreachable origin) | exit 0, guesses (no write access?) |
exit 0, shows git's error |
.reports-lock held |
exit 0, no warning | exit 0, says another write holds the reports branch |
[P2 non-blocking] The hint "re-run the same teamai init command to retry" does not retry for a non-interactive member. Without --force, the second run hits the re-init guard and stops with Aborted. Existing config is unchanged., so registration never runs. An interactive member has to answer the overwrite prompt first. The e2e test passes --force, so it doesn't catch this. The same wording is in both init.ts paths, both FAQ pages and CONTRIBUTING. Naming --force in the hint, or pointing at a command that registers without re-initializing, would fix it.
[P3 nit] PublishResult.reason from a failed push is git's raw stderr with a trailing newline, so the warning prints . You are still set up locally… on a line of its own. .trim() on the reason fixes it.
#1268 changes the timeout inside the same two withTimeout(updateReports(...)) calls. This PR owns how the result is handled and what the messages say. The overlap is only textual.
The Node 20 / ubuntu job failed with a vitest worker crash (ERR_IPC_CHANNEL_CLOSED), not a failing test. A re-run should clear it.
Summary
initcollapsedupdateReportsto a boolean and only reported failure when the roster callback changed a member. A reports checkout or initial commit failure before that callback was silent; a later failure guessed "no write access?" and discarded the returned reason.Both git-backed and single-repo init now handle
PublishResultbefore the changed-member checks:failednames the returned reason and how to retry, andbusyidentifies the reports-branch writer and asks the member to retry after it finishes. Local setup still completes.publishedandalready-presentdo not produce a failure warning. Failed writes no longer print a registration-success line. The bilingual FAQ, contributor note and changelog describe the warning.Type of Change
Test Plan
npm run typechecknpm run lintnpm run buildgit diff --checknpx vitest run src/__tests__/init.test.ts -t 'member registration result': 12 passed, covering both init modes, failure before/after the callback, busy, published and already-present. Before the runtime change, the six failure/busy regressions failed.npx vitest run src/__tests__/init-projects.test.ts src/__tests__/members.test.ts src/__tests__/projects-members.test.ts: 43 passed.npx vitest run --config vitest.e2e.config.ts src/__tests__/e2e/init-registration-result.test.ts --retry 0: 2 passed. Each fixture runs the builtnode dist/index.js init . --provider git --agent claude --forcewith a temporary HOME and real Git repo. One configures a missing GPG program so the reports branch's first commit fails before the member callback; the other holds.reports-lockwith the test process's live PID. Both preserve the local self-mode config, finish init with exit 0, print the appropriate cause/busy warning and retry hint, and report no member-registration success. The busy case preserves the other writer's lock. Both cases failed against the pre-fix build because the registration warning was absent.init.test.ts: 70 passed / 5 failed before the final two already-present cases were added; pristined60e68fhas the same 5 failures / 60 passed. The failures concern Windows path separators in existing clone fixtures. All final 12 new cases pass separately.init-scope-default.test.ts: the same 3 path-normalization failures on this branch and pristined60e68f(16 passed on each).npx vitest run --maxWorkers=4 --bail=10 --reporter=json --outputFile=../init-unit-results.jsonstopped early; its report recorded 110 passed, 7 failed, 12 pending. All seven observed failing test names also fail when running unchangedlocal-agent.test.tson pristined60e68f(the baseline file has 104 passed / 34 failed). This was not a completed full-suite run.Local verification used Windows, Node 24.19.0 and Git 2.33.1. Other providers and AI-tool sessions are left to CI; no live model session was used.
Related Issues
Closes #1267.
Notes for Reviewers
Only the two registration-result consumers in
src/init.tschange at runtime. The reports writer, lock, timeout and roster merge behavior are unchanged. #1268 changes reports Git timeouts and is a related, separate fix.Door: two-way; reverting restores the old diagnostics, with no data/schema migration.
Blast radius: init's member-registration messages. Registration remains non-blocking and uses the existing retry operation.