Skip to content

spec: pin well-known type semantics in refinement rules (RFC-001 §6.2) - #96

Merged
trendvidia merged 1 commit into
mainfrom
spec/061-wkt-semantics
Jul 16, 2026
Merged

spec: pin well-known type semantics in refinement rules (RFC-001 §6.2)#96
trendvidia merged 1 commit into
mainfrom
spec/061-wkt-semantics

Conversation

@trendvidia

Copy link
Copy Markdown
Owner

Closes #61 (spec item #12). Stacked on #95 (train: #94#95 → this); merge in order.

What

Ratifies the WKT binding semantics — pure spec text, no descriptor/lowering change. §6.2 becomes "Wrapper and well-known type handling" with five normative rules:

  1. Wrappers unwrap to the scalar (unchanged §6.2 behavior).
  2. Timestamp/Duration bind this to the engine-native temporal value; comparison operators are mandatory; temporal literals/helpers are engine-stdlib, not spec syntax. CEL's native mapping already conforms.
  3. Any never unwrapsthis.type_url refinement is canonical; auto-unpacking is forbidden (descriptor-pool inference + silent behavior change as pools grow). Payload access goes through an explicit function.
  4. All other messages bind structurally; no further special cases.
  5. Run-stable now(): current-time builtins return one instant per validation run — otherwise @validate(this > now()) is internally inconsistent within a collect-all Report and §6.5 memoization is unsound.

Also: §10 notes temporal comparisons are portable under --strict-portability; §13 row 3 resolved; CHANGELOG bullet; new schema-text fixture 09_wkt_refinements.proto (Timestamp/Duration/Any aliases).

Effect on shipped code

protocompile's type-alias lowering (base_type_fqn) is untouched and retroactively unambiguous — the audit's concern that #12 "retroactively affects the meaning of already-shipped type-alias lowering" is settled in the direction that requires no code change. protocheck M4 execution (#42) now has portable WKT semantics to implement against.

Resolves spec issue #12 (GH #61). Spec-text only — no descriptor or
lowering change; already-shipped type-alias lowering keeps its literal
base_type_fqn, this pins what it means at evaluation time.

- §6.2 expanded to five binding rules: wrappers unwrap (unchanged);
  Timestamp/Duration bind engine-native temporal values with mandatory
  comparison operators; Any never unwraps (type_url refinement is
  canonical, auto-unpacking forbidden as descriptor-pool inference);
  other messages bind structurally; engine now() builtins must be
  run-stable within one Report.
- §10: temporal comparisons count as portable under --strict-portability.
- §13 row 3 resolved; CHANGELOG updated.
- testdata/schema-extensions/09_wkt_refinements.proto: schema-text
  fixture with Timestamp/Duration/Any aliases (v1.2 grammar).
@trendvidia
trendvidia force-pushed the spec/061-wkt-semantics branch from ebcaac6 to 6efd650 Compare July 16, 2026 06:24
@trendvidia
trendvidia merged commit 3267390 into main Jul 16, 2026
4 checks passed
@trendvidia
trendvidia deleted the spec/061-wkt-semantics branch July 16, 2026 06:28
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.

Well-known types semantics (Timestamp, Duration, Any)

1 participant