Skip to content

fix(ci-compliance): survive a file the engine throws on - #28

Merged
sakanni merged 3 commits into
developfrom
internal-tickets-#58-CatchPerFileInComplianceRunner
Oct 16, 2026
Merged

sakanni merged 3 commits into
developfrom
internal-tickets-#58-CatchPerFileInComplianceRunner

Conversation

@sakanni

@sakanni sakanni commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Issues addressed by this PR

Closes #29

A compliance rule that throws on one file took the whole run with it. The check went red, which is right, but it named no file, wrote no coverage line, and discarded the findings already gathered for every other file in the run.

The runner now catches per file: it counts the file, emits an annotation naming it, and moves on. The run still fails, on the failure count rather than by dying.

This came out of a crash caused by a preprocessor directive, but it is not specific to that. Any file that parses malformed can reach the same place.

Test files

FileAccountingTests and ComplianceRunnerE2ETests, 6 new tests and 3 updated. 104 passing in Compliance.Unit.Tests and 72 in Compliance.Tests, existing tests unmodified. Seven mutations run, all caught.

Also checked end to end on a throwaway sandbox pull request running this branch: the check fails, the unanalysable file is named, and the other file's violation is still reported.

Changelog

A compliance rule that throws on one file no longer ends the run. The check still fails, and it now names the file and keeps the findings for every other file.

Additional comments

Read ComplianceRunner.cs with whitespace ignored. Wrapping the loop re-indented it, so the raw diff is around 230 lines where the change is about 40.

The two dataset runners share the shape and are not covered here. Neither parses C#, so neither is exposed to this fault.

A rule that threw escaped Main and killed the process before any output
was written. The check went red, which is right, but it named no file,
emitted no coverage line, and discarded the findings already gathered for
every other file in the run.

Catch per file: count it, emit an annotation naming the file, and carry on.
The run still fails, now on the failure count rather than by dying.
The first crash test runs a second file carrying a real violation, so the
run exits 1 on the merged Error regardless. A mutation removing the
failure term from the exit code survived it. This runs the unanalysable
file on its own, where nothing else can make the run red.
@sakanni
sakanni marked this pull request as ready for review October 15, 2026 13:50
@sakanni
sakanni merged commit 6dca53a into develop Oct 16, 2026
2 checks passed
@sakanni
sakanni deleted the internal-tickets-#58-CatchPerFileInComplianceRunner branch October 19, 2026 09:18
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.

ci-compliance: a crash on one file discards every finding in the run

1 participant