chore: absorb system into packages/system by loks0n · Pull Request #13804 · appwrite/appwrite · GitHub
Skip to content

chore: absorb system into packages/system - #13804

Merged
loks0n merged 130 commits into
mainfrom
codex/absorb-system
Sep 21, 2026
Merged

loks0n merged 130 commits into
mainfrom
codex/absorb-system

Conversation

@loks0n

@loks0n loks0n commented Sep 21, 2026

Copy link
Copy Markdown
Member

Summary

Move utopia-php/system into packages/system so Appwrite loads it directly and system-library changes can land with their callers. Import full mirror history at f7077643de7e012945f6e3fc4c3c36e7f1d40047, identical to the 0.11.0 release already in Appwrite’s lockfile.

Flatten source and tests, register root autoload/replace entries, remove the Composer dependency, and point the mirror workflow and README at Appwrite. The lockfile removes only system; other dependencies retain their versions. Production code changes are formatting only. The environment-variable test now seeds its own isolated process rather than relying on the package XML, so it also runs in the combined Appwrite suite.

Per the migration RFC, record 16 existing maximum-level PHPStan findings in a baseline and the RFC follow-up list. Integration changes after the history import remove a net 18 lines.

Validation

  • bin/monorepo validate
  • bin/monorepo check system: Pint and maximum-level PHPStan with baseline
  • bin/monorepo test system: 33 tests, 65 assertions on PHP 8.5/macOS
  • vendor/bin/phpunit --no-configuration --bootstrap vendor/autoload.php packages/system/tests: 33 tests, 65 assertions, including isolated cgroup fixtures
  • composer validate --no-check-publish: existing exact-version warnings only
  • bin/monorepo split system --dry-run: d1682f6e286b564de1b00364eee79a458095f20a
  • git diff --check

Linux and full Appwrite integration validation remain for CI; no Appwrite stack was run locally.

Merge and follow-up

Use a merge commit, not squash, to preserve subtree ancestry. The system mirror already has an active ruleset allowing the split app to bypass it; no ruleset change was needed.

After merge, confirm Appwrite’s Split succeeds, then remove packages/system from utopia-php/monorepo and refresh its graph in a follow-up PR. Retain the standalone mirror, release tags, and consumer Packagist constraints. Confirm the old splitter stops publishing system. No open PRs were found on the system mirror during selection.

Closes #13803.

loks0n and others added 17 commits May 5, 2026 13:19
Both branches previously fell through to 0.0 when shell_exec was
disabled or returned no numeric output, breaking the >0 contract that
the Linux branch and tests rely on. Throw a descriptive exception
instead, matching the Linux behaviour.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
shell_exec can return string|false|null; use is_string() before passing
to preg_match to satisfy static analysis.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
wmic emits one NumberOfCores row per socket, so preg_match captured
only the first and undercounted multi-socket systems. Use preg_match_all
and sum the values.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
An input like "3-1" previously produced a negative increment; require
start <= end before counting.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat: add getCPU() with cgroup limit support
The five per-arch test suites (only runnable on matching hardware,
previously selected by CI inside docker) collapse into a single arch
consistency test. Memory tests now expect success on Darwin, where
getMemoryTotal/getMemoryFree are implemented; testGetMemoryAvailable
was asserting against the wrong method in its else branch. TESTA/TESTB
env vars move from the deleted Dockerfile into phpunit.xml.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every uses: ref is upgraded to its latest major (checkout v6,
create-github-app-token v3) and pinned to the tag's commit SHA in
ratchet's format. The validate job now runs ratchet lint over root and
package workflows, so unpinned refs fail CI. Four leftover QA-only
codeql workflows (cli, pools, telemetry, validators) are deleted — they
invoke the composer check script that QA hoisting removed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- 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) <noreply@anthropic.com>
Hoist PHPStan level 5 to the monorepo root
build: hoist baseline rector + phpstan configs to the root
docs: enforce documentation style with Vale
docs: centralize CODE_OF_CONDUCT and CONTRIBUTING at the monorepo root
chore: stop committing package lock files
feat(system): add cgroup-aware memory capacity method
…1d40047'

git-subtree-dir: packages/system
git-subtree-mainline: 9500bdc
git-subtree-split: f707764
@loks0n loks0n added the absorb History-preserving package absorption; merge commit required label Sep 21, 2026
@loks0n loks0n self-assigned this Sep 21, 2026
@greptile-apps

greptile-apps Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Comment thread packages/system/tests/CgroupMemoryTest.php
@github-actions

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → codex/absorb-system (after).

Metric Before After Change
🚀 Requests/sec 184.41 180.22 ⚪ -2.3%
⏱️ Latency P50 93.1 ms 96.86 ms ⚪ +4%
⏱️ Latency P95 223.42 ms 225.06 ms ⚪ +0.7%
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 96.86 225.06 11,400 180.22 +1.64
Account 178.28 338.43 600 10.15 -16.24
TablesDB 93.16 174.29 6,200 100.43 -9.17
Storage 89.03 192.5 3,000 49.96 +4.4
Functions 139.46 275.33 1,600 27.22 +15.56

Top API waits (after)

API request Max wait (ms)
functions.variables.update 489.79
account.prefs.update 464.08
account.name.update 449.49
tablesdb.rows.create 409.9
functions.create 392.43

@loks0n

loks0n commented Sep 21, 2026

Copy link
Copy Markdown
Member Author

Investigated the four CI failures. Locale, Mqtt, and Organization have GitHub annotations saying the self-hosted runner lost communication with the server; their logs were not uploaded. Functions completed 83 tests with one failure: testFunctionsDomain expected 200 but received 404 at FunctionsCustomServerTest.php:2868. Build, root unit suite, static checks, and every package job (including system) passed. Retrying only the failed jobs on the unchanged commit to distinguish infrastructure/transient domain readiness from a reproducible regression.

@loks0n

loks0n commented Sep 21, 2026

Copy link
Copy Markdown
Member Author

@loks0n
loks0n merged commit bcb653d into main Sep 21, 2026
103 of 107 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.

Absorb system into packages/system