Skip to content

Products endpoint returns multiple versions of the same LID in a single queryΒ #788

Description

@jordanpadams

Checked for duplicates

Yes - I've already checked

πŸ› Describe the bug

The /products endpoint returns multiple versions of the same LID in a single query result, even when no version filter is applied. This is unexpected β€” callers querying for context products generally expect to receive the latest version of each LID, not all historical versions.

πŸ“œ To Reproduce

The following query returns two versions of urn:nasa:pds:context:facility:laboratory.relab (::1.0 and ::1.1):

https://pds.mcp.nasa.gov/api/search/1/products?q=(lid%20eq%20%22urn:nasa:pds:context:facility:laboratory.relab%22)

A broader query for all Product_Context products reveals 9 LIDs with multiple versions returned:

LID Versions returned
urn:nasa:pds:context:facility:laboratory.relab 1.0, 1.1
urn:nasa:pds:context:instrument:relab.bd-vnir 1.0, 1.2
urn:nasa:pds:context:instrument:relab.bc-ftir1 1.0, 1.2
urn:nasa:pds:context:instrument:relab.bcf-ftir2 1.0, 1.2
urn:nasa:pds:context:investigation:other_investigation.relab_speclib 1.0, 2.1
urn:esa:psa:context:instrument_host:spacecraft.vex 1.1, 1.2
urn:esa:psa:context:investigation:mission.venus_express 1.1, 1.1 (same LIDVID from two nodes)
urn:esa:psa:context:instrument:vex.mag 1.2, 1.2 (same LIDVID from two nodes)
urn:esa:psa:context:instrument:vex.virtis 1.2, 1.2 (same LIDVID from two nodes)

The last three (vex.mag, vex.virtis, mission.venus_express) are particularly concerning β€” the exact same LIDVID appears twice, harvested from two different registry nodes (PDS_ENG and PSA).

This was discovered while investigating a downstream bug in the validate tool (NASA-PDS/validate#1632), where validate -u downloads all context products and the presence of older versions alongside newer ones causes false context_ref_mismatch warnings for users with valid labels.

πŸ•΅οΈ Expected behavior

A query for Product_Context products should return at most one entry per LID β€” either the latest version only, or deduplicate exact-LIDVID duplicates arising from multi-node harvesting.

πŸ–₯ Environment Info

Production API: https://pds.mcp.nasa.gov/api/search/1/

πŸ“š Version of Software Used

PDS Search API (production)

🩺 Additional context

  • The ops:Provenance.ops:superseded_by field on all returned products is set to the string "null" β€” even on genuinely superseded older versions β€” so there is currently no way for API clients to filter out old versions server-side.
  • A latest-only endpoint (/products/latest) returns HTTP 404.
  • Adding version/latest filters to the q= parameter returns HTTP 400.

πŸ€– Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions