Skip to content

test: yjs suites and bench scenarios fit raak's attachment policy, placement and task edits - #168

Merged
flipvh merged 1 commit into
mainfrom
test/yjs-policy-and-bench-payloads
Oct 10, 2026
Merged

flipvh merged 1 commit into
mainfrom
test/yjs-policy-and-bench-payloads

Conversation

@flipvh

@flipvh flipvh commented Oct 10, 2026

Copy link
Copy Markdown
Member

After the 0.18.0 sync, pnpm test had two failing yjs integration tests and pnpm bench --all failed four of its eight scenarios. None of it was a product regression: the tests and the bench payloads did not fit raak's policy and API. This PR makes them fit. No product code changes.

Change

  • Yjs integration tests. permissions.test.ts and revocation.test.ts expect that an organization member may update their own attachment; raak's policy gives a member update: 0. The backend suites already declare that assumption with assumeMemberAttachmentPolicy. The helper moves to shared/src/testing/member-policy.ts, backend/tests/security/helpers.ts re-exports it so the seven backend suites that use it are untouched, and both yjs suites call it with { read: 1, update: 'own', delete: 'own' }.
  • attachment-churn (new in 0.18.0, never passed here). Its create payload carried no projectId, which raak requires, so every create answered 400 and every delete 403. A batch now lands in a seeded bench project, with a fork marker as in attachment.bench.ts.
  • task-edit and cdc-throughput (raak-owned, both use processors/task-edits.ts). The assign edit sent a field timestamp for assignedTo, a set delta, which the API refuses: 25% of the requests answered 400. It could also name the same user twice in one delta, which the API refuses as well: rare, but enough to fail a --short run. It now sends no timestamp and distinct users.

Verification

  • pnpm check and pnpm unused pass.
  • pnpm test: 4909 passed, 0 failed (before: 2 failed). A dev stack was up, so the bench smoke test ran all eight scenarios short.
  • pnpm bench --all, then the two scenarios a dev-stack restart interrupted, each on its own:
Scenario Before After Req/s p95 (ms)
attachment-churn 2500 of 2500 rejected passed 107 32.8
attachment-edit failed once on old counters, see below passed 789 1064.4
cdc-throughput 25% rejected passed 631 77.5
get-me passed passed 1330 54.1
page-load passed passed 876 18
sse-fanout passed passed 16 24.8
task-edit 25% rejected passed 469 26.8
yjs-typing passed passed

The latencies come from a laptop that also ran the stack and other work: read them as rough.

Notes for the reviewer

  • Not fixed here, nothing to fix: attachment-edit failed its first run on the CDC worker's books check. The first verify after 0.18.0 found 202 counters the old worker had left (200 are the new e:c:h:workspace and e:c:h:project keys, 2 are label usage counts from a soft-deleted task) and rebuilt them; every later verify found 0 differences. Production will see the same once, at the first nightly verify (03:00 UTC) after the 0.18.0 deploy: one wrong_books incident, and connected clients refetch.
  • cdc-throughput still does not check the worker's record. Its clean run had 25,000 accepted edits and 22,935 recorded activities: an edit that changes nothing writes no row, so counting accepted responses would fail that check.
  • Both the helper's place and a home for bench attachments belong upstream; they are noted as cella feedback.

🤖 Generated with Claude Code

…acement and task edits

Two yjs integration tests assumed that an organization member may update their own
attachment, which raak's policy denies. `assumeMemberAttachmentPolicy` moves to
`shared/testing/member-policy` (the backend helpers re-export it) and both suites declare
the policy they assume, as the backend suites do.

Three bench scenarios sent payloads raak's API refuses:
- attachment-churn created attachments without a home; a batch now lands in a seeded
  bench project.
- task-edit and cdc-throughput sent a field timestamp for the `assignedTo` set delta and
  could name the same user twice in one delta.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@flipvh
flipvh merged commit 12a0778 into main Oct 10, 2026
11 checks passed
@flipvh
flipvh deleted the test/yjs-policy-and-bench-payloads branch October 10, 2026 13:47
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