Repository navigation
test(api): cover the new dashboard table queries (DataSpaceBackend#254) - #202
saqibmanan wants to merge 1 commit into
Conversation
Covers useCasesTable, collaborativesTable and aiModelsTable (the new
filterable/sortable/paginated listing queries, built the same way as the
existing datasetsTable) with the anon visibility boundary, a title filter
that genuinely narrows results, and a statusCounts-ignores-the-status-
filter check that avoids the vacuous PUBLISHED-filter case. Also re-ran
the existing datasetsTable coverage against dev to confirm #254's shared
status_counts() refactor didn't regress it. publicationsTable is left
with only a shape check -- dev has zero published Publications to assert
a real invariant against -- documented as a gap in the file and PR body.
Gated with deployed_pr("DataSpaceBackend#254") since the merge hasn't
reached main/prod yet.
|
The failure is No fix exists yet for this that I can port in. Leaving this for a human to look at Generated by Claude Code |
|
Not re-running: same fixed-window reasoning as #200/#201 — an immediate retry would likely just hit the same throttling. Leaving this for a later CI run or a human once the window clears. Generated by Claude Code |
Covers CivicDataLab/DataSpaceBackend#254 (merge commit
3143e405), merged 2026-10-22T15:10:45Z.§0 — merged is not deployed? Checked, it is
GET https://dev.api.civicdataspace.in/health/currently answersgit_sha: 3143e40564d4f381dffef764135ab1fd7b691b2c— exactly #254's own merge commit. Confirmed live on dev, no rollback.What actually changed (from the diff, not the title)
Four new GraphQL queries —
useCasesTable,collaborativesTable,aiModelsTable,publicationsTable— built the same way as the existingdatasetsTable(#215): filters, sort options, pagination, and astatusCountsfield for tab labels. All four are additive next to their existing plain queries (useCases,collaboratives,aiModels,publications), which are untouched. The PR's second commit also refactorsdatasetsTable's inline status-counting into a sharedstatus_counts()helper (api/utils/qs_utils.py), now used by all five table queries.Confirmed directly against the diff (
api/schema/{usecase,collaborative,aimodel,publication}_schema.py,api/utils/qs_utils.py), not the PR title/description.Category chosen:
api+smoke(+functional/regressionper test, same split astest_api_013_datasets_table.py)Pure GraphQL schema/resolver change, no UI surface. Mirrors the exact category split the sibling
datasetsTablefile already uses in this repo.Existing coverage re-run first (§3: check the changed paths' existing tests)
Because this PR touches shared helper code, I re-ran the existing
test_api_013_datasets_table.py(unchanged) against dev before writing anything new:The
status_counts()extraction didn't regress the existing query.Test added
tests/api/smoke/test_api_029_listing_tables.py, reusinganon_graphql_client(no new fixtures):includePublicstatusCounts is{"PUBLISHED"}only. A real finding while writing this: unlikedatasetsTable, omittingincludePublicdoes not return zero rows here —_visible_use_cases/_visible_collaborativesalready fall back to the PUBLISHED-only queryset for an anonymous caller regardless of the flag (the PR body says this explicitly: "This differs from datasetsTable, which returns nothing here"). My first draft assumed the datasetsTable shape and asserted 0 rows — it failed on real data (132/106 rows came back), so I rewrote it to assert the actual, intended invariant:includePublicmust not change anon's result at all. Live before/after check is in the test's docstring.is_public=True, is_active=True(boolean flags), not thestatusenum, so live data on dev legitimately shows bothACTIVEandREGISTEREDrows as "public". Asserting single-status here would have been a test written against a wrong assumption, not the real contract — confirmed on live data (105 ACTIVE + 24 REGISTERED) before deciding not to write it.title/display_nameicontainsfilters checked to produce0 < filtered < totalon live data (use cases: "testing" → 1 of 132; collaboratives: "test collab" → 10 of 106; AI models: "New AI Model" → 114 of 129) — not<=, per SKILL.md §5's "flipping is not enough" guidance.aiModelsTableacceptsdisplay_name(the model field) and rejects the GraphQL-caseddisplayName, naming the allowed fields — same allowlist mechanismtest_api_013's unknown-field test guards, checked bidirectionally on live data.test_api_013's equivalent, filtering onDRAFT(notPUBLISHED, which is a no-op for an anon caller and would have been a vacuous check per SKILL.md §5).publicationsTable— documented gap, not faked coverage: dev currently has zero published Publications ({ publications { id } }→[]), so there's no live data to assert a visibility or filtering invariant against. The one test here only checks the query doesn't error and returns a consistent empty shape; it's explicitly marked in its docstring as not real regression coverage, with instructions to extend it once a Publication exists on dev.Gating:
deployed_pr, not plainreadonly#254 is not yet on
main(verified:git merge-base --is-ancestor 3143e40564d4f381dffef764135ab1fd7b691b2c origin/mainfails in DataSpaceBackend).readonly+deployed_pr("DataSpaceBackend#254"), same pattern as #250/#223/#245/#215.Proof (red → green), pasted below
Collection, under both of CI's real marker filters:
Green — against dev, all 10 new tests + the 6 existing datasetsTable tests:
Correctly skips against prod (marker in place):
(6 skip lines — one per distinct call site; parametrized tests share a line.)
Red — flipped assertions, both reverted before commit, never pushed:
statuses == {"PUBLISHED"}→!=, and the includePublic-no-op equality →!=:filters:argument (reused the unfiltered total as the "filtered" result, exactly what an ignored-filter resolver would produce), run standalone (not shipped):Confirms the assertion (
0 < filtered < total, never<=) genuinely depends on the filter being applied.All failures land at the intended assertion, not a setup/fixture error.
Also assessed in this run, no tests added
Gaps
publicationsTablehas no real invariant coverage — see above. Extendtest_publications_table_gap_no_published_rows_on_dev(or add siblings next to it, same pattern as the use-case/collaborative tests) once a Publication is published on dev.sortOptions) isn't covered for any of the four queries — out of scope for this pass;datasetsTable's own test file doesn't cover it either.TEST_EMAIL_1/TEST_PASSWORD_1(and ideally an org-scoped account) should extend this file to cover those branches, same waytest_api_013's org-visibility cases would need to be.Housekeeping
test-sync/DataSpaceBackend-pr254, based onorigin/CI.test-sync/DataSpaceBackend-pr254branch, no test-repo PR mentioningDataSpaceBackend#254.test_api_029_*(free onorigin/CI; a sibling in-flight PR from this same run claimed 028 forDataSpaceBackend#249, pending).Run context: scheduled cloud routine, no test credentials in this environment. Everything above except the authenticated-visibility gap was actually executed (unauthenticated, read-only).