-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Problem
Recursive Aiken types (e.g. a multisig script type that contains a list of itself) are not covered by the blueprint codegen pipeline. The gap spans three layers:
-
No Aiken source with a recursive type — there is no `.ak` file in the repo that defines a self-referencing type, so no `plutus.json` is ever generated from one.
-
No blueprint fixture for a recursive definition — `Blueprint.test.ts` has no test case where a definition's `$ref` points back to itself (directly or transitively). Without a fixture, whether the codegen emits correct `Schema.suspend(() => ...)` wrapping for self-references is untested.
-
No end-to-end codegen → encode/decode roundtrip test — `TSchema.recursive.test.ts` proves that `TSchema` itself handles recursive schemas correctly (e.g. MultisigScript from SundaeSwap), but there is no test that:
- Takes a blueprint JSON with a recursive definition
- Runs `generateFromBlueprint`
- Validates the generated TSchema encodes and decodes recursive values correctly
Why it matters
The codegen already emits `Schema.suspend(() => ...)` for forward references (controlled by `useSuspend` in `CodegenConfig`), but this is only verified against non-recursive definitions in the current test suite. A true recursive type exercises a different code path — the suspend wrapping must appear on the field that references the containing type, not just a sibling definition — and this is untested.
Acceptance Criteria
- An Aiken contract with at least one recursive type is added (or a `plutus.json` fixture is added directly if adding Aiken source is out of scope)
- `Blueprint.test.ts` has a test case for a recursive definition that validates the generated code string contains correct `Schema.suspend` wrapping
- A roundtrip encode/decode test exercises the generated schema with a recursive value