Thing contract, C#: GameCult.Thing.Contract (thing2 cut 1b) #5

Merged
eureka merged 22 commits from hands/thing2-contract-cs into main 2026-11-27 17:54:26 +00:00
Owner

Thing 2.0 cut 1b: GameCult.Thing.Contract, the C# package of the Thing contract, held to the Rust goldens in crates/thing-contract.

Spec thing2:cut_spec:cut-contract-cs.r3 (libby mind). Four Hands attempts (h1-h4); Soul s1-s3 findings fixed, deferred or recorded; thing2:verdict:cut-contract-cs.s4 holds on every claim. Stryker on h3: 100% in range.

Not in this PR: the TypeScript package (cut-contract-ts.r3, next) and the 1x cross-store check, which waits on both.

🤖 Generated with Claude Code

Thing 2.0 cut 1b: `GameCult.Thing.Contract`, the C# package of the Thing contract, held to the Rust goldens in `crates/thing-contract`. Spec `thing2:cut_spec:cut-contract-cs.r3` (libby mind). Four Hands attempts (h1-h4); Soul s1-s3 findings fixed, deferred or recorded; `thing2:verdict:cut-contract-cs.s4` holds on every claim. Stryker on h3: 100% in range. Not in this PR: the TypeScript package (cut-contract-ts.r3, next) and the 1x cross-store check, which waits on both. 🤖 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>
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>
Merge branch 'main' into hands/thing2-contract-cs
All checks were successful
Portable Eve contracts and browser lowering / ubuntu-latest eve-browser-lowering (pull_request) Successful in 8m2s
Portable Eve contracts and browser lowering / ubuntu-latest eve-contracts (pull_request) Successful in 3m39s
57ea7647f5
eureka merged commit 7654e27364 into main 2026-11-27 17:54:26 +00:00
eureka deleted branch hands/thing2-contract-cs 2026-11-27 17:54:26 +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!5
No description provided.