Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds conditional deployment triggering based on branch and path patterns: two new array attributes ( Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR implements branch and path-based build triggers for VCS deployments (SER-401), allowing functions and sites to filter which GitHub pushes/PRs actually trigger a build based on configurable branch patterns and file path patterns. Two new attributes ( Key changes:
Confidence Score: 1/5
Important Files Changed
Reviews (1): Last reviewed commit: "remove default" | Re-trigger Greptile |
src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php
Outdated
Show resolved
Hide resolved
🔄 PHP-Retry SummaryFlaky tests detected across commits: Commit
|
| Test | Retries | Total Time | Details |
|---|---|---|---|
UsageTest::testVectorsDBStats |
1 | 10.61s | Logs |
RealtimeCustomClientQueryTest::testDatabaseChannelWithQuery |
1 | 39.44s | Logs |
Commit c925ad8 - 5 flaky tests
| Test | Retries | Total Time | Details |
|---|---|---|---|
UsageTest::testVectorsDBStats |
1 | 10.06s | Logs |
DocumentsDBCustomServerTest::testTimeout |
1 | 120.43s | Logs |
LegacyConsoleClientTest::testTimeout |
1 | 121.40s | Logs |
LegacyCustomClientTest::testTimeout |
1 | 120.93s | Logs |
LegacyCustomServerTest::testInvalidDocumentStructure |
1 | 240.70s | Logs |
Commit 0bbe82a - 2 flaky tests
| Test | Retries | Total Time | Details |
|---|---|---|---|
UsageTest::testVectorsDBStats |
1 | 10.43s | Logs |
DatabaseServerTest::testUpdateRow |
1 | 241.28s | Logs |
Commit a8452db - 5 flaky tests
| Test | Retries | Total Time | Details |
|---|---|---|---|
LegacyConsoleClientTest::testListDocumentsWithCache |
1 | 948ms | Logs |
LegacyCustomClientTest::testListIndexes |
1 | 240.77s | Logs |
LegacyCustomClientTest::testDocumentsListQueries |
1 | 4ms | Logs |
LegacyCustomServerTest::testAttributeResponseModels |
1 | 243.06s | Logs |
UsageTest::testVectorsDBStats |
1 | 10.03s | Logs |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/Appwrite/Vcs/Validator/BuildTrigger.php (1)
7-10: Document the trigger grammar on the validator.This class now defines reusable behavior (
!,*,**, empty-pattern fallback, precedence), but none of that is discoverable from the class signature. A short class/constructor docblock will save callers from reverse-engineering the contract from tests.As per coding guidelines "Include comprehensive PHPDoc comments."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Vcs/Validator/BuildTrigger.php` around lines 7 - 10, Add a PHPDoc block to the BuildTrigger class/constructor documenting the trigger grammar and semantics so callers don't need to inspect tests: describe the accepted pattern tokens and their meanings (e.g., '!' prefix for negation, '*' for single-segment wildcard, '**' for multi-segment wildcard), explain the empty-pattern fallback behavior and pattern precedence/resolution rules, and note that the constructor takes an array of patterns via the private readonly array $patterns parameter; place this docblock immediately above the class declaration or constructor (BuildTrigger::__construct) to satisfy the "Include comprehensive PHPDoc comments" guideline.composer.json (1)
87-87: Please pinutopia-php/vcsto an immutable revision before merge.
dev-ser-401 as 3.0.99still follows a movable branch head, so a fresh dependency resolution can install code that differs from what this PR was validated against. For a1.9.xbranch, a tag or exact locked revision is much safer.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@composer.json` at line 87, The composer.json entry for utopia-php/vcs uses a movable branch ("dev-ser-401 as 3.0.99"); replace it with an immutable reference (either an exact package tag like "3.0.99" or a branch pinned to a commit SHA using "dev-ser-401#<commit-hash>" or the exact tag) so the dependency cannot drift, update composer.lock by running composer update for that package, and commit the updated composer.json and composer.lock; target the "utopia-php/vcs" dependency string in composer.json to make this change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php`:
- Around line 544-552: The path-trigger logic currently rejects the deployment
as soon as any affected file does not match, but it should accept the resource
if any affected file matches the BuildTrigger; update the loop that iterates
$providerAffectedFiles using the BuildTrigger $pathTrigger so that it returns
true immediately when $pathTrigger->isValid($file) is true (or sets a match
flag) and only calls Span::add(... 'path') and returns false if no files matched
after the loop completes; ensure Span::add is moved to the "no match" branch so
we only log a skip reason when nothing matched.
In `@src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php`:
- Around line 215-216: The current use of array_column($prFiles, 'filename')
only captures new paths and misses renamed files' old paths; update the logic
that builds $providerAffectedFiles (after calling getPullRequestFiles and where
$prFiles is available) to collect both 'filename' and, when present,
'previous_filename' for each entry (e.g., loop over $prFiles, push both values
if non-empty, then array_unique the result) so renamed files match filters;
apply the same change in the corresponding Update handler where
$prFiles/$providerAffectedFiles are built.
In `@src/Appwrite/Vcs/Validator/BuildTrigger.php`:
- Around line 21-41: isValid() currently returns true immediately on the first
inclusion match, allowing excluded paths to slip through; change it so
exclusions veto inclusions: in the isValid() method (which uses $this->patterns,
matchGlob(), and the include/exclude arrays) first collect include and exclude
patterns as you do now, then when an inclusion pattern matches set a flag (e.g.
$matched = true) but do not return; after checking inclusions, iterate excludes
(using substr($pattern,1) or similar) and if any exclusion matches return false;
finally return $matched || empty($include). Ensure matchGlob() is used unchanged
and update logic near getDescription() to respect this veto behavior.
---
Nitpick comments:
In `@composer.json`:
- Line 87: The composer.json entry for utopia-php/vcs uses a movable branch
("dev-ser-401 as 3.0.99"); replace it with an immutable reference (either an
exact package tag like "3.0.99" or a branch pinned to a commit SHA using
"dev-ser-401#<commit-hash>" or the exact tag) so the dependency cannot drift,
update composer.lock by running composer update for that package, and commit the
updated composer.json and composer.lock; target the "utopia-php/vcs" dependency
string in composer.json to make this change.
In `@src/Appwrite/Vcs/Validator/BuildTrigger.php`:
- Around line 7-10: Add a PHPDoc block to the BuildTrigger class/constructor
documenting the trigger grammar and semantics so callers don't need to inspect
tests: describe the accepted pattern tokens and their meanings (e.g., '!' prefix
for negation, '*' for single-segment wildcard, '**' for multi-segment wildcard),
explain the empty-pattern fallback behavior and pattern precedence/resolution
rules, and note that the constructor takes an array of patterns via the private
readonly array $patterns parameter; place this docblock immediately above the
class declaration or constructor (BuildTrigger::__construct) to satisfy the
"Include comprehensive PHPDoc comments" guideline.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 14a7367c-f85b-42e7-9dfc-0353f49aaf85
⛔ Files ignored due to path filters (1)
composer.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
app/config/collections/projects.phpcomposer.jsonsrc/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/External/Update.phpsrc/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.phpsrc/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.phpsrc/Appwrite/Vcs/Validator/BuildTrigger.phptests/unit/Vcs/Validator/BuildTriggerTest.php
src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php
Outdated
Show resolved
Hide resolved
✨ Benchmark results
⚡ Benchmark Comparison
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/Appwrite/Vcs/Validator/BuildTrigger.php (1)
1-9: Add strict type declaration and PHPDoc comment.The file is missing
declare(strict_types=1);and class-level documentation.Suggested fix
<?php + +declare(strict_types=1); namespace Appwrite\Vcs\Validator; use Utopia\Validator; +/** + * Validates values against glob-based inclusion/exclusion patterns. + * + * Specific patterns (no wildcards) take precedence over wildcard patterns. + * Exclusions (prefixed with !) can veto inclusions at the same specificity level. + */ class BuildTrigger extends Validator {As per coding guidelines: "Use strict type declarations where applicable" and "Include comprehensive PHPDoc comments".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Vcs/Validator/BuildTrigger.php` around lines 1 - 9, Add a strict types declaration and a PHPDoc block to the BuildTrigger class: insert declare(strict_types=1); after the opening <?php and add a class-level PHPDoc above class BuildTrigger describing purpose, constructor parameters (array $patterns) and visibility/immutability, and annotate the constructor property (patterns) with its type in the PHPDoc so tools and readers understand intent; ensure the constructor signature remains public function __construct(private readonly array $patterns) {} and update any doc tags (e.g., `@param` array<string> $patterns) to match expected pattern types.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Appwrite/Vcs/Validator/BuildTrigger.php`:
- Around line 52-57: The wildcard-inclusion loop in BuildTrigger prematurely
returns true and ignores wildcard exclusions; update the logic so that when a
wildcard include (in $include, detected via !$isSpecific($pattern) &&
$this->matchGlob($value, $pattern)) matches, do not immediately return true but
instead check $exclude for any matching wildcard exclusion
($this->matchGlob($value, $exPattern) && !$isSpecific($exPattern)) and only
accept the include if no such wildcard exclusion matches (while preserving
existing behavior that any specific exclusion ($isSpecific) still overrides
inclusions); adjust the comment to reflect that wildcard exclusions will now
refine wildcard inclusions and keep using $isSpecific, $include, $exclude,
matchGlob and the surrounding method in BuildTrigger to locate the change.
---
Nitpick comments:
In `@src/Appwrite/Vcs/Validator/BuildTrigger.php`:
- Around line 1-9: Add a strict types declaration and a PHPDoc block to the
BuildTrigger class: insert declare(strict_types=1); after the opening <?php and
add a class-level PHPDoc above class BuildTrigger describing purpose,
constructor parameters (array $patterns) and visibility/immutability, and
annotate the constructor property (patterns) with its type in the PHPDoc so
tools and readers understand intent; ensure the constructor signature remains
public function __construct(private readonly array $patterns) {} and update any
doc tags (e.g., `@param` array<string> $patterns) to match expected pattern types.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 270e9e08-4947-4403-aa26-00cd18a291f3
⛔ Files ignored due to path filters (1)
composer.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.phpsrc/Appwrite/Vcs/Validator/BuildTrigger.phptests/unit/Vcs/Validator/BuildTriggerTest.php
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/unit/Vcs/Validator/BuildTriggerTest.php
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
tests/unit/Vcs/Validator/BuildTriggerTest.php (1)
181-188: Misleading test comment at line 186.The comment
// excluded even if inclusion didn't matchis misleading. When'develop'is passed toisValid()with patterns['main', '!develop'], it returnsfalsebecause no inclusion pattern matches (falls through to line 61: "No inclusion matched"), not because the exclusion blocked it. The exclusion check only runs for values that could match a wildcard inclusion.The test passes for the correct reason, but the comment suggests a different code path.
📝 Suggested comment fix
public function testInclusionWithNoMatchFails(): void { // Inclusions exist but none match — exclusion is irrelevant $validator = new BuildTrigger(['main', '!develop']); $this->assertTrue($validator->isValid('main')); - $this->assertFalse($validator->isValid('develop')); // excluded even if inclusion didn't match + $this->assertFalse($validator->isValid('develop')); // no inclusion matches — exclusion is not evaluated $this->assertFalse($validator->isValid('staging')); // no inclusion match }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/unit/Vcs/Validator/BuildTriggerTest.php` around lines 181 - 188, Update the misleading inline comment in the test method testInclusionWithNoMatchFails: change the comment on the assertion for $validator->isValid('develop') so it states that 'develop' is false because no inclusion pattern matched (the validator falls through to the "no inclusion matched" branch in BuildTrigger::isValid), not because the exclusion '!develop' blocked it; keep the rest of the assertions unchanged and reference BuildTrigger and isValid to indicate the source of truth.src/Appwrite/Vcs/Validator/BuildTrigger.php (1)
1-12: Consider adding strict type declaration and PHPDoc.The class implementation is solid. For consistency with PHP best practices and the coding guidelines recommending strict type declarations, consider adding the strict types declaration and comprehensive PHPDoc.
📝 Suggested improvements
<?php + +declare(strict_types=1); namespace Appwrite\Vcs\Validator; use Utopia\Validator; +/** + * Validates a string against a list of glob-based include/exclude patterns. + * + * Supports wildcards: * (single segment), ? (single char), ** (multi-segment). + * Exclusions are prefixed with '!'. Specific inclusions take precedence over + * exclusions; exclusions override wildcard inclusions. + */ class BuildTrigger extends Validator { + /** + * `@param` array<string> $patterns List of glob patterns (prefix with ! to exclude) + */ public function __construct(private readonly array $patterns) { }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Vcs/Validator/BuildTrigger.php` around lines 1 - 12, Add a strict types declaration at the top of the file and provide PHPDoc for the BuildTrigger class and its constructor to document the $patterns array shape and purpose (e.g., `@var` array<string> $patterns and a short description), referencing the BuildTrigger class and its __construct method so editors and static analyzers pick up the intent and types.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/External/Update.php`:
- Around line 136-142: The code builds $providerAffectedFiles using
array_column($prFiles, 'filename') and array_column($prFiles,
'previous_filename') which yields nulls for non-renamed files; update the
construction of $providerAffectedFiles by filtering out null/empty values from
the previous_filename array (and optionally deduplicating) before passing it
into createGitDeployments so path matching isn't polluted. Locate $prFiles and
$providerAffectedFiles in Update.php and replace the raw array_column(...) merge
with a step that removes nulls (e.g., array_filter) from the previous_filename
results and then merge/unique the lists prior to calling createGitDeployments.
In `@src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php`:
- Around line 215-219: The array construction for $providerAffectedFiles
includes array_column($prFiles, 'previous_filename') which yields null entries
for non-renamed files; update the code that builds $providerAffectedFiles (the
block using $prFiles and $providerAffectedFiles) to filter out null/empty values
from the previous_filename results before merging (e.g., map/filter the
array_column output or array_filter the merged array) so only valid filenames
are included; ensure you still include both current 'filename' and any non-null
'previous_filename' values.
---
Nitpick comments:
In `@src/Appwrite/Vcs/Validator/BuildTrigger.php`:
- Around line 1-12: Add a strict types declaration at the top of the file and
provide PHPDoc for the BuildTrigger class and its constructor to document the
$patterns array shape and purpose (e.g., `@var` array<string> $patterns and a
short description), referencing the BuildTrigger class and its __construct
method so editors and static analyzers pick up the intent and types.
In `@tests/unit/Vcs/Validator/BuildTriggerTest.php`:
- Around line 181-188: Update the misleading inline comment in the test method
testInclusionWithNoMatchFails: change the comment on the assertion for
$validator->isValid('develop') so it states that 'develop' is false because no
inclusion pattern matched (the validator falls through to the "no inclusion
matched" branch in BuildTrigger::isValid), not because the exclusion '!develop'
blocked it; keep the rest of the assertions unchanged and reference BuildTrigger
and isValid to indicate the source of truth.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5ab391df-c369-43e0-863e-6bb14dd8f20e
📒 Files selected for processing (4)
src/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/External/Update.phpsrc/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.phpsrc/Appwrite/Vcs/Validator/BuildTrigger.phptests/unit/Vcs/Validator/BuildTriggerTest.php
src/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/External/Update.php
Show resolved
Hide resolved
|
Found 1 test failure on Blacksmith runners: Failure
|
Closes SER-401