Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Warn when OpenAPI and Refitter interface is possibly out of sync #1968

Closed

Conversation

oskogstad
Copy link
Collaborator

Description

Related Issue(s)

  • #{issue number}

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

Documentation

  • Documentation is updated (either in docs-directory, Altinnpedia or a separate linked PR in altinn-studio-docs., if applicable)

@oskogstad oskogstad requested review from a team as code owners February 26, 2025 10:03
Copy link
Contributor

coderabbitai bot commented Feb 26, 2025

📝 Walkthrough

Walkthrough

This pull request updates two GitHub Actions workflow files. In the workflow-build-and-test.yml file, two new jobs are added: one to trigger a check for changes and a conditional job that validates synchronization between the Swagger schema and the WebAPI SDK Refitter interface, including an error step. In the workflow-check-for-changes.yml file, a new output variable is introduced for monitoring changes to the Refitter interface, and a file path is added to track the Refitter interface file.

Changes

File(s) Change Summary
.github/workflows/workflow-build-and-test.yml - Added check-for-changes job to trigger a change-detecting workflow.
- Introduced check-refitter-swagger-sync job that conditionally runs (on Ubuntu, with continue-on-error) to check for Swagger schema changes without corresponding WebAPI SDK Refitter interface updates.
.github/workflows/workflow-check-for-changes.yml - Added output variable hasWebApiClientRefitterInterfaceChanges under workflow_call and to the check-for-changes job outputs.
- Updated file monitoring by adding the Refitter interface file at src/Digdir.Library.Dialogporten.WebApiClient/.../RefitterInterface.cs to the files_yaml configuration.

Possibly related PRs

Suggested reviewers

  • MagnusSandgren

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc370b5 and 22fad13.

📒 Files selected for processing (2)
  • .github/workflows/workflow-build-and-test.yml (1 hunks)
  • .github/workflows/workflow-check-for-changes.yml (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/workflow-build-and-test.yml
  • .github/workflows/workflow-check-for-changes.yml

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@oskogstad oskogstad force-pushed the ci/add-reminder-for-swagger-refitter-change-mismatch branch from d7e5b1d to d102bfe Compare February 26, 2025 10:09
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/workflow-build-and-test.yml (1)

12-22: Job "check-refitter-swagger-sync": Conditional Logic and Warning Configuration

The conditional expression in line 14 properly triggers this job when the OpenAPI spec changes without accompanying changes to the WebAPI SDK Refitter interface. The design—using continue-on-error: true along with an exit code (exit 1) in the step—effectively issues a warning without failing the entire workflow. It would be beneficial to add an inline comment clarifying that this behavior is intentional (i.e., a warning mechanism rather than a hard error) for future maintainers.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7e5b1d and d102bfe.

📒 Files selected for processing (4)
  • .github/workflows/workflow-build-and-test.yml (1 hunks)
  • .github/workflows/workflow-check-for-changes.yml (3 hunks)
  • docs/schema/V1/swagger.verified.json (1 hunks)
  • src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Content/ContentValueDto.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/workflow-check-for-changes.yml
  • src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Content/ContentValueDto.cs
  • docs/schema/V1/swagger.verified.json
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build-infrastructure / Build infrastructure for test
  • GitHub Check: build / build-and-test
🔇 Additional comments (1)
.github/workflows/workflow-build-and-test.yml (1)

8-11: Job "check-for-changes" Integration: Verify External Outputs

The new job leverages the external workflow at .github/workflows/workflow-check-for-changes.yml to monitor code changes—including those for the Refitter interface file. Please ensure that the external workflow correctly produces the expected outputs (especially hasWebApiClientRefitterInterfaceChanges) for consumption in downstream jobs.

@oskogstad oskogstad force-pushed the ci/add-reminder-for-swagger-refitter-change-mismatch branch 3 times, most recently from a265714 to bc370b5 Compare February 26, 2025 10:36
@Altinn Altinn deleted a comment from github-actions bot Feb 26, 2025
@oskogstad oskogstad force-pushed the ci/add-reminder-for-swagger-refitter-change-mismatch branch 3 times, most recently from d8b1702 to 32505dd Compare February 26, 2025 10:44
@Altinn Altinn deleted a comment from github-actions bot Feb 26, 2025
Copy link
Contributor

🤖 The OpenAPI spec has changed, but the WebAPI Refitter interface has not.

Did you forget to rebuild the WebAPI SDK?
If not, carry on! 🚀

@oskogstad oskogstad force-pushed the ci/add-reminder-for-swagger-refitter-change-mismatch branch from 32505dd to 774ddf3 Compare February 26, 2025 10:46
@MagnusSandgren
Copy link
Collaborator

Har vi ikke en test på dette?

@oskogstad
Copy link
Collaborator Author

Har vi ikke en test på dette?

Hmm, nei? 👀
Jeg kan endre på en DTO-description => swagger-test feiler => oppdater swagger => alle tester ✅
Uten at refitter er oppdatert

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