Skip to content

format: correct activation correlation — activation id inside invoke/return/revert, scope name to pick#240

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

format: correct activation correlation — activation id inside invoke/return/revert, scope name to pick#240
gnidan merged 2 commits into
transform-contextfrom
architect-activation-id

Conversation

@gnidan

@gnidan gnidan commented Jul 3, 2026

Copy link
Copy Markdown
Member

Corrects the #236 correlation mechanism (gnidan's ruling, task #29). Format spec + schema only — no code, no structural break.

The flaw #236 had

#236 overloaded the name context to also correlate invoke↔return. But a sibling name inherently declares the context it sits in — so a return carrying the same name to "reference" the activation would be a second declaration of that name, violating the per-name uniqueness we froze. The declaration/reference asymmetry was right; the mechanism (one primitive for both roles) was not.

The fix — two identifiers for two jobs

  • name → scoped back to pick-selection (its ergonomic home: the identifier a pick selects by). Reverts format: define context name as a referenceable identifier (activation correlation) #236's cross-context-reference over-scope in name.schema.yaml + name.mdx; uniqueness is only "distinct among a pick's alternatives." The format: add Name context type and guard to TS types #238 Context.Name TS type stays valid — name isn't going away, just scoped.
  • activation → a new correlation id inside the call facts. An opaque string living inside the invoke/return/revert objects. The invoke that opens an activation and the return/revert that closes it carry the same value; distinct activations carry distinct values, unique per program.

Why this is clean

  • Symmetric — both endpoints carry activation; matching values pair them. No declare/reference asymmetry, no primitive doing a job it structurally can't.
  • Flat, no gather forced — a tailcall back-edge's co-located return+invoke each carry their own activation value as flat siblings: { return: { …, activation: "iter3" }, invoke: { …, activation: "iter4" } }.
  • Identity vs instance kept separateactivation is deliberately NOT on the shared function-identity schema (identity = which function; activation = which instance).

Files

  • name.schema.yaml, name.mdx — revert to pick-selection framing.
  • invoke.schema.yaml, return.schema.yaml, revert.schema.yaml — add optional activation string (+ an example on the inlined invoke).
  • invoke.mdx — swap "Correlating with name" → "Correlating with activation": id-based pairing, order-independent, push/pop the id-less fallback. Membership stays marker-only (adversarial-reorder membership deferred).

Verification

yarn workspace @ethdebug/format test green — 449 passed, incl. schema validity (70) + examples (317); the new activation example validates (confirms the properties+$ref+unevaluatedProperties interaction on invoke).

Follow-ups: debugger adds activation to the Invoke/Return/Revert TS types; compiler emission + UI pairing deferred until the shape is frozen here.

…` to pick

#236 overloaded the `name` context to also correlate invoke/return, but
a sibling `name` inherently *declares* the context it sits in — so a
`return` carrying the same `name` would be a second declaration,
violating the per-name uniqueness. Correct it with two distinct
identifiers for two distinct jobs (gnidan's ruling):

- `name` — scope back to its ergonomic home: the identifier a `pick`
  selects by. Revert #236's cross-context-reference over-scope in
  name.schema.yaml + name.mdx; uniqueness is only "distinct among a
  pick's alternatives". (The #238 Context.Name TS type stays valid.)
- `activation` — a new opaque-string correlation id living INSIDE the
  invoke/return/revert objects. The invoke that opens an activation and
  the return/revert that closes it carry the same value; distinct
  activations carry distinct values, unique per program. Symmetric (no
  declare/reference asymmetry) and flat — a tailcall back-edge's
  co-located return+invoke each carry their own `activation`, no
  `gather` forced.

invoke.mdx: replace "Correlating with `name`" with "Correlating with
`activation`" — id-based pairing, order-independent, push/pop the
id-less fallback; membership stays marker-only.

Kept out of the shared function-identity schema (identity = which
function; activation = which instance). Spec + schema only; TS types
(activation on Invoke/Return/Revert) follow separately.
@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 21:56 UTC

…ifies')

Per writer review of #240: (A) the opening of 'Correlating with
activation' lumped membership into the well-nested-order clause, but
membership is the order-independent inline marker (as the section's own
para 4 says) — the blind spot is a pure push/pop pairing problem. Scope
the sentence to push/pop only. (B) 'activation names which instance' →
'identifies', avoiding an echo of the now-disentangled name context.
gnidan added a commit that referenced this pull request Jul 3, 2026
The activation-id correction (#240 schema) adds an optional `activation`
string on the invoke, return, and revert context objects — the opening
invoke and the closing return/revert share the same value to pair an
activation independent of trace order.

Mirror that in the TS types: add `activation?: string` to
Invoke.Invocation, Return.Info, and Revert.Info. Placed per-object to
track the schema (activation is added on each of invoke/return/revert,
not on the shared context/function identity schema). No guard change —
activation is an optional field on an existing object, not a new context
discriminator.
@gnidan gnidan merged commit ee6c1ee into transform-context Jul 3, 2026
4 checks passed
@gnidan gnidan deleted the architect-activation-id branch July 3, 2026 21:52
gnidan added a commit that referenced this pull request Jul 3, 2026
…241)

The activation-id correction (#240 schema) adds an optional `activation`
string on the invoke, return, and revert context objects — the opening
invoke and the closing return/revert share the same value to pair an
activation independent of trace order.

Mirror that in the TS types: add `activation?: string` to
Invoke.Invocation, Return.Info, and Revert.Info. Placed per-object to
track the schema (activation is added on each of invoke/return/revert,
not on the shared context/function identity schema). No guard change —
activation is an optional field on an existing object, not a new context
discriminator.
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