Skip to content

chore: absorb utopia-php/config into packages/config - #14227

Merged
ChiragAgg5k merged 92 commits into
mainfrom
chore/absorb-config
Oct 7, 2026
Merged

ChiragAgg5k merged 92 commits into
mainfrom
chore/absorb-config

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves utopia-php/config into packages/config, following the playbook in rfc/monorepo.md (#13828). Appwrite was on config 1.0.0, the static key/value registry. 2.x replaced that registry with a typed Source + Parser loader, so every consumer (Appwrite, Cloud, Edge, open-runtimes/executor) stayed on 1.x or 0.2. To close the gap, Config gets the registry back in 2.x. Call sites keep Utopia\Config\Config, and this supersedes #14224, which moved the registry into Appwrite\Config instead.

Four commits plus the subtree merge:

  1. Add 'packages/config/' from commit 'bdc39bc…': subtree import of the mirror with its full history. The mirror head is the 2.0.8 release, and its tree matches packages/config in utopia-php/monorepo.
  2. chore(config): mirror plumbing: mirror.yml and the README banner now point here. The mirror's ruleset is normalised so the split app can bypass it.
  3. feat(config): restore the static registry on Config
    • Config gets $params, setParam() and getParam() back, with the 1.x behaviour: dotted keys walk nested arrays, and an absent or null key returns the default. This is additive, so it releases as config/2.1.0.
    • load() stays 2.x's typed loader. Its name collides with 1.x's load($key, $path, $adapter), so registry users store values with setParam() instead.
    • New tests/RegistryTest.php, plus a README section.
    • Step A of the monorepo shape: src/Config/* → src/, tests → Utopia\Config\Tests\, a standalone rector.php, and phpstan.neon at level max with a baseline for the 123 findings the package arrived with (8 in src, 115 in the parser tests). The baseline is listed for phase 8.
    • ConfigTest now sets the two _UTOPIA_KEY* variables itself, because the root packages suite doesn't read the package's phpunit.xml. Otherwise testVariableSource errors there.
    • src/ is unchanged apart from the path move, the registry and Pint brace placement.
  4. refactor: load config from packages/
    • Root autoload and replace entries are added, "utopia-php/config": "1.*" is dropped, and the lock loses only utopia-php/config 1.0.0.
    • app/init/configs.php: the 45 Config::load($key, $path, new PHP()) calls become Config::setParam($key, include $path). 2.x's Parser\PHP includes a temporary copy of the file, which would break the config files that use __DIR__. The old PHP adapter was a plain include anyway.
    • Repository env detection (Detections/Create, Repositories/XList) moves from Adapters\Dotenv to Parser\Dotenv. Behaviour changes there:
      • Quoted values are unquoted, and a # inside quotes is kept.
      • A line without = now rejects that file, which is skipped silently as before.
      • A literal null becomes PHP null. The endpoints return it as "null", as before (999c0d1).
    • rfc/monorepo.md: the Version gaps row is updated, open question 2 is resolved, and the baseline is listed.

Plus docs(config): strip trailing whitespace from the README and fix(vcs): keep a literal null in detected .env values (review).

Tests

  • bin/monorepo test config: 75 tests / 257 assertions.
  • Root packages suite filtered to Utopia\Config, in appwrite/base:2.1.0: 75 tests pass.
  • Appwrite unit suite in appwrite/base:2.1.0 with .env: 1397 tests pass.
  • Booting app/init/constants.php + app/init/configs.php registers all 45 keys (platform resolves with 18 keys).
  • New e2e VCSGiteaConsoleClientTest::testDetectionReadsVariablesFromDotenv covers env detection through the parser switch: an inline comment, a quoted #, and KEY=null → "null". Nothing covered detected variables before. It runs in CI's VCSGitea job.
  • bin/monorepo check config, bin/monorepo validate, composer lint, composer refactor:check and composer analyze all pass.
  • bin/monorepo split config --dry-run: 713e163.
  • git diff --check is clean apart from whitespace-only lines inside the parser tests' heredoc fixtures, which are deliberate.

Merge and follow-up

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

After merge:

  • Confirm Split pushes to utopia-php/config, then bin/monorepo release config 2.1.0.
  • Retire packages/config from utopia-php/monorepo.
  • Close Feat: Migrate to Github Actions utopia-php/config#12 (2023, migrate to GitHub Actions), which is moot here.
  • Cloud: the server-ce bump that picks this up has to rewrite its own Config::load($key, $path, $adapter) calls and any Adapters\* / Exceptions\* imports in the same way. Its Config::getParam() / setParam() call sites are unaffected.
  • Edge and open-runtimes/executor can move from 0.2 to ^2.1 whenever convenient. 0.2 stays on Packagist.
  • Review findings in the released 2.x code (typed loader with non-public or uninitialised properties, Parser\PHP without an open tag, Dotenv # and export handling, two tests using mismatched keys, README examples) go to a follow-up against packages/config.

Related: #13828

Related: #13828

Meldiron and others added 12 commits July 13, 2026 13:15
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
chore: adopt validators ^1.0 in config and storage
…b5da9fc'

git-subtree-dir: packages/config
git-subtree-mainline: 390f952
git-subtree-split: bdc39bc
2.x replaced the 1.x registry (load/setParam/getParam) with a typed
Source + Parser loader, which left every consumer (Appwrite, Cloud, Edge,
open-runtimes/executor) on 1.x or 0.2. Config regains $params, setParam()
and getParam() with the 1.x semantics, so 2.x can host both styles and
consumers move without rewriting their call sites. load() stays the typed
loader; registry users store values with setParam().

Also applies step A of the monorepo shape (flat src/ and tests/,
Utopia\Config\Tests\), a level-max PHPStan config with a baseline for the
123 findings it arrived with, and sets the env-source fixture in the test
itself since the root packages suite does not read the package phpunit.xml.
Drops the vendored utopia-php/config 1.0.0; packages/config now provides
Utopia\Config\Config with the registry restored, so call sites keep their
imports. The 45 file loads in app/init/configs.php store each file with
setParam(include ...), since load() is 2.x's typed loader. Repository env
detection moves to Parser\Dotenv, which honours quotes and maps a literal
null to null; the response model types the value as a string, so a null
is returned as ''.

Refs #13828
@ChiragAgg5k ChiragAgg5k added the absorb History-preserving package absorption; merge commit required label Oct 7, 2026
@luxor-code-review

luxor-code-review Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review complete. 🟡 5 medium

💬 Inline comments (5)

  • 🟡 Literal null dotenv value becomes empty string — Dotenv.php:167
  • 🟡 Non-public config properties throw raw Error — Config.php:71
  • 🟡 Optional missing keys leave typed properties uninitialized — Config.php:88
  • 🟡 PHP parser echoes tag-less config to output — PHP.php:32
  • 🟡 Dotenv truncates values at any #, mis-keys export — Dotenv.php:54
🧹 Nitpicks (2) — 🟢 2 low
  • 🟢 YAML scalar equal to contents gets wrong error (YAML.php:33) — In packages/config/src/Parser/YAML.php:33, \in_array($config, [false, null, $contents], true) compares the decoded value against the raw input string.
  • 🟢 Temp file leaks on PHP parser write failure (PHP.php:27) — In packages/config/src/Parser/PHP.php, the finally that unlinks the temp file only wraps the include (packages/config/src/Parser/PHP.php:31-37); on the file_put_contents() === false branch at line 27 the tempnam() file is thrown past un-unlinked and leaks in the system temp directory.

This PR absorbs the config library into the monorepo as packages/config, reworking parsing (YAML/JSON/PHP/Dotenv), sources (File/Environment/Variable), and attribute-based typed loading, and swaps app/init/configs.php from Config::load adapters to direct Config::setParam(include ...). The VCS detection/list endpoints adopt the new Dotenv parser with ?? '' null coercion, covered by a new Gitea e2e test. Boot wiring and composer autoload changes verified clean; findings concentrate in the parser contracts and typed-loading edge cases.

Files Change
packages/config/src/** New config package: registry, reflection loader, parsers, sources, attributes
packages/config/tests/** Unit tests and fixtures for parsers, registry, and typed config loading
app/init/configs.php, composer.json Migrate config bootstrapping to setParam(include ...) and wire local package autoload
VCS endpoints + Gitea e2e test Parse repo .env via new Dotenv parser in detection/list flows
rfc/monorepo.md, packages/config/* scaffolding Monorepo docs, mirror workflow, package QA configs

Reviewed commit: a0fedff

@ghost

ghost commented Oct 7, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

Absorbs Utopia Config into packages/config, restores the static registry alongside the typed loader, and wires the package into Appwrite's root autoload. Boot configuration uses direct includes with setParam(), while repository environment detection switches to the dotenv parser. The latest changes preserve parsed null values as the string 'null' in detected variable suggestions and update the e2e expectation.

Latest changes: Both repository detection endpoints now return 'null' rather than an empty string for parsed null values, and the Gitea e2e test expects that value.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 10
File Change
app/init/configs.php Replaces adapter-backed registry loads with direct includes and setParam().
composer.json, composer.lock Autoloads the absorbed package and removes the external Config dependency.
packages/config/.github/workflows/mirror.yml, packages/config/.gitignore, packages/config/LICENSE.md Adds mirror plumbing, package ignore rules, and licensing.
packages/config/README.md, packages/config/composer.json Documents the typed loader and restored registry and declares standalone dependencies.
packages/config/phpstan-baseline.neon, packages/config/phpstan.neon, packages/config/phpunit.xml, packages/config/rector.php Adds standalone package QA configuration and an imported-analysis baseline.
packages/config/src/** Imports typed sources, parsers, attributes, and exceptions and restores the static registry.
packages/config/tests/** Imports loader and parser tests and fixtures, adds registry coverage, and sets test environment variables.
rfc/monorepo.md Records Config absorption, the resolved version gap, and the analysis baseline.
src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Detections/Create.php, src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php Uses the dotenv parser and now suggests parsed null values as the string 'null'.
tests/e2e/Services/VCSGitea/VCSGiteaConsoleClientTest.php Adds real-repository dotenv detection coverage and updates the null-value expectation.

Reviewed the commits since a0fedff · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Tier A · Looks good to merge. Summary

Comment thread packages/config/tests/ConfigTest.php Resolved
Comment thread packages/config/README.md Resolved
Comment thread packages/config/README.md Resolved
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

32 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (17)
  • php.appwrite.permissive-write-permission (8)
  • php.appwrite.secret-compare-timing (5)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@luxor-code-review luxor-code-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Absorbs utopia-php/config into packages/config with parser/source rewrites, then migrates app/init/configs.php and the VCS dotenv endpoints to the new API.

Key findings

  • 🟡 Literal null dotenv value becomes empty string — Dotenv.php:167
  • 🟡 Non-public config properties throw raw Error — Config.php:71
  • 🟡 Optional missing keys leave typed properties uninitialized — Config.php:88
  • 🟡 PHP parser echoes tag-less config to output — PHP.php:32
  • 🟡 Dotenv truncates values at any #, mis-keys export — Dotenv.php:54

Comment thread packages/config/src/Parser/Dotenv.php Resolved
Comment on lines +71 to +142
foreach ($reflection->getProperties() as $property) {
$attributeFound = false;

foreach ($property->getAttributes(Key::class, ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
$attributeFound = true;
$key = $attribute->newInstance();

$value = self::resolveValue($data, $key->name);

// A present null is kept; only a genuinely absent key is skipped
// or, when required, reported missing.
if ($value === self::missing()) {
if ($key->required) {
throw new Load("Missing required key: {$key->name}");
}
continue;
}

$expectedType = $property->getType();
if ($expectedType === null) {
throw new Load("Property {$property->name} is missing a type.");
}

if (! $key->validator->isValid($value)) {
throw new Load("Invalid value for {$key->name}: {$key->validator->getDescription()}");
}

$propertyName = $property->name;
try {
$instance->$propertyName = $value;
} catch (\TypeError $e) {
throw new Load("Invalid value for {$key->name}: does not match the type of property {$property->name}.", 0, $e);
}
}

foreach ($property->getAttributes(ConfigKey::class, ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
$attributeFound = true;

$key = $attribute->newInstance();
$keyName = $key->name;
if (empty($keyName)) {
$keyName = $property->name;
}

$value = self::resolveValue($data, $keyName);

if ($value === self::missing()) {
if ($key->required) {
throw new Load("Missing required key: {$keyName}");
}
continue;
}

$expectedType = $property->getType();
if ($expectedType === null || !method_exists($expectedType, 'getName')) {
throw new Load("Property {$property->name} is missing a type.");
}

$expectedClass = $expectedType->getName();

if (!($value instanceof $expectedClass)) {
throw new Load("Invalid value for {$keyName}: Must be instance of {$expectedClass}.");
}

$propertyName = $property->name;
$instance->$propertyName = $value;
}

if (!$attributeFound) {
throw new Load("Property {$property->name} is missing attribute syntax.");
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 bug · medium

Non-public config properties throw raw Error

load() iterates $reflection->getProperties() with no visibility filter (packages/config/src/Config.php:71), so protected and private properties are processed. A non-public property without an attribute fails with the misleading "missing attribute syntax" Load, and one with a #[Key] attribute reaches $instance->$propertyName = $value (packages/config/src/Config.php:100), which executes in Config's scope and throws an uncaught Error: Cannot access private property instead of Load. A schema author using an internal cached field gets a fatal, not a loader exception.

📋 Prompt for AI Agents

In packages/config/src/Config.php around line 71, change $reflection->getProperties() to $reflection->getProperties(\ReflectionProperty::IS_PUBLIC) so only public properties are considered. Optionally add an explicit check that rejects non-public properties with a descriptive Load exception (e.g. "Property X must be public") so schema authors get a clear loader error instead of an uncaught Error or the misleading "missing attribute syntax" message.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This comes from utopia-php/config 2.0.8 as released: the absorb imports the mirror unchanged apart from the path move, restoring the registry, and Pint formatting. The RFC keeps API and behaviour changes out of absorb PRs, so it is tracked for a follow-up against packages/config (#13828) and not changed here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The user is claiming this is intentionally deferred to a follow-up PR (#13828) rather than fixed here. Looking at the current diff, $reflection->getProperties() on line 71 is unchanged — no visibility filter (ReflectionProperty::IS_PUBLIC) has been added, and no explicit non-public property check has been introduced. The issue remains present in this PR as submitted.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in #14235 (a792823). Config::load() now rejects any non-public property with Load before assigning. Covered by testNonPublicKeyPropertyThrowsLoad and testNonPublicPropertyWithoutAttributeThrowsLoad, both red without the check.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The fix is claimed to have landed in #14235 (commit a792823), but that change is not visible in the current PR diff — the candidate file diff for packages/config/src/Config.php still shows $reflection->getProperties() on line 71 with no visibility filter and no explicit non-public property guard. Since this PR's code is unchanged from the original finding, the issue remains unresolved here, even if a separate PR addresses it downstream.

Comment on lines +88 to +93

$expectedType = $property->getType();
if ($expectedType === null) {
throw new Load("Property {$property->name} is missing a type.");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 bug · medium

Optional missing keys leave typed properties uninitialized

When an optional key is absent, load() hits continue (packages/config/src/Config.php:92) and leaves the property untouched. For a typed non-nullable property declared without a default (exactly the pattern in the library's own TestConfig fixtures), the loaded object is invalid: any later read throws Error: Typed property ... must not be accessed before initialization, a fatal outside the Load contract. Callers cannot distinguish "key absent" from "key loaded" and crash at first access.

📋 Prompt for AI Agents

In packages/config/src/Config.php at the optional-missing branch (lines 88-93), before continue, inspect the property: if the property is non-nullable typed and $property->isInitialized($instance) is false with no default value, throw a Load exception telling the schema author that an optional key's non-nullable typed property must declare a default. This prevents a later uninitialized-property Error on first access of the loaded object.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This comes from utopia-php/config 2.0.8 as released: the absorb imports the mirror unchanged apart from the path move, restoring the registry, and Pint formatting. The RFC keeps API and behaviour changes out of absorb PRs, so it is tracked for a follow-up against packages/config (#13828) and not changed here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The user's reply is a maintenance/process explanation, not a fix claim. Looking at the full diff, the issue remains unaddressed: both continue branches (for Key around line 92 and for ConfigKey around line 128) still skip optional missing keys without checking whether the property is a non-nullable typed property lacking a default. The TestConfig fixture confirms the risk — properties like public string $phpKey have no default, are optional (required: false), and will be left uninitialized when their key is absent from the config source. A read of such a property will throw Error: Typed property must not be accessed before initialization. No guard was added in this PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in #14235 (a792823). An absent optional key keeps the declared default. Without one, a nullable property becomes null and any other property raises Load, for both #[Key] and #[ConfigKey]. The README now states this. Covered by testAbsentOptionalKeyLeavesAUsableObject and testAbsentOptionalKeyWithoutDefaultThrowsLoad.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The fix claimed in #14235 (a792823) is not visible in the diff evidence shown here — the current PR diff for packages/config/src/Config.php still contains the original unguarded 'continue' branches for both '#[Key]' and '#[ConfigKey]' when an optional key is absent, with no check for uninitialized non-nullable typed properties. Since the fix reportedly landed in a separate PR (#14235) rather than this one, I cannot verify it in the available evidence. The finding remains unresolved in this PR's diff.

}

try {
$contents = include $tempPath;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 bug · medium

PHP parser echoes tag-less config to output

Parser\PHP writes the contents to a temp file and includes it (packages/config/src/Parser/PHP.php:32) without any check for a PHP open tag. A config file accidentally saved without <?php has its raw text emitted as output (CLI/HTTP response pollution) while the include returns 1, so parsing "fails correctly" via the must-return-an-array branch — and the new testPHPParseExceptionMissingStart encodes this implementation accident rather than a real missing-start-tag rule. A future refactor of the return path can silently change what the test verifies.

📋 Prompt for AI Agents

In packages/config/src/Parser/PHP.php, add an explicit check in parse() that the contents begin with the PHP open tag (<?php) and throw a Parse exception otherwise, before writing the temp file. Then in packages/config/tests/Parser/PHPTest.php testPHPParseExceptionMissingStart (lines 141-145), keep the Parse expectation and add an assertion that no output was produced during parse (wrap the call in ob_start/ob_get_clean) so the test no longer depends on the incidental include-return-value behavior.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This comes from utopia-php/config 2.0.8 as released: the absorb imports the mirror unchanged apart from the path move, restoring the registry, and Pint formatting. The RFC keeps API and behaviour changes out of absorb PRs, so it is tracked for a follow-up against packages/config (#13828) and not changed here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The user has explained this is an absorb PR that intentionally keeps the upstream utopia-php/config 2.0.8 code unchanged, with the fix deferred to a follow-up (#13828). Looking at the current diff for packages/config/src/Parser/PHP.php, the fix is not present — there is still no <?php open-tag check before writing the temp file, and the output-pollution risk remains in this PR. Since the fix has not landed here, I cannot resolve this finding based on a future PR's intent.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in #14235 (5a12875). Parser\PHP refuses contents that do not start with <?php before including them. testPHPParseExceptionMissingStart now covers a missing tag, text, a newline and a BOM before it, and asserts nothing is printed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The fix referenced in #14235 (commit 5a12875) is not present in the current diff shown for this PR — 'packages/config/src/Parser/PHP.php' still has no open-tag check before writing the temp file, and 'packages/config/tests/Parser/PHPTest.php' shows 'testPHPParseExceptionMissingStart' without the ob_start/ob_get_clean output assertion. Since the fix landed in a separate PR rather than here, I cannot resolve this finding against the evidence in this diff.

Comment on lines +54 to +59
$hash = strpos($raw, '#');
if ($hash !== false) {
$raw = substr($raw, 0, $hash);
}

return trim($raw);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 bug · medium

Dotenv truncates values at any #, mis-keys export

Parser\Dotenv::parseValue() strips everything from the first # of an unquoted value (packages/config/src/Parser/Dotenv.php:54-59), so a value like pa#ss silently becomes pa — mainstream dotenv implementations treat # as a comment only when preceded by whitespace, so URL=https://x.com/a#b and hashed secrets are corrupted. Separately, an export KEY=val line is stored under the key export KEY (no prefix handling in parse()), diverging silently from real dotenv files. Both feed function env variables through the VCS detection endpoints.

📋 Prompt for AI Agents

In packages/config/src/Parser/Dotenv.php parseValue() (lines 47-59), change the unquoted branch so the inline comment starts only at a # preceded by whitespace, preserving values like URL=https://x.com/a#b and PASSWORD=pa#ss. In parse() around line 139, strip a leading export prefix from $parts[0] before the $name = trim($parts[0]) assignment so export KEY=val stores key KEY like standard dotenv implementations.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This comes from utopia-php/config 2.0.8 as released: the absorb imports the mirror unchanged apart from the path move, restoring the registry, and Pint formatting. The RFC keeps API and behaviour changes out of absorb PRs, so it is tracked for a follow-up against packages/config (#13828) and not changed here. The 1.x adapter Appwrite used before also cut values at the first # and kept export KEY as the key, so env detection behaves as it did on main.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The user's reply is a deferral, not a fix claim — they acknowledge the bugs exist but explain this PR intentionally preserves the existing broken behavior for compatibility, with fixes tracked separately. Looking at the current diff, both issues remain unresolved in the code:

  1. 'parseValue()' still uses 'strpos($raw, "#")' without any whitespace check, so 'pa#ss' is still truncated to 'pa'.
  2. 'parse()' still does '$name = trim($parts[0])' with no 'export ' prefix stripping.

Since the fix is explicitly deferred to a follow-up PR and is not present in this diff, I cannot resolve this finding.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in #14235 (711bf65). An unquoted # starts a comment only at the start of the value or after whitespace, and a leading export is dropped from the key. Covered by two Dotenv tests and by the Gitea env-detection e2e test, which now includes SECRET=pa#ss and export EXPORTED=yes.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

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

Metric Before After Change
🚀 Requests/sec 205.55 209.04 ⚪ +1.7%
⏱️ Latency P50 83.77 ms 81.65 ms ⚪ -2.5%
⏱️ Latency P95 202.42 ms 196.14 ms ⚪ -3.1%
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 81.65 196.14 13,053 209.04 -6.29
Account 160.71 314.54 687 11.4 -24.98
TablesDB 77.05 145.49 7,099 116.14 -12.38
Storage 78.15 172.2 3,435 57.98 +6.74
Functions 122.29 235.16 1,832 31.49 -16.76

Top API waits (after)

API request Max wait (ms)
account.prefs.update 507.17
account.name.update 406.1
account.get 374.01
functions.variables.update 370.74
functions.variables.create 357.51

Parser\Dotenv maps a literal null to PHP null, and the previous adapter
returned the string. Detection suggests the value the file holds, so
return 'null' rather than an empty string.
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.