Skip to content

chore: absorb dsn into packages/dsn - #13894

Merged
ChiragAgg5k merged 44 commits into
mainfrom
chore/absorb-dsn
Sep 26, 2026
Merged

ChiragAgg5k merged 44 commits into
mainfrom
chore/absorb-dsn

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

This moves utopia-php/dsn into packages/dsn, so Appwrite loads it directly, and upgrades Appwrite from 0.2.1 to 1.0.0 in the process. It follows the playbook in rfc/monorepo.md (wave 1 of #13828) and comes in three commits:

  1. Add 'packages/dsn/' from commit '6d0e0aa9…': subtree import from the standalone repository with full history. The head is the 1.0.0 tag.
  2. chore(dsn): mirror plumbing: absorb writes mirror.yml, removes the old linter.yml and pull_request.yml workflows, adds the README banner, and strips Pint, PHPUnit and PHP_CodeSniffer from require-dev along with the lint/format scripts.
  3. refactor: load dsn from packages/:
    • Adds the root autoload and replace entries, drops the utopia-php/dsn: 0.2.1 require line, and removes the package from the lock. The lock diff is that one package plus the content hash.
    • Step A of the standard shape:
      • src/DSN/DSN.php moves up to src/.
      • tests/DSN/DSNTest.php moves up to tests/, and its namespace goes from Tests\Unit\DSN to Utopia\DSN\Tests, with a matching autoload-dev entry.
      • The @dataProvider annotation becomes a #[DataProvider] attribute, since PHPUnit 12 ignores the annotation.
      • phpunit.xml is rewritten for PHPUnit 12. vimeo/psalm leaves require-dev (there was no psalm.xml), and .gitignore gains composer.lock and .phpunit.cache.
      • The README's test section pointed at composer lint/format, which no longer exist, so it's now just composer test.
    • Adds a standalone phpstan.neon at level max over src and tests, plus rector.php. The standalone repository had no PHPStan config. A phpstan-baseline.neon holds 4 findings: the untyped $params array, parse_url()'s integer port stored in a ?string property, and getParam() returning the mixed parsed query value. The RFC's phase 8 burn-down list now includes them.

There's nothing to hoist, since the package requires only PHP.

The 1.0.0 upgrade

The only change from 0.2.1 is utopia-php/dsn#10: when a DSN fails to parse, the exception message is now Unable to parse DSN: malformed instead of echoing the DSN, and the constructor argument is #[\SensitiveParameter]. The exception type (\InvalidArgumentException) and the API are unchanged. The 26 Appwrite files that use Utopia\DSN only catch the type, and nothing in app/, src/ or tests/ asserts on the message, so Appwrite needs no changes. The benefit is that a malformed database or queue DSN no longer leaks its credentials into logs.

Cross-repo

utopia-php/migration (still vendored, lock 2.0.7) requires utopia-php/dsn: 0.2.*. Inside Appwrite, replace satisfies that, and Packagist consumers of migration keep installing dsn 0.2.x. The constraint moves to ^1.0 when migration is absorbed (wave 5 of #13828).

Validation

  • bin/monorepo validate: all packages valid
  • bin/monorepo check dsn: Rector, Pint, and PHPStan level max (with baseline) pass
  • bin/monorepo test dsn: 7 tests / 112 assertions
  • vendor/bin/phpunit --testsuite packages --filter 'Utopia\\DSN': 7 tests / 112 assertions under the root autoloader
  • Utopia\DSN\DSN resolves to packages/dsn/src/DSN.php, and nothing is left under vendor/utopia-php/dsn
  • Root PHPStan on the 26 files that use Utopia\DSN (on the host): no errors
  • vendor/bin/phpunit tests/unit/Auth/Validator/PasswordPwned tests/unit/Platform/Modules/Databases/PoolTest.php: 37 tests pass
  • composer validate --no-check-publish: valid
  • bin/monorepo split dsn --dry-run: 6538569d, which fast-forwards from the mirror head 6d0e0aa9 (2 commits)
  • git diff --check

Merge and follow-up

Warning

Merge with a merge commit, not a squash. A squash drops the git-subtree-* annotation and orphans the package from its mirror.

utopia-php/dsn had a main ruleset (id 23926928), created today, that required one approving review and let only org admins and repository admins bypass it, so the split app would have been rejected. absorb normalised it in place to the canonical config: default branch, deletion and non-fast-forward blocked, PR required with 0 approvals, and the split app (4016286) as the only always-bypass actor.

After merge: confirm Split pushes to utopia-php/dsn. Then triage the mirror's one open item, issue utopia-php/dsn#7 ("Add code formatter and CI/CD linter", a 2024 codeday task). It asks for Pint, lint/format scripts and a lint workflow. The root toolchain now provides all three (bin/monorepo check dsn), so it can be closed with a pointer here. The repository has no open PRs.

🤖 Generated with Claude Code

christyjacob4 and others added 30 commits October 26, 2022 00:22
Previously, DSN would not be able to parse special characters like "@"
or "/". This adds support by requiring the input to be url encoded and
then DSN would decode it after parsing.
Update DSN to support special chars for user and password
parse_url() rejects the mistakes people actually make in a DSN (an empty
host after the userinfo, a port out of range, a secret key with an
unencoded "/"), and the refusal quoted the whole DSN back, user and
password included. Anything that logs the message, or lets the exception
escape to stderr, wrote the credentials out with it.

Nothing of the input is kept: redacting only the userinfo would mean
picking apart a string parse_url() has just refused, and the query can
carry secrets of its own. The scheme and host refusals already quoted
nothing; the regression test pins all three.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With the message clean, the refusal's stack trace still printed the DSN
argument, cut to zend.exception_string_param_max_len (15 bytes by
default): the scheme, the user and the start of the password. Traces
carry arguments unless zend.exception_ignore_args is on, and it is off
by default and in the official PHP images, which ship no php.ini.

#[\SensitiveParameter] prints the argument as
Object(SensitiveParameterValue) instead. PHP before 8.2 ignores the
attribute, so the trace test runs from 8.2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
abnegate and others added 5 commits September 24, 2026 19:33
SensitiveParameter only takes effect from PHP 8.2, and this package
still supports 8.0 and 8.1, where the refusal's trace kept printing the
DSN argument. A trace prints a parameter's current value rather than
the one passed, so the constructor drops $dsn once parse_url() is done
with it, and the trace test now runs on every supported version.

The test no longer pins how PHP renders a redacted argument (NULL
before 8.2, Object(SensitiveParameterValue) from 8.2): it asserts that
neither the user nor the password is printed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix: keep credentials out of DSN parse failures
…6c4a'

git-subtree-dir: packages/dsn
git-subtree-mainline: b866958
git-subtree-split: 6d0e0aa
@ChiragAgg5k ChiragAgg5k added the absorb History-preserving package absorption; merge commit required label Sep 24, 2026
@greptile-apps

greptile-apps Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Moves a dependency package into the monorepo structure.

The PR appears safe to merge, though the standalone test instructions remain unusable after a fresh package install.

Fix All in Claude CodeFindings

  1. P2 Standalone test command cannot run ▶
Fix with agent prompt
### Issue 1
packages/dsn/README.md:undefined-40
After a fresh checkout of the standalone DSN package and `composer install`, the documented `composer test` command cannot find PHPUnit: the package runs `phpunit` but does not declare it as a dependency. The monorepo test runner supplies PHPUnit from the root toolchain, so the command works there but leaves standalone contributors without a working test path. Please document the monorepo command or provide a standalone test dependency.

---

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

Summary

The PR moves Utopia DSN into packages/dsn, loads it through the root autoloader, and records its PHPStan baseline in the monorepo RFC.

  • The only PR change since the previous review is the RFC baseline entry.

Reviews (10) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..."

Comment thread packages/dsn/README.md
## Tests

```bash
composer test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Standalone test command cannot run

After a fresh checkout of the standalone DSN package and composer install, the documented composer test command cannot find PHPUnit: the package runs phpunit but does not declare it as a dependency. The monorepo test runner supplies PHPUnit from the root toolchain, so the command works there but leaves standalone contributors without a working test path. Please document the monorepo command or provide a standalone test dependency.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/dsn/README.md
Line: 40

Comment:
**Standalone test command cannot run**

After a fresh checkout of the standalone DSN package and `composer install`, the documented `composer test` command cannot find PHPUnit: the package runs `phpunit` but does not declare it as a dependency. The monorepo test runner supplies PHPUnit from the root toolchain, so the command works there but leaves standalone contributors without a working test path. Please document the monorepo command or provide a standalone test dependency.

---

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

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → chore/absorb-dsn (after).

Metric Before After Change
🚀 Requests/sec 165.07 162.89 ⚪ -1.3%
⏱️ Latency P50 104.38 ms 106.83 ms ⚪ +2.3%
⏱️ Latency P95 246.21 ms 246.1 ms ⚪ 0%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 106.83 246.1 10,260 162.89 -0.12
Account 214.28 398.91 540 9.19 -19.45
TablesDB 103.59 192.63 5,580 90.14 +0.81
Storage 97.48 206.46 2,700 45.52 -5.79
Functions 155.08 300.37 1,440 24.97 +9.49

Top API waits (after)

API request Max wait (ms)
tablesdb.rows.update 653.87
account.name.update 593.98
functions.create 527.84
account.prefs.update 507.46
storage.files.create 477.96

@ChiragAgg5k
ChiragAgg5k merged commit 84b9190 into main Sep 26, 2026
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

absorb History-preserving package absorption; merge commit required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants