Skip to content

Improve .cbor control validation failure message#148

Merged
Soupstraw merged 2 commits intomasterfrom
jj/cbor-control-fix
Mar 12, 2026
Merged

Improve .cbor control validation failure message#148
Soupstraw merged 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
Contributor

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 Soupstraw force-pushed the jj/cbor-control-fix branch 2 times, most recently from c9aaa1d to 3af1905 Compare February 27, 2026 10:28
Soupstraw and others added 2 commits March 10, 2026 15:59
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Soupstraw Soupstraw force-pushed the jj/cbor-control-fix branch from 3af1905 to 33123b2 Compare March 10, 2026 13:59
@Soupstraw Soupstraw merged commit 6806dd7 into master Mar 12, 2026
11 checks passed
@Soupstraw Soupstraw deleted the jj/cbor-control-fix branch March 12, 2026 11:16
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