Skip to content

test: inline hoisting is pinned at one source position out of nine #254

Description

@OmarAlJarrah

Problem

testdata/conformance/openapi/inline-types.yaml is twelve lines and pins inline-schema hoisting at
exactly one source position: a nested inline object inside a component schema. hoist_test.go covers
interning idempotence, not positions.

Hoisting happens at many more positions than that. Probing nine — parameter schema, request-body root,
response-body root, response-header schema, array items, nested property, additionalProperties,
webhook body, callback body — with an inline oneOf at each produces sixteen type nodes with distinct
pointer-derived IDs, zero dangling targets and zero error diagnostics. So the behaviour is right
today; what is missing is anything that would notice if one position regressed.

That matters more here than for a typical coverage gap. CLAUDE.md already records this exact
mechanism failing once: the pointer collision was "fixed in the union lowering and left standing in
the inline-position hoist on the same branch, because the fix was scoped to where it was noticed."
Per-position coverage is the guard that would have caught the second site.

For reference, oapi-codegen's internal/test/aggregates/hoisting/spec_implicit.yaml pins seven
positions — response-body root, array items, nested property, request-body root, request-body
property, webhook, callback — precisely because each was a separate bug.

Proposed direction

One conformance case with an inline composite at every position the compiler can hoist from, asserting
per position: a node is interned, its ID derives from the source pointer, and the referring site points
at it. Positions to cover, at least:

  • parameter schema, response-header schema
  • request-body root, request-body property
  • response-body root, response-body property
  • array items, additionalProperties, tuple prefixItems entry
  • union branch
  • webhook operation body, callback operation body

Two things the case should do beyond existing:

  • run under the two-order oracle, since a colliding hoist passes in one declaration order and fails in
    the other;
  • declare the positions in an order that would have caught the original collision, not the order the
    correct lowering already produces.

Related: #71 (corpus traceability) would surface the missing rows systematically.

Acceptance

  • Every hoist position has an asserted node with a pointer-derived ID.
  • Reverting the pointer-namespace fix at any single position reddens the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions