Repository navigation
fix(build): detect orphaned compiled tests before building - #5647
seekskyworld wants to merge 3 commits into
Conversation
Generated-by: OpenAI Codex Signed-off-by: seekskyworld <djh1813553759@gmail.com>
Generated-by: OpenAI Codex Signed-off-by: seekskyworld <djh1813553759@gmail.com>
hqhq1025
left a comment
There was a problem hiding this comment.
Reviewed the current six-file root prebuild scanner for orphan compiled test artifacts and its tests. I found no substantiated P0–P3 issue attributable to this change; the four focused scanner tests and diff check pass. This is not ready to merge: the current-head required test check is failing in an unchanged storage artifact-writer-lock concurrency test (PR attribution remains unproven), and this branch conflicts with main. Please resolve the conflict and investigate/rerun the required check before merge. I did not run the full test suite or validate every build artifact layout.
Automated review notice: This comment was posted by an automated review agent operated by hqhq1025. It is not an independent human review and does not replace one.
me2seeks
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent operated by me2seeks make. It is not an independent human review and does not replace one.
Summary
Adds a root prebuild guard that fails the build when dist/**/*.test.{js,jsx,mjs,cjs} has no matching source under src/, with docs and a CI lane. The issue is real — incremental tsc never deletes outputs for removed sources, and test:dist then runs ghost tests. The solution is minimal (detect + direct to npm run rebuild rather than deleting), workspaces are explicit paths (package.json:16-30), Desktop's nested dist/main/__tests__ layout and .d.ts/.map siblings are correctly handled, and the npm-lifecycle test would fail if the hook were dropped.
Findings
- [P2] The
testlane is red on the current head (run 35902091783): storage testbundle export excludes a mutation queued behind the same child-held writer lock. The body claims it is unrelated to this build-tooling change — plausible, but it must be re-run green or demonstrated to fail on unmodifiedmainbefore merge. - No code-level findings. The check correctly no-ops on unbuilt checkouts, skips symlinked entries, keeps module-specific extension mapping (
mjs→mts/mjs,cjs→cts/cjs), and its mutation coverage is real (removing theprebuildhook fails the lifecycle regression).
Verdict
needs-discussion — code is merge-ready, but the failing test lane on head needs a green re-run or proof of pre-existing failure.
Generated-by: OpenAI Codex Signed-off-by: seekskyworld <djh1813553759@gmail.com>
|
Synced main 2463d86 and resolved the workflow/contributor-guide conflicts in 0c3316e. The unchanged artifact-writer-lock test file now passes 10/10 locally, including the previously failing export case. Build/typecheck/lint/format, both knip gates, ASF headers, and 90 guard/planner/workflow tests pass. The new push requests fresh required CI; the previous red run has not been relabelled as successful. Automated update by OpenAI Codex under the contributor’s direction. |
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
Incremental review from 0e34d7ee (previously reviewed, no P0–P3) to 0c3316eb. The update is only a merge of main (2463d86c); git range-diff shows both author commits unchanged.
Merge resolution (git show --remerge-diff): three conflicts, all resolved correctly. In .github/workflows/ci.yml, the Test CI planner list keeps both this PR's scripts/check-orphaned-test-output.test.mjs and main's scripts/install-electron-with-retry.test.mjs. In CONTRIBUTING.md and CONTRIBUTING.zh-CN.md, main's new dev:worktree paragraph is kept, followed by the build paragraph with this PR's npm run rebuild sentence. No other content was lost or added.
Prior findings / blockers: the branch conflict with main is resolved. The earlier red test (unchanged storage artifact-writer-lock concurrency test) does not recur: "Run affected standard workspace tests" passes on this head. In the Build step, node scripts/check-orphaned-test-output.mjs runs and passes against the merged tree.
New findings: none.
CI / mergeability: MERGEABLE/BLOCKED. audit, owner (macOS, Windows), package, and package-linux pass. test is red. The only failing step is Storybook smoke: settings-pages.stories.tsx:2835 (product-settings-pages--usage-long-tail / --usage-narrow) reports "expected 168.03125 to be less than or equal to 168". That is a known main-side sub-pixel flake in the Usage time-cell width check. This PR does not touch that story or the Settings Usage surface, so it is not PR-caused. Main's latest CI run skipped Storybook, so it cannot serve as a direct comparison. A rerun is needed for a green required gate.
Summary
After a test source is removed or renamed, incremental TypeScript builds leave its compiled copy in
dist, andtest:diststill runs it. Rootnpm run buildnow detects these orphaned tests before compiling, lists their paths, and directs contributors tonpm run rebuild, which clears both output and incremental state.The check preserves normal incremental builds and does not delete individual compiler outputs. It covers the repository's
src→distlayouts, including Desktop's nested main tests and UI TSX tests. Contributor guidance and CI regression coverage are included.Fixes #5641
Verification
npm run check:releasepasses all 203 release-contract tests; 19 focused guard/file-policy tests pass. The first hosted run identified fixture paths that looked like real workspace references; the fixture namespace was corrected in the follow-up commit and the revised tests pass in CI.Current validation (2026-10-10)
Merged main
2463d86c3, preserving both the new Electron installer CI test and orphan guard, plus the worktree-development documentation. All conflicts are resolved in0c3316eb0.artifact-writer-lockfile passes 10/10, including the same child-held writer-lock export case that failed in the older hosted run. No lock assertions or production storage code were changed.Hosted check
The older run 35902091783 failed in the storage lock test; attribution to this PR was not established. A fresh run is requested by the main-sync push and is pending. The earlier result is not treated as green on the strength of a local rerun.
AI use
Tool(s) and scope: OpenAI Codex inspected the issue, implemented and tested the build guard, and drafted this description under human direction.
Checklist
Does this PR entail a change in behavior?
Hosted CI update (2026-10-12): run 38037653011 failed in the unchanged Usage Storybook
usage-long-tail/usage-narrowwidth assertion (168.03125 <= 168). The failure remains unresolved; this PR does not change that surface. Automated status update by OpenAI Codex.