Skip to content

test: drop low-value import-boundary guard and CSS-contract suites - #2425

Merged
jackwener merged 2 commits into
mainfrom
test/trim-low-value-suites
Aug 7, 2026
Merged

test: drop low-value import-boundary guard and CSS-contract suites#2425
jackwener merged 2 commits into
mainfrom
test/trim-low-value-suites

Conversation

@jackwener

@jackwener jackwener commented Aug 7, 2026

Copy link
Copy Markdown
Member

概览

精简低价值的守卫/契约类测试套件,净删 2086 行、12 个文件,同时保留对真实行为的守卫覆盖。

变更内容

1. 删除 4 个 import 边界守卫套件(−1325 行)

纯架构守卫/元测试,用 typescript/unstable/ast 扫描源码 import 图强制执行白名单:

  • runtime-host dependency-boundary.test.ts(424L / 5 cases)
  • storage root-authority-dependency.test.ts(228L / 3 cases)
  • headless headless-storage-dependency.test.ts(196L / 3 cases)
  • cli runtime-host-run-dependency.test.ts(477L / 2 cases)

这些是开发期组合审计,而非产品行为测试;并且在并行工作区运行时会出现 flake(runtime-host 套件仅在共同调度时失败 30+ 个用例)。行为守卫覆盖由其余行为测试套件保留。

2. 删除 8 个纯 CSS 结构契约套件(−761 行)

用 postcss 解析渲染器 CSS 文本并断言精确的选择器/声明形态(阶梯、间距、连字、引用层几何、选择器菜单)。它们是对 Astryx 样式表的脆弱像素/顺序锁定,而非行为;行为契约(app-shell-effect-stability、ui-render-memo-boundary、dock-presentation、window-reveal、cursor clock)以及共享 css-test-helpers 的真实窗口/DOM 行为消费者均保留。

验证

  • 删除的 12 个测试文件在 CI/scripts 中无点名引用(通过 glob 自动发现,删源码即不再运行)
  • 受影响包(cli / storage / headless / runtime-host / desktop)均编译通过
  • cli(514/514)、storage(746/746)、headless(1493/1493)测试全绿

Remove pure architecture-guard meta-tests that scan the source import
graph with typescript/unstable/ast to enforce whitelists:

- runtime-host dependency-boundary (424L / 5 cases)
- storage root-authority-dependency (228L / 3 cases)
- headless headless-storage-dependency (196L / 3 cases)
- cli runtime-host-run-dependency (477L / 2 cases)

These are dev-time composition audits, not product behavior tests; they
also flake under parallel workspace runs (the runtime-host suite failed
30+ cases only when co-scheduled). Product guard coverage is preserved
by the remaining behavioral suites.
These tests parse the renderer CSS text with postcss and assert exact
selector/declaration shapes (ladders, gutters, ligatures, quote-layer
geometry, picker menus). They are brittle pixel/order locks on Astryx's
stylesheet, not behavior: they re-read source CSS and pin values the
design system owns. The behavior contracts (app-shell-effect-stability,
ui-render-memo-boundary, dock-presentation, window-reveal, cursor clock)
are kept, as are the shared css-test-helpers consumers that exercise
real window/DOM behavior.
@jackwener
jackwener force-pushed the test/trim-low-value-suites branch from 657c3da to 0f2ca8a Compare August 7, 2026 10:12
@jackwener
jackwener merged commit 1e53f5c into main Aug 7, 2026
@jackwener jackwener changed the title test: trim low-value guard and CSS-contract suites, fix sqlite warning noise test: drop low-value import-boundary guard and CSS-contract suites Aug 7, 2026
jackwener added a commit that referenced this pull request Aug 7, 2026
main has been red on `knip --workspace apps/desktop` since #2425, with
`format:check` red alongside it, which drags every open PR's typecheck job
red too (PR CI runs the branch merged with main).

The knip half is leftovers, not new decisions:

- #2425 deleted the CSS-contract suites but kept their helpers, so
  `assertCssRuleDecls` and `parseCssBlocks` lost their only callers. Removing
  them orphans the whole scanning subtree behind them (`cssRuleBody`,
  `splitSelectorList`, `stripCssComments`, the postcss block walk and the
  `CssBlock` type), which goes with them; `postcss` was that subtree's only
  use in this workspace and leaves devDependencies. What the file still owes
  its callers is `REPO_ROOT` and `readAllRendererCss`, which stay.
- #2426 removed the Voice module end-to-end, but `provider-connection-dialog`
  was reachable only from the deleted `voice-settings-page` and survived it.

The format half is just the formatter over three files that landed without
it: `tool-free-model-call.ts`, and `bootstrap-connections.ts` +
`connection-store.test.ts` from #2431.

No behaviour change in any of this.
jackwener added a commit that referenced this pull request Aug 7, 2026
)

main has been red on `knip --workspace apps/desktop` since #2425, with
`format:check` red alongside it, which drags every open PR's typecheck job
red too (PR CI runs the branch merged with main).

The knip half is leftovers, not new decisions:

- #2425 deleted the CSS-contract suites but kept their helpers, so
  `assertCssRuleDecls` and `parseCssBlocks` lost their only callers. Removing
  them orphans the whole scanning subtree behind them (`cssRuleBody`,
  `splitSelectorList`, `stripCssComments`, the postcss block walk and the
  `CssBlock` type), which goes with them; `postcss` was that subtree's only
  use in this workspace and leaves devDependencies. What the file still owes
  its callers is `REPO_ROOT` and `readAllRendererCss`, which stay.
- #2426 removed the Voice module end-to-end, but `provider-connection-dialog`
  was reachable only from the deleted `voice-settings-page` and survived it.

The format half is just the formatter over three files that landed without
it: `tool-free-model-call.ts`, and `bootstrap-connections.ts` +
`connection-store.test.ts` from #2431.

No behaviour change in any of this.
Astro-Han added a commit that referenced this pull request Aug 21, 2026
styles.css told readers the "compact == transcript" assumption was held by
`__tests__/markdown-rhythm-dom-contract.test.tsx`. That file was deleted in
claiming a guard that does not exist — the worst state to leave an
assumption in, since the next person reads the citation and stops looking.

Restore the two assertions the comment is actually about, plus the ladder
order #2348 exists to protect, in ONE file. Split across two they each
stayed green against the half they could not see, which is how the
stylesheet half got deleted without anything noticing:

- the ladder is declared on the --space-* scale in strictly increasing
  order (retuning a rung is a design call and stays green; list gaps
  meeting block gaps fails)
- every rung declared is actually spent by a rule, so the ladder cannot
  become decoration while literals do the spacing
- the runtime hooks the selectors need are really emitted by MarkdownBody
  — data-maka-contract, data-density, astryx-markdown-heading, data-level,
  astryx-list-item. These names have a single upstream owner in Astryx and
  appear in Maka only inside selectors, so a rename kills every rule at
  once with nothing failing
- compact markdown still has exactly one caller, which is the bet the
  comment names: the table carries heading TYPOGRAPHY on a density key,
  and Astryx's own RFC says density must not do that

Why these are not what #2425/#2462 retired. Those PRs removed markup/copy
pins, duplicate presentation assertions and CSS-structure suites that
asserted how a rule was written. Nothing here asserts an appearance or a
rule's shape: three of the four are relations that must survive any
retune, and the fourth renders the real component and checks the join
between Astryx's output and Maka's selectors. Deliberately left unpinned,
because they ARE how the table is written: the adjacent-sibling gap form,
the `hr` rung, the ListItem padding reset, and the two heading size tiers.

The stylesheet-reading half no longer revives the deleted desktop
css-test-helpers module or the renderer-wide CSS aggregate it read; it
reads packages/ui/src/styles.css directly, in the package that owns it.

Seven mutations, each verified to fail the assertion that describes it:
inverting the ladder; taking a rung off the --space-* grid; hardcoding a
rung's usage; hardcoding it while naming the rung in a comment (this is
why comments are stripped first); renaming the contract wrapper; cutting
density off before it reaches Astryx; and adding a second compact caller.

Also state in the comment what the contract does and does not hold, so
the next reader does not have to open the test to find out.

Generated-by: Claude Code
Astro-Han added a commit that referenced this pull request Aug 21, 2026
styles.css told readers the "compact == transcript" assumption was held by
`__tests__/markdown-rhythm-dom-contract.test.tsx`. That file was deleted in
#2462 and its stylesheet-side sibling in #2425, so the comment has been
citing a guard that does not exist — the worst state to leave an assumption
in, since the next person reads the citation and stops looking.

Restore only what cannot be noticed without a test. Both failure modes here
are silent: no error, no failing check, just spacing that quietly stops
being what the table declares, because a CSS selector that matches nothing
never complains.

- The table selects entirely on DOM Astryx generates at runtime —
  data-density, astryx-markdown-heading + data-level, astryx-list-item.
  Those names have one upstream owner and appear in Maka only inside
  selectors, so a rename kills every rule at once. Astryx is bumped
  regularly (0.4.0 in #2983, 0.4.3 in flight, plus the Dependabot minor
  group), so this is a recurring event, not a hypothetical.
- Astryx's ListItem carries CONTROL row padding that `density` cannot reach
  from outside. That padding is what inverted the ladder in #2348 — list
  items ~10px apart against 4px paragraphs — and one rule neutralizes it.
  Lose the rule and the original defect returns, silently.

- Plus the assumption the comment actually names: compact markdown still
  has exactly one caller. The table carries heading TYPOGRAPHY on a density
  key, which Astryx's own RFC says density must not do, so the key is
  honest only while `compact` and "transcript" are the same set.

Deliberately NOT pinned: the ladder's declared values and their order. A
first draft asserted them, and it was the wrong instinct — a reversed
ladder has to be typed on purpose into four adjacent lines under a comment
explaining the order, and it is visible the moment anyone looks at a
transcript. It also would not have caught the defect it claimed to guard:
#2348's inversion came from the ListItem padding above, which a test
reading only the declared variables cannot see. Same for the
adjacent-sibling gap form, the `hr` rung and the two heading size tiers —
those are how the table is written, not what it promises.

Why this is not what #2425/#2462 retired. Those PRs removed markup/copy
pins, duplicate presentation assertions, and CSS-structure suites that
asserted how a rule was written. Two of the three assertions here render
the real component and check the join between Astryx's output and Maka's
selectors; the third asserts an outcome the table promises, not a syntax.
The stylesheet-reading half does not revive the deleted desktop
css-test-helpers module or the renderer-wide CSS aggregate it read — it
reads packages/ui/src/styles.css directly, in the package that owns it.

Six mutations, each verified to fail the assertion that describes it:
deleting the ListItem padding reset; un-zeroing it; un-zeroing it while
naming the reset in a comment (this is why comments are stripped first);
renaming the contract wrapper; cutting density off before it reaches
Astryx; and adding a second compact caller.

Generated-by: Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant