Skip to content

chore: absorb console into packages/console - #13925

Merged
ChiragAgg5k merged 188 commits into
mainfrom
chore/absorb-console
Sep 27, 2026
Merged

ChiragAgg5k merged 188 commits into
mainfrom
chore/absorb-console

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Summary

Moves utopia-php/console into packages/console so Appwrite loads it directly. Wave 2 of #13828, following the playbook in rfc/monorepo.md. The mirror head 7bd79458 is the 0.2.9 commit Appwrite already locks, so the code Appwrite runs does not change.

Commit What
Add 'packages/console/' from commit '7bd79458…' Subtree import from the mirror with full history
chore(console): mirror plumbing mirror.yml points at this repository's mirror-redirect; README banner points here
refactor: load console from packages/ Root autoload + replace, require line dropped, lock updated, step A shape, BARE entry, baseline
docs(rfc): list the console baseline as its own phase 8 bullet One-line bullet, placed so it merges cleanly with #13924
Merge of main Not rebased, so the subtree history stays intact; lock resolved by taking main's and re-running bin/monorepo autoload + composer update --lock

Details

Area Change
Bare Utopia\ prefix Utopia\Console and Utopia\Command live at the namespace root, so the package keeps Utopia\ → src/ until step B (phase 6). bin/monorepo's BARE gains console => Console; the root bare list is now packages/console/src, packages/validators/src. No classes renamed
src/ Already flat, nothing moves. Only change against 0.2.9 is Pint's fn ( spacing in Command.php. rector.php skips the constructor-promotion and readonly rules; Rector changes nothing
Tests tests/Console/ConsoleTest.php → tests/ConsoleTest.php (already Utopia\Console\Tests), with a matching autoload-dev entry
stdin-driven test testLogs asserted Console::confirm() against phpunit < tests/input.txt, which the root packages suite cannot pipe (it would hang on a TTY or fail on a closed stdin). The confirm() assertion moved to testConfirm, which runs a tests/resources/confirm.php fixture through Console::execute() with the answer on stdin. input.txt is gone and composer test is the standard script
Fixture autoload tests/resources/loop.php required ../../vendor/autoload.php, which only exists in a standalone install. Fixtures now go through tests/resources/autoload.php, which falls back to the root vendor/
Shape LICENSE.md → LICENSE; phpunit.xml, .gitignore match the sibling packages; standalone phpstan.neon at level max over src and tests
Baseline phpstan-baseline.neon with 8 findings, all in src (the package had no PHPStan config of its own): unchecked fopen()/fgets() in confirm(), the untyped $cmd array in execute(), string-keyed variadic arrays passed to compose(). Added to the RFC phase 8 list
Dependencies Nothing to hoist: the package requires php and utopia-php/validators, which is already absorbed. database (still vendored) requires utopia-php/console; replace satisfies it

Note: the console unit tier takes about 55 s (testLoop runs a 30 s loop, plus the stream and timeout tests), which now runs in the root packages suite.

Validation

Check Result
bin/monorepo validate all packages valid, including the duplicate-class check
bin/monorepo check console Rector, Pint, PHPStan level max (with baseline) pass
bin/monorepo test console 43 tests / 175 assertions
vendor/bin/phpunit packages/console/tests (root autoload, no package vendor/) 43 tests / 168 assertions (the env-var test asserts once per environment row)
vendor/bin/phpunit --testsuite packages --filter 'Utopia\\Console' the 43 console tests pass; 3 errors from packages/cache CodecTest data providers because the host lacks igbinary (unrelated, CI's image has it)
Root PHPStan (host) no errors on Functions/Workers/Builds.php, Certificates/LetsEncrypt.php, Platform/Action.php, Tasks/Maintenance.php, Tasks/Install.php, Tasks/Interval.php
composer validate --no-check-publish valid (only the existing platform exact-version warning)
Lock diff vs main removes only utopia-php/console 0.2.9, plus the content hash
bin/monorepo split console --dry-run c65179da, fast-forwards from the mirror head 7bd79458 (2 commits), tree identical to packages/console
git diff --check, composer lint clean

Mirror

Ruleset canonical main ruleset (id 17613338) with the split app as always-bypass, so the absorb ran with --skip-ruleset
Classic branch protection none (branches/main/protection → 404)
Open PRs / issues on utopia-php/console none
Open utopia-php/monorepo PRs touching packages/console none

After merge

Step
Merge with a merge commit a squash drops the git-subtree-* annotation and orphans the package from its mirror
Confirm Split pushes to utopia-php/console
Retire from utopia-php/monorepo remove packages/console there
Triage mirror PRs / issues none open

🤖 Generated with Claude Code

loks0n and others added 17 commits June 20, 2026 10:45
- Drop the 17 per-package mirror CI workflows: they were inert in the monorepo
  and only re-tested, on the mirror, code the monorepo's own matrix already
  gated pre-merge. absorb now strips all incoming workflows and writes only
  mirror.yml; the ratchet lint over packages/* (no uses: left to pin) goes too.
- Make absorb's mirror ruleset idempotent: update whatever branch ruleset
  already exists in place instead of skipping on a name clash (the gap that left
  auth's mirror without the split-app bypass).
- Remove the standalone `import` command — unused, and it left a package without
  mirror.yml/banner/ruleset. import_package() stays as absorb's helper.
- Trim absorbing.md/creating.md/README to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Hoist PHPStan level 5 to the monorepo root
build: hoist baseline rector + phpstan configs to the root
chore: widen utopia-php/validators to 0.3.*
docs: enforce documentation style with Vale
docs: centralize CODE_OF_CONDUCT and CONTRIBUTING at the monorepo root
…console-http-queue

chore: move servers, console, http and queue onto validators ^1.0
chore: stop committing package lock files
…e6e834ad'

git-subtree-dir: packages/console
git-subtree-mainline: ee19d6d
git-subtree-split: 7bd7945
@ChiragAgg5k ChiragAgg5k added the absorb History-preserving package absorption; merge commit required label Sep 26, 2026
@greptile-apps

greptile-apps Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[High risk] Moves console package into monorepo structure.

The PR does not appear ready to merge because the existing regex-validator finding violates an explicit repository requirement.

Fix All in Claude CodeFindings

  1. P2 Regex validators violate guidance. ▶
  2. P2 Tests pin command formatting. ▶
  3. P2 Test leaks an environment variable. ▶
  4. P2 PHP minimum is misstated. ▶
Fix with agent prompt
### Issue 1
packages/console/src/Command.php:undefined-100
The imported flag and option validators add `preg_match()` expressions. The repository guide says not to add regular expressions; it requires string operations or an existing validator unless the PR explains why neither works. The option validator and a test validator repeat this pattern. This repository requirement needs to be satisfied before merging.

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!

### Issue 2
packages/console/tests/ConsoleTest.php:undefined-281
These assertions require exact quoting, spacing, and grouping in the command builder’s string output, even though other tests check what the commands do when executed. A harmless formatting change could therefore break several tests. The repository instruction requires tests of observable behavior rather than assertions coupled to implementation details. This requirement needs to be satisfied before merging.

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!

### Issue 3
packages/console/tests/ConsoleTest.php:undefined-134
This test overwrites process-wide `FOO` without restoring its previous value. It runs in the shared root packages suite without process isolation, so later tests inherit the unexpected value and any existing value is lost for the rest of the run. Save and restore the prior value even if an assertion fails.

### Issue 4
packages/console/README.md:undefined-131
The README says PHP 8.0 or later is supported, but the package manifest requires PHP 8.5 or later. A standalone consumer following the README cannot install the package on PHP 8.0–8.4.

```suggestion
Utopia Console requires PHP 8.5 or later. We recommend using the latest PHP version whenever possible.
```

---

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

Summary

The PR absorbs Utopia Console into packages/console, switches root Composer loading to the in-tree package, and adds package tests, tooling, and mirror configuration.

  • The merge from main preserves the console subtree annotation.
  • Four prior Greptile findings remain outstanding; this review found no distinct new issue.

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

{
$this->ensurePlain();

if (! preg_match('/^-[A-Za-z0-9]+$|^--[A-Za-z0-9][A-Za-z0-9_-]*$/', $key)) {

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 Regex validators violate guidance. The imported flag and option validators add preg_match() expressions. The repository guide says not to add regular expressions; it requires string operations or an existing validator unless the PR explains why neither works. The option validator and a test validator repeat this pattern. This repository requirement needs to be satisfied before merging.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/console/src/Command.php
Line: 100

Comment:
**Regex validators violate guidance.** The imported flag and option validators add `preg_match()` expressions. The repository guide says not to add regular expressions; it requires string operations or an existing validator unless the PR explains why neither works. The option validator and a test validator repeat this pattern. This repository requirement needs to be satisfied before merging.

**Context Used:** AGENTS.md ([source](https://github.com/appwrite/appwrite/blob/main/AGENTS.md))

---

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!

Fix in Claude Code Fix in Codex

new Command('publish'),
);

$this->assertSame("( 'build' || 'build:fallback' ) && 'publish'", $command->toString());

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 Tests pin command formatting. These assertions require exact quoting, spacing, and grouping in the command builder’s string output, even though other tests check what the commands do when executed. A harmless formatting change could therefore break several tests. The repository instruction requires tests of observable behavior rather than assertions coupled to implementation details. This requirement needs to 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/console/tests/ConsoleTest.php
Line: 281

Comment:
**Tests pin command formatting.** These assertions require exact quoting, spacing, and grouping in the command builder’s string output, even though other tests check what the commands do when executed. A harmless formatting change could therefore break several tests. The repository instruction requires tests of observable behavior rather than assertions coupled to implementation details. This requirement needs to 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!

Fix in Claude Code Fix in Codex

public function testExecuteEnvVariables(): void
{
$randomData = base64_encode(random_bytes(10));
putenv("FOO={$randomData}");

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 Test leaks an environment variable. This test overwrites process-wide FOO without restoring its previous value. It runs in the shared root packages suite without process isolation, so later tests inherit the unexpected value and any existing value is lost for the rest of the run. Save and restore the prior value even if an assertion fails.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/console/tests/ConsoleTest.php
Line: 134

Comment:
**Test leaks an environment variable.** This test overwrites process-wide `FOO` without restoring its previous value. It runs in the shared root packages suite without process isolation, so later tests inherit the unexpected value and any existing value is lost for the rest of the run. Save and restore the prior value even if an assertion fails.

---

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


## System requirements

Utopia Console requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible.

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 PHP minimum is misstated. The README says PHP 8.0 or later is supported, but the package manifest requires PHP 8.5 or later. A standalone consumer following the README cannot install the package on PHP 8.0–8.4.

Suggested change
Utopia Console requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible.
Utopia Console requires PHP 8.5 or later. We recommend using the latest PHP version whenever possible.

Knowledge Base Used: Reusable platform packages

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

Comment:
**PHP minimum is misstated.** The README says PHP 8.0 or later is supported, but the package manifest requires PHP 8.5 or later. A standalone consumer following the README cannot install the package on PHP 8.0–8.4.

```suggestion
Utopia Console requires PHP 8.5 or later. We recommend using the latest PHP version whenever possible.
```

**Knowledge Base Used:** [Reusable platform packages](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/appwrite/-/docs/reusable-platform-packages.md)

---

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 26, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

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

Metric Before After Change
🚀 Requests/sec 185.11 183.77 ⚪ -0.7%
⏱️ Latency P50 93.03 ms 93.47 ms ⚪ +0.5%
⏱️ Latency P95 222.01 ms 221.13 ms ⚪ -0.4%
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 93.47 221.13 11,457 183.77 -0.87
Account 183.7 356.18 603 10.01 +8.09
TablesDB 90.28 176.42 6,231 101.22 +1.75
Storage 85.34 185.75 3,015 51.14 +0.41
Functions 134.01 269.26 1,608 27.98 -3.96

Top API waits (after)

API request Max wait (ms)
account.name.update 528.46
tablesdb.rows.delete 525.66
functions.variables.update 485.31
account.prefs.update 469.33
tablesdb.rows.get 425.18

@ChiragAgg5k
ChiragAgg5k merged commit 3b60d66 into main Sep 27, 2026
81 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.