Skip to content

tests: add soundness tests - #432

Merged
stringhandler merged 2 commits into
BlockstreamResearch:masterfrom
stringhandler:st-soundness-tests
Oct 13, 2026
Merged

stringhandler merged 2 commits into
BlockstreamResearch:masterfrom
stringhandler:st-soundness-tests

Conversation

@stringhandler

Copy link
Copy Markdown
Collaborator

Creates a set of tests to cover all errors. Each error will either have a .simf file that reproduces it, or a link to the unit test.
The purpose is to cover the possibility of allowing an error in future. I think this structure should at least help us when adding new Errors.

There are a few errors that are never generated in the code, and they are marked Untestable. I'll either create issues for these or fixes.

Mostly generated by LLM.

@stringhandler
stringhandler requested a review from delta1 as a code owner October 6, 2026 09:26
@stringhandler

Copy link
Copy Markdown
Collaborator Author

Note that this does break the rule that a commit may not remove code introduced in a previous commit, because the first commit just adds the single test files, and the second commit fixes the ones identified as Gap. I can squash them if it bothers anyone.

@KyrylR KyrylR left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ACK 395c3ba; successfully ran local tests + new ones

@KyrylR KyrylR left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

utACK 9ea8c3e

Each file in functional-tests/error-test-cases/single-file names the Error
variant it must produce. One test compiles every file and checks that the
named variant is among its diagnostics, so a check that stops firing fails
the test.

A table in src/error_cases.rs lists every Error variant with an exhaustive
match, so a new variant does not compile until it has a case file or a
reason it has none (covered elsewhere, untestable, or a known gap).

Assisted-by: Claude
Add unit tests where the errors are raised: ExternalFileNotFound and
FileNotFound in resolution, FileNotFound for an unreadable import in the
driver, and RawHashJetsUnavailable with a jet hinter that lacks the
SHA-256 context jets.

Point the coverage table at these and at the existing resolution tests
for the other dependency errors. No variant is left uncovered, so drop
the Gap status.

Assisted-by: Claude
@stringhandler
stringhandler merged commit 2b48934 into BlockstreamResearch:master Oct 13, 2026
14 checks passed
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