Skip to content

feat(BA-7345): limit the size of an app config fragment - #13739

Draft
jopemachine wants to merge 3 commits into
mainfrom
feat/BA-7345-limit-app-config-fragment-size
Draft

feat(BA-7345): limit the size of an app config fragment#13739
jopemachine wants to merge 3 commits into
mainfrom
feat/BA-7345-limit-app-config-fragment-size

Conversation

@jopemachine

Copy link
Copy Markdown
Member

Resolves #13730 (BA-7345)

Summary

  • Cap one app config fragment at 64 KiB of compact JSON (MAX_APP_CONFIG_FRAGMENT_BYTES), checked in AppConfigFragmentService.bulk_upsert before the batch reaches the repository, so the GraphQL and the REST v2 write paths are both covered. Nothing bounded the document until now — the DTO accepted any dict and the JSONB column stopped only at Postgres' field ceiling.
  • Reject an oversize document with a new AppConfigFragmentTooLarge error under a new ErrorDomain.APP_CONFIG_FRAGMENT. One oversize item rejects the whole batch, as the allow-list write gate already does.
  • State the limit in the upsert input's field description, on the v2 DTO and on the GraphQL input.

The value is arbitrary for this PR. BA-7345 keeps the open questions: the number itself, whether it belongs in the manager config or per config name on the definition / allow-list entry, whether the merged result of all fragments for one config name needs its own cap, and whether the per-request item count should be bounded too.

Test plan

  • Unit tests for the service: a document exactly at the limit is written, and a batch holding one oversize item is rejected without reaching the repository
  • CI green — the suite was not exercised locally

🤖 Generated with Claude Code

jopemachine and others added 2 commits August 12, 2026 19:14
Nothing bounded a fragment's config document: the DTO accepted any dict, the
service checked nothing, and the JSONB column stopped only at Postgres' field
ceiling. Since an allow-listed user may write their own user-scope fragment,
and every app config read merges the fragments it finds, an oversize document
was both reachable without admin rights and paid for on every read.

Cap one fragment at 64 KiB of compact JSON and reject an oversize document in
the service, before the batch reaches the repository. The value is provisional
- BA-7345 still holds the open questions of the number itself, of whether it
belongs in the manager config, and of a cap on the merged result.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added size:L 100~500 LoC comp:manager Related to Manager component comp:common Related to Common component labels Aug 12, 2026
Co-authored-by: octodog <mu001@lablup.com>
)

#: Upper bound on one fragment's config document, measured on its compact JSON encoding.
MAX_APP_CONFIG_FRAGMENT_BYTES: Final[int] = 64 * 1024

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.

Temp value FYI

@github-actions github-actions Bot added the area:docs Documentations label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentations comp:common Related to Common component comp:manager Related to Manager component size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bound the size of an app config fragment

1 participant