Skip to content

[#197] Settings → Trim whitespace around connection values - #199

Merged
revett merged 2 commits into
8thpark:mainfrom
newchannelid432-code:fix/trim-settings-whitespace
Aug 10, 2026
Merged

[#197] Settings → Trim whitespace around connection values#199
revett merged 2 commits into
8thpark:mainfrom
newchannelid432-code:fix/trim-settings-whitespace

Conversation

@newchannelid432-code

@newchannelid432-code newchannelid432-code commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #197

An accidental leading space in the bucket field produced a generic Storage rejected the request (400) error. Rather than blaming the user, canonicalize the connection fields the same way endpointFor/[normalizePrefix] already do: store exactly as typed, trim at the point of use.

  • Adds bucketFor and uses it everywhere a connection builds its URL (createS3Client, testConnection, fingerprintSettings).
  • Trims accountId, region, endpoint, and accessKeyId at the point of use too, so a stray space in any connection field fails loudly or works, never with a baffling provider error.
  • hasConnectionConfig / missingFieldFor treat whitespace-only values as missing.
  • Adds table-driven tests for bucket/region/accountId whitespace trimming.

Verified locally: 374/374 tests pass, biome check clean, npm run build passes.

Greptile Summary

The PR canonicalizes connection fields at the point of use while preserving exactly what users entered in persisted settings.

  • Adds shared derivation helpers for bucket, account ID, and access key ID.
  • Uses normalized values consistently for validation, request construction, signing, and settings fingerprints.
  • Adds table-driven coverage for surrounding and whitespace-only values.
  • Documents the point-of-use normalization contract.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/settings/settings.ts Centralizes trimming in derivation helpers and consistently applies them to connection completeness and endpoint/region derivation.
src/storage/storage.ts Uses the same normalized values for required-field diagnostics, request signing, and URL construction.
src/vault/vault.ts Canonicalizes target-identifying fields before generating the settings fingerprint.
src/settings/settings.test.ts Adds focused coverage for trimmed derivations and whitespace-only connection completeness.
src/storage/storage.test.ts Verifies that manual connection testing reports whitespace-only required fields as missing.
docs/technical_settings.md Documents the shared point-of-use normalization contract and field derivation functions.

Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

- Add bucketFor to trim the bucket a connection actually uses, so an
  accidental leading space no longer turns a valid bucket into a 400.
- Trim accountId, region, endpoint, and accessKeyId at the point of use,
  matching how endpointFor/regionFor/normalizePrefix already canonicalize.
- Normalize the same fields in fingerprintSettings so a whitespace edit
  does not read as a target change.
- Resolves 8thpark#197.
@revett

revett commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@greptileai Review PR

@revett

revett commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

@greptileai Review PR

@revett
revett merged commit 4c3be7d into 8thpark:main Aug 10, 2026
11 checks passed
@revett

revett commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

@newchannelid432-code Thanks for another PR! 🍪

I finished it off, as it is needed for the 0.1.0 release.

Please keep contributing and sharing the project

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.

Settings → Trim whitespace around values

2 participants