Skip to content

feat: Save Anyways -> Save#8769

Open
royendo wants to merge 26 commits intomainfrom
fix/save-anyways-bug
Open

feat: Save Anyways -> Save#8769
royendo wants to merge 26 commits intomainfrom
fix/save-anyways-bug

Conversation

@royendo
Copy link
Contributor

@royendo royendo commented Feb 4, 2026

https://www.loom.com/share/cb6134ba1b484d4ab4b483edbe2b15da

Screenshot 2026-02-04 at 12 05 44 Save follow same logic as Test and Connect (allows save when req parameters are met, can change this easily)

Follow up to: #8636 (comment)
as Save Anyways caused mulitple keys to be created in .env.
Screenshot 2026-02-04 at 14 33 48

Save is a step forward for "Edit connector" feature as it doesnt require a test connect to fail for the button to appear.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

royendo added a commit that referenced this pull request Feb 4, 2026
royendo added a commit that referenced this pull request Feb 4, 2026
@royendo royendo changed the title Save Anyways -> Save feat: Save Anyways -> Save Feb 4, 2026
@royendo
Copy link
Contributor Author

royendo commented Feb 5, 2026

✅ Code Review Complete

Summary

This PR successfully refactors "Save Anyway" to "Save" with improved visibility and adds the ConnectorAddModelButton for importing data from existing connectors.

Highlights

Architecture & Code Quality

  • ✅ Clean shared utility shouldShowSkipLink() eliminates duplicate logic
  • ✅ Fixed getSchemaNameFromDriver return type (was string | null, now correctly string)
  • ✅ Good JSDoc documentation on all new public functions
  • ✅ Follows Rill patterns consistently

Test Coverage

  • ConnectorAddModelButton.spec.ts - 11 tests for component logic
  • connector-schemas.spec.ts - 24 tests including 5 new for shouldShowSkipLink
  • ✅ E2E tests updated for new button naming

UX Improvements

  • ✅ Tooltips explain button actions clearly
  • ✅ Proper cursor behavior (pointer when enabled, not-allowed when disabled)
  • ✅ Simplified file path fallback logic in WorkspaceHeader

Files Reviewed

File Status
ConnectorAddModelButton.svelte ✅ New component with JSDoc
connector-schemas.ts ✅ Shared utility, fixed types
AddDataForm.svelte ✅ Uses shared utility
MultiStepConnectorFlow.svelte ✅ Uses shared utility
WorkspaceHeader.svelte ✅ Improved comments

LGTM! Ready to merge once CI passes. 🚀


🤖 Generated with Claude Code

@royendo royendo requested a review from ericpgreen2 February 10, 2026 18:18
@ericpgreen2 ericpgreen2 requested review from lovincyrus and removed request for ericpgreen2 February 10, 2026 19:54
@ericpgreen2
Copy link
Contributor

@lovincyrus, can you please do the first code review? Once you think it's good-to-go, please tag me and I'll do a final review.

lovincyrus

This comment was marked as outdated.

@lovincyrus lovincyrus self-requested a review February 11, 2026 02:20
@royendo royendo mentioned this pull request Feb 12, 2026
8 tasks
Copy link
Contributor

@lovincyrus lovincyrus left a comment

Choose a reason for hiding this comment

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

AddDataForm.svelte:89-98shouldShowSkipLink references stepState before it's declared

// line 89
$: shouldShowSkipLink = checkShouldShowSkipLink(
    stepState.step,  // used here
    connector?.name,
    connectorInstanceName,
    connector?.implementsOlap,
);

// line 98
$: stepState = $connectorStepStore;  // declared here

Svelte's reactive system resolves this at runtime, but it reads as a use-before-declare and is fragile if someone refactors these into non-reactive code. Can you move $: stepState = $connectorStepStore above the shouldShowSkipLink block?


ConnectorAddModelButton.spec.ts — tests JavaScript operators, not the component

This file duplicates the component's logic inline and asserts on it:

const isDisabled = hasUnsavedChanges || hasReconcileError || !driverName;
expect(isDisabled).toBe(true);

This verifies that true || false || false === true — if the component's disabled condition changes, these tests still pass. The tooltip tests have the same issue. The imported functions (getSchemaNameFromDriver, OLAP_ENGINES) are already covered by connector-schemas.spec.ts.

I'd suggest removing this file. It adds maintenance cost without catching real regressions.

The fix:

WorkspaceEditorContainer.svelte — reverted to string | undefined to match main (PR #8788 simplified this prop to plain string)
+page.svelte:107 — pass mainError?.message instead of mainError to extract the string from the LineStatus object
Copy link
Contributor Author

@royendo royendo left a comment

Choose a reason for hiding this comment

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

PR #8769 Review: feat: Save Anyways -> Save

CI Status

PENDING - e2e tests still running. Build and analysis checks are passing.

Summary

This PR refactors the "Save Anyway" button to a simpler "Save" button for connector forms, addressing an issue where the previous flow caused multiple keys in .env files. Key changes:

  • Renamed "Save Anyway" to "Save" - Always visible on connector step (when not using public auth)
  • New "Import Data" button - ConnectorAddModelButton.svelte for importing data from workspace header
  • Enhanced addSourceModal.open() - Now accepts connectorName and connectorInstanceName parameters
  • New utility functions - getSchemaNameFromDriver() and shouldShowSkipLink() in connector-schemas.ts
  • Comprehensive test coverage - Unit tests for all new functionality

Key Findings

Strengths:

  • Excellent test coverage (379 lines of new tests across 3 test files)
  • E2E tests properly updated for new button labels
  • Good JSDoc comments on all new functions
  • Follows existing component patterns (ConnectorAddModelButton mirrors ConnectorRefreshButton)
  • Clean refactoring from saveAnyway/showSaveAnyway to simpler saving state
  • No security concerns identified

Minor Suggestions (non-blocking):

  1. ConnectorAddModelButton.svelte: Consider renaming openAddModel to openImportDataModal for clarity
  2. ConnectorAddModelButton.svelte: Reorder imports - lucide-svelte (third-party) should come before @rilldata/* imports
  3. AddDataForm.svelte: The import alias shouldShowSkipLink as checkShouldShowSkipLink is slightly awkward
  4. AddDataModal.svelte: The popstate handler (lines 65-88) has grown complex - consider extracting connector resolution into a named function

Decision: COMMENT

Well-implemented PR with good test coverage and proper patterns. Cannot APPROVE until CI completes. Once e2e tests pass, this PR is ready to merge.


🤖 Generated with Claude Code

@royendo royendo requested a review from lovincyrus February 13, 2026 03:03
royendo added a commit that referenced this pull request Feb 13, 2026
* clickhouse play template

* increase width/height of modal

* dropdown with all 4 connectors

* prettier

* colosr!

* code qual

* e2e and error handling

* fix button for Rill Managed

* as req and update e2e

* removing see description

The core logic is already tested by unit tests in code-utils.spec.ts - specifically replaceOlapConnectorInYAML. The e2e test is just testing the UI flow that triggers this logic.

Since the unit tests already cover the YAML manipulation, and the integration point is simply the OLAP_ENGINES.includes() check in submitAddDataForm.ts:389, we can safely remove the flaky e2e test.

* fix save anyawys but will be changed with #8769

* Update save-anyway.spec.ts

* feedback from review, testing 1080p playwright to see button due to increased height

consolidate the JSONSchemaRender,
decrease the form height,
Salesforce doesnt need TALL

* prettier

* bug fix

* local Claude PR review fixes

* as req

default port wasnt showing with changes only to clickhouse.ts, added extra logic that required clearErrorOnInput for error message

* code qual;

* since we're here, quick change to support duck too/

* hide rill-managed

* prettier

* remove e2e from as rill-managed is commented out

* prettier

* code qual

* fix

* as req

* e2e fix,

Root cause of the e2e failure: saveConnectorAnyway() internally calls goto('/files/connectors/clickhouse.yaml') to navigate. Then handleSaveAnyway called onClose() → resetModal(), which fired window.history.pushState + dispatchEvent(new PopStateEvent(...)). The synthetic popstate raced with SvelteKit's router (especially with invalidate("init") from the rill.yaml write), causing the navigation to revert to root. The fix uses resetModalQuietly() which just resets the UI state variables directly, without touching the history API.
@royendo
Copy link
Contributor Author

royendo commented Feb 17, 2026

@ericokuma what do you think about putting Save on the model step? or should we implement
https://linear.app/rilldata/issue/APP-655/implement-loading-screens-after-data-explorer-import-triggered

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.

3 participants