Skip to content

Conversation

@adityachoudhari26
Copy link
Contributor

@adityachoudhari26 adityachoudhari26 commented Dec 19, 2025

Summary by CodeRabbit

Release Notes

  • Refactor
    • Updated API schema structure for job agent and deployment configurations to use simplified validation through reference types rather than explicit type discriminators.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 19, 2025

Walkthrough

Removed OpenAPI discriminator blocks from job agent configuration schemas across JSON and JSONNET files. Discriminator property mappings are eliminated while preserving oneOf schema references. Generated TypeScript descriptions are simplified by removing version notation.

Changes

Cohort / File(s) Summary
OpenAPI schema definitions
apps/api/openapi/schemas/deployments.jsonnet, apps/api/openapi/schemas/job-agents.jsonnet
Removed discriminator blocks with propertyName and type-to-schema mappings; oneOf references retained
Generated OpenAPI spec
apps/api/openapi/openapi.json
Removed discriminator blocks from DeploymentJobAgentConfig and JobAgentConfig schemas
Generated TypeScript types
apps/api/src/types/openapi.ts
Simplified job agent type discriminator descriptions by removing "(enum property replaced by openapi-typescript)" notation

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

The changes follow a consistent, repetitive pattern of discriminator removal across multiple schema files. No complex logic alterations or functional behavior changes are present. Generated code updates are straightforward text simplifications.

Poem

🐰 No more discriminators in our schemas so fine,

Just oneOf now, without the mapping line,

Simpler types for agents on the quest,

Config validation—cleaned and blessed! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing job agent discriminators from the OpenAPI schema across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove-job-agent-discriminator

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 69ea6e9 and 2bac5c3.

📒 Files selected for processing (4)
  • apps/api/openapi/openapi.json (0 hunks)
  • apps/api/openapi/schemas/deployments.jsonnet (0 hunks)
  • apps/api/openapi/schemas/job-agents.jsonnet (0 hunks)
  • apps/api/src/types/openapi.ts (8 hunks)
💤 Files with no reviewable changes (3)
  • apps/api/openapi/schemas/job-agents.jsonnet
  • apps/api/openapi/schemas/deployments.jsonnet
  • apps/api/openapi/openapi.json
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Use TypeScript with explicit types (prefer interfaces for public APIs)
Import styles: Use named imports, group imports by source (std lib > external > internal)
Consistent type imports: import type { Type } from "module"
Prefer async/await over raw promises
Handle errors explicitly (use try/catch and typed error responses)

Files:

  • apps/api/src/types/openapi.ts

⚙️ CodeRabbit configuration file

**/*.{ts,tsx}: Note on Error Handling:
Avoid strict enforcement of try/catch blocks. Code may use early returns, Promise chains (.then().catch()), or other patterns for error handling. These are acceptable as long as they maintain clarity and predictability.

Files:

  • apps/api/src/types/openapi.ts
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}

📄 CodeRabbit inference engine (CLAUDE.md)

Formatting: Prettier is used with @ctrlplane/prettier-config

Files:

  • apps/api/src/types/openapi.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: adityachoudhari26
Repo: ctrlplanedev/ctrlplane PR: 637
File: packages/events/src/kafka/client.ts:10-16
Timestamp: 2025-08-01T04:41:41.345Z
Learning: User adityachoudhari26 prefers not to add null safety checks for required environment variables when they are guaranteed to be present in their deployment configuration, similar to their preference for simplicity over defensive programming in test code.
Learnt from: adityachoudhari26
Repo: ctrlplanedev/ctrlplane PR: 601
File: e2e/tests/api/policies/retry-policy.spec.ts:23-24
Timestamp: 2025-06-24T23:52:50.732Z
Learning: The user adityachoudhari26 prefers not to add null safety checks or defensive programming in test code, particularly in e2e tests, as they prioritize simplicity and focus on the main functionality being tested rather than comprehensive error handling within the test itself.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build (linux/amd64)
  • GitHub Check: Lint
  • GitHub Check: Typecheck
🔇 Additional comments (1)
apps/api/src/types/openapi.ts (1)

768-768: LGTM! Auto-generated file correctly updated.

The description changes across all job agent configuration types are consistent and properly reflect the removal of discriminator blocks from the source OpenAPI schemas. The simplified descriptions improve clarity while maintaining the necessary type information.

Also applies to: 849-849, 918-918, 925-925, 941-941, 956-956, 1103-1103, 1423-1423, 1466-1466


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.

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.

2 participants