diff --git a/apps/desktop/oxfmt.config.ts b/apps/desktop/oxfmt.config.ts index 1fb3df91..b76bc44c 100644 --- a/apps/desktop/oxfmt.config.ts +++ b/apps/desktop/oxfmt.config.ts @@ -9,5 +9,9 @@ export default defineConfig({ "**/src-host/**", "**/assets/**/*.json", "**/artifacts/**", + // Build outputs are gitignored but not written by hand: `oxfmt --check .` walks the tree, so + // leaving them out formats the bundled renderer (tens of MB) on every lint run. + "**/dist/**", + "**/build/**", ], }); diff --git a/docs/sdlc/changes/2026-09-16-lint-ignore-build-output/intent.md b/docs/sdlc/changes/2026-09-16-lint-ignore-build-output/intent.md new file mode 100644 index 00000000..b8c04c45 --- /dev/null +++ b/docs/sdlc/changes/2026-09-16-lint-ignore-build-output/intent.md @@ -0,0 +1,42 @@ +--- +id: 2026-09-16-lint-ignore-build-output +schema: 5 +stage: intent +status: accepted +owner: chenli +created: 2026-09-16 +source: user +risk: low +approved_by: chenli +approved_at: 2026-09-16 +approval_source: "Direct request: pr, answering the offer to fix the lint hang caused by build output." +next_trigger: chenli reviews the verified work. +--- + +# Intent: Keep the lint run away from build output + +## Intent + +`bun run lint` (`ultracite check`) hangs or crashes whenever `apps/desktop/dist/` exists. The dev +watcher rebuilds that directory on every source edit, so the failure appears at random during +ordinary development: the run burns CPU for minutes and then reports an error over the bundled +renderer's embedded xterm banner. + +Cause, verified on the live checkout: ultracite runs `oxlint .` and `oxfmt --check .`; `oxlint` +honours this repo's `ignorePatterns` (`dist/**`, `build/**`, `artifacts/**`, `node_modules/**`) and +finishes in seconds, while `apps/desktop/oxfmt.config.ts` only ignores `src-tauri/gen`, `src-host`, +asset JSON and `artifacts`. So the formatter walks the ~48 MB bundled renderer (including a 5 MB +vendor bundle) on every lint run. + +Outcome: `bun run lint` and `bun run build:renderer` stay fast and green whether or not a build +output directory exists. + +Constraints: the ignore list grows only by the project's own build directories; no rule, file list, +or formatting behaviour changes for maintained source. + +Non-goals: changing what ultracite checks, adding a lint configuration, or removing build output +cleanup from any script. + +## Non-goals + +No new lint rule, no change to the maintained file set, and no product code. diff --git a/docs/sdlc/changes/2026-09-16-lint-ignore-build-output/plan.md b/docs/sdlc/changes/2026-09-16-lint-ignore-build-output/plan.md new file mode 100644 index 00000000..a9d4348b --- /dev/null +++ b/docs/sdlc/changes/2026-09-16-lint-ignore-build-output/plan.md @@ -0,0 +1,26 @@ +--- +id: 2026-09-16-lint-ignore-build-output +schema: 5 +stage: plan +status: accepted +owner: chenli +created: 2026-09-16 +based_on: spec.md +scope: apps/desktop/oxfmt.config.ts, docs/sdlc/changes/2026-09-16-lint-ignore-build-output +--- + +# Plan: Keep the lint run away from build output + +## Plan + +1. `apps/desktop/oxfmt.config.ts` — add `**/dist/**` and `**/build/**` to `ignorePatterns` with the + reason in a comment. (AC-1, AC-3) +2. Reproduce the state the watcher leaves behind (`apps/desktop/dist/` present) and run the two + affected commands: `bun run lint` and `bun run build:renderer`. (AC-1, AC-2) +3. Confirm the maintained verdict is unchanged by running the same pair again after the fix and + comparing with the earlier passing runs in this session. + +Temporary resources: the ignored `apps/desktop/dist/` output that `build:renderer` recreates is +removed before handoff; no other scratch is created. + +Rollback: revert the two added lines; no source, script, or rule depends on them. diff --git a/docs/sdlc/changes/2026-09-16-lint-ignore-build-output/spec.md b/docs/sdlc/changes/2026-09-16-lint-ignore-build-output/spec.md new file mode 100644 index 00000000..b9cfa31b --- /dev/null +++ b/docs/sdlc/changes/2026-09-16-lint-ignore-build-output/spec.md @@ -0,0 +1,27 @@ +--- +id: 2026-09-16-lint-ignore-build-output +schema: 5 +stage: spec +status: accepted +owner: chenli +created: 2026-09-16 +based_on: intent.md +--- + +# Spec: Keep the lint run away from build output + +## Design + +`apps/desktop/oxfmt.config.ts` gains two ignore patterns beside the ones it already carries: +`**/dist/**` (the renderer build output, including the `dist-web` web build) and `**/build/**` (the +Electrobun app bundle tree). The comment beside them records why: the formatter walks the tree, so +an unignored bundle of tens of megabytes is formatted on every lint run. `oxlint.config.ts` already +ignores the same directories and is unchanged. + +## Acceptance criteria + +- [x] AC-1: With `apps/desktop/dist/` present, `bun run lint` finishes in seconds and reports the + maintained files only. +- [x] AC-2: `bun run build:renderer` (lint + tsc + vite build) passes with a previous `dist/` + present, which is the state the dev watcher leaves behind. +- [x] AC-3: No maintained source file's formatting verdict changes. diff --git a/docs/sdlc/changes/2026-09-16-lint-ignore-build-output/verification.md b/docs/sdlc/changes/2026-09-16-lint-ignore-build-output/verification.md new file mode 100644 index 00000000..40c12829 --- /dev/null +++ b/docs/sdlc/changes/2026-09-16-lint-ignore-build-output/verification.md @@ -0,0 +1,48 @@ +--- +id: 2026-09-16-lint-ignore-build-output +schema: 5 +stage: verification +status: passed +owner: chenli +created: 2026-09-16 +based_on: plan.md +revision: "833ecb8b (main) with the lint-ignore-build-output change applied" +verification_mode: owner +verified_by: chenli +verified_at: 2026-09-16 +release_target: none +cleanup_status: complete +--- + +# Verification: Keep the lint run away from build output + +## Verification + +- AC-1: PASS — With `apps/desktop/dist/` present (48 MB, including the 5 MB vendor bundle), `bun run lint` finished in 8.8 s and reported `All matched files use the correct format.` on 515 files. Before the change the same command with that directory present never returned: three attempts hit the agent's tool timeouts (300 s, 420 s, 600 s) while `oxlint`/`oxfmt` burned a core. +- AC-2: PASS — `bun run build:renderer` (lint, then `tsc --noEmit`, then the Vite build) completed with a previous `dist/` present: `All matched files use the correct format.` followed by `✓ built in 24.04s`, 39.6 s wall including the bundle. +- AC-3: PASS — The maintained verdict is unchanged from the earlier clean-tree runs in this session: `ultracite check src tests` reports `All matched files use the correct format.` on 475 files, and the full `bun run lint` reports the same on 515. + +Verdict: verified. +Residual risk: the two ignored directories are the project's own gitignored outputs; a future build +directory with another name would need its own pattern. `oxfmt` still spends a few seconds walking +the ignored tree (8.8 s versus the 0.2 s clean-tree run), which is acceptable and far cheaper than +formatting the bundle. + +## Cleanup + +Removed: the ignored `apps/desktop/dist/` output recreated for the AC-2 check. +Retained: none. +Processes: none started or left behind; the user's dev window and the other worktrees' servers were +not touched. +Evidence: `git status --porcelain` lists only the config file plus this record bundle after cleanup. + +## Review and release + +Approval: the fix and its PR were requested directly by the user (pr); merge and release are not +authorized. +Rollback: See plan.md. +Release: No release requested; merge and external actions require their own authorization. +Review: [PR #240](https://github.com/IchenDEV/codeTwo/pull/240) carries this change on branch +t3code/lint-ignore-build-output, based on main 833ecb8b; the hosted CI Validate job passed (run +35086020084, job 104760912876, 2m58s). +Feedback: Link an Incident and regression Eval when a real failure occurs.