Development docsTracks main. Use your release’s bundled docs for its exact behavior; back up your store before upgrading.
Skip to content

Timestamp implementation fixtures ​

Regression matrix for the Markdown-authoritative contract. Core clock/semantic cases are executable in src/lifecycle.rs; process/editor/storage cases live in tests/cli.rs, tests/terminal.rs, tests/locking.rs and filesystem/prune unit tests. Use injected clocks rather than sleeps. For every failure, assert source/destination bytes and draft recovery behavior, not just exit status. See the normative timestamp contract.

Use original created = 2026-01-01T00:00:00Z, updated = 2026-02-01T00:00:00+00:00, and command finalization time 2026-03-01T00:00:00.123456Z unless overridden.

FixtureExpected result
Add body, empty body, CRLF, missing final newlineBoth dates equal finalization time; body bytes preserved
Interactive add opened before finalization; several draft savesBoth dates use finalization clock, not open/intermediate-save clock
Add draft has historical, invalid, or removed date fieldsGenerated dates replace draft date fields; malformed YAML still fails
Edit body or user metadataPreserve created; updated equals finalization time
Edit changes expires or an unknown nested fieldCounts as user-metadata change; stamp updated; no automatic retention extension
Exact no-op, including body-only input equal to originalPreserve entire source bytes; no rewrite
YAML comment, mapping-order, nested-order, or quoting-only editPreserve dates; explicit formatting edits may be published
Sequence reorder, scalar type change, field absence vs. nullCounts as a change for supported values (frontmatter)
Body newline, whitespace, CRLF/LF, or final-newline changeCounts as a change; preserve proposed body bytes
External edit before command; command makes no further changeNo timestamp repair or historical comparison
Plain move across IDs/shelves, including differing retention defaultsPreserve dates and absence; no stamp from identity change
Move with actual user-metadata change vs. same-value assignmentStamp only the actual change
Imported file with neither date, created only, or updated onlyNo-op/plain move preserves absence; changed content sets updated only
Valid imported non-UTC offset and fractional precisionUntouched dates retain string values; generated dates use UTC
Missing date required by shelfReject final candidate unless supplied under applicable command rules
Invalid date: null, number, empty, date-only, malformed offsetEdit/move fails, including no-op; automatic stamp cannot mask invalid original
Draft explicitly repairs/removes invalid original dateAccept when resulting metadata satisfies shelf requirements
Draft explicitly edits/removes created onlyHonor change; no stamp unless body/user metadata also changes
Draft explicitly edits/removes updated onlyHonor change; no automatic stamp
Draft changes body and explicitly changes/removes updatedExplicit updated wins, even if older than original or command time
Draft rewrites date string to equivalent instantHonor different string representation; quoting alone is not an override
Draft leaves updated unchanged while changing created and bodyHonor created; automatically stamp updated
Draft temporarily changes dates/content then restores originalsFinal draft is a no-op; intermediate changes irrelevant
Clock earlier than or equal to original updatedChanged content saves; updated retains original value/representation
Prior updated has subsecond precision beyond generated defaultClamp never rounds backward
Missing updated with future createdSet updated to command time; no cross-field chronology restriction
Editor nonzero exit or invalid final draftSource unchanged; retain recovery draft
Concurrent source change while editor is openReject finalization; preserve external source and recoverable draft
Add/move collision or pre-publication write failureExisting files and their dates unchanged
Publication succeeds, durability confirmation or cleanup failsReport committed/uncertain outcome accurately; no promised rollback
Open, list, show, search, validateNo timestamp or history writes
No state, stale state, corrupt state, obsolete state.lockSame timestamp behavior; leftover files untouched and never consulted
Delete/recreate at same identifierAdd gets new dates; no inherited history
Removed sync commandOrdinary unknown-command failure; no reconciliation or migration

Run command-boundary cases against both human and JSON output where supported. Exercise editor finalization using a deterministic editor helper. Lock release, durable publication, move partial outcomes, and platform failure injection are covered by the locking, filesystem, move and prune tests; none of them keep lifecycle bookkeeping.

Development documentation (main). Use the docs bundled with your release for its exact contract.