Skip to content

test: comprehensive coverage for daemon, rules, health, capabilities, scenes, status-sync, upgrade-check#36

Closed
chenliuyun wants to merge 8 commits intomainfrom
test/comprehensive-coverage
Closed

test: comprehensive coverage for daemon, rules, health, capabilities, scenes, status-sync, upgrade-check#36
chenliuyun wants to merge 8 commits intomainfrom
test/comprehensive-coverage

Conversation

@chenliuyun
Copy link
Copy Markdown
Collaborator

Summary

Regression-guard tests for every untested or under-tested command surface so future refactors cannot silently break daemon lifecycle, rules analytics, health reporting, capabilities discovery, scenes validation, status-sync management, or upgrade detection.

No production code is changed. 47 new tests, test count 1889 → 1936.

Coverage added

Area File New tests
daemon stop/status/reload tests/commands/daemon.test.ts 7
rules conflicts/doctor/summary/last-fired tests/commands/rules.test.ts 11
rules webhook-rotate/show-token/suggest tests/commands/rules.test.ts 10
health check CLI tests/commands/health-check.test.ts (new) 6
capabilities --surface + commandMeta shape tests/commands/capabilities.test.ts 3
scenes validate + scenes simulate tests/commands/scenes.test.ts 7
status-sync start/stop unit tests/commands/status-sync.test.ts (new) 6
upgrade-check happy path + network error tests/commands/upgrade-check.test.ts 4

Notes

  • Planned Task 5 Part B (schema export --compact+--capabilities) was dropped: the --capabilities flag does not exist in the current schema export command. Task 5 shipped only Part A (capabilities surface/commandMeta).
  • Windows-specific fix in the daemon stop test: replaced vi.spyOn(process, 'kill') with direct property assignment, because vi.spyOn on process.kill does not capture invocations reliably on Windows. Kill-path execution is verified via observable side effects (pid file unlink + persisted stopped state + stdout message).
  • Conflict analyzer semantics locked in: opposing-actions is severity: 'warning' not error, so rules conflicts exits 0 and report.clean remains true. Tests assert the finding via findings.some(f => f.code === 'opposing-actions').

Test plan

  • npm test passes locally (1936/1936)
  • Per-task npx vitest run <file> verification after each commit
  • CI green on PR (Node 18 / 20 / 22 matrix + offline-smoke + pack-install-smoke)

Independent from PR #35

This PR is orthogonal to fix/3.2.1-shebang (release pipeline hardening). Both branch from the same main commit; review/merge order does not matter.

@chenliuyun
Copy link
Copy Markdown
Collaborator Author

Superseded by #35, which landed the same coverage work (daemon, rules, health, scenes, status-sync, upgrade-check, capabilities) in a more complete form — plus two additional test files this branch does not have (tests/build/bundle-size.test.ts, tests/commands/capabilities-meta.test.ts).

Merging this PR would regress two changes already on main:

  1. tests/status-sync/manager.test.ts — this branch still uses vi.spyOn(process, 'kill'), which main replaced with a direct-assignment pattern + afterAll restore (7f59a0b) to stabilize the test across Node versions and OSes.
  2. tests/version.test.ts — this branch is missing the shebang regression guard (keeps a node shebang on dist/index.js for npm bin execution) that Ship v3.2.1 with hardened release pipeline #35 introduced as part of the release-pipeline hardening.

Closing without merging; deleting the branch.

@chenliuyun chenliuyun closed this Apr 26, 2026
@chenliuyun chenliuyun deleted the test/comprehensive-coverage branch April 26, 2026 02:30
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