App config fragment write for a missing owner answers 500 instead of 404
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 368
Description
## Symptom
Writing an app config fragment at a domain or user scope whose id names no existing domain or user (`scoped_upsert_app_config_fragments`) answers `VirtualEntityNotFound`, an HTTP 500, instead of a 404. The row is inserted first — `app_config_fragments.scope_id` carries no foreign key because the owner is polymorphic — and the RBAC graph write that follows fails to find the owner's node, rolling the transaction back with a server error.
## Expected
The same refusal the scoped reads give: `DomainNotFound` / `UserNotFound` (404) through `AppConfigFragmentOperationScope.existence_checks`, checked before anything is written.
## Fix
- An atomic entity upsert action may name the `OperationScope`s it writes in; the ops write validates their existence checks before the rows, in the same transaction. Empty by default, so every other upsert is unchanged.
- `BulkUpsertAppConfigFragmentsAction` names the fragment scope of its owner.
- Unit test on the ops repository; the scenario row in BA-7834 switches to the 404 once this lands.
## Found by
BA-7804 scenario research — the row "슈퍼관리자가 없는 소유자를 지목해 쓴다" pinned the 500.
## Story points
0.5
JIRA Issue: BA-7861
Contributor guide
Research direction
Start with AppConfigFragmentOperationScope.existence_checks and BulkUpsertAppConfigFragmentsAction in the ops repository. Add the scope validation before writes while preserving the default behavior for other upserts, then run the relevant unit tests and confirm a missing domain or user returns 404 without leaving a row.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, authorization, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100