Skip to content

Improve sidecar startup error for unknown action class#181

Merged
luca-iachini merged 4 commits into
mainfrom
fir-284-improve-error-sidecar-startup-message
Jun 21, 2026
Merged

Improve sidecar startup error for unknown action class#181
luca-iachini merged 4 commits into
mainfrom
fir-284-improve-error-sidecar-startup-message

Conversation

@luca-iachini

@luca-iachini luca-iachini commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Improves the startup error raised by MappingTable::from_config when a mapping rule references an action class not in the built-in FEP registry.

New message explains:

  • the action class is not in the built-in FEP registry,
  • schema_path in [authority] only affects Cedar policy validation in the
    Authority — it does not extend this registry (a common point of confusion), and
  • how to proceed, with a link to the extend-mapping guide.

Changes

  • crates/firma-sidecar/src/normalizer/mapping.rs — expand the error string

@luca-iachini luca-iachini force-pushed the fir-284-improve-error-sidecar-startup-message branch from 395f0f2 to b59e4ac Compare June 20, 2026 10:08
@luca-iachini luca-iachini marked this pull request as ready for review June 20, 2026 10:10
@luca-iachini luca-iachini requested a review from a team June 20, 2026 10:10
@@ -113,7 +113,12 @@ impl MappingTable {
for (i, rule_cfg) in file.rules.iter().enumerate() {
if !registry.contains(&rule_cfg.action_class) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have a test that hits this error path?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We already have them, but I took the opportunity to refactor them to use clearer names and improve the assertions.

@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.57143% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/firma-sidecar/src/normalizer/mapping.rs 98.57% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Comment on lines +316 to +320
assert_matches!(
err,
MappingTableError::DuplicateRule { index: 1, ref rule }
if rule.action_class == "code.review.read"
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For errors that may end up being user-facing, let's use insta to ensure they render as we expect.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added

@luca-iachini luca-iachini force-pushed the fir-284-improve-error-sidecar-startup-message branch from 1182cf0 to 9aabde5 Compare June 21, 2026 10:40
@luca-iachini luca-iachini merged commit c5a6b00 into main Jun 21, 2026
15 checks passed
@luca-iachini luca-iachini deleted the fir-284-improve-error-sidecar-startup-message branch June 21, 2026 17:54
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