RFC-0039 hash builtin argument encoding
Versioned draft snapshot
RFCs, reference catalogs, and evidence reflect Spec 3b2e3e7a114fb826b1445d39a48756b8fff629cd. Counts and pending/status notes belong to that snapshot. Read the dated project update for later progress.
Source repositories are private during staging. Links marked “repository access required” need access to the linked repository.
This is a trace and gap record from the pinned draft specification. It does not establish proof or implementation conformance.
RFC-0039 §5.2 promises hash(value, ...) with a canonical SHA-256 hex
result, but does not specify how multiple values or non-string expression
values become bytes. ExpressionFunctions.hash accepts variadic arguments;
the current graph template implementation consumes only the first string
argument. It also truncated the digest to 16 hex characters. The digest
truncation is corrected in the framework source with a focused test; the
variadic encoding contract remains undefined.
Recommended contract
Define a versioned, type-tagged canonical encoding for the ordered argument list, then return the full 64-character lowercase SHA-256 hex digest of those bytes. The encoding needs explicit rules for strings, finite numbers, booleans, null, bigints, instants, arrays, and maps with sorted keys, plus deterministic rejection of unsupported or cyclic values. Specify whether a single string uses the same framed encoding or retains the current raw UTF-8 hash for compatibility. Since no Gnomon deployment exists, a clean first release may choose one consistent framed form without legacy aliases.
The alternative is to change the normative signature to hash(value: string) and reject extra or non-string arguments. That is simpler but gives
up the documented variadic contract.
Acceptance criteria
- Authored RFC, Lean, RDF claim, TS function type, and runtime use the same argument domain and byte encoding.
- Conformance vectors cover different types, object-key order, argument boundaries, Unicode, full digest length, and deterministic errors.
- Template engine tests and cross-language expression conformance pass; the projection and generated-reference checks are regenerated from source.