Static feature modules, a root options module and token overrides in createApp #425

Closed
opened 2026-10-15 14:45:27 +00:00 by root · 11 comments
root commented 2026-10-15 14:45:27 +00:00 (Migrated from gitlab.core-project.space)

Parent

#421

What to build

Feature modules declare their dependencies, configuration enters the app in one place, and tests replace providers by token instead of through production options.

  • The Auth, Games, Room, Mail and Database modules become static and declare their imports: Room imports Games, Games imports Auth, Auth imports Mail.
  • A global options module, built by the root module from the app options, provides every feature's option tokens once. Each token stays defined in its feature.
  • The Database module reads its source from a token.
  • The devtools module is static. It is added to the root's imports only on stacks that enable devtools (ADR 0039).
  • The app options keep only production configuration: allowed origins, database source, session secret, public URL, mail, rate limits, devtools flag, Mailpit URL, front dist directory.
  • createApp takes an optional second argument, a list of { token, value } pairs applied as provider overrides before the app boots.
  • The test fixture's connect() passes overrides there. Tests that passed per-feature options (Rooms, Auth, Games, Guests) override the option tokens instead.

Room's factories that turn Games into its isClaimed and onDecided callbacks stay as they are. No configured module object is passed from one module to another.

Seam: S1, the wire through the real app.

Acceptance criteria

  • Only the root module is dynamic. Every feature module lists what it imports, and no forRoot receives another module.
  • One Auth service and one Games service exist per app.
  • The app options type holds no test-only field (no sweep scheduler, hash cost, clock or random source).
  • createApp applies token overrides before boot. connect() uses them for the sweep scheduler, the hash cost and every former per-feature option.
  • Devtools procedures exist only when devtools are enabled, as today.
  • Every API test passes, changed only in how it builds the app.
## Parent #421 ## What to build Feature modules declare their dependencies, configuration enters the app in one place, and tests replace providers by token instead of through production options. - The Auth, Games, Room, Mail and Database modules become static and declare their imports: Room imports Games, Games imports Auth, Auth imports Mail. - A global options module, built by the root module from the app options, provides every feature's option tokens once. Each token stays defined in its feature. - The Database module reads its source from a token. - The devtools module is static. It is added to the root's imports only on stacks that enable devtools (ADR 0039). - The app options keep only production configuration: allowed origins, database source, session secret, public URL, mail, rate limits, devtools flag, Mailpit URL, front dist directory. - `createApp` takes an optional second argument, a list of `{ token, value }` pairs applied as provider overrides before the app boots. - The test fixture's `connect()` passes overrides there. Tests that passed per-feature options (Rooms, Auth, Games, Guests) override the option tokens instead. Room's factories that turn Games into its `isClaimed` and `onDecided` callbacks stay as they are. No configured module object is passed from one module to another. Seam: S1, the wire through the real app. ## Acceptance criteria - [ ] Only the root module is dynamic. Every feature module lists what it imports, and no `forRoot` receives another module. - [ ] One Auth service and one Games service exist per app. - [ ] The app options type holds no test-only field (no sweep scheduler, hash cost, clock or random source). - [ ] `createApp` applies token overrides before boot. `connect()` uses them for the sweep scheduler, the hash cost and every former per-feature option. - [ ] Devtools procedures exist only when devtools are enabled, as today. - [ ] Every API test passes, changed only in how it builds the app.
root commented 2026-10-15 14:45:39 +00:00 (Migrated from gitlab.core-project.space)

mentioned in issue #426

mentioned in issue #426
root commented 2026-10-15 14:45:40 +00:00 (Migrated from gitlab.core-project.space)

mentioned in issue #427

mentioned in issue #427
root commented 2026-10-15 14:46:04 +00:00 (Migrated from gitlab.core-project.space)

marked this issue as related to #421

marked this issue as related to #421
root commented 2026-10-15 14:46:23 +00:00 (Migrated from gitlab.core-project.space)

marked this issue as related to #424

marked this issue as related to #424
root commented 2026-10-15 14:46:24 +00:00 (Migrated from gitlab.core-project.space)

marked this issue as related to #426

marked this issue as related to #426
root commented 2026-10-15 14:46:26 +00:00 (Migrated from gitlab.core-project.space)

marked this issue as related to #427

marked this issue as related to #427
root commented 2026-10-15 16:04:31 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit a8af303289

mentioned in commit a8af30328976d086e2b9204076768aa42a7a2463
root commented 2026-10-15 16:04:47 +00:00 (Migrated from gitlab.core-project.space)

mentioned in merge request !536

mentioned in merge request !536
root commented 2026-10-15 16:07:36 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit 6a3a6992ee

mentioned in commit 6a3a6992eee1f663923be0210ec65352045c1911
root (Migrated from gitlab.core-project.space) closed this issue 2026-10-15 19:01:49 +00:00
root commented 2026-10-15 21:18:56 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit 215cdba4c9

mentioned in commit 215cdba4c9194e91817007777bbb204e7197fb99
root commented 2026-10-15 21:19:13 +00:00 (Migrated from gitlab.core-project.space)

mentioned in merge request !537

mentioned in merge request !537
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
amaurycoudr/chess-project#425
No description provided.