style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415) - #1122

Merged
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline
Jul 19, 2026
Merged

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415)#1122
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline

Conversation

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
Contributor

The formatter follow-up promised in #1019 — one atomic PR, structured for a merge moment of your choosing. Closes the formatter half of #415.

Structure (3 commits)

  1. Config + gate — formatter config restored in biome.jsonc (2-space / 100-col / single quotes / semicolons / trailing commas), format + format:check scripts, and npm run format:check in the CI typecheck job (right after lint, before build).
  2. Baseline — mechanical biome format --write to fixpoint: 805 files, zero logic changes. This is the commit to point .git-blame-ignore-revs at.
  3. .git-blame-ignore-revs — carries the baseline commit's branch hash. ⚠️ If you squash/rebase-merge, the hash changes; the file has the one-liner to regenerate it (git log --oneline --grep 'Biome format baseline' -1) — happy to push the corrected hash post-merge instead if you prefer merge-commit-off.

⚠️ The discovery you should weigh in on: apps/desktop is formatter-excluded

Running the baseline over the whole tree broke 145 assertions across 64 desktop test files. Desktop has a pervasive source-contract test style — tests read .ts/.tsx source and regex-match exact single-line shapes (e.g. account-auth-ui.test.ts matches a full <div className=... aria-label=...> line). Any reformat — Biome's or a future hand edit — snaps them.

Rather than scattering ~145 // biome-ignore format: comments through desktop source (which would exempt much of desktop from the formatter this PR introduces — self-defeating), this PR excludes apps/desktop/** from the formatter only (it stays fully linted), and defers desktop to a follow-up. Options for that follow-up, your call:

  • (a) Make the source-contract assertions whitespace-tolerant first, then format desktop. Two shared helpers (main-process-contract-source-helpers.js, 20 files; provider-contract-source-helpers.js, 6 files) could centralize normalization, but many exact-spacing regexes are inline per test — non-trivial.
  • (b) Keep desktop formatter-excluded long-term and accept the split.
  • (c) Treat the source-contract style itself as the issue (they're fragile against any edit, not just Biome) and migrate them to AST-based checks — bigger conversation.

Outside desktop, the same class of problem existed at small scale and IS handled in the baseline: 5 statements carry a // biome-ignore format: guard — two @ts-expect-error directives that must stay adjacent to the line they suppress (proxy-test.ts, run-trace.ts — splitting the statement orphans the directive: TS2578 + the suppressed error resurfaces) and three single-line shapes asserted by source-contract tests (run-prompt-ab.mjs, run-prompt-optimization.mjs, run-harness-ab.mjs).

Also excluded (byte-sensitive, not hand-authored): apps/desktop/resources/licenses/** (SOURCE.json is whole-file SHA-256'd + size-checked by prepare-cua-driver.mjs) and bundled-tools.json.

Verification

  • npm run lint ✅ and npm run format:check ✅ (formatter run to fixpoint — Biome's formatter isn't idempotent on some multi-line generic signatures, so one extra pass was needed)
  • npm run build ✅, npm run typecheck
  • Full npm test: scripts 109, core 1067, storage 287, runtime 1983, computer-use 135, desktop (untouched) all green; headless 1063/1067 with only the 2 known-flaky opencode stop runner subtests (fail identically on unmodified main, pass in isolation)

Merge timing

Touches ~805 files, so it conflicts with most open PRs — merge whenever suits; I'll rebase + re-run the baseline to fixpoint on request the same day you want it landed (regenerating is cheap and deterministic, ~1 min).

Heads-up per the #1019 thread: biome lint --write --unsafe still hangs on apps/desktop (~100% CPU indefinitely; plain format is fine) — upstream minimization still on my list, tracked separately from this PR.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

CI's test failure was real and informative — fixed and force-pushed.

Root cause: desktop's source-contract tests don't only introspect desktop's own source — ~45 contracts read packages/ui source too (composer.tsx, daily-review-panel.tsx, primitives/*.tsx, …), and packages/ui was in the baseline. So the exclusion boundary isn't "apps/desktop", it's the whole UI surface.

Also owning a verification gap on my side: locally npm test short-circuits at the 2 known-flaky headless subtests (the script chains suites with &&), so the desktop/ui suites never actually ran after my rebase — I've re-verified per-suite explicitly this time.

Changes in the force-push:

  • Formatter now excludes apps/desktop/**andpackages/ui/** (both still fully linted); baseline shrinks 805 → 660 files (packages/ui's 142 reverted, byte-identical to main).
  • .git-blame-ignore-revs updated to the new baseline hash.

Verified: npm run lint ✅, npm run format:check ✅ (fixpoint), build ✅, typecheck ✅, and explicitly: @maka/ui ✅, @maka/desktop ✅ (2,571 tests), @maka/storage ✅.

This also sharpens the follow-up question: the source-contract web spans the whole UI surface (desktop + ui, 190+ single-line assertions), so making those contracts format-tolerant (or AST-based) is the real gate for ever formatting UI code — option (a)/(c) from the PR description.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved.

Non-blocking P3 follow-up: this repository squash-merges PRs, so the branch-only baseline hash in .git-blame-ignore-revs will not exist in a fresh clone after merge; git blame configured with the file then exits with "cannot find revision ... to ignore". Please remove the branch hash before merge and add the resulting squash commit hash in a follow-up, or otherwise update the entry immediately after merge.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

Done — went with your first option. The branch hash is removed from .git-blame-ignore-revs before merge; the file now ships as documentation/scaffold only, with a note that entries must be hashes that exist on main (you're right that a hash unknown to the clone makes git blame hard-error, not just no-op — stricter than my original in-file note assumed). I'll open the one-line follow-up adding the squash-commit hash immediately after this lands.

One operational note: GitHub hasn't been starting CI runs on my last few pushes to this branch ("no checks reported", no check-suites on the head SHA — not the fork-approval gate). The commits are content-identical to the previously verified tree apart from the .git-blame-ignore-revs text change, and everything is verified locally (lint / format:check fixpoint / build / typecheck / per-suite tests including desktop's 2,571). If checks stay absent on your side, a close/reopen should kick a fresh pull_request event — or happy to try anything else you prefer.

@Astro-Han

Copy link
Copy Markdown
Contributor

LGTM, but there is a lot of rebase to be done.

@likun666661likun666661 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but there is a lot of rebase to be done.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

已在最新 main(8b9d69a)上重建整个基线(force-push,a385f96b)。全仓机械格式化 PR 的 rebase 策略是重新生成而非解决 660 文件的文本冲突:配置 commit 重放 → 重新跑 biome format(750 文件)→ 补 ignore-revs 脚手架(占位设计不变)。

重建中发现并处理了两个机械格式化的实际危害(已写进基线 commit message):

  1. proxy-test.ts@ts-expect-error 因 fetch 调用被拆行而错位(build 失败)→ 指令移到它压制的属性行;
  2. Biome 对两个文件的首遍输出不满足自身 format:check(非幂等边界)→ 二遍收敛;
  3. 一个源码契约测试(tool-runtime-extraction-contract)把 RunTracePhase 联合钉成单行字面量 → 改为对格式容忍的正则(契约是变体集合,不是排版)。

验证:format:check / lint / build / typecheck 干净,全套件通过——唯一失败是 session-title.test.js 的「aborts title generation when the provider exceeds its deadline」,它在 pristine origin/main 上同样失败(#1199 引入,套件内稳定挂、单文件跑通过,cancelledByParent 挂起类),与本 PR 无关,另行报告。

陆逊 added 4 commits July 19, 2026 12:58
…che#415)
Follow-up to apache#1019, which introduced the linter but deliberately left the
formatter out. Restores the formatter config (2-space, 100-col, single
quotes, semicolons, trailing commas — matching dominant existing style),
adds `format` (write) / `format:check` scripts, and a `npm run
format:check` CI step in the typecheck job.
Formatter-scoped exclusions (all still fully linted):
- apps/desktop/** and packages/ui/**: the UI surface's source-contract
tests read .ts/.tsx source (desktop's own and packages/ui's) and
regex-match exact single-line shapes; a whole-tree reformat broke 145
desktop-source assertions plus ~45 contracts introspecting packages/ui.
UI-surface formatting lands as a follow-up once those contract tests
are format-tolerant.
- Byte-sensitive provenance artifacts (SOURCE.json is SHA-256'd and
size-checked by scripts/prepare-cua-driver.mjs) and bundled-tools.json.
The mechanical baseline reformat is the next commit; the check gate goes
green only with both included.
Regenerated on top of current main (the previous baseline commit was 90
commits stale and conflicting; a whole-repo mechanical reformat is
rebased by re-running the formatter, not by resolving 660 files of
textual conflicts). Same scope as before: biome.json excludes the
apps/desktop UI surface.
Two adjustments the reformat itself required: a @ts-expect-error in
proxy-test.ts moved onto the property line it suppresses (the reformat
split the fetch call, displacing the directive), and a second formatter
pass over two files where Biome's first pass is not idempotent.
@likun666661
likun666661force-pushed the chore/formatter-baseline branch from fc6899b to 3be9261CompareJuly 19, 2026 05:01
@likun666661
likun666661 merged commit d0407f7 into apache:mainJul 19, 2026
2 of 3 checks passed
@UncertaintyDeterminesYou4ndMe
UncertaintyDeterminesYou4ndMe deleted the chore/formatter-baseline branch July 19, 2026 05:04
Sign up for freeto 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.

3 participants

@UncertaintyDeterminesYou4ndMe@Astro-Han@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415) - #1122

Merged
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline
Jul 19, 2026
Merged

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415)#1122
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline

Conversation

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
Contributor

The formatter follow-up promised in #1019 — one atomic PR, structured for a merge moment of your choosing. Closes the formatter half of #415.

Structure (3 commits)

  1. Config + gate — formatter config restored in biome.jsonc (2-space / 100-col / single quotes / semicolons / trailing commas), format + format:check scripts, and npm run format:check in the CI typecheck job (right after lint, before build).
  2. Baseline — mechanical biome format --write to fixpoint: 805 files, zero logic changes. This is the commit to point .git-blame-ignore-revs at.
  3. .git-blame-ignore-revs — carries the baseline commit's branch hash. ⚠️ If you squash/rebase-merge, the hash changes; the file has the one-liner to regenerate it (git log --oneline --grep 'Biome format baseline' -1) — happy to push the corrected hash post-merge instead if you prefer merge-commit-off.

⚠️ The discovery you should weigh in on: apps/desktop is formatter-excluded

Running the baseline over the whole tree broke 145 assertions across 64 desktop test files. Desktop has a pervasive source-contract test style — tests read .ts/.tsx source and regex-match exact single-line shapes (e.g. account-auth-ui.test.ts matches a full <div className=... aria-label=...> line). Any reformat — Biome's or a future hand edit — snaps them.

Rather than scattering ~145 // biome-ignore format: comments through desktop source (which would exempt much of desktop from the formatter this PR introduces — self-defeating), this PR excludes apps/desktop/** from the formatter only (it stays fully linted), and defers desktop to a follow-up. Options for that follow-up, your call:

  • (a) Make the source-contract assertions whitespace-tolerant first, then format desktop. Two shared helpers (main-process-contract-source-helpers.js, 20 files; provider-contract-source-helpers.js, 6 files) could centralize normalization, but many exact-spacing regexes are inline per test — non-trivial.
  • (b) Keep desktop formatter-excluded long-term and accept the split.
  • (c) Treat the source-contract style itself as the issue (they're fragile against any edit, not just Biome) and migrate them to AST-based checks — bigger conversation.

Outside desktop, the same class of problem existed at small scale and IS handled in the baseline: 5 statements carry a // biome-ignore format: guard — two @ts-expect-error directives that must stay adjacent to the line they suppress (proxy-test.ts, run-trace.ts — splitting the statement orphans the directive: TS2578 + the suppressed error resurfaces) and three single-line shapes asserted by source-contract tests (run-prompt-ab.mjs, run-prompt-optimization.mjs, run-harness-ab.mjs).

Also excluded (byte-sensitive, not hand-authored): apps/desktop/resources/licenses/** (SOURCE.json is whole-file SHA-256'd + size-checked by prepare-cua-driver.mjs) and bundled-tools.json.

Verification

  • npm run lint ✅ and npm run format:check ✅ (formatter run to fixpoint — Biome's formatter isn't idempotent on some multi-line generic signatures, so one extra pass was needed)
  • npm run build ✅, npm run typecheck
  • Full npm test: scripts 109, core 1067, storage 287, runtime 1983, computer-use 135, desktop (untouched) all green; headless 1063/1067 with only the 2 known-flaky opencode stop runner subtests (fail identically on unmodified main, pass in isolation)

Merge timing

Touches ~805 files, so it conflicts with most open PRs — merge whenever suits; I'll rebase + re-run the baseline to fixpoint on request the same day you want it landed (regenerating is cheap and deterministic, ~1 min).

Heads-up per the #1019 thread: biome lint --write --unsafe still hangs on apps/desktop (~100% CPU indefinitely; plain format is fine) — upstream minimization still on my list, tracked separately from this PR.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

CI's test failure was real and informative — fixed and force-pushed.

Root cause: desktop's source-contract tests don't only introspect desktop's own source — ~45 contracts read packages/ui source too (composer.tsx, daily-review-panel.tsx, primitives/*.tsx, …), and packages/ui was in the baseline. So the exclusion boundary isn't "apps/desktop", it's the whole UI surface.

Also owning a verification gap on my side: locally npm test short-circuits at the 2 known-flaky headless subtests (the script chains suites with &&), so the desktop/ui suites never actually ran after my rebase — I've re-verified per-suite explicitly this time.

Changes in the force-push:

  • Formatter now excludes apps/desktop/**andpackages/ui/** (both still fully linted); baseline shrinks 805 → 660 files (packages/ui's 142 reverted, byte-identical to main).
  • .git-blame-ignore-revs updated to the new baseline hash.

Verified: npm run lint ✅, npm run format:check ✅ (fixpoint), build ✅, typecheck ✅, and explicitly: @maka/ui ✅, @maka/desktop ✅ (2,571 tests), @maka/storage ✅.

This also sharpens the follow-up question: the source-contract web spans the whole UI surface (desktop + ui, 190+ single-line assertions), so making those contracts format-tolerant (or AST-based) is the real gate for ever formatting UI code — option (a)/(c) from the PR description.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved.

Non-blocking P3 follow-up: this repository squash-merges PRs, so the branch-only baseline hash in .git-blame-ignore-revs will not exist in a fresh clone after merge; git blame configured with the file then exits with "cannot find revision ... to ignore". Please remove the branch hash before merge and add the resulting squash commit hash in a follow-up, or otherwise update the entry immediately after merge.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

Done — went with your first option. The branch hash is removed from .git-blame-ignore-revs before merge; the file now ships as documentation/scaffold only, with a note that entries must be hashes that exist on main (you're right that a hash unknown to the clone makes git blame hard-error, not just no-op — stricter than my original in-file note assumed). I'll open the one-line follow-up adding the squash-commit hash immediately after this lands.

One operational note: GitHub hasn't been starting CI runs on my last few pushes to this branch ("no checks reported", no check-suites on the head SHA — not the fork-approval gate). The commits are content-identical to the previously verified tree apart from the .git-blame-ignore-revs text change, and everything is verified locally (lint / format:check fixpoint / build / typecheck / per-suite tests including desktop's 2,571). If checks stay absent on your side, a close/reopen should kick a fresh pull_request event — or happy to try anything else you prefer.

@Astro-Han

Copy link
Copy Markdown
Contributor

LGTM, but there is a lot of rebase to be done.

@likun666661likun666661 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but there is a lot of rebase to be done.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

已在最新 main(8b9d69a)上重建整个基线(force-push,a385f96b)。全仓机械格式化 PR 的 rebase 策略是重新生成而非解决 660 文件的文本冲突:配置 commit 重放 → 重新跑 biome format(750 文件)→ 补 ignore-revs 脚手架(占位设计不变)。

重建中发现并处理了两个机械格式化的实际危害(已写进基线 commit message):

  1. proxy-test.ts@ts-expect-error 因 fetch 调用被拆行而错位(build 失败)→ 指令移到它压制的属性行;
  2. Biome 对两个文件的首遍输出不满足自身 format:check(非幂等边界)→ 二遍收敛;
  3. 一个源码契约测试(tool-runtime-extraction-contract)把 RunTracePhase 联合钉成单行字面量 → 改为对格式容忍的正则(契约是变体集合,不是排版)。

验证:format:check / lint / build / typecheck 干净,全套件通过——唯一失败是 session-title.test.js 的「aborts title generation when the provider exceeds its deadline」,它在 pristine origin/main 上同样失败(#1199 引入,套件内稳定挂、单文件跑通过,cancelledByParent 挂起类),与本 PR 无关,另行报告。

陆逊 added 4 commits July 19, 2026 12:58
…che#415)
Follow-up to apache#1019, which introduced the linter but deliberately left the
formatter out. Restores the formatter config (2-space, 100-col, single
quotes, semicolons, trailing commas — matching dominant existing style),
adds `format` (write) / `format:check` scripts, and a `npm run
format:check` CI step in the typecheck job.
Formatter-scoped exclusions (all still fully linted):
- apps/desktop/** and packages/ui/**: the UI surface's source-contract
tests read .ts/.tsx source (desktop's own and packages/ui's) and
regex-match exact single-line shapes; a whole-tree reformat broke 145
desktop-source assertions plus ~45 contracts introspecting packages/ui.
UI-surface formatting lands as a follow-up once those contract tests
are format-tolerant.
- Byte-sensitive provenance artifacts (SOURCE.json is SHA-256'd and
size-checked by scripts/prepare-cua-driver.mjs) and bundled-tools.json.
The mechanical baseline reformat is the next commit; the check gate goes
green only with both included.
Regenerated on top of current main (the previous baseline commit was 90
commits stale and conflicting; a whole-repo mechanical reformat is
rebased by re-running the formatter, not by resolving 660 files of
textual conflicts). Same scope as before: biome.json excludes the
apps/desktop UI surface.
Two adjustments the reformat itself required: a @ts-expect-error in
proxy-test.ts moved onto the property line it suppresses (the reformat
split the fetch call, displacing the directive), and a second formatter
pass over two files where Biome's first pass is not idempotent.
@likun666661
likun666661force-pushed the chore/formatter-baseline branch from fc6899b to 3be9261CompareJuly 19, 2026 05:01
@likun666661
likun666661 merged commit d0407f7 into apache:mainJul 19, 2026
2 of 3 checks passed
@UncertaintyDeterminesYou4ndMe
UncertaintyDeterminesYou4ndMe deleted the chore/formatter-baseline branch July 19, 2026 05:04
Sign up for freeto 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.

3 participants

@UncertaintyDeterminesYou4ndMe@Astro-Han@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415) - #1122

Merged
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline
Jul 19, 2026
Merged

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415)#1122
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline

Conversation

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
Contributor

The formatter follow-up promised in #1019 — one atomic PR, structured for a merge moment of your choosing. Closes the formatter half of #415.

Structure (3 commits)

  1. Config + gate — formatter config restored in biome.jsonc (2-space / 100-col / single quotes / semicolons / trailing commas), format + format:check scripts, and npm run format:check in the CI typecheck job (right after lint, before build).
  2. Baseline — mechanical biome format --write to fixpoint: 805 files, zero logic changes. This is the commit to point .git-blame-ignore-revs at.
  3. .git-blame-ignore-revs — carries the baseline commit's branch hash. ⚠️ If you squash/rebase-merge, the hash changes; the file has the one-liner to regenerate it (git log --oneline --grep 'Biome format baseline' -1) — happy to push the corrected hash post-merge instead if you prefer merge-commit-off.

⚠️ The discovery you should weigh in on: apps/desktop is formatter-excluded

Running the baseline over the whole tree broke 145 assertions across 64 desktop test files. Desktop has a pervasive source-contract test style — tests read .ts/.tsx source and regex-match exact single-line shapes (e.g. account-auth-ui.test.ts matches a full <div className=... aria-label=...> line). Any reformat — Biome's or a future hand edit — snaps them.

Rather than scattering ~145 // biome-ignore format: comments through desktop source (which would exempt much of desktop from the formatter this PR introduces — self-defeating), this PR excludes apps/desktop/** from the formatter only (it stays fully linted), and defers desktop to a follow-up. Options for that follow-up, your call:

  • (a) Make the source-contract assertions whitespace-tolerant first, then format desktop. Two shared helpers (main-process-contract-source-helpers.js, 20 files; provider-contract-source-helpers.js, 6 files) could centralize normalization, but many exact-spacing regexes are inline per test — non-trivial.
  • (b) Keep desktop formatter-excluded long-term and accept the split.
  • (c) Treat the source-contract style itself as the issue (they're fragile against any edit, not just Biome) and migrate them to AST-based checks — bigger conversation.

Outside desktop, the same class of problem existed at small scale and IS handled in the baseline: 5 statements carry a // biome-ignore format: guard — two @ts-expect-error directives that must stay adjacent to the line they suppress (proxy-test.ts, run-trace.ts — splitting the statement orphans the directive: TS2578 + the suppressed error resurfaces) and three single-line shapes asserted by source-contract tests (run-prompt-ab.mjs, run-prompt-optimization.mjs, run-harness-ab.mjs).

Also excluded (byte-sensitive, not hand-authored): apps/desktop/resources/licenses/** (SOURCE.json is whole-file SHA-256'd + size-checked by prepare-cua-driver.mjs) and bundled-tools.json.

Verification

  • npm run lint ✅ and npm run format:check ✅ (formatter run to fixpoint — Biome's formatter isn't idempotent on some multi-line generic signatures, so one extra pass was needed)
  • npm run build ✅, npm run typecheck
  • Full npm test: scripts 109, core 1067, storage 287, runtime 1983, computer-use 135, desktop (untouched) all green; headless 1063/1067 with only the 2 known-flaky opencode stop runner subtests (fail identically on unmodified main, pass in isolation)

Merge timing

Touches ~805 files, so it conflicts with most open PRs — merge whenever suits; I'll rebase + re-run the baseline to fixpoint on request the same day you want it landed (regenerating is cheap and deterministic, ~1 min).

Heads-up per the #1019 thread: biome lint --write --unsafe still hangs on apps/desktop (~100% CPU indefinitely; plain format is fine) — upstream minimization still on my list, tracked separately from this PR.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

CI's test failure was real and informative — fixed and force-pushed.

Root cause: desktop's source-contract tests don't only introspect desktop's own source — ~45 contracts read packages/ui source too (composer.tsx, daily-review-panel.tsx, primitives/*.tsx, …), and packages/ui was in the baseline. So the exclusion boundary isn't "apps/desktop", it's the whole UI surface.

Also owning a verification gap on my side: locally npm test short-circuits at the 2 known-flaky headless subtests (the script chains suites with &&), so the desktop/ui suites never actually ran after my rebase — I've re-verified per-suite explicitly this time.

Changes in the force-push:

  • Formatter now excludes apps/desktop/**andpackages/ui/** (both still fully linted); baseline shrinks 805 → 660 files (packages/ui's 142 reverted, byte-identical to main).
  • .git-blame-ignore-revs updated to the new baseline hash.

Verified: npm run lint ✅, npm run format:check ✅ (fixpoint), build ✅, typecheck ✅, and explicitly: @maka/ui ✅, @maka/desktop ✅ (2,571 tests), @maka/storage ✅.

This also sharpens the follow-up question: the source-contract web spans the whole UI surface (desktop + ui, 190+ single-line assertions), so making those contracts format-tolerant (or AST-based) is the real gate for ever formatting UI code — option (a)/(c) from the PR description.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved.

Non-blocking P3 follow-up: this repository squash-merges PRs, so the branch-only baseline hash in .git-blame-ignore-revs will not exist in a fresh clone after merge; git blame configured with the file then exits with "cannot find revision ... to ignore". Please remove the branch hash before merge and add the resulting squash commit hash in a follow-up, or otherwise update the entry immediately after merge.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

Done — went with your first option. The branch hash is removed from .git-blame-ignore-revs before merge; the file now ships as documentation/scaffold only, with a note that entries must be hashes that exist on main (you're right that a hash unknown to the clone makes git blame hard-error, not just no-op — stricter than my original in-file note assumed). I'll open the one-line follow-up adding the squash-commit hash immediately after this lands.

One operational note: GitHub hasn't been starting CI runs on my last few pushes to this branch ("no checks reported", no check-suites on the head SHA — not the fork-approval gate). The commits are content-identical to the previously verified tree apart from the .git-blame-ignore-revs text change, and everything is verified locally (lint / format:check fixpoint / build / typecheck / per-suite tests including desktop's 2,571). If checks stay absent on your side, a close/reopen should kick a fresh pull_request event — or happy to try anything else you prefer.

@Astro-Han

Copy link
Copy Markdown
Contributor

LGTM, but there is a lot of rebase to be done.

@likun666661likun666661 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but there is a lot of rebase to be done.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

已在最新 main(8b9d69a)上重建整个基线(force-push,a385f96b)。全仓机械格式化 PR 的 rebase 策略是重新生成而非解决 660 文件的文本冲突:配置 commit 重放 → 重新跑 biome format(750 文件)→ 补 ignore-revs 脚手架(占位设计不变)。

重建中发现并处理了两个机械格式化的实际危害(已写进基线 commit message):

  1. proxy-test.ts@ts-expect-error 因 fetch 调用被拆行而错位(build 失败)→ 指令移到它压制的属性行;
  2. Biome 对两个文件的首遍输出不满足自身 format:check(非幂等边界)→ 二遍收敛;
  3. 一个源码契约测试(tool-runtime-extraction-contract)把 RunTracePhase 联合钉成单行字面量 → 改为对格式容忍的正则(契约是变体集合,不是排版)。

验证:format:check / lint / build / typecheck 干净,全套件通过——唯一失败是 session-title.test.js 的「aborts title generation when the provider exceeds its deadline」,它在 pristine origin/main 上同样失败(#1199 引入,套件内稳定挂、单文件跑通过,cancelledByParent 挂起类),与本 PR 无关,另行报告。

陆逊 added 4 commits July 19, 2026 12:58
…che#415)
Follow-up to apache#1019, which introduced the linter but deliberately left the
formatter out. Restores the formatter config (2-space, 100-col, single
quotes, semicolons, trailing commas — matching dominant existing style),
adds `format` (write) / `format:check` scripts, and a `npm run
format:check` CI step in the typecheck job.
Formatter-scoped exclusions (all still fully linted):
- apps/desktop/** and packages/ui/**: the UI surface's source-contract
tests read .ts/.tsx source (desktop's own and packages/ui's) and
regex-match exact single-line shapes; a whole-tree reformat broke 145
desktop-source assertions plus ~45 contracts introspecting packages/ui.
UI-surface formatting lands as a follow-up once those contract tests
are format-tolerant.
- Byte-sensitive provenance artifacts (SOURCE.json is SHA-256'd and
size-checked by scripts/prepare-cua-driver.mjs) and bundled-tools.json.
The mechanical baseline reformat is the next commit; the check gate goes
green only with both included.
Regenerated on top of current main (the previous baseline commit was 90
commits stale and conflicting; a whole-repo mechanical reformat is
rebased by re-running the formatter, not by resolving 660 files of
textual conflicts). Same scope as before: biome.json excludes the
apps/desktop UI surface.
Two adjustments the reformat itself required: a @ts-expect-error in
proxy-test.ts moved onto the property line it suppresses (the reformat
split the fetch call, displacing the directive), and a second formatter
pass over two files where Biome's first pass is not idempotent.
@likun666661
likun666661force-pushed the chore/formatter-baseline branch from fc6899b to 3be9261CompareJuly 19, 2026 05:01
@likun666661
likun666661 merged commit d0407f7 into apache:mainJul 19, 2026
2 of 3 checks passed
@UncertaintyDeterminesYou4ndMe
UncertaintyDeterminesYou4ndMe deleted the chore/formatter-baseline branch July 19, 2026 05:04
Sign up for freeto 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.

3 participants

@UncertaintyDeterminesYou4ndMe@Astro-Han@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415) - #1122

Merged
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline
Jul 19, 2026
Merged

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415)#1122
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline

Conversation

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
Contributor

The formatter follow-up promised in #1019 — one atomic PR, structured for a merge moment of your choosing. Closes the formatter half of #415.

Structure (3 commits)

  1. Config + gate — formatter config restored in biome.jsonc (2-space / 100-col / single quotes / semicolons / trailing commas), format + format:check scripts, and npm run format:check in the CI typecheck job (right after lint, before build).
  2. Baseline — mechanical biome format --write to fixpoint: 805 files, zero logic changes. This is the commit to point .git-blame-ignore-revs at.
  3. .git-blame-ignore-revs — carries the baseline commit's branch hash. ⚠️ If you squash/rebase-merge, the hash changes; the file has the one-liner to regenerate it (git log --oneline --grep 'Biome format baseline' -1) — happy to push the corrected hash post-merge instead if you prefer merge-commit-off.

⚠️ The discovery you should weigh in on: apps/desktop is formatter-excluded

Running the baseline over the whole tree broke 145 assertions across 64 desktop test files. Desktop has a pervasive source-contract test style — tests read .ts/.tsx source and regex-match exact single-line shapes (e.g. account-auth-ui.test.ts matches a full <div className=... aria-label=...> line). Any reformat — Biome's or a future hand edit — snaps them.

Rather than scattering ~145 // biome-ignore format: comments through desktop source (which would exempt much of desktop from the formatter this PR introduces — self-defeating), this PR excludes apps/desktop/** from the formatter only (it stays fully linted), and defers desktop to a follow-up. Options for that follow-up, your call:

  • (a) Make the source-contract assertions whitespace-tolerant first, then format desktop. Two shared helpers (main-process-contract-source-helpers.js, 20 files; provider-contract-source-helpers.js, 6 files) could centralize normalization, but many exact-spacing regexes are inline per test — non-trivial.
  • (b) Keep desktop formatter-excluded long-term and accept the split.
  • (c) Treat the source-contract style itself as the issue (they're fragile against any edit, not just Biome) and migrate them to AST-based checks — bigger conversation.

Outside desktop, the same class of problem existed at small scale and IS handled in the baseline: 5 statements carry a // biome-ignore format: guard — two @ts-expect-error directives that must stay adjacent to the line they suppress (proxy-test.ts, run-trace.ts — splitting the statement orphans the directive: TS2578 + the suppressed error resurfaces) and three single-line shapes asserted by source-contract tests (run-prompt-ab.mjs, run-prompt-optimization.mjs, run-harness-ab.mjs).

Also excluded (byte-sensitive, not hand-authored): apps/desktop/resources/licenses/** (SOURCE.json is whole-file SHA-256'd + size-checked by prepare-cua-driver.mjs) and bundled-tools.json.

Verification

  • npm run lint ✅ and npm run format:check ✅ (formatter run to fixpoint — Biome's formatter isn't idempotent on some multi-line generic signatures, so one extra pass was needed)
  • npm run build ✅, npm run typecheck
  • Full npm test: scripts 109, core 1067, storage 287, runtime 1983, computer-use 135, desktop (untouched) all green; headless 1063/1067 with only the 2 known-flaky opencode stop runner subtests (fail identically on unmodified main, pass in isolation)

Merge timing

Touches ~805 files, so it conflicts with most open PRs — merge whenever suits; I'll rebase + re-run the baseline to fixpoint on request the same day you want it landed (regenerating is cheap and deterministic, ~1 min).

Heads-up per the #1019 thread: biome lint --write --unsafe still hangs on apps/desktop (~100% CPU indefinitely; plain format is fine) — upstream minimization still on my list, tracked separately from this PR.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

CI's test failure was real and informative — fixed and force-pushed.

Root cause: desktop's source-contract tests don't only introspect desktop's own source — ~45 contracts read packages/ui source too (composer.tsx, daily-review-panel.tsx, primitives/*.tsx, …), and packages/ui was in the baseline. So the exclusion boundary isn't "apps/desktop", it's the whole UI surface.

Also owning a verification gap on my side: locally npm test short-circuits at the 2 known-flaky headless subtests (the script chains suites with &&), so the desktop/ui suites never actually ran after my rebase — I've re-verified per-suite explicitly this time.

Changes in the force-push:

  • Formatter now excludes apps/desktop/**andpackages/ui/** (both still fully linted); baseline shrinks 805 → 660 files (packages/ui's 142 reverted, byte-identical to main).
  • .git-blame-ignore-revs updated to the new baseline hash.

Verified: npm run lint ✅, npm run format:check ✅ (fixpoint), build ✅, typecheck ✅, and explicitly: @maka/ui ✅, @maka/desktop ✅ (2,571 tests), @maka/storage ✅.

This also sharpens the follow-up question: the source-contract web spans the whole UI surface (desktop + ui, 190+ single-line assertions), so making those contracts format-tolerant (or AST-based) is the real gate for ever formatting UI code — option (a)/(c) from the PR description.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved.

Non-blocking P3 follow-up: this repository squash-merges PRs, so the branch-only baseline hash in .git-blame-ignore-revs will not exist in a fresh clone after merge; git blame configured with the file then exits with "cannot find revision ... to ignore". Please remove the branch hash before merge and add the resulting squash commit hash in a follow-up, or otherwise update the entry immediately after merge.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

Done — went with your first option. The branch hash is removed from .git-blame-ignore-revs before merge; the file now ships as documentation/scaffold only, with a note that entries must be hashes that exist on main (you're right that a hash unknown to the clone makes git blame hard-error, not just no-op — stricter than my original in-file note assumed). I'll open the one-line follow-up adding the squash-commit hash immediately after this lands.

One operational note: GitHub hasn't been starting CI runs on my last few pushes to this branch ("no checks reported", no check-suites on the head SHA — not the fork-approval gate). The commits are content-identical to the previously verified tree apart from the .git-blame-ignore-revs text change, and everything is verified locally (lint / format:check fixpoint / build / typecheck / per-suite tests including desktop's 2,571). If checks stay absent on your side, a close/reopen should kick a fresh pull_request event — or happy to try anything else you prefer.

@Astro-Han

Copy link
Copy Markdown
Contributor

LGTM, but there is a lot of rebase to be done.

@likun666661likun666661 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but there is a lot of rebase to be done.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

已在最新 main(8b9d69a)上重建整个基线(force-push,a385f96b)。全仓机械格式化 PR 的 rebase 策略是重新生成而非解决 660 文件的文本冲突:配置 commit 重放 → 重新跑 biome format(750 文件)→ 补 ignore-revs 脚手架(占位设计不变)。

重建中发现并处理了两个机械格式化的实际危害(已写进基线 commit message):

  1. proxy-test.ts@ts-expect-error 因 fetch 调用被拆行而错位(build 失败)→ 指令移到它压制的属性行;
  2. Biome 对两个文件的首遍输出不满足自身 format:check(非幂等边界)→ 二遍收敛;
  3. 一个源码契约测试(tool-runtime-extraction-contract)把 RunTracePhase 联合钉成单行字面量 → 改为对格式容忍的正则(契约是变体集合,不是排版)。

验证:format:check / lint / build / typecheck 干净,全套件通过——唯一失败是 session-title.test.js 的「aborts title generation when the provider exceeds its deadline」,它在 pristine origin/main 上同样失败(#1199 引入,套件内稳定挂、单文件跑通过,cancelledByParent 挂起类),与本 PR 无关,另行报告。

陆逊 added 4 commits July 19, 2026 12:58
…che#415)
Follow-up to apache#1019, which introduced the linter but deliberately left the
formatter out. Restores the formatter config (2-space, 100-col, single
quotes, semicolons, trailing commas — matching dominant existing style),
adds `format` (write) / `format:check` scripts, and a `npm run
format:check` CI step in the typecheck job.
Formatter-scoped exclusions (all still fully linted):
- apps/desktop/** and packages/ui/**: the UI surface's source-contract
tests read .ts/.tsx source (desktop's own and packages/ui's) and
regex-match exact single-line shapes; a whole-tree reformat broke 145
desktop-source assertions plus ~45 contracts introspecting packages/ui.
UI-surface formatting lands as a follow-up once those contract tests
are format-tolerant.
- Byte-sensitive provenance artifacts (SOURCE.json is SHA-256'd and
size-checked by scripts/prepare-cua-driver.mjs) and bundled-tools.json.
The mechanical baseline reformat is the next commit; the check gate goes
green only with both included.
Regenerated on top of current main (the previous baseline commit was 90
commits stale and conflicting; a whole-repo mechanical reformat is
rebased by re-running the formatter, not by resolving 660 files of
textual conflicts). Same scope as before: biome.json excludes the
apps/desktop UI surface.
Two adjustments the reformat itself required: a @ts-expect-error in
proxy-test.ts moved onto the property line it suppresses (the reformat
split the fetch call, displacing the directive), and a second formatter
pass over two files where Biome's first pass is not idempotent.
@likun666661
likun666661force-pushed the chore/formatter-baseline branch from fc6899b to 3be9261CompareJuly 19, 2026 05:01
@likun666661
likun666661 merged commit d0407f7 into apache:mainJul 19, 2026
2 of 3 checks passed
@UncertaintyDeterminesYou4ndMe
UncertaintyDeterminesYou4ndMe deleted the chore/formatter-baseline branch July 19, 2026 05:04
Sign up for freeto 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.

3 participants

@UncertaintyDeterminesYou4ndMe@Astro-Han@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415) - #1122

Merged
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline
Jul 19, 2026
Merged

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415)#1122
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline

Conversation

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
Contributor

The formatter follow-up promised in #1019 — one atomic PR, structured for a merge moment of your choosing. Closes the formatter half of #415.

Structure (3 commits)

  1. Config + gate — formatter config restored in biome.jsonc (2-space / 100-col / single quotes / semicolons / trailing commas), format + format:check scripts, and npm run format:check in the CI typecheck job (right after lint, before build).
  2. Baseline — mechanical biome format --write to fixpoint: 805 files, zero logic changes. This is the commit to point .git-blame-ignore-revs at.
  3. .git-blame-ignore-revs — carries the baseline commit's branch hash. ⚠️ If you squash/rebase-merge, the hash changes; the file has the one-liner to regenerate it (git log --oneline --grep 'Biome format baseline' -1) — happy to push the corrected hash post-merge instead if you prefer merge-commit-off.

⚠️ The discovery you should weigh in on: apps/desktop is formatter-excluded

Running the baseline over the whole tree broke 145 assertions across 64 desktop test files. Desktop has a pervasive source-contract test style — tests read .ts/.tsx source and regex-match exact single-line shapes (e.g. account-auth-ui.test.ts matches a full <div className=... aria-label=...> line). Any reformat — Biome's or a future hand edit — snaps them.

Rather than scattering ~145 // biome-ignore format: comments through desktop source (which would exempt much of desktop from the formatter this PR introduces — self-defeating), this PR excludes apps/desktop/** from the formatter only (it stays fully linted), and defers desktop to a follow-up. Options for that follow-up, your call:

  • (a) Make the source-contract assertions whitespace-tolerant first, then format desktop. Two shared helpers (main-process-contract-source-helpers.js, 20 files; provider-contract-source-helpers.js, 6 files) could centralize normalization, but many exact-spacing regexes are inline per test — non-trivial.
  • (b) Keep desktop formatter-excluded long-term and accept the split.
  • (c) Treat the source-contract style itself as the issue (they're fragile against any edit, not just Biome) and migrate them to AST-based checks — bigger conversation.

Outside desktop, the same class of problem existed at small scale and IS handled in the baseline: 5 statements carry a // biome-ignore format: guard — two @ts-expect-error directives that must stay adjacent to the line they suppress (proxy-test.ts, run-trace.ts — splitting the statement orphans the directive: TS2578 + the suppressed error resurfaces) and three single-line shapes asserted by source-contract tests (run-prompt-ab.mjs, run-prompt-optimization.mjs, run-harness-ab.mjs).

Also excluded (byte-sensitive, not hand-authored): apps/desktop/resources/licenses/** (SOURCE.json is whole-file SHA-256'd + size-checked by prepare-cua-driver.mjs) and bundled-tools.json.

Verification

  • npm run lint ✅ and npm run format:check ✅ (formatter run to fixpoint — Biome's formatter isn't idempotent on some multi-line generic signatures, so one extra pass was needed)
  • npm run build ✅, npm run typecheck
  • Full npm test: scripts 109, core 1067, storage 287, runtime 1983, computer-use 135, desktop (untouched) all green; headless 1063/1067 with only the 2 known-flaky opencode stop runner subtests (fail identically on unmodified main, pass in isolation)

Merge timing

Touches ~805 files, so it conflicts with most open PRs — merge whenever suits; I'll rebase + re-run the baseline to fixpoint on request the same day you want it landed (regenerating is cheap and deterministic, ~1 min).

Heads-up per the #1019 thread: biome lint --write --unsafe still hangs on apps/desktop (~100% CPU indefinitely; plain format is fine) — upstream minimization still on my list, tracked separately from this PR.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

CI's test failure was real and informative — fixed and force-pushed.

Root cause: desktop's source-contract tests don't only introspect desktop's own source — ~45 contracts read packages/ui source too (composer.tsx, daily-review-panel.tsx, primitives/*.tsx, …), and packages/ui was in the baseline. So the exclusion boundary isn't "apps/desktop", it's the whole UI surface.

Also owning a verification gap on my side: locally npm test short-circuits at the 2 known-flaky headless subtests (the script chains suites with &&), so the desktop/ui suites never actually ran after my rebase — I've re-verified per-suite explicitly this time.

Changes in the force-push:

  • Formatter now excludes apps/desktop/**andpackages/ui/** (both still fully linted); baseline shrinks 805 → 660 files (packages/ui's 142 reverted, byte-identical to main).
  • .git-blame-ignore-revs updated to the new baseline hash.

Verified: npm run lint ✅, npm run format:check ✅ (fixpoint), build ✅, typecheck ✅, and explicitly: @maka/ui ✅, @maka/desktop ✅ (2,571 tests), @maka/storage ✅.

This also sharpens the follow-up question: the source-contract web spans the whole UI surface (desktop + ui, 190+ single-line assertions), so making those contracts format-tolerant (or AST-based) is the real gate for ever formatting UI code — option (a)/(c) from the PR description.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved.

Non-blocking P3 follow-up: this repository squash-merges PRs, so the branch-only baseline hash in .git-blame-ignore-revs will not exist in a fresh clone after merge; git blame configured with the file then exits with "cannot find revision ... to ignore". Please remove the branch hash before merge and add the resulting squash commit hash in a follow-up, or otherwise update the entry immediately after merge.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

Done — went with your first option. The branch hash is removed from .git-blame-ignore-revs before merge; the file now ships as documentation/scaffold only, with a note that entries must be hashes that exist on main (you're right that a hash unknown to the clone makes git blame hard-error, not just no-op — stricter than my original in-file note assumed). I'll open the one-line follow-up adding the squash-commit hash immediately after this lands.

One operational note: GitHub hasn't been starting CI runs on my last few pushes to this branch ("no checks reported", no check-suites on the head SHA — not the fork-approval gate). The commits are content-identical to the previously verified tree apart from the .git-blame-ignore-revs text change, and everything is verified locally (lint / format:check fixpoint / build / typecheck / per-suite tests including desktop's 2,571). If checks stay absent on your side, a close/reopen should kick a fresh pull_request event — or happy to try anything else you prefer.

@Astro-Han

Copy link
Copy Markdown
Contributor

LGTM, but there is a lot of rebase to be done.

@likun666661likun666661 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but there is a lot of rebase to be done.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

已在最新 main(8b9d69a)上重建整个基线(force-push,a385f96b)。全仓机械格式化 PR 的 rebase 策略是重新生成而非解决 660 文件的文本冲突:配置 commit 重放 → 重新跑 biome format(750 文件)→ 补 ignore-revs 脚手架(占位设计不变)。

重建中发现并处理了两个机械格式化的实际危害(已写进基线 commit message):

  1. proxy-test.ts@ts-expect-error 因 fetch 调用被拆行而错位(build 失败)→ 指令移到它压制的属性行;
  2. Biome 对两个文件的首遍输出不满足自身 format:check(非幂等边界)→ 二遍收敛;
  3. 一个源码契约测试(tool-runtime-extraction-contract)把 RunTracePhase 联合钉成单行字面量 → 改为对格式容忍的正则(契约是变体集合,不是排版)。

验证:format:check / lint / build / typecheck 干净,全套件通过——唯一失败是 session-title.test.js 的「aborts title generation when the provider exceeds its deadline」,它在 pristine origin/main 上同样失败(#1199 引入,套件内稳定挂、单文件跑通过,cancelledByParent 挂起类),与本 PR 无关,另行报告。

陆逊 added 4 commits July 19, 2026 12:58
…che#415)
Follow-up to apache#1019, which introduced the linter but deliberately left the
formatter out. Restores the formatter config (2-space, 100-col, single
quotes, semicolons, trailing commas — matching dominant existing style),
adds `format` (write) / `format:check` scripts, and a `npm run
format:check` CI step in the typecheck job.
Formatter-scoped exclusions (all still fully linted):
- apps/desktop/** and packages/ui/**: the UI surface's source-contract
tests read .ts/.tsx source (desktop's own and packages/ui's) and
regex-match exact single-line shapes; a whole-tree reformat broke 145
desktop-source assertions plus ~45 contracts introspecting packages/ui.
UI-surface formatting lands as a follow-up once those contract tests
are format-tolerant.
- Byte-sensitive provenance artifacts (SOURCE.json is SHA-256'd and
size-checked by scripts/prepare-cua-driver.mjs) and bundled-tools.json.
The mechanical baseline reformat is the next commit; the check gate goes
green only with both included.
Regenerated on top of current main (the previous baseline commit was 90
commits stale and conflicting; a whole-repo mechanical reformat is
rebased by re-running the formatter, not by resolving 660 files of
textual conflicts). Same scope as before: biome.json excludes the
apps/desktop UI surface.
Two adjustments the reformat itself required: a @ts-expect-error in
proxy-test.ts moved onto the property line it suppresses (the reformat
split the fetch call, displacing the directive), and a second formatter
pass over two files where Biome's first pass is not idempotent.
@likun666661
likun666661force-pushed the chore/formatter-baseline branch from fc6899b to 3be9261CompareJuly 19, 2026 05:01
@likun666661
likun666661 merged commit d0407f7 into apache:mainJul 19, 2026
2 of 3 checks passed
@UncertaintyDeterminesYou4ndMe
UncertaintyDeterminesYou4ndMe deleted the chore/formatter-baseline branch July 19, 2026 05:04
Sign up for freeto 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.

3 participants

@UncertaintyDeterminesYou4ndMe@Astro-Han@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415) - #1122

Merged
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline
Jul 19, 2026
Merged

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415)#1122
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline

Conversation

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
Contributor

The formatter follow-up promised in #1019 — one atomic PR, structured for a merge moment of your choosing. Closes the formatter half of #415.

Structure (3 commits)

  1. Config + gate — formatter config restored in biome.jsonc (2-space / 100-col / single quotes / semicolons / trailing commas), format + format:check scripts, and npm run format:check in the CI typecheck job (right after lint, before build).
  2. Baseline — mechanical biome format --write to fixpoint: 805 files, zero logic changes. This is the commit to point .git-blame-ignore-revs at.
  3. .git-blame-ignore-revs — carries the baseline commit's branch hash. ⚠️ If you squash/rebase-merge, the hash changes; the file has the one-liner to regenerate it (git log --oneline --grep 'Biome format baseline' -1) — happy to push the corrected hash post-merge instead if you prefer merge-commit-off.

⚠️ The discovery you should weigh in on: apps/desktop is formatter-excluded

Running the baseline over the whole tree broke 145 assertions across 64 desktop test files. Desktop has a pervasive source-contract test style — tests read .ts/.tsx source and regex-match exact single-line shapes (e.g. account-auth-ui.test.ts matches a full <div className=... aria-label=...> line). Any reformat — Biome's or a future hand edit — snaps them.

Rather than scattering ~145 // biome-ignore format: comments through desktop source (which would exempt much of desktop from the formatter this PR introduces — self-defeating), this PR excludes apps/desktop/** from the formatter only (it stays fully linted), and defers desktop to a follow-up. Options for that follow-up, your call:

  • (a) Make the source-contract assertions whitespace-tolerant first, then format desktop. Two shared helpers (main-process-contract-source-helpers.js, 20 files; provider-contract-source-helpers.js, 6 files) could centralize normalization, but many exact-spacing regexes are inline per test — non-trivial.
  • (b) Keep desktop formatter-excluded long-term and accept the split.
  • (c) Treat the source-contract style itself as the issue (they're fragile against any edit, not just Biome) and migrate them to AST-based checks — bigger conversation.

Outside desktop, the same class of problem existed at small scale and IS handled in the baseline: 5 statements carry a // biome-ignore format: guard — two @ts-expect-error directives that must stay adjacent to the line they suppress (proxy-test.ts, run-trace.ts — splitting the statement orphans the directive: TS2578 + the suppressed error resurfaces) and three single-line shapes asserted by source-contract tests (run-prompt-ab.mjs, run-prompt-optimization.mjs, run-harness-ab.mjs).

Also excluded (byte-sensitive, not hand-authored): apps/desktop/resources/licenses/** (SOURCE.json is whole-file SHA-256'd + size-checked by prepare-cua-driver.mjs) and bundled-tools.json.

Verification

  • npm run lint ✅ and npm run format:check ✅ (formatter run to fixpoint — Biome's formatter isn't idempotent on some multi-line generic signatures, so one extra pass was needed)
  • npm run build ✅, npm run typecheck
  • Full npm test: scripts 109, core 1067, storage 287, runtime 1983, computer-use 135, desktop (untouched) all green; headless 1063/1067 with only the 2 known-flaky opencode stop runner subtests (fail identically on unmodified main, pass in isolation)

Merge timing

Touches ~805 files, so it conflicts with most open PRs — merge whenever suits; I'll rebase + re-run the baseline to fixpoint on request the same day you want it landed (regenerating is cheap and deterministic, ~1 min).

Heads-up per the #1019 thread: biome lint --write --unsafe still hangs on apps/desktop (~100% CPU indefinitely; plain format is fine) — upstream minimization still on my list, tracked separately from this PR.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

CI's test failure was real and informative — fixed and force-pushed.

Root cause: desktop's source-contract tests don't only introspect desktop's own source — ~45 contracts read packages/ui source too (composer.tsx, daily-review-panel.tsx, primitives/*.tsx, …), and packages/ui was in the baseline. So the exclusion boundary isn't "apps/desktop", it's the whole UI surface.

Also owning a verification gap on my side: locally npm test short-circuits at the 2 known-flaky headless subtests (the script chains suites with &&), so the desktop/ui suites never actually ran after my rebase — I've re-verified per-suite explicitly this time.

Changes in the force-push:

  • Formatter now excludes apps/desktop/**andpackages/ui/** (both still fully linted); baseline shrinks 805 → 660 files (packages/ui's 142 reverted, byte-identical to main).
  • .git-blame-ignore-revs updated to the new baseline hash.

Verified: npm run lint ✅, npm run format:check ✅ (fixpoint), build ✅, typecheck ✅, and explicitly: @maka/ui ✅, @maka/desktop ✅ (2,571 tests), @maka/storage ✅.

This also sharpens the follow-up question: the source-contract web spans the whole UI surface (desktop + ui, 190+ single-line assertions), so making those contracts format-tolerant (or AST-based) is the real gate for ever formatting UI code — option (a)/(c) from the PR description.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved.

Non-blocking P3 follow-up: this repository squash-merges PRs, so the branch-only baseline hash in .git-blame-ignore-revs will not exist in a fresh clone after merge; git blame configured with the file then exits with "cannot find revision ... to ignore". Please remove the branch hash before merge and add the resulting squash commit hash in a follow-up, or otherwise update the entry immediately after merge.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

Done — went with your first option. The branch hash is removed from .git-blame-ignore-revs before merge; the file now ships as documentation/scaffold only, with a note that entries must be hashes that exist on main (you're right that a hash unknown to the clone makes git blame hard-error, not just no-op — stricter than my original in-file note assumed). I'll open the one-line follow-up adding the squash-commit hash immediately after this lands.

One operational note: GitHub hasn't been starting CI runs on my last few pushes to this branch ("no checks reported", no check-suites on the head SHA — not the fork-approval gate). The commits are content-identical to the previously verified tree apart from the .git-blame-ignore-revs text change, and everything is verified locally (lint / format:check fixpoint / build / typecheck / per-suite tests including desktop's 2,571). If checks stay absent on your side, a close/reopen should kick a fresh pull_request event — or happy to try anything else you prefer.

@Astro-Han

Copy link
Copy Markdown
Contributor

LGTM, but there is a lot of rebase to be done.

@likun666661likun666661 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but there is a lot of rebase to be done.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

已在最新 main(8b9d69a)上重建整个基线(force-push,a385f96b)。全仓机械格式化 PR 的 rebase 策略是重新生成而非解决 660 文件的文本冲突:配置 commit 重放 → 重新跑 biome format(750 文件)→ 补 ignore-revs 脚手架(占位设计不变)。

重建中发现并处理了两个机械格式化的实际危害(已写进基线 commit message):

  1. proxy-test.ts@ts-expect-error 因 fetch 调用被拆行而错位(build 失败)→ 指令移到它压制的属性行;
  2. Biome 对两个文件的首遍输出不满足自身 format:check(非幂等边界)→ 二遍收敛;
  3. 一个源码契约测试(tool-runtime-extraction-contract)把 RunTracePhase 联合钉成单行字面量 → 改为对格式容忍的正则(契约是变体集合,不是排版)。

验证:format:check / lint / build / typecheck 干净,全套件通过——唯一失败是 session-title.test.js 的「aborts title generation when the provider exceeds its deadline」,它在 pristine origin/main 上同样失败(#1199 引入,套件内稳定挂、单文件跑通过,cancelledByParent 挂起类),与本 PR 无关,另行报告。

陆逊 added 4 commits July 19, 2026 12:58
…che#415)
Follow-up to apache#1019, which introduced the linter but deliberately left the
formatter out. Restores the formatter config (2-space, 100-col, single
quotes, semicolons, trailing commas — matching dominant existing style),
adds `format` (write) / `format:check` scripts, and a `npm run
format:check` CI step in the typecheck job.
Formatter-scoped exclusions (all still fully linted):
- apps/desktop/** and packages/ui/**: the UI surface's source-contract
tests read .ts/.tsx source (desktop's own and packages/ui's) and
regex-match exact single-line shapes; a whole-tree reformat broke 145
desktop-source assertions plus ~45 contracts introspecting packages/ui.
UI-surface formatting lands as a follow-up once those contract tests
are format-tolerant.
- Byte-sensitive provenance artifacts (SOURCE.json is SHA-256'd and
size-checked by scripts/prepare-cua-driver.mjs) and bundled-tools.json.
The mechanical baseline reformat is the next commit; the check gate goes
green only with both included.
Regenerated on top of current main (the previous baseline commit was 90
commits stale and conflicting; a whole-repo mechanical reformat is
rebased by re-running the formatter, not by resolving 660 files of
textual conflicts). Same scope as before: biome.json excludes the
apps/desktop UI surface.
Two adjustments the reformat itself required: a @ts-expect-error in
proxy-test.ts moved onto the property line it suppresses (the reformat
split the fetch call, displacing the directive), and a second formatter
pass over two files where Biome's first pass is not idempotent.
@likun666661
likun666661force-pushed the chore/formatter-baseline branch from fc6899b to 3be9261CompareJuly 19, 2026 05:01
@likun666661
likun666661 merged commit d0407f7 into apache:mainJul 19, 2026
2 of 3 checks passed
@UncertaintyDeterminesYou4ndMe
UncertaintyDeterminesYou4ndMe deleted the chore/formatter-baseline branch July 19, 2026 05:04
Sign up for freeto 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.

3 participants

@UncertaintyDeterminesYou4ndMe@Astro-Han@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415) - #1122

Merged
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline
Jul 19, 2026
Merged

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415)#1122
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline

Conversation

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
Contributor

The formatter follow-up promised in #1019 — one atomic PR, structured for a merge moment of your choosing. Closes the formatter half of #415.

Structure (3 commits)

  1. Config + gate — formatter config restored in biome.jsonc (2-space / 100-col / single quotes / semicolons / trailing commas), format + format:check scripts, and npm run format:check in the CI typecheck job (right after lint, before build).
  2. Baseline — mechanical biome format --write to fixpoint: 805 files, zero logic changes. This is the commit to point .git-blame-ignore-revs at.
  3. .git-blame-ignore-revs — carries the baseline commit's branch hash. ⚠️ If you squash/rebase-merge, the hash changes; the file has the one-liner to regenerate it (git log --oneline --grep 'Biome format baseline' -1) — happy to push the corrected hash post-merge instead if you prefer merge-commit-off.

⚠️ The discovery you should weigh in on: apps/desktop is formatter-excluded

Running the baseline over the whole tree broke 145 assertions across 64 desktop test files. Desktop has a pervasive source-contract test style — tests read .ts/.tsx source and regex-match exact single-line shapes (e.g. account-auth-ui.test.ts matches a full <div className=... aria-label=...> line). Any reformat — Biome's or a future hand edit — snaps them.

Rather than scattering ~145 // biome-ignore format: comments through desktop source (which would exempt much of desktop from the formatter this PR introduces — self-defeating), this PR excludes apps/desktop/** from the formatter only (it stays fully linted), and defers desktop to a follow-up. Options for that follow-up, your call:

  • (a) Make the source-contract assertions whitespace-tolerant first, then format desktop. Two shared helpers (main-process-contract-source-helpers.js, 20 files; provider-contract-source-helpers.js, 6 files) could centralize normalization, but many exact-spacing regexes are inline per test — non-trivial.
  • (b) Keep desktop formatter-excluded long-term and accept the split.
  • (c) Treat the source-contract style itself as the issue (they're fragile against any edit, not just Biome) and migrate them to AST-based checks — bigger conversation.

Outside desktop, the same class of problem existed at small scale and IS handled in the baseline: 5 statements carry a // biome-ignore format: guard — two @ts-expect-error directives that must stay adjacent to the line they suppress (proxy-test.ts, run-trace.ts — splitting the statement orphans the directive: TS2578 + the suppressed error resurfaces) and three single-line shapes asserted by source-contract tests (run-prompt-ab.mjs, run-prompt-optimization.mjs, run-harness-ab.mjs).

Also excluded (byte-sensitive, not hand-authored): apps/desktop/resources/licenses/** (SOURCE.json is whole-file SHA-256'd + size-checked by prepare-cua-driver.mjs) and bundled-tools.json.

Verification

  • npm run lint ✅ and npm run format:check ✅ (formatter run to fixpoint — Biome's formatter isn't idempotent on some multi-line generic signatures, so one extra pass was needed)
  • npm run build ✅, npm run typecheck
  • Full npm test: scripts 109, core 1067, storage 287, runtime 1983, computer-use 135, desktop (untouched) all green; headless 1063/1067 with only the 2 known-flaky opencode stop runner subtests (fail identically on unmodified main, pass in isolation)

Merge timing

Touches ~805 files, so it conflicts with most open PRs — merge whenever suits; I'll rebase + re-run the baseline to fixpoint on request the same day you want it landed (regenerating is cheap and deterministic, ~1 min).

Heads-up per the #1019 thread: biome lint --write --unsafe still hangs on apps/desktop (~100% CPU indefinitely; plain format is fine) — upstream minimization still on my list, tracked separately from this PR.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

CI's test failure was real and informative — fixed and force-pushed.

Root cause: desktop's source-contract tests don't only introspect desktop's own source — ~45 contracts read packages/ui source too (composer.tsx, daily-review-panel.tsx, primitives/*.tsx, …), and packages/ui was in the baseline. So the exclusion boundary isn't "apps/desktop", it's the whole UI surface.

Also owning a verification gap on my side: locally npm test short-circuits at the 2 known-flaky headless subtests (the script chains suites with &&), so the desktop/ui suites never actually ran after my rebase — I've re-verified per-suite explicitly this time.

Changes in the force-push:

  • Formatter now excludes apps/desktop/**andpackages/ui/** (both still fully linted); baseline shrinks 805 → 660 files (packages/ui's 142 reverted, byte-identical to main).
  • .git-blame-ignore-revs updated to the new baseline hash.

Verified: npm run lint ✅, npm run format:check ✅ (fixpoint), build ✅, typecheck ✅, and explicitly: @maka/ui ✅, @maka/desktop ✅ (2,571 tests), @maka/storage ✅.

This also sharpens the follow-up question: the source-contract web spans the whole UI surface (desktop + ui, 190+ single-line assertions), so making those contracts format-tolerant (or AST-based) is the real gate for ever formatting UI code — option (a)/(c) from the PR description.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved.

Non-blocking P3 follow-up: this repository squash-merges PRs, so the branch-only baseline hash in .git-blame-ignore-revs will not exist in a fresh clone after merge; git blame configured with the file then exits with "cannot find revision ... to ignore". Please remove the branch hash before merge and add the resulting squash commit hash in a follow-up, or otherwise update the entry immediately after merge.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

Done — went with your first option. The branch hash is removed from .git-blame-ignore-revs before merge; the file now ships as documentation/scaffold only, with a note that entries must be hashes that exist on main (you're right that a hash unknown to the clone makes git blame hard-error, not just no-op — stricter than my original in-file note assumed). I'll open the one-line follow-up adding the squash-commit hash immediately after this lands.

One operational note: GitHub hasn't been starting CI runs on my last few pushes to this branch ("no checks reported", no check-suites on the head SHA — not the fork-approval gate). The commits are content-identical to the previously verified tree apart from the .git-blame-ignore-revs text change, and everything is verified locally (lint / format:check fixpoint / build / typecheck / per-suite tests including desktop's 2,571). If checks stay absent on your side, a close/reopen should kick a fresh pull_request event — or happy to try anything else you prefer.

@Astro-Han

Copy link
Copy Markdown
Contributor

LGTM, but there is a lot of rebase to be done.

@likun666661likun666661 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but there is a lot of rebase to be done.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

已在最新 main(8b9d69a)上重建整个基线(force-push,a385f96b)。全仓机械格式化 PR 的 rebase 策略是重新生成而非解决 660 文件的文本冲突:配置 commit 重放 → 重新跑 biome format(750 文件)→ 补 ignore-revs 脚手架(占位设计不变)。

重建中发现并处理了两个机械格式化的实际危害(已写进基线 commit message):

  1. proxy-test.ts@ts-expect-error 因 fetch 调用被拆行而错位(build 失败)→ 指令移到它压制的属性行;
  2. Biome 对两个文件的首遍输出不满足自身 format:check(非幂等边界)→ 二遍收敛;
  3. 一个源码契约测试(tool-runtime-extraction-contract)把 RunTracePhase 联合钉成单行字面量 → 改为对格式容忍的正则(契约是变体集合,不是排版)。

验证:format:check / lint / build / typecheck 干净,全套件通过——唯一失败是 session-title.test.js 的「aborts title generation when the provider exceeds its deadline」,它在 pristine origin/main 上同样失败(#1199 引入,套件内稳定挂、单文件跑通过,cancelledByParent 挂起类),与本 PR 无关,另行报告。

陆逊 added 4 commits July 19, 2026 12:58
…che#415)
Follow-up to apache#1019, which introduced the linter but deliberately left the
formatter out. Restores the formatter config (2-space, 100-col, single
quotes, semicolons, trailing commas — matching dominant existing style),
adds `format` (write) / `format:check` scripts, and a `npm run
format:check` CI step in the typecheck job.
Formatter-scoped exclusions (all still fully linted):
- apps/desktop/** and packages/ui/**: the UI surface's source-contract
tests read .ts/.tsx source (desktop's own and packages/ui's) and
regex-match exact single-line shapes; a whole-tree reformat broke 145
desktop-source assertions plus ~45 contracts introspecting packages/ui.
UI-surface formatting lands as a follow-up once those contract tests
are format-tolerant.
- Byte-sensitive provenance artifacts (SOURCE.json is SHA-256'd and
size-checked by scripts/prepare-cua-driver.mjs) and bundled-tools.json.
The mechanical baseline reformat is the next commit; the check gate goes
green only with both included.
Regenerated on top of current main (the previous baseline commit was 90
commits stale and conflicting; a whole-repo mechanical reformat is
rebased by re-running the formatter, not by resolving 660 files of
textual conflicts). Same scope as before: biome.json excludes the
apps/desktop UI surface.
Two adjustments the reformat itself required: a @ts-expect-error in
proxy-test.ts moved onto the property line it suppresses (the reformat
split the fetch call, displacing the directive), and a second formatter
pass over two files where Biome's first pass is not idempotent.
@likun666661
likun666661force-pushed the chore/formatter-baseline branch from fc6899b to 3be9261CompareJuly 19, 2026 05:01
@likun666661
likun666661 merged commit d0407f7 into apache:mainJul 19, 2026
2 of 3 checks passed
@UncertaintyDeterminesYou4ndMe
UncertaintyDeterminesYou4ndMe deleted the chore/formatter-baseline branch July 19, 2026 05:04
Sign up for freeto 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.

3 participants

@UncertaintyDeterminesYou4ndMe@Astro-Han@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415) - #1122

Merged
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline
Jul 19, 2026
Merged

style: Biome format baseline + check-mode CI gate (outside apps/desktop) (#415)#1122
likun666661 merged 4 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:chore/formatter-baseline

Conversation

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
Contributor

The formatter follow-up promised in #1019 — one atomic PR, structured for a merge moment of your choosing. Closes the formatter half of #415.

Structure (3 commits)

  1. Config + gate — formatter config restored in biome.jsonc (2-space / 100-col / single quotes / semicolons / trailing commas), format + format:check scripts, and npm run format:check in the CI typecheck job (right after lint, before build).
  2. Baseline — mechanical biome format --write to fixpoint: 805 files, zero logic changes. This is the commit to point .git-blame-ignore-revs at.
  3. .git-blame-ignore-revs — carries the baseline commit's branch hash. ⚠️ If you squash/rebase-merge, the hash changes; the file has the one-liner to regenerate it (git log --oneline --grep 'Biome format baseline' -1) — happy to push the corrected hash post-merge instead if you prefer merge-commit-off.

⚠️ The discovery you should weigh in on: apps/desktop is formatter-excluded

Running the baseline over the whole tree broke 145 assertions across 64 desktop test files. Desktop has a pervasive source-contract test style — tests read .ts/.tsx source and regex-match exact single-line shapes (e.g. account-auth-ui.test.ts matches a full <div className=... aria-label=...> line). Any reformat — Biome's or a future hand edit — snaps them.

Rather than scattering ~145 // biome-ignore format: comments through desktop source (which would exempt much of desktop from the formatter this PR introduces — self-defeating), this PR excludes apps/desktop/** from the formatter only (it stays fully linted), and defers desktop to a follow-up. Options for that follow-up, your call:

  • (a) Make the source-contract assertions whitespace-tolerant first, then format desktop. Two shared helpers (main-process-contract-source-helpers.js, 20 files; provider-contract-source-helpers.js, 6 files) could centralize normalization, but many exact-spacing regexes are inline per test — non-trivial.
  • (b) Keep desktop formatter-excluded long-term and accept the split.
  • (c) Treat the source-contract style itself as the issue (they're fragile against any edit, not just Biome) and migrate them to AST-based checks — bigger conversation.

Outside desktop, the same class of problem existed at small scale and IS handled in the baseline: 5 statements carry a // biome-ignore format: guard — two @ts-expect-error directives that must stay adjacent to the line they suppress (proxy-test.ts, run-trace.ts — splitting the statement orphans the directive: TS2578 + the suppressed error resurfaces) and three single-line shapes asserted by source-contract tests (run-prompt-ab.mjs, run-prompt-optimization.mjs, run-harness-ab.mjs).

Also excluded (byte-sensitive, not hand-authored): apps/desktop/resources/licenses/** (SOURCE.json is whole-file SHA-256'd + size-checked by prepare-cua-driver.mjs) and bundled-tools.json.

Verification

  • npm run lint ✅ and npm run format:check ✅ (formatter run to fixpoint — Biome's formatter isn't idempotent on some multi-line generic signatures, so one extra pass was needed)
  • npm run build ✅, npm run typecheck
  • Full npm test: scripts 109, core 1067, storage 287, runtime 1983, computer-use 135, desktop (untouched) all green; headless 1063/1067 with only the 2 known-flaky opencode stop runner subtests (fail identically on unmodified main, pass in isolation)

Merge timing

Touches ~805 files, so it conflicts with most open PRs — merge whenever suits; I'll rebase + re-run the baseline to fixpoint on request the same day you want it landed (regenerating is cheap and deterministic, ~1 min).

Heads-up per the #1019 thread: biome lint --write --unsafe still hangs on apps/desktop (~100% CPU indefinitely; plain format is fine) — upstream minimization still on my list, tracked separately from this PR.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

CI's test failure was real and informative — fixed and force-pushed.

Root cause: desktop's source-contract tests don't only introspect desktop's own source — ~45 contracts read packages/ui source too (composer.tsx, daily-review-panel.tsx, primitives/*.tsx, …), and packages/ui was in the baseline. So the exclusion boundary isn't "apps/desktop", it's the whole UI surface.

Also owning a verification gap on my side: locally npm test short-circuits at the 2 known-flaky headless subtests (the script chains suites with &&), so the desktop/ui suites never actually ran after my rebase — I've re-verified per-suite explicitly this time.

Changes in the force-push:

  • Formatter now excludes apps/desktop/**andpackages/ui/** (both still fully linted); baseline shrinks 805 → 660 files (packages/ui's 142 reverted, byte-identical to main).
  • .git-blame-ignore-revs updated to the new baseline hash.

Verified: npm run lint ✅, npm run format:check ✅ (fixpoint), build ✅, typecheck ✅, and explicitly: @maka/ui ✅, @maka/desktop ✅ (2,571 tests), @maka/storage ✅.

This also sharpens the follow-up question: the source-contract web spans the whole UI surface (desktop + ui, 190+ single-line assertions), so making those contracts format-tolerant (or AST-based) is the real gate for ever formatting UI code — option (a)/(c) from the PR description.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved.

Non-blocking P3 follow-up: this repository squash-merges PRs, so the branch-only baseline hash in .git-blame-ignore-revs will not exist in a fresh clone after merge; git blame configured with the file then exits with "cannot find revision ... to ignore". Please remove the branch hash before merge and add the resulting squash commit hash in a follow-up, or otherwise update the entry immediately after merge.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

Done — went with your first option. The branch hash is removed from .git-blame-ignore-revs before merge; the file now ships as documentation/scaffold only, with a note that entries must be hashes that exist on main (you're right that a hash unknown to the clone makes git blame hard-error, not just no-op — stricter than my original in-file note assumed). I'll open the one-line follow-up adding the squash-commit hash immediately after this lands.

One operational note: GitHub hasn't been starting CI runs on my last few pushes to this branch ("no checks reported", no check-suites on the head SHA — not the fork-approval gate). The commits are content-identical to the previously verified tree apart from the .git-blame-ignore-revs text change, and everything is verified locally (lint / format:check fixpoint / build / typecheck / per-suite tests including desktop's 2,571). If checks stay absent on your side, a close/reopen should kick a fresh pull_request event — or happy to try anything else you prefer.

@Astro-Han

Copy link
Copy Markdown
Contributor

LGTM, but there is a lot of rebase to be done.

@likun666661likun666661 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but there is a lot of rebase to be done.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
ContributorAuthor

已在最新 main(8b9d69a)上重建整个基线(force-push,a385f96b)。全仓机械格式化 PR 的 rebase 策略是重新生成而非解决 660 文件的文本冲突:配置 commit 重放 → 重新跑 biome format(750 文件)→ 补 ignore-revs 脚手架(占位设计不变)。

重建中发现并处理了两个机械格式化的实际危害(已写进基线 commit message):

  1. proxy-test.ts@ts-expect-error 因 fetch 调用被拆行而错位(build 失败)→ 指令移到它压制的属性行;
  2. Biome 对两个文件的首遍输出不满足自身 format:check(非幂等边界)→ 二遍收敛;
  3. 一个源码契约测试(tool-runtime-extraction-contract)把 RunTracePhase 联合钉成单行字面量 → 改为对格式容忍的正则(契约是变体集合,不是排版)。

验证:format:check / lint / build / typecheck 干净,全套件通过——唯一失败是 session-title.test.js 的「aborts title generation when the provider exceeds its deadline」,它在 pristine origin/main 上同样失败(#1199 引入,套件内稳定挂、单文件跑通过,cancelledByParent 挂起类),与本 PR 无关,另行报告。

陆逊 added 4 commits July 19, 2026 12:58
…che#415)
Follow-up to apache#1019, which introduced the linter but deliberately left the
formatter out. Restores the formatter config (2-space, 100-col, single
quotes, semicolons, trailing commas — matching dominant existing style),
adds `format` (write) / `format:check` scripts, and a `npm run
format:check` CI step in the typecheck job.
Formatter-scoped exclusions (all still fully linted):
- apps/desktop/** and packages/ui/**: the UI surface's source-contract
tests read .ts/.tsx source (desktop's own and packages/ui's) and
regex-match exact single-line shapes; a whole-tree reformat broke 145
desktop-source assertions plus ~45 contracts introspecting packages/ui.
UI-surface formatting lands as a follow-up once those contract tests
are format-tolerant.
- Byte-sensitive provenance artifacts (SOURCE.json is SHA-256'd and
size-checked by scripts/prepare-cua-driver.mjs) and bundled-tools.json.
The mechanical baseline reformat is the next commit; the check gate goes
green only with both included.
Regenerated on top of current main (the previous baseline commit was 90
commits stale and conflicting; a whole-repo mechanical reformat is
rebased by re-running the formatter, not by resolving 660 files of
textual conflicts). Same scope as before: biome.json excludes the
apps/desktop UI surface.
Two adjustments the reformat itself required: a @ts-expect-error in
proxy-test.ts moved onto the property line it suppresses (the reformat
split the fetch call, displacing the directive), and a second formatter
pass over two files where Biome's first pass is not idempotent.
@likun666661
likun666661force-pushed the chore/formatter-baseline branch from fc6899b to 3be9261CompareJuly 19, 2026 05:01
@likun666661
likun666661 merged commit d0407f7 into apache:mainJul 19, 2026
2 of 3 checks passed
@UncertaintyDeterminesYou4ndMe
UncertaintyDeterminesYou4ndMe deleted the chore/formatter-baseline branch July 19, 2026 05:04
Sign up for freeto 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.

3 participants

@UncertaintyDeterminesYou4ndMe@Astro-Han@likun666661