Skip to content

feat(kdl): serde serialization write-back for annotation lists - #17137

Merged
dezren39 merged 2 commits into
mainfrom
xaltha/0212k-17134-kdl-se
Nov 30, 2026
Merged

dezren39 merged 2 commits into
mainfrom
xaltha/0212k-17134-kdl-se

Conversation

@dezren39

@dezren39 dezren39 commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Closes #17134

pkgs/id/vendor/kdl/src/se.rs had no annotation handling: a struct carrying the reserved fields landed by #15749 (@annotations, @children-annotations, #<n>#type, #@<prop>#type) serialized without emitting the annotations, so a deserialize -> serialize round trip silently dropped every annotation.

Change

  • NodeChildMapSerializer (the node-struct path, struct and map forms) now treats the reserved field names as annotation fields, mirroring the de.rs contract:
    • @annotations and the legacy #type set the node's annotations; @children-annotations sets the children-block annotations.
    • #<n>#type annotates the n-th positional argument; #@<prop>#type annotates a property's value (checked before the plain #@<prop> property branch).
    • Annotation lists are arrays of the raw payload strings; a single string is a one-element list.
    • An annotation field naming an entry serialized later in the same struct is applied once that entry exists; one naming an entry that never appears is an error at end(), not a silent drop.
  • No change to the de.rs contract or field naming landed by Add KDL annotation serde shapes #15749.

Tests

tests/fork_serde.rs gains: serialize-emission of all four reserved field kinds, a de -> se -> de fixed-point round trip, the (object)(predicate#knows)triple (person)(agent)alice acceptance shape round trip, out-of-order declaration (annotation field before its entry), and the dangling-annotation error case.

Lane 0212-K (xaltha). Authored via the Git-API contents route after this seat's code clone was removed mid-run by a sandbox recycle; pooled fleet gh was wedged (repeated >100s timeouts), so the final writes used the documented FLEET_GH_RAW=1 last-resort hatch.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 38 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 52642752-5481-47c9-8de4-2d11c6054bbe
Commits

Reviewing files that changed from the base of the PR and between 9f2aea8 and 6a6779d.

Files selected for processing: 2

  • pkgs/id/vendor/kdl/src/se.rs
  • pkgs/id/vendor/kdl/tests/fork_serde.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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.

kdl fork: serde serialization (se.rs) write-back for annotation lists (#5753 Packet B follow-on)

1 participant