Skip to content

schema + db-model: support bundle request data selection tables#10111

Draft
mergeconflict wants to merge 1 commit intomainfrom
mergeconflict/support-bundle-request-schema-and-model
Draft

schema + db-model: support bundle request data selection tables#10111
mergeconflict wants to merge 1 commit intomainfrom
mergeconflict/support-bundle-request-schema-and-model

Conversation

@mergeconflict
Copy link
Contributor

@mergeconflict mergeconflict commented Mar 20, 2026

Adds two tables:

  • fm_support_bundle_request (the primary table representing nexus_types::fm::case::SupportBundleRequest
  • fm_sb_req_data_selection (the join table representing the nexus_types::support_bundle::BundleDataSelections in the support bundle request).

... and their corresponding models.

This is for persisting fault-management-initiated support bundle requests as part of a sitrep. Each request belongs to a case and tracks which sitrep originally requested it. Context: #10062.

This supersedes #10091 and #10095, in which the schema had a different table for each BundleDataSelection variant. That got hairy because we were joining 6 tables together and Diesel got mad about it. (Then I got mad.)

@mergeconflict mergeconflict changed the base branch from main to mergeconflict/builder-side-quest March 20, 2026 16:56
@mergeconflict mergeconflict added the fault-management Everything related to the fault-management initiative (RFD480 and others) label Mar 20, 2026
@mergeconflict mergeconflict self-assigned this Mar 20, 2026
@mergeconflict mergeconflict requested review from hawkw, jgallagher and smklein and removed request for hawkw and smklein March 20, 2026 17:03
@mergeconflict mergeconflict force-pushed the mergeconflict/support-bundle-request-schema-and-model branch 2 times, most recently from 476acc0 to 88e7b32 Compare March 20, 2026 17:32
@mergeconflict mergeconflict force-pushed the mergeconflict/builder-side-quest branch 2 times, most recently from 770be0e to 8153e6f Compare March 20, 2026 17:57
@mergeconflict mergeconflict force-pushed the mergeconflict/support-bundle-request-schema-and-model branch from 88e7b32 to d28f22b Compare March 20, 2026 17:57
@mergeconflict mergeconflict force-pushed the mergeconflict/builder-side-quest branch from 8153e6f to c171063 Compare March 20, 2026 18:08
@mergeconflict mergeconflict force-pushed the mergeconflict/support-bundle-request-schema-and-model branch from d28f22b to 0c999b9 Compare March 20, 2026 18:38
Base automatically changed from mergeconflict/builder-side-quest to main March 20, 2026 20:18
@hawkw
Copy link
Member

hawkw commented Mar 23, 2026

looks like the CI unhappiness here is because the schema versions don't match, btw.

Adds fm_support_bundle_request and fm_sb_req_data_selection tables
for persisting FM-initiated support bundle requests as part of a
sitrep. Each request belongs to a case and tracks which sitrep
originally requested it. The data selection table uses a
bundle_data_category enum and category-specific nullable columns
with CHECK constraints to store per-category parameters (sled
selection for host_info, time/serial/class filters for ereports).

Address PR feedback: use cardinality() and return errors instead of panicking

- Replace `array_length(sled_ids, 1) IS NULL` with `cardinality(sled_ids) = 0`
  in the CHECK constraint, avoiding a counterintuitive PostgreSQL/CRDB quirk
  where `array_length` of an empty array returns NULL.

- Replace `expect()` calls in `SbReqDataSelection::into_bundle_data` with
  `anyhow::Context`-based error returns, so a broken CHECK constraint
  produces a runtime error rather than crashing Nexus.
@mergeconflict mergeconflict force-pushed the mergeconflict/support-bundle-request-schema-and-model branch from ef06169 to 44c803e Compare March 23, 2026 19:28
@mergeconflict mergeconflict marked this pull request as draft March 23, 2026 21:37
@mergeconflict
Copy link
Contributor Author

I think we decided in chat to actually try going back to the #10091 / #10095 world, since nobody especially likes the "this enum is encoded in the db as a bucket of nullable columns" design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fault-management Everything related to the fault-management initiative (RFD480 and others)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants