Thing contract, TypeScript: @gamecult/thing-contract (thing2 cut 1a) #6

Merged
eureka merged 36 commits from hands/thing2-contract-ts into main 2026-11-27 20:43:02 +00:00
Owner

Thing 2.0 cut 1a: the TypeScript package of the Thing contract, held to the Rust goldens in crates/thing-contract: presence held on both codec doors against the Rust-blessed nil vector (2866 rows), results validated and frozen deep at one factory, every codec named to its C# reference type (C# ParityTests refuse a TS store with one drifted name).

Spec thing2:cut_spec:cut-contract-ts.r3; reports h1, h2; Soul thing2:verdict:cut-contract-ts.s2 holds and fixes all four s1 findings. TS 83/83, C# 101/101. One Low follow-up: decoded payload bytes are a mutable Uint8Array.

🤖 Generated with Claude Code

Thing 2.0 cut 1a: the TypeScript package of the Thing contract, held to the Rust goldens in `crates/thing-contract`: presence held on both codec doors against the Rust-blessed nil vector (2866 rows), results validated and frozen deep at one factory, every codec named to its C# reference type (C# ParityTests refuse a TS store with one drifted name). Spec `thing2:cut_spec:cut-contract-ts.r3`; reports h1, h2; Soul `thing2:verdict:cut-contract-ts.s2` holds and fixes all four s1 findings. TS 83/83, C# 101/101. One Low follow-up: decoded payload bytes are a mutable Uint8Array. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
One C# type per Rust type, keys in the crate's slot order. Unions are abstract classes with an
internal constructor and sealed arms; unit arms are shared instances. ThingDomain owns the four
domains and ThingKeys the key grammar. CommandResult is built by four factories only; its
constructor is private. Builds against CultLib b3bd8dd5 through CultLibRoot. Tests follow in the
next commit; this one builds.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Goldens, refusals, store read, keys, domains at every constructor and every door (CultLib
MessagePack, MessagePack Standard, System.Text.Json), factories-only reflection, deepest chain
the 256 bound admits. Goldens are linked from crates/thing-contract/tests/goldens, read only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Comment-only; builds.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Does not build-verified yet: the first Yggdrasil run follows.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Builds (tsc strict); tests not yet run to completion.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The factory and key builders took a non-integer through the decode leaf; the encode leaf refuses it. Deep chain bound corrected to 83 Box levels.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Rename kind to input_kind at key 2 (the wire is the slot key; no golden byte moves).
nil_positions.rs walks every array element of every value golden, splices nil over it and
records whether the Rust decode door accepts it, into goldens/nil-positions.tsv. The tsv is
blessed by the next commit; this one builds, and its nil test fails until then.
golden_bytes, blessing and goldens_dir move to tests/common so both test files share one path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Blessed with THING_BLESS=1 on Yggdrasil; the sha256 list of every existing golden is identical
before and after (only this file is new), and the compare run passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ThingDomain.Present and Items; every constructor, factory and key builder passes each non-nullable
reference parameter through Present (refusal names the slot, never a value) and each list through
Items (a private read-only copy, nil items refused). Lists are IReadOnlyList on every type.
TextInputNode's slot 2 property and parameter are InputKind, matching Rust input_kind.
Tests: NilPositionTests reads the Rust vector row by row; PresenceTests and ReadOnlyListTests
walk every door by reflection; InputKindNameTests. NameSetTests and the unit-arm rewrite follow.
Unit-arm statics are still present in this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deleted the 38 + 17 + 3 internal static Instance fields and public static unit-arm properties.
Unit arms are built with new ImageFitContain() and told by a type test; the arm constructors are
public. Builders rewritten (65 uses); UnitArmTests replaces the SameAs assertions: every decoded
unit arm is its arm type, no union base exposes a static member of its own kind, and
new ImageFitFill() still writes 92 02 90.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two previous GameCult.Thing.Contract commits do not build: ParamDecl's constructor assigned
InputKind. This restores Kind = Present(kind, "Kind").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
catalog-members.tsv (27 rows) and type-names.txt (168 types) are generated from the C# types on
Yggdrasil at CultLib b3bd8dd5 and read by NameSetTests; the package owns the names, every other
runtime is held to them. NameSetTests also patches System.Int64 to System.Int32 in a store C#
wrote and requires reopen to refuse. Presence and list tests no longer count ThingDomainException
as a door.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A store whose id still matches the local registry is not compared, so the patched store changes
the id and Int64 together, as a real shape change does. Presence threshold set to the measured
174 required slots. goldens/README.md is the base file plus the nil-vector section (the earlier
commit rewrote its line endings).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reopening a single-file store at CultLib b3bd8dd5 does not compare recorded type names (a store
patched in id and Int64 opens and reads), so the test hands ResolvePersistedSchema a persisted
catalog entry with one member type changed (and one with Assets as a List): both are refused,
and the same entry with a moved id and unchanged names resolves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An entry equal to the local one in content hash resolves as Exact without comparing names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under thing2:ruling:payload-bytes-read-only the payload holds a copy made at
construction (wire bytes unchanged). New tests: a T[] argument (including
through Builders.Boxed) is copied; no list of any decoded golden is writable;
a caller's buffer written after construction does not change the payload. The
byte[] exemption in the mutable-collection scan is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the false comment that reopening never compares type names with the
end-to-end pin: id, content hash and a member type name moved together are
refused; the same patch without the type name opens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous two commits do not build: Command.cs lacked the using. This one
restores the build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reopen test from a9f8b2c did not build without it; this restores the test build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The nil-positions vector found the regression (invocation-all-inputs 4.1: the
view decodes nil to default and was accepted though Rust refuses). ThingDomain.Present
for byte views refuses an empty view with no backing store; an empty array stays a
present, empty payload. Test pins both and the empty payload's wire round trip.
The commits before this one fail NilPositionTests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MemoryMarshal.TryGetArray answers true for any empty view, so it cannot tell nil
from empty; equality with default can. The commit before this fails the new payload test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Present(ReadOnlyMemory<byte>) is deleted. The constructor copies any view, default
included, as an empty payload; a nil on the wire (which decodes to a default view) is
noted by the constructor and refused in OnAfterDeserialize, so the nil-positions rows hold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GameCult.Thing.Contract.Tests: the empty-payload tests use the MessagePack options RecordPayload is not a document
Some checks failed
Portable Eve contracts and browser lowering / windows-latest eve-browser-lowering (pull_request) Waiting to run
Portable Eve contracts and browser lowering / windows-latest eve-contracts (pull_request) Waiting to run
Portable Eve contracts and browser lowering / ubuntu-latest eve-browser-lowering (pull_request) Failing after 2m33s
Portable Eve contracts and browser lowering / ubuntu-latest eve-contracts (pull_request) Failing after 3m0s
3dadfc6349
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
present() refuses nil on decode and null/undefined on encode in every slot the Rust type does not make optional;
required() goes. mint runs the slot record, so factories hold every domain the decode door holds, and freezes the
outcome and effect deep. ParamName/Scalar become the C# arm codecs; lists are named IReadOnlyList<T>. codecs and
definitions tests read the names and members from tests/thing-contract-parity.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
thing-contract-ts: present's slot names are held by a test, and its forwarded getters are not enumerable (Stryker survivors)
Some checks failed
Portable Eve contracts and browser lowering / ubuntu-latest eve-browser-lowering (pull_request) Has been cancelled
Portable Eve contracts and browser lowering / ubuntu-latest eve-contracts (pull_request) Has been cancelled
47fba57a6d
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Merge origin/main into hands/thing2-contract-ts (parity README: keep the branch's superset)
All checks were successful
Portable Eve contracts and browser lowering / ubuntu-latest eve-browser-lowering (pull_request) Successful in 1m32s
Portable Eve contracts and browser lowering / ubuntu-latest eve-contracts (pull_request) Successful in 3m51s
65b82b2dcd
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eureka merged commit 31f324f738 into main 2026-11-27 20:43:02 +00:00
eureka deleted branch hands/thing2-contract-ts 2026-11-27 20:43:03 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/Thing!6
No description provided.