Skip to content

fix: Properly indicate DeleteAllGraph when selected in DB Management - BED-8799#2937

Open
StephenHinck wants to merge 4 commits into
mainfrom
BED-8799
Open

fix: Properly indicate DeleteAllGraph when selected in DB Management - BED-8799#2937
StephenHinck wants to merge 4 commits into
mainfrom
BED-8799

Conversation

@StephenHinck

@StephenHinck StephenHinck commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Description

Properly sends the deletion request with DeleteAllGraph true, rather than including a list of all source kinds when "Delete all graph data" is checked.

Additionally, enforced the uniqueness at the API layer such that a user may not request AllGraphData AND sourcekinds or relationships in the same payload, since AllGraphData includes all sources and relationships.

Motivation and Context

Resolves BED-8799

Why is this change required? What problem does it solve?

How Has This Been Tested?

Validated locally, added additional test cases.

Screenshots (optional):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

Summary by CodeRabbit

  • New Features
    • Added an “All graph data” option to graph-data check controls for one-step clearing.
  • Bug Fixes
    • “All graph data” now emits the correct selection state and clears related targeted choices.
    • Deletion requests now enforce that “All graph data” can’t be combined with targeted source-kind or relationship deletions.
  • Tests
    • Added UI coverage for deleting all graph data and verifying the resulting request payload.
    • Added API negative test cases to confirm validation and error messaging for invalid combinations.

@StephenHinck StephenHinck self-assigned this Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 196dd078-bb7f-4560-99f8-1f39affe4bea

📥 Commits

Reviewing files that changed from the base of the PR and between 5977401 and 03c67c5.

📒 Files selected for processing (6)
  • cmd/api/src/api/v2/database_wipe.go
  • cmd/api/src/api/v2/database_wipe_test.go
  • cmd/ui/src/views/DatabaseManagement/DatabaseManagement.test.tsx
  • cmd/ui/src/views/DatabaseManagement/DatabaseManagement.tsx
  • packages/javascript/bh-shared-ui/src/components/GraphDataCheckboxes/GraphDataCheckboxes.test.tsx
  • packages/javascript/bh-shared-ui/src/components/GraphDataCheckboxes/GraphDataCheckboxes.tsx
🚧 Files skipped from review as they are similar to previous changes (6)
  • cmd/ui/src/views/DatabaseManagement/DatabaseManagement.tsx
  • cmd/api/src/api/v2/database_wipe_test.go
  • cmd/ui/src/views/DatabaseManagement/DatabaseManagement.test.tsx
  • packages/javascript/bh-shared-ui/src/components/GraphDataCheckboxes/GraphDataCheckboxes.test.tsx
  • packages/javascript/bh-shared-ui/src/components/GraphDataCheckboxes/GraphDataCheckboxes.tsx
  • cmd/api/src/api/v2/database_wipe.go

📝 Walkthrough

Walkthrough

GraphDataSelections adds allGraphData. GraphDataCheckboxes computes and emits it. DatabaseManagement uses it to build delete requests, and the API rejects conflicting full-graph and targeted delete combinations. Tests cover the new selection and validation behavior.

Changes

allGraphData selection and delete request flow

Layer / File(s) Summary
Selection shape and emission
packages/javascript/bh-shared-ui/src/components/GraphDataCheckboxes/GraphDataCheckboxes.tsx, packages/javascript/bh-shared-ui/src/components/GraphDataCheckboxes/GraphDataCheckboxes.test.tsx
GraphDataSelections adds allGraphData: boolean; getGraphDataSelections accepts sourceKinds and computes allGraphData; notifyChange passes sourceKinds so the new field is emitted. Checkbox tests update fixtures and expectations for parent and nested selection changes.
Delete request handling
cmd/ui/src/views/DatabaseManagement/DatabaseManagement.tsx, cmd/ui/src/views/DatabaseManagement/DatabaseManagement.test.tsx
DatabaseManagement derives deleteCollectedGraphData from checked.allGraphData and clears targeted delete arrays when it is selected; the UI test covers selecting “All graph data”, confirming deletion, and asserting the request payload.
Request validation
cmd/api/src/api/v2/database_wipe.go, cmd/api/src/api/v2/database_wipe_test.go
BuildDeleteRequest rejects combinations of deleteCollectedGraphData with targeted delete fields; API tests cover both invalid combinations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

bug, user interface, javascript, api, go

Suggested reviewers

  • cweidenkeller
  • AD7ZJ
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main fix: using DeleteAllGraph when selected in DB Management.
Description check ✅ Passed The description follows the template and includes the change summary, motivation, testing, type, and checklist items.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch BED-8799

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added bug Something isn't working javascript Pull requests that update javascript code user interface A pull request containing changes affecting the UI code. labels Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

@coderabbitai coderabbitai Bot added api A pull request containing changes affecting the API code. go Pull requests that update go code labels Jun 29, 2026
@StephenHinck

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@StephenHinck

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

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

Labels

api A pull request containing changes affecting the API code. bug Something isn't working go Pull requests that update go code javascript Pull requests that update javascript code user interface A pull request containing changes affecting the UI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant