Skip to content

chore: absorb compression into packages/compression - #13798

Merged
loks0n merged 39 commits into
mainfrom
codex/absorb-compression
Sep 21, 2026
Merged

loks0n merged 39 commits into
mainfrom
codex/absorb-compression

Conversation

@loks0n

@loks0n loks0n commented Sep 21, 2026

Copy link
Copy Markdown
Member

Summary

Absorb utopia-php/compression into packages/compression, so Appwrite loads it directly and library changes can land alongside their callers. It is a leaf package requiring only PHP; optional compression extensions remain suggested dependencies.

  • Import full mirror history from 8a23fdec63623aa6ad64ed764d688e67cf2c110e, flatten source/tests, and point the mirror workflow and README here.
  • Replace the Composer dependency with root autoload/replace entries. The lockfile removes only compression; no other versions change.
  • Preserve runtime behavior. Carry 16 pre-existing maximum-level PHPStan findings in a baseline, recorded for follow-up in the RFC.
  • Remove empty teardown methods and approximately 33 MiB of unused test fixtures.

Validation

  • bin/monorepo validate
  • bin/monorepo check compression (Pint and maximum-level PHPStan with baseline)
  • bin/monorepo test compression: 30 tests, 88 assertions; all optional compression extensions present, no skips
  • Same 30 tests / 88 assertions using the root autoloader
  • composer validate --no-check-publish (existing exact-version warnings only)
  • bin/monorepo split compression --dry-run: b920ca6c3fd10c00515f1fccddf2c71c92eddab8
  • git diff --check

Full Appwrite CI remains pending; no Appwrite E2E stack was run locally.

Merge and mirror

Merge with a merge commit, not squash, to preserve the subtree ancestry. After merge, verify the compression Split workflow. The mirror already has an active ruleset with split-app bypass, so no ruleset mutation was needed. Existing mirror PR utopia-php/compression#5 concerns formatting/CI now owned by the root and should be closed as superseded after this lands.

Closes #13797.

eldadfux and others added 30 commits October 17, 2024 13:50
fix: add tests ci and & gzip
feat(zstd): enable by default for accept encoding
Real fixes surfaced by the hoisted toolchain: Algorithms\Gzip
referenced with the wrong case (a PSR-4 autoload hazard on
case-sensitive filesystems), a typo'd 'suggests' composer key hiding
the extension suggestions, and compressed-size assertions hardcoding
library-version-dependent byte counts. Algorithm suites now skip via
RequiresPhpExtension when an extension is absent; psalm is replaced by
the hoisted phpstan (level 5); the tests-in-container scaffolding is
retired.

Co-Authored-By: Claude Fable 5 <[email protected]>
setup-php has no xz extension, so the runner's phpstan lacked
xzencode/xzdecode; a scanFiles stub provides the symbols without the
extension. Tests already skip via RequiresPhpExtension.

Co-Authored-By: Claude Fable 5 <[email protected]>
loks0n and others added 9 commits June 12, 2026 18:10
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 <[email protected]>
- 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]>
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
…8e67cf2c110e'

git-subtree-dir: packages/compression
git-subtree-mainline: 5088486
git-subtree-split: 8a23fde
@loks0n loks0n added the absorb History-preserving package absorption; merge commit required label Sep 21, 2026
@loks0n loks0n self-assigned this Sep 21, 2026
@github-actions

Copy link
Copy Markdown

✨ Benchmark results

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

Metric Before After Change
🚀 Requests/sec 174.41 178.64 ⚪ +2.4%
⏱️ Latency P50 99.11 ms 98.06 ms ⚪ -1.1%
⏱️ Latency P95 231.54 ms 227.42 ms ⚪ -1.8%
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 98.06 227.42 11,400 178.64 -4.12
Account 193.07 358.16 600 10.19 +7.96
TablesDB 94.87 174.99 6,200 100.7 -9.82
Storage 90.39 187.86 3,000 49.99 -3.74
Functions 138.82 271.86 1,600 27.23 -10.52

Top API waits (after)

API request Max wait (ms)
account.name.update 561.52
account.prefs.update 459.77
functions.create 437.15
tablesdb.rows.decrement 423.37
functions.variables.update 394.29

@loks0n
loks0n marked this pull request as ready for review September 21, 2026 12:41
@loks0n
loks0n merged commit 9500bdc into main Sep 21, 2026
52 checks passed
@greptile-apps

greptile-apps Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

The runtime migration appears sound, but the explicit repository testing requirement must be satisfied by removing the implementation-coupled compressed-size assertions before merging.

Fix All in Claude CodeFindings

  1. P2 Codec output is over-specified ▶
Fix with agent prompt
### Issue 1
packages/compression/tests/Algorithms/LZ4Test.php:35
This assertion freezes the exact output size of the current LZ4 extension and fixture even though the test already verifies a lossless round trip. A valid extension upgrade can change the encoded byte count without breaking compression, causing meaningless CI failures. The same pattern appears in `SnappyTest` and `ZstdTest`. This violates the repository directive to test observable behavior rather than mirror implementation- or version-specific output, so these byte-size assertions must be removed 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!

---

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

Summary

This PR absorbs the previously pinned utopia-php/compression package into the monorepo, flattens its package layout, and replaces the external Composer dependency with direct root autoloading.

  • Imports the source from the same commit previously recorded in composer.lock.
  • Adds standalone package metadata, mirror plumbing, PHPStan configuration, tests, and retained fixtures.
  • Updates the monorepo RFC to record the imported static-analysis baseline.
  • The package and root autoload mappings match the flattened source layout.
  • The imported tests contain version-sensitive compressed-byte assertions that violate the repository’s observable-behavior testing requirement.

Reviews (1) · Last reviewed commit: "chore: integrate compression into the mo..."

$dataSize = mb_strlen($data, '8bit');

$this->assertSame(21, $demoSize);
$this->assertSame(27, $dataSize);

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 Codec output is over-specified

This assertion freezes the exact output size of the current LZ4 extension and fixture even though the test already verifies a lossless round trip. A valid extension upgrade can change the encoded byte count without breaking compression, causing meaningless CI failures. The same pattern appears in SnappyTest and ZstdTest. This violates the repository directive to test observable behavior rather than mirror implementation- or version-specific output, so these byte-size assertions must be removed 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/compression/tests/Algorithms/LZ4Test.php
Line: 35

Comment:
**Codec output is over-specified**

This assertion freezes the exact output size of the current LZ4 extension and fixture even though the test already verifies a lossless round trip. A valid extension upgrade can change the encoded byte count without breaking compression, causing meaningless CI failures. The same pattern appears in `SnappyTest` and `ZstdTest`. This violates the repository directive to test observable behavior rather than mirror implementation- or version-specific output, so these byte-size assertions must be removed 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

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 compression into packages/compression

4 participants