Skip to content

fix: make Node entry lifecycle linearizable - #1778

Open
kang-heewon wants to merge 1 commit into
trunkfrom
fix/1706-linearize-node-entry
Open

fix: make Node entry lifecycle linearizable#1778
kang-heewon wants to merge 1 commit into
trunkfrom
fix/1706-linearize-node-entry

Conversation

@kang-heewon

Copy link
Copy Markdown
Member

Outcome

Node entry startup is now linearizable: concurrent callers share one startup attempt, repeated starts after success remain idempotent, and startup failure permits a clean retry. Closing waits for an active startup, shares concurrent close work, closes the owned listener, and permanently fences later start attempts once shutdown begins.

Invalid post-close starts return the stable preset-node/lifecycle-conflict Problem with the attempted operation and lifecycle state. The public API, Problem registry, generated API documentation, README, and release metadata describe the same contract.

Fixes #1706

Verification

  • pnpm --filter @croco/preset-node test
  • pnpm --filter @croco/preset-node typecheck
  • pnpm --filter @croco/preset-node lint
  • pnpm --filter @croco/preset-node build
  • pnpm problem-registry:check
  • pnpm public-api:check
  • pnpm docs:build
  • pnpm check
  • pre-push full test and typecheck hooks

Review gates

  • Correctness and regression: concurrent start, synchronous listening callback, startup failure retry, close during startup, shared close, and close-error retry paths are covered.
  • API and release: typed Problem export, registry, API snapshot, TypeDoc output, package dependency, lockfile, and changesets were regenerated and verified.
  • Maintainability and scope: routing and entry options are unchanged; generated drift was removed; an independent adversarial review found no remaining actionable issue.

Residual risk

None identified.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kang-heewon, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 24 minutes

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

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 76587599-29f8-4603-a0d4-9dcb1fdb0dc7

📥 Commits

Reviewing files that changed from the base of the PR and between 6795b4d and 6df034d.

⛔ Files ignored due to path filters (2)
  • packages/problems-core/src/generated/problem-code-registry.ts is excluded by !**/generated/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (15)
  • .changeset/linear-node-entry-lifecycle.md
  • docs/problem-code-registry.json
  • packages/docs/src/content/docs/api/preset-node/src/classes/NodeEntryLifecycleProblem.md
  • 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
  • packages/preset-node/README.md
  • packages/preset-node/package.json
  • packages/preset-node/src/entry.ts
  • packages/preset-node/src/index.ts
  • packages/preset-node/src/problems.ts
  • packages/preset-node/src/tests/presetNode.spec.ts
  • packages/preset-node/src/tests/publicTypes.spec.ts
  • packages/preset-node/tsconfig.json
  • packages/preset-node/vitest.config.ts
  • public-api-surface.snapshot.json

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 Aug 8, 2026

Copy link
Copy Markdown

📊 Benchmark Results

✅ All benchmarks passed

Benchmark p75 Threshold Baseline vs Baseline Status Notes
CrocoApp constructor 43.9μs 30.0ms 8.2μs +436.7% -
CrocoApp lambdaHandler (10 controllers) 2.1ms 50.0ms 258.4μs +694.4% -
Lambda cold-start simulation 2.1ms 80.0ms 418.1μs +390.8% -
Lambda cold-start with headers 1.5ms 80.0ms 369.7μs +312.8% -
Lambda cold-start with binary body 1.5ms 80.0ms 339.1μs +345.9% -
Lambda cold-start with query params 1.5ms 80.0ms 301.3μs +395.5% -
Lambda cold-start with authorizer context 1.5ms 80.0ms 299.8μs +404.4% -
Lambda cold-start realistic scenario 1.5ms 80.0ms 299.2μs +400.0% -
EventBusConfig.start (10 handlers) 1.7μs 10.0ms 1.4μs +16.7% -
EventPublisher.publishNow single event 1.8μs 2.0ms 1.7μs +9.6% -
DefaultHandlerResolver.resolve × 10 0.1μs 5.0ms 0.1μs +1.3% -
Container.get singleton (cold) 86.2μs 5.0ms 70.3μs +22.7% -
Container.register × 50 components 3.4ms 10.0ms 3.2ms +4.4% -
Container.validate (50 components) 3.8ms 20.0ms 3.4ms +13.5% -
Container.get singleton (warm) 1.7μs 500.0μs 1.6μs +1.2% -
TelemetryRuntime.init (lambda preset) 2.2μs 200.0ms 1.1ms -99.8% -
lambdaPreset config creation 1.5μs 2.0ms 1.4μs +4.9% -

Updated: 2026-08-08T08:06:24.785Z · Commit: 77be7a9

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.

[preset-node] Make createNodeEntry start and close linearizable

1 participant