Skip to content

Commit

Permalink
Set source area for installer errors
Browse files Browse the repository at this point in the history
Summary:
To exclude these from UBE-0.
Original plan was to set source_area based on presence of INSTALL tag and exclude that, however source area is only based on the best tag which is set to TIER0 if the installer categorizes something as Tier0 which takes precedence over INSTALL. Fixing this requires making sure best tag always starts with INSTALLER if it originates from the installer.

Reviewed By: IanChilds

Differential Revision: D69088225

fbshipit-source-id: 7b53f9359c5dc083a65fcae9532fafcb047ec5e2
  • Loading branch information
christolliday authored and facebook-github-bot committed Feb 4, 2025
1 parent 3128772 commit 26af837
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
4 changes: 4 additions & 0 deletions app/buck2_data/error.proto
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ enum ErrorTag {

// Errors during buck2 install.
INSTALL = 200;
INSTALLER_UNKNOWN = 2101;
INSTALLER_TIER0 = 2102;
INSTALLER_ENVIRONMENT = 2103;
INSTALLER_INPUT = 2104;

//// High level descriptions of the "phase" of the build during which the
// error occurred
Expand Down
10 changes: 10 additions & 0 deletions app/buck2_error/src/classify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub(crate) fn category_and_rank(tag: ErrorTag) -> (Option<Tier>, u32) {
ErrorTag::ServerStderrEmpty => rank!(environment),
// Note: This is only true internally due to buckwrapper
ErrorTag::NoBuckRoot => rank!(environment),
ErrorTag::InstallerEnvironment => rank!(environment),

// Tier 0 errors
ErrorTag::ServerJemallocAssert => rank!(tier0),
Expand Down Expand Up @@ -123,6 +124,8 @@ pub(crate) fn category_and_rank(tag: ErrorTag) -> (Option<Tier>, u32) {
ErrorTag::DiceCancelled => rank!(tier0),
ErrorTag::DiceUnexpectedCycleGuardType => rank!(tier0),
ErrorTag::DiceDuplicateActivationData => rank!(tier0),
ErrorTag::InstallerUnknown => rank!(tier0),
ErrorTag::InstallerTier0 => rank!(tier0),

ErrorTag::Environment => rank!(environment),
ErrorTag::Tier0 => rank!(tier0),
Expand Down Expand Up @@ -158,6 +161,7 @@ pub(crate) fn category_and_rank(tag: ErrorTag) -> (Option<Tier>, u32) {
ErrorTag::Analysis => rank!(input),
ErrorTag::TestDeadlineExpired => rank!(input),
ErrorTag::Unimplemented => rank!(input),
ErrorTag::InstallerInput => rank!(input),

ErrorTag::Input => rank!(input),

Expand Down Expand Up @@ -216,6 +220,9 @@ pub fn tag_is_hidden(tag: &ErrorTag) -> bool {
ErrorTag::Tier0 => true,
ErrorTag::Input => true,
ErrorTag::Environment => true,
ErrorTag::InstallerTier0 => true,
ErrorTag::InstallerInput => true,
ErrorTag::InstallerEnvironment => true,
_ => false,
}
}
Expand Down Expand Up @@ -279,6 +286,7 @@ pub enum ErrorSourceArea {
Watchman,
Starlark,
TestExecutor,
Installer,
}

pub fn source_area(tag: ErrorTag) -> ErrorSourceArea {
Expand All @@ -293,6 +301,8 @@ pub fn source_area(tag: ErrorTag) -> ErrorSourceArea {
ErrorSourceArea::Starlark
} else if tag == crate::ErrorTag::Tpx || tag == crate::ErrorTag::TestExecutor {
ErrorSourceArea::TestExecutor
} else if tag_name.starts_with("INSTALLER") {
ErrorSourceArea::Installer
} else {
ErrorSourceArea::Buck2
}
Expand Down
21 changes: 12 additions & 9 deletions app/buck2_server_commands/src/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,18 +799,21 @@ async fn send_file(
installer_log: install_log.to_owned(),
}
.into();
if let Some(category) =
let category_tag = if let Some(category) =
buck2_install_proto::ErrorCategory::from_i32(error_detail.category)
{
if let Some(category_tag) = match category {
buck2_install_proto::ErrorCategory::Unspecified => None,
buck2_install_proto::ErrorCategory::Tier0 => Some(ErrorTag::Tier0),
buck2_install_proto::ErrorCategory::Input => Some(ErrorTag::Input),
buck2_install_proto::ErrorCategory::Environment => Some(ErrorTag::Environment),
} {
error = error.tag([category_tag]);
match category {
buck2_install_proto::ErrorCategory::Unspecified => ErrorTag::InstallerUnknown,
buck2_install_proto::ErrorCategory::Tier0 => ErrorTag::InstallerTier0,
buck2_install_proto::ErrorCategory::Input => ErrorTag::InstallerInput,
buck2_install_proto::ErrorCategory::Environment => {
ErrorTag::InstallerEnvironment
}
}
}
} else {
ErrorTag::InstallerUnknown
};
error = error.tag([category_tag]);

for tag in error_detail.tags {
error = error.context_for_key(&tag);
Expand Down

0 comments on commit 26af837

Please sign in to comment.