Skip to content

fix(databases): name the bound an increment or decrement reached, from the column or the request - #14593

Merged
abnegate merged 3 commits into
mainfrom
qfix-database-835
Oct 16, 2026
Merged

abnegate merged 3 commits into
mainfrom
qfix-database-835

Conversation

@abnegate

@abnegate abnegate commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

What

This bumps utopia-php/database to 8.3.5. 8.3.5 includes #1036 (exact double binds and reads) and #1037, which holds an increment or decrement to the column's own min/max and throws Exception\Limit.

With 8.3.5, an increment that only the column bound stops answers 400 column_limit_exceeded with:

tablesDB "b" has reached the maximum value of 

There is no number, because the message was built from the request's empty max/min.

Fix

Increment.php/Decrement.php now name the bound actually reached. Two new helpers in the documents Action, getReachedMaximum()/getReachedMinimum(), pick between the two candidates:

  • the request's bound, floored or ceiled on an integer column the same way the library does;
  • the column's formatOptions bound.

They return the tighter of the two, or whichever one exists. The message also names the field (Column "b" or Attribute "b") instead of the SDK namespace. #14582 changes the same line for the wording; whichever lands second takes this version.

Tests

Test main code + 8.3.5 this PR
E2E testIncrementAndDecrementPastTheColumnRangeNameTheColumnBound: column b min 0, max 10, value 5; +6 with no max; −8 with no min; +4 with max 8; +6 with max 20; bigint column +4 with max 8.5 ❌ tablesDB "b" has reached the maximum value of ✅ Column "b" has reached the maximum value of 10 / minimum value of 0 / 8 / 10; bigint 8; row unchanged

The fix is in the HTTP action, so the E2E is the fixing-layer test. It runs for TablesDB and Legacy; DocumentsDB skips it because it has no columns.

8.3.5 changes float binding, so I also ran the full database E2E suites locally on 8.3.5 (Postgres for TablesDB, Legacy and VectorsDB; Mongo for DocumentsDB):

Suite Result
TablesDBCustomServerTest ✅ 261 tests, 5950 assertions
TablesDBCustomClientTest ✅ 261 tests, 6259 assertions
DatabasesNumericTypesTest ✅ 8 tests
LegacyCustomServerTest ✅ 264 tests, 5951 assertions
DocumentsDBCustomServerTest ✅ 261 tests (171 skipped for no attributes)
TablesDBTransactionsCustomServerTest ✅ except testCommitEventPayloadCarriesSurfaceIds, which fails the same way on main in my local stack (webhook delivery)
VectorsDB/DatabasesCustomServerTest ✅ except the two embedding tests; my local stack has no embedding service (_APP_EMBEDDING=disabled)

CI covers the MySQL and MariaDB matrix.

🤖 Generated with Claude Code

…m the column or the request

utopia-php/database 8.3.5 holds an increment or decrement to the column's own
min and max and throws Limit when only that bound applies. The message was
built from the request's max or min, so with none given it read "has reached
the maximum value of " with no number. It now names the bound actually
reached: the request's, floored or ceiled on an integer column as the
library does, or the column's when that is tighter or the only one, and the
field ("Column" or "Attribute") instead of the SDK namespace.

Bumps utopia-php/database to 8.3.5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tenki-reviewer

tenki-reviewer Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


This PR replaces fixed increment/decrement range messages with ones reporting the column's actual min/max bound, adding getReachedMaximum()/getReachedMinimum()/getColumnBound() helpers on the shared Documents action base and wiring them into the LimitException handlers for both Increment and Decrement, with an e2e test asserting the bound text.

Files Change
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php Adds shared helpers resolving the effective integer/float bound (request bound vs column bound, floor/ceil coercion) and building the limit-error message.
.../Attribute/Increment.php, .../Attribute/Decrement.php Use the new helpers when catching LimitException to emit messages naming the actual reached bound.
tests/e2e/Services/Databases/DatabasesBase.php Adds an e2e case asserting the increment/decrement past-column-range error names the column bound.
composer.json Unrelated metadata change shipped alongside.

No findings survived verification at the required confidence threshold.

Reviewed commit: 38a04dc

@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

19 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (12)
  • 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.

@hansi-codes

hansi-codes Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🟢 Tier S · Ready to merge

The new BigInteger type recognition uses the existing type-normalization helper, and the added case exercises the stored-type and fractional-bound path.

This PR updates the utopia-php/database dependency to 8.3.5 and changes increment/decrement limit errors to report the field and the effective request or column bound. It adds E2E coverage for column-bound failures and integer-bound rounding, including BigInteger attributes.

Latest changes: The newest commits normalize stored BigInteger types when detecting integer columns and add an E2E case for rounding a fractional request bound on BigInteger.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 6
File Change
composer.json Raises the required utopia-php/database version to 8.3.5.
composer.lock Locks utopia-php/database and its dependency resolution to 8.3.5.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php Adds helpers to select the effective request or column bound for increment/decrement errors; the latest change recognizes stored BigInteger types as integer columns.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php Reports the affected field and effective maximum when an increment reaches a limit.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php Reports the affected field and effective minimum when a decrement reaches a limit.
tests/e2e/Services/Databases/DatabasesBase.php Covers column and request bounds in increment/decrement errors, including fractional rounding on a BigInteger attribute.

Merged main (ffd1249); no changes to this PR's code since 393da80 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@hansi-codes hansi-codes Bot left a comment

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.

🔵 Tier A · See the inline comments. Summary

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → qfix-database-835 (after).

Metric Before After Change
🚀 Requests/sec 203.54 209.47 ⚪ +2.9%
⏱️ Latency P50 84.81 ms 83.03 ms ⚪ -2.1%
⏱️ Latency P95 195.73 ms 190.44 ms ⚪ -2.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 83.03 190.44 13,338 209.47 -5.28
Account 147.15 277.46 702 11.66 -16.6
TablesDB 79.61 149.49 7,254 117.21 -9.25
Storage 79.22 184.04 3,510 58.19 +2.59
Functions 109.4 222.94 1,872 31.76 -32.63

Top API waits (after)

API request Max wait (ms)
account.prefs.update 378.67
storage.buckets.create 377.35
account.name.update 372.73
account.get 364.44
functions.variables.update 350.47

…olumn

A big integer column is stored with the type bigint, which the integer check
compared against biginteger, so a fractional request bound on one was
reported as given (8.5) instead of the whole bound the database applies (8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@hansi-codes hansi-codes Bot left a comment

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.

🟢 Tier S · Looks good to merge. Summary

# Conflicts:
#	src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php
#	src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php
#	src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php
@abnegate
abnegate merged commit 9d79caa into main Oct 16, 2026
224 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant