fix: change an app's access mode under the deploy row lock

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Guilhem Lemouel
2026-10-23 00:29:56 -07:00
co-authored by Claude Opus 5.5
parent 5ef19a88a9
commit dc244fcdb6
8 changed files with 393 additions and 59 deletions
+5 -2
View File
@@ -103,12 +103,15 @@ ignored into `inlineScript`.
`update_app` takes a builder too, but settings only: the deploy panel saves a deployed full-code
app's access and frontend scopes through it with no value. It reaches the same check, so a builder
can no more switch the sandbox off there than on deploy.
can no more switch the sandbox off there than on deploy. A change of `execution_mode` alone runs
that check on the deployed policy under the row lock, and is refused when the app runs as someone
else unless the builder is in `wm_deployers`.
A builder's **draft** goes through the same `check_operator_composed_app` as its deploy, with
`BuilderAppWrite::Draft`: an admin may open it in the editor or deploy it as it stands, so any
rule added for deploys must hold for drafts too. Where the two differ, `write` decides: a deploy
fills in an omitted sandbox or mode, since it stores the policy it checked, while a draft skips
fills in an omitted sandbox, since it stores the policy it checked, and an omitted mode inherits the
deployed one, except that `Viewer` becomes `Publisher`, while a draft skips
`triggerables_v2` and must not name another user's run identity. Every frontend writer of a
builder draft must conform the policy first with `conformBuilderAppPolicy`, since a policy loaded
from someone else's app breaks these rules: the raw-app editor component does, which covers both