Repository navigation
[pending DataSpaceBackend#52] test(api): SDK GraphQL query field names match live schema - #185
Draft
saqibmanan wants to merge 1 commit into
Draft
saqibmanan wants to merge 1 commit into
saqibmanan wants to merge 1 commit into
Conversation
…kend#52) Pending: covers open CivicDataLab/DataSpaceBackend#52 (head 97260a8). Skipped in CI until it merges. Safe to merge before it. dataspace_sdk's aimodel/dataset GraphQL query strings use field names that do not exist on the live schema (aiModel/dataset instead of getAiModel/getDataset). #52 fixes this. These tests send the PR's exact new query text to the live dev endpoint and assert it is schema-valid.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pending: covers open CivicDataLab/DataSpaceBackend#52 (head
97260a83054054f555dfed822d294c12fb7ebc44), "Dataspace sdk" — "Corrected the get ai model graphql query in sdk", open since 2025-12-16, basedev. Skipped in CI until it merges. Safe to merge before it.What the source PR actually changes
dataspace_sdk/is a Python client SDK that lives inside the DataSpaceBackend repo (not a separately deployed service).dataspace_sdk/resources/aimodels.pyanddatasets.pyhardcode GraphQL query strings. The real diff (not just the title) is:aiModel(id: $id)→getAiModel(modelId: $id)(also dropsendpoints.name, which isn't a real field)dataset(id: $id)→getDataset(datasetId: $id),createdAt/updatedAt→created/modified,resources.title→resources.name,resources.fileDetails/resources.schemafrom scalars to objects ({ format }/{ fieldName })Confirmed live on the real dev schema right now, independent of this PR merging (the backend already has these fields — this PR only fixes the SDK's hardcoded query text to match):
Why
pending_pr, and why notreadonlyNothing is deployed anywhere when this SDK PR merges — it's a client library, not a server. There is no server-side "before" vs "after" to point at (the schema itself doesn't change). What's gated by
pending_pris the query text, which only exists in the DataSpaceBackend repo once #52 merges — the schema-validity check itself is already true today, independent of the merge. Notreadonly: that marker is for the merged-PR prod-safety gate (§7), unrelated to this pending-PR gate (§9).Categories
api+smokeon/api/graphql(anonymous POST, structural/schema validation only — no mutation, no real record touched). A nonexistent id is used deliberately in both tests so this checks field names on the schema, never a specific record.Tests added
test_sdk_aimodel_query_matches_live_schema— sends PR#52's exact new AI-model query text (copied verbatim from the diff) and asserts no"Cannot query field"error.test_sdk_dataset_query_matches_live_schema— same, for the new dataset query.Proof (pasted)
Precondition, confirmed:
git show origin/CI:conftest.py | grep _pending_pr_statefinds the hook.Marker present, PR not merged — SKIPPED with the correct reason:
Collected under CI's real marker filter:
Green — marker temporarily removed, run against the live dev schema with the PR's new query text:
Red — same run, with the query text swapped for the exact old (pre-fix) field names, marker still removed:
Both fail at the intended assertion, confirming this methodology genuinely catches the bug #52 fixes.
Gaps / notes for the reviewer
DatasetsResource.get_by_id()still doesresponse.get("data", {}).get("dataset", {})after the fix — but the field is nowgetDataset, notdataset, so even with the corrected query text, that line will always return{}. This looks like a residual bug in fix: scope SDG Goals and Geography locators to combobox role #52 itself that this coverage cannot catch (it would need to import and execute the actualdataspace_sdkpackage, which isn't a dependency of this test repo). Flagging for the PR author/reviewer, not fixing it here.-rsand confirm the summary shows2 passed, not skips (the usual "skipped is not passed" check).