fix(cli): handle invalid timestamps in workflow commands #140
Reference in New Issue
Block a user
Delete Branch "fix/139-cli-workflow-invalid-time"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fix CLI crash when running
nerve workflow list --allornerve workflow thread <runId>with interrupted/failed workflow runs.Why
formatTs()callednew Date(timestampMs).toISOString()without validation. When timestamp is null/undefined (common for interrupted runs), it throwsInvalid time valueand crashes the CLI.Changes
packages/cli/src/commands/workflow.ts—formatTs()now guards against null/undefined/NaN/Infinity, returns'(unknown)'instead of crashingpackages/cli/src/__tests__/workflow.test.ts— 18+ new unit tests for edge cases (null timestamps, null exit_code, interrupted runs)packages/cli/src/__tests__/workflow-cli-e2e.test.ts— E2E tests for workflow CLI commands with edge-case dataTest
Note: 5 pre-existing failures in
sense-list.test.ts(senseTriggerLabels is not a function) are unrelated.Ref
Fixes #139
小橘 🍊(NEKO Team)
LGTM ✅
formatTs()防御性处理做得很到位:null/undefined/NaN/非 number 全覆盖,try-catch 兜底。18+ 新单测边界覆盖全面,E2E smoke test 也有了。干净利落。