feat(adt-plugin-gcts): schema-aware generic emit/parse for all wave2 stubs
User description
Stops stubs at a minimal envelope: genericToMetadata now emits
formatVersion+header plus every top-level body property the payload
carries, resolved from the type's official schema. formatVersion flows
through the payload so a v1 document re-emits as v1 (cfdf/sito/uiad
narrow in v2 — blind latest-version emission produced invalid output);
fresh objects emit latest.
genericFromMetadata spreads body fields into the deserialize payload so
they land on obj._data — full metadata round-trip fidelity.
generic.ts is workspace-dep-free (ajv + node only) so the mechanics are
testable without builds; wave2-generic.ts is now thin registry wiring.
tests/aff/generic-roundtrip.test.ts: every upstream example for every
stub type emits schema-valid metadata + survives the round-trip —
2/2 pass. Covers W1 families and W2 singletons mechanically; dedicated
handlers remain for source companions and special file shapes (W3).
Generated with Devin
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Stack created with GitHub Stacks CLI • Give Feedback 💬
Summary by Sourcery
Preserve schema-defined AFF fields and document versions across generic wave2 metadata round-trips.
New Features:
- Add schema-aware generic AFF metadata handling for wave2 stub types, preserving supported body fields during serialization and parsing.
- Preserve declared AFF format versions during round-trips while using the latest version for new objects.
Bug Fixes:
- Prevent older AFF documents from being re-emitted with incompatible newer schema versions.
Enhancements:
- Move generic AFF emit/parse logic into a reusable, workspace-independent module and simplify wave2 handler registration.
Tests:
- Add round-trip coverage confirming upstream examples produce schema-valid metadata and retain all supported body fields.
Summary by cubic
Makes wave2 generic AFF stubs schema-aware so metadata round-trips losslessly. genericToMetadata now emits formatVersion, header, and every top-level body property the payload carries, resolved from the type's official schema, instead of a hardcoded minimal envelope; genericFromMetadata spreads those body fields back into the payload so they land on obj._data.
formatVersion flows through the payload: a v1 document re-emits as v1 (cfdf/sito/uiad narrow in v2, so blind latest-version emission produced invalid output), while fresh objects emit the latest. The mechanics live in generic.ts, which has no workspace dependencies and is testable without builds; wave2-generic.ts is now thin registry wiring.
Round-trip tests verify every upstream example for every stub type emits schema-valid metadata and survives the trip back; dedicated handlers still cover source companions and special file shapes.
Summary by CodeRabbit
- New Features
- Generic AFF objects now retain supported format versions and include the body properties defined for that version.
- Converting AFF metadata back to generic objects preserves defined body fields and relevant language-version information.
- Bug Fixes
- Generic object conversions now handle header and body fields more consistently, improving compatibility across supported AFF object types.
CodeAnt-AI Description
Preserve AFF fields and document versions during generic handler round-trips
What Changed
- Generic handlers now include schema-supported body fields when emitting metadata and restore those fields when parsing it.
- Existing documents retain their declared format version when re-emitted; new documents use the latest schema version.
Impact
✅ Fewer AFF fields lost during round-trips
✅ Valid output for documents using older AFF versions
💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
@codeant-ai ask: Your question here
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
@codeant-ai ask: Can you suggest a safer alternative to storing this secret?
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
@codeant-ai: Your feedback here
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
@codeant-ai: Do not flag unused imports.
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
@codeant-ai: review
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.