Skip to content

Create a new graph when duplicating instead of renaming the original - #343

Merged
aliu65803 merged 4 commits into
mainfrom
fix/graph-duplicate-unchanged-error
Nov 16, 2026
Merged

aliu65803 merged 4 commits into
mainfrom
fix/graph-duplicate-unchanged-error

Conversation

@aliu65803

@aliu65803 aliu65803 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

No linked issue.

Summary

Duplicating a graph renamed the original instead of creating a copy. Graphs are content-addressed with one alias per definition, and Duplicate went through the Edit save path with force_rename=true, so saving an unchanged duplicate moved the original's name to <name>_copy.

  • NewGraph now sends only the Edit flow through validateAndEditGraph (force_rename=true); Duplicate and other flows use the create path (force_rename=false).
  • An unchanged duplicate now shows the backend's existing "definition already exists with name …" error and the original is untouched; a modified duplicate creates a new graph. Edit is unchanged.
  • This also stops Duplicate from force-renaming the original onto an existing <name>_copy.

Change map: change map comment

Testing Done

  • DuplicateGraph.test.tsx: Duplicate posts force_rename: false; an unchanged duplicate stays on the page when creation fails; sequential steps run on a cleared request history. The test's previously ignored validateWithInvalidSuccess option is now forwarded, so that step asserts the validation alert instead of silently running the success path.
  • Existing EditGraph tests still assert force_rename: true.

Deployment on 3.0.8

These three PRs are intended to ship together on the 3.0.8 images (kumo-ui, kumo-backend-cpu, kumo-backend-gpu tag 3.0.8, built from 46c9c4e3):

Each PR's commits cherry-pick cleanly onto 46c9c4e3. When building the 3.0.8 images, regenerate ui/src/gen against the 3.0.8 backend rather than taking the copy PR's generated files; the 3.0.8 client then differs from its committed spec only by the copy endpoint additions. Only the copy PR changes the backend image.

Validated together on the 3.0.8 images with all three PRs applied (CPU single-host compose stack):

  • UI unit tests 1,239/1,239, type-check, lint (0 errors) and production build; backend copy tests 20/20.
  • Existing Playwright suite 21/21 on Chromium, Firefox and WebKit, plus jobs-list-controls (mutating).
  • Click-through Playwright checks of all three changes against S3-compatible and ADLS Gen2 connectors.
  • End-to-end on a copied ADLS connector: tables → graph → snapshot → train table → training → prediction table → batch prediction.

Hotfix Context

Not a P0 fix. See Deployment on 3.0.8 above.

Checklist

  • I listed all the breaking changes introduced by the PR (none)
  • I made sure to update examples and documentation with my changes (if necessary)
  • I have added and modified unit tests required to cover changes made by this PR.

🤖 Generated with Claude Code

aliu65803 and others added 3 commits November 13, 2026 13:27
Duplicate now uses the create path (force_rename=false), so saving an
unchanged definition returns the backend's already-exists error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… steps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@copy-pr-bot

copy-pr-bot Bot commented Nov 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@aliu65803
aliu65803 temporarily deployed to gha-kumo-workflow-tests November 14, 2026 02:42 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

UI Review (/review-ui)

⚠️ The review did not produce a findings file despite completing.

This is not a clean pass — no findings were emitted to grade. Re-run by commenting /review-ui on this PR, or inspect the run for details.

Reviewed commit: · View run

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5ccc5cf and c713251.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The graph save callback now uses validateAndEditGraph only for EDIT flows and routes other flow types to onCreateGraph. Duplicate graph creation passes graphFlowInfo directly to createGraph and uses its name for navigation. Tests cover unchanged duplicate submissions, invalid create responses, and create failures.

Merge Risk: Minimal · previous review 5ccc5

Duplicating a graph now uses the create path, so an unchanged duplicate shows the backend's name-conflict error instead of renaming the original. Edit behavior is unchanged. No actionable merge-blocking risk was identified in the UI change.

Security architecture risk: Minimal · up to 5ccc5

The change stops Duplicate from automatically renaming an existing graph. It reuses the existing creation endpoint and validation controls, and no introduced or worsened security, ownership, or failure-containment risk was established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed operation remains scoped to graph definitions and aliases in the selected project. Both save paths reach the same server-side creation operation, and graph persistence continues to require that referenced tables belong to the graph's active project.

Security Findings and Attack Paths

  • observed — The change removes automatic forced rename from Duplicate but does not remove the server's existing force-rename capability. EDIT still requests that capability; it is not a newly granted privilege.

Trust Boundaries and Controls

  • observed — Browser-provided graph data still passes through the shared backend project-validation call, Custom SQL canonicalization, connector execution-authorization calls, and authenticated-principal requirement before graph persistence. Changing the UI flow does not select a different server control path.

Resilience and Maintainability Implications

  • observed — Graph and dependent-table writes occur within the existing write transaction, with exception cleanup handled by the database runtime. The UI guard prevents overlapping submissions only within one mounted component. Repeating an accepted same-fingerprint, same-alias request can still increment ref_count under pre-existing backend semantics; this PR does not introduce stronger idempotency.
Pre-merge checks: Passed 3

Check name Status Explanation
Change Map Design Review Passed The change map comment (#343 (comment)) matches the code. I checked each claim against the repository. Necessity (confirmed). Before this PR…
Pr Size Passed The PR size check counts changed files and fails only above 40. The reviewed range (refs/coderabbit/pre-merge-check/base to head) contains 2 changed files, both modified (M): ui/src/pages/Graphs/NewGr…
Public Resource Access Passed The check applies only to external resource references (URLs, repository locations, package source locations) that this PR adds or modifies. The changed-file inventory shows two modified files: `ui/sr…
Full details: Change Map Design Review

Explanation

The change map comment (#343 (comment)) matches the code. I checked each claim against the repository. Necessity (confirmed). Before this PR, onFinishClick sent every non-CREATE flow to validateAndEditGraph. That path calls useCreateGraph with isEdit=true, and the hook sends force_rename: isEdit (ui/src/hooks/graph/newGraph.ts:100). Duplicate therefore sent force_rename=true. The backend then moved the alias of the existing definition, which is the rename the map describes. The fix is needed. Design (sound). In NewGraph.tsx, only FlowType.EDIT now calls validateAndEditGraph. Other flows call onCreateGraph, which sends force_rename=false. Edit keeps force_rename=true. editGraph drops the Duplicate name sync and the copied object. Each change is a routing or cleanup change in one file. The change belongs in the UI layer, because the backend already protects the existing behavior. Existing behavior kept (confirmed). statedb/db/services.py save_graph_definition (lines 670–676) raises GraphDefinitionAlreadyExists(GRAPH_RENAME_MESSAGE) when the same fingerprint already has a different alias and force_rename is false. It raises before any upsert, so the original stays unchanged. create_full_graph_v2 (lines 377–388) also rejects an alias that another graph already uses. The map's "create still rejects duplicate definitions and names" is accurate. Stopping condition (matches code). An unchanged duplicate reaches the backend guard and returns the error. A changed duplicate has a new fingerprint and creates a new graph. Uncertain design questions (not proven defects): 1. The observed failure says Duplicate should create a copy. After this change, an unchanged Duplicate creates no copy and shows an error. The map states this as the stopping condition, but its "Why" column does not explain the trade-off. The backend rule (one alias per definition) causes it. The map should say that unchanged duplicates are rejected by design, not fixed. Whether product wants a different outcome cannot be decided from the code. 2. The routing change also moves FlowType.AS_TEMPLATE from the Edit path to the create path. The table says only "other flows". I found no graph UI code that sets AS_TEMPLATE; its only use is in ui/src/utils/tables.ts. The map should state this. 3. The "click-through checks" in Verification come from the PR author and are not in the repository. They cannot be checked here. Suggested correction (refinement, not a blocker): Add one sentence to the map. Say that an unchanged Duplicate now fails with the backend GRAPH_RENAME_MESSAGE by design. Say that AS_TEMPLATE shares the create path and has no graph caller.

Full details: Pr Size

Explanation

The PR size check counts changed files and fails only above 40. The reviewed range (refs/coderabbit/pre-merge-check/base to head) contains 2 changed files, both modified (M): ui/src/pages/Graphs/NewGraph/NewGraph.tsx and ui/src/pages/Graphs/tests/DuplicateGraph.test.tsx. This is well under the threshold of 40, so the check passes. Line counts were ignored as instructed.

Full details: Public Resource Access

Explanation

The check applies only to external resource references (URLs, repository locations, package source locations) that this PR adds or modifies. The changed-file inventory shows two modified files: ui/src/pages/Graphs/NewGraph/NewGraph.tsx and ui/src/pages/Graphs/__tests__/DuplicateGraph.test.tsx. I searched every added line of the patch for http(s)://, git@, ssh://, github.com, GitLab/Bitbucket hosts, npm/PyPI/registry references, object-store URIs, and archive file extensions. No matches were found. The added lines contain only TypeScript logic and test code: graphFlowInfo passed to createGraph, the FlowType.EDIT branch, force_rename: false, and new test cases. The PR description contains URLs, including a change-map comment link and PR references, but the description is not changed code, and the check does not cover it. No external resource reference is added or modified, so there is nothing to verify and no inaccessible reference to report.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b6f8bfc and 5ccc5cf.

Files selected for processing: 2

  • ui/src/pages/Graphs/NewGraph/NewGraph.tsx
  • ui/src/pages/Graphs/__tests__/DuplicateGraph.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@aliu65803

Copy link
Copy Markdown
Contributor Author

Change map

  • Observed failure: Duplicate on a graph renamed the original to <name>_copy instead of creating a copy.
  • Existing behavior kept: Edit still saves with force_rename=true; create still rejects duplicate definitions and names.
  • Smallest sufficient change: route Duplicate through the create path.
  • Verification: DuplicateGraph and EditGraph tests, plus click-through checks of unchanged and changed duplicates and an unchanged Edit.
  • Stopping condition: an unchanged duplicate errors without touching the original, a changed duplicate creates a new graph, and Edit is unchanged.
File Function / scope What changed Why
ui/src/pages/Graphs/NewGraph/NewGraph.tsx onFinishClick, editGraph Only Edit uses validateAndEditGraph; other flows use onCreateGraph. editGraph drops the Duplicate name sync and a redundant copy Duplicate sent force_rename=true and renamed the original
ui/src/pages/Graphs/__tests__/DuplicateGraph.test.tsx DuplicateGraphPage tests Expects force_rename: false; adds an unchanged-duplicate test; forwards the previously dropped helper options; clears request history between steps Proves the fix and makes each step's assertions independent

@aliu65803
aliu65803 temporarily deployed to gha-kumo-workflow-tests November 16, 2026 14:45 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown

UI Test Jobs Completed on 81f42b8

@anle2024 anle2024 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I approve this PR. Duplicate now uses the create path with force_rename=false, and Edit keeps force_rename=true. I traced the backend. For an unchanged copy, save_graph_definition raises "This graph definition already exists with name ...", so the original keeps its name. A changed copy creates a new graph. CI passes.

Note for the Santander reply: an unchanged duplicate shows this error and does not create a second graph. The backend identifies a graph by its definition, so the customer must change the copy before they save it.

Release note: see my comment on #342 about the image tag.

@anle2024

Copy link
Copy Markdown
Collaborator

/ok to test c713251

@aliu65803
aliu65803 merged commit 29c2c46 into main Nov 16, 2026
121 of 122 checks passed
@aliu65803
aliu65803 deleted the fix/graph-duplicate-unchanged-error branch November 16, 2026 17:56
aliu65803 added a commit that referenced this pull request Nov 16, 2026
No linked issue.

## Summary
Adds project archiving to the UI using the existing `POST
/v0/projects/{project_id}/archive` endpoint.

- **Project Settings:** an "Archive project" section with a confirmation
dialog, shown only to the project owner or an administrator (matching
the backend's owner-or-admin rule) and never for the Default project or
an already archived project. Confirmation is guarded against double
submits.
- **After archiving:** selects the Default project and Default group and
opens its models page, through a shared `openProject` helper that the
project picker now also uses.
- **Project picker:** hides archived projects, since list endpoints
still return them.
- `DEFAULT_PROJECT_ID` and `DEFAULT_GROUP_ID` are added to
`utils/Constants`, mirroring `kumoapi`.

Change map: [change map
comment](#344 (comment))

## Testing Done
- `ProjectSettings.test.tsx`: archive and return to Default
project/group; cancel; failure; owner, admin, and non-owner visibility;
no action for Default or archived projects; project list cache refresh;
double confirmation sends one request (fails without the guard).
- `ProjectList.test.tsx`: archived projects hidden, including when
stored as the selected project.

## Deployment on 3.0.8
These three PRs are intended to ship together on the **3.0.8 images**
(`kumo-ui`, `kumo-backend-cpu`, `kumo-backend-gpu` tag `3.0.8`, built
from `46c9c4e3`):
- #342 — copy a connector into another project (backend + UI)
- #343 — graph Duplicate no longer renames the original (UI only)
- #344 — archive projects from Project Settings (UI only)

Each PR's commits cherry-pick cleanly onto `46c9c4e3`. When building the
3.0.8 images, regenerate `ui/src/gen` against the 3.0.8 backend rather
than taking the copy PR's generated files; the 3.0.8 client then differs
from its committed spec only by the copy endpoint additions. Only the
copy PR changes the backend image.

Validated together on the 3.0.8 images with all three PRs applied (CPU
single-host compose stack):
- UI unit tests 1,239/1,239, type-check, lint (0 errors) and production
build; backend copy tests 20/20.
- Existing Playwright suite 21/21 on Chromium, Firefox and WebKit, plus
`jobs-list-controls` (mutating).
- Click-through Playwright checks of all three changes against
S3-compatible and ADLS Gen2 connectors.
- End-to-end on a copied ADLS connector: tables → graph → snapshot →
train table → training → prediction table → batch prediction.

## Hotfix Context
Not a P0 fix. See *Deployment on 3.0.8* above.

## Checklist
- [x] I listed all the **breaking changes** introduced by the PR (none)
- [x] I made sure to **update examples and documentation** with my
changes (if necessary)
- [x] I have added and modified unit tests required to cover changes
made by this PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
aliu65803 added a commit that referenced this pull request Nov 16, 2026
No linked issue.

## Summary
Adds a way to copy a project connector into another project.

- **API:** `POST
/v0/projects/{project_id}/connectors/{connector_id}/copy` with
`CopyConnectorArgs {target_project_id, name?, description?}`. The driver
reads the source with `get_for_project`, then recreates its config and
identity reference through the existing `create_project_connector` path,
so target visibility, active project/group, identity-to-group binding,
and provider validation are unchanged.
- **Errors:** same project → 400; missing/upload source, archived or
invisible target → 404; identity not bound to the target group → 403; a
connector with the same name already in the target → 409 "already
exists"; failed target validation → 422. Copying from an archived source
project is allowed.
- **UI:** "Copy to project" in the connector overview menu opens a
dialog (target picker of other active projects, editable name). Errors
show inline; success links to the target project. Submit is guarded
against double activation.
- **Generated client:** regenerated with `make generate-ui-client-code`,
keeping only the copy endpoint additions. Unrelated drift that
regeneration also picks up from `main`
(`GraphSnapshotResponse.timestamp_precision` and a
`TrainingTableGenerationPlan` description) is left out of this PR.

Change map: [change map
comment](#342 (comment))

## Testing Done
- `test/rest/routers/test_connector_copy.py`: driver and route tests,
including error mapping and same-project/name-conflict rejection.
- `test/statedb/db/test_identity_services.py`: copy tests against the
real `ConnectorService` (identity not bound to target group,
archived/invisible target, upload connector, archived source, repeated
copy, differently configured name clash).
- UI: dialog, hook, and connector list tests; the double-submit test
fails without the guard.

## Deployment on 3.0.8
These three PRs are intended to ship together on the **3.0.8 images**
(`kumo-ui`, `kumo-backend-cpu`, `kumo-backend-gpu` tag `3.0.8`, built
from `46c9c4e3`):
- #342 — copy a connector into another project (backend + UI)
- #343 — graph Duplicate no longer renames the original (UI only)
- #344 — archive projects from Project Settings (UI only)

Each PR's commits cherry-pick cleanly onto `46c9c4e3`. When building the
3.0.8 images, regenerate `ui/src/gen` against the 3.0.8 backend rather
than taking the copy PR's generated files; the 3.0.8 client then differs
from its committed spec only by the copy endpoint additions. Only the
copy PR changes the backend image.

Validated together on the 3.0.8 images with all three PRs applied (CPU
single-host compose stack):
- UI unit tests 1,239/1,239, type-check, lint (0 errors) and production
build; backend copy tests 20/20.
- Existing Playwright suite 21/21 on Chromium, Firefox and WebKit, plus
`jobs-list-controls` (mutating).
- Click-through Playwright checks of all three changes against
S3-compatible and ADLS Gen2 connectors.
- End-to-end on a copied ADLS connector: tables → graph → snapshot →
train table → training → prediction table → batch prediction.

## Hotfix Context
Not a P0 fix. See *Deployment on 3.0.8* above.

## Checklist
- [x] I listed all the **breaking changes** introduced by the PR (none;
new endpoint and schema are additive)
- [x] I made sure to **update examples and documentation** with my
changes (if necessary)
- [x] I have added and modified unit tests required to cover changes
made by this PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
gha-kumo-workflow-tests — c7132513 Deployed Nov 16, 2026 by aliu65803 via import #2404
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