WIP: fix(forge): show issue attachments in view #300

Draft
monsterlag wants to merge 1 commit from monsterlag/Longshot:fix/forge-issue-attachments into main
First-time contributor

Why

Contributors reading an issue through forge.py issue view cannot see its attached diagnostic logs. The issue API already returns their names and links, but the CLI drops them, so a report can appear to have no log even when one is attached.

What changed

  • scripts/forge.py, cmd_issue: list the issue's existing attachment metadata after its body and before optional comments. Include the name, byte size and download link; make no additional request.
  • tests/test_forge_pr.py: five game-free cases cover multiple/zero-byte files, unchanged no-attachment output, comments and exact request counts, display-control escaping and Unicode names in a cp1252 pipe. Existing network guards remain active.
  • docs/forge.md: document the output. Names are JSON-quoted, including Unicode escapes, so the added rows stay lossless in Windows pipes; URL control characters are escaped too.

Flags and settings

None.

Measurements

main: 514591a30d (2026-11-13)
this PR: fix/forge-issue-attachments @ d39f01dd9d
Hardware: Ryzen 7 9800X3D, 96 GiB RAM, Windows 11 build 26300, native Python 3.14.7. No GPU used by this check.
Scene: five authored CLI cases with a mocked API; live issue 278 for metadata-only verification. No game scene.
Method: two sequential interleaved main/PR runs of the same five new regression cases, then two interleaved live CLI pairs on the same PC. Tests ran against the exact source files committed here. Live calls use -X utf8 for the existing title/body encoding problem covered by PR120; the new rows independently pass a cp1252-pipe case.
How to reproduce: run the five PR.test_issue_view_* methods in tests/test_forge_pr.py; for main, use the same new tests with main's scripts/forge.py. Run python -X utf8 -I -B scripts/forge.py issue view 278 on both checkouts. The command reads issue metadata, never attachment content.

Check main @ 514591a3 this PR @ d39f01dd
New regression cases not passing, run 1 / run 2 4 / 4 of 5 (3 failures, 1 error each) 0 / 0 of 5
Median cases not passing 4 0
Live issue 278 attachment rows, run 1 / run 2 0 / 0 2 / 2
Median live attachment rows 0 2
main, each regression run: cases 5, failures 3, errors 1
this PR, each regression run: cases 5, failures 0, errors 0
main live CLI, each run: exit 0, attachment rows 0
this PR live CLI, each run: exit 0, attachment rows 2

Attachments:
  "longshot_log.txt" (13712 bytes): https://git.magicbean.dev/attachments/3ea47eeb-f712-4feb-9961-60c209b393e9
  "longshot_log.1.txt" (10985 bytes): https://git.magicbean.dev/attachments/9e2be9cc-ccb3-47ff-bbd3-ceb1dbdfd0df

Those live sizes/links were observed on 2026-11-13. No speed improvement is claimed.
The new tests assert one issue GET without comments and the existing second GET when comments are requested;
the network guards reject any attempt to fetch attachment content.

Testing

Tested: native Windows focused CLI group; the two regression and live pairs above; independent read-only review. Full python -I -B tests/run_all.py --jobs 8: 497 passed, 3 failed, 33 skipped in 137 s. The three failing check groups also fail on untouched main 514591a3 in a fresh focused run: test_check_third_party.py (ignored-file handling, PR80/255), test_release.py (Windows fixtures, PR119/145/255) and test_menu_i18n.py (stale Debug-tools help, PR273/255). No assertion was weakened and no skip was added. git diff --check passes.

Not tested: live CLI on Linux/macOS. This metadata-only CLI change does not run in the game. Attachment content and access permissions were not tested or changed: the separate download route returned HTTP403 during triage, and was stopped. PR/comment attachment listings and the pre-existing title/body encoding defect are outside this diff.

Needs other testers: None for this metadata display fix.

Screenshots

The CLI output is shown in Measurements.

Risk and rollback

The visible change is an extra section on issues with attachments; names use JSON quoting so control characters cannot add terminal rows. No attachment request, upload or execution is introduced. Reverting this commit restores the old display.

Reviewer notes

Coordination: this PR is WIP because PR298 implements the same issue listing and adds comment attachments. Do not merge both unchanged. PR298 has a requested-changes review for reproduced cp1252/control-output gaps; the safe formatter and regression coverage here are available for consolidation. Keep this branch/evidence until an equivalent replacement is verified. The measurements below still describe unchanged commit d39f01dd.

Start at cmd_issue. The new rows come from the same issue GET already used by this command. The tests assert its exact calls and keep the existing no-network guards. This is separate from PR254's picture uploads and PR120's output-stream setup.

Issues

Fixes #289

Checklist

For everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description).
  • Rebased on current main.
  • python -I -B tests/run_all.py run and passing (any failure that also fails on main is named above).
  • Tested in the game, or what wasn't is named under Testing.
  • Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests).
  • Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported.
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

If applicable

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.
## Why Contributors reading an issue through `forge.py issue view` cannot see its attached diagnostic logs. The issue API already returns their names and links, but the CLI drops them, so a report can appear to have no log even when one is attached. ## What changed - `scripts/forge.py`, `cmd_issue`: list the issue's existing attachment metadata after its body and before optional comments. Include the name, byte size and download link; make no additional request. - `tests/test_forge_pr.py`: five game-free cases cover multiple/zero-byte files, unchanged no-attachment output, comments and exact request counts, display-control escaping and Unicode names in a cp1252 pipe. Existing network guards remain active. - `docs/forge.md`: document the output. Names are JSON-quoted, including Unicode escapes, so the added rows stay lossless in Windows pipes; URL control characters are escaped too. ## Flags and settings None. ## Measurements main: 514591a30d707fe9f3ad31eae148c3cc1e750bff (2026-11-13) this PR: fix/forge-issue-attachments @ d39f01dd9da9b3d24a3fb1c127ed49794b7f64c4 Hardware: Ryzen 7 9800X3D, 96 GiB RAM, Windows 11 build 26300, native Python 3.14.7. No GPU used by this check. Scene: five authored CLI cases with a mocked API; live issue 278 for metadata-only verification. No game scene. Method: two sequential interleaved main/PR runs of the same five new regression cases, then two interleaved live CLI pairs on the same PC. Tests ran against the exact source files committed here. Live calls use `-X utf8` for the existing title/body encoding problem covered by PR120; the new rows independently pass a cp1252-pipe case. How to reproduce: run the five `PR.test_issue_view_*` methods in `tests/test_forge_pr.py`; for main, use the same new tests with main's `scripts/forge.py`. Run `python -X utf8 -I -B scripts/forge.py issue view 278` on both checkouts. The command reads issue metadata, never attachment content. | Check | main @ 514591a3 | this PR @ d39f01dd | |---|---|---| | New regression cases not passing, run 1 / run 2 | 4 / 4 of 5 (3 failures, 1 error each) | 0 / 0 of 5 | | Median cases not passing | 4 | 0 | | Live issue 278 attachment rows, run 1 / run 2 | 0 / 0 | 2 / 2 | | Median live attachment rows | 0 | 2 | ```text main, each regression run: cases 5, failures 3, errors 1 this PR, each regression run: cases 5, failures 0, errors 0 main live CLI, each run: exit 0, attachment rows 0 this PR live CLI, each run: exit 0, attachment rows 2 Attachments: "longshot_log.txt" (13712 bytes): https://git.magicbean.dev/attachments/3ea47eeb-f712-4feb-9961-60c209b393e9 "longshot_log.1.txt" (10985 bytes): https://git.magicbean.dev/attachments/9e2be9cc-ccb3-47ff-bbd3-ceb1dbdfd0df ``` Those live sizes/links were observed on 2026-11-13. No speed improvement is claimed. The new tests assert one issue GET without comments and the existing second GET when comments are requested; the network guards reject any attempt to fetch attachment content. ## Testing **Tested:** native Windows focused CLI group; the two regression and live pairs above; independent read-only review. Full `python -I -B tests/run_all.py --jobs 8`: **497 passed, 3 failed, 33 skipped in 137 s**. The three failing check groups also fail on untouched main 514591a3 in a fresh focused run: `test_check_third_party.py` (ignored-file handling, PR80/255), `test_release.py` (Windows fixtures, PR119/145/255) and `test_menu_i18n.py` (stale Debug-tools help, PR273/255). No assertion was weakened and no skip was added. `git diff --check` passes. **Not tested:** live CLI on Linux/macOS. This metadata-only CLI change does not run in the game. Attachment content and access permissions were not tested or changed: the separate download route returned HTTP403 during triage, and was stopped. PR/comment attachment listings and the pre-existing title/body encoding defect are outside this diff. **Needs other testers:** None for this metadata display fix. ## Screenshots The CLI output is shown in Measurements. ## Risk and rollback The visible change is an extra section on issues with attachments; names use JSON quoting so control characters cannot add terminal rows. No attachment request, upload or execution is introduced. Reverting this commit restores the old display. ## Reviewer notes Coordination: this PR is WIP because PR298 implements the same issue listing and adds comment attachments. Do not merge both unchanged. PR298 has a requested-changes review for reproduced cp1252/control-output gaps; the safe formatter and regression coverage here are available for consolidation. Keep this branch/evidence until an equivalent replacement is verified. The measurements below still describe unchanged commit d39f01dd. Start at `cmd_issue`. The new rows come from the same issue GET already used by this command. The tests assert its exact calls and keep the existing no-network guards. This is separate from PR254's picture uploads and PR120's output-stream setup. ## Issues Fixes #289 ## Checklist ### For everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`). - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` run and passing (any failure that also fails on `main` is named above). - [x] Tested in the game, or what wasn't is named under Testing. - [x] Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests). - [x] Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### If applicable - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated.
fix(forge): show issue attachments in view
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
d39f01dd9d
List the existing issue response's attachment metadata so diagnostic logs
can be found from the CLI. Preserve no-attachment output and comments,
escape display controls, and keep attachment content access separate.

Assisted-by: OpenAI Codex
Co-Authored-By: OpenAI Codex <[email protected]>
monsterlag changed title from WIP: fix(forge): show issue attachments in view to fix(forge): show issue attachments in view 2026-11-13 20:29:56 +00:00
monsterlag changed title from fix(forge): show issue attachments in view to WIP: fix(forge): show issue attachments in view 2026-11-13 21:18:56 +00:00
Author
First-time contributor

Returned to WIP to consolidate overlapping issue289 work into broader PR298 once its reproduced Unicode-pipe/control-output gaps are fixed (review15190). My branch d39f01dd and its regression evidence remain available; do not merge both unchanged. No code or measurements changed.

Returned to WIP to consolidate overlapping issue289 work into broader PR298 once its reproduced Unicode-pipe/control-output gaps are fixed (review15190). My branch d39f01dd and its regression evidence remain available; do not merge both unchanged. No code or measurements changed.
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
This pull request has changes conflicting with the target branch.
  • tests/test_forge_pr.py
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/forge-issue-attachments:monsterlag-fix/forge-issue-attachments'
git switch 'monsterlag-fix/forge-issue-attachments'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!300
No description provided.