Skip to content

fix: resolve reports/ from the scripts, not the cwd - #38

Merged
katodea merged 2 commits into
trunkfrom
fix/reports-dir
Sep 22, 2026
Merged

katodea merged 2 commits into
trunkfrom
fix/reports-dir

Conversation

@katodea

@katodea katodea commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

what

  • scripts/run-qa-report.sh
    • drops mkdir -p ./reports — the generator creates its own reportsDir, so this only ever left a stray folder in a foreign cwd
    • the json argument is required and prints usage; its default reports/data/qa-report.json was dead (no skill writes that name)
  • scripts/merge-qa-reports.sh
    • input defaults resolve from KOSH_REPORTS_DIR, else reports/ next to the script's real directory (pwd -P, so symlinks agree with the generator's __dirname)
    • reads the html path back from the generator's HTML report generated: line instead of rebuilding it from ./reports + a copy of the slug rule
    • trap 'rm -f "$MERGED_JSON"' EXIT replaces three rm lines and covers the set -e exit that leaked the temp file when the generator failed
  • scripts/generate-report.js — the input argument is required; its default was the same dead qa-report.json
  • tests/reports-dir.test.js — runs both scripts from a foreign cwd
  • CLAUDE.md states the rule and that KOSH_REPORTS_DIR redirects scripts only, not where skills write; docs/getting-started.md says why to stay in the kosh folder

why

the generator, the stamp script and the hook already agreed that reports/ lives next to scripts/. the two shell scripts had their own ./reports, which only matched because the documented launch is cd kosh && claude --plugin-dir .. under KOSH_REPORTS_DIR or any other cwd, merge-qa-reports.sh rendered the report and then exited 1:

Error: Report file was not generated

because it was looking at its own rebuilt path. run-qa-report.sh was subtler — it worked, but left an empty reports/ wherever you ran it from. the upcoming refactor's portability conventions need one answer to "where is reports/?": scripts resolve from their own location, skills stay cwd-relative, the cwd must be the plugin root.

co-authored by claude fable 5.1 🧭

@katodea katodea self-assigned this Sep 22, 2026
@t51eng-poseidon

Copy link
Copy Markdown

🔱 Poseidon started reviewing this PR — central run.

@t51eng-poseidon t51eng-poseidon Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔱 Poseidon Review

Summary — Resolves reports/ from each script's own location instead of the cwd, drops the dead default-JSON arguments and the redundant mkdir blocks, and adds a foreign-cwd regression test; low risk, no issues found on this pass.

Walkthrough

  • ♻️ Refactor — merge-qa-reports.sh and generate-report.js now resolve inputs/outputs from $SCRIPT_DIR (or KOSH_REPORTS_DIR), and merge reads the HTML path back from the generator's HTML report generated: line rather than rebuilding it with a copy of the slug rule.
  • 🐛 Fix — merge-qa-reports.sh no longer renders and then exits 1 under a foreign cwd; a single trap 'rm -f "$MERGED_JSON"' EXIT replaces the three scattered rm lines and covers the set -e leak.
  • 🧪 Tests — new tests/reports-dir.test.js runs both shell scripts from a sibling cwd and asserts the HTML/archive land under the reports dir and nothing leaks into the cwd.
  • 📝 Docs — CLAUDE.md and docs/getting-started.md document the "scripts resolve from their own dir, skills stay cwd-relative, KOSH_REPORTS_DIR redirects scripts only" rule.

ℹ️ Review info
  • Commit: a150411
  • Files reviewed: CLAUDE.md, docs/getting-started.md, scripts/generate-report.js, scripts/merge-qa-reports.sh, scripts/run-qa-report.sh, tests/reports-dir.test.js
  • Files skipped: none
  • Model: claude-opus-4-8

@katodea
katodea merged commit bdb0bab into trunk Sep 22, 2026
3 checks passed
@katodea
katodea deleted the fix/reports-dir branch September 22, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant