fix: tolerate non-leading $type in polymorphic payloads (closes #50) #51
No reviewers
Labels
No labels
breaking-change
bug
documentation
duplicate
enhancement
good first issue
help wanted
performance
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Grandiras/ATProto.NET!51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/out-of-order-type-metadata"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Bluesky appview serializes embed views with the discriminator LAST
({"external": …, "$type": …}) and real-world record writers do the
same inside record unions — System.Text.Json needs
AllowOutOfOrderMetadataProperties for that. Set it in both
AtProtoJsonDefaults.Options and LexiconTypeRegistry.CreateOptions().
Fixes getPosts/getPostThread/timeline deserialization wherever a post
carries an embed. Regression tests with the captured appview shape.
Found by Mise's engagement hydration (anchor share-post resolution).
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
The Bluesky appview serializes embed views with the discriminator LAST ({"external": …, "$type": …}) and real-world record writers do the same inside record unions — System.Text.Json needs AllowOutOfOrderMetadataProperties for that. Set it in both AtProtoJsonDefaults.Options and LexiconTypeRegistry.CreateOptions(). Fixes getPosts/getPostThread/timeline deserialization wherever a post carries an embed. Regression tests with the captured appview shape. Found by Mise's engagement hydration (anchor share-post resolution). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>@claude-bot Please fix the conflicts.
🤖 On it — follow along in the action run; the reply will link the full session transcript.
8b88f9732924f529d1e1Conflicts resolved —
fix/out-of-order-type-metadatais now rebased ontomain(669b851) and force-pushed.The conflict was CHANGELOG-only. Both sides appended to
## [Unreleased] → ### Fixed:mainhad picked up the two OAuth handle-resolution entries from #52/#54, and this branch adds the #50 polymorphic-$typeentry. I kept all of them, ordering the #50 bullet after the #52 entries and before the pre-existingDirectory.Build.propsbullet. No code files conflicted — the actual fix (AllowOutOfOrderMetadataPropertiesinAtProtoJsonDefaults.OptionsandLexiconTypeRegistry.CreateOptions()) and the regression tests replayed cleanly.I rebased rather than merged so the PR stays a single commit (
24f529d), matching the repo's one-commit-per-issue workflow.Verified (had to install the .NET 10 SDK in the container first — it wasn't present):
dotnet build -p:EnableSourceControlManagerQueries=false→ 0 errors; the 1160 warnings are pre-existing (CS1591 XML-doc gaps, one Razor RZ10012).dotnet test tests/ATProtoNet.Tests/ -p:EnableSourceControlManagerQueries=false→ 942 passed, 0 failed, 0 skipped.OutOfOrderTypeMetadataTestsspecifically → 3 passed, so the captured appview shape still deserializes on top of the rebasedmain.⏱ 1m 54s · 17 turns · tokens: 22.0k in / 3.7k out (+505.6k cache-read)
📜 Full session transcript