Skip to content

feat(search): match docker image tags by property (prop:KEY=VALUE) - #469

Merged
M0Rf30 merged 2 commits into
openartifact:mainfrom
orcamedia:feat/search-prop-docker
Nov 11, 2026
Merged

M0Rf30 merged 2 commits into
openartifact:mainfrom
orcamedia:feat/search-prop-docker

Conversation

@orcamedia

Copy link
Copy Markdown
Contributor

Follow-up to #466 and #467: prop:KEY=VALUE now matches docker image tags as well as files.

Why the ids line up

  • The web UI stores properties under primaryFile(entry).id, the id of the row in the package listing.
  • For docker, that listing row is dockerBranch in internal/database/catalog_branches.go, and its id is t.id, i.e. docker_tags.id.
  • The docker search row (dockerSearchBranch) uses the same id, dt.id.
  • UpsertDockerTag is ON CONFLICT ... DO UPDATE, so pushing a tag again keeps its id, and properties stay attached.

Change

  • The s.format <> 'docker' exclusion is gone.
  • The id-array shape (matchedArtifacts, formerly matchedFiles) has a docker_tags half. It joins on the same repository and uses the lowercase UUID match from fix(search): consistent UUID match and single planning for prop filters #467. The outer s.id = ANY(...) probes docker_tags_pkey.
  • The EXISTS shape needed no change: it already compares s.id::text with the stored path.
  • Docs:

Tests

  • Fixture: newPropWorld gains a docker repository d with:
  • Results: the TestSearchByProperty cases cover both shapes.
  • Plans (TestPropFilterPlans):
    • The id-array case now also requires docker_tags_pkey.
    • Adding the docker rows to a world of about a dozen rows flipped both plans. On tables that small, any index order costs about the same. The plan test now adds 2000 filler files, tags and properties first; this costs about 3 s.
    • The EXISTS case used to assert "Nested Loop Semi Join, never Hash Semi Join" with a broad filter and no other filter. That only held on the tiny fixture. On the 300k probe database, main also plans a Parallel Hash Semi Join for that query. The case now asserts the property the EXISTS shape exists for: with a selective name, matches are probed per row (Nested Loop Semi Join).

EXPLAIN ANALYZE on the 300k-file probe database (every file tagged) with 100k tagged docker tags added:

EXISTS query main (docker excluded) this PR
status=approved 92-104 ms 66-77 ms
status=approved + selective name 0.3 ms 4.6-7 ms (it now also finds the matching docker tag)
format:docker status=approved (excluded) 48-52 ms

Not in this PR

The per-repository GET .../artifacts/search still names only file ids. A docker tag id comes back with just artifact_id, as documented under "Any other id". Naming tags there would be a separate change.

Checks

  • golangci-lint run passes, with and without -tags integration.
  • go test -short passes for internal/{search,api,mcp}.
  • -tags integration ./internal/search passes three times in a row (-count=3).
  • make docs-check passes.
  • The -tags noai,nomcp build passes.

🤖 Generated with Claude Code

orcamedia and others added 2 commits November 11, 2026 16:02
The web UI stores a docker tag's properties under the id of the tag's row
in the package listing (catalog dockerBranch: t.id), which is docker_tags.id,
the id of the docker search row. The tag upsert keeps that id when the tag
is pushed again. Drop the s.format <> 'docker' exclusion and add a
docker_tags half to the id-array shape (matchedArtifacts), joined on the
same repository with the lowercase UUID match of openartifact#467; the EXISTS shape
already compares s.id::text.

Tests: a docker repository in the prop world (a tagged tag, a deleted tag,
a tag id stored in another repository, an upper-case stored id), both
shapes. The plan test gets 2000 filler files, tags and properties so it is
costed over more than a dozen rows; the EXISTS case now asserts the
per-row probe with a selective name. With the whole table tagged the
planner picks a hash semi-join on main too (300k files: 92-104 ms on main,
66-77 ms with 100k tagged docker tags added).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@M0Rf30
M0Rf30 merged commit a1ba8e8 into openartifact:main Nov 11, 2026
23 checks passed
@orcamedia
orcamedia deleted the feat/search-prop-docker branch November 11, 2026 18:00
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.

2 participants