Repository navigation
chore: absorb detector into packages/detector - #13891
Conversation
Chore: Expose ssr files list to be public
nuxt generate writes .output/public and symlinks dist to it. There is no output directory without the leading dot, so consumers that build a path from this value get one that never exists. Every other framework here returns a directory its build really writes, and Appwrite's own frameworks config has the same entry with the dot.
fix: return .output as the Nuxt output directory
Adds a Jaspr detection adapter so Jaspr sites are recognised when importing a repository. Jaspr projects are Dart projects, so they share pubspec.yaml and pubspec.lock with Flutter and cannot be told apart by filename alone. Detection therefore keys off the `jaspr` dependency in the manifest, which required teaching the package matcher to read YAML manifests as well as package.json. Adapter detection reads the `jaspr.mode` key from pubspec.yaml: `mode: static` maps to static, anything else to ssr. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Jaspr now extends Flutter, so the two share the pubspec markers and the detector's specificity tie-break picks Flutter for a pubspec that names neither framework, whatever order the options were registered in. Flutter claims the flutter package and Jaspr the jaspr ones, so either wins on its own dependencies. Package matching accepts quoted and flow-mapping YAML keys, adapter detection parses the jaspr mapping in either YAML style and maps client mode to static, and a jaspr server build is recognised as SSR from its compiled app executable. Build command is now `jaspr build`, matching the jaspr adapter merged in #13710 and the CLI preinstalled in the open-runtimes flutter runtime. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A commented out dependency no longer counts as a package match: keys must sit at the start of a line or inside a flow mapping, and comments are stripped first. Adapter detection strips comments the same way, including one trailing the `jaspr:` key itself, and reads `mode` from the direct children of the jaspr mapping rather than the first `mode:` anywhere in it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Package matching and jaspr mode detection were each doing their own comment stripping and key matching, and each missed cases the other handled. Both now go through Utopia\Detector\Yaml, which leaves a `#` inside a quoted value alone, and splits a flow mapping on its own commas so nested collections and multiline mappings read correctly. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A quoted scalar opens only at a value boundary, so the apostrophe in `description: Don't` no longer starts one and a comment after it is stripped again. Closing is escape aware: doubled quotes inside a single quoted scalar and backslash escaped quotes inside a double quoted one stay inside the value. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`path: &local 'packages # local'` left the anchor name as the last character before the quote, so the value read as plain text and its hash was stripped as a comment, taking a real dependency with it. Anchors, aliases and tags are now read as their own token and leave the value boundary standing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Replaces the hand written Yaml helper with ext-json and ext-yaml. Package matching now reads dependency sections out of a parsed manifest instead of searching the raw text, and the jaspr adapter reads jaspr.mode off the parsed tree instead of a regex. Appwrite, the only consumer, already requires ext-yaml. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The detector reads dependency names itself, and Jaspr calls yaml_parse directly since a pubspec is always YAML. Drops src/Manifest.php. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
feat: add Jaspr framework detection
|
|
|
||
| // Initialise Packager Detection | ||
| $files = ['bun.lockb', 'fly.toml', 'package.json', 'remix.config.js']; | ||
| $detector = new Packager($files); |
There was a problem hiding this comment.
Quickstart cannot run The example passes
$files to Packager, whose constructor takes no arguments. The later detector constructors also have different signatures, and none of the detectors receive inputs through addInput(). Even after correcting the constructors, the first getName() call would fail because detection returns null. The missing option-class imports and nonexistent Static class create further failures for readers copying the example.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/detector/README.md
Line: 35
Comment:
**Quickstart cannot run** The example passes `$files` to `Packager`, whose constructor takes no arguments. The later detector constructors also have different signatures, and none of the detectors receive inputs through `addInput()`. Even after correcting the constructors, the first `getName()` call would fail because detection returns null. The missing option-class imports and nonexistent `Static` class create further failures for readers copying the example.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| Add tests for your new detector and detection class in `tests/DetectorTest.php`. Here's an example: | ||
|
|
||
| ```php | ||
| public function testYourDetector(array $files, ?string $expectedName): void |
There was a problem hiding this comment.
Example test cannot run This test requires arguments but has no
#[DataProvider] attribute, and the provider shown below it is not static. A contributor following the guide gets a test that cannot execute under the package’s PHPUnit setup. Show the attribute and static-provider pattern used by the actual suite.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/detector/docs/add-new-adapter.md
Line: 111
Comment:
**Example test cannot run** This test requires arguments but has no `#[DataProvider]` attribute, and the provider shown below it is not static. A contributor following the guide gets a test that cannot execute under the package’s PHPUnit setup. Show the attribute and static-provider pattern used by the actual suite.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
|
||
| public function testJasprConfigFiles(): void | ||
| { | ||
| $this->assertContains('pubspec.yaml', (new Jaspr())->getConfigFiles()); |
There was a problem hiding this comment.
Test pins configuration details This assertion checks that an internal configuration-file list contains a literal filename instead of testing detection behavior. The repository’s testing directive says not to mirror configuration in assertions and to test observable behavior; similar list checks appear in the SvelteKit and Remix tests. This requirement must be satisfied before merging.
Context Used: Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/detector/tests/DetectorTest.php
Line: 1107
Comment:
**Test pins configuration details** This assertion checks that an internal configuration-file list contains a literal filename instead of testing detection behavior. The repository’s testing directive says not to mirror configuration in assertions and to test observable behavior; similar list checks appear in the SvelteKit and Remix tests. This requirement must be satisfied before merging.
**Context Used:** Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| $ git pull | ||
| ``` | ||
|
|
||
| 2. Create new branch from `master` like: `doc-548-submit-a-pull-request-section-to-contribution-guide` |
There was a problem hiding this comment.
Contribution steps target old repository The guide tells readers to branch from
master and submit a PR through the detector repository, but the README now identifies that repository as a read-only mirror and directs development to appwrite/appwrite. Following these steps sends contributors to the wrong workflow; update the branch and PR instructions for the new development location.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/detector/CONTRIBUTING.md
Line: 45
Comment:
**Contribution steps target old repository** The guide tells readers to branch from `master` and submit a PR through the detector repository, but the README now identifies that repository as a read-only mirror and directs development to `appwrite/appwrite`. Following these steps sends contributors to the wrong workflow; update the branch and PR instructions for the new development location.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
# Conflicts: # composer.lock
Summary
This moves
utopia-php/detectorintopackages/detector, so Appwrite loads it directly. It is part of wave 1 in #13828 and follows the playbook inrfc/monorepo.md. detector was a standalone repository and was never inutopia-php/monorepo, so this PR runs the full playbook: a newmirror.yml, the README banner, and a new ruleset on the mirror. It comes in six commits:Add 'packages/detector/' from commit '22171ed5…': subtree import fromutopia-php/detectorwith full history. The mirror head is the0.2.8tag Appwrite already locks, so the code Appwrite runs doesn't change.chore(detector): mirror plumbing:mirror.ymlreplaces the repository'stests,linterandcodeql-analysisworkflows, and the README gets the read-only mirror banner.absorbalso removedpint.jsonand the package'scomposer.lock(and addedcomposer.lockto.gitignore), dropped the Pint, PHPStan and PHPUnitrequire-deventries, and dropped thelint,formatandcheckscripts.refactor: load detector from packages/:replaceentries, drops theutopia-php/detectorrequire line, and removes the package from the lock. Nothing else changes in the lock.src/was already flat.tests/unit/DetectorTest.phpmoves up totests/, and the test namespace changes from the bareUtopia\TeststoUtopia\Detector\Tests, with a matchingautoload-deventry. The old entry pointed at atests/Detector/directory that doesn't exist.docs/add-new-adapter.mdnow points at the new test path.phpstan.neonis now standalone at level max oversrcandtests. The package used to be checked at level 8. No baseline is needed:srcpasses as it is. The 17 findings were all in the tests:?->calls andis_null()guards on values PHPUnit'sassertNotNull()had already narrowed, and anassertNotNull()onRendering::detect(), which never returns null. I removed them.rector.php(PHP sets plus type declarations, the same asopenapi). Commit 6 reverts thesrc/changes Rector made here.phpunit.xmlmoves to the PHPUnit 12 schema, andcomposer testis now plainphpunit.test(detector): run the suite under PHPUnit 12: the suite was written for PHPUnit 9 and didn't run under the root toolchain.@dataProviderannotations become#[DataProvider]attributes, the nine providers becomestatic, andtestFrameworkEdgeCases'$packageFileparameter is renamed to$packageto match its provider's keys, because PHPUnit 12 passes string keys as named arguments.docs(detector): strip trailing whitespace from the adapter guide: one line in the upstream docs failedgit diff --check.refactor(detector): keep src as released; skip the rector rules that rewrote it: an absorb only moves code, sosrc/is now byte-identical to the imported0.2.8.rector.phpskips the rules that rewrote it, the same way balancer's does:ClassPropertyAssignToConstructorPromotionRector,ReadOnlyPropertyRector,ClosureToArrowFunctionRector,ClosureReturnTypeRector,AddArrowFunctionReturnTypeRector,AddArrowFunctionParamArrayWhereDimFetchRector,AddArrayFunctionClosureParamTypeRectorandAddClosureParamTypeForArrayMapRector. Only the tests change.There's nothing to hoist. The package requires only PHP,
ext-jsonandext-yaml, and the rootrequirealready has both extensions. Appwrite uses the package inDeployment/Detection.phpand inVCS/Http/Installations/Repositories/{XList,Detections/Create}.php.Validation
bin/monorepo validate: all packages validbin/monorepo check detector: Rector, Pint, and PHPStan level max pass, with no baselinebin/monorepo test detector: 122 tests / 303 assertionsvendor/bin/phpunit --testsuite packages --filter 'Utopia\\Detector': 122 tests / 303 assertions pass under the root autoloaderUtopia\Detector, run on the host: no errorsUtopia\Detector\Detector\Frameworkresolves topackages/detector/srcfrom the root autoloadercomposer validate --no-check-publish: valid. The only warning is the existingutopia-php/platformexact-version onecomposer update --lock: 1 removal (utopia-php/detector 0.2.8), no other changesbin/monorepo split detector --dry-run:35ed642e, which fast-forwards from the mirror head22171ed5git diff --checkMerge and follow-up
Warning
Merge with a merge commit, not a squash. A squash drops the
git-subtree-*annotation, and the mirror then rejects the split.utopia-php/detectorhad no rulesets, soabsorbcreated the canonicalmainruleset (id23943482). It blocks deletion and non-fast-forward pushes and requires a PR, and the split app (4016286) is an always-bypass actor.After merge: confirm
Splitpushes toutopia-php/detector. Then triage what's still open on the mirror. None of it was carried over here:getAdapter()reports static for an SSR app that prerenders any route🤖 Generated with Claude Code