fix: expose Croco operations status plane - #817
Conversation
|
Warning Review limit reached
More reviews will be available in 12 minutes and 19 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 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (16)
📝 WalkthroughWalkthrough
ChangesOperations Status Plane
Sequence DiagramssequenceDiagram
participant User
participant opsStatus커맨드
participant runOpsStatus
participant fetchOperationalEndpoint
participant CrocoApp서버
rect rgba(70, 130, 180, 0.5)
Note over User,opsStatus커맨드: croco ops status <url>
User->>opsStatus커맨드: 실행 (--json, --token 옵션)
opsStatus커맨드->>runOpsStatus: target URL, RunOpsStatusOptions
end
rect rgba(60, 179, 113, 0.5)
Note over runOpsStatus,CrocoApp서버: 4개 엔드포인트 병렬 조회
runOpsStatus->>fetchOperationalEndpoint: Promise.all [/health, /ready, /diagnostics, /metrics]
fetchOperationalEndpoint->>CrocoApp서버: GET /health
fetchOperationalEndpoint->>CrocoApp서버: GET /ready
fetchOperationalEndpoint->>CrocoApp서버: GET /diagnostics (X-Diagnostics-Token 헤더)
fetchOperationalEndpoint->>CrocoApp서버: GET /metrics
CrocoApp서버-->>fetchOperationalEndpoint: OpsEndpointSnapshot 배열
end
rect rgba(255, 140, 0, 0.5)
Note over runOpsStatus,opsStatus커맨드: 요약 계산 및 출력
fetchOperationalEndpoint-->>runOpsStatus: OpsEndpointSnapshot[]
runOpsStatus-->>opsStatus커맨드: OpsStatusReport (summary, endpoints)
opsStatus커맨드->>User: JSON 또는 포맷된 텍스트 출력
opsStatus커맨드->>opsStatus커맨드: process.exitCode = 0(healthy) 또는 1(그 외)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
📊 Benchmark Results❌ Some benchmarks failed Gate failures
Updated: 2026-06-16T12:35:42.304Z · Commit: e566ff3 |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/commands/ops.ts`:
- Around line 148-166: The functions parseTimeoutMs and parseTargetUrl are
throwing raw Error objects which violates the project's RFC 7807-based exception
handling rules. Replace both Error throws with appropriate Problem subclasses:
in parseTimeoutMs when the parsed timeout is not finite or is non-positive, and
in parseTargetUrl when the URL constructor throws an exception. Use the
project's standard Problem subclasses instead of new Error for consistent error
handling across CLI validations.
In `@packages/cli/src/index.ts`:
- Around line 30-42: The export block from the ops commands module mixes runtime
exports and type exports together, violating the file's organization convention.
Separate the type exports (type OpsEndpointName, type OpsEndpointSnapshot, type
OpsStatusFetch, type OpsStatusReport, type OpsStatusSummary, type
RunOpsStatusOptions) from the runtime exports (formatOpsStatusReport,
getOpsStatusExitCode, ops, opsStatus, runOpsStatus). Keep the runtime exports in
their current location and move all the type exports to a dedicated types
section at the end of the file, following the established pattern of grouping
exports by category with types collected at the end.
In `@packages/cli/src/tests/opsStatus.spec.ts`:
- Around line 1-10: The test file is missing the required DI container isolation
hook. Add `beforeEach` to your vitest imports at the top of the file, import the
DI Container (likely from a dependency injection module), and add a `beforeEach`
hook inside the describe block for "ops status" that calls `Container.reset()`
before each test. This ensures proper test isolation by resetting the dependency
injection container between test runs as required by the coding guidelines for
test files.
In `@packages/transports-http/src/tests/OperationalEndpoints.spec.ts`:
- Around line 9-12: Separate type imports from value imports following the
mandatory coding guideline. In
packages/transports-http/src/tests/OperationalEndpoints.spec.ts (lines 9-12),
move DiagnosticsEndpointOptions from the regular import statement into a
separate import type statement. In packages/cli/src/tests/opsStatus.spec.ts
(lines 2-8), move OpsStatusFetch from the regular import statement into a
separate import type statement. Ensure all type-only symbols use import type
syntax while keeping value imports in regular import statements.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: a8b1241f-22ce-49a7-afad-13c0a5ea9a02
📒 Files selected for processing (10)
.changeset/ops-status-plane.mdpackages/cli/src/bin/croco.tspackages/cli/src/commands/ops.tspackages/cli/src/index.tspackages/cli/src/tests/opsStatus.spec.tspackages/transports-http/src/index.tspackages/transports-http/src/libs/CrocoApp.tspackages/transports-http/src/libs/HealthCheckRegistry.tspackages/transports-http/src/libs/operationalEndpoints.tspackages/transports-http/src/tests/OperationalEndpoints.spec.ts
6d7710c to
1b44764
Compare
1b44764 to
8b3cd2a
Compare
Fixes #716.
Summary
Croco apps now expose the canonical operations surface expected by the issue:
/diagnosticsalongside the legacy diagnostics path,/metricswith safe framework counters, and runtime metadata in the default diagnostics collector.The CLI now includes
croco ops status <url>with pretty and--jsonoutput for health, readiness, diagnostics, and metrics probes. The diagnostics token is only sent to/diagnostics, and degraded or unhealthy summaries return a non-zero exit code for smoke/CI usage.Verification
pnpm --filter @croco/cli exec vitest run src/tests/opsStatus.spec.tspnpm --filter @croco/transports-http exec vitest run src/tests/OperationalEndpoints.spec.ts src/tests/HealthCheck.spec.tspnpm typecheck --filter=@croco/transports-http --filter=@croco/clipnpm checkpnpm test --filter=@croco/diagnostics-core --filter=@croco/health-core --filter=@croco/transports-http --filter=@croco/clipnpm changeset-required:check -- --base origin/trunk --head HEADgit diff --check origin/trunk...HEADpnpm testpassed 197/197 taskspnpm typecheckpassed 196/196 tasksSelf-review gates
/diagnostics, legacy/health/diagnostics,/metrics, runtime diagnostics metadata, CLI healthy/degraded/unhealthy summaries, diagnostics token scoping, and non-zero degraded exits are covered by focused tests. Existing diagnostics duplicate-provider, timeout, redaction, recent-error, and readiness tests remain green through the related package matrix./metricsexposes only counts, diagnostics tokens are scoped to the diagnostics request, no dependency or lockfile change is introduced, and a patch changeset covers@croco/transports-httpand@croco/cli.Independent review
--tokento/diagnostics, renaming the metrics endpoint-list count tostandardEndpointPathCount, and making degraded CLI status non-zero.Risk
Low. Diagnostics exposure remains controlled by the existing diagnostics policy; the new
/metricsroute is always available but only returns timestamp, standard endpoint-path count, and registered health-check count.Summary by CodeRabbit
릴리스 노트
New Features
croco ops status명령을 통해 런타임 상태를 확인할 수 있습니다.Tests