Skip to content

fix(api): add deprecated id alias in schedule list responses#182

Open
SudipSinha wants to merge 1 commit into
mainfrom
fix/schedule-response-id-field
Open

fix(api): add deprecated id alias in schedule list responses#182
SudipSinha wants to merge 1 commit into
mainfrom
fix/schedule-response-id-field

Conversation

@SudipSinha

Copy link
Copy Markdown
Member

Summary

Java clients read the id field from GET .../requests schedule list responses, but the Python service only returns requestId. This causes KeyError: 'id' in integration tests.

Root cause

The Java ScheduleRequest class has public UUID id which Jackson serializes as "id". The Python service uses "requestId" — a clearer name, but incompatible with existing Java API clients.

The schedule creation response (POST .../request) correctly uses requestId in both Java (BaseScheduledResponse.getRequestId()) and Python.

The fix

Add "id" as a deprecated alias in list responses, emitting both fields with the same value:

{
    "id": str(request_id),          # deprecated: use requestId
    "requestId": str(request_id),
    "modelId": ...,
}

This preserves backward compatibility with Java API clients while keeping requestId as the preferred field name.

Files changed

File Change
src/endpoints/metrics/drift/compare_means.py Add id alias in list response
src/endpoints/metrics/drift/kolmogorov_smirnov.py Add id alias in list response
src/endpoints/metrics/drift/jensen_shannon.py Add id alias in list response
src/endpoints/metrics/fairness/group/dir.py Add id alias in list response
src/endpoints/metrics/fairness/group/spd.py Add id alias in list response
tests/endpoints/metrics/drift/factory.py Assert at least one of id/requestId present; verify equality when both exist

Test plan

  • All 100 metrics tests pass
  • Test assertions are transition-friendly — accept either id or requestId, verify equality when both present
  • ruff check clean
  • ruff format clean
  • pyrefly check clean

🤖 Generated with Claude Code

@SudipSinha SudipSinha self-assigned this Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

More reviews will be available in 18 minutes and 14 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.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 58c1a42f-6946-4c27-8914-e7cf01826829

📥 Commits

Reviewing files that changed from the base of the PR and between eeca7e6 and 4c044f2.

📒 Files selected for processing (6)
  • src/endpoints/metrics/drift/compare_means.py
  • src/endpoints/metrics/drift/jensen_shannon.py
  • src/endpoints/metrics/drift/kolmogorov_smirnov.py
  • src/endpoints/metrics/fairness/group/dir.py
  • src/endpoints/metrics/fairness/group/spd.py
  • tests/endpoints/metrics/drift/factory.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/schedule-response-id-field

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.

@SudipSinha SudipSinha added bug Something isn't working python Pull requests that update python code ok-to-test Proceed with CI testing tests high-priority Critical issues that should be addressed soon labels Jun 16, 2026
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

PR image build and manifest generation completed successfully!

📦 PR image: quay.io/trustyai/trustyai-service-python-ci:4c044f29020aa4173523136319290f6d61ee5d7a

🗂️ CI manifests

devFlags:
  manifests:
    - contextDir: config
      sourcePath: ''
      uri: https://api.github.com/repos/trustyai-explainability/trustyai-service-operator-ci/tarball/service-python-4c044f29020aa4173523136319290f6d61ee5d7a

SudipSinha added a commit that referenced this pull request Jun 16, 2026
…st responses

The id alias was added to compare_means, kolmogorov_smirnov, and
jensen_shannon in PR #182 but missed in mmd.py and
kolmogorov_smirnov_streaming.py, causing KeyError: 'id' in
integration tests for approxkstest and fouriermmd schedules.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SudipSinha added a commit that referenced this pull request Jun 16, 2026
Match PR #182 pattern — include both id and requestId in list
response for Java API compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Sudip Sinha <Sudip.Sinha@RedHat.com>
SudipSinha added a commit that referenced this pull request Jun 16, 2026
Match PR #182 pattern — include both id and requestId in list
response for Java API compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Sudip Sinha <Sudip.Sinha@RedHat.com>
@SudipSinha SudipSinha marked this pull request as ready for review June 18, 2026 14:08
SudipSinha added a commit that referenced this pull request Jun 18, 2026
Match PR #182 pattern — include both id and requestId in list
response for Java API compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Sudip Sinha <Sudip.Sinha@RedHat.com>
Java clients read the id field from GET .../requests responses, but
the Python service only returns requestId. Add id as a deprecated alias
(same value) for backward compatibility. Tests accept either field and
verify equality when both are present, so removing id later won't break
them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Sudip Sinha <Sudip.Sinha@RedHat.com>
SudipSinha added a commit that referenced this pull request Jun 18, 2026
Match PR #182 pattern — include both id and requestId in list
response for Java API compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Sudip Sinha <Sudip.Sinha@RedHat.com>
@SudipSinha SudipSinha force-pushed the fix/schedule-response-id-field branch from 032f3d9 to 4c044f2 Compare June 18, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working high-priority Critical issues that should be addressed soon ok-to-test Proceed with CI testing python Pull requests that update python code tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant