Skip to content

Conversation

@stephencelis
Copy link
Member

@stephencelis stephencelis commented Oct 29, 2025

We had a bug in enum decoding that resulted in the decoder missing a few columns along the way.

Fixes #218.

We had a bug in enum decoding that resulted in the decoder missing a few
columns along the way.
// if true {
if ProcessInfo.processInfo.environment["SPI_GENERATE_DOCS"] != nil {
if ProcessInfo.processInfo.environment["SPI_GENERATE_DOCS"] != nil
|| ProcessInfo.processInfo.environment["CI"] != nil
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ensure enum tests are actually running in CI.

Comment on lines +2578 to +2579
let photo = try decoder.decode(Photo.self)
let note = try decoder.decode(String.self)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to call decoder.decode for every type so that the query decoder's cursor advances to the proper column offset.

Comment on lines 392 to -565
fileprivate enum Kind {
case link(URL)
case note(String)
case notes(Attachment.Notes)
@Column(as: [String].JSONRepresentation.self)
case notesInline([String])
case video(Attachment.Video)
case image(Attachment.Image)
}

@Selection fileprivate struct Notes {
@Column(as: [String].JSONRepresentation.self)
let list: [String]
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acosmicflamingo Sorry, I reverted these tests since they weren't actually running on CI and were actually failing with the changes I made.

I do wonder if this PR fixes some of the issues you were seeing, though!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No big deal! I'll have to see when I'm in front of a computer.

@mbrandonw mbrandonw merged commit 34a57f2 into main Oct 30, 2025
3 checks passed
@mbrandonw mbrandonw deleted the enum-selection-fix-2 branch October 30, 2025 16:51
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.

4 participants