fix(dry-run): let --dry-run reach recall maintenance and recall promote (#900) - #903
Merged
Merged
Conversation
…te (Tencent#900) The root program declares --dry-run, and Commander gives it to the root wherever it is written, so these two actions, which read only their own options, never saw it: --prune --dry-run pruned and published, --update-quality --dry-run wrote AI drafts, and promote --dry-run promoted and published. Both actions now merge program.opts() as the other actions do, and load with { dryRun }. --confidence-writeback, which ignored the flag, now reports what it would write and publishes nothing.
…ng (Tencent#900) executePromotion created <repo>/<category>/ before its dry-run return, so recall promote --dry-run left an empty directory in the team repo.
|
No findings.
|
|
No findings.
|
jeff-r2026
approved these changes
Sep 29, 2026
This was referenced Sep 29, 2026
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
teamai recall maintenance --prune --dry-rundeleted learnings and published the deletion.recall promote <id> --dry-runpromoted and published, and--update-quality --dry-runwrote AI drafts. The root program declares--dry-runtoo, and Commander 12 (withoutenablePositionalOptions()) gives the flag to the root wherever it is written. Most actions mergeprogram.opts(), but these two read only their own options, wheredryRunis alwaysundefined.Type of Change
Test Plan
npx tsc --noEmitpassesnpm run lintpassesnpx vitest runpasses (341 files, 5366 tests, 1 skipped)Unit.
src/__tests__/recall-maintenance-dry-run.test.tsdrives the real command table (program.parseAsync), because the flag goes missing in Commander's wiring. The maintenance module and publishing are mocked at their module boundary.maintenance-two-roots.test.tsgains the case wherewriteBackConfidenceunderdryRunnames the file it would write and writes none. The existingexecutePromotiondry-run case inmaintenance-promote.test.tsnow also asserts that the category directory is not created.origin/main): all five dry-run rows, the write-back case and the promotion-directory check fail (7). The three controls pass.End-to-end, real CLI (
npm run build, thennode dist/index.js). The fixture is an HTTP-kind user scope, whose learnings and votes live underrepo.localPath, so the run needs no network or branch worktree. It holds one learning nobody recalled (confidence 0.04, below the 0.15 threshold):mainisorigin/main671f509;branchis 67d66f0. The provider does not matter here: the change is in option parsing.A second probe diffs the whole fixture tree (v2 votes, a promotable and a stale learning). On this branch, every dry-run mode leaves the team repo unchanged, and
HOME/.teamaitoo apart fromdebug.log, with the flag before or after the subcommand:--prune,--prune --archive,--confidence-writeback,--update-qualityandpromote <id>. Onmain, each of them prunes, archives, rewrites, drafts or promotes.Related Issues
Fixes section B of #900. The issue stays open for sections C and D.
Notes for Reviewers
Deliberately not in this PR
These are known and tracked, so please do not report them as missing from this diff.
--dry-runor on a read-only run (mcp inject,roles,tags,source,import, the pre-command auto-migration, ...)remove,source add,import --from-repo*,models switch,roles/projectsedits),stats--dry-runentirely (projects set,hooks inject/remove,mcp remove,update,init, ...)resolveMaintenancePathsrefreshes the reports and learnings checkouts on a dry runpushIfCreated: falseand never publishes a branch, and a preview needs the current votes and learnings to name its candidates, the same waypull --dry-runfetchesloadUserVotesrewrites a v1 votes file into v2 when it reads one (src/votes.ts:199-202), and maintenance reads votes on a dry run toomain.recall promote --dry-runstill asks the AI to classify the candidate, and the Claude CLI it spawns creates~/.claude/in a fresh HOME, while teamai appends to~/.teamai/debug.logmain.enablePositionalOptions()globallywriteBackConfidencemutates the object gray-matter caches for a given input string. That is harmless in one CLI run, but it is why the new unit case uses its own frontmatter. It predates this PR and is left alone.Review record
Two-axis
/code-review(standards and spec) ran twice againstorigin/main. Pass 1 (on e1718ed): Standards found nothing; Spec found thatrecall promote --dry-runstill created the empty target directory (promote.ts:162) in the real CLI, fixed in eb4c38a with its test, and noted the two pre-existing behaviours listed above. Pass 2 (on eb4c38a): Spec re-ran every dry-run mode (11 cases, flag before and after the subcommand) and every real mode against the built CLI, and found the team repo unchanged in each preview and the real modes identical tomain; Standards noted that the movedensureDirwas redundant withwriteFile, dropped in 67d66f0. The remaining pass-2 notes were corrections to this description, applied.Merge danger
Door: two-way. Two actions merge their options and one function gains a defaulted option. A revert restores the old behaviour.
Blast radius:
recall maintenanceandrecall promoteonly. Without--dry-run, their behaviour is unchanged (see the positive controls, unit and real CLI). With it, they now preview. That is what the help text (Show what would be done without making changes) and the docs (docs/usage-guide.md:1267,:1300,docs/product-overview.md:150and the zh-CN pairs) already promised, so no doc changes.