Skip to content

fix: sensitive toggle / metadata-only PUT fails on DataModel + ModelAttribute#90

Merged
kennethphough merged 1 commit into
masterfrom
fix/sensitive-toggle-partial-put
May 28, 2026
Merged

fix: sensitive toggle / metadata-only PUT fails on DataModel + ModelAttribute#90
kennethphough merged 1 commit into
masterfrom
fix/sensitive-toggle-partial-put

Conversation

@kennethphough

Copy link
Copy Markdown
Member

Summary

Toggling sensitive=1 on a model (Settings tab) or field never persisted — PUT returned 200 with an empty body, toggle reverted with "Save failed." Two update hooks assumed every update carries the full record:

  • DataModelController::hook_preprocess(update): $o->name != $r['name'] ran the table-rename path; a partial {sensitive:1} PUT omits namerenameTable($o->name, null) throws before $obj->save(). Gated on isset($r['name']) && ....
  • ModelAttributeController::hook_preprocess(update): unconditionally changeColumn(...) on every update; metadata-only PUT → rename column to empty → throws. Gated on isset($r['name']).

The empty-200 was the swallowed hook exception. ControllerController has no schema-altering update hook, so Controller toggles were never affected.

Why it matters

Blocks enabling model/field-level sensitive-data redaction (the policy reads these flags at runtime) — a hard prerequisite for the ORB log purge.

Test plan

  • Deploy to ORB, toggle model + field sensitive → confirm DB persists sensitive=1 and PUT returns a non-empty body
  • Field-edit form (full PUT incl. name) path unchanged — schema edits still ALTER

No schema change; composer upgrade sufficient. Target v4.5.1.

🤖 Generated with Claude Code

…Model + ModelAttribute

Toggling sensitive=1 on a model or field never persisted: PUT returned
200 with an empty body and the toggle reverted with "Save failed."

Two update hooks assumed every update carries the full record:

- DataModelController::hook_preprocess(update): `$o->name != $r['name']`
  ran the table-rename path. A partial PUT of just {sensitive:1} omits
  name, so the compare was true vs null -> renameTable($o->name, null)
  throws "New table name cannot be empty" BEFORE $obj->save() persists
  sensitive. Now gated on isset($r['name']) && $o->name != $r['name'].

- ModelAttributeController::hook_preprocess(update): unconditionally ran
  changeColumn($tbl->name, $o->name, $r['name'], $attrs) on every update.
  A metadata-only PUT (no name) tried to rename the column to an empty
  name with an incomplete definition and threw. CHANGE COLUMN now gated
  on isset($r['name']); the field-edit form (always sends name) is
  unaffected.

The empty-200 was the swallowed hook exception. ControllerController has
no schema-altering update hook, so Controller sensitive toggles were
never affected.

Blocks enabling model/field-level sensitive-data redaction (policy reads
these flags at runtime). No schema change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kennethphough
kennethphough merged commit be90794 into master May 28, 2026
4 checks passed
@kennethphough
kennethphough deleted the fix/sensitive-toggle-partial-put branch May 28, 2026 07:54
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