Skip to content

feat(devops): proto-to-zod v2 — oneof, cycle detection, tests#7588

Merged
h0lybyte merged 2 commits intodevfrom
trunk/kbve-devops-proto-zod-v2-1772581208
Mar 4, 2026
Merged

feat(devops): proto-to-zod v2 — oneof, cycle detection, tests#7588
h0lybyte merged 2 commits intodevfrom
trunk/kbve-devops-proto-zod-v2-1772581208

Conversation

@h0lybyte
Copy link
Member

@h0lybyte h0lybyte commented Mar 4, 2026

Summary

  • 204 unit tests across 5 spec files with shared mock descriptor factories (test-factories.ts)
  • Oneof support: mapOneof() emits z.union() for message-only and z.union([z.object(...)]) for mixed/scalar oneofs; emitter iterates msg.members instead of msg.fields
  • Circular dependency detection: Three-color DFS in topoSortMessages returns lazyRefs: Set<string>; mapField auto-wraps in z.lazy() (existing fieldOverrides take precedence)
  • Multi-package support: protoPackage accepts string | string[]
  • Well-known type inlining: google.protobuf.Timestampz.string().datetime(), Structz.record(), wrapper types, etc.
  • Field rename conflict detection: throws at codegen time if two fields map to the same output name

Test plan

  • nx test devops — 204 tests pass, 0 skipped
  • Manually verify OSRS output unchanged (existing fieldOverride for z.lazy takes precedence over auto)
  • Test against kbve/common.proto (KeyValue oneof)

…o-zod

- Add 204 unit tests across 5 spec files with shared mock factories
- Add oneof support: mapOneof() emits z.union() for oneof groups
- Add cycle detection: three-color DFS in topoSort returns lazyRefs
- Auto z.lazy() for circular message references
- Emitter iterates msg.members (not msg.fields) for correct oneof ordering
- Multi-package support: protoPackage accepts string | string[]
- Well-known type inlining (Timestamp, Struct, wrapper types, etc.)
- Field rename conflict detection in emitter
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@h0lybyte h0lybyte merged commit 6fc846e into dev Mar 4, 2026
5 checks passed
@h0lybyte h0lybyte deleted the trunk/kbve-devops-proto-zod-v2-1772581208 branch March 4, 2026 01:22
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