You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(abi)!: unify result-code contract across Zig and Idris2 (18 codes, machine-checked)
The two sides of the 'contractual' result-code mapping had silently
diverged: Zig GsaResult codes 5-12 (not_initialized/timeout/...) encoded
different concepts than Types.idr Result codes 5-12 (AlreadyConsumed/
ResourceLeaked/...). Nothing cross-checked them, so 124 green tests
shipped a broken cross-language contract.
- Types.idr keeps its stable 0-12 encoding and gains the five Zig-side
failure modes as codes 13-17 (NotInitialized, ProtocolError, IoError,
PermissionDenied, NotFound); all total functions extended.
- GsaResult now mirrors Result name-for-name and value-for-value,
including the linear-resource codes (already_consumed/resource_leaked/
double_free) the multi-handle model needs.
- New scripts/gen_result_codes.zig parses Types.idr's resultToInt
clauses into result_codes_expected.zig (same pattern as
gen_abi_expected.zig); a comptime block next to GsaResult turns any
name/value/cardinality drift into a compile error (verified by
injecting a deliberate mismatch).
- Call sites retargeted: parse_error -> config_parse_error,
VeriSimDB failures -> verisimdb_unavailable.
- The old 'values match Idris2 ABI' test asserted Zig literals against
the Zig enum; renamed to a sanity check, with the generated table as
the real contract.
BREAKING CHANGE: integer values of result codes 5-12 changed; consumers
holding numeric codes must rebuild against the new table.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TaWWedv6VQqeZaPvc94keN
0 commit comments