Skip to content

Improve .cbor control validation failure message#148

Open
Soupstraw wants to merge 2 commits intomasterfrom
jj/cbor-control-fix
Open

Improve .cbor control validation failure message#148
Soupstraw wants to merge 2 commits intomasterfrom
jj/cbor-control-fix

Conversation

@Soupstraw
Copy link
Contributor

@Soupstraw Soupstraw commented Feb 26, 2026

Improved error messages for failing .cbor validation. It now displays that a .cbor control is unsatisfied instead of throwing a "Not implemented" error.

Related: IntersectMBO/ouroboros-consensus#1892

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves .cbor control validation failures so they are reported as an unsatisfied control (instead of throwing a runtime "Not yet implemented" error), and adds golden coverage to lock in the new behavior.

Changes:

  • Make .cbor byte-string control validation return False on decode/validation failure, allowing the validator to emit UnsatisfiedControl rather than crashing.
  • Add a new Huddle example and golden test (cborControlBad) to validate the improved error output.
  • Refactor the generator test example naming/exports to use customGenExample instead of simpleTermExample.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Codec/CBOR/Cuddle/CBOR/Validator.hs Replaces the .cbor control’s runtime error with a normal validation failure (False).
test/Test/Codec/CBOR/Cuddle/CDDL/Validator/Golden.hs Adds a golden test case that triggers an unsatisfied .cbor control.
test/Test/Codec/CBOR/Cuddle/CDDL/Examples/Huddle.hs Introduces cborControlExample and renames the custom generator example exports.
test/Test/Codec/CBOR/Cuddle/CDDL/GeneratorSpec.hs Updates generator specs to reference customGenExample.
golden/cborControlBad.txt Captures the expected pretty-printed error output for the failing .cbor control.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Soupstraw and others added 2 commits February 27, 2026 12:27
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

2 participants