Skip to content

test(codegen): pin FQN @objectRef payload codegen strips to bare names (Python + Kotlin)#190

Merged
dmealing merged 1 commit into
mainfrom
fix/payload-fqn-cross-port-tests
Jul 10, 2026
Merged

test(codegen): pin FQN @objectRef payload codegen strips to bare names (Python + Kotlin)#190
dmealing merged 1 commit into
mainfrom
fix/payload-fqn-cross-port-tests

Conversation

@dmealing

Copy link
Copy Markdown
Member

Summary

Cross-port coverage follow-up to the TypeScript promptRender FQN fix (54433a0b).

The TS bug: under package declaration, a nested @objectRef in a prompt-payload value-object canonicalizes to an FQN (pkg::Name, FR-032/ADR-0041), and the TS payload generator emitted it verbatim as both the field type and the interface name → invalid TypeScript. Fixed on main with a regression test.

I then checked all four other ports. The FQN-leak is TS-only — Java, C#, Kotlin, and Python payload-VO codegen all already strip the package (structured name construction: splitFqn / StripPkg / KotlinPoet ClassName(pkg, name) — vs TS's string interpolation that let :: leak). Java and C# already have full-FQN regression tests (C# even Roslyn-compiles the output). Python and Kotlin were correct but had no test forcing a real package-qualified @objectRef through that path — this PR closes those two gaps.

Changes (test-only — no product code)

  • Python (test_payload_vo_generator.py): test_plain_object_field_strips_fqn_to_bare_nested_payload — a plain field.object @objectRef="acme::ai::Note" isArray on a payload VO emits list[NotePayload] + class NotePayload(BaseModel), and the referenced FQN never leaks. (Closes the only payload path with zero unit coverage.)
  • Kotlin (KotlinPayloadGeneratorTest.kt): a two-package fixture (Note in acme::ai referenced from Report in acme::demo) forces a real prefix through PackageMapping.splitFqn; asserts val notes: List<NotePayload> + data class NotePayload, and no :: in any emitted identifier.

Verification

  • Python: pytest test_payload_vo_generator.py → 21 passed (+1).
  • Kotlin: mvn -pl codegen-kotlin test -Dtest=KotlinPayloadGeneratorTest → 7 passed.

Both pass on first run (the product code was already correct). Non-TS, so no PyPI/Maven republish needed — the shippable fix (TS promptRender) is already on main.

Follow-ups (out of scope — surfaced during the hunt, unconfirmed, no fixture)

  1. C#: the top-level @payloadRef selector matches on bare c.Name == payloadRef — may not match an FQN payloadRef.
  2. Kotlin: multi-package nested-payload dedupe emits the nested class into the referring template's package → possible unresolved import when one VO is referenced from templates in two packages.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FaRaYFjvWVV8D6h33ejj1m

…s (Python + Kotlin)

Cross-port coverage follow-up to the TS promptRender FQN fix (54433a0). An investigation of
all four non-TS ports found the FQN-leak is TS-only — Java/C#/Kotlin/Python payload-VO codegen
already strip the package (splitFqn / StripPkg / KotlinPoet ClassName(pkg,name)) — but Python
and Kotlin lacked a test forcing a real package-qualified @objectref through that path.

- Python: test_plain_object_field_strips_fqn_to_bare_nested_payload — a plain field.object
  @objectref="acme::ai::Note" isArray on a payload VO emits list[NotePayload] + class
  NotePayload(BaseModel), never the FQN.
- Kotlin: a two-package fixture (Note in acme::ai referenced from Report in acme::demo) forces
  a real prefix through PackageMapping.splitFqn; asserts val notes: List<NotePayload> + data
  class NotePayload, no '::' in any emitted identifier.

Test-only, no product-code change (all four ports were already correct). Java + C# already had
equivalent FQN regression tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FaRaYFjvWVV8D6h33ejj1m
@dmealing
dmealing merged commit 24a7d4e into main Jul 10, 2026
1 check passed
@dmealing
dmealing deleted the fix/payload-fqn-cross-port-tests branch July 10, 2026 18:09
dmealing added a commit that referenced this pull request Jul 10, 2026
…nt-context skills

npm-only patch, 14-package lockstep 0.15.17 -> 0.15.18. TS-only; PyPI/NuGet/Maven unchanged.
Non-breaking; advances the 1.0 quiet period.

- fix(codegen-ts): promptRender emits bare TS names for FQN @objectref payload refs (54433a0)
- fix(agent-context): broken skill YAML front-matter, wrong C# ref, deploy-all -> stack-scoped,
  deprecated imports, tanstack paths, ADR-0040 index.lookup, stale Kotlin fixture (red on main)
- test(codegen): cross-port Python + Kotlin FQN regression coverage (#190)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FaRaYFjvWVV8D6h33ejj1m
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