Validate and Relocate JSON Global Flag

I notice that we have a --json global flag for all the entire repo commands, where, I reckon it is only implemented inside entire repo mirror list. Validate where it is imeplemented and move away from global flag
Done. Verified end-to-end.
What was wrong
--json was a persistent control-plane flag (addControlPlaneFlags, corecmd.go), inherited by every subcommand of repo/org/project/grant. It was implemented broadly (all list/get/create verbs) — not just mirror list. Real defect: 9 side-effect verbs inherited it and silently ignored it.
Fix (structural, your pick)
- Dropped
--jsonfrom persistentaddControlPlaneFlags; kept--insecure-http-authpersistent (all commands build a client). - Added local helper
addJSONFlag(cmd); wired it onto the 20 commands that honor it. jsonRequested()unchanged.
Result
repo clone --json→Error: Invalid usage: unknown flag: --json(loud, not silent no-op).repo clone --help→ no--json. Help honest.repo mirror list --help→ still shows--json. Honoring commands unchanged.
Verification
- New test
TestControlPlaneJSONFlag_OnlyOnHonoringCommands— walks all 4 group trees, locks the 27-command matrix (drift in either direction fails). RED before, GREEN after. - Full
cmd/entire/clipackage tests pass. gofmtclean;golangci-lintv2.11.3 clean (0 issues).- Live binary confirms reject + help behavior above.
Two notes
mise run lintfails in your env — stray golangci-lint v1.64.8 in~/.local/share/mise/installs/go/1.26.4/binshadows the mise-pinned v2.11.3. Pre-existing, not my change. Ran v2 directly → clean.- Files touched:
corecmd.go,org.go,project.go,repo.go,repo_mirror.go,repo_mirror_collaborators.go,grant.go, + test file & one stale test comment.
No commit made — say "ship it" when ready.
Base directory for this skill: /Users/gtrrz-victor/.claude/skills/ship
Ship Changes
Commit current changes, push to remote, and update the PR.
Step 1: Analyze changes
- Run
git diff --statandgit diffto understand what changed - Run
git statusto see untracked files - Run
git log --oneline -3to match the repo's commit message style
Step 2: Commit
- Stage only the relevant changed/untracked files by name (never
git add -Aorgit add .) - Write a concise commit message that focuses on the "why" not the "what"
- If
draftis provided, use it as the commit message - Otherwise, draft one from the diff
- If
- Commit. If hooks fail, diagnose and fix — do NOT use
--no-verify
Step 3: Push
- Check if the branch tracks a remote:
git rev-parse --abbrev-ref --symbolic-full-name @{u} - If not tracking, push with
-u origin <branch> - If tracking, just
git push - If push is rejected (remote has new commits), pull with rebase first then push
Step 4: Update PR
- Find the open PR for the current branch:
gh pr view --json number,body,title - If no PR exists, skip this step and inform the user
- Compare the current PR body against the new changes:
- If the changes are within the existing PR scope, update the description to reflect the current state
- If the changes are additive or a follow-up, add a PR comment summarizing what was just pushed instead
- When updating the PR body, preserve the overall structure but refresh the summary bullets and test plan
- When adding a comment, keep it concise — bullet points of what changed and why
- Before making any PR update (description edit or comment), show the user the exact text you plan to post and ask for their approval. Do NOT post until they confirm.
Rules
- Never commit files that look like secrets (.env, credentials, tokens)
- Never force push
- Always show the user what was committed and the PR URL when done
Pushed. Here's the draft PR I'll create — approve before I post:
Title: Move control-plane --json off the shared persistent flag
Body:
Post it as a draft?
Shipped as draft.
- Commit:
6b9369605onmove-json-flag-to-specific-commands - Pushed with upstream tracking
- Draft PR: https://github.com/entireio/cli/pull/1680
Conflicts fixed, merged, pushed.
- Merged
origin/main(was ahead: column refactor +--repo→--namerename). - One conflict — comment-only in
repo_mirror_test.go; kept my--json-is-local wording, adopted the--nameflag name. - Auto-merge handled
repo_mirror.go; build clean despite main'sfilterByRepo→filterByNamerename and[]columnchange. - Full
cmd/entire/clitests pass; golangci-lint v2.11.3 clean. - Pushed
2e7f72056→ PR #1680 updated.
Confirmed the root cause. It's a pre-existing flaky test on main, not related to my --json change.
Why it failed
Failing test: TestRunInvestigateConfigPicker_QuorumExceedsAgents (investigate/picker_test.go:84).
Two tests in that file both call t.Parallel() and both mutate the same process-global override pickerFormOverride:
TestRunInvestigateConfigPicker_FiltersNonInstalled(line 36) setsquorum = 0(valid)TestRunInvestigateConfigPicker_QuorumExceedsAgents(line 84) setsquorum = 5(invalid, expects an error)
The flake sequence:
- QuorumExceeds stores its
quorum=5override - FiltersNonInstalled (parallel) stores its
quorum=0override, clobbering it - QuorumExceeds calls the picker → reads
quorum=0→ valid config → no error →t.Fatal("expected error when quorum exceeds agent count")at line 101
The atomic.Pointer only stops a data race; it can't stop this logical clobber. The picker's own comment even says it (picker.go:92):
tests that install conflicting overrides must not run in parallel with each other
…but both tests were left with t.Parallel(). It surfaced now only because merging main pulled the investigate package into my PR's test-core run; it passes locally because the two fast tests rarely overlap.
Not my code
My change only touched the --json flag in repo/org/project/grant. This is an unrelated package.
Options
- Just re-run
test-core— it's flaky, likely goes green (doesn't fix the underlying bug). - Fix it here: drop
t.Parallel()from the two override-setting tests (lines 37, 85), honoring the documented contract. One-line-each, safe, but scope-creep on a focused PR. - Fix separately on its own branch/PR, re-run this PR's CI meanwhile.
Which do you want? I'd lean #2 with a note in the PR — it reliably unblocks and the fix is trivially correct.
Pushed. Here's the PR I'll open — approve before I post:
Title: investigate: fix flaky picker tests racing on global override
Body:
Post it?