Skip to content

Adopt OKF 62432a0: every timestamp is a datetime with a UTC offset - #60

Merged
leoafarias merged 2 commits into
mainfrom
feat/spec-62432a0-timestamps
Sep 11, 2026
Merged

leoafarias merged 2 commits into
mainfrom
feat/spec-62432a0-timestamps

Conversation

@leoafarias

Copy link
Copy Markdown
Member

Fixes #56. Also completes #57, together with #59. Stacked on #59: review and merge that first, and this PR will retarget to main.

Upstream 62432a0 (PR #323) makes every timestamp-valued key an ISO 8601 datetime with an explicit UTC offset (generated.at, verified[].at, stale_after, sources[].last_modified, usage_window). stale_after becomes an instant, and a concept is stale when now >= stale_after.

Validation (advisories only; conformance is unchanged)

  • New okf/timestamp-without-offset advisory. It flags date-only values, with the exact rewrite and a pointer to the migration, and datetimes that have no offset. The finding names the location, such as sources[0].last_modified.
  • okf/invalid-stale-after and okf/invalid-usage-window accept datetimes. Date-only values are still accepted there, so a bundle written for the old revision gets one migration advisory rather than two findings.
  • Rule order: the new ID follows okf/invalid-stale-after (see test/spec_rules/rule_test.dart).

Metadata (behavior change)

  • staleAfter, lastModified and the usage_window boundaries parse full instants. Date-only values are read as midnight UTC.
  • isStale / isStaleOn compare instants instead of local calendar days. Before, stale_after: 2026-09-23 meant "from local midnight"; it now means 2026-09-23T00:00:00Z, which is what the migrated value says. The parameter is renamed from today to now, which doesn't affect callers because it is positional.

Migration

  • okf format --migrate-timestamps rewrites date-only values to YYYY-MM-DDT00:00:00Z and lists each change (Migrated alpha.md: stale_after 2026-09-23 -> 2026-09-23T00:00:00Z). It works with --check.
  • The migration is opt-in: a plain okf format never changes a timestamp's value.
  • Datetimes without an offset are not rewritten, because the intended zone is unknown. The advisory asks for one.

Docs: the README and docs/conformance-matrix.md move the pin from 3fcbb9f to 62432a0 and add §5 and §5.5 rows.

Release: the isStale semantics change suggests 0.5.0. I haven't added a CHANGELOG entry, because the first ## <version> section feeds release notes; it will be added with the release.

Checks: dart analyze --fatal-infos is clean and dart test passes (225 tests). test/ci/gate_test.dart has formatter drift that is already on main; I didn't touch it here.

Base automatically changed from fix/strict-timestamp-parsing to main September 11, 2026 21:27
Every timestamp-valued key is now an ISO 8601 datetime with an explicit
offset, and stale_after is an instant compared as now >= stale_after.
Date-only values from earlier revisions still validate and are read as
midnight UTC; okf/timestamp-without-offset reports them and offset-less
datetimes as advisories. okf format --migrate-timestamps rewrites the
date-only values, which is the one form that migrates without guessing.
@leoafarias
leoafarias force-pushed the feat/spec-62432a0-timestamps branch from faaa189 to 5508064 Compare September 11, 2026 21:35
The matrix said date-only values read as midnight UTC, which is true only
for stale_after, usage_window and last_modified. generated.at and
verified[].at have always required a time, so a date-only value there
carries no instant; the row now says so, and notes that --strict fails on
the advisory and that migrating verified[].at can change trust_tier.

Adds the test that was missing for the compatibility promise: a bundle
full of date-only timestamps still reports isConformant, and each field
reads the way the matrix now claims.

Co-authored-by: Cursor <cursoragent@cursor.com>
@leoafarias
leoafarias merged commit f3f6d25 into main Sep 11, 2026
4 checks passed
@leoafarias
leoafarias deleted the feat/spec-62432a0-timestamps branch September 11, 2026 22:02
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.

Adopt OKF spec 62432a0: every timestamp is an ISO 8601 datetime with an explicit offset

1 participant