You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Medium Risk
Larger default rows increase per-request memory and stored JSONB size; mis-set env overrides could weaken or tighten limits in production, but scope is limited to table row validation.
Overview
Raises the default per-row serialized size cap for user tables from 100KB to 400KB and makes the limit overridable via server env TABLE_MAX_ROW_SIZE_BYTES (documented default 409600), aligned with other table plan-limit env knobs.
Adds getMaxRowSizeBytes() (env read at call time through envNumber) and wires validateRowSize to use the effective limit so validation errors report the active cap instead of a hardcoded constant.
Reviewed by Cursor Bugbot for commit a34c919. Bugbot is set up for automated code reviews on this repo. Configure here.
Raises the per-row size limit from 100 KB to 400 KB and makes it runtime-configurable via TABLE_MAX_ROW_SIZE_BYTES, following the same envNumber pattern used for plan-tier row/table count limits. The error message now reports the effective limit rather than the old hard-coded constant.
constants.ts promotes MAX_ROW_SIZE_BYTES to 400 KB and adds getMaxRowSizeBytes(), which reads the env var at call time with a min:1, integer:true guard.
validation.ts replaces the direct constant reference with getMaxRowSizeBytes() and propagates the resolved value into the error string.
env.ts registers the new optional numeric env var in the schema alongside the existing table plan-limit overrides.
Confidence Score: 4/5
Safe to merge; the logic change is confined to a single validation function and follows the well-established env-override pattern already in use.
The production code path is clean — getMaxRowSizeBytes() correctly defaults to the new 400 KB constant and safely gates on min:1, integer:true. The one concern is in the test: it sizes its oversized payload against the static constant rather than the runtime-resolved value, so the assertion could silently pass if TABLE_MAX_ROW_SIZE_BYTES were set to a larger value in the test environment.
The test at apps/sim/lib/table/tests/validation.test.ts line 176 should drive off getMaxRowSizeBytes() rather than TABLE_LIMITS.MAX_ROW_SIZE_BYTES.
Important Files Changed
Filename
Overview
apps/sim/lib/core/config/env.ts
Adds TABLE_MAX_ROW_SIZE_BYTES as an optional numeric env var following the existing pattern for table plan limit overrides.
apps/sim/lib/table/constants.ts
Raises MAX_ROW_SIZE_BYTES default from 100 KB to 400 KB and introduces getMaxRowSizeBytes() that reads the env override via envNumber with a min:1, integer:true guard.
apps/sim/lib/table/validation.ts
Swaps the hard-coded constant for getMaxRowSizeBytes() and threads the effective limit into the error message; no logic change beyond that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TABLE_MAX_ROW_SIZE_BYTESenv var (read at call time invalidateRowSize, same pattern as the plan-limit overrides)Type of Change
Testing
Table validation tests pass (54/54).
bun run lintandbun run check:api-validation:strictpass.Checklist