Repository navigation
perf(control-plane): add 2-lane TS test runner and cut coordination test CPU - #9537
loopx-agent wants to merge 1 commit into
Conversation
…est CPU Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
通过。 本范围无阻塞发现。默认运行、规范字节和存储恢复得到独立验证。
动机 / Motivation
维护者运行控制面测试,已有 File/SQLite 权威存储继续读写历史 Todo 和回执。TS 套件由一个 Node 运行器发起,Reducer 对已验证投影重复做整份规范化和后置读模型校验。 独立合成旧字段契约并经新旧 Reducer 对照,普通更新保留旧字段列表,使用新字段时升级。含 Unicode 和 proto 自有属性的规范 JSON 与两个摘要逐字节一致。 未知字段仍拒绝。File/SQLite 实际读写套件覆盖 CAS、租约护栏和提交过程退出。独立 SIGTERM 回归观测到候选按信号退出,所属 Node 测试 worker 已退出。 本机真实 File、SQLite、Node 和有限 Python 集成。NoKV 仅用测试 SDK 与 JSONL 回归,外部服务和跨平台性能未复验。
改动思路 / Approach
将默认测试切分为互斥的两个进程组,将安全的重复规范化局部移除,仍由已有 codec 和存储持久化边界生成摘要。 继续由现有 provider 提交和读模型 schema 负责兼容性,优化解析和密集测试的执行分配。 本机真实 File、SQLite、Node 和有限 Python 集成。NoKV 仅用测试 SDK 与 JSONL 回归,外部服务和跨平台性能未复验。
具体改动 / Changes
精确提交 3930e76db0b9937424b633d3397cbc2fc84fa053。GitHub 目标基线 509360fb0d3e9e6e578ddf5c12db587886016b23,行为对照 509360fb0d3e9e6e578ddf5c12db587886016b23。14 个文件,增加 1,604 行、删除 275 行。 测试与质量契约 评审条件 authority-history、test-targets。
关键代码讲解
buildControlPlaneRunPlan。默认把两个重存储套件各分配一次,参数和覆盖率路径保持单 runner。 源码runControlPlaneTests。在工作运行期间管理 Node 子进程和私有编译缓存,转发退出信号。 源码reduceCoordinationProjection。验证旧模型和新写记录,保留旧字段清单直到新字段实际写入。 源码authorityUnicodeCompare。对无代理码元的字符串使用快路径,其他输入继续按 Unicode 码点比较。 源码
对主干的风险 / Risks
独立合成旧字段契约并经新旧 Reducer 对照,普通更新保留旧字段列表,使用新字段时升级。含 Unicode 和 proto 自有属性的规范 JSON 与两个摘要逐字节一致。 原生 npm 默认两组共 6,895 项 TS 测试通过、4 项因本机环境等条件跳过。所选 Python 集成 352 项通过、3 项按本地环境跳过。TS 类型检查通过。c8 显式目标中的两项旧 manifest 测试通过并生成 LCOV。Git diff --check 通过。 未知字段仍拒绝。File/SQLite 实际读写套件覆盖 CAS、租约护栏和提交过程退出。独立 SIGTERM 回归观测到候选按信号退出,所属 Node 测试 worker 已退出。
语义与 CI 对齐
独立运行与其他任务并行,未复核作者的提速倍率。NoKV 使用合成 SDK,未连接外部服务。安装和 SQLite 测试跳过项保留在本机验证范围内。
我的整体评价 / Verdict
APPROVE。 默认测试入口与权威投影的兼容性回归通过。 保持现有发布版字段验证、排序、摘要和持久化责任。 独立运行与其他任务并行,未复核作者的提速倍率。NoKV 使用合成 SDK,未连接外部服务。安装和 SQLite 测试跳过项保留在本机验证范围内。
English verdict: APPROVE at 3930e76. The normal runner and canonical state, legacy schemas, and storage recovery passed independent validation.
Summary
Speeds up
npm run test:control-plane(~317.23sbaseline ->190.06son final rebasedHEAD, cutting user CPU from546.50sto353.91s) with zero weakened assertions, zero weakened Filefsyncor SQLitePRAGMA synchronous = FULLdurability guarantees, and full coverage compatibility.Changes
scripts/run_control_plane_ts_tests.mjs,scripts/run_control_plane_ts_tests.d.mts,package.json,tsconfig.control-plane.json):LOOPX_TS_TEST_CONCURRENCY(positive integer override) orMath.min(8, Math.max(4, Math.floor(availableParallelism / 2))).NODE_COMPILE_CACHEdirectory (mode 0o700, cleaned up on exit andSIGINT/SIGTERM/SIGHUP) unlessNODE_COMPILE_CACHE,NODE_DISABLE_COMPILE_CACHE=1, orNODE_V8_COVERAGEis set.totalConcurrency >= 6, no explicit file/flag args are supplied, andNODE_V8_COVERAGEis unset:--test-concurrency=2): runs only the 2fsync-intensive conformance suites (tests/control_plane_ts/sqlite_authority_store.test.tsandtests/control_plane_ts/authority_store.test.ts) concurrently fromt=0, preventing them from serializing behind each other or saturating APFSfsync.--test-concurrency=(totalConcurrency - 2)): runs all remainingtests/control_plane_ts/*.test.tsfiles concurrently fromt=0.node --testwhentotalConcurrency < 6, explicit files/flags are passed, orNODE_V8_COVERAGEis active (preservingnpm run test:control-plane:coveragewithc8).tests/control_plane_ts/run_control_plane_ts_tests.test.ts) & e2e alignment (tests/control_plane/test_shared_goal_authority_e2e.py):[4, 8]clamping,LOOPX_TS_TEST_CONCURRENCYoverrides and invalid fallbacks, 2-lane partitioning and single-lane fallbacks,0o700NODE_COMPILE_CACHElifecycle/opt-outs, forwarded args/exit codes, heavy-lane failure propagation, andSIGTERMcleanup.test_native_ladder_suites_remain_in_the_regular_typescript_test_jobto inspectbuildNodeTestArgs([]).loopx/control_plane/coordination/authority_store_codec.ts: code-unit< 0xD800fast path inauthorityUnicodeCompare, sorted-key short-circuit insortCanonicalKeys, and ordinary hidden-class{}cloning (preserving inherited-setter safety viaObject.definePropertyand sparse-array hole semantics).loopx/control_plane/coordination/coordination_state_contract.ts:WeakMap-cached allowed-field sets for frozenRecordContractdescriptors.loopx/control_plane/coordination/coordination_projection.ts: removes duplicate full-graphvalidateCoordinationTodoReadModelduring commit preparation and validates only mutated Todos incrementally during projection reduction.loopx/control_plane/coordination/nokv_authority_store.ts: reuses module-levelFATAL_UTF8_DECODER.tests/control_plane_ts/production_scale_coordination_fixture.ts: memoizes immutable base fixtures withstructuredClone.tests/control_plane_ts/authority_archive_audit.test.ts: runs archive audit consumer recovery tests concurrently (concurrency: 4) via asyncspawn.tests/fixtures/nokv_fake_sdk/nokv/__init__.py&tests/control_plane_ts/nokv_jsonl_transport.test.ts: keys fake NoKV blob storage by(workbench, path)and pools 6 reusablenokv_jsonl_helper.pyprocesses across conformance cases with isolated tenants.Benchmark Results (18-CPU / 6P+12E Apple Silicon Mac)
origin/main(2302e42d9cad,--test-concurrency=4, no compile cache)317.23s546.50s/107.80s6,890/6,886/4/02302e42d9cadbase, 2-lane2+6)210.28s357.57s/131.58s6,898/6,894/4/02302e42d9cadbase, 2-lane2+6)215.36s365.75s/133.14s6,898/6,894/4/03930e76db0b,origin/main509360fb0d3base, 2-lane2+6)190.06s(1.67x)353.91s/119.99s6,899/6,895/4/0Verification
npm run test:control-planeon3930e76db0b: 0 failures (190.06s; standard lane366files6,084 pass / 4 skippedin189.63swithsqlite_capacityin50.81s; heavy laneauthority_store.test.ts398 passin170.40sandsqlite_authority_store.test.ts413 passin188.24s).npm run typecheck:control-plane: passed (0errors).npm run test:control-plane:coverage -- tests/control_plane_ts/run_control_plane_ts_tests.test.ts tests/control_plane_ts/authority_store_codec.test.ts tests/control_plane_ts/coordination_projection.test.ts tests/control_plane_ts/coordination_state_contract.test.ts: passed (c8compatibility confirmed).uv run --extra test pytest -q -n 4 tests/control_plane/test_shared_goal_authority_e2e.py tests/test_nokv_jsonl_helper.py tests/canary/test_runner_compile_cache.py tests/architecture/test_nokv_qualified_pin_single_owner.py tests/control_plane/test_coordination_authority_core.py tests/control_plane/test_local_coordination_authority.py tests/control_plane/test_authority_archive.py tests/control_plane/test_sqlite_authority_cli.py:360 passed, 3 skipped in 33.93s.uv run --extra test ruff check tests/control_plane/test_shared_goal_authority_e2e.py tests/fixtures/nokv_fake_sdk/nokv/__init__.py: passed.uv run --extra test mypy --no-incremental --follow-imports=silent tests/fixtures/nokv_fake_sdk/nokv/__init__.py:0issues.uv run --extra test python scripts/check_rfc_bilingual.py --base origin/main --head HEAD: passed.uv run --extra test loopx check --scan-path ...(all 14 changed/new files):errors=0, warnings=0, public boundary scan clean: 14 files.uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main:passed(selected=17, failures=0, merge_gate_passed=true).