You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: replace source-regex extraction contracts with behavioral assertions #1403
The #1084 refactor wave itself left behind a cluster of *-extraction-contract.test.ts files (born 2026-07-16 – 07-20) that pin source-text layout, not behavior, via readFile + dozens of assert.match/assert.doesNotMatch regexes:
A rename or reformat breaks them; a behavioral regression passes them. session-manager.test.ts:8491 similarly pins runtime-kernel.ts internals by slicing source text (indexOf('private async *runAgentTurn') → includes('new AiSdkFlow')).
Scope
Replace each with (a) typed assertions on the extracted collaborator's public interface and (b) the lane's behavioral tests; delete the regex layer. Keep genuinely defensive source guards — containment-guard-contract.test.ts exists to prevent re-definition of a retired predicate and is fine as-is.
Policy for new extraction PRs (effective immediately): upcoming sub-issue PRs under #1084 and the third-pass governance issue should not add new source-regex extraction contracts. Pin an extraction with typed interface assertions and behavior tests instead.
Direction discussion (maintainer input wanted)
apps/desktop/src/main/__tests__ has a larger pre-existing family (~45 behavioral/wiring tests fed by renderer-shell-source-helpers.ts) asserting renderer wiring by regex over source text. Migrating those is a bigger project with real trade-offs (some assert cross-process wiring that is genuinely awkward to execute). This issue proposes agreeing on a policy — no new source-regex behavior tests; migrate opportunistically when a pinned file is refactored — rather than a big-bang rewrite.
References
#1084 (second-pass governance; the wave that introduced the cluster).
I plan to take the two #1381-adjacent runtime files listed here: tool-runtime-extraction-contract.test.ts and ai-sdk-compaction-extraction-contract.test.ts. I’ll replace their source-regex coverage with typed and behavioral contracts, and leave the other #1403 files untouched.
The five source-regex test files are gone: #1448 replaced two of them with typed behavioral coverage, #1727 removed the other three, and #1675 dropped the slice assertions in session-manager.test.ts. What remains is policy discussion, not actionable work.
Activity
Astro-Han commentedon Jul 24, 2026
I plan to take the two #1381-adjacent runtime files listed here:
tool-runtime-extraction-contract.test.tsandai-sdk-compaction-extraction-contract.test.ts. I’ll replace their source-regex coverage with typed and behavioral contracts, and leave the other #1403 files untouched.refactor(runtime): drop source-regex AiSdkFlow contract test (apache#…
Refactor/runtime kernel split (#1675)
Astro-Han commentedon Aug 2, 2026
The five source-regex test files are gone: #1448 replaced two of them with typed behavioral coverage, #1727 removed the other three, and #1675 dropped the slice assertions in session-manager.test.ts. What remains is policy discussion, not actionable work.
refactor(headless): unify canonicalJson into single serializer (apach…
refactor(headless): unify canonicalJson into single serializer (apach…
refactor(headless): unify canonicalJson into single serializer (apach…
refactor(headless): unify canonicalJson into single serializer (#1404) (