Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions 04-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ collection, and a value such as `0.3.0-rc.5` is invalid.

| Key | Type | Default | Meaning |
| --- | --- | --- | --- |
| `settings.timezone` | string | local runtime | durable IANA timezone for authority-owned calendar semantics |
| `settings.timezone` | string | none | durable IANA timezone for type matching, floating date-times, and other collection-owned calendar semantics |
| `settings.types_folder` | string | `_types` | folder containing type files |
| `settings.contracts_folder` | string | `_contracts` | folder containing data contract files |
| `settings.record_extensions` | list of strings | `[md]` | record file extensions without dot |
Expand All @@ -67,6 +67,12 @@ calendar authority or model daylight-saving transitions. An invalid configured
timezone makes the collection configuration invalid; an implementation MUST
NOT silently substitute its runtime timezone.

At a date-time location (Chapter 10), this setting resolves a floating
`local-date-time` to an instant. If the setting is absent, the floating value
stays a string and the record receives a `timezone_required` warning stating
that the collection needs `settings.timezone`. Implementations MUST NOT use
the runtime timezone or an invocation timezone for this resolution.

The types and contracts folders MUST be different normalized paths. Both are
reserved control-file folders and are excluded from ordinary record discovery.

Expand All @@ -93,15 +99,16 @@ single record being written. Checks are divided into three tiers:
| cross-record | `collection.unique` rules with `enforce: report`, `link_not_found`, link `target_type` mismatches, `ambiguous_link`, and `path_collision` | reported, never rejected |

A single-record check depends only on the record's own path, frontmatter,
body, and the type registry. A cross-record check also depends on other
records; such a check never blocks a write, because another tool, another
device, or a later edit can change the other records at any time. The only
exception is a uniqueness rule that explicitly opts into `enforce: write`
(Chapter 07).
body, the collection configuration, and the type registry. A cross-record
check also depends on other records. It never blocks a write, because another
tool, another device, or a later edit can change the other records at any time.
The only exception is a uniqueness rule that explicitly opts into
`enforce: write` (Chapter 07).

`path_value_inconsistent` and `path_field_in_frontmatter` (Chapter 07) are
single-record checks whose severity is always `warning`: they are reported at
levels `warn` and `error` and never reject a write.
`timezone_required` and the Chapter 07 diagnostics `path_value_inconsistent`
and `path_field_in_frontmatter` always have severity `warning`. Tools report
these single-record diagnostics at levels `warn` and `error`. They never
reject a write.

`path_value_normalized` (Chapter 07) is not a validation issue. It is a
warning in the result of the write that normalized the value, at every
Expand All @@ -123,7 +130,7 @@ through an engine.
| --- | --- | --- | --- |
| `off` | not performed | return records without validation diagnostics | write without record validation |
| `warn` | performed | return records with `warning` diagnostics | write and report `warning` diagnostics |
| `error` | performed | return records with `error` diagnostics | fail before writing when the resulting record has a single-record issue; write and report cross-record issues as `warning` diagnostics |
| `error` | performed | report issues as errors except for warning-only checks | reject a single-record error, otherwise write and report warnings |

At every level a read returns the record, including an invalid one, and a query
evaluates every candidate. Queries do not report per-record validation issues
Expand Down
15 changes: 15 additions & 0 deletions 06-json-schema-profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,27 @@ profile requires assertion behavior for:

- `format: date`
- `format: date-time`
- `format: local-date-time`
- `format: time`

`date`, `time`, and `date-time` use the RFC 3339 productions referenced by JSON
Schema. `date-time` values MUST contain `Z` or a numeric UTC offset. Invalid
values produce `format_invalid` diagnostics.

A `local-date-time` is a floating clock time. It consists of an RFC 3339
`full-date`, an uppercase `T`, and `HH:MM`. Seconds (`:SS`) are optional.
When seconds are present they may be followed by a decimal point and one or
more ASCII digits. Clock components use two ASCII digits each, with hours
from 00 to 23 and minutes and seconds from 00 to 59. Examples include
`2026-11-27T08:00`, `2026-11-27T08:00:00`, and `2026-11-27T08:00:00.5`.
Invalid calendar dates, invalid clock times, and values with a `Z` suffix
or numeric offset MUST fail with `format_invalid`. Validation of this
format does not require a timezone.

A schema using `local-date-time` remains valid JSON Schema 2020-12. Outside
mdbase, unknown formats are annotations under the base dialect. Hosts that
assert mdbase formats must register `local-date-time`.

Other formats such as `email`, `uri`, and `uuid` MAY be asserted by
implementations. Collections that require them depend on implementation-specific
behavior until a conformance profile defines their semantics.
Expand Down
43 changes: 34 additions & 9 deletions 10-cel-profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,38 @@ strings:
- A **timestamp** is CEL's standard `google.protobuf.Timestamp`.
- A **duration** is CEL's standard `google.protobuf.Duration`.

Date fields therefore stay strings in every context. In query, projection, and
lifecycle contexts, a string at a location that every matched schema declares
`format: date-time` becomes a timestamp, because date-time offsets make string
comparison unreliable. A schema location is reachable from the root through
`properties`, `items`, and local `$ref`; locations inside `allOf`, `anyOf`,
`oneOf`, `not`, and conditional subschemas are not used for typing. A value
that fails its format stays a string and the record reports `format_invalid`.
Untyped date-times are converted explicitly with `timestamp()`.
Date fields stay strings in every context. In query, projection, and lifecycle
contexts, a location is a **date-time location** when the record matches at
least one schema and every matched schema declares at that location either:

- `format: date-time` or `format: local-date-time`
- an `anyOf` or `oneOf` whose every branch is a string schema with one of
those two formats

Locations are reachable from the root through `properties`, `items`, and
local `$ref`. The date-time union above is the sole exception to the rule
that locations inside `anyOf` and `oneOf` are not used for typing. Locations
inside `allOf`, `not`, and conditional subschemas are also excluded. A field
whose branches mix `date` with date-time formats stays a string, even when
the value contains an offset.

At a date-time location, a string that satisfies every matched schema's
declared format becomes a CEL timestamp: an offset date-time resolves
directly, and a floating date-time resolves to that clock time in the
collection's `settings.timezone`. Omitted seconds are zero. When the clock
time occurs twice during an overlap, use the earlier instant. When the clock
skips that time during a gap, move the clock time forward by the length of
the gap. This matches RFC 5545 and Temporal's `compatible` disambiguation.

Without `settings.timezone`, a floating value that satisfies the location's
declared format stays a string and the record gets the warning
`timezone_required` (Chapter 04). Implementations MUST NOT substitute the
runtime or invocation timezone. A value that fails a matched schema's
declared format — such as a floating value in a `format: date-time`-only
field, or an offset value in a `format: local-date-time`-only field — stays a
string and reports `format_invalid` alone (without `timezone_required`).
Floating date-times introduce no new CEL functions. An untyped offset
date-time can be converted explicitly with `timestamp()`.

### Functions

Expand Down Expand Up @@ -299,7 +323,8 @@ Date results are already strings. A timestamp result serializes as an RFC 3339
date-time in UTC with a `Z` suffix. A duration result serializes as a CEL
duration string in seconds, such as `"5400s"`. Typing never changes persisted
or `effective_frontmatter` values; it applies only to expression evaluation and
expression results.
expression results. The engine never rewrites a floating value as an instant.
Lifecycle `now: true` continues to write a UTC timestamp with a `Z` suffix.

## Text Helpers

Expand Down
23 changes: 15 additions & 8 deletions 11-querying.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,24 @@ the tool. In ascending order, values sort first by kind:
| 6 | map | by number of keys |
| 7 | null or missing | all equal |

A string is of the date or date-time kind only when the tool knows it is one:
Rank 3 includes:

- the value of a field of a typed record, when every type the record
matches declares the same `format: date` or the same `format: date-time`
for that field, and the value is valid for that format and, for a
date-time, has an offset
- a valid `date` field of a typed record when every matched type declares
`format: date`
- a valid offset date-time at a date-time location as defined in Chapter 10
- a valid floating date-time at such a location when `settings.timezone` is
configured, ordered by its resolved instant alongside offset date-times
- a projection or selection value that is a CEL timestamp

Every other string is of the string kind, however it is written: a string
that merely looks like a date is not guessed to be one, and an invalid value
in a `format: date` field sorts as a string, after every valid date.
Every other string sorts at rank 4. This includes a floating date-time when
the collection has no `settings.timezone`, an invalid date or date-time, an
untyped string that looks like a date, and a field whose schema mixes
`date` and date-time branches.

Changing `settings.timezone` can change the resolved instant of a floating
value and its position in a query. Implementations MUST include the
collection timezone (including its absence) in the catalog fingerprint for
materialized index rows and invalidate cached query state that depends on it.

Two lists with the same number of items, and two maps with the same number
of keys, compare equal whatever they contain. A query that needs an order
Expand Down
5 changes: 3 additions & 2 deletions 14-conformance.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ The v0.3 core codes include `invalid_request`, `duplicate_batch_path`,
`invalid_data_contract`, `data_contract_not_found`, `data_contract_conflict`,
`data_contract_version_mismatch`, `data_contract_binding_invalid`,
`data_contract_field_invalid`, `data_contract_record_invalid`,
`invalid_timezone`, and the JSON Schema `schema_<keyword>` codes from Chapter
`timezone_required`, `invalid_timezone`, and the JSON Schema `schema_<keyword>` codes from Chapter
06. Runtime profile 0.2 reuses interoperability codes such as
`unknown_contract`, `contract_digest_conflict`, `no_provider`,
`ambiguous_provider`, and `capability_denied`, and additionally defines
Expand Down Expand Up @@ -247,7 +247,8 @@ CEL implementations MUST:
- support the CEL optional types extension
- supply the system bindings defined for that context in Chapter 10
- preserve the mdbase missing, null, raw, and effective-value contract
- type `format: date-time` values as timestamps and provide `now()`,
- type offset and floating values at date-time locations according to Chapter
10 and provide `now()`,
`today()`, the date conversions, and the date-string methods with declared
timezone behavior
- provide the `lower()` and `upper()` text helpers with Unicode default case
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this specification and conformance suite are documented here.

## Unreleased

- The profile asserts `local-date-time` for floating clock times. At
date-time locations, CEL and query ordering resolve them in the collection
timezone. When the setting is absent they remain strings and validation
reports a `timezone_required` warning.

## Runtime standard pack 0.2.1 and `@callumalpass/mdbase-runtime` 0.2.1 (2026-11-17)

The specification itself is unchanged.
Expand Down
2 changes: 1 addition & 1 deletion schemas/v0.3/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"timezone": {
"type": "string",
"minLength": 1,
"description": "Durable IANA timezone for collection-authority calendar semantics"
"description": "Durable IANA timezone for type matching, resolving floating date-times, and other collection-owned calendar semantics"
},
"types_folder": {
"type": "string",
Expand Down
Loading
Loading