Repository navigation
t27b: carry std.ArrayList(T) and std.StringHashMap(V) that are never opened (type (generic)) #8701
Description
Problem
t27b refuses two specs that the reference (t27c gen + zig test) passes, both as type (generic) (docs/reports/t27b_expectations.json):
specs/port/trinity/src/tri-api/claude_md.t27:parts: *std.ArrayList(u8)parameters of fns no test calls (line 15, line 21).specs/port/trinity/src/phi-engine/vibeec_original/bogatyrs_registry.t27: a struct fieldplugins: std.StringHashMap(PluginEntry), set toundefinedand never read (line 14); every test then cascades asExprCall(rejected fn).
What Zig does
Neither spec opens the container: no method call, no field read. Zig instantiates the generic with its argument, which must name a type, and the struct it returns has a size that does not depend on the argument. Measured with zig 0.16.0 on the t27c lab, Debug build: @sizeOf(std.ArrayList(T)) is 24, @sizeOf(std.StringHashMap(V)) is 40, both aligned to 8.
Plan
In line with #8696 (see #7917), which carries a std.mem.Allocator as an opaque value: t27b carries std.ArrayList(T) and std.StringHashMap(V) as structs with no fields and Zig's Debug layout, after naming the argument as a pointee. Calls and field reads keep their refusals by name. Any other generic stays type (generic). The decision lives in specs/tri/t27b/opaque_plan.t27; no real generics are needed.
Acceptance
- Both specs pass
t27b test <spec> --checkwith runtime asserts, or move on to their next blocker; the ledger rows follow. - The t27b lab corpus moves only those two files.
- Net hand lines <= 0 (check_budget).
User Scenarios
- Given a spec
specs/port/trinity/src/tri-api/claude_md.t27withparts: *std.ArrayList(u8)parameters on uncalled fns, When runningt27b test <spec> --check, Then the spec passes with runtime asserts instead of refusingtype (generic). - Given a spec
specs/port/trinity/src/phi-engine/vibeec_original/bogatyrs_registry.t27with a struct fieldplugins: std.StringHashMap(PluginEntry)set toundefinedand never read, When runningt27b test <spec> --check, Then the spec passes with runtime asserts instead of cascadingExprCall(rejected fn).
Requirements
- FR-001: t27b MUST carry
std.ArrayList(T)as an opaque struct of size 24, alignment 8, after namingTas a pointee. - FR-002: t27b MUST carry
std.StringHashMap(V)as an opaque struct of size 40, alignment 8, after namingVas a pointee. - FR-003: The opaque layout decision MUST be recorded in
specs/tri/t27b/opaque_plan.t27without introducing real generics. - FR-004: Calls and field reads on these carried types MUST keep their existing refusals by name.
- FR-005: The ledger
docs/reports/t27b_expectations.jsonMUST update only the two cited spec rows. - FR-006: Net hand lines MUST be <= 0 as verified by
check_budget.
Success Criteria
t27b test specs/port/trinity/src/tri-api/claude_md.t27 --checkexits 0 with runtime asserts.t27b test specs/port/trinity/src/phi-engine/vibeec_original/bogatyrs_registry.t27 --checkexits 0 with runtime asserts.docs/reports/t27b_expectations.jsonshows only the two cited spec rows changed fromtype (generic)refusal to pass.check_budgetreports net hand lines <= 0.
Boundary
- specs/port/trinity/src/tri-api/claude_md.t27
- specs/port/trinity/src/phi-engine/vibeec_original/bogatyrs_registry.t27
- specs/tri/t27b/opaque_plan.t27
- docs/reports/t27b_expectations.json
- scripts/tri_loop/t27b.py
Activity
t27b: carry std.ArrayList(T) and std.StringHashMap(V) that are never …