Skip to content

Revert "fix(storage): address the DSN bucket through the endpoint and refuse a DSN that names no device" - #247

Closed
abnegate wants to merge 1 commit into
mainfrom
revert-246-dat-2206-storage-dsn
Closed

Revert "fix(storage): address the DSN bucket through the endpoint and refuse a DSN that names no device"#247
abnegate wants to merge 1 commit into
mainfrom
revert-246-dat-2206-storage-dsn

Conversation

@abnegate

@abnegate abnegate commented Aug 7, 2026

Copy link
Copy Markdown
Member

Reverts #246

@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown

Greptile Summary

This PR reverts the preceding storage DSN validation and endpoint-addressing change, restoring local fallback for unusable DSNs and root-based S3 bucket handling.

  • Restores the prior StorageFactory construction logic and associated unit tests.
  • Relaxes and relocks utopia-php/storage to 4.0.0 with corresponding transitive dependency downgrades.
  • Restores the earlier storage DSN documentation.

Confidence Score: 4/5

The PR should not merge until S3 bucket 0 is preserved rather than silently redirected to the root namespace.

The restored bucket normalization explicitly classifies the nonempty string 0 as absent, so valid DSNs for that bucket generate incorrect object paths.

Files Needing Attention: src/Executor/StorageFactory.php, tests/unit/Executor/StorageFactoryTest.php

Important Files Changed

Filename Overview
src/Executor/StorageFactory.php Restores fallback and S3 root construction but incorrectly discards the valid bucket name 0.
tests/unit/Executor/StorageFactoryTest.php Restores tests for the reverted behavior while removing coverage that ensured bucket 0 remained addressable.
composer.json Relaxes the storage dependency constraint from ^4.0.2 to ^4.0.
composer.lock Relocks storage to 4.0.0 and downgrades related transitive packages without an established compatibility defect.
README.md Restores documentation for placeholder-host and URL-based S3-compatible DSNs.

Fix All in Claude Code Fix All in Codex

Prompt To Fix All With AI
### Issue 1
src/Executor/StorageFactory.php:58-60
**Bucket zero loses its namespace**

When an S3 DSN names bucket `0`, this condition treats it as empty and omits it from `$bucketRoot`, causing reads and writes to target the root namespace instead of bucket `0`.

```suggestion
                $bucketRoot = $bucket === ''
                    ? $root
                    : \rtrim($bucket . '/' . \ltrim($root, '/'), '/');
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Revert "fix(storage): address the DSN bu..." | Re-trigger Greptile

Comment on lines +58 to +60
$bucketRoot = ($bucket === '' || $bucket === '0')
? $root
: \rtrim($bucket . '/' . \ltrim($root, '/'), '/');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Bucket zero loses its namespace

When an S3 DSN names bucket 0, this condition treats it as empty and omits it from $bucketRoot, causing reads and writes to target the root namespace instead of bucket 0.

Suggested change
$bucketRoot = ($bucket === '' || $bucket === '0')
? $root
: \rtrim($bucket . '/' . \ltrim($root, '/'), '/');
$bucketRoot = $bucket === ''
? $root
: \rtrim($bucket . '/' . \ltrim($root, '/'), '/');
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/Executor/StorageFactory.php
Line: 58-60

Comment:
**Bucket zero loses its namespace**

When an S3 DSN names bucket `0`, this condition treats it as empty and omits it from `$bucketRoot`, causing reads and writes to target the root namespace instead of bucket `0`.

```suggestion
                $bucketRoot = $bucket === ''
                    ? $root
                    : \rtrim($bucket . '/' . \ltrim($root, '/'), '/');
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

@abnegate abnegate closed this Aug 7, 2026
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.

1 participant