Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Do not allow panics in the dal by default (ENG-2411)#3463

Merged
si-bors-ng[bot] merged 1 commit intomainfrom
nick/7d5fe1e
Mar 25, 2024
Merged

Do not allow panics in the dal by default (ENG-2411)#3463
si-bors-ng[bot] merged 1 commit intomainfrom
nick/7d5fe1e

Conversation

@nickgerace
Copy link
Copy Markdown
Contributor

Description

This PR disallows panics in the dal by default. It fixes or permits existing panic locations along the way.

@github-actions github-actions Bot added A-sdf Area: Primary backend API service [Rust] A-dal labels Mar 21, 2024
Comment thread lib/dal/src/lib.rs
Comment on lines +3 to +8
#![warn(
clippy::panic,
clippy::panic_in_result_fn,
clippy::unwrap_in_result,
clippy::unwrap_used
)]
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.

This is the primary addition of the PR.

@nickgerace nickgerace force-pushed the nick/7d5fe1e branch 4 times, most recently from 01e84c0 to 1d4c5e2 Compare March 25, 2024 16:24
@nickgerace
Copy link
Copy Markdown
Contributor Author

bors merge

si-bors-ng Bot added a commit that referenced this pull request Mar 25, 2024
3463: Do not allow panics in the dal by default (ENG-2411) r=nickgerace a=nickgerace

## Description

This PR disallows panics in the `dal` by default. It fixes or permits existing panic locations along the way.

<img src="https://media1.giphy.com/media/HUkOv6BNWc1HO/giphy.gif"/>

Co-authored-by: Nick Gerace <nick@systeminit.com>
@nickgerace
Copy link
Copy Markdown
Contributor Author

bors cancel

@si-bors-ng
Copy link
Copy Markdown
Contributor

si-bors-ng Bot commented Mar 25, 2024

Canceled.

let current_root_weight = self.get_node_weight(self.root_index).unwrap();
let current_root_weight = self
.get_node_weight(self.root_index)
.expect("this should be impossible and this code should only be used for debugging");
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 allow expects in debug output functions. This is within a function to prints out a "dot" graph for local development only.

let filename_no_extension = format!("{}-{}", Ulid::new().to_string(), suffix);

let home_str = std::env::var("HOME").unwrap();
let home_str = std::env::var("HOME").expect("could not find home directory via env");
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 allow expects in debug output functions. This is within a function to prints out a "dot" graph for local development only.

This commit disallows panics in the dal by default. It fixes or permits
existing panic locations along the way.

Signed-off-by: Nick Gerace <nick@systeminit.com>
@nickgerace
Copy link
Copy Markdown
Contributor Author

bors merge

@si-bors-ng
Copy link
Copy Markdown
Contributor

si-bors-ng Bot commented Mar 25, 2024

Build succeeded:

@si-bors-ng si-bors-ng Bot merged commit 57ce43e into main Mar 25, 2024
@si-bors-ng si-bors-ng Bot deleted the nick/7d5fe1e branch March 25, 2024 16:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A-dal A-sdf Area: Primary backend API service [Rust]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant