feat: add data-pathways delete and health check commands#192
Conversation
Add two missing SDK commands for data-pathways control plane: - DataPathwayDeleteCommand (DELETE /api/v1/pathways/:id) - DataPathwayHealthCheckCommand (GET /api/v1/health) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds two Data Pathways commands (health check and pathway delete), a new DataPathwayHealth schema/type, barrel exports for the commands, and a package version bump in Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Command as DataPathwayHealthCheckCommand
participant API as Data-Pathways API
participant Parser as Response Parser
Client->>Command: execute()
Command->>API: GET https://data-pathways.api.flowcore.io/api/v1/health
API-->>Command: 200 {status, checks, uptime}
Command->>Parser: parseResponseHelper(DataPathwayHealthSchema, raw)
Parser-->>Command: DataPathwayHealth
Command-->>Client: return DataPathwayHealth
sequenceDiagram
participant Client
participant Command as DataPathwayDeleteCommand
participant API as Data-Pathways API
participant Parser as Response Parser
participant ErrorMapper as Error Mapper
Client->>Command: execute({ id })
Command->>API: DELETE https://data-pathways.api.flowcore.io/api/v1/pathways/{id}
alt 200/2xx
API-->>Command: 200 {mutation response}
Command->>Parser: parseResponseHelper(DataPathwayMutationResponseSchema, raw)
Parser-->>Command: DataPathwayMutationResponse
Command-->>Client: return response
else 404
API-->>Command: 404 {...}
Command->>ErrorMapper: map to NotFoundException("DataPathway", id)
ErrorMapper-->>Command: throw NotFoundException
Command-->>Client: throw NotFoundException
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/commands/data-pathways/pathway.delete.ts (1)
28-31: Consider: Empty body on DELETE when no reason is provided.When
reasonis not provided,getBody()returns{}. The base class will send this withContent-Type: application/json. While this works with most APIs, some strict REST implementations may reject DELETE requests with bodies.If the API accepts bodyless DELETE, you could return
undefinedwhen the payload is empty:💡 Optional refinement
protected override getBody(): Record<string, unknown> | undefined { const { id: _id, ...payload } = this.input - return payload + return Object.keys(payload).length > 0 ? payload : undefined }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/data-pathways/pathway.delete.ts` around lines 28 - 31, The getBody() implementation in the PathwayDelete command extracts id into _id and returns payload which yields an empty object when no reason is provided; change getBody() (in the pathway.delete command) to return undefined when payload is empty so the base request does not send an empty JSON body—detect payload emptiness (after stripping _id) and return payload if non-empty otherwise return undefined.src/commands/data-pathways/health.check.ts (1)
7-9: Consider: Bearer-only authentication for health checks.Health endpoints are often unauthenticated to support external monitoring tools (load balancers, Kubernetes probes). The current bearer-only restriction limits usage to authenticated internal calls.
If this is intentional for internal monitoring, this is fine. Otherwise, consider allowing unauthenticated access or API key auth.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/data-pathways/health.check.ts` around lines 7 - 9, DataPathwayHealthCheckCommand currently restricts auth via protected override allowedModes: ("apiKey" | "bearer")[] = ["bearer"], which forces bearer-only access; to allow external monitoring either add "apiKey" to allowedModes (set to ["bearer","apiKey"]) or make the endpoint unauthenticated by setting allowedModes to an empty array ([]) or a mode that represents anonymous access; update DataPathwayHealthCheckCommand's allowedModes and any related auth checks or tests (and keep protected override retryOnFailure as-is) so health probes can use the intended auth model.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/commands/data-pathways/health.check.ts`:
- Around line 23-25: Remove the unnecessary getBody() override that returns an
empty object; the GET handler should rely on the base Command.getBody() behavior
(which returns undefined) so no JSON body or Content-Type is sent. Locate and
delete the getBody() method override in the health check command (the method
named getBody in the class handling the health check, e.g., HealthCheckCommand)
so the request will not include an empty body.
---
Nitpick comments:
In `@src/commands/data-pathways/health.check.ts`:
- Around line 7-9: DataPathwayHealthCheckCommand currently restricts auth via
protected override allowedModes: ("apiKey" | "bearer")[] = ["bearer"], which
forces bearer-only access; to allow external monitoring either add "apiKey" to
allowedModes (set to ["bearer","apiKey"]) or make the endpoint unauthenticated
by setting allowedModes to an empty array ([]) or a mode that represents
anonymous access; update DataPathwayHealthCheckCommand's allowedModes and any
related auth checks or tests (and keep protected override retryOnFailure as-is)
so health probes can use the intended auth model.
In `@src/commands/data-pathways/pathway.delete.ts`:
- Around line 28-31: The getBody() implementation in the PathwayDelete command
extracts id into _id and returns payload which yields an empty object when no
reason is provided; change getBody() (in the pathway.delete command) to return
undefined when payload is empty so the base request does not send an empty JSON
body—detect payload emptiness (after stripping _id) and return payload if
non-empty otherwise return undefined.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8914e781-9ddc-435e-b893-80309443e0ac
📒 Files selected for processing (5)
deno.jsonsrc/commands/data-pathways/health.check.tssrc/commands/data-pathways/index.tssrc/commands/data-pathways/pathway.delete.tssrc/contracts/data-pathways.ts
GET requests should not send a body — use base class default (undefined). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
DataPathwayDeleteCommand—DELETE /api/v1/pathways/:idfor pathway deletionDataPathwayHealthCheckCommand—GET /api/v1/healthfor health checksDataPathwayHealthSchemacontract typeTest plan
deno check src/mod.tspassesdeno test— all 20 tests pass🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores