Skip to content

format: define context name as a referenceable identifier (activation correlation)#236

Merged
gnidan merged 2 commits into
transform-contextfrom
architect-name-correlation-id
Jul 3, 2026
Merged

format: define context name as a referenceable identifier (activation correlation)#236
gnidan merged 2 commits into
transform-contextfrom
architect-name-correlation-id

Conversation

@gnidan

@gnidan gnidan commented Jul 3, 2026

Copy link
Copy Markdown
Member

Implements the approved #26 design (gnidan + team-lead sign-off, per-program uniqueness confirmed). Format spec + schema-description change only — no schema structure change, no code.

Why

name was always intended as the machine-generated identifier for a context that other contexts reference by name — the #179 "pick disambiguation label" framing undersold it. This states that purpose clearly and applies it as the invoke/return correlation id, which is the principled fix for the two cases push/pop + the inline marker alone cannot handle (identified during the #23 inline work):

  • adjacent same-function activations (two inlined copies back-to-back, no caller gap) — a marker-run rule merges them;
  • reordered / interleaved bodies — a return moved ahead of its invoke defeats strict push/pop pairing.

Distinct per-activation names resolve both, order-independently.

What changes

  • name.schema.yaml — rewrite the description: a machine-generated identifier, referenceable by other contexts, unique within a program (one instructions sequence). Refreshed examples. No structural change (still { name: string }).
  • name.mdx — frame name first as the general referenceable-context-name primitive, then pick selection and invoke/return correlation as applications. Notes that co-located facts needing distinct names (e.g. a tailcall's return+invoke) use gather, one name per member.
  • invoke.mdx — add a "Correlating with name" subsection to Reconstructing activations: an invoke declares an activation's name, return/membership reference it; when present, names are authoritative for activation structure, with push/pop + marker-count as the name-less fallback (they agree in well-nested output; where they can't, names win).

Model notes (from the design thread)

Compiler emission (bugc inlining pass → per-activation names) and UI consumption are deferred — this PR freezes the spec shape first. Full design write-up in the #26 proposal.

Reframe the `name` context from a "disambiguation label" to its
intended purpose: a machine-generated identifier for a context that
other contexts reference by name, unique within a program. State the
per-program uniqueness requirement.

Apply it to activation reconstruction: an `invoke` context declares an
activation's name; the matching `return` and the body's member
instructions reference it. This pairs a call with its return
order-independently — resolving the two cases push/pop + the inline
marker alone cannot: adjacent same-function activations and
reordered/interleaved bodies. When present, names are authoritative for
activation structure; push/pop + marker-count are the name-less
fallback.

- name.schema.yaml: rewrite description (purpose + uniqueness); examples.
- name.mdx: frame `name` as the referenceable-context-name primitive,
  then pick-selection and invoke/return correlation as applications;
  note gather carries distinct co-located names (tailcall).
- invoke.mdx: add "Correlating with `name`" to Reconstructing
  activations (Layer 2 authoritative when present).

No schema structure change.
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-03 01:19 UTC

…eely)

Per writer review of #236: 'a name must be unique' misread as 'appears
once', but a name deliberately recurs — the invoke declares it, the
return and every body instruction reference it. State the requirement on
the declaration: each name is declared by exactly one context; other
contexts reference it freely. Mirror the wording across name.schema.yaml,
name.mdx, and invoke.mdx. Plus prose polish (marker-run phrasing, pick
handle).
@gnidan gnidan merged commit 1e90935 into transform-context Jul 3, 2026
4 checks passed
@gnidan gnidan deleted the architect-name-correlation-id branch July 3, 2026 01:15
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.

1 participant