Commit graph

123 commits

Author SHA1 Message Date
loks0n
8201fea9ef Differentiate executor timeouts for builds, sync, and async executions
Adds Executor\Exception\Timeout (with timeoutSeconds) and translates it at
each call site into BUILD_TIMEOUT, FUNCTION_SYNCHRONOUS_TIMEOUT, or
FUNCTION_ASYNCHRONOUS_TIMEOUT instead of always using the misleading sync
function error. Build timeouts now append to streamed buildLogs rather
than replacing them, and the build worker reports its timeout via Span.
2026-05-06 15:54:11 +01:00
Chirag Aggarwal
9d7df34590 fix: clean up php 8.5 runtime deprecations 2026-04-29 14:47:05 +05:30
Chirag Aggarwal
d2230f8fe7 chore: bump PHPStan to level 4 and fix all new errors
Raises `phpstan.neon` level from 3 to 4 and fixes the 549 new errors
that level 4 surfaces across 157 files. Fixes are root-cause — no
`@phpstan-ignore`, no `@var` casts, no baseline entries, no widened
types. A handful of latent bugs were fixed along the way:

- `app/controllers/general.php`: path-traversal guard was negating
  `\substr(...)` before the strict comparison (`!\substr(...) === $base`
  was always `false === $base`). Rewritten as `\substr(...) !== $base`.
- `src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php`
  and `.../TablesDB/Logs/XList.php`: were importing the raw Matomo
  `DeviceDetector` (whose `getDevice()` returns `?int`) but treating the
  result as an array with `deviceName/deviceBrand/deviceModel` keys.
  Swapped to `Appwrite\Detector\Detector`, matching the wrapper already
  used a few lines below for `$os`/`$client`.
- `src/Appwrite/Platform/Modules/Functions/Workers/Builds.php`: a match
  key was checking `$resourceKey === 'functions'` when `$resourceKey`
  is `'functionId'|'siteId'` — always false. Switched to the intended
  `$resource->getCollection() === 'functions'` check.
- `src/Appwrite/OpenSSL/OpenSSL.php`: `encrypt()` return type tightened
  to `string|false` to match `openssl_encrypt`; this lets callers'
  `=== false` error handling remain meaningful.
- `app/controllers/api/messaging.php`: removed a dead
  `array_key_exists('from', [])` branch in the Msg91 provider (empty
  array literal; branch was unreachable).

Large cleanup categories across the 549 fixes:
- Removed redundant `?? default` on array offsets and expressions that
  PHPStan now knows are non-nullable.
- Removed unreachable statements (mostly `return;` after `throw` or
  `markTestSkipped()`).
- Removed redundant `is_array`/`is_string`/`is_bool`/`instanceof` checks
  on already-narrowed types.
- Added `default =>` arms (or throwing arms) to non-exhaustive matches
  on `string`/`mixed` input.
- Removed dead `$document === false` branches where method return types
  were tightened to non-nullable `Document`.
- Removed unused properties (`$version` on Etsy/Zoom OAuth2, `$paths` on
  Installer State, `$source` on MigrationsWorker, `$account2` on two
  GraphQL auth tests), unused traits (`ApiVectorsDB`, `DatabaseFixture`),
  and an unused `cleanupStaleExecutions` task method.
- Replaced `assertTrue(true)` and redundant `assertIsArray`/`assertIsString`/
  `assertNotNull` assertions with `addToAssertionCount(1)` or
  `assertNotEmpty` where the runtime type was already known.
2026-04-19 17:31:20 +05:30
Jake Barnby
006867617b Fix parallel test assertions and graceful runtime cleanup
- Fix testListProjectKey: use dynamic key counts instead of hardcoded 5
  (parallel workers don't share state from testCreateProjectKey)
- Fix testGetProjectKey: expect 'Key Test' from setupProjectWithKey(),
  not 'Key Custom' from a previously-dependent test
- Handle 404 in Executor::deleteRuntime() (runtime already gone)
- Make cancel deployment cleanup best-effort (status already updated)
- Apply same fix to Sites cancel endpoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 18:23:55 +13:00
Chirag Aggarwal
a80209ddbd fix cookie parsing 2026-02-10 11:45:10 +05:30
loks0n
50c6a35079 feat: multiple app domains 2025-12-11 09:01:31 +00:00
Matej Bačo
b75952071e Support array headers for set-cookie 2025-09-03 17:32:15 +02:00
Matej Bačo
ee225834d9 Fix default param syntax 2025-06-26 21:39:00 +02:00
Matej Bačo
df902d2624 Fix account tests using old token 2025-06-26 20:47:59 +02:00
Chirag Aggarwal
276a294391 chore: update createExecution 2025-06-26 13:37:43 +05:30
Chirag Aggarwal
8bf3a8bf5d chore: add runtimeEntrypoint param 2025-06-26 13:29:06 +05:30
loks0n
bc41838c66 chore: remove endpoint selector 2025-06-12 14:22:17 +01:00
loks0n
3d9e22a6df chore: remove endpoint selector for edge 2025-06-12 14:18:05 +01:00
loks0n
33dc7ea97c feat: bypass gateway 2025-05-18 23:23:06 +01:00
Matej Bačo
5a0b22f638 Fix after merge 2025-04-08 11:09:12 +02:00
Matej Bačo
8e32ef1851 Merge branch '1.7.x' into feat-sites 2025-04-08 10:41:39 +02:00
Fabian Gruber
0ae70f8321 feat: inject executor instead of creating a new instance 2025-04-07 09:53:38 +02:00
Fabian Gruber
954ed45a36 feat: update appwrite to use generic S3 adapter 2025-04-07 09:53:38 +02:00
Matej Bačo
536319b440 PR review changes 2025-03-12 11:32:43 +01:00
Matej Bačo
994e2faa42 OPR v5 + Flutter starter 2025-03-11 18:19:25 +01:00
Matej Bačo
232f99c6c9 Finalize PR, review changes, fix tests 2025-03-08 16:50:39 +01:00
Khushboo Verma
f830918c7c Add logic to detect rendering strategy and fallback file 2025-02-25 16:19:30 +05:30
Matej Bačo
3aafceab40 Improve CI/CD flaky tests 2025-02-03 11:38:36 +01:00
Matej Bačo
47f4e67a52 Fixing bug post-merge 2025-02-03 11:03:58 +01:00
Khushboo Verma
4c1881324e Use compute vars for functions and sites 2024-10-27 17:22:45 +01:00
Khushboo Verma
7f17efcdd8 Resolve merge conflicts 2024-10-27 15:43:52 +01:00
Matej Bačo
ea6765c68a Support static sites 2024-10-26 18:43:30 +02:00
Khushboo Verma
03d4d4c8fa Add build env vars for sites 2024-10-26 12:29:42 +02:00
Jake Barnby
c58fa78962
Remove tenant in filter 2024-09-05 14:25:11 +12:00
Bradley Schofield
5285ef9939 Merge remote-tracking branch 'origin/1.6.x' into feat-runtime-controls-1.5.x 2024-08-14 19:36:15 +09:00
Bradley Schofield
e51f912ab1 Address Jake's comments and add 0.5 cpu spec 2024-08-06 18:54:46 +09:00
Matej Bačo
bce06a6178 Supply autorestart to executor 2024-08-03 09:14:19 +00:00
Khushboo Verma
d43039387e Merge branch '1.6.x' into fix-disabled-function-logging 2024-07-29 11:19:36 +05:30
Bradley Schofield
4f558d35be Improvement v3 -> v4 transition 2024-07-22 19:42:29 +09:00
Khushboo Verma
0970d784ff Handle false appended to string 2024-07-16 16:10:17 +05:30
Bradley Schofield
824a70f936 Move Runtime Controls PR to 1.5.x 2024-07-12 18:25:57 +09:00
Khushboo Verma
4ef42c9cf8 Fix execution duration and add test 2024-07-03 18:05:08 +05:30
Matej Bačo
5fb41fd216 Fix executions 2024-07-03 08:00:17 +00:00
Khushboo Verma
aab4665701 Resolve merge conflict 2024-07-02 15:02:58 +05:30
Khushboo Verma
ead0b93900 Resolve merge conflict 2024-07-02 14:59:15 +05:30
Matej Bačo
f87e2bc879 Binary support & tests for Router 2024-07-01 10:35:06 +02:00
Matej Bačo
7bdcd5c436 Multipoart support 2024-07-01 06:57:18 +00:00
Khushboo Verma
0edbec4f44 OPR v4 support 2024-06-25 15:03:07 +05:30
loks0n
863a2ce0a9 chore: matej review 2024-05-20 11:44:08 +01:00
loks0n
4d572d4a05 chore: errors.php 2024-05-20 11:05:53 +01:00
loks0n
3d119ad1a6 fix: improve cold start error 2024-05-17 18:16:10 +01:00
Eldad Fux
8ed1da4ea8 Updated getEnv to use system lib 2024-04-01 13:02:47 +02:00
Ben Humphries
fbd277f6aa
executor: pass build timeout to runtimes (#7350)
open-runtimes executor (v1/runtimes) supports passing a timeout parameter that defaults to 600 seconds.

->param('timeout', 600, new Integer(), 'Commands execution time in seconds.', true)

https://github.com/open-runtimes/executor/blob/main/app/http.php#L383

This change passes the _APP_FUNCTIONS_BUILD_TIMEOUT env var.
2024-01-04 11:46:08 +01:00
Matej Bačo
b6ce679b93 Merge branch '1.4.x' into cl-1.4.x 2023-10-04 10:46:38 +02:00
Matej Bačo
891960a977 Fix realtime logs container name 2023-10-04 10:16:02 +02:00