Skip to content

fix: send package-search sorts the API accepts; download a small dataset in e2e - #65

Merged
krynju merged 1 commit into
mainfrom
kr/package-search-sorts-dataset-pick
Oct 12, 2026
Merged

krynju merged 1 commit into
mainfrom
kr/package-search-sorts-dataset-pick

Conversation

@krynju

@krynju krynju commented Oct 9, 2026

Copy link
Copy Markdown
Member

What's wrong

  1. jh package search gets a 400. The CLI sends a name tiebreak as sorts[1]=name. The packages API's Sorts schema requires every key to carry a direction sign (^[+-].+$), so the unsigned key is rejected:
    schema validation failed while decoding query parameter sorts /1: pattern
    
  2. TestDatasetDownloadFirst can time out. It downloads the first Blob in jh dataset list. On a shared instance that can be a large blob left behind by another suite (around 1 GB), which takes longer than the command timeout to download.

What this changes

  • buildPackagesInfoQuery sends -name as the tiebreak. The tiebreak only exists to keep paging stable (packages of one repository share a score), so its direction doesn't matter. TestBuildPackagesInfoQuery now also checks every sorts[i] value against the API's pattern.
  • The download test picks the smallest uploaded Blob whose listed size is between 1 byte and 20 MiB, and skips with a clear message when there is none. New helpers smallestIDOfType and datasetEntriesOfType in e2e/helpers_test.go. firstIDOfType keeps its behaviour for the status tests. New TestSmallestIDOfType is a pure parsing test.

Testing

  • make check passes: gofmt, go vet with and without the e2e tag, unit tests, e2e compile.
  • go test -tags e2e -run 'TestFirstIDOfType|TestSmallestIDOfType' ./e2e/ passes.
  • The live e2e suite wasn't run locally. One assumption: jh dataset list prints every dataset; if it ever paginates, the smallest Blob on the first page is used.

🤖 Generated with Claude Code

…set in e2e

`jh package search` sent `sorts[1]=name` as its tiebreak. The packages API
requires every sort key to carry a direction sign (`^[+-].+$`) and rejects
the unsigned key with a 400. Send `-name`: any fixed direction keeps paging
stable, and the signed form is accepted.

TestDatasetDownloadFirst downloaded the first Blob listed, which on a shared
instance can be a large blob left by another suite and outlast the command
timeout. It now downloads the smallest uploaded Blob whose listed size is at
most 20 MiB, and skips with a clear message when there is none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@krynju
krynju marked this pull request as ready for review October 9, 2026 14:27
@krynju
krynju requested a review from a team October 9, 2026 14:27
@krynju
krynju merged commit 4dc8f6a into main Oct 12, 2026
1 check passed
@krynju
krynju deleted the kr/package-search-sorts-dataset-pick branch October 12, 2026 09:04
pankgeorg added a commit that referenced this pull request Oct 14, 2026
* fix(packages): use /api/v1/ui/packages/info for package search and name lookup

`jh package search`, `jh search packages`, `jh package info` and every
`--package <name>` lookup called `/packages/info`, which current JuliaHub
does not route: the request falls through to the git `/packages/` handler
and returns 404. The GraphQL fallback is then refused ("query is not
allowed"), so all of these failed.

Call the web UI's package listing, `/api/v1/ui/packages/info`, instead. It
pages with `pagination[page]`/`pagination[per_page]` (at most 100 per page)
rather than limit/offset, so map the CLI's `--limit`/`--offset` window onto
the covering pages (`planRESTPages`). Order by relevance (`-score`) when a
search term is given, by stars otherwise, and always break ties by name:
packages from one repository share a score, and without a tiebreak their
order changes between requests, so consecutive pages could repeat or skip
rows.

* fix(packages): find a package's registry via the REST listing in `jh package dependency`

Without `--registry`, `jh package dependency <name>` looked the package's
registry up through the GraphQL package search only, which current JuliaHub
refuses ("query is not allowed"), so the command failed. Look it up in the
REST package listing first (`findPackageRegistry`) and keep GraphQL as the
fallback, reporting both errors if both fail.

* fix(packages): send package-search sorts the API accepts

The packages API's `Sorts` schema requires every key to carry a direction
sign (`^[+-].+$`), so the unsigned `sorts[1]=name` tiebreak was rejected with
a 400. Send `-name` instead.

Package changes of #65 (7ad14d9), without its e2e changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: `jh package dependents <package-name>` lists reverse dependencies

The docs pkg.json that `jh package dependency` already reads also carries
`reversedeps`. `dependents` prints the direct, indirect and total counts and
lists the direct dependents; `--indirect` lists the indirect ones too.
`--registry` and `--server` work as for `dependency`.

A dependent can appear in `reversedeps` once as direct and once as indirect,
so entries are collapsed to one per UUID (direct wins), which matches the
count on JuliaHub's "Dependents" badge.

The pkg.json fetch moves into `fetchPackageDocs`, shared by both commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: tan <tanmaykm@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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