Skip to content

feat: deep field selection for GET /modelconfigurations/{id}#7

Merged
mosoriob merged 9 commits into
mainfrom
feat/modelconfig-deep-read
May 10, 2026
Merged

feat: deep field selection for GET /modelconfigurations/{id}#7
mosoriob merged 9 commits into
mainfrom
feat/modelconfig-deep-read

Conversation

@mosoriob
Copy link
Copy Markdown
Contributor

Summary

  • Adds a deep field-selection mode so GET /modelconfigurations/{id} returns the full Config tree (inputs/outputs with their variable_presentation + standard_variable + unit, parameters, regions, authors, grid, dimensionality, software_image) in a single read.
  • List endpoints stay lean (existing shallow selection unchanged).
  • Preserves the isOptional hoist on dataset_specification and elides empty arrays.

Design + plan

  • Spec: docs/superpowers/specs/2026-05-10-modelconfig-deep-read-design.md
  • Plan: docs/superpowers/plans/2026-05-10-modelconfig-deep-read.md

(Both live in the monorepo on branch feat/modelconfig-deep-read.)

Verification

  • npm test — 120 pass / 38 skip
  • npm run test:e2e — 19/19 pass (covers deep tree, isOptional hoist, list-stays-lean, empty-array elision)
  • npm run build — clean

Follow-up

  • Notebook cell 73002499 update (mint-client deep-read example) lands as a separate follow-up commit.

Test plan

  • CI green on npm test, npm run test:e2e, npm run build
  • Manual smoke: POST modelconfiguration with 5 inputs x 5 outputs x 1 VP, GET by id, confirm deep tree returns
  • Verify Hasura non-admin role permits SELECT on modelcatalog_dataset_specification_presentation and modelcatalog_variable_presentation

mosoriob added 8 commits May 10, 2026 13:52
Adds FIELD_SELECTIONS_BY_ID map (empty) and extends getFieldSelection with a
'list' | 'byId' mode. Default 'list' preserves all existing call sites; 'byId'
returns the deep variant when present, else falls back to FIELD_SELECTIONS.
… by-id

Adds FIELD_SELECTIONS_BY_ID.modelcatalog_configuration with presentations
nested under inputs.input and outputs.output. Mirror anchor comment added
to FIELD_SELECTIONS.modelcatalog_dataset_specification to flag the
duplicated VP selection. List path unchanged (default mode='list').
service.ts:183 now requests mode='byId' from getFieldSelection. List path
(line 123) keeps default mode='list'. End-to-end coverage in
read-shape-deep-e2e.test.ts.
GET /v2.0.0/modelconfigurations/{id} returns the full
Config → DataSetSpec → VariablePresentation tree in one round trip.
Asserts VP id/label/hasShortName surface; standardVariable/unit absent
(depth-2 cap).
bug-082 class regression check — adding nested hasPresentation under
inputs.input does not regress the is_optional → isOptional scalar hoist
in response.ts:104-122.
GET /v2.0.0/modelconfigurations (list) keeps the shallow input shape —
hasPresentation absent. Confirms divergence between list and by-id
field selection.
Config with zero inputs/outputs returns no hasInput/hasOutput keys
(response.ts:95). Confirms the deep read does not introduce empty arrays
that would diverge from v1.8.0 client contract.
…m handlers

GET /resources/{id} and DELETE /resources/{id} previously rejected bare
slug paths with 400 "Resource ID must be a full URL-encoded URI",
forcing callers to URL-encode the full https://w3id.org/okn/i/mint/<id>.
Now both paths resolve fullId = isFullUri(id) ? id : `${idPrefix}${id}`,
mirroring the existing PUT update behavior.

custom-handlers.ts: replaced strict requireFullUri (reject) with
resolveResourceId (prepend resource idPrefix). Applied at all 5 call
sites covering custom_configurationsetups_id_get,
custom_modelconfigurationsetups_id_get,
custom_modelconfigurations_id_get,
custom_datasetspecifications_get configurationid, and
custom_configuration_id_inputs_get.

PUT path switched from raw startsWith('https://') to isFullUri for
http:// parity. Flipped 3 unit tests that asserted 400 to assert the
prepended URI is forwarded to Hasura.
@mosoriob mosoriob merged commit 11c2b6d into main May 10, 2026
6 checks passed
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.

1 participant