Delete stale HTML/ copy — HTMLTemplates.swift is the template source of truth (#434) - #452
Conversation
…f truth (#434) Tyler's ruling on #434: option 1 — delete the stale copy. The HTML/ directory was excluded from the build, 28 diff hunks behind the compiled templates, and last touched (#350) one day before #349 hand-edited the "generated" file it supposedly generated. - Delete Sources/XCTestHTMLReportCore/HTML/ and the Package.swift exclude. - Replace the false DO NOT EDIT header (createTemplates.sh was deleted in #295) with one declaring the file the hand-maintained source of truth. - Keep both lint exemptions with corrected justifications (see PR). - Fix .githooks/pre-commit: SwiftLint ignores the config excluded: list for explicitly passed paths, so the first-ever staged edit to HTMLTemplates.swift failed the hook on rules the config exempts; add --force-exclude to match CI behavior. Zero rendered-output change: only the header comment changed in HTMLTemplates.swift. Full suite 100/100 (2 pre-existing skips), incl. DifferentialTests 6/6 and ReproducibilityTests 7/7. Co-Authored-By: Claude Fable 5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR removes standalone HTML template resources, keeps template markup in ChangesTemplate source consolidation
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to The PR removes an unused stale template copy, corrects documentation and commit-hook behavior, and reports no rendered-output change; no actionable merge-blocking risk remains after normal checks and review. Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
… fix) When HTMLTemplates.swift is the only staged Swift file, --force-exclude leaves SwiftLint zero lintable paths and it exits 1 with "No lintable files found", so the hook still blocked exactly the template-only commits #434 set out to unblock. Treat that specific outcome as success: zero lintable files means zero possible violations, so it cannot mask a real lint failure. Any other nonzero exit still fails the hook. Verified in a scratch worktree: HTMLTemplates.swift-only staging exits 0; a staged 259-char-line Swift file still fails (alone and alongside the excluded file); non-Swift-only staging exits 0. shellcheck clean. Co-Authored-By: Claude Fable 5 <[email protected]>
Fixes #434.
Of the three options in #434, this takes option 1 — delete the stale
HTML/copy (Tyler's call): smallest change, makesHTMLTemplates.swifthonestly the single source of truth, and removes the trap before the 4.0 report redesign (#439) starts from the wrong file.What changed
Sources/XCTestHTMLReportCore/HTML/(12 files). It was excluded from the build (Package.swiftexclude: ["HTML"]), 28 diff hunks behind the compiled templates, and last touched in 2024 (Lazy load video and everything else #350) — one day before Support mixed children test types in test suites #349 hand-edited the "generated" file it supposedly generated. Verified nothing references it: the only build-level reference was thePackage.swiftexclude entry itself, now removed. All other repo matches for the filenames are coincidental (the report's outputindex.html, thetext/htmlMIME type, comments naming templates conceptually).HTMLTemplates.swift. It claimedDO NOT EDIT! This file is autogenerated by createTemplates.sh, but that script was deleted in remove ruby & thor tasks #295 and nothing has regenerated the file since. The header now states what is true: this file is the hand-maintained source of truth for the report's markup, styles, and scripts, and is edited directly..githooks/pre-commitso the SwiftLint exemption actually holds at commit time. The hook passes staged paths to SwiftLint explicitly, and SwiftLint ignores the config'sexcluded:list for explicitly passed paths unless given--force-exclude. Nobody had staged an edit toHTMLTemplates.swiftsince the hook existed, so this never fired — this PR's header edit was the first, and the hook failed with 15line_lengtherrors (2.5k–107k-char lines),file_length, andtype_body_length, all on lines the config exempts. One flag (--force-exclude) brings the hook in line with CI, which lints from the repo root and has always honored the exclusion. And because SwiftLint exits nonzero withNo lintable files foundwhen every staged Swift file is excluded — exactly the template-only commits this PR unblocks; caught in review — the hook treats that specific outcome as success: zero lintable files means zero possible violations, so it cannot mask a real failure. Any other nonzero exit still fails the hook. The hook's comment claiming SwiftLint applies config exclusions to explicit paths was corrected too.HTMLTemplates.swiftis the two-line header comment; no template string changes.The two lint exemptions: KEEP, with corrected justifications
Both
.swiftformatand.swiftlint.ymlexemptedHTMLTemplates.swifton the premise that it is generated. That premise is false, so each exemption was re-decided on its actual merits:.swiftformat— KEEP. Dry-running SwiftFormat on the file with the exclusion removed rewrites ~2,300 lines (2,293 with SwiftFormat 0.62.1; the exact count is SwiftFormat-version-dependent): it re-indents every multiline string literal body from the file's 2-space base to the repo's 4-space style, moves the closing"""delimiters (which changes how much leading whitespace Swift strips — i.e. potentially the bytes of every rendered report), and convertsstruct HTMLTemplatesto anenum. The existing comment's technical rationale was already correct; only its "generated" premise sentence was wrong. The comment now leads with "hand-maintained"..swiftlint.yml— KEEP. With the exclusion removed, 15 lines exceed theline_lengtherror threshold (200 chars) — long embedded HTML lines that no formatter can wrap — plusfile_length(1226 lines) andtype_body_length(1206 lines) violations that are intrinsic to a file of embedded templates. The alternatives (inlineswiftlint:disableannotations scattered through template strings, or raising repo-wide thresholds) are both worse than one config exclusion. The comment now states the real reason instead of "Generated (carries a DO NOT EDIT header)".Docs check
docs/superpowers/specs/2026-08-10-xcresulttool-legacy-migration-design.mdanddocs/superpowers/plans/2026-08-10-xcresulttool-legacy-migration.mdmention the stale copy — as dated design records describing the problem and stating the source-of-truth question "must first settle" before the redesign. This PR is that settlement; the records stay accurate as history and need no edits.Verification
swift buildgreen with the directory deleted and theexcludeentry removed../prepareTestResults.sh. Re-ran the output-sensitive suites explicitly: DifferentialTests 6/6, ReproducibilityTests 7/7 — zero rendered-output change confirmed.swiftformat --lint .: 0/71 files require formatting.swiftlint: exit 0 (pre-existing warnings only)..githooks/pre-commitverified in both directions in a scratch worktree: onlyHTMLTemplates.swiftstaged (whitespace edit) → exit 0; a Swift file with a deliberate 259-char line staged → exit 1 with the violation reported (also exit 1 when staged alongsideHTMLTemplates.swift, so the excluded file cannot shield others); only a non-Swift file staged → exit 0.shellcheckon the edited hook: clean.🤖 Generated with Claude Code
Summary by CodeRabbit