Skip to content

修复构建阻塞与过期测试,补 npm test 入口 (WORK-20) - #2

Open
lbtsm wants to merge 3 commits into
mainfrom
agent/cc-developer/work-20-clean
Open

修复构建阻塞与过期测试,补 npm test 入口 (WORK-20)#2
lbtsm wants to merge 3 commits into
mainfrom
agent/cc-developer/work-20-clean

Conversation

@lbtsm

@lbtsm lbtsm commented Aug 18, 2026

Copy link
Copy Markdown
Owner

修复 compass-ts 构建阻塞与过期测试,补 npm test 入口(WORK-20)。

内容与 #1 完全相同(两者 tree 逐字节一致),但历史已重写:#1 的基线提交里误入了一个硬编码的 XRP 钱包 seed,本分支直接从不含该文件的干净基线上重放了测试提交,seed 不在本分支任何一个提交中。

改动

  • test/sol_handler_saved_fields_test.js — 原测试把 handler.ts 当纯文本读、断言 13 行源码原文,且这 13 条全部过期。改成行为断言:直接驱动 SolEventHandler.crossOut / crossIn,断言真正落库的 mos 记录,8 个用例。没有改任何业务代码。
  • scripts/run-tests.sh + package.json"test" script — 一次跑完 test/ 下 7 个脚本,给出 PASS/FAIL 汇总和正确退出码。没引入 jest / mocha / vitest,也没改用 node --test
  • 依赖零改动:package-lock.json 未修改,npm audit 的漏洞面原样不动。

src/chain/sol/sync.tssrc/utils/time.tstest/sol_sync_retry_test.js 三个文件来自 runtime 固化的本地未提交改动,不是本单的工作,合并前请确认是否本来就该进 main。

验收

npm run typecheck / npm run build / npm test 三条均退出码 0,7 个测试全 PASS。

验证入口:npm ci && npm run typecheck && npm run build && npm test

lbtsm and others added 3 commits August 18, 2026 17:21
The old test read src/chain/sol/handler.ts as a string and asserted that 13
exact source lines appeared in it. handler.ts has since moved 'from' to
publicKeyToBytes() and the numeric fields to normalizeEventNumberHex(), so
every one of those assertions was stale and the test failed on main.

Rather than refresh the string literals — which would only buy time until the
next refactor — the test now drives SolEventHandler.crossOut / crossIn and
asserts the mos row that actually gets persisted: base58 vs raw-bytes shape for
user/from, even-length unprefixed hex for chain ids and amounts, the '00'
defaults when optional CrossIn fields are absent, the RefundEvent flag, the
unsupported-bridgeMint alarm path, and the bridge api query. It survives a
rename and it fails when the mapping is wrong, which the text version could
not distinguish.

Stubs replace the module exports (insertMos / requestBridgeData / alarm), the
same technique mysql_duplicate_test.js already uses, so no network or database
is touched. No business code was changed — the assertions were brought up to
the source, not the reverse.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
test/ held 7 standalone Node assert scripts with no way to run them as a set:
package.json had no test script, and most of them require('../app/...') so they
silently fail unless the tree is built first.

scripts/run-tests.sh builds, then runs each script as its own process, prints
PASS/FAIL per file plus a total, and exits non-zero if any failed — so it can
gate CI. Output of passing tests is swallowed and only failures are echoed,
because these scripts are very chatty on stdout.

No test framework: the scripts are top-level asserts, not node:test cases, so
'exit 0 means pass' is the whole contract and jest/mocha/vitest would each
require rewriting all 7. SKIP_BUILD=1 reuses an existing app/ build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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