Skip to content

feat: breaking changes detection against the backend server (HEXA-1238)#260

Merged
nazarfil merged 33 commits into
mainfrom
HEXA-1238-implement-sdk-version-compatibility-check-system-breaking-changes-detection
May 20, 2025
Merged

feat: breaking changes detection against the backend server (HEXA-1238)#260
nazarfil merged 33 commits into
mainfrom
HEXA-1238-implement-sdk-version-compatibility-check-system-breaking-changes-detection

Conversation

@yolanfery

Copy link
Copy Markdown
Contributor

We have had many issue caused by discrepancies between the SDK and the backend. This PR is about introducing a comparison between the backend GraphQL Schema and the one used by the SDK. A warning is shown when breaking changes are detected.

Changes

  • Instrument find_breaking_changes from graphql-core to find breaking changes between a local version of the schema and the one used by the backend.
  • Cache the result on the disk for 1 hour
  • Unit tests to cover breaking change detection and the caching

Screenshots / screencast

Screenshot 2025-05-12 at 10 06 24

@yolanfery yolanfery self-assigned this May 12, 2025
Comment thread openhexa/cli/api.py Outdated
Comment on lines +158 to +162
last_checked = get_last_checked()
current_time = time.time()
if not last_checked or (current_time - last_checked) >= _COOLDOWN_PERIOD:
detect_graphql_breaking_changes(token)
update_last_checked()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not totally convinced myself on the caching on the disk. WDYT ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mmm me neither. I'd prefer to store this in the config of the user (where we store the workspaces and the token)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok I agree, will do the change

Comment thread openhexa/cli/api.py Outdated
Comment on lines +158 to +162
last_checked = get_last_checked()
current_time = time.time()
if not last_checked or (current_time - last_checked) >= _COOLDOWN_PERIOD:
detect_graphql_breaking_changes(token)
update_last_checked()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mmm me neither. I'd prefer to store this in the config of the user (where we store the workspaces and the token)

Comment thread openhexa/cli/api.py Outdated
click.echo(click.style(f"- {change.description}", fg="yellow"))
click.echo(click.style("This could lead to unexpected results.", fg="red"))
click.echo(
click.style(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you give an example of command to update the openhexa.sdk package to the user as well please ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea, thanks

@nazarfil

Copy link
Copy Markdown

To test it I for example removed query param search from pipeline query in sdk, reinstalled sdk in venv, and then tried to push the pipeline to my OH instance locally , expected behavior is for the push to fail with the waring message as in example?

@nazarfil

nazarfil commented May 20, 2025

Copy link
Copy Markdown

To test it I for example removed query param search from pipeline query in sdk, reinstalled sdk in venv, and then tried to push the pipeline to my OH instance locally , expected behavior is for the push to fail with the waring message as in example?

  • as it detects breaking changes on backend side, only new field in sdk, or less fields in backend will trigger the warning

@nazarfil nazarfil merged commit 316feef into main May 20, 2025
4 checks passed
@nazarfil nazarfil deleted the HEXA-1238-implement-sdk-version-compatibility-check-system-breaking-changes-detection branch May 20, 2025 07:17
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.

3 participants