Repository navigation
Fix various typing related bugs - #380
Merged
Merged
Conversation
Persisted bookmarks and Trino tab indexes were cast to their types without checking the shape. A stored `null`, a non-array value or an entry with missing fields made the BookmarksState constructor or the tab store initialisation throw, breaking the storage explorer or the Trino editor until storage was cleared. Parse entries with zod schemas and drop anything that does not match. Also make persistToStorage best-effort so a full quota does not throw.
A truncated result was signalled by setting error to 'ROW_LIMIT:<n>' on a FINISHED query, which the UI decoded with startsWith/split. Add a typed rowLimit field to QuerySnapshot so error only carries real failures.
The Trino connection form passed no message type to superValidate, so the client cast form.message to ConnectionMessage. The storage connect and edit actions returned bare English strings and used 'ok' as a success sentinel in the same channel. Pass explicit message types to superValidate, add a StorageConnectionMessage union and use translated messages for the storage errors.
On the edit page a blank secret key means "keep the existing credentials". If the user changed only the access key, the client fell back to the stored credentials and silently discarded the new access key while reporting success. Reject the submit with a field error when the access key differs from the stored one and no secret key was entered.
The auto-reconnect path copied the saved connection into the form field by field but skipped name. After the redirect saveConnectionLocally replaced the stored entry with the form data, so the name was lost. Use the same form-fill function for auto-reconnect and for selecting a saved connection.
Storage API handlers used locals.storageConfig! and relied on a route-id prefix check in hooks.server.ts to guarantee the value. Add requireStorageConfig(), which returns the config or throws 401, so each handler enforces the guarantee itself.
The tests mocked superValidate, the zod adapter and StorageConnectionSchema, so the schema and the form handling were never run, and the mocked form objects were cast past the type checker. Post devalue-encoded form data like the client does and assert on the real superforms results, including field errors and the host normalisation.
requireBucketKey trimmed the key, so objects whose key starts or ends with whitespace could not be downloaded or previewed, and an upload of "a " was stored as "a". The delete endpoint did not trim, so behaviour differed between endpoints. Return the key unchanged and only reject empty keys. Bucket names cannot contain whitespace, so trimming the bucket stays.
The host schema checked min(1) before the transform that strips the scheme, so inputs like "http://" passed validation and produced an empty host. Validate the transformed value again.
lfrancke
approved these changes
Oct 9, 2026
Bohreromir
added a commit
that referenced
this pull request
Oct 13, 2026
Conflicts were mostly from #380, which touched storage code that v1 has rewritten. Kept v1's structure and ported the #380 fixes onto it: - Type the storage connect/edit superforms messages with StorageConnectionMessage instead of the 'ok' / bare-string sentinel. - Stop trimming S3 object keys and prefixes in the storage API and in StorageObjectNameSchema; callers trim user input. - Keep v1's requireConfig (request-context.ts) instead of requireStorageConfig, and v1's server-side check that a changed access key needs a secret key. Drop main's client-side check, its duplicate e2e test and message key. - Take main's mock server ports in playwright.config.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Hint: Review each commit separately