Skip to content

fix(access-editor): a newly typed group scope saved as null; un-quarantine the suite - #51

Merged
rubenvdlinde merged 1 commit into
developmentfrom
wip/access-scopes-green
Jul 28, 2026
Merged

fix(access-editor): a newly typed group scope saved as null; un-quarantine the suite#51
rubenvdlinde merged 1 commit into
developmentfrom
wip/access-scopes-green

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Product bug. A taggable NcSelect emits both @tag (raw typed string) and @input (new selection). In that @input payload the freshly created entry is the raw string, not a {value,label} option — so onGroupsChange's blind o.value mapped it to undefined, persisted as null, clobbering the correct value @tag had just stored. Scoping an operation to any group not already in the list — the normal case, since the options come from the current user's own groups — wrote "read": [null] instead of ["vets"].

Live-verified after the fix: staged groups: ["vets"]PUT 200 with authorization {"read":["vets"],"update":["@creator"]} → persisted in the DB.

schema-access-scopes un-quarantined — 6/6, green on two consecutive runs, the first starting from the previous run's dirty state.

Three test-side defects beyond #41's blockers:

  • rows were matched with hasText: /^read$/, but a row's text is its heading plus its controls, so nothing matched — match the <h4>;
  • the taggable select renders its "create" option asynchronously, so Enter straight after fill() committed nothing and the group was silently dropped;
  • waitForLoadState('networkidle') does not wait for the save XHR, so API assertions raced it and read the previous contents — a working save looked like a failure. Post-save reads now poll.

Plus a per-run baseline reset: scenario 4 seeds update: ['@creator'], and the leftovers turned scenario 2 red on every rerun.

🤖 Generated with Claude Code

…ntine the suite

A taggable NcSelect emits BOTH `@tag` (the raw typed string) and `@input` (the
new selection). In that `@input` payload the freshly created entry is the raw
STRING, not a `{ value, label }` option — so onGroupsChange's blind `o.value`
mapped it to undefined, which persisted as null, clobbering the correct value
`@tag` had just stored. Scoping an operation to any group that is not already in
the list — the normal case, since the options come from the current user's own
groups — therefore wrote `"read": [null]` instead of `["vets"]`. Accept both
shapes and drop empties. Live-verified: staged `groups: ["vets"]`, PUT 200 with
`authorization {"read":["vets"],"update":["@Creator"]}`, persisted in the DB.

schema-access-scopes is UN-QUARANTINED: 6/6, green on two consecutive runs
including one started from the previous run's dirty state.

Test-side, three things were wrong beyond #41's blockers:
  - per-operation rows were matched with `hasText: /^read$/`, but a row's text is
    its heading PLUS its controls, so nothing ever matched — match the <h4>;
  - the taggable select renders its "create" option asynchronously, so pressing
    Enter straight after fill() committed nothing and the group was dropped;
  - `waitForLoadState('networkidle')` does not wait for the save XHR, so the API
    assertions raced it and read the schema's previous contents — a WORKING save
    looked like a failure. Post-save reads now poll (saveAndAwait).
Plus a baseline reset per run, because scenario 4 seeds `update: ['@Creator']`
and the leftovers made scenario 2 red on every rerun.
@rubenvdlinde
rubenvdlinde merged commit 68cbffc into development Jul 28, 2026
@rubenvdlinde
rubenvdlinde deleted the wip/access-scopes-green branch July 28, 2026 17:45
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.

2 participants