test(cli): add e2e test for nerve store archive #174

Merged
xiaomo merged 1 commits from test/163-store-archive into main 2026-04-27 07:19:43 +00:00
Owner

What

E2E test for nerve store archive with a real daemon.

Why

Validates the full archive pipeline: produce logs → backdate → archive → verify JSONL export and row removal.

Changes

  • e2e-harness.ts — add store subcommand to harness
  • e2e-store-archive.test.ts — 2 tests: archive exports + row removal, --vacuum flag

Ref

Fixes #163

## What E2E test for `nerve store archive` with a real daemon. ## Why Validates the full archive pipeline: produce logs → backdate → archive → verify JSONL export and row removal. ## Changes - `e2e-harness.ts` — add `store` subcommand to harness - `e2e-store-archive.test.ts` — 2 tests: archive exports + row removal, `--vacuum` flag ## Ref Fixes #163
xiaoju added 1 commit 2026-04-27 06:58:19 +00:00
Start daemon, trigger workflow, backdate logs >30 days, verify:
- store archive exports old entries to JSONL files
- Archived rows removed from logs.db
- thread list still shows workflow_runs correctly
- --vacuum flag runs SQLite VACUUM successfully

Extends e2e-harness with store subcommand.

Fixes #163
xiaomo approved these changes 2026-04-27 07:01:31 +00:00
Dismissed
xiaomo left a comment
Owner

LGTM

亮点:

  • 通过 UPDATE logs SET timestamp 模拟老数据触发归档,避免真等 30 天,很聪明
  • 验证链路完整:archive → JSONL 内容 → logs 表清空 → workflow_runs 不受影响 → vacuum
  • harness 的 StartTestDaemonOpts 扩展设计合理,向后兼容 null

小建议(不阻塞):

  • linkWorkspaceDaemonIntoNerveRoot export 出来很好,#173 合并后可以复用这个而不是各自写一份
  • overflow: "drop" as constas const 多余,TS 会自动推断字面量类型
✅ LGTM **亮点:** - 通过 `UPDATE logs SET timestamp` 模拟老数据触发归档,避免真等 30 天,很聪明 - 验证链路完整:archive → JSONL 内容 → logs 表清空 → workflow_runs 不受影响 → vacuum - harness 的 `StartTestDaemonOpts` 扩展设计合理,向后兼容 `null` **小建议(不阻塞):** - `linkWorkspaceDaemonIntoNerveRoot` export 出来很好,#173 合并后可以复用这个而不是各自写一份 - `overflow: "drop" as const` 的 `as const` 多余,TS 会自动推断字面量类型
xiaoju force-pushed test/163-store-archive from 0a598a2ff0 to e7788b4323 2026-04-27 07:11:02 +00:00 Compare
xiaomo force-pushed test/163-store-archive from e7788b4323 to 0241f0fd3e 2026-04-27 07:16:21 +00:00 Compare
xiaomo approved these changes 2026-04-27 07:19:41 +00:00
xiaomo left a comment
Owner

LGTM

Harness 扩展干净利落:withNoopWorkflow 条件分支、linkWorkspaceDaemonIntoNerveRoot 导出复用都很好。

测试覆盖了 archive 核心流程(backdate → archive → JSONL 验证 → row 清除)和 --vacuum flag,逻辑清晰。

一个小建议:两个 test 里 pollUntil + backdate + runCli 的 setup 重复度高,可以考虑抽个 helper,不过不阻塞合并。

LGTM ✅ Harness 扩展干净利落:`withNoopWorkflow` 条件分支、`linkWorkspaceDaemonIntoNerveRoot` 导出复用都很好。 测试覆盖了 archive 核心流程(backdate → archive → JSONL 验证 → row 清除)和 `--vacuum` flag,逻辑清晰。 一个小建议:两个 test 里 pollUntil + backdate + runCli 的 setup 重复度高,可以考虑抽个 helper,不过不阻塞合并。
xiaomo merged commit cba24d727c into main 2026-04-27 07:19:43 +00:00
xiaomo deleted branch test/163-store-archive 2026-04-27 07:19:43 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
2 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#174