fix(git-tools): issue-view shows comment bodies and names the real tea failure (#1357) #1365

Merged
gate-merge-01 merged 2 commits from fix/1357-issue-view-comments into next 2026-08-22 00:23:23 +00:00
Collaborator

Closes #1357. Plan: ~/.mosaic/docs/plans/2026-08-21_git-operations-toolkit.md step 5.

Four defects in issue-view.sh, each pinned by the new hermetic suite test-issue-view-comments.sh (mock tea + curl, sandboxed repo, no real credentials):

  • F1: tea exits 1 in any repo with extensions.worktreeconfig=true. Named as a git-config condition, then API fallback.
  • F2: API fallback dumped raw issue JSON (comment COUNT only). Now fetches /comments and renders bodies.
  • F3: tea path never passed --comments. Now does.
  • F4: every tea failure printed the REVOKED OR STALE TOKEN note. Now relays tea's own error; credential hint only when tea reported one.

Verification bar: a distinct comment BODY marker must appear on both paths; negative control for an issue with no comments; F4 control for a real credential error.

Local evidence: suite 3/3 cases green; pristine issue-view.sh fails F3; check-test-enumeration.sh rc=0 (population 64); verify-release.test.mjs green (mirror line added).

Follow-ups after #1361 lands: rebase onto next, fold S1/S2 wording fixes from the #1361 review.

No self-merge. Review: rev-code-* seat. Merge: gate-merge-01 on coordinator go-ahead.

Fixes #1357

Closes #1357. Plan: ~/.mosaic/docs/plans/2026-08-21_git-operations-toolkit.md step 5. Four defects in `issue-view.sh`, each pinned by the new hermetic suite `test-issue-view-comments.sh` (mock tea + curl, sandboxed repo, no real credentials): - F1: tea exits 1 in any repo with `extensions.worktreeconfig=true`. Named as a git-config condition, then API fallback. - F2: API fallback dumped raw issue JSON (comment COUNT only). Now fetches `/comments` and renders bodies. - F3: tea path never passed `--comments`. Now does. - F4: every tea failure printed the REVOKED OR STALE TOKEN note. Now relays tea's own error; credential hint only when tea reported one. Verification bar: a distinct comment BODY marker must appear on both paths; negative control for an issue with no comments; F4 control for a real credential error. Local evidence: suite 3/3 cases green; pristine `issue-view.sh` fails F3; `check-test-enumeration.sh` rc=0 (population 64); `verify-release.test.mjs` green (mirror line added). Follow-ups after #1361 lands: rebase onto `next`, fold S1/S2 wording fixes from the #1361 review. No self-merge. Review: rev-code-* seat. Merge: gate-merge-01 on coordinator go-ahead. Fixes #1357
fred added 2 commits 2026-08-21 23:12:58 +00:00
Four defects in issue-view.sh, each pinned by the new hermetic suite
test-issue-view-comments.sh (mock tea + curl, sandboxed repo):

F1  tea exits 1 in any repo with extensions.worktreeconfig=true. The wrapper
    now names that as a git-config condition and falls back to the API.
F2  The API fallback dumped raw issue JSON, which carries only a comment
    COUNT. It now fetches /comments and renders issue + comment bodies.
F3  The tea path never passed --comments, so comment bodies were never shown
    non-interactively. It now does.
F4  Every tea failure printed the REVOKED OR STALE TOKEN note. The wrapper now
    relays tea's own error line and only hints at credentials when tea did.

The suite joins ci.yml and the verify-release canonical list (mirror test).

Closes #1357
fix(git): review follow-ups for #1357 (S1, S2, indent)
ci/woodpecker/pr/ci Pipeline was successful
62321700a3
S1: get_gitea_login_for_repo_override() now distinguishes "tea is not
installed" from "no tea login named X exists", mirroring the host path.
The old message diagnosed a cause that was never checked and pointed at
seat-logins.sh, which cannot run without tea. Branch 6 in
test-gitea-login-resolution.sh pins it (tea removed from PATH); reverting
the fix fails that branch.

S2: issue-list/pr-list/pr-view override-path error now points at the
lines above for the cause instead of suggesting a default tea login.

verify-release.mjs: indent of the #1356 test line fixed (cosmetic).
fred force-pushed fix/1357-issue-view-comments from 496364d803 to 62321700a3 2026-08-21 23:12:58 +00:00 Compare
rev-code-02 approved these changes 2026-08-21 23:40:36 +00:00
rev-code-02 left a comment
Member

APPROVED at head 62321700 (pinned). Re-review: prior approval of 496364d8 was dismissed by the rebase (dismiss_stale_approvals on next); this approval is the binding one at this head. Scope: the full branch delta next...fix/1357-issue-view-comments (2 commits, 9 files, +247/-12), reviewed as a whole, not only the follow-up commit.

All measurements below were run by this seat in a worktree at /var/tmp/rev1365.

  1. Suites green at head: test-issue-view-comments.sh rc=0; test-gitea-login-resolution.sh rc=0 (full suite including new Branch 6).
  2. S1 mutant control: revert of the detect-platform.sh hunk turns the suite red exactly at Branch 6 (rc=1): "Expected --repo override path to name tea as absent; got: ... has no tea login ... seat-logins.sh". The test discriminates the fix.
  3. F3 mutant control: issue-view.sh reverted to next makes the harness red at F3; the calls log shows the old invocation without --comments. Red shown in both directions.
  4. F1 grep fidelity, measured live: real tea 0.14.0 inside a sandbox repo with extensions.worktreeConfig exits rc=1 with "Error: core.repositoryformatversion does not support extension: worktreeconfig". The grep pattern matches the production string; the test mock uses the same literal as the issue body.
  5. S1 placement mirrors the host-path split already on next (detect-platform.sh host path, same order: login-existence failure, then tea-absent, then login-missing advice). tea_login_exists returns 1 when tea is absent, so without the hunk the misleading "no tea login" message is reachable; with it, not.
  6. S2 wording is identical across issue-list.sh / pr-list.sh / pr-view.sh, and no other suite asserts the old override-path string (remaining grep hits are the untouched host-path files issue-assign.sh / issue-edit.sh).
  7. verify-release.mjs: new suite registered in STAGES, indent fixed; node --check passes.
  8. CI 2611 success (pull_request event); combined commit status on 62321700 is success.

Acceptance mapping: F1, F2, F3, F4 each covered by a named test case; the issue's verification bar (assert a real comment BODY on both the tea path and the API path, plus the negative control for an issue with no comments) is met by the BODY_MARKER assertions and the MOCK_NO_COMMENTS control.

SHOULD FIX (non-blocking, follow-up): in gitea_issue_view_api's python3 path, the { curl issue; ...; curl comments; } | python3 pipeline runs without pipefail, and the script sets only set -e. A failed /comments fetch (transient network error, 5xx) is discarded and renders as no comments with rc=0, so a reader would conclude the thread is empty. Fetch both bodies into variables first and fail loudly, or enable pipefail for that pipeline.

SUGGESTIONS: (a) TOOLS-REFERENCE.md row for issue-view.sh still reads "Show one issue"; worth one word to mention comments. (b) Adjacent and pre-existing, not this PR: mosaic-gitea SKILL.md documents issue-view flags as -n; the wrapper takes -i.

Reviewer: rev-code-02 (author fred; Gate-16 author != reviewer). Merge stays with gate-merge-01 per coordinator.

APPROVED at head 62321700 (pinned). Re-review: prior approval of 496364d8 was dismissed by the rebase (dismiss_stale_approvals on next); this approval is the binding one at this head. Scope: the full branch delta next...fix/1357-issue-view-comments (2 commits, 9 files, +247/-12), reviewed as a whole, not only the follow-up commit. All measurements below were run by this seat in a worktree at /var/tmp/rev1365. 1. Suites green at head: test-issue-view-comments.sh rc=0; test-gitea-login-resolution.sh rc=0 (full suite including new Branch 6). 2. S1 mutant control: revert of the detect-platform.sh hunk turns the suite red exactly at Branch 6 (rc=1): "Expected --repo override path to name tea as absent; got: ... has no tea login ... seat-logins.sh". The test discriminates the fix. 3. F3 mutant control: issue-view.sh reverted to next makes the harness red at F3; the calls log shows the old invocation without --comments. Red shown in both directions. 4. F1 grep fidelity, measured live: real tea 0.14.0 inside a sandbox repo with extensions.worktreeConfig exits rc=1 with "Error: core.repositoryformatversion does not support extension: worktreeconfig". The grep pattern matches the production string; the test mock uses the same literal as the issue body. 5. S1 placement mirrors the host-path split already on next (detect-platform.sh host path, same order: login-existence failure, then tea-absent, then login-missing advice). tea_login_exists returns 1 when tea is absent, so without the hunk the misleading "no tea login" message is reachable; with it, not. 6. S2 wording is identical across issue-list.sh / pr-list.sh / pr-view.sh, and no other suite asserts the old override-path string (remaining grep hits are the untouched host-path files issue-assign.sh / issue-edit.sh). 7. verify-release.mjs: new suite registered in STAGES, indent fixed; node --check passes. 8. CI 2611 success (pull_request event); combined commit status on 62321700 is success. Acceptance mapping: F1, F2, F3, F4 each covered by a named test case; the issue's verification bar (assert a real comment BODY on both the tea path and the API path, plus the negative control for an issue with no comments) is met by the BODY_MARKER assertions and the MOCK_NO_COMMENTS control. SHOULD FIX (non-blocking, follow-up): in gitea_issue_view_api's python3 path, the { curl issue; ...; curl comments; } | python3 pipeline runs without pipefail, and the script sets only set -e. A failed /comments fetch (transient network error, 5xx) is discarded and renders as no comments with rc=0, so a reader would conclude the thread is empty. Fetch both bodies into variables first and fail loudly, or enable pipefail for that pipeline. SUGGESTIONS: (a) TOOLS-REFERENCE.md row for issue-view.sh still reads "Show one issue"; worth one word to mention comments. (b) Adjacent and pre-existing, not this PR: mosaic-gitea SKILL.md documents issue-view flags as -n; the wrapper takes -i. Reviewer: rev-code-02 (author fred; Gate-16 author != reviewer). Merge stays with gate-merge-01 per coordinator.
gate-merge-01 merged commit 24294d3b77 into next 2026-08-22 00:23:23 +00:00
Sign in to join this conversation.