Commit fc64545
committed
RBAC tests: extract projectCreated to break platform.v3.server cycle (TRI-8731)
After rebasing rbac-packages on origin/main, the e2e.full harness
regressed with the same `TypeError: Cannot convert undefined or null
to object at allMachines (build/index.js:71862)` that TRI-8731
worked around by switching the testcontainer to NODE_ENV=production.
Recent main commits changed the bundled init order enough that the
production-mode dodge no longer applies — the cycle now triggers in
both NODE_ENV=test and NODE_ENV=production.
Root cause is structural:
app/services/platform.v3.server → imports createEnvironment
from app/models/organization.server
app/models/organization.server → imports getDefaultEnvironmentConcurrencyLimit
from app/services/platform.v3.server
Inside an esbuild __esm bundle, this manifests as:
init_platform_v3_server() runs init_organization_server() in the
middle of its body. organization.server's body re-enters
init_platform_v3_server(), which short-circuits because the outer
call already cleared its `fn` — so `({ defaultMachine, machines } =
singleton("machinePresets", ...))` never completes its destructure
and both vars stay undefined. Object.entries(undefined) crashes
when `allMachines()` runs inside `createRunEngine()`.
Fix: move the only function in platform.v3.server.ts that imports
from organization.server (`projectCreated`, the sole caller of
`createEnvironment`) into its own file. platform.v3.server.ts no
longer imports from organization.server, so the cycle is gone. Two
trivial supporting changes:
- export `isCloud` from platform.v3.server (projectCreated needs it)
- drop the now-unused `Organization` and `Project` type imports
No dynamic imports, no application-code workarounds — just a
structural file split.
Verified:
- 162/162 e2e.full pass (auth-api, auth-cross-cutting, auth-dashboard)
- 31/31 api-auth.e2e pass
- 31/31 @trigger.dev/rbac unit tests pass
- 7/7 cloud enterprise e2e.full pass against the same webapp build1 parent 38ab6b0 commit fc64545
4 files changed
Lines changed: 114 additions & 42 deletions
File tree
- apps/webapp/app
- models
- services
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
587 | 586 | | |
588 | 587 | | |
589 | 588 | | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | 589 | | |
618 | 590 | | |
619 | 591 | | |
| |||
778 | 750 | | |
779 | 751 | | |
780 | 752 | | |
781 | | - | |
| 753 | + | |
782 | 754 | | |
783 | 755 | | |
784 | 756 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments