Repository navigation
feat: Codex v0.4 contract (JCS vectors at 8299fee) - #1
Merged
Merged
Conversation
Bring types, validation, money, and canonicalization to the @ui8kit/contract 0.2.0 profile at commit 8299fee. Vendor the 24 codex-entry/v1 vectors and pass them byte-for-byte. Co-authored-by: AlexY OS <alexy-os@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bring
github.com/fastygo/codexto Codex data contract v0.4, byte-compatible with@ui8kit/contract0.2.0 at commit8299fee(parent867eb06).Do not merge-tag
v0.4.0from this PR. Tag only after the contract owner confirms the official vectors.Official vectors (
codex-entry/v1)Pinned at
conformance/contract/(VERSIONcommit8299fee). The published file has 24 cases: 15 ok, 9 error (the request said 17/7; this table follows the actual file). Go matches canonical + digest, or the exact error code, on every case. No divergences to send back.d7ebf2ee…cc4a)9c71a088…96eb)d68d38dc…bfe3)0cf19364…538f)<>&U+2028 U+2029 emoji and Cyrillic stay unescaped73d79493…d4c9)c578a2a9…2ad9;1e21→1e+21)canonical.unsafe_integercanonical.unsafe_integer940b35fa…fe75)d7ebf2ee…cc4a)9c71a088…96eb)c03a841c…a512)canonical.fractional_secondscanonical.invalid_dateaaa00b45…4c37)3e8f0b66…8e53)canonical.unknown_fieldcanonical.duplicate_keycanonical.duplicate_keycanonical.invalid_idcanonical.missing_field{}in a json metadata value stays{}(not[])915cb2fb…e495)"0","1"stays an objectda511da9…7f47)fb8a8e68…2ef5)Runner:
canonical.Canonicalize/Digestagainstconformance/contract/fixtures/vectors/canonical.json.JCS implementation
canonical/is a local RFC 8785 port of@ui8kit/contractsrc/canonical.ts+docs/canonical.md(profile draft v0.4, including thecodex-manifest/v2paragraph). No third-party JCS library.encoding/jsonis not used for canonical output (it HTML-escapes<>&and\u-escapes U+2028/U+2029). Strict parser rejects duplicate keys and unsafe integers beforefloat64.Manifest.Digeststayscodex-manifest/v1(Goencoding/jsonofCanonical()).Manifest.DigestV2iscodex-manifest/v2:sha256:over JCS ofCanonical().Contract decisions vs Go
canonicalpackageprivate:true; omitprivate:falsesensitive; profile removes nothing on that basisResource.PublicProjectionstill does for the Go APInull/""/[]/{}; keepmetadata.<k>.valueYYYY-MM-DDTHH:MM:SSZ; offsets → Z;.000dropped; non-zero fraction errorsNumber.toString;-0→0;1e21→1e+21|n| > 2^53-1;9007199254740993.0→unsafe_integer9007199254740991entry.localized_mismatchvalidate.CollectionV04^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$onidonly, not*_id; integer PK<kind>-<n>entry.schema.jsonleft as\Sschema.CheckMoneyCurrencyschema.field.rule_unknownValidateFieldProfilecanonical.projectnullin requiredcanonical.missing_fieldorder:0/pinned:falsePending questions
None for this pin. Q2/Q7/Q8/Q9 are implemented as decided. If a later official vector disagrees, send the case name and Go output back to the contract owner — currently there is nothing to send.
Other v0.4 surface
(id, locale); chrome is a string;LocalizedText/Localesremoved;statusaddspending;origin/discussion/order/pinned/format.(entry_id, locale).validate.CollectionV04ports ISSUE_CODES_V04.migrate.EntryJSON/TaxonomyJSONconvert v0.3 → v0.4 for a requested locale and reject unsafe integers.scripts/refresh-ui8kit-contract.sh.go test -race.Verify locally:
go test -race -count=1 ./...,go vet ./...,gofmt -l .clean.