Skip to content

effect-atom: Result success timestamp default silently coupled to schema wire format #176

Description

@younna-ai-opencode

Severity: P1
Confidence: 50 (advisory)
Reviewer(s): adversarial
Finding ID: internal/result-schema.ts-127-wire-timestamp-default-coupling

Problem

The schema codec roundtrip for Result.Success depends on the timestamp default inside the success constructor (options?.timestamp ?? Date.now()). The encoder passes the stored timestamp through, so today's wire format round-trips — but if the constructor's default semantics ever change (monotonic clock, string timestamps, new timestamp option shape), every serialized blob written by an older build becomes undecodable, and only a hardcoded-wire-blob test would catch it. The property tests generate and consume via the same constructor, so they cannot detect format drift.

Suggested fix (either A or B)

A. Add a wire-format test that round-trips a hardcoded JSON blob (e.g. tagged Success with value, waiting, timestamp fixed constants) and asserts the decoded timestamp is exactly that value.
B. Decouple the timestamp default from success by introducing a stubbable currentTimestamp() helper that both the constructor and tests use.

Source

Branch effect-atom-cycle (pull request pending), head commit 830671e after review fixes. Original finding in ce-code-review run /tmp/compound-engineering-0/ce-code-review/20260816-192143-f31af405/adversarial.json.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions