Skip to content

fix(cli): register create-domain controllers in app.ts for spa-be-split - #3479

Open
kang-heewon wants to merge 1 commit into
trunkfrom
issue-3095-create-domain-registration
Open

kang-heewon wants to merge 1 commit into
trunkfrom
issue-3095-create-domain-registration

Conversation

@kang-heewon

Copy link
Copy Markdown
Member

Summary

Closes #3095.

croco create domain picked the host entrypoint index.ts whenever it existed, so on spa-be-split scaffolds (production-app/admin-console) controller registration failed with unsupported-pattern: index.ts boots the host (createCrocoApp() → createNodeHost(...)) while the controller list lives in app.ts (const controllers = [...]).

Change

  • New shared resolver packages/cli/src/libs/controllerRegistrationTarget.ts, moved from generateUsageDashboard.ts:
    • applicationModule.ts with SAAS_APPLICATION_CONTROLLERS array literal (unchanged, first).
    • NEW: app.ts with a controllers array literal plus an application-controller target → { entryPath: app.ts, registrationArrayName: "controllers" }.
    • Existing app.ts registration-target check (unchanged).
    • index.ts → app.ts fallback (unchanged, last).
  • createDomain.ts uses the shared resolver instead of index.ts-first selection.
  • generateUsageDashboard.ts uses the shared resolver (behavior-preserving move).
  • Regression test in createDomain.spec.ts copies the real spa-be-split index.ts/app.ts template files and asserts status: "updated" plus the controllers array and import update.
  • @croco/cli patch changeset.

Validation

  • Negative control: new test fails on pre-fix tree with { status: "unsupported-pattern" }, passes post-fix with { status: "updated" }.
  • createDomain.spec.ts + GenerateUsageDashboard.spec.ts + registerController.spec.ts: 3 files, 60/60 pass.
  • Full @croco/cli suite: 605 pass; 2 pre-existing collection failures (AgentReadProcess/AgentReadTools, missing @croco/metrics-core build — also failing pre-fix, unrelated).
  • oxlint: 0 warnings, 0 errors.
  • typecheck at package scope fails on missing built workspace deps (@croco/problems-core etc.) both pre- and post-fix — pre-existing worktree build state, not caused by this diff.
  • Independent code-reviewer subagent: PASS (two non-blocking robustness notes on matcher precision: top-level-only array detection, loose substring gating — no in-repo regression).

Residual risk

  • Resolver matches module-scope controllers arrays; exotic scopings fall back to prior behavior (safe unsupported-pattern, no mis-edit).
  • Spread-element arrays are detected as literals but safely rejected by the codemod's existing spread guard.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 10:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 0f6724a4-bbc1-4fe4-8c28-5c819dd38a0d

📥 Commits

Reviewing files that changed from the base of the PR and between a08f36c and 0aed1e0.


⛔ Files ignored due to path filters (1)
  • packages/problems-core/src/generated/problem-code-registry.ts is excluded by !**/generated/**

📒 Files selected for processing (9)
  • .changeset/3095-create-domain-registration-target.md
  • docs/problem-code-registry.json
  • packages/cli/src/commands/createDomain.ts
  • packages/cli/src/commands/generateUsageDashboard.ts
  • packages/cli/src/libs/controllerRegistrationTarget.ts
  • packages/cli/src/tests/createDomain.spec.ts
  • packages/docs/src/content/docs/api/problems-core/src/variables/CROCO_PROBLEM_CODE_REGISTRY.md
  • packages/docs/src/content/docs/en/reference/problem-recovery-cookbook.md
  • tsconfig/contract-strict.baseline.json

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

📊 Benchmark Results

✅ All benchmarks passed

Benchmark p75 Threshold Baseline vs Baseline Status Notes
CrocoApp constructor 11.1μs 30.0ms 8.2μs +35.8% ❌ -
CrocoApp lambdaHandler (10 controllers) 1.6ms 50.0ms 258.4μs +504.0% ❌ -
Lambda cold-start simulation 1.6ms 80.0ms 418.1μs +281.2% ❌ -
Lambda cold-start with headers 1.6ms 80.0ms 369.7μs +334.2% ❌ -
Lambda cold-start with binary body 1.5ms 80.0ms 339.1μs +332.8% ❌ -
Lambda cold-start with query params 1.4ms 80.0ms 301.3μs +374.6% ❌ -
Lambda cold-start with authorizer context 1.4ms 80.0ms 299.8μs +380.8% ❌ -
Lambda cold-start realistic scenario 1.4ms 80.0ms 299.2μs +374.9% ❌ -
EventBusConfig.start (10 handlers) 5.7μs 10.0ms 1.4μs +295.0% ❌ -
EventPublisher.publishNow single event 2.4μs 2.0ms 1.7μs +44.1% ❌ -
DefaultHandlerResolver.resolve × 10 0.2μs 5.0ms 0.1μs +125.0% ❌ -
Container.get singleton (cold) 119.2μs 5.0ms 70.3μs +69.6% ❌ -
Container.register × 50 components 3.2ms 10.0ms 3.2ms -0.3% ✅ -
Container.validate (50 components) 3.6ms 20.0ms 3.4ms +5.7% ✅ -
Container.get singleton (warm) 1.0μs 500.0μs 1.6μs -38.1% ✅ -
TelemetryRuntime.init (lambda preset) 14.3μs 200.0ms 1.1ms -98.7% ✅ -
lambdaPreset config creation 1.4μs 2.0ms 1.4μs +0.8% ✅ -

Updated: 2026-10-11T03:48:50.701Z · Commit: 0aed1e0

@kang-heewon
kang-heewon force-pushed the issue-3095-create-domain-registration branch 3 times, most recently from ddedea3 to bee6933 Compare October 11, 2026 03:17
@kang-heewon
kang-heewon force-pushed the issue-3095-create-domain-registration branch from bee6933 to 0aed1e0 Compare October 11, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants