Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneeshammz

Relationships

#2122 Data queries read unrelated artifact bodies before metadata filters reject them

Opened by hammz · 9/13/2026· Shipped 9/16/2026

Description

A query that combines a metadata filter with an attributes predicate reads artifact bodies before evaluating the metadata filter. Unrelated artifacts therefore add I/O and parsing work, and an unreadable unrelated body can fail a query whose matching data is readable.

Reproduction scenario

  1. Populate the catalog with many current JSON artifacts whose specName is report, plus one current artifact whose specName is question and whose body is {"value": 1}.
  2. Query using the metadata-plus-attributes predicate:
swamp data query 'specName == "question" && attributes.value > 0' --json
  1. Trace content reads. To expose the failure case, make one unrelated report body unreadable while its catalog metadata remains available.

Actual behavior

DataQueryService.executeQuery() detects attributes/content references across the whole filter and projection, then calls rowToRecord() with hydration enabled before running the CEL predicate. fromRow() in src/domain/data/data_record_mapper.ts calls getContentSync() at that point.

The current SQL pushdown handles latest-version and simple model-name filtering, so the specName condition in this example does not exclude the unrelated rows before hydration. Their bodies are read even though the first predicate term rejects them. A thrown content-read error occurs before predicate evaluation and can abort the query. Attribute access required only by a projection or forced result hydration can also trigger unnecessary reads before matching.

Expected behavior

Metadata-rejected rows do not require body reads. Evaluation, projections, and returned records load content only when they actually need it. Errors from required reads remain visible, and successive queries see fresh content.

Suggested fix direction

Defer attributes/content hydration until evaluation accesses those fields or a matching returned record needs them. Preserve JSON content/attributes aliasing, projection and loadAttributes behavior, and existing stale-row handling. Do not turn required read failures into silently skipped rows.

Evidence and scope

Inspected swamp core source at revision 7b111963. The reproduction scenario and actual behavior below are derived from source inspection; no released binary or end-to-end reproduction was tested for this report.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 19 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

9/16/2026, 9:00:44 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
hammz assigned hammz9/16/2026, 4:37:11 PM

Sign in to post a ripple.