Repository navigation
fix(connections): one name rule for the form and the server; stored names survive an edit - #583
Merged
Merged
Conversation
…ames survive an edit The credential form allowed only letters, numbers, spaces, - and _, and applied that to the stored name when it opened. But the form itself saves `host/database` or a file path when the name is left empty, and Query files names credentials `Files: <file>`. So editing any of those and saving renamed it (127.0.0.1/foxdb became 127001foxdb). The server had no rule at all. checkConnectionName (@foxschema/shared) is now the rule for both: free text, trimmed, up to 120 characters, no control characters. POST and PUT /api/connections refuse anything else with 400; the form drops only characters that cannot be seen. Also: the credential dialog is never taller than the window. The overlay centres it and cannot scroll, so at 1280x800 the Edit Credential title was cut off; the fields now scroll between a fixed header and footer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Test IDsAdded (2)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From the 2026-11-01 manual walk. The board card is
credential-name-rule.Bug
The credential form allowed only letters, numbers, spaces,
-and_(max 50), and applied that to the stored name when it opened. But the app makes names outside that rule itself:host/database(or the file path) when the name is left emptyFiles: <file name>So editing one of those and saving silently renamed it:
127.0.0.1/foxdbbecame127001foxdb. Of the 130 connections in my dev workspace, 9 distinct names were affected. The server had no rule at all.Fix
You picked free text on both sides.
checkConnectionNamein@foxschema/sharedis the one rule:Where it applies:
POSTandPUT /api/connectionsrefuse anything else with400 invalid_input, before savinghost/databasename is capped at the same lengthAlso in this PR: the credential dialog is never taller than the window. The overlay centres it and can't scroll, so at 1280×800 the Edit Credential title was cut off. The fields now scroll between a fixed header and footer. I checked this in the app at 600 px tall: dialog at 16–584 px, title and Save visible, body scrolls (570 / 426 px).
Tests
connection-name.test.ts: names the app makes are kept; trimming and blank names; control characters, too long, and non-strings are refusedconnections.routes.test.ts(new): POST and PUT keep127.0.0.1/foxdbtrimmed; refuse a control character without calling the store; refuse 121 charactersConnectionModal.test.tsx: a stored127.0.0.1/foxdb (staging)stays as it is in the formA/B: with the old route and form, all 6 new route and form tests fail. With the fix, all pass.
tscand eslint are clean, and the test-ID catalog is regenerated (two new IDs on the dialog card and body).🤖 Generated with Claude Code
Note
Medium Risk
Changes validation and normalization on every connection create/update path; behavior shift from permissive server + strict form to one shared rule.
Overview
Fixes credentials being silently renamed on edit when the app had already stored names like
127.0.0.1/foxdborFiles: …but the form only allowed alphanumerics (max 50) and stripped everything else on open/save.Introduces shared
checkConnectionNamein@foxschema/shared: trimmed free text up to 120 characters, rejecting only control characters. POST/PUT connection routes now run this check and return400 invalid_inputbefore persisting; the credential form strips invisible characters only and updates its hint accordingly. Auto-generated default names are capped at the same limit on save.The Edit Credential dialog is capped to the viewport height with a scrollable body so title and Save stay visible on short screens (
conn-modal-card/conn-modal-bodytest IDs). Tests cover shared validation, route handlers, and preserving a stored name in the modal.Reviewed by Cursor Bugbot for commit 03e6992. Bugbot is set up for automated code reviews on this repo. Configure here.