[Meta] Cross-module .vxlib surface: what survives flat-model serialization end to end
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 14
- Forks
- 2
- Avg merge
- 12h 42m
- Merged PRs (30d)
- 61
Description
Tracks what can cross a .vxlib boundary — the serialized flat-model interface ({frozen registry + flat HIR bodies}) that a downstream compile consumes without parsing the library's source.
Sibling of epic hiraditya/Vx.1#224. hiraditya/Vx.1#224 asks "can the stdlib stop being part of the AST?"; this issue asks the more general "which language constructs survive serialization end to end?". The stdlib is the most demanding consumer of that surface, so hiraditya/Vx.1#224 depends on this being broad enough — but the surface matters independently for any precompiled Vx library.
Verified state
Audited against e912fc70. Every row was run, not read: the library was compiled to a .vxlib, its source deleted, and the consumer compiled and JITed against the artifact alone. Verified through both --link-interface and bare import auto-resolution (VX_STD_PATH).
| Surface | State | Owner |
|---|---|---|
| Functions — call, params, return | ✅ runs (double(21) → 42) |
— |
| Structs — construct, field read, return by value | ✅ runs (→ 7) | — |
| Consumer outside the flat subset | ✅ clean diagnostic, no ICE | — |
Methods — c.get() on an imported type |
❌ Method 'get' not found — serialized but never consulted |
hiraditya/Vx#219 |
Generics — ident<T>(1) |
❌ signature crosses, cannot instantiate | hiraditya/Vx.1#221 |
| Enums — payload-free, imported | ❌ enum_variants empty on deserialize + flat emit declines |
hiraditya/Vx.1#274 |
| Enums — data-carrying | ❌ blocked upstream of serialization | hiraditya/Vx.1#233 |
| Traits / trait impls | ❌ no trait_impls table in the registry at all |
hiraditya/Vx.1#218 |
The protocol itself is sound — two surfaces are fully runnable, versioned, and fail-closed on a stale artifact. What is missing is breadth, not design.
Codec state
serialize_registry_interface / deserialize_registry_interface (src/metadata.rs) cover module_indices, layouts, fn_sigs, methods, bodies, structs. Magic + FNV format hash; Err on bad magic, version mismatch, or truncation — never a silent misread. Round-trip and driver-level tests pass (9/9).
Note the split between serialized and usable: methods round-trips correctly but resolution never queries it, and generic signatures transport but do not substitute. "In the artifact" and "works across the boundary" are different questions, and most remaining gaps are on the second.
Correctness / infrastructure defects
Independent of coverage, both found while auditing this surface:
#291— fixed (af73b993). Two artifacts defining the same type name collided silently inmerge_from, first-wins on the name-keyed tables, non-deterministically (5/10 identical runs failed).structsis now GID-keyed so same-named structs coexist;fn_sigs/methods/enum_variantspoison an import-vs-import conflict. Re-verified: 200/200 check-level and 60/60 JIT runs across both import orders, including the same-arity/different-field-type case that would previously have misread silently.#292— fixed (df192f10).--emit-interfacenow reports per-table encoded/skipped counts.- #294 — follow-up to hiraditya/Vx.1#291: a poisoned name is reported as
Undefined functionrather than as an ambiguity. Thepoisoned_*tombstones are written and never read outsideregistry.rs, so no diagnostic can tell "never defined" from "defined twice". Diagnostics only;methods/enum_variantsinherit it the moment hiraditya/Vx#219/#274 make them reachable.
Suggested order
#291and#292are done. hiraditya/Vx.1#294 (the poisoned-name diagnostic) is cheap and worth doing before hiraditya/Vx#219/#274, since those make two more poisoned tables reachable and each would otherwise inherit the same misleading message.- #219 — the method flip. Highest value-per-effort: the dual-run gate at
src/hir/check/calls.rs:1249-1278already asserts, across the whole suite, that the registry resolves every concrete non-generic method the AST does. The oracle is proven; only consuming it remains. - #274 (enums) and #221 (generic monomorphization) — the substantive coverage work.
- #218 (
trait_impls) — needed for trait-dispatch-heavy stdlib modules. - #220's
std.vxlibbuild step — deliberately last. It is mostly plumbing (nothing understdlib/is precompiled today and no build rule produces it), but a precompiled stdlib is only useful once methods/generics/traits cross, and only safe now that hiraditya/Vx.1#291 and hiraditya/Vx#292 have landed.
Related
- Epic hiraditya/Vx.1#224 (stdlib decoupling) — the primary consumer of this surface.
- hiraditya/Vx.1#197 / hiraditya/Vx.1#201 — the flat pipeline; the artifact is the same flat HIR the flat codegen consumes, so coverage here tracks flat-codegen coverage.
- hiraditya/Vx.1#242, hiraditya/Vx.1#233 — flat-codegen surfaces (generic aggregates, tagged-union enums) that gate what can be serialized at all.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the suggested follow-up order, especially src/hir/check/calls.rs:1249-1278 and the registry interface code in src/metadata.rs. Run the existing dual-run and driver-level tests to understand the verified flat-model boundary. Done means the remaining listed surfaces work from a serialized .vxlib with the source removed, with diagnostics and coverage updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100