Skip to content

HYPERFLEET-1246: Make kind required on ObjectReference, remove ObjectReference2#62

Open
kuudori wants to merge 1 commit into
openshift-hyperfleet:mainfrom
kuudori:HYPERFLEET-1246-objectref
Open

HYPERFLEET-1246: Make kind required on ObjectReference, remove ObjectReference2#62
kuudori wants to merge 1 commit into
openshift-hyperfleet:mainfrom
kuudori:HYPERFLEET-1246-objectref

Conversation

@kuudori

@kuudori kuudori commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Made kind field required (was optional) on ObjectReference model — aligns spec with API runtime validation
  • Removed unused ObjectReference2<Kind> generic model
  • Version bump 1.0.22 → 1.0.23

Context

Follow-up to #61 which fixed the NodePool example. This addresses the root cause: the model itself declared kind as optional while the API validates it as mandatory.

Test plan

  • ./build-schema.sh passes
  • spectral lint passes with --fail-severity warn
  • All existing examples already include kind — no example changes needed
  • Audited all create/response examples across both api-spec and api-spec-template repos

…unused ObjectReference2

The kind field was marked optional in the ObjectReference model but the
API validates it as mandatory, causing a mismatch between the spec and
runtime behavior. Also removes the unused ObjectReference2<Kind> generic
model.
@openshift-ci openshift-ci Bot requested review from ldornele and sherine-k June 22, 2026 16:04
@openshift-ci

openshift-ci Bot commented Jun 22, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign mischulee for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
📝 Walkthrough

Summary by CodeRabbit

Release v1.0.23

  • Changed

    • The kind field is now required for cluster, node pool, and object reference objects in API requests and responses.
  • Removed

    • Removed an unused generic model variant.

Walkthrough

ObjectReference.kind is changed from optional (kind?: string) to required (kind: string) in shared/models/common/model.tsp. The unused generic model ObjectReference2<Kind> is removed from the same file. The generated schemas/core/openapi.yaml is updated accordingly: kind is added to the required array of ObjectReference, Cluster, ClusterCreateRequest, NodePool, NodePoolCreateRequest, and NodePoolCreateResponse. Version metadata is incremented to 1.0.23 in package.json, main.tsp, openapi.yaml, and CHANGELOG.md.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: making kind required on ObjectReference and removing ObjectReference2, aligning with the primary modifications across all files.
Description check ✅ Passed The description is directly related to the changeset, covering the key modifications, context, and test results that match the file-level changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Sec-02: Secrets In Log Output ✅ Passed No log statements (slog, log, logr, zap, fmt.Print*) found in any Go files. Only Go file modified (schemas/schemas.go) is a minimal package definition with no logging.
No Hardcoded Secrets ✅ Passed No hardcoded secrets, API keys, tokens, passwords, private keys, credentials, base64 strings >32 chars, or credential URLs detected in PR changes. Version bumps and schema tightening only.
No Weak Cryptography ✅ Passed PR contains only schema/specification changes (making kind field required on ObjectReference, removing unused generic model, version bump). No cryptographic primitives, implementations, or weak...
No Injection Vectors ✅ Passed No injection vectors detected. PR modifies only configuration files (CHANGELOG.md, package.json, main.tsp) and schema definitions (OpenAPI YAML, TypeSpec models). No SQL concatenation (CWE-89), com...
No Privileged Containers ✅ Passed PR contains only schema/specification updates (TypeSpec, OpenAPI YAML, changelog, package.json). No Kubernetes manifests, OpenShift configs, Helm templates, or Dockerfiles present—check not applica...
No Pii Or Sensitive Data In Logs ✅ Passed No logging statements present in PR. Changes are configuration and specification updates (version bumps, model definition changes, schema requirements) with no PII/sensitive data exposure.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 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 `@main.tsp`:
- Line 33: The version string format at line 33 in main.tsp is no longer
compatible with the CI's version extraction logic for the `@info.version` field,
causing the release validation to fail. Either revert the version token back to
the format that the CI parser expects (check previous version formats in git
history), or update the CI version extractor configuration in the same pull
request to handle the new format. Ensure the fix is made in this PR before
merging to unblock the validation job.

In `@package.json`:
- Line 3: The version field in package.json is currently set to a patch version
(1.0.23), but the changes include API schema modifications that make previously
optional request properties required, which constitutes a breaking change to the
public API contract. Update the version to the next breaking-contract version
(typically a minor version bump like 1.1.0 or major version bump like 2.0.0
depending on your versioning strategy) to properly communicate the contract
change to downstream clients and prevent contract drift.
🪄 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: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: acfdfd55-ec42-4936-9270-2cd55f794759

📥 Commits

Reviewing files that changed from the base of the PR and between 4a55942 and 17c2597.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • CHANGELOG.md
  • main.tsp
  • package.json
  • schemas/core/openapi.yaml
  • shared/models/common/model.tsp
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift-hyperfleet/architecture (manual)
  • openshift-hyperfleet/hyperfleet-api (manual)
  • openshift-hyperfleet/hyperfleet-sentinel (manual)
  • openshift-hyperfleet/hyperfleet-adapter (manual)
  • openshift-hyperfleet/hyperfleet-broker (manual)

Comment thread main.tsp
@service(#{ title: "HyperFleet API" })
@info(#{
version: "1.0.22",
version: "1.0.23",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Version extraction failure blocks release validation.

CI is failing to parse @info.version from main.tsp after this change, which blocks the validation job. Keep the version: "x.y.z" token parser-compatible at Line [33] or update the CI extractor in the same PR.

As per coding guidelines, "**: Prioritize Critical and Major severity issues."

🤖 Prompt for 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.

In `@main.tsp` at line 33, The version string format at line 33 in main.tsp is no
longer compatible with the CI's version extraction logic for the `@info.version`
field, causing the release validation to fail. Either revert the version token
back to the format that the CI parser expects (check previous version formats in
git history), or update the CI version extractor configuration in the same pull
request to handle the new format. Ensure the fix is made in this PR before
merging to unblock the validation job.

Sources: Coding guidelines, Pipeline failures

Comment thread package.json
{
"name": "hyperfleet",
"version": "1.0.22",
"version": "1.0.23",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Public API contract tightening is shipped as a patch version.

Line [3] sets 1.0.23, while request schemas were tightened (Line [1883], Line [2169], Line [2351] in schemas/core/openapi.yaml, flagged as request-property-became-required). This should be released under the next breaking-contract version to avoid downstream client contract drift.

As per coding guidelines, "**: Prioritize Critical and Major severity issues. ... Validate changes against HyperFleet architecture standards."

🤖 Prompt for 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.

In `@package.json` at line 3, The version field in package.json is currently set
to a patch version (1.0.23), but the changes include API schema modifications
that make previously optional request properties required, which constitutes a
breaking change to the public API contract. Update the version to the next
breaking-contract version (typically a minor version bump like 1.1.0 or major
version bump like 2.0.0 depending on your versioning strategy) to properly
communicate the contract change to downstream clients and prevent contract
drift.

Sources: Coding guidelines, Linters/SAST tools

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.

1 participant