Skip to content

feat: member tables, schema revision, and native64/wasm32 layout certs (#775) - #1365

Closed
godofecht wants to merge 2 commits into
mainfrom
cursor/type-identity-775-remaining-2ea3
Closed

godofecht wants to merge 2 commits into
mainfrom
cursor/type-identity-775-remaining-2ea3

Conversation

@godofecht

@godofecht godofecht commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #775

Intent

Linked issue or roadmap item: #775 (remaining slice after merged #1340).

What changed, and why is this the smallest useful change?

#1340 shipped family/schema IDs, alignof, and TransportSafe. This slice adds the three remaining capabilities named on that PR and on the issue:

  • @schema_revision(N) on struct / enum / type aliases, included in type_schema_id (not type_family_id)
  • type_member_count<T>() / type_member_table<T>() — target-independent public-field description
  • type_sizeof_* / type_alignof_* / type_layout_* for native64 (ptr=8) and wasm32 (ptr=4)

No new reflection syntax. IDs and certificates stay compile-time integer constants.

Overlap check

  • I searched open pull requests and recent commits for overlapping work.
  • This does not duplicate another active implementation, or the relationship is explained below.

Overlap / dependency notes: #1340 is merged. No open PR covered the remaining #775 surface.

Evidence

Baseline before this change: family/schema IDs and TransportSafe exist; there is no member table, no schema revision attribute, and no native64-vs-wasm32 layout certificate.

Targeted proof that exercises the changed behaviour:

  • flowc selftest type_id_ok=1 (revision, member count/table, Point layout match, HasPtr 16 vs 8)
  • tests/lang/test_type_schema_layout.flow
  • tests/scripts/type_identity.flow (revision vs family, member table, layout certs)

Why that proof would detect the old failure or regression: the old compiler rejects the new builtins and @schema_revision on types; a family that absorbed revision would fail the same-name script check; equal layout certs for HasPtr would fail the pointer-divergence check.

Repository gate(s) run:

  • env -u FLOWC_IN -u FLOWC_OUT "$(./flow tool compiler/scripts/flowc_host.flow)" → flowc: PASS including type_id_ok=1
  • ./compiler/scripts/bootstrap_from_c.sh --regen → fixed point at gen2
  • ./compiler/scripts/bootstrap_from_c.sh --verify → ALL PASS bootstrap_from_c
  • ./flow test-lang → all 267 language tests passed (includes test_type_identity.flow and test_type_schema_layout.flow)
  • ./flow tool tests/scripts/type_identity.flow → 6 passed (declaration order, field order, field type, schema revision vs family, member table, native64/wasm32 layout certs)
  • ./flow tool compiler/scripts/fmt_check.flow --check → fmt gate OK

Generated/bootstrap state: compiler/bootstrap/flowc_stage_a.c regenerated after the source edits in a separate commit.

Risk

Compatibility, performance, security, lifetime, backend, or release implications:

Additive builtins and one type-level attribute. Unversioned type_schema_id values are unchanged (;rev;N is omitted when N is 0).

  • No unresolved language/API design decision is being implemented implicitly.
  • No unrelated generated artifacts or local state are included.
  • Docs changed when user-visible behaviour or syntax changed.
  • docs/project/Questions.md updated if this needs a language-design decision.

The three-level split and schema-revision-in-digest were already decided on #775.

Compatibility

  • No user-visible compatibility change.
  • Compatibility change is documented in docs/project/CHANGELOG.md.

CHANGELOG notes the additive surface under Unreleased.

Agent handoff

Cloud agent implementing the remaining #775 slice. Do not merge from this session.

Open in Web Open in Cursor 

@godofecht

Copy link
Copy Markdown
Contributor Author

Design decision, 2026-10-07, decided by the project owner: accepted.

@schema_revision(N), type_member_count<T>(), type_member_table<T>() and the type_sizeof_* / type_alignof_* / type_layout_* names for native64 and wasm32 become public API at Experimental stability, so they can change before a 1.x review.

Condition before merge: register them as experimental in stability/surfaces.json (checked by ./flow tool stability_manifest). This PR does not touch that file yet. A suitable entry:

{
  "id": "type-reflection",
  "kind": "language-feature",
  "classification": "experimental",
  "source": "docs/language/type-identity.md",
  "owner_issue": 775,
  "note": "@schema_revision(N), type_member_count<T>(), type_member_table<T>() and the per-target type_sizeof_*, type_alignof_* and type_layout_* names for native64 and wasm32 are public API at Experimental stability (decided 2026-10-07). They may change before a 1.x review."
}

Also fold in from closed #1387 the docs/coverage.json entry for type-identity.md and the tests/scripts/doc_coverage.flow change, leaving out its scratch output files. Recorded in docs/project/Questions.md by #1422.

godofecht added a commit that referenced this pull request Oct 7, 2026
The project owner decided six open design questions on 2026-10-07:
orchestration starts as a std.orchestrate library (#723, #1393 closed),
request and persistent lifetime domains (#1369), @Lifetime on struct
fields with LD5 (#1358), last-use moves without a move keyword or COW
(#1354), the type reflection API at Experimental stability (#1365), and
the Linux release qualification policy (#1399).

Questions.md archives each one. The Flow 3.0 tracker records the
library-first rule for orchestration. Follow-up on persistent and
TransportSafe is #1421.
godofecht added a commit that referenced this pull request Oct 7, 2026
The project owner decided six open design questions on 2026-10-07:
orchestration starts as a std.orchestrate library (#723, #1393 closed),
request and persistent lifetime domains (#1369), @Lifetime on struct
fields with LD5 (#1358), last-use moves without a move keyword or COW
(#1354), the type reflection API at Experimental stability (#1365), and
the Linux release qualification policy (#1399).

Questions.md archives each one. The Flow 3.0 tracker records the
library-first rule for orchestration. Follow-up on persistent and
TransportSafe is #1421.
godofecht added a commit that referenced this pull request Oct 7, 2026
The project owner decided six open design questions on 2026-10-07:
orchestration starts as a std.orchestrate library (#723, #1393 closed),
request and persistent lifetime domains (#1369), @Lifetime on struct
fields with LD5 (#1358), last-use moves without a move keyword or COW
(#1354), the type reflection API at Experimental stability (#1365), and
the Linux release qualification policy (#1399).

Questions.md archives each one. The Flow 3.0 tracker records the
library-first rule for orchestration. Follow-up on persistent and
TransportSafe is #1421.
#775)

The remaining slice of #775. @schema_revision(N) on structs, enums and
aliases feeds type_schema_id without changing type_family_id.
type_member_count<T>() and type_member_table<T>() expose the members.
type_sizeof_*, type_alignof_* and type_layout_* give native64 and wasm32
layout descriptors separately from the semantic IDs.

The names are public at Experimental stability per the 2026-10-07
decision; stability/surfaces.json gains a type-reflection surface.

Rebased from PR #1365 onto current main (CHANGELOG conflict kept both
sides).
Fixed point at gen2; bootstrap_from_c.sh --verify passes.
@godofecht
godofecht force-pushed the cursor/type-identity-775-remaining-2ea3 branch from bae20d2 to 721a4bb Compare October 7, 2026 15:30
@godofecht

Copy link
Copy Markdown
Contributor Author

Prepared for merge on main 3f577d08 (two commits: source 0bbc0374, bootstrap regen 721a4bb3).

  • Rebased by applying the PR's source diff onto main; the CHANGELOG conflict keeps both entries.
  • Added per the 2026-10-07 decision (docs/project/Questions.md, "Public type reflection API and its stability tier"): a type-reflection surface in stability/surfaces.json, classification experimental, owner Expose stable type identity and reflection for cross-target runtime schemas #775. stability_manifest: OK, 18 surfaces.
  • Added attribute:schema_revision to docs/coverage.json (doc_coverage reported it as having no home).

Gates on the rebased tree: flowc selftest PASS; --regen fixed point gen2; --verify PASS; test-lang pass; test-runtime pass; typecheck_rules pass; parity_lowering pass; tests/cgen pass; parse_coverage --check pass; fmt_check --check pass; self_host_full ALL PASS; roundtrip ALL PASS; tests/scripts/type_identity 6/0; doc_examples --check-ledger, doc_links, doc_coverage clean; tests/cli 152/2 (jit_hello, test_mlir: golden drift on main).

parity_mlir reports 6 corpus goldens changed (test_attributes, test_parser_python_forms, test_parser_span_mutability, test_recognition_ssa, test_semantic_stack, test_typecheck_overload_integration). main's own flowc gives the same 6, so this predates the PR.

godofecht added a commit that referenced this pull request Oct 7, 2026
#775)

The remaining slice of #775. @schema_revision(N) on structs, enums and
aliases feeds type_schema_id without changing type_family_id.
type_member_count<T>() and type_member_table<T>() expose the members.
type_sizeof_*, type_alignof_* and type_layout_* give native64 and wasm32
layout descriptors separately from the semantic IDs.

The names are public at Experimental stability per the 2026-10-07
decision; stability/surfaces.json gains a type-reflection surface.

Rebased from PR #1365 onto current main (CHANGELOG conflict kept both
sides).
godofecht added a commit that referenced this pull request Oct 7, 2026
#775)

The remaining slice of #775. @schema_revision(N) on structs, enums and
aliases feeds type_schema_id without changing type_family_id.
type_member_count<T>() and type_member_table<T>() expose the members.
type_sizeof_*, type_alignof_* and type_layout_* give native64 and wasm32
layout descriptors separately from the semantic IDs.

The names are public at Experimental stability per the 2026-10-07
decision; stability/surfaces.json gains a type-reflection surface.

Rebased from PR #1365 onto current main (CHANGELOG conflict kept both
sides).
@godofecht

Copy link
Copy Markdown
Contributor Author

Landed in #1369 as 32401c7 (lane A train). The #775 source change was carried as its own commit, with the doc_coverage attribute count raised to 23 and the affected MLIR corpus digests re-recorded.

@godofecht godofecht closed this Oct 7, 2026
@godofecht
godofecht deleted the cursor/type-identity-775-remaining-2ea3 branch October 12, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose stable type identity and reflection for cross-target runtime schemas

1 participant