Skip to content

fix: reject duplicate diagnostics provider names - #749

Merged
kang-heewon merged 1 commit into
trunkfrom
fix/700-diagnostics-provider-conflicts
Jun 14, 2026
Merged

fix: reject duplicate diagnostics provider names#749
kang-heewon merged 1 commit into
trunkfrom
fix/700-diagnostics-provider-conflicts

Conversation

@kang-heewon

Copy link
Copy Markdown
Member

Fixes #700.

Summary

@croco/diagnostics-core now treats diagnostics provider names as unique within a DiagnosticsCollector. Re-registering the same provider instance remains idempotent, while registering a different provider with an existing name throws DuplicateDiagnosticsProviderProblem before the original provider can be overwritten.

변경 사항

  • Added duplicate-name detection to DiagnosticsCollector.registerProvider().
  • Added and exported DuplicateDiagnosticsProviderProblem using the existing Croco Problem pattern.
  • Locked duplicate registration behavior with regressions for different-provider conflicts and same-instance idempotency.
  • Documented the provider name uniqueness contract and added a patch changeset for @croco/diagnostics-core.

Verification

  • pnpm vitest run src/tests/DiagnosticsIntegration.spec.ts --reporter verbose first failed before implementation with expected function to throw an error, but it did not.
  • pnpm --filter @croco/diagnostics-core test - 1 file, 8 tests passed.
  • pnpm --filter @croco/diagnostics-core typecheck - passed.
  • pnpm --filter @croco/diagnostics-core build - passed.
  • pnpm --filter @croco/diagnostics-core lint - 0 warnings/errors.
  • node scripts/normalize-packages.mjs --check - passed.
  • pnpm check - passed package manifest, docs catalog, circular dependency, oxlint, and oxfmt checks.
  • CI=1 pnpm exec changeset status --since origin/trunk - passed with patch bump for @croco/diagnostics-core and dependents.
  • git diff --cached --check - passed before commit.
  • Pre-commit hook: oxfmt and oxlint passed.
  • Pre-push hook: full pnpm test 197/197 tasks passed; full pnpm typecheck 196/196 tasks passed.

Self-review

  • Correctness/regression: PASS. [diagnostics-core] 같은 이름의 diagnostics provider 등록이 조용히 덮어써짐 #700 acceptance is covered by the duplicate provider regression, which now throws before overwrite and verifies the original provider remains the only reported component. Same-instance re-registration is explicitly locked as idempotent.
  • API/security/compatibility/release: PASS. The public API change is an additive Problem export, the new runtime dependency is the workspace @croco/problems-core package used by other Croco packages, no secrets or environment assumptions changed, and a patch changeset covers the publishable behavior.
  • Maintainability/minimality: PASS. The behavior diff is limited to DiagnosticsCollector, one focused Problem class, package metadata, focused tests, docs, and release metadata. Independent review found no actionable issues.

Risk

Low. Consumers that accidentally registered two different providers with the same name will now fail fast instead of silently using the later provider. That is the intended behavior for #700.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

More reviews will be available in 34 minutes and 27 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8bb3d17c-a509-44a5-afd1-6f305b410430

📥 Commits

Reviewing files that changed from the base of the PR and between 76bc0df and ae4c6dd.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • .changeset/diagnostics-provider-conflicts.md
  • docs/troubleshooting/diagnostics.md
  • packages/diagnostics-core/package.json
  • packages/diagnostics-core/src/index.ts
  • packages/diagnostics-core/src/libs/DiagnosticsCollector.ts
  • packages/diagnostics-core/src/libs/problems/DiagnosticsProblems.ts
  • packages/diagnostics-core/src/tests/DiagnosticsIntegration.spec.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/700-diagnostics-provider-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 and usage tips.

@github-actions

Copy link
Copy Markdown

📊 Benchmark Results

❌ Some benchmarks failed

Benchmark p75 Threshold Baseline vs Baseline Status
CrocoApp benchmarks 3.4μs - - - ⚠️
EventBusConfig.start (10 handlers) 1.5μs - 9.0μs -83.9%
EventPublisher.publishNow single event 1.7μs - - - ⚠️
DefaultHandlerResolver.resolve × 10 0.1μs - 0.2μs -60.0%
Container.get singleton (cold) 1.0μs - 0.5μs +98.2%
Container.register × 50 components 10.9μs - 8.0μs +36.0%
Container.validate (50 components) 28.1μs - 25.0μs +12.4%
Container.get singleton (warm) 0.4μs - 0.3μs +30.3%
TelemetryRuntime benchmarks 1.9μs - 2.0μs -3.9%

Updated: 2026-06-14T22:12:22.111Z · Commit: b2f2b26

@kang-heewon
kang-heewon merged commit 2f0dae2 into trunk Jun 14, 2026
7 of 8 checks passed
@kang-heewon
kang-heewon deleted the fix/700-diagnostics-provider-conflicts branch June 14, 2026 22:21
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.

[diagnostics-core] 같은 이름의 diagnostics provider 등록이 조용히 덮어써짐

1 participant