Repository navigation
feat(properties): resolve property search ids to their files - #453
Merged
M0Rf30 merged 2 commits intoNov 9, 2026
Merged
Conversation
GET /api/v1/repositories/{repo}/artifacts/search answered only
{"artifact_ids": [...]}, so a client had to list the repository's packages
to tell what matched. It now also returns "artifacts": the same ids, each
with the name, version and format of the package version it names when the
id is the id of a live file of the same repository (package_files.id, the
listing item id the web UI and oa store properties under). Other ids keep
only artifact_id. artifact_ids is unchanged.
The ids are resolved in the search query itself, with one LEFT JOIN of
package_files, package_versions and packages. Only text shaped like a UUID
is cast, so external ids never reach the cast and the lookup stays on the
primary key. Files of other repositories and deleted files do not resolve.
oa props search gains a NAME column; its JSON output stays the list of ids.
OpenAPI, the generated web client and reference docs, and
docs/repositories/properties.md are updated.
Closes openartifact#444
Co-Authored-By: Claude Opus 5.5 <[email protected]>
M0Rf30
requested changes
Nov 9, 2026
M0Rf30
left a comment
Collaborator
There was a problem hiding this comment.
Thanks, the SQL and the response shape look right (UUID guard, same-repository join, deleted file and version left unresolved, empty lists not null, artifact_ids unchanged). One change before merging:
PropertyMatch.Resolved()(internal/database/models/property.go:20) is only called fromproperty_search_integration_test.go. AGENTS.md: code only tests call doesn't go in a production file. Either inlinem.Name != nilin the test and drop the method, or use it inPropertyStore.SearchByProperty/ the handler.
Minor, no change needed: the text table of oa props search gains a NAME column, so anyone parsing it line by line sees a change; worth a line in the upgrade notes.
Only the integration test called it; it now checks Name directly. Add an upgrade note for the NAME column of oa props search and the new artifacts field. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
Thanks! Done: |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #444, in the shape agreed there.
GET /api/v1/repositories/{repo}/artifacts/searchnow answers with an additiveartifactslist next to the unchangedartifact_ids:{ "artifact_ids": ["0b7e5c2a-3f1d-4c8e-9a6b-1d2e3f4a5b6c", "build-482"], "artifacts": [ {"artifact_id": "0b7e5c2a-3f1d-4c8e-9a6b-1d2e3f4a5b6c", "name": "landing/v2/index.html", "version": "", "format": "raw"}, {"artifact_id": "build-482"} ] }How ids are resolved
In the search query itself (
SearchByPropertyininternal/database/queries/properties.sql): oneLEFT JOINofpackage_files→package_versions→packageson the search result, no lookup per id and no package listing.package_files.id, what the web UI stores viaprimaryFile(entry).id).CASE WHEN … ~* uuid-pattern THEN ::uuid END), so external ids never reach the cast and the join stays on the primary key.deleted_aton the file or its version) and anything else stay{"artifact_id": …}. HTTP paths are not matched, as agreed.Also in this PR
oa props search: newNAMEcolumn. I kept--format jsonas the plain list of ids so scripts that read it keep working. Happy to switch it to theartifactsobjects if you prefer.PropertySearchResultandPropertySearchArtifactschemas on the 200 response; regenerated web client (bun run generate-api), reference docs andopenapi.json.gz(make docs-gen).docs/repositories/properties.md: a "Search results" section, and the Model paragraph now says the web UI uses the id of the version's first file rather than the package id (from your correction on Property search: say which artifact each returned id is #444).PropertyStore.SearchByPropertyreturns[]models.PropertyMatch; the four test doubles follow.Tests
internal/database/property_search_integration_test.go(integration, Postgres): a file id of the repository resolves to name, empty version andraw; unresolved and still listed are an external id (build-482), a file id of another repository, an upper-case UUID that names no file, and a deleted file; the same tag in the other repository doesn't leak in; results are sorted and distinct. I checked it fails when the same-repository condition is removed from the join.internal/api/properties_search_test.go: answer shape, fields omitted for unresolved ids, empty lists rather thannull.internal/oacli/contract_test.go: theNAMEcolumn; the existing ids-only case still passes (older servers).Checked locally on current main (macOS, Postgres 18):
make check,cmd/docgen -check,sqlc diff,bun run typecheck, the unit suite with-raceand the slim (noai,nomcp) suite pass.go test -tags integration ./internal/database/passes exceptTestVulnScanOverviewUsesIndexes, which fails the same way on main here (out of shared memorywhile seedingscan_jobs, also with--shm-size=1g), so it looks specific to Docker on my Mac rather than this change.🤖 Generated with Claude Code