diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 0000000..e941215 --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,57 @@ +# yaml-language-server: $schema=https://www.coderabbit.ai/integrations/schema.v2.json +tone_instructions: >- + Terse. State the defect, the input that triggers it, and the smallest fix. + No praise, no emoji, no restating the diff. +reviews: + profile: chill + high_level_summary: true + high_level_summary_in_walkthrough: true + in_progress_fortune: false + suggested_reviewers: false + suggested_labels: false + auto_review: + ignore_title_keywords: + - "chore: release" + ignore_usernames: + - lmarkmann-release[bot] + - renovate[bot] + pre_merge_checks: + docstrings: + mode: "off" + path_filters: + - "!src/**" + - "!tests/fixtures/**" + - "!proptest-regressions/**" + - "!Cargo.lock" + - "!docs/CHANGELOG.md" + path_instructions: + - path: "src/**/*.rs" + instructions: | + Cargo.toml denies println!, eprintln!, unwrap, expect, panic!, indexing, unchecked arithmetic and process::exit outside tests. Flag any new allow() for these; the fix is .get(), checked_/saturating_ arithmetic, or a local #[expect(..., reason = "...")] when the invariant is real. + stdout is data and goes only through src/output.rs; narration, spinners and warnings go through src/ui.rs on stderr. + Errors are thiserror types whose message ends with a "Try:" recovery hint; report() in src/lib.rs appends the cause chain, so a message that also interpolates {source} prints it twice. + Every color comes from a role in src/palette.rs. + API keys come from the environment or credentials.toml, never from flags, and must never reach a URL, error message or log line (ADR 0009). + The cache is best effort and must never fail a search (ADR 0007). + - path: "src/sources/**" + instructions: | + Each adapter splits its request from a pure parse function, and each parse has a test against a recorded response in tests/fixtures/sources/. A new source is one SOURCES row in src/sources.rs, at most one module here, a fixture, a parse test, and its row in the ADR 0004 table. Protocol adapters (CKAN, Dataverse, NADA, Socrata, STAC, SDMX, EBI) are configured per row, not copied (ADR 0005). + - path: "src/cli.rs" + instructions: | + The doc comments here are the --help text and are user-visible; a change must come with an updated snapshot in tests/snapshots/ and a matching docs/reference/contract.md when a flag or output changes. + - path: "src/dedup.rs" + instructions: | + Ranking changes are measured offline by `just relevance` against judged queries; a change to scoring or merge order without a relevance result is unmeasured. + - path: "tests/**" + instructions: | + No test touches the network. Expected values in parse tests come from reading the fixture, not from the code's own output. + - path: ".github/workflows/**" + instructions: | + Actions are pinned by commit SHA, workflows start from `permissions: {}` and grant per job, and zizmor runs in CI. +knowledge_base: + code_guidelines: + filePatterns: + - CONTRIBUTING.md + - docs/reference/development.md + - docs/reference/contract.md + - docs/adr/*.md diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8e59bdc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,27 @@ +# https://editorconfig.org +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.rs] +indent_style = space +indent_size = 4 +# Matches max_width in rustfmt.toml, so the editor ruler and the gate agree. +max_line_length = 79 + +[*.{toml,md,yml,yaml,json}] +indent_style = space +indent_size = 2 + +[justfile] +indent_style = space +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false +# Prose is one line per paragraph; an editor hard-wrapping it would fight that. +max_line_length = off diff --git a/.github/pr-template.md b/.github/pr-template.md new file mode 100644 index 0000000..cd4d9be --- /dev/null +++ b/.github/pr-template.md @@ -0,0 +1,15 @@ +## Summary + + + +## Release line + + + +## Checklist + +- [ ] `just ci` passes +- [ ] Tests cover the change; a new or changed adapter has a `parse` test against a recorded fixture +- [ ] Changed snapshots were stepped through with `just review` +- [ ] Docs are current: `docs/reference/contract.md` for flags or output, an ADR for a decision, ADR 0004 and `docs/synthesis/terms.md` for a new source +- [ ] Re-recorded fixtures are trimmed, carry no key, and have every personal e-mail address replaced diff --git a/.github/release-plz.toml b/.github/release-plz.toml new file mode 100644 index 0000000..1baba5e --- /dev/null +++ b/.github/release-plz.toml @@ -0,0 +1,55 @@ +[workspace] +changelog_update = true +git_tag_enable = true +git_release_enable = true +git_release_type = "auto" +git_release_body = "{{ changelog }}" +release_commits = "^(feat|fix|perf|refactor)" +features_always_increment_minor = true +semver_check = false +release_always = false +pr_name = "chore: release{% if version %} v{{ version }}{% endif %}" +pr_body = """ +{% for release in releases %}{{ release.package }}: {{ release.previous_version }} -> {{ release.next_version }} +{% if release.changelog %} +{{ release.changelog }} +{% endif %}{% endfor -%} +""" + +[[package]] +name = "dataseek" +changelog_path = "docs/CHANGELOG.md" + +[changelog] +header = """# Changelog + +What shipped, newest first. release-plz writes each section from the conventional commits merged since the previous tag; see [`reference/release.md`](reference/release.md). +""" +body = """ +## {{ version }} - {{ timestamp | date(format="%Y-%m-%d") }} +{% for group, commits in commits | group_by(attribute="group") %} +### {{ group | upper_first }} +{% for commit in commits %} +- {% if commit.breaking %}Breaking: {% endif %}{{ commit.message | upper_first }}{% endfor %} +{% endfor %} +""" +commit_parsers = [ + # The never-download catalog design, replaced by background downloads + # before 0.9.0 shipped; its lines would describe behavior no release has. + { sha = "fda0c484b114c828eb45f1211be0374f21dc948c", skip = true }, + { sha = "87feb88d7e772bf61d0de28371d2920e080626ab", skip = true }, + { sha = "8f5ffe70db718415153d22132ab14075d04769f1", skip = true }, + { sha = "7a31886df8726dcc357d05b025b9c31d6d74cf82", skip = true }, + { message = "^feat", group = "added" }, + { message = "^fix", group = "fixed" }, + { message = "^perf", group = "performance" }, + { message = "^refactor", group = "changed" }, + { message = "^doc", group = "docs" }, + { message = "^build", group = "other" }, + { message = "^chore\\(release\\)", skip = true }, + { message = "^chore", group = "other" }, + { message = "^test", skip = true }, + { message = "^ci", skip = true }, + { message = "^Merge ", skip = true }, + { message = ".*", group = "uncategorized" }, +] diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..0f8f21f --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended", + "helpers:pinGitHubActionDigests" + ], + "schedule": [ + "before 9am on monday" + ], + "timezone": "Europe/Berlin", + "lockFileMaintenance": { + "enabled": true, + "schedule": [ + "before 9am on monday" + ] + }, + "rangeStrategy": "bump", + "packageRules": [ + { + "matchUpdateTypes": [ + "minor", + "patch" + ], + "matchCurrentVersion": "!/^0/", + "groupName": "non-major dependencies" + }, + { + "matchUpdateTypes": [ + "major" + ], + "groupName": "major dependencies" + }, + { + "matchManagers": [ + "github-actions" + ], + "minimumReleaseAge": "7 days", + "groupName": "actions" + } + ] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b360f9c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,94 @@ +# One Linux job with clippy cross-checks for Windows and macOS: docs/adr/0002-one-linux-ci-job.md. +name: ci + +on: + pull_request: + push: + branches: [main] + merge_group: + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +env: + CARGO_BUILD_WARNINGS: deny + CARGO_TERM_COLOR: always + +jobs: + linux: + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read + steps: + - name: checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: toolchain + run: | + rustup update --no-self-update + rustup toolchain install + - name: cache + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + save-if: ${{ github.ref == 'refs/heads/main' }} + - name: tools + uses: taiki-e/install-action@4cef1412cce204788f482e778a0b9187f9626a29 # v2.87.21 + with: + tool: cargo-nextest,cargo-deny,cargo-shear,typos,zizmor,hyperfine,just,uv + fallback: none + # The CLI tests parse the fish completion script and render the man + # page, and fail on CI when either tool is missing. + - name: fish and mandoc + run: | + sudo apt-get update -qq + sudo apt-get install -y -qq --no-install-recommends fish mandoc + - name: fmt + run: cargo fmt --all --check + - name: typos + run: typos + - name: clippy + run: cargo clippy --workspace --all-targets --all-features --locked + - name: cross-check + run: | + rustup target add x86_64-pc-windows-msvc aarch64-apple-darwin + cargo clippy --all-targets --all-features --locked --target x86_64-pc-windows-msvc + cargo clippy --all-targets --all-features --locked --target aarch64-apple-darwin + - name: test + run: | + cargo nextest run --workspace --all-features --locked + cargo test --doc --workspace --locked + # The merged ranking scored against the committed judgments, offline; + # fails on a regression past the baseline's tolerance. + - name: relevance + run: just relevance + # Startup latency against the budgets, doubled on a runner: a breach + # fails, a regression against the committed baseline only warns. + - name: startup bench + run: just bench-startup + - name: startup bench artifact + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: startup-bench + path: docs/bench/startup.json + if-no-files-found: warn + - name: deny + run: cargo deny check advisories licenses bans sources + - name: shear + run: cargo shear + - name: workflows + env: + GH_TOKEN: ${{ github.token }} + run: | + zizmor --format=github . + go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 + # Last: it installs a second toolchain. + - name: msrv + run: | + msrv=$(cargo metadata --no-deps --format-version 1 | jq -r '[.packages[].rust_version | select(.)] | sort_by(split(".") | map(tonumber)) | last') + rustup toolchain install "$msrv" --profile minimal + RUSTUP_TOOLCHAIN="$msrv" cargo check --workspace --all-targets --all-features --locked diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml new file mode 100644 index 0000000..deadeee --- /dev/null +++ b/.github/workflows/codspeed.yml @@ -0,0 +1,59 @@ +# CodSpeed's CPU simulation of benches/search.rs: docs/adr/0012-benchmarks-criterion-local-codspeed-ci.md. +name: codspeed + +on: + # Unfiltered, so every commit on main is a baseline a pull request can be compared with. + push: + branches: [main] + pull_request: + paths: + - src/** + - benches/** + - Cargo.toml + - Cargo.lock + - .github/workflows/codspeed.yml + # Lets CodSpeed backfill runs for older commits. + workflow_dispatch: + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +env: + CARGO_TERM_COLOR: always + +jobs: + benchmarks: + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read + id-token: write # OIDC upload to CodSpeed + steps: + - name: checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: toolchain + run: | + rustup update --no-self-update + rustup toolchain install + - name: cache + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + save-if: ${{ github.ref == 'refs/heads/main' }} + # Same version as the codspeed crate in Cargo.lock; the two move together. + - name: tools + uses: taiki-e/install-action@4cef1412cce204788f482e778a0b9187f9626a29 # v2.87.21 + with: + tool: cargo-codspeed@5.0.2 + fallback: cargo-binstall + - name: build + run: cargo codspeed build --features internals --locked + - name: run + uses: CodSpeedHQ/action@373d6868929f444bc08d901fd0eb0ad52a8875ea # v5.2.1 + with: + mode: simulation + run: cargo codspeed run diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml new file mode 100644 index 0000000..a9db54a --- /dev/null +++ b/.github/workflows/release-plz.yml @@ -0,0 +1,99 @@ +# Two jobs, the App token and the config path: docs/adr/0001-release-plz-owns-the-version.md. +name: release-plz + +on: + push: + branches: [main] + +permissions: {} + +jobs: + release: + runs-on: ubuntu-latest + timeout-minutes: 20 + # crates.io trusts this workflow and environment; release-plz exchanges + # the job's OIDC token for a short-lived publish token. + environment: crates-io + permissions: + contents: read + id-token: write + steps: + - name: harden runner + uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 + with: + egress-policy: audit + - name: token + id: app + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + client-id: ${{ vars.RELEASE_APP_CLIENT_ID }} + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + permission-contents: write + permission-pull-requests: write + - name: checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - name: toolchain + run: | + rustup update --no-self-update + rustup toolchain install + - name: release + uses: release-plz/action@b8d6b54b02889ff2ae2bb82e8b57c3a8fc1683a5 # v0.5.139 + with: + command: release + version: 0.3.169 + config: .github/release-plz.toml + env: + # The action's `token` input is the cargo registry token; GitHub's goes here. + GITHUB_TOKEN: ${{ steps.app.outputs.token }} + + release-pr: + needs: release + if: ${{ !failure() }} + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read + concurrency: + group: release-plz-pr-${{ github.ref }} + cancel-in-progress: false + steps: + - name: harden runner + uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 + with: + egress-policy: audit + - name: token + id: app + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + client-id: ${{ vars.RELEASE_APP_CLIENT_ID }} + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + permission-contents: write + permission-pull-requests: write + - name: checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - name: toolchain + run: | + rustup update --no-self-update + rustup toolchain install + - name: release-pr + id: pr + uses: release-plz/action@b8d6b54b02889ff2ae2bb82e8b57c3a8fc1683a5 # v0.5.139 + with: + command: release-pr + version: 0.3.169 + config: .github/release-plz.toml + env: + # The action's `token` input is the cargo registry token; GitHub's goes here. + GITHUB_TOKEN: ${{ steps.app.outputs.token }} + - name: automerge + if: steps.pr.outputs.prs_created == 'true' + env: + GH_TOKEN: ${{ steps.app.outputs.token }} + PR: ${{ fromJSON(steps.pr.outputs.pr).number }} + run: gh pr merge --auto --squash "$PR" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e4d0bf2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,242 @@ +# Release builds once release-plz has published a GitHub release: a wheel and +# a binary archive per platform, the archives attached to the release, the +# wheels sent to PyPI and the Homebrew formula rewritten. release-plz owns the +# version, the tag and crates.io (docs/reference/release.md). One machine per +# platform, because these are the only jobs that must run on macOS and Windows +# (ADR 0017). A pull request that changes the release build runs the builds +# without publishing anything. +name: release + +on: + release: + types: [published] + pull_request: + paths: + - .github/workflows/release.yml + - pyproject.toml + +permissions: {} + +jobs: + build: + name: build ${{ matrix.target }} + runs-on: ${{ matrix.runner }} + timeout-minutes: 30 + permissions: + contents: read + strategy: + fail-fast: false + matrix: + include: + - runner: ubuntu-latest + target: x86_64-unknown-linux-gnu + native: true + # ring's ARM assembly needs a GCC that defines __ARM_ARCH, which the + # manylinux2014 cross image's GCC does not. + - runner: ubuntu-latest + target: aarch64-unknown-linux-gnu + manylinux: 2_28 + - runner: macos-latest + target: aarch64-apple-darwin + native: true + - runner: macos-latest + target: x86_64-apple-darwin + - runner: windows-latest + target: x86_64-pc-windows-msvc + native: true + steps: + - name: checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: wheel + uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 + with: + maturin-version: v1.15.0 + target: ${{ matrix.target }} + manylinux: ${{ matrix.manylinux || 'auto' }} + args: --release --locked --out dist + # The binaries the wheel carries, archived under the name cargo binstall + # looks for: dataseek-.tar.gz, or .zip on Windows. + - name: archive + shell: bash + env: + TARGET: ${{ matrix.target }} + NATIVE: ${{ matrix.native }} + run: | + dir="dataseek-$TARGET" + ext="" + [[ $TARGET == *windows* ]] && ext=".exe" + mkdir -p "$dir" archives + cp "target/$TARGET/release/dataseek$ext" "target/$TARGET/release/dsk$ext" README.md LICENSE-MIT LICENSE-APACHE "$dir/" + if [[ $TARGET == *windows* ]]; then + archive="$dir.zip" + 7z a -bd "archives/$archive" "$dir" > /dev/null + else + archive="$dir.tar.gz" + tar czf "archives/$archive" "$dir" + fi + cd archives + if command -v sha256sum > /dev/null; then + sha256sum "$archive" > "$archive.sha256" + else + shasum -a 256 "$archive" > "$archive.sha256" + fi + if [[ $NATIVE == true ]]; then + "../$dir/dataseek$ext" --version + fi + - name: upload wheel + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: wheel-${{ matrix.target }} + path: dist/*.whl + if-no-files-found: error + - name: upload archive + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: archive-${{ matrix.target }} + path: archives/* + if-no-files-found: error + + sdist: + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + steps: + - name: checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: build + uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 + with: + maturin-version: v1.15.0 + command: sdist + args: --out dist + - name: upload + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: sdist + path: dist/*.tar.gz + if-no-files-found: error + + assets: + if: github.event_name == 'release' + needs: build + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: write + id-token: write + attestations: write + steps: + - name: harden runner + uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 + with: + egress-policy: audit + - name: download + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + pattern: archive-* + path: archives + merge-multiple: true + - name: attest + uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 + with: + subject-path: archives/dataseek-* + - name: attach + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + TAG: ${{ github.event.release.tag_name }} + run: gh release upload "$TAG" archives/* --repo "$REPO" --clobber + + # PyPI's trusted publisher names this workflow file and the pypi + # environment; uv exchanges the job's OIDC token, so no PyPI token exists. + pypi: + if: github.event_name == 'release' + needs: [build, sdist] + runs-on: ubuntu-latest + timeout-minutes: 10 + environment: pypi + permissions: + id-token: write + steps: + - name: harden runner + uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 + with: + egress-policy: audit + - name: download wheels + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + pattern: wheel-* + path: dist + merge-multiple: true + - name: download sdist + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: sdist + path: dist + - name: uv + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 + with: + version: 0.12.21 + enable-cache: false + - name: publish + run: uv publish --trusted-publishing always dist/* + + # Rewrites Formula/dataseek.rb in lmarkmann/homebrew-tap from the checksums + # just attached, with a release App token scoped to that one repository. + homebrew: + if: github.event_name == 'release' && !github.event.release.prerelease + needs: assets + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + steps: + - name: harden runner + uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 + with: + egress-policy: audit + - name: token + id: app + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + client-id: ${{ vars.RELEASE_APP_CLIENT_ID }} + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + owner: lmarkmann + repositories: homebrew-tap + permission-contents: write + - name: checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: checkout tap + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: lmarkmann/homebrew-tap + token: ${{ steps.app.outputs.token }} + path: tap + persist-credentials: false + - name: formula + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + TAG: ${{ github.event.release.tag_name }} + run: | + gh release download "$TAG" --repo "$REPO" -p '*.tar.gz.sha256' -D sums + scripts/homebrew-formula.sh "$TAG" sums > tap/Formula/dataseek.rb + - name: push + working-directory: tap + env: + TOKEN: ${{ steps.app.outputs.token }} + TAG: ${{ github.event.release.tag_name }} + run: | + git config user.name "lmarkmann-release[bot]" + git config user.email "333785277+lmarkmann-release[bot]@users.noreply.github.com" + git add Formula/dataseek.rb + git diff --cached --quiet && exit 0 + git commit -m "dataseek $TAG" + git push "https://x-access-token:$TOKEN@github.com/lmarkmann/homebrew-tap.git" HEAD:main diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dcaf758 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +# Generated by Cargo +# will have compiled files and executables +debug +target + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb + +# Generated by cargo mutants +# Contains mutation testing data +**/mutants.out*/ + +# rustc will dump stack traces when hitting an internal compiler error to PWD +rustc-ice-*.txt + +.idea/ +.vscode/ +.zed/ +*.swp + +out/ +.DS_Store +.rumdl_cache + +# profiling / coverage artifacts +perf.data +perf.data.old +flamegraph.svg +*.profraw + +# Each `just bench-startup` run rewrites it; CI keeps it as an artifact. +docs/bench/startup.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e9feead --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,50 @@ +# Contributing + +Bug reports, fixes and new sources are welcome. For anything larger than a fix, open an issue first, so the idea is settled before the code is written. Report vulnerabilities privately, as [`docs/SECURITY.md`](docs/SECURITY.md) describes. + +## Setup + +[`docs/reference/setup.md`](docs/reference/setup.md) lists the toolchain and the tools the recipes call. Run `prek install` once, so formatting, clippy, `cargo-shear` and `typos` run on every commit. + +## While you work + +```sh +just check # fmt --check, clippy -D warnings, tests, doctests +just test # a subset of the tests +just review # step through changed help and output snapshots +just ci # everything CI gates on; run it before opening a pull request +``` + +A green `just ci` means a green CI run on your platform. + +## Commits and pull requests + +Write [conventional commits](https://www.conventionalcommits.org). The prefix decides what gets released: `feat:` cuts a minor release, `fix:`, `perf:` and `refactor:` a patch, `doc:`, `build:` and `chore:` only reach the changelog, and `test:` and `ci:` stay out of it. The full table is in [`docs/reference/release.md`](docs/reference/release.md). + +Each subject becomes a line in the changelog, so write it for someone who runs `dsk`, not for a reviewer: "fix: a 403 with a spent quota reads as rate limited, not as rejected credentials" rather than "fix: map 403 to RateLimited". A pull request with several commits is merged with a merge commit, so make each commit stand on its own. + +Leave the version in `Cargo.toml` and `docs/CHANGELOG.md` alone; the release tooling writes both. + +## Tests + +No test touches the network. Each adapter splits its request from a pure `parse`, and each `parse` is tested against a real response recorded in `tests/fixtures/sources/`, with the expected record read off the fixture by hand, never pasted from the code's own output. + +When you record or re-record a fixture, never send a key, trim the arrays to a few rows, and replace any person's e-mail address with `contact@example.org`. The exact steps, and where each kind of test belongs, are in [`docs/reference/development.md`](docs/reference/development.md). Commit any new file proptest writes to `proptest-regressions/`. + +## Code + +The lints in `Cargo.toml` deny `unwrap`, `expect`, `panic!`, indexing, unchecked arithmetic and direct printing outside tests. Write code that satisfies them rather than adding an `allow`. Results go to stdout only through `src/output.rs`, and everything else to stderr through `src/ui.rs`. [`docs/reference/contract.md`](docs/reference/contract.md) defines the flags, streams, errors and exit codes, and a change to any of them is a change to that document. + +## Adding a source + +A source is one row in `SOURCES` in `src/sources.rs` and at most one module under `src/sources/`. Before writing a module, check whether a protocol adapter (CKAN, Dataverse, NADA, Socrata, STAC, SDMX, EBI) already covers it; then the source is only a row ([ADR 0005](docs/adr/0005-one-adapter-per-shared-protocol.md)). + +A source is complete with: + +- a recorded fixture and a `parse` test against it +- its row in the source table of [ADR 0004](docs/adr/0004-every-source-is-searched.md) +- its row in [`docs/synthesis/terms.md`](docs/synthesis/terms.md), quoting the provider's terms that allow a public tool to query it this way + +## Proposing something bigger + +Read [`docs/adr/`](docs/adr/) first: it records why dataseek is built the way it is. [`docs/adr/watchlist.md`](docs/adr/watchlist.md) lists what is parked and the trigger that would bring each item back; if your idea is there, say what has changed. diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c225006 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2393 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocation-counter" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beb9e990c0a33699f1984d85a6abead615ccc72dd8130bf3e15dcabe2ca149c9" + +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "asn1-rs" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f43a50ac4fdca5df8e885c21b835997f0a1cdee65494a6847694a98652d9d8" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3109e49b1e4909e9db6515a30c633684d68cdeaa252f215214cb4fa1a5bfee2c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure 0.13.2", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "assert_cmd" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aa3a22042e45de04255c7bf3626e239f450200fd0493c1e382263544b20aea6" +dependencies = [ + "anstyle", + "bstr", + "libc", + "predicates", + "predicates-core", + "predicates-tree", + "wait-timeout", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec 0.8.0", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "bstr" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb31b46c14244e20ee9984b11bf5c992b91fb6939fea616e3512c8baecdbe5f" +dependencies = [ + "memchr", + "regex-automata", + "serde_core", +] + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cc" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f74872d07caf508b30a21f6836e7d7016a2eaf7d9ff4f48deaa58cd8a0407630" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + +[[package]] +name = "clap" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", + "terminal_size", +] + +[[package]] +name = "clap_complete" +version = "4.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037e2a1a92236d0aff7e845093f64661d6df4c02c9fcc61a60e9e1d736fa392f" +dependencies = [ + "clap", +] + +[[package]] +name = "clap_derive" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "clap_lex" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486" + +[[package]] +name = "clap_mangen" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "211d617eaa4b735c96c9e0228fcbdb5120ef623f2b8cb67ffb84c3e02dbc28a4" +dependencies = [ + "clap", + "roff", +] + +[[package]] +name = "codspeed" +version = "5.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0379da47d0de730b2f7900e3f2d9c3b5efc21b46875282305300b4851f03e70" +dependencies = [ + "anyhow", + "cc", + "colored", + "getrandom 0.4.3", + "glob", + "libc", + "nix", + "serde", + "serde_json", + "statrs", +] + +[[package]] +name = "codspeed-criterion-compat" +version = "5.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65f64942456bd4514b06ba4c72623bf197931d05d3d1db61b8a0c6289b30b2c7" +dependencies = [ + "clap", + "codspeed", + "codspeed-criterion-compat-walltime", + "colored", + "regex", +] + +[[package]] +name = "codspeed-criterion-compat-walltime" +version = "5.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e86691354129085562c025293f9e8b35bf9054813bb9981be3a96aa8490c07d1" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap", + "codspeed", + "criterion-plot", + "is-terminal", + "itertools", + "num-traits", + "once_cell", + "oorandom", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "colored" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "combine" +version = "4.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "console" +version = "0.16.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96a4956774c13c126a8b5af4daa79384f4d826534c95a02d76afb39e2ab64e3" +dependencies = [ + "encode_unicode", + "libc", + "unicode-width", + "windows-sys 0.61.2", +] + +[[package]] +name = "cookie" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a373e3602691c3cdea496d2f0ee5935151e6168fe87739483c463db1b2f2f87" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + +[[package]] +name = "cookie_store" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b2c103cf610ec6cae3da84a766285b42fd16aad564758459e6ecf128c75206" +dependencies = [ + "cookie", + "document-features", + "idna", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "time", + "url", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "crc32fast" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools", +] + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + +[[package]] +name = "dataseek" +version = "0.9.0" +dependencies = [ + "allocation-counter", + "anstream", + "anyhow", + "assert_cmd", + "clap", + "clap_complete", + "clap_mangen", + "codspeed-criterion-compat", + "etcetera", + "indicatif", + "insta", + "predicates", + "proptest", + "pulldown-cmark", + "quick-xml", + "rcgen", + "rustls", + "serde", + "serde_json", + "signal-hook", + "tempfile", + "terminal_size", + "thiserror", + "toml", + "ureq", +] + +[[package]] +name = "der" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a878c850e9e421b20262e9b41f9c860e4785fa07541c266b62ff9d1ef998a80a" +dependencies = [ + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "der-parser" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07da5016415d5a3c4dd39b11ed26f915f52fc4e0dc197d87908bc916e51bc1a6" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" + +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "either" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" + +[[package]] +name = "encode_unicode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "etcetera" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de48cc4d1c1d97a20fd819def54b890cadde72ed3ad0c614822a0a433361be96" +dependencies = [ + "cfg-if", + "windows-sys 0.61.2", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "find-msvc-tools" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" + +[[package]] +name = "flate2" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" +dependencies = [ + "crc32fast", + "miniz_oxide", + "zlib-rs", +] + +[[package]] +name = "float-cmp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09cf3155332e944990140d967ff5eceb70df778b34f77d8075db46e4704e6d8" +dependencies = [ + "num-traits", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] + +[[package]] +name = "glob" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "icu_collections" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" + +[[package]] +name = "icu_properties" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" + +[[package]] +name = "icu_provider" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "indicatif" +version = "0.18.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9433806cd6b4ec1aba79c021c7e4c58fb4c3b9977c085062e611ac929998fb0c" +dependencies = [ + "console", + "portable-atomic", + "unicode-width", + "unit-prefix", +] + +[[package]] +name = "insta" +version = "1.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67d3d2e287e4b86c10b3f3b641033d1f89b74bdb39d05f34952e2b9a6fe21cd" +dependencies = [ + "console", + "once_cell", + "regex", + "similar", + "strip-ansi-escapes", + "tempfile", +] + +[[package]] +name = "is-terminal" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys", + "log", + "simd_cesu8", + "thiserror", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" + +[[package]] +name = "libc" +version = "0.2.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "native-tls" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "normalize-line-endings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "oid-registry" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f40cff3dde1b6087cc5d5f5d4d65712f34016a03ed60e9c08dcc392736b5b7" +dependencies = [ + "asn1-rs", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "oorandom" +version = "11.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" + +[[package]] +name = "openssl" +version = "0.10.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "openssl-sys" +version = "0.9.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "pem" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d354a98a3d1251555de99e8fdd8afda05573c31b82f59063a7b0a29b5527f120" +dependencies = [ + "base64", + "serde_core", +] + +[[package]] +name = "pem-rfc7468" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6305423e0e7738146434843d1694d621cce767262b2a86910beab705e4493d9" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "predicates" +version = "3.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ada8f2932f28a27ee7b70dd6c1c39ea0675c55a36879ab92f3a715eaa1e63cfe" +dependencies = [ + "anstyle", + "difflib", + "float-cmp", + "normalize-line-endings", + "predicates-core", + "regex", +] + +[[package]] +name = "predicates-core" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cad38746f3166b4031b1a0d39ad9f954dd291e7854fcc0eed52ee41a0b50d144" + +[[package]] +name = "predicates-tree" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0de1b847b39c8131db0467e9df1ff60e6d0562ab8e9a16e568ad0fdb372e2f2" +dependencies = [ + "predicates-core", + "termtree", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b45fcc2344c680f5025fe57779faef368840d0bd1f42f216291f0dc4ace4744" +dependencies = [ + "bit-set", + "bit-vec 0.8.0", + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "pulldown-cmark" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f068eba8e7071c5f9511831b44f32c740d5adf574e990f946ddb53db2f314e" +dependencies = [ + "bitflags", + "memchr", + "unicase", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quick-xml" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rcgen" +version = "0.14.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8774e05a7d0de114588e6a28fe7e71694b82614ed569d86d8b389dfbc98b8ad8" +dependencies = [ + "pem", + "ring", + "rustls-pki-types", + "time", + "x509-parser", + "yasna", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "roff" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "323c417e1d9665a65b263ec744ba09030cfb277e9daa0b018a4ab62e57bc8189" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + +[[package]] +name = "rustix" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98" +dependencies = [ + "core-foundation", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f" + +[[package]] +name = "rustls-webpki" +version = "0.103.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rusty-fork" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "serde_json" +version = "1.0.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b29ffa27d3d59a049bb328258de100f8012848d1b08d444e08bbc02ac468435e" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "similar" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" + +[[package]] +name = "smallvec" +version = "1.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e" + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "statrs" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a3fe7c28c6512e766b0874335db33c94ad7b8f9054228ae1c2abd47ce7d335e" +dependencies = [ + "approx", + "num-traits", +] + +[[package]] +name = "strip-ansi-escapes" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a8f8038e7e7969abb3f1b7c2a811225e9296da208539e0f79c5251d6cac0025" +dependencies = [ + "vte", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "terminal_size" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" +dependencies = [ + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "termtree" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "toml" +version = "1.1.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_parser" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_writer" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicase" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f" + +[[package]] +name = "unicode-ident" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "unit-prefix" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "ureq" +version = "3.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a7ac20be9b7726e0bbdbf974c059676d9acb1cd414961f570a4e8231cacd7fc" +dependencies = [ + "base64", + "cookie_store", + "der", + "flate2", + "log", + "native-tls", + "percent-encoding", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_json", + "ureq-proto", + "utf8-zero", + "webpki-root-certs", + "webpki-roots", +] + +[[package]] +name = "ureq-proto" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f86fd172ccca569e458f61b6bdd6220965a9ef36e672a6852953b51a0e1583be" +dependencies = [ + "base64", + "http", + "httparse", + "log", +] + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8-zero" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vte" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "231fdcd7ef3037e8330d8e17e61011a2c244126acc0a982f4040ac3f9f0bc077" +dependencies = [ + "memchr", +] + +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b96554aa2acc8ccdb7e1c9a58a7a68dd5d13bccc69cd124cb09406db612a1c9b" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "webpki-roots" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "x509-parser" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d43b0f71ce057da06bc0851b23ee24f3f86190b07203dd8f567d0b706a185202" +dependencies = [ + "asn1-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "ring", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "yasna" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5f6765e852b9b4dc8e2a76843e4d64d1cea8e79bcde0b6901aea8e7c7f08282" +dependencies = [ + "bit-vec 0.9.1", + "time", +] + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", + "synstructure 0.14.0", +] + +[[package]] +name = "zerocopy" +version = "0.8.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6400fc4bb7426f6faac3fb07566122bb18622e3022bd2c36426a92ed489b1dbe" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99c27cc7525bad4df59a45e073c45b2c2aa820efb588234cc23a547ec69a34db" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", + "synstructure 0.14.0", +] + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..5ed8f05 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,123 @@ +[package] +name = "dataseek" +version = "0.9.0" +description = "Search for datasets from the terminal" +license = "MIT OR Apache-2.0" +repository = "https://github.com/lmarkmann/dataseek" +readme = "README.md" +keywords = ["dataset", "search", "open-data", "research", "cli"] +categories = ["command-line-utilities", "science"] +edition = "2024" +rust-version = "1.99" +# What `cargo install` needs to build; tests, fixtures, benches and docs stay +# in the repository. +include = ["/src", "/build.rs", "/README.md", "/LICENSE-MIT", "/LICENSE-APACHE"] + +[lints.rust] +unsafe_code = "forbid" +missing_docs = "warn" +rust_2018_idioms = { level = "warn", priority = -1 } + +[lints.clippy] +all = { level = "warn", priority = -1 } +pedantic = { level = "warn", priority = -1 } +print_stdout = "deny" +print_stderr = "deny" +unwrap_used = "deny" +expect_used = "deny" +panic = "deny" +panic_in_result_fn = "deny" +unreachable = "deny" +unimplemented = "deny" +indexing_slicing = "deny" +arithmetic_side_effects = "deny" +unchecked_time_subtraction = "deny" +dbg_macro = "deny" +todo = "deny" +exit = "deny" +struct_excessive_bools = "allow" +doc_markdown = "allow" + +[dependencies] +anyhow = "1" +anstream = "1" +clap = { version = "4", features = ["derive", "env", "wrap_help"] } +clap_complete = "4" +clap_mangen = "0.3" +etcetera = "0.11" +indicatif = { version = "0.18", default-features = false, features = ["unicode-width"] } +pulldown-cmark = { version = "0.13", default-features = false } +quick-xml = "0.42" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +tempfile = "3" +terminal_size = "0.4" +thiserror = "2" +toml = { version = "1", default-features = false, features = ["parse", "serde", "std"] } + +[target.'cfg(unix)'.dependencies] +signal-hook = { version = "0.4", default-features = false } + +# TLS per platform: the OS's own stack on Windows and macOS (SChannel, +# Security.framework), rustls on everything else. ring, rustls' crypto, builds +# C against the target's system headers, which the Linux CI runner does not +# have for Windows or macOS, so this split is what lets ADR 0002's +# cross-checks compile (ADR 0011). Every platform trusts the OS's root +# certificates; platform-verifier gives rustls the system store (ADR 0014). +# src/http.rs picks the matching provider. +[target.'cfg(any(windows, target_os = "macos"))'.dependencies] +ureq = { version = "3", default-features = false, features = ["json", "gzip", "native-tls"] } + +# rustls itself only to tell a refused certificate from a dead host. +[target.'cfg(not(any(windows, target_os = "macos")))'.dependencies] +rustls = { version = "0.23", default-features = false, features = ["std"] } +ureq = { version = "3", features = ["json", "platform-verifier"] } + +[features] +# Re-exports for benches/ and the relevance example only; unstable and +# outside semver, see the internals module in src/lib.rs. +internals = [] + +[dev-dependencies] +allocation-counter = "0.8" +assert_cmd = "2" +criterion = { version = "5", package = "codspeed-criterion-compat", default-features = false, features = ["cargo_bench_support"] } +insta = { version = "1", features = ["filters"] } +predicates = "3" +proptest = "1" + +# A local HTTPS server under a private root, for the test that Linux trusts +# what SSL_CERT_FILE names; rustls with ring is already in the build there. +[target.'cfg(target_os = "linux")'.dev-dependencies] +rcgen = "0.14" +rustls = { version = "0.23", default-features = false, features = ["ring", "std"] } + +[profile.release] +opt-level = 3 +# Fat LTO lets the optimizer drop and merge code across every crate at once. +lto = "fat" +codegen-units = 1 +strip = "symbols" + +# Dependencies optimized for size; fat LTO inlines the hot ones into this +# crate's own code, which stays at opt-level 3 (docs/bench/2026-10-07-binary-size.md). +[profile.release.package."*"] +opt-level = "z" + +# Release as shipped, with line tables kept so CodSpeed flamegraphs resolve +# symbols (ADR 0012). +[profile.bench] +inherits = "release" +strip = "none" +debug = "line-tables-only" + +[[bench]] +name = "search" +harness = false +required-features = ["internals"] + +# The relevance benchmark: docs/reference/development.md. +[[example]] +name = "relevance" +required-features = ["internals"] +test = true diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 0000000..1b5ec8b --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,176 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..c98eff7 --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Luis Markmann + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..8ea15c6 --- /dev/null +++ b/README.md @@ -0,0 +1,92 @@ +![dataseek: every dataset source it searches, set out as a periodic table](https://raw.githubusercontent.com/lmarkmann/dataseek/main/docs/assets/dataseek-banner.png) + +[![crates.io](https://img.shields.io/crates/v/dataseek?style=flat-square&label=crates.io&color=dea584&logo=rust&logoColor=black)](https://crates.io/crates/dataseek)[![PyPI](https://img.shields.io/pypi/v/dataseek?style=flat-square&label=PyPI&color=3775A9&logo=pypi&logoColor=white)](https://pypi.org/project/dataseek/)[![Homebrew](https://img.shields.io/badge/brew-lmarkmann%2Ftap-FBB040?style=flat-square&logo=homebrew&logoColor=black)](https://github.com/lmarkmann/dataseek)[![License](https://img.shields.io/crates/l/dataseek?style=flat-square&color=2DA44E)](https://github.com/lmarkmann/dataseek) + + +Search for datasets from the terminal + + +Datasets sit in dozens of archives: Hugging Face and Kaggle, Zenodo and Dataverse, data.gov and data.europa.eu, the IMF and the ECB, NASA and Copernicus. Each has its own search box and its own idea of relevance, and many host the same dataset under different names. dataseek queries them all at once and returns one deduplicated, ranked list, naming every archive that holds each result. Datasets carried by more archives, and matching more of your query, rank higher. + +Most sources need no key and nothing to set up. Results come back in the terminal, as JSON for scripts, or to an AI client over MCP. Google Dataset Search and Mendeley Data are the exception: neither permits automated searches, so dataseek asks them only when you name them with `-s` ([ADR 0013](docs/adr/0013-opt-in-sources.md)). `dsk` is the same program under a shorter name. + +## Install +```sh +brew install lmarkmann/tap/dataseek +cargo binstall dataseek # prebuilt binaries, otherwise this also works: + +cargo install --locked dataseek +uv tool install dataseek + +# To run it once without installing: +crgx --allow-build dataseek search sea surface temperature +uvx dataseek search sea surface temperature +``` + +## Usage +```sh +dsk search sea surface temperature # every default source, merged and ranked +dsk search mnist -s huggingface,kaggle # only these sources +dsk search inflation -c economics,finance # only these categories +dsk search census --json | jq -r '.results[].url' # one URL per line, for scripts +dsk sources # every source, its protocol, key and docs +dsk inspect https://zenodo.org/records/13135140 # a page's metadata and the files it lists +``` + +`dsk search air quality -n 3` on a terminal: + +```text +- searching 71 sources for "air quality"; 3 need a key, see `dsk doctor` +1 Improving Indoor Air Quality for Poor Families: Controlled Experiments 2005-2006 + https://microdata.worldbank.org/catalog/396 + worldbank-microdata, ihsn | Susmita Dasgupta, Mainul Huq, M. Khaliquzzaman and David Wheeler | 2... + Indoor air pollution (IAP) is dangerously high for many poor families in Bangla... + +2 Air quality data in five counties in California + https://b2find.eudat.eu/dataset/f2611e4d-793c-5e55-950c-7a9979c772b8 + b2find, pangaea | PANGAEA | 2026-05-04 | doi:10.1594/pangaea.923005 + Air quality data used to identify time windows of the best air quality in the d... + +3 Historical Air Quality + https://data.calgary.ca/d/uqjm-jxgp + openaire, socrata | City of Calgary Open Data Portal | 2018-07-16 | See Terms of Use + This dataset makes historical air quality data accessible for various parameter... + + ✓ 3 of 359 results; 70 of 71 sources answered; -n 359 shows all +``` + +`dsk` alone shows the commands, `dsk help environment` the variables it reads, `dsk help exit-codes` what it returns. `cargo install` cannot install a man page or completions: `dsk man > ~/.local/share/man/man1/dsk.1` puts the page where `man dsk` finds it, and `dsk completion fish` (or `bash`, `zsh`) says where its script goes. + +While, most of the sources don't require an API-key FRED, Roboflow and Data Commons are skipped without one; keys for Hugging Face, Kaggle, Data.gov, GitHub and NCBI raise download limits. See: [`docs/reference/keys-and-cache.md`](docs/reference/keys-and-cache.md). + +## MCP +Use it in the terminal, pipe its JSON into scripts, or use dataseek via MCP (`dsk mcp`), so Claude, Cursor or any other MCP client can search and inspect datasets for you. Most sources need no API key. Google Dataset Search and Mendeley Data don't permit automated searches, so dataseek only queries them when named with `-s` ([ADR 0013](docs/adr/0013-opt-in-sources.md)). Register it in the client's MCP server configuration: + +```json +{ + "mcpServers": { + "dataseek": { "command": "dsk", "args": ["mcp"] } + } +} +``` + +Each tool returns what its command prints with `--json`; keys are read from the environment the client starts it in, or from `credentials.toml`. Google Dataset Search and Mendeley Data stay opt-in here too; the model asks for them by naming them in the search tool's `source` argument. See: [`docs/reference/contract.md`](docs/reference/contract.md#mcp-mode). + +## Contributing & Development Docs +- [`CONTRIBUTING.md`](CONTRIBUTING.md) covers setup, the commit prefixes that decide each release, the test rules and how to add a source. Report vulnerabilities privately, as [`SECURITY.md`](docs/SECURITY.md) describes. +- [`docs/CHANGELOG.md`](docs/CHANGELOG.md): what shipped, written by release-plz. +- [`docs/reference/`](docs/reference/): setup, development, the CLI contract, keys and cache, the supply-chain gates, and the release loop. +- [`docs/adr/`](docs/adr/): why it is built this way, including [the full source list](docs/adr/0004-every-source-is-searched.md), plus what is [parked](docs/adr/watchlist.md). Read it before proposing an addition. +- [`docs/bench/`](docs/bench/): measured speed of the search stages and of startup, each with the machine it ran on. +- [`docs/synthesis/`](docs/synthesis/): how the sources' search interfaces differ, and the bench that measures them. + +```sh +just check # fmt --check, clippy -D warnings, tests, doctests +just ci # everything CI gates on: check, relevance, startup bench, Windows and macOS cross-check, shear, msrv, audit, typos +just audit # cargo-deny, zizmor +just run search climate temperature # the CLI built from this checkout +``` + +## License + +Licensed under either [Apache License, Version 2.0](LICENSE-APACHE) or [MIT license](LICENSE-MIT); at your choice. diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 0000000..fe7f823 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,12 @@ +[files] +# Recorded source responses: third-party text, kept as the source sent it. +extend-exclude = ["tests/fixtures/"] + +[default] +# Third-party spellings and identifiers quoted from the recorded responses. +extend-ignore-re = [ + "Dateset contains past", + "CC-BY-NC-ND-4\\.0", + "Burnt Area \\(BA\\)", + "census for BA 44/45", +] diff --git a/benches/search.rs b/benches/search.rs new file mode 100644 index 0000000..66faf21 --- /dev/null +++ b/benches/search.rs @@ -0,0 +1,320 @@ +//! The CPU side of a search, by stage: parsing downloaded catalogs, loading +//! a cached catalog, searching it, fusing the per-source lists and cleaning +//! remote text. Network time dwarfs all of it; these exist so a change that +//! makes one stage grow faster than its input shows up before a user waits +//! on it (ADR 0012). +//! +//! Inputs are synthetic, shaped after real responses (ECB's SDMX-ML dataflow +//! list, Eurostat's table of contents, 2026-10-06) and built from a word list +//! by index, so every run sees the same bytes without a seed. + +#![allow( + clippy::arithmetic_side_effects, + clippy::indexing_slicing, + clippy::unwrap_used, + missing_docs, + reason = "setup arithmetic on small indices, a failed setup aborts the bench, and criterion_group! expands to an undocumented pub fn" +)] + +use std::fmt::Write; +use std::hint::black_box; +use std::time::Duration; + +use criterion::{ + BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, + criterion_main, +}; +use dataseek::internals::{ + Cache, Dataset, Kind, catalog_search, clean, eurostat_toc, merge, + sdmx_dataflows, weigh, +}; + +#[rustfmt::skip] +const WORDS: [&str; 48] = [ + "sea", "surface", "temperature", "population", "census", "region", + "unemployment", "monthly", "gross", "domestic", "product", "inflation", + "consumer", "price", "index", "exchange", "rates", "balance", "payments", + "emissions", "carbon", "precipitation", "daily", "annual", "household", + "income", "survey", "labour", "trade", "exports", "energy", "electricity", + "mortality", "births", "education", "country", "employment", "wages", + "agriculture", "land", "cover", "ocean", "salinity", "glacier", "species", + "occurrence", "gene", "traffic", +]; + +const QUERY: &str = "sea surface temperature"; + +/// Catalog sizes: Eurostat's table of contents holds about 10,000 datasets +/// and tables, the SDMX agencies hundreds to a few thousand. +const CATALOG_SIZES: [usize; 3] = [1_000, 4_000, 16_000]; + +/// 76 sources answering with this many records each. +const RECORDS_PER_SOURCE: [usize; 3] = [5, 20, 80]; +const SOURCES: usize = 76; + +fn word(i: usize) -> &'static str { + WORDS[i % WORDS.len()] +} + +/// Four to seven words, varied by `i` so titles rarely repeat. +fn phrase(i: usize) -> String { + (0..4 + i % 4) + .map(|k| word(i.wrapping_mul(31).wrapping_add(k * 17) >> (k % 3))) + .collect::>() + .join(" ") +} + +fn sdmx_xml(flows: usize) -> String { + let mut xml = String::from( + r#"IREF004131"#, + ); + for i in 0..flows { + let id = format!("DF{i:05}"); + write!( + xml, + r#""# + ) + .unwrap(); + if i % 2 == 0 { + write!( + xml, + r#"{}"#, + phrase(i + 1) + ) + .unwrap(); + } + write!( + xml, + r#"{} & {}"#, + phrase(i), + word(i) + ) + .unwrap(); + if i % 3 == 0 { + write!( + xml, + r#"{}"#, + phrase(i + 7) + ) + .unwrap(); + } + write!( + xml, + r#""# + ) + .unwrap(); + } + xml.push_str(""); + xml +} + +/// Datasets and tables nested under folders, every eighth line a folder, +/// titles indented by depth as the real file does. +fn eurostat_tsv(lines: usize) -> String { + let mut toc = String::from( + "\"title\"\t\"code\"\t\"type\"\t\"last update of data\"\t\"last table structure change\"\t\"data start\"\t\"data end\"\t\"values\"\n", + ); + for i in 0..lines { + let indent = " ".repeat(4 * (1 + i % 6)); + let kind = match i % 8 { + 0 => "folder", + 1 => "table", + _ => "dataset", + }; + writeln!( + toc, + "\"{indent}{}\"\t\"{}_{i}\"\t\"{kind}\"\t\"{:02}.{:02}.2026\"\t\"10.01.2024\"\t\"2011\"\t\"2025\"\t{}", + phrase(i), + word(i), + 1 + i % 28, + 1 + i % 12, + i * 37 + ) + .unwrap(); + } + toc +} + +fn catalog(entries: usize) -> Vec { + (0..entries) + .map(|i| { + Dataset::new( + &phrase(i), + &format!("https://catalog.example.org/datasets/{i}"), + ) + .describe(Some(format!( + "{} {}", + phrase(i + 3), + phrase(i + 11) + ))) + }) + .collect() +} + +/// One source's ranked list. Every 25th record carries a DOI that every +/// source shares at that rank, matching the bench's measured 4% of hits +/// found by more than one source. +fn source_list(source: usize, records: usize) -> Vec { + (0..records) + .map(|rank| { + let mut dataset = Dataset::new( + &phrase(source * 101 + rank), + &format!("https://repo{source}.example.org/records/{rank}"), + ) + .describe(Some(format!("{QUERY} {}", phrase(rank)))); + dataset.publisher = Some(format!("Publisher {source}")); + if rank % 25 == 0 { + dataset.doi = Some(format!("10.5281/zenodo.{rank}")); + } + dataset + }) + .collect() +} + +fn html(bytes: usize) -> String { + let paragraph = "

Monthly sea surface temperature from \ + NOAA ERSST & \ + partners, "gridded" at 2' resolution.\u{1b}[31m

\n"; + paragraph.repeat(bytes.div_ceil(paragraph.len())) +} + +/// Prose whose ampersands start no entity, as in "R&D" or "Q&A", and which +/// has no semicolon to end one. +fn ampersands(bytes: usize) -> String { + let sentence = "Research & development spending by R&D sector, \ + with Q&A notes from AT&T and P&G. "; + sentence.repeat(bytes.div_ceil(sentence.len())) +} + +fn parse(c: &mut Criterion) { + let mut group = c.benchmark_group("parse/sdmx"); + for flows in [100, 1_000, 10_000] { + let xml = sdmx_xml(flows); + group.throughput(Throughput::Elements(flows as u64)); + group.bench_with_input( + BenchmarkId::from_parameter(flows), + &xml, + |b, xml| { + b.iter(|| sdmx_dataflows(black_box(xml)).unwrap()); + }, + ); + } + group.finish(); + + let mut group = c.benchmark_group("parse/eurostat"); + for lines in CATALOG_SIZES { + let toc = eurostat_tsv(lines); + group.throughput(Throughput::Elements(lines as u64)); + group.bench_with_input( + BenchmarkId::from_parameter(lines), + &toc, + |b, toc| { + b.iter(|| eurostat_toc(black_box(toc))); + }, + ); + } + group.finish(); +} + +fn catalogs(c: &mut Criterion) { + let mut group = c.benchmark_group("catalog/search"); + for entries in CATALOG_SIZES { + let catalog = catalog(entries); + group.throughput(Throughput::Elements(entries as u64)); + group.bench_with_input( + BenchmarkId::from_parameter(entries), + &catalog, + |b, catalog| { + b.iter(|| { + catalog_search(black_box(catalog), black_box(QUERY), 20) + }); + }, + ); + } + group.finish(); + + let dir = tempfile::tempdir().unwrap(); + let cache = Cache::new(dir.path().to_owned()); + let mut group = c.benchmark_group("catalog/load"); + for entries in CATALOG_SIZES { + let key = format!("catalog-{entries}"); + cache.store(Kind::Catalog, &key, &catalog(entries)); + group.throughput(Throughput::Elements(entries as u64)); + group.bench_with_input( + BenchmarkId::from_parameter(entries), + &key, + |b, key| { + b.iter(|| { + cache + .load::>( + Kind::Catalog, + black_box(key), + Duration::MAX, + ) + .unwrap() + }); + }, + ); + } + group.finish(); +} + +fn fusion(c: &mut Criterion) { + let mut group = c.benchmark_group("merge"); + for records in RECORDS_PER_SOURCE { + let lists: Vec<(&'static str, Vec)> = (0..SOURCES) + .map(|s| { + let id: &'static str = + Box::leak(format!("source{s}").into_boxed_str()); + (id, source_list(s, records)) + }) + .collect(); + group.throughput(Throughput::Elements((SOURCES * records) as u64)); + group.bench_with_input( + BenchmarkId::from_parameter(SOURCES * records), + &lists, + |b, lists| { + // merge consumes its lists, so every run gets a fresh copy, + // made outside the measurement. + b.iter_batched( + || lists.clone(), + |lists| weigh(merge(lists), black_box(QUERY)), + BatchSize::LargeInput, + ); + }, + ); + } + group.finish(); +} + +fn sanitize(c: &mut Criterion) { + let mut group = c.benchmark_group("clean"); + for bytes in [200, 2_000, 20_000] { + let text = html(bytes); + group.throughput(Throughput::Bytes(text.len() as u64)); + group.bench_with_input( + BenchmarkId::from_parameter(bytes), + &text, + |b, text| { + b.iter(|| clean(black_box(text))); + }, + ); + } + group.finish(); + + let mut group = c.benchmark_group("clean/ampersands"); + for bytes in [2_000, 20_000] { + let text = ampersands(bytes); + group.throughput(Throughput::Bytes(text.len() as u64)); + group.bench_with_input( + BenchmarkId::from_parameter(bytes), + &text, + |b, text| { + b.iter(|| clean(black_box(text))); + }, + ); + } + group.finish(); +} + +criterion_group!(benches, parse, catalogs, fusion, sanitize); +criterion_main!(benches); diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..532c6eb --- /dev/null +++ b/build.rs @@ -0,0 +1,41 @@ +#![expect(missing_docs, reason = "build scripts are not a public API")] + +use std::path::Path; +use std::process::Command; + +// A crates.io build has no `.git`, and a rerun-if-changed path that does not +// exist reruns the script on every build. A worktree's `.git` is a file, so +// git names the real HEAD and refs. +fn main() { + let sha = if Path::new(".git").exists() { + for name in ["HEAD", "refs"] { + if let Some(path) = git(&["rev-parse", "--git-path", name]) { + println!("cargo::rerun-if-changed={path}"); + } + } + built_from() + } else { + println!("cargo::rerun-if-changed=build.rs"); + "unknown".to_owned() + }; + println!("cargo::rustc-env=DATASEEK_GIT_SHA={sha}"); +} + +fn built_from() -> String { + let Some(sha) = git(&["rev-parse", "--short", "HEAD"]) else { + return "unknown".to_owned(); + }; + match git(&["status", "--porcelain"]) { + Some(changes) if !changes.is_empty() => format!("{sha}-dirty"), + _ => sha, + } +} + +fn git(args: &[&str]) -> Option { + let out = Command::new("git").args(args).output().ok()?; + out.status + .success() + .then(|| String::from_utf8(out.stdout).ok()) + .flatten() + .map(|s| s.trim().to_owned()) +} diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 0000000..4b6c79f --- /dev/null +++ b/clippy.toml @@ -0,0 +1,4 @@ +allow-unwrap-in-tests = true +allow-expect-in-tests = true +allow-panic-in-tests = true +allow-indexing-slicing-in-tests = true diff --git a/deny.toml b/deny.toml new file mode 100644 index 0000000..4a63c97 --- /dev/null +++ b/deny.toml @@ -0,0 +1,27 @@ +[advisories] +ignore = [] + +[licenses] +allow = [ + "MIT", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "BSD-2-Clause", + "BSD-3-Clause", + "CDLA-Permissive-2.0", + "ISC", + "Unicode-3.0", + "Zlib", + "0BSD", +] +unused-allowed-license = "allow" + +[bans] +multiple-versions = "warn" +wildcards = "deny" +deny = [] + +[sources] +unknown-registry = "deny" +unknown-git = "deny" +allow-registry = ["https://github.com/rust-lang/crates.io-index"] diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md new file mode 100644 index 0000000..1f09d2c --- /dev/null +++ b/docs/CHANGELOG.md @@ -0,0 +1,421 @@ +# Changelog + +What shipped, newest first. release-plz writes each section from the conventional commits merged since the previous tag; see [`reference/release.md`](reference/release.md). + +## 0.9.0 - 2026-10-09 + +### Docs + +- The stopping-rule measurement, ADRs 0018 and 0019 and the cache reference state the measured numbers, and --timeout's help says failures do not count toward the quorum + +### Fixed + +- A source the search stopped waiting for stops paging, whether the deadline, the quorum or a background catalog download ended the wait +- A Hugging Face search that loses one of its words to an error fails instead of caching a partial list as the answer +- A search that stopped waiting for a source says so, by name, and --json reports whether the results are complete +- A catalog whose background download failed is named in the search's warnings, and two searches no longer start the same download +- Sources named with -s wait for their catalogs, a catalog already downloading in the background is not downloaded again, and a cold cache still stops at the quorum +- Hugging Face searches by every meaningful word of the query, so "Iris flower dataset" and natural-language questions find their datasets instead of failing or coming back empty +- A source that refuses a keyless request reports "refused the request" instead of "rejected the credentials", and is not rested +- The cache evicts query results before catalogs, so a busy week of searches no longer drops every catalog +- A search no longer waits for slow catalog downloads; they finish in the background for the next search, and cache warm -s downloads only the named catalogs +- Stop a source's pages when the search deadline passes + +### Other + +- Each release updates the Homebrew formula, so brew install lmarkmann/tap/dataseek installs dataseek and dsk with completions and the man page + +### Performance + +- A search waits at most one more second once 90% of its sources have answered, so most searches finish in about 2 s + +## 0.8.0 - 2026-10-07 + +### Added + +- Dsk sources shows the notices FRED and the Census Bureau ask for, and the README names each source's attribution terms +- Dsk help environment wraps each variable's meaning on a terminal +- Dsk sources sizes its columns to their content and wraps its notes on a terminal +- Dsk doctor wraps long details under their column on a terminal +- Dsk inspect fits the terminal: wrapped fields, a file count and total size, and each file's link under its name +- Dsk completion on a terminal says where to save the script instead of printing it +- The cache budget reads as 30 MB and DATASEEK_CACHE_MAX_MB sets another +- The bare overview has Search, Upkeep and Shell headings, the same command lines as -h, bench under Upkeep, and points at both -h and --help +- Dsk man opens the page in man on a terminal, and drops out of the help it does not belong in +- Result descriptions on a terminal are cut between 40 and 80 columns, so wide terminals read as prose + +### Changed + +- Dsk sources writes its table and builds its notes in separate steps +- The hidden --jq flag is gone, so completions stop offering it; pipe --json into jq + +### Docs + +- The supply-chain gates move to reference/supply-chain.md so they no longer share a name with the security policy +- The security policy leaves supported versions open, and the README names SECURITY.md +- A security policy, a contributing guide and a pull request template, linked from the README +- The README installs from crates.io, cargo-binstall and uv, and runs once through crgx or uvx +- The terms table gives each source's registry effect as it stands +- The ADR index holds decisions and the watch list +- Dataseek is licensed under MIT or Apache-2.0 +- The README says why dataseek exists, shows a real search, and covers the man page, completions and opt-in sources over MCP +- The README shows the CI status and the latest release +- The README installs straight from GitHub and its example comments match what the commands do +- The README opens with a banner of every source dataseek searches +- The 0.7.0 changelog lists every change that shipped + +### Fixed + +- A source's error text can no longer carry escape sequences to the terminal +- A source that keeps answering 429 rests for 10 minutes instead of being asked again on every search +- The User-Agent names the repository next to the contact address +- Dsk man writes the page it opens to a temporary file with a random name only its user can read +- The man page describes every option and closes with EXAMPLES, EXIT STATUS and REPORTING BUGS +- Flags with a fixed set of values name them in their help once, as in "Colorize output (auto, always, or never)" +- The searching line counts only the sources that will be asked and says how many need a key +- Search result facts are separated by a single-spaced bar +- Status lines say 1 source, 1 result and "was still downloading its catalog" instead of plurals + +### Other + +- A PyPI wheel carries dataseek and dsk, and each GitHub release publishes the wheels through trusted publishing +- The crate is ready for crates.io, packaging only what building needs, and its build script settles without a git checkout +- Merge commits stay out of the changelog + +## 0.7.0 - 2026-10-07 + +### Added + +- Dsk mcp serves search, sources and inspect to MCP clients +- Inspect lists a dataset's files with format, size, checksum and link + +### Changed + +- The overview says dsk mcp serves search, sources and inspect, and relayed stderr lines share the event writer +- MCP argument types are a fixed set, and a count flag takes how many times to repeat it + +### Docs + +- MCP mode's errors, limits and lifetime in the contract, ADR 0015 sizes under the current release profile, and the inspect fixtures as they are +- Say that the relevance example uses internals, and how weighing treats terms past the 64th +- Bring the relevance numbers and workflow up to date with the judgments +- ADR 0014 amends 0011, SSL_CERT_FILE and SSL_CERT_DIR each replace the whole Linux store, and inspect's help names a file set's pattern +- What just bloat --what-if measures, and size figures that match their byte counts +- Binary size per target before and after, with every lever measured +- Rank by fusion and rarity-weighted coverage (ADR 0016, superseding ADR 0006) +- How to run, label, re-record and re-baseline the relevance benchmark, with its first results +- MCP mode in the contract, the README and ADR 0015 + +### Fixed + +- Dsk mcp runs at most four calls at once and refuses a fifth as a tool error +- A cancelled dsk mcp call can no longer collect a later call that reuses its request id +- Dsk mcp keeps running its calls after an upgrade replaces the binary +- Dsk mcp refuses an argument holding a NUL character as a tool error, not a server fault +- Dsk mcp refuses a search timeout over 300 seconds, and tool schemas give the range of every ranged integer +- Inspect --json puts the file list in a top-level files key and strips control characters from the page's metadata +- A usage error under --json keeps the missing argument and the possible values, and dsk mcp names a missing argument +- Inspect reads file links from bare strings, link lists and ids, shows sizes it cannot parse as written, and counts the files it could not read +- Inspect lists the files on CKAN pages such as HDX, whose metadata refers to each file by id +- A dsk mcp call that fails without an error, or succeeds without a JSON object, says what it printed instead +- Dsk mcp stops its running calls when the client closes the pipe, instead of dying of SIGPIPE +- A certificate dataseek cannot verify says so and how to install roots, instead of reading as an offline machine +- Dsk mcp answers a line that is not UTF-8 or a request without a method, and keeps serving +- MCP clients can pass offline and refresh, whose schema no longer limits a boolean to strings +- --jq names its replacement instead of failing as an unknown flag +- Rank datasets that match the query's rarer words above ones that match only its common words +- Help --json lists the flags help --json lists +- Inspect finds the dataset on Zenodo pages, which give its type as a full schema.org address +- Linux checks certificates against the system's trust store, so a TLS-inspecting proxy's root works + +### Other + +- macOS and Windows builds no longer warn about the certificate failure only rustls reports +- The changelog marks breaking changes +- Drop dependency features dataseek never uses +- Just bloat runs cargo-bsize + +### Performance + +- Breaking: Drop --jq; pipe --json into jq instead +- Release binary is 23% smaller: fat LTO, dependencies optimized for size +- Search moves each source's results into the merge instead of copying them + +## 0.6.0 - 2026-10-06 + +### Added + +- Data Commons needs your own API key and is skipped without one +- Google Dataset Search and Mendeley Data are asked only when named with -s +- OpenAIRE results carry download counts and merge on a record's other DOIs, on the v3 API +- Roboflow Universe returns more than one page of hits and keeps your key out of the URL +- Data.europa.eu results carry the DOI, replies are a fifth the size, and a stray quote no longer fails the search +- STAC results carry the collection's DOI and Data Space links open its browser page +- Hugging Face results carry the DOI and size, and descriptions start with prose instead of the card heading +- DANDI results carry the DOI and star count, skip empty dandisets and list starred ones first; a colon in the query no longer fails the search +- Date ILOSTAT dataflows, drop IMF ones with no portal page +- Kaggle searches read as many pages as the limit asks for +- OpenNeuro results carry a description, DOI, license, size and download count +- TensorFlow Datasets results show the categories they are listed under +- Data.gov results carry monthly views and more DOIs +- Materials Project results carry the full title, license and publisher + +### Changed + +- GitHub leaves its 403 quota handling to the HTTP client +- Data.gov reads the landing page once when it looks for a DOI +- Fiscal Data reads only the description fields the API sends + +### Docs + +- PANGAEA row says all words must match +- Record each source's terms verdict and what it offers for filters and file lists +- Search methods, limits and watch list match what the adapters now do +- ADR 0004 rows follow the registry docs links +- Registry rows point at the docs pages that exist today +- NCEI header lists every character the search service rejects +- DANDI header lines stay within 79 columns +- WHO header counts 37 archived indicator stubs +- ArcGIS Hub header spells the throttle header as the service sends it +- Record NOMAD's name filters, paging, rate limit and metadata terms +- DataONE header counts the DOIs and the records without a creator against the current index +- Earth Engine adapter records the catalog page's size, what it lacks and why STAC is not used +- Census header says what its link is and dates the key and attribution rules +- DBnomics header says over 90 providers beside the dated count +- CESSDA adapter records its page limit, result window and why it asks for English +- Socrata adapter records its page limit, throttle and which asset types it keeps +- Record how Synapse search pages, ranks and what it indexes +- OpenML results are described by size because the list carries no text +- DBnomics adapter records its page limit and what the search matches + +### Fixed + +- Eurostat sizes its description buffer with saturating arithmetic +- A 403 with a spent quota reads as rate limited, not as rejected credentials +- A catalog searched from an expired copy reads stale instead of ok +- An offline search no longer clears a source's outage mark +- A connect timeout you set no longer marks the source as down for ten minutes +- OSF results name OSF as the publisher instead of the project's first author +- PANGAEA drops leading wildcards when it retries a rejected query +- OpenAIRE keeps phrases and operators it accepts and asks again as plain words only after a rejection +- CKAN tries each date field in turn until one parses +- Roboflow fails the search when a later page fails, so a short list is not cached +- Eurostat datasets are found by their code again +- Zenodo keeps phrase and wildcard queries and escapes them only after an HTTP 500 +- Data.europa.eu searches asking for more than 1000 results no longer fail +- STAC collections that share a DOI stay separate results +- EBI Search retries a rejected query only when escaping changes it +- SDMX last-update stamps with an impossible day or month are ignored +- PhysioNet results leave out software and models, merge on the concept DOI, and read the current list endpoint +- World Bank indicators outside WDI link to their API record, not a missing page +- AWS Open Data results no longer show a lone ellipsis as the description +- NCEI results no longer carry the end of coverage as their update date, and a query its text parameter rejects is retried as plain words +- PANGAEA results name PANGAEA as publisher instead of the authors, and a query its parser rejects is retried as plain words +- Microdata searches (World Bank, IHSN, FAO, UNHCR) keep surveys whose title lacks the query word +- Google Dataset Search results show the license Google names by code +- DataCite returns matches by relevance instead of newest first, with download counts and unescaped descriptions, and retries a query its parser rejects +- FRED results carry the series id in the title +- Our World in Data returns up to 100 results and claims no license +- TensorFlow Datasets names the missing All Datasets listing when the page changes +- CKAN portals return plain descriptions, real publishers and dataset dates +- CERN Open Data pages through results ten at a time and retries a query its parser rejects +- GBIF licenses read as SPDX ids and the unspecified placeholder is dropped +- DataONE results carry the DOI from the series id and a query with OR or NOT no longer fails +- Zenodo returns up to 100 results per search, and a query with a slash or a lone ! no longer parks it as down +- Eurostat results are described by their topic folders, not by their code +- OpenDataSoft links open the publishing portal and drop the source-link text from descriptions +- Materials Project projects stay findable by their short title +- WHO search no longer lists archived indicator stubs that hold no data +- ArrayExpress and BioStudies accept queries with slashes and brackets, and BioStudies shows abstracts and dates +- ModelScope results carry their size and real update date, and an empty summary stays empty +- OmicsDI leaves out Europe PMC papers and names each repository +- Figshare shows when a dataset was last modified, and a search under 3 characters returns nothing instead of failing +- GEO records stop using organism and sample count as publisher +- Keep CELLxGENE collections of one paper as separate results +- NASA CMR results take their DOI and date from the collection record +- Data Commons uses only your own key and no longer shows a variable id as its description +- A long query no longer parks Mendeley Data as down +- GitHub's update date is the last push, and an exhausted quota reads as a rate limit + +### Other + +- Keep typos quiet about quoted titles, an SPDX id and test words +- Record what the UCI list endpoint returns, checked in October 2026 +- Record the ArcGIS Hub limits and field meanings checked in October 2026 + +### Performance + +- Eurostat builds each description with one allocation +- Eurostat keeps one folder path and trims it by offset, so no row rebuilds it +- Eurostat builds each topic path once per folder instead of once per dataset + +## 0.5.0 - 2026-10-06 + +### Added + +- A bare dsk shows an overview; help topics, --jq, --offline and tagged JSON + +### Docs + +- Help text and contract say what the code does +- Drop leftover template wording + +### Fixed + +- A failed write to stderr no longer panics +- Inspect no longer calls one unreachable page an offline machine +- Cache warm names every failed catalog and refuses a cache it cannot write +- --json keeps stderr NDJSON under -v, and help and a bare call answer in JSON +- --offline answers from the cache even after an outage, and an empty run says why +- Cache clear removes its own entries, never other files in --cache-dir +- --jq output carries no control characters from remote text +- Cached answers from an older release are refetched, not served as fresh + +### Uncategorized + +- Merge remote-tracking branch 'origin/main' into cli-conformance + +## 0.4.3 - 2026-10-06 + +### Docs + +- Measured gains from the allocation and complexity pass + +### Other + +- Bench cleaning prose full of bare ampersands + +### Performance + +- Load cached catalogs with one UTF-8 check +- Parse Eurostat's table of contents without per-line allocations +- Parse SDMX dataflow lists with one pass over each element's attributes +- Merge results with fewer copies and allocations +- Search downloaded catalogs without allocating per entry +- Clean remote text in linear time and with fewer copies + +## 0.4.2 - 2026-10-06 + +### Fixed + +- Data.gov descriptions show text instead of raw Markdown +- NCEI results name the organization the record gives +- NASA CMR results name the archive center, not its provider code +- OpenDataSoft results name the source portal when the publisher is blank +- OSF results carry the project's DOI +- OSF results show the project's size +- OSF results show the project's license +- Google Dataset Search results show the license when Google has one +- Google Dataset Search results name the publisher, not the authors +- GitHub results show the repository's size +- GBIF results show when the dataset was last modified +- Fiscal Data results show when the dataset was last updated +- ArcGIS Hub results carry their view count +- ArcGIS Hub results show the dataset's size +- ECB results link to a page that opens for every dataflow +- Earth Engine results show the catalog's description and provider +- DBnomics results show the dataset's description +- Census results show the dataset's CC0 license +- CERN Open Data results show the dataset's size +- CERN Open Data results show the record's license +- PhysioNet results show the project's size +- PhysioNet results show the project's license +- CESSDA results carry the study's DOI +- Synapse and STAC descriptions show text instead of raw Markdown +- Socrata descriptions no longer carry zero-width spaces + +## 0.4.1 - 2026-10-06 + +### Changed + +- Split each adapter's parsing from its request + +### Docs + +- How the adapters, loop and HTTP client are tested + +### Fixed + +- Drop ECB dataflows that have no page of their own +- Send Mendeley Data the query it actually reads +- Cut World Bank descriptions on a word and mark the cut +- Decode named and numeric HTML entities in remote text +- Pick the AWS registry's description paragraph by shape +- Keep GBIF's real datasets in DataCite results +- Treat ArcGIS Hub's "none" license as no license +- Strip every Google tracking fragment from result links +- Take CMR's DOI from its links and stop dating by coverage start +- Date a dandiset by the version its name and size come from +- Read PhysioNet's publish_date +- Spell out compact dates like 20100708 for every source +- Keep OpenML's catalog in a stable order +- Read numbers written as decimal strings +- End a DOI at the first space +- Report a GEO esummary without results as a changed response +- Never cache an empty catalog, fall back to the old one instead +- Keep a literal < in titles instead of eating the rest +- Strip control characters from localized text + +### Other + +- Keep typos off recorded fixtures + +### Uncategorized + +- Merge remote-tracking branch 'origin/main' into test/source-adapters + +## 0.4.0 - 2026-10-06 + +### Added + +- Inspect a page's schema.org or Croissant metadata +- Bench sources for latency and overlap +- Economics and finance categories, with Bundesbank, Treasury Fiscal Data and Census +- Add CERN Open Data, MPContribs, NOMAD and CESSDA +- Add OpenNeuro, DANDI and PhysioNet +- Add NCBI GEO, OmicsDI, CELLxGENE and Synapse +- Add GBIF and DataONE +- Add NASA CMR, Earth Engine, NOAA NCEI and PANGAEA +- Add DBnomics, World Bank, Eurostat, Data Commons, OWID, FRED and WHO +- Add Data.gov, OpenDataSoft and ArcGIS Hub +- Add OSF and Mendeley Data +- Add AWS Open Data, TensorFlow Datasets and GitHub +- Search Google Dataset Search +- Search the SDMX dataflows of statistical agencies +- Search STAC collection catalogs +- Search EMBL-EBI archives through EBI Search +- Search Socrata portals through the Discovery API +- Search NADA microdata catalogs +- Search Dataverse installations +- Search CKAN portals +- Search datasets across sources with merged, deduplicated results +- Ship the same program as dsk + +### Changed + +- Drop the template's count command + +### Docs + +- Source list, design ADRs, search methods and bench results + +### Fixed + +- Report a crashed adapter as crashed, not as still running +- Keep one source's same-named records apart and give Data Commons unique links +- Strip control characters from remote metadata before printing + +### Other + +- Use the platform TLS stack on Windows and macOS +- Gitignore from the GitHub Rust template +- Trim comments in src and tests ([#8](https://github.com/lmarkmann/dataseek/pull/8)) +- Docs layout, release-plz config under .github, current pins ([#6](https://github.com/lmarkmann/dataseek/pull/6)) + +## 0.3.1 - 2026-09-25 + +No user-facing change; the release workflow cut this version from two `ci:` merges. + +## 0.3.0 - 2026-09-09 + +First tagged version. diff --git a/docs/SECURITY.md b/docs/SECURITY.md new file mode 100644 index 0000000..ed2c399 --- /dev/null +++ b/docs/SECURITY.md @@ -0,0 +1,25 @@ +# Security policy + +## Reporting a vulnerability + +Report it privately through [GitHub's advisory form](https://github.com/lmarkmann/dataseek/security/advisories/new). If you cannot use GitHub, write to contact@dataseek.dev. Please do not open a public issue for it. + +A useful report names the version (`dsk --version`), the platform, the command you ran, and what happened. When remote content triggers it, add the source id and the response body that does it; a saved file is enough. + +You will hear back within a week. The fix ships as a patch release, and the advisory is published with it, crediting you unless you ask not to be named. + +## Scope + +In scope: + +- The `dataseek` and `dsk` binaries, including the MCP server that `dsk mcp` runs. +- Keys: a key from the environment, `credentials.toml` or Kaggle's token files reaching a URL, an error message, a log line, the cache, or any host other than the source it belongs to ([ADR 0009](adr/0009-keys-and-contact-address.md)). +- The cache directory: remote text reaching a file path, or a cache file another local user can plant or read. +- Remote text driving the terminal: control characters or escape sequences from a source's response, a page `inspect` reads, or a source's own error message reaching stdout or stderr. +- The release pipeline: the workflows, the tags, and the binaries and wheels they publish. + +Out of scope: + +- The sources themselves. A source serving wrong, stale or misleading data, or a flaw in its own API, belongs with that provider. +- A vulnerability in a dependency that dataseek never reaches. Report it upstream; `cargo-deny` fails CI on any published RUSTSEC advisory ([`reference/supply-chain.md`](reference/supply-chain.md)). +- Attacks that start from control of your environment variables or your config directory. diff --git a/docs/adr/0001-release-plz-owns-the-version.md b/docs/adr/0001-release-plz-owns-the-version.md new file mode 100644 index 0000000..08a5b1c --- /dev/null +++ b/docs/adr/0001-release-plz-owns-the-version.md @@ -0,0 +1,31 @@ +# ADR 0001: release-plz owns the version, the tag and the changelog + +- Status: accepted +- Date: 2026-09-25, config and changelog moved 2026-10-06 + +## Context + +The version in `Cargo.toml`, the `vX.Y.Z` tag, the changelog section and the GitHub release have to move together. Done by hand they drift, which is why there is no hand-written `just release` recipe. + +## Decision + +release-plz runs on every push to `main` from `.github/workflows/release-plz.yml`, in two jobs: + +- `release` tags and cuts the GitHub release. It has no concurrency group, because GitHub discards a *pending* run in a group whenever a newer one queues, whatever `cancel-in-progress` says. With `release_always = false` only the release PR's merge commit tags, so a discarded run would lose the tag with no failure anywhere. +- `release-pr` opens or updates the release PR and queues it for auto-merge. It is serialized, because two runs writing the release branch race. + +Both jobs mint a one-hour token from the `lmarkmann-release` GitHub App and pass it as `GITHUB_TOKEN`. Pushes and PRs made with the workflow's own `GITHUB_TOKEN` trigger no workflow, so CI would never run on the release PR and its merge would never start the release run. + +The config lives at `.github/release-plz.toml`, beside the workflow that reads it, and is passed explicitly through the action's `config` input and `--config` locally. The changelog lives at `docs/CHANGELOG.md` through `changelog_path`. + +## Consequences + +- A bare `release-plz update` at the repo root finds no config, runs on defaults and writes a root `CHANGELOG.md`. `just release-preview` carries the flag; use it rather than the raw command. +- Merging both jobs into one under a concurrency group reintroduces the lost-tag failure. +- Swapping the App token for `GITHUB_TOKEN` stalls the loop silently: the release PR opens, CI never runs, auto-merge never fires. +- The action's `token` input is a cargo registry token. A GitHub token put there fails with `environment variable GITHUB_TOKEN is undefined`. + +## Evidence + +- v0.3.1 was cut end to end by this loop on 2026-09-25, after the first run failed on the `token` input mistake. +- 2026-10-06, scratch clone with a `feat:` and a `fix:` commit: `release-plz update --config .github/release-plz.toml` moved 0.3.1 to 0.4.0, wrote the section at the top of `docs/CHANGELOG.md`, and created no root `CHANGELOG.md`. diff --git a/docs/adr/0002-one-linux-ci-job.md b/docs/adr/0002-one-linux-ci-job.md new file mode 100644 index 0000000..bc780d5 --- /dev/null +++ b/docs/adr/0002-one-linux-ci-job.md @@ -0,0 +1,22 @@ +# ADR 0002: CI is one Linux job that cross-checks Windows and macOS + +- Status: accepted +- Date: 2026-09-25 + +## Context + +CI ran a three-OS matrix (ubuntu, macOS, Windows). It guarded two things: path layouts, which `etcetera` resolves as XDG on every Unix and differently only on Windows, and `cfg` boundaries that fail to compile off Linux. On a private repository a macOS runner bills at ten times the Linux rate and Windows at twice. + +## Decision + +`.github/workflows/ci.yml` is one `ubuntu-latest` job, `linux`, with every check as a named step. The `cross-check` step runs clippy for `x86_64-pc-windows-msvc` and `aarch64-apple-darwin` from that machine; `just cross` runs the same commands locally. The `msrv` step runs last because it installs a second toolchain, and every earlier step failing first is cheaper. + +## Consequences + +- Compile boundaries on Windows and macOS stay covered; runtime behavior there (path resolution, terminal detection) is not exercised. +- `linux` is the single check the ruleset requires. +- Shipping binaries for Windows or macOS adds a per-OS build matrix in the release workflow, gated on a release having happened. That matrix, not this job, is where runtime coverage on those platforms would return. + +## Evidence + +The bug the matrix once caught, an unconditional `SIGPIPE` import from `signal-hook`, was a compile failure on Windows; clippy for the Windows target reports it from Linux. diff --git a/docs/adr/0003-the-cli-surface-sets-the-version.md b/docs/adr/0003-the-cli-surface-sets-the-version.md new file mode 100644 index 0000000..59a43d3 --- /dev/null +++ b/docs/adr/0003-the-cli-surface-sets-the-version.md @@ -0,0 +1,32 @@ +# ADR 0003: The CLI surface sets the version + +- Status: accepted +- Date: 2026-10-06 + +## Context + +dataseek is a binary with `publish = false`; nothing depends on it through Cargo. Cargo's SemVer rules for `0.x` (minor is breaking, features bump patch) protect library dependents, and release-plz follows them by default. Under that default a new subcommand ships as `0.3.2`, indistinguishable from a bug fix. + +## Decision + +The version follows the command-line surface: subcommands, flags, output formats and exit codes. + +| commit | before 1.0 | from 1.0 | +|---|---|---| +| `feat:` | minor | minor | +| `fix:`, `perf:`, `refactor:` | patch | patch | +| `feat!:`, `fix!:` or a `BREAKING CHANGE:` footer | minor | major | +| `docs:`, `build:`, `chore:`, `test:`, `ci:` | no release | no release | + +`features_always_increment_minor = true` and `release_commits = "^(feat|fix|perf|refactor)"` in `.github/release-plz.toml` encode this. `1.0.0` is a deliberate step, taken with `release-plz set-version 1.0.0` once the surface is declared stable. Personal-project rule: stable versions only, no prerelease channels. + +## Consequences + +- Before 1.0 a feature and a breaking change both bump minor; the changelog's group and the `!` marker are what tell them apart, so mark breaking commits. +- Reverting the flag makes new subcommands patch releases again. +- If the crate ever publishes a library, Cargo's `0.x` rule binds and this flag violates it (release-plz warns about exactly this); revisit then. + +## Evidence + +- 2026-10-06, scratch clone: a `feat:` plus a `fix:` gave 0.3.1 -> 0.4.0; a lone `fix:` gave 0.3.1 -> 0.3.2. +- v0.3.1 was cut from two `ci:` merges with an empty changelog section, before `release_commits` existed. diff --git a/docs/adr/0004-every-source-is-searched.md b/docs/adr/0004-every-source-is-searched.md new file mode 100644 index 0000000..88b5569 --- /dev/null +++ b/docs/adr/0004-every-source-is-searched.md @@ -0,0 +1,175 @@ +# ADR 0004: Every source is searched, none is tiered + +- Status: accepted +- Date: 2026-10-06 + +## Context + +Google Dataset Search was dataseek's only source in the lost Python version, and it misses whole classes of data: Hugging Face pages carry no schema.org markup, statistical series and STAC collections rarely do, and omics accessions live behind their own archives. A research pass on 2026-10-06 ranked about sixty candidate sources into tiers. Tiers would have decided by guess which sources earn an adapter; the alternative is to build them all to one standard and let measurement decide. + +## Decision + +Every source below is implemented to the same contract (`src/sources.rs`) and searched by default, except the opt-in ones ([ADR 0013](0013-opt-in-sources.md)), which run only when `--source` names them. A source is left out of a run only when it needs a key the user has not set, when it had an outage in the last ten minutes, or when the user narrows the run with `--source`, `--exclude` or `--category`. `dataseek bench` measures latency, answer rate, result count and overlap per source, and that measurement, not a tier list, is what a source is later demoted or dropped on. + +`search` is `live` when the query goes to the source, `local` when the source publishes a complete list but no search endpoint, so its catalog is downloaded (cached for a week) and searched on disk. + +## Consequences + +- One query fans out to about 74 hosts. The search deadline (ADR 0007) bounds the cost of the slowest; the cache bounds repeats. +- Adding a source is one registry row plus, at most, one module. Removing one is the reverse; nothing else refers to a source by id. +- Overlap is low (ADR 0006 evidence: 96% of merged hits came from exactly one source), so dropping a source loses results rather than duplicates. Reverting to tiers would cut recall in proportion. + +## Evidence + +- `dataseek bench` on 2026-10-06, six queries, 76 sources: all 74 that had their keys answered 6 of 6; median latency per source from 0 ms (local catalogs) to 1.4 s (data.gov.au). Full table: [`../synthesis/bench-2026-10-06.md`](../synthesis/bench-2026-10-06.md). +- Search semantics per interface: [`../synthesis/search-methods.md`](../synthesis/search-methods.md). + +## The sources + +76 sources, grouped by `--category`. Each source's terms verdict and the sentence it rests on are in [`../synthesis/terms.md`](../synthesis/terms.md); what each offers for filters and file lists is in [`../synthesis/capabilities.md`](../synthesis/capabilities.md). Keys are read from the environment or `credentials.toml` ([`../reference/keys-and-cache.md`](../reference/keys-and-cache.md)); an optional key raises a rate limit or unlocks a better endpoint, a required one is the only way in. + +### aggregator + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `datacite` | DataCite | DataCite REST | live | | [docs](https://support.datacite.org/docs/api) | +| `openaire` | OpenAIRE Graph | OpenAIRE Graph | live | | [docs](https://graph.openaire.eu/docs/apis/graph-api/) | +| `google` | Google Dataset Search | results page data | live | opt-in | [docs](https://datasetsearch.research.google.com/help) | +| `b2find` | EUDAT B2FIND | CKAN | live | | [docs](https://docs.ckan.org/en/latest/api/) | + +### machine-learning + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `huggingface` | Hugging Face Hub | Hub API | live | `$HF_TOKEN` (optional) | [docs](https://huggingface.co/docs/huggingface_hub/package_reference/hf_api) | +| `kaggle` | Kaggle | Kaggle API | live | `$KAGGLE_API_TOKEN` (optional) | [docs](https://www.kaggle.com/docs/api) | +| `openml` | OpenML | OpenML REST, listed | local | | [docs](https://docs.openml.org/ecosystem/Rest/) | +| `uci` | UCI Machine Learning Repository | list endpoint | local | | [docs](https://github.com/uci-ml-repo/ucimlrepo) | +| `roboflow` | Roboflow Universe | Universe API | live | `$ROBOFLOW_API_KEY` (required) | [docs](https://docs.roboflow.com/datasets/universe/universe/universe-search) | +| `modelscope` | ModelScope | site API | live | | [docs](https://www.modelscope.cn/docs) | +| `aws` | Registry of Open Data on AWS | registry page | local | | [docs](https://github.com/awslabs/open-data-registry) | +| `tfds` | TensorFlow Datasets | catalog page | local | | [docs](https://www.tensorflow.org/datasets/catalog/overview) | + +### code + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `github` | GitHub (topic:dataset) | GitHub search | live | `$GITHUB_TOKEN` (optional) | [docs](https://docs.github.com/en/rest/search/search) | + +### research + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `zenodo` | Zenodo | InvenioRDM | live | | [docs](https://developers.zenodo.org/) | +| `figshare` | Figshare | Figshare | live | | [docs](https://docs.figshare.com/) | +| `harvard-dataverse` | Harvard Dataverse | Dataverse | live | | [docs](https://guides.dataverse.org/en/latest/api/search.html) | +| `borealis` | Borealis (Canada) | Dataverse | live | | [docs](https://guides.dataverse.org/en/latest/api/search.html) | +| `recherche-data-gouv` | Recherche Data Gouv (France) | Dataverse | live | | [docs](https://guides.dataverse.org/en/latest/api/search.html) | +| `dataverse-nl` | DataverseNL | Dataverse | live | | [docs](https://guides.dataverse.org/en/latest/api/search.html) | +| `dataverse-no` | DataverseNO | Dataverse | live | | [docs](https://guides.dataverse.org/en/latest/api/search.html) | +| `osf` | OSF (via SHARE) | SHARE trove | live | | [docs](https://share.osf.io/trove/docs) | +| `mendeley` | Mendeley Data | site search API | live | opt-in | [docs](https://data.mendeley.com/api/docs/) | + +### government + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `europa` | data.europa.eu | DCAT-AP (piveau) | live | | [docs](https://dataeuropa.gitlab.io/data-provider-manual/api-documentation/) | +| `datagov` | Data.gov | Data.gov Catalog API | live | `$DATAGOV_API_KEY` (optional) | [docs](https://resources.data.gov/catalog-api/) | +| `data-gov-uk` | data.gov.uk | CKAN | live | | [docs](https://docs.ckan.org/en/latest/api/) | +| `open-canada` | Open Government Canada | CKAN | live | | [docs](https://docs.ckan.org/en/latest/api/) | +| `data-gov-au` | data.gov.au | CKAN | live | | [docs](https://docs.ckan.org/en/latest/api/) | +| `govdata` | GovData (Germany) | CKAN | live | | [docs](https://docs.ckan.org/en/latest/api/) | +| `hdx` | Humanitarian Data Exchange | CKAN | live | | [docs](https://docs.humdata.org/build/hdx-apis/metadata-endpoints/package_search) | +| `socrata` | Socrata portals (US) | Socrata Discovery | live | | [docs](https://dev.socrata.com/docs/other/discovery) | +| `socrata-eu` | Socrata portals (EU) | Socrata Discovery | live | | [docs](https://dev.socrata.com/docs/other/discovery) | +| `opendatasoft` | OpenDataSoft hub | OpenDataSoft Explore | live | | [docs](https://help.huwise.com/apis/ods-explore-v2/) | +| `arcgis` | ArcGIS Hub | OGC API Records | live | | [docs](https://hub.arcgis.com/api/search/v1) | + +### statistics + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `ihsn` | IHSN survey catalog | NADA | live | | [docs](https://microdata.worldbank.org/api-documentation/catalog/index.html) | +| `fao-microdata` | FAO Microdata | NADA | live | | [docs](https://microdata.worldbank.org/api-documentation/catalog/index.html) | +| `unhcr-microdata` | UNHCR Microdata Library | NADA | live | | [docs](https://microdata.worldbank.org/api-documentation/catalog/index.html) | +| `eurostat` | Eurostat | Eurostat table of contents | local | | [docs](https://ec.europa.eu/eurostat/web/user-guides/data-browser/api-data-access) | +| `undata` | UNdata | SDMX | local | | [docs](https://data.un.org/Host.aspx?Content=API) | +| `datacommons` | Data Commons | Data Commons REST v2 | live | `$DATACOMMONS_API_KEY` (required) | [docs](https://docs.datacommons.org/api/rest/v2/) | +| `owid` | Our World in Data | Search API | live | | [docs](https://docs.owid.io/projects/etl/api/search-api/) | +| `census` | U.S. Census Bureau API | DCAT data.json, listed | local | | [docs](https://census.gov/data/developers/updates/new-discovery-tool.html) | +| `who` | WHO Global Health Observatory | OData, listed | local | | [docs](https://www.who.int/data/gho/info/gho-odata-api) | + +### economics + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `dbnomics` | DBnomics | DBnomics | live | | [docs](https://api.db.nomics.world/v22/apidocs) | +| `worldbank` | World Bank indicators | World Bank API, listed | local | | [docs](https://datahelpdesk.worldbank.org/knowledgebase/articles/889392) | +| `worldbank-microdata` | World Bank Microdata Library | NADA | live | | [docs](https://microdata.worldbank.org/api-documentation/catalog/index.html) | +| `imf` | IMF | SDMX | local | | [docs](https://data.imf.org/en/Resource-Pages/IMF-API) | +| `oecd` | OECD | SDMX | local | | [docs](https://www.oecd.org/en/data/insights/data-explainers/2024/09/api.html) | +| `ilo` | ILOSTAT | SDMX | local | | [docs](https://www.ilo.org/resource/other/ilostat-sdmx-user-guide) | + +### finance + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `ecb` | European Central Bank | SDMX | local | | [docs](https://data.ecb.europa.eu/help/api/overview) | +| `bis` | Bank for International Settlements | SDMX | local | | [docs](https://stats.bis.org/api-doc/v2/) | +| `fred` | FRED | FRED API | live | `$FRED_API_KEY` (required) | [docs](https://fred.stlouisfed.org/docs/api/fred/series_search.html) | +| `bundesbank` | Deutsche Bundesbank | SDMX | local | | [docs](https://statistiken.bundesbank.de/content/991208) | +| `fiscal-data` | U.S. Treasury Fiscal Data | Fiscal Data API, listed | local | | [docs](https://fiscaldata.treasury.gov/api-documentation/) | + +### geospatial + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `cmr` | NASA Earthdata (CMR) | CMR search | live | | [docs](https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html) | +| `planetary-computer` | Microsoft Planetary Computer | STAC | local | | [docs](https://planetarycomputer.microsoft.com/docs/reference/stac/) | +| `earth-search` | Earth Search (AWS) | STAC | local | | [docs](https://element84.com/earth-search/) | +| `copernicus-dataspace` | Copernicus Data Space | STAC | local | | [docs](https://documentation.dataspace.copernicus.eu/APIs/STAC.html) | +| `copernicus-cds` | Copernicus Climate Data Store | STAC | local | | [docs](https://cds.climate.copernicus.eu/how-to-api) | +| `earth-engine` | Google Earth Engine catalog | catalog page | local | | [docs](https://developers.google.com/earth-engine/datasets/catalog) | +| `ncei` | NOAA NCEI | NCEI Search Service | live | | [docs](https://www.ncei.noaa.gov/support/access-search-service-api-user-documentation) | +| `pangaea` | PANGAEA | PANGAEA search | live | | [docs](https://wiki.pangaea.de/wiki/PANGAEA_search) | + +### ecology + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `gbif` | GBIF | GBIF registry | live | | [docs](https://techdocs.gbif.org/en/openapi/v1/registry) | +| `dataone` | DataONE | DataONE Solr | live | | [docs](https://dataoneorg.github.io/api-documentation/) | + +### life-sciences + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `geo` | NCBI GEO | E-utilities | live | `$NCBI_API_KEY` (optional) | [docs](https://www.ncbi.nlm.nih.gov/books/NBK25501/) | +| `arrayexpress` | ArrayExpress (EBI) | EBI Search | live | | [docs](https://www.ebi.ac.uk/ebisearch/documentation/rest-api) | +| `biostudies` | BioStudies (EBI) | EBI Search | live | | [docs](https://www.ebi.ac.uk/ebisearch/documentation/rest-api) | +| `omicsdi` | OmicsDI | OmicsDI | live | | [docs](https://www.omicsdi.org/ws/) | +| `cellxgene` | CZ CELLxGENE | Curation API, listed | local | | [docs](https://api.cellxgene.cziscience.com/curation/ui/) | +| `synapse` | Synapse | Synapse REST | live | | [docs](https://rest-docs.synapse.org/) | + +### neuroscience + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `openneuro` | OpenNeuro | GraphQL, listed | local | | [docs](https://docs.openneuro.org/api.html) | +| `dandi` | DANDI Archive | DANDI REST | live | | [docs](https://api.dandiarchive.org/swagger/) | +| `physionet` | PhysioNet | project list | local | | [docs](https://physionet.org/about/) | + +### physics + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `cern` | CERN Open Data | Invenio | live | | [docs](https://github.com/cernopendata/opendata.cern.ch) | +| `materials-project` | Materials Project (MPContribs) | MPContribs, listed | local | | [docs](https://contribs-api.materialsproject.org/) | +| `nomad` | NOMAD | NOMAD API, listed | local | | [docs](https://nomad-lab.eu/prod/v1/api/v1/extensions/docs) | + +### social-science + +| id | source | protocol | search | key | API docs | +|---|---|---|---|---|---| +| `cessda` | CESSDA Data Catalogue | CESSDA | live | | [docs](https://api.tech.cessda.eu/) | diff --git a/docs/adr/0005-one-adapter-per-shared-protocol.md b/docs/adr/0005-one-adapter-per-shared-protocol.md new file mode 100644 index 0000000..8cf1bb9 --- /dev/null +++ b/docs/adr/0005-one-adapter-per-shared-protocol.md @@ -0,0 +1,39 @@ +# ADR 0005: One adapter per shared protocol + +- Status: accepted +- Date: 2026-10-06 + +## Context + +Most dataset portals do not have APIs of their own: they run one of a handful of platforms. Writing per-portal code would multiply adapters by the number of installations. + +## Decision + +A protocol is written once and configured per registry row: + +| protocol | module | rows today | searched | +|---|---|---|---| +| CKAN `package_search` | `ckan.rs` | data.gov.uk, Canada, Australia, GovData, HDX, B2FIND | live | +| Dataverse Search API | `dataverse.rs` | Harvard, Borealis, Recherche Data Gouv, DataverseNL, DataverseNO | live | +| NADA catalog search | `nada.rs` | World Bank, IHSN, FAO, UNHCR | live | +| Socrata Discovery | `socrata.rs` | US and EU regions (every Socrata domain) | live | +| EBI Search | `ebi.rs` | ArrayExpress, BioStudies | live | +| STAC collections | `stac.rs` | Planetary Computer, Earth Search, Copernicus Data Space, Copernicus CDS | local | +| SDMX-ML 2.1 dataflows | `sdmx.rs` | IMF, OECD, ECB, BIS, ILO, UNdata, Bundesbank | local | +| DCAT-AP | `europa.rs` | every EU national portal, through data.europa.eu | live | +| DataCite, OpenAIRE | `datacite.rs`, `openaire.rs` | thousands of DOI and OAI-PMH repositories | live | + +Adding an installation of a known protocol is a registry row and nothing else. Protocols that cannot be searched at query time are not used for search: OAI-PMH is harvest-only and would need a local index larger than the cache budget (watch list), and schema.org `Dataset` and Croissant are per-page metadata, read by `dataseek inspect` rather than searched. + +Where one agency's protocol endpoint is impractical, the agency gets its own small adapter: Eurostat's SDMX dataflow list is 37 MB of multilingual annotations, so its 2 MB table of contents is read instead (`eurostat.rs`). + +## Consequences + +- A protocol bug affects every row using it; a protocol fix repairs them all. +- The CKAN registry is curated, not imported: the public registry of 631 portals includes dead and test instances. +- Reverting to per-portal code would cost one module per installation for no capability. + +## Evidence + +- Probed live 2026-10-06: each listed endpoint answered keyless with the shape the module parses (see `../synthesis/search-methods.md`). +- The Eurostat dataflow list measured 37,664,029 bytes; the table of contents about 2 MB with 10,311 dataset and table rows. diff --git a/docs/adr/0006-merge-by-identity-rank-by-fusion.md b/docs/adr/0006-merge-by-identity-rank-by-fusion.md new file mode 100644 index 0000000..c92d9c2 --- /dev/null +++ b/docs/adr/0006-merge-by-identity-rank-by-fusion.md @@ -0,0 +1,27 @@ +# ADR 0006: Merge by identity, rank by fusion and query coverage + +- Status: superseded by [ADR 0016](0016-rank-by-fusion-and-weighted-coverage.md) +- Date: 2026-10-06 + +## Context + +Results arrive as about 75 ranked lists with incomparable scores (Elasticsearch relevance, download counts, catalog order). The same dataset appears in several (a Zenodo record in Zenodo, DataCite, OpenAIRE and Google), DataCite lists every version of a record, and many sources match loosely (any word, stemmed, or in fields dataseek never sees). + +## Decision + +`src/dedup.rs` does three things in order. + +1. **Identity.** Two records are one dataset when they share a key: a DOI (normalized, also when it hides in a resolver or `/doi/` URL), a concept DOI carried as an alias (folds DataCite and Zenodo versions), a normalized landing URL (no scheme, `www.`, fragment, trailing slash or `utm_` parameters), or a normalized title with the same publisher. A title key only joins records from different sources. Merging is transitive. The first source's fields win; later sources fill gaps. +2. **Fusion.** Reciprocal rank fusion (Cormack, Clarke and Buettcher, SIGIR 2009) with k = 60: a hit scores the sum over its sources of `1 / (61 + rank)`, counting each source's best rank once. Agreement between sources beats any single first place. +3. **Coverage.** The fused score is scaled by `0.25 + 0.75 * coverage`, the share of meaningful query words in the title or description; a hit that shows a description yet mentions no query word is dropped. + +## Consequences + +- Scores need no calibration across sources, and a new source needs none either. +- A landing URL must carry its identity in the path or query, never only in the fragment: Data Commons links of the form `statvar#sv=ID` normalized to one URL and merged 45 variables into 5 until they were changed to `/browser/ID`. +- Reverting coverage weighting brings back off-topic hits that two loose sources agree on (NADA mirrors returned a household survey for "single cell lung"). + +## Evidence + +- Bench 2026-10-06: 2,463 results from 76 sources over six queries; 2,355 merged hits came from exactly one source, so cross-source overlap is about 4%. The largest pairwise overlaps were data.gov and Socrata (4), DBnomics and Eurostat (4), and Kaggle and Google (3 per six queries). +- DataCite: 60 results contributed 39 hits, the rest being versions and duplicates folded by concept DOI and URL. diff --git a/docs/adr/0007-cache-budget-and-failure-handling.md b/docs/adr/0007-cache-budget-and-failure-handling.md new file mode 100644 index 0000000..7b3473b --- /dev/null +++ b/docs/adr/0007-cache-budget-and-failure-handling.md @@ -0,0 +1,27 @@ +# ADR 0007: A 30 MB cache, a search deadline, and sources that fail alone + +- Status: amended by [ADR 0018](0018-a-search-never-waits-for-a-catalog-download.md) (catalog downloads) and [ADR 0019](0019-stop-waiting-past-a-quorum.md) (stragglers) +- Date: 2026-10-06 + +## Context + +A search that waits for 75 hosts is only as fast as the slowest, and some hosts fail or rate-limit. Catalog sources download lists of up to tens of thousands of entries (World Bank indicators: 29,533). The cache must not bloat. + +## Decision + +- **Cache** (`src/cache.rs`): one JSON file per entry under the XDG cache directory, written atomically. Query results live 6 hours, catalogs 7 days. The directory is trimmed to 30 MB and 2,000 files, oldest first, once per search (the entry cap follows yoink's bounded search cache). Kaggle results are never written, per Kaggle's terms. +- **Deadline**: `search` prints what has arrived after `--timeout` seconds (default 20; 0 waits for all). Sources still working are reported as still running; their threads are detached. `dataseek cache warm` downloads every catalog with no deadline. +- **Failure isolation** (`src/search.rs`): each source runs on its own thread. A transient connect failure is retried once after 300 ms; a short `Retry-After` is honored once. An outage (unreachable, timeout, challenge page, HTTP 5xx, or a rate limit that outlasts the one honored retry) marks the source for 10 minutes and later searches skip it unless it is named with `--source`. A failed fetch serves the expired cache entry when one exists. A required key that is missing skips the source instead of failing it. +- **Exit codes**: 0 when any source answered (even with no results), 1 when every attempted source failed or none could run. + +## Consequences + +- A cold first search can miss the slowest catalogs (PhysioNet took 35 s, OpenNeuro 25 s); the stderr summary names them and points at `cache warm`. +- A stale answer is labeled in `-v` and `--json` output, never silently passed off as fresh. +- Raising the budget or TTLs is one constant each. + +## Evidence + +- Cold search 2026-10-06 without a deadline: 35.5 s, bounded by PhysioNet. With the 20 s deadline: 20.3 s. Warm: under 1 s from cache, about 8 s fresh. +- `cache warm` fetched all 26 catalogs in about 30 s; the cache then held well under the budget. +- Concurrent lookups produced spurious DNS and `WouldBlock` errors for gbif and dandi until the single connect retry was added. diff --git a/docs/adr/0008-google-dataset-search-from-page-data.md b/docs/adr/0008-google-dataset-search-from-page-data.md new file mode 100644 index 0000000..89cf8d0 --- /dev/null +++ b/docs/adr/0008-google-dataset-search-from-page-data.md @@ -0,0 +1,28 @@ +# ADR 0008: Google Dataset Search is read from its results page data + +- Status: superseded by [ADR 0013](0013-opt-in-sources.md) +- Date: 2026-10-06 + +## Context + +Google Dataset Search has no API, documented or announced. Its results page embeds the first 20 results as one JSON array in an `AF_initDataCallback({key: 'ds:0', ...})` block, the data the page itself renders. The lost Python version read Google Dataset Search the same way. The paid alternative (DataForSEO's Google Dataset Search endpoint) would put a third party's scraping and a billing account between the user and the results. + +## Decision + +`src/sources/google.rs` sends one request per query to the results page and parses the `ds:0` block. Field positions (title, provider, URL, DOI, description, update date, file size) were mapped on 2026-10-06 and are pinned by a fixture test. Failsafes: + +- A consent or "unusual traffic" interstitial is reported as blocked, which counts as an outage (skipped for 10 minutes). +- A page without the block, or a non-empty result list in which no record matches the known layout, is a shape error, never an empty result; the search falls back to the last cached answer. +- A record missing its title or link is skipped, not guessed at. +- No paging, no retries against Google, results cached for 6 hours like every source. + +## Consequences + +- When Google changes the page, `-v` shows `google: returned an unexpected shape` and every other source carries on. The fix is updating the positions in one function and its fixture. +- Google's results merge with the sources it indexes; Kaggle shared the most hits with it (3 of 60 across the bench). +- Moving to DataForSEO later would replace one module and add a key; nothing else changes. + +## Evidence + +- Probed 2026-10-06: `ds:0` held 20 results and a total of 151 for "climate temperature"; the dataseek User-Agent was served the same page as a browser. +- Bench: 6 of 6 queries answered, median 706 ms. diff --git a/docs/adr/0009-keys-and-contact-address.md b/docs/adr/0009-keys-and-contact-address.md new file mode 100644 index 0000000..c3e16a5 --- /dev/null +++ b/docs/adr/0009-keys-and-contact-address.md @@ -0,0 +1,23 @@ +# ADR 0009: Keys come from the environment or files, never flags + +- Status: accepted +- Date: 2026-10-06 + +## Context + +Eight sources take an API key (Hugging Face, Kaggle, data.gov, GitHub, FRED, Roboflow, Data Commons, NCBI). The contract forbids secrets on the command line (`../reference/contract.md`). Polite-pool APIs (DataCite, NCBI) want a contact address, and that address ends up in their logs. + +## Decision + +- A key is read from its environment variable, then from `credentials.toml` in the config directory. Kaggle additionally reads what its own CLI writes, `~/.kaggle/access_token` then the legacy `~/.kaggle/kaggle.json` (honoring `KAGGLE_CONFIG_DIR`), so a user who ran `kaggle auth` needs no setup. Without a token Kaggle is still asked, anonymously, and answers every page. +- Secrets are never formatted into output; `sources` and `doctor` report only where a key came from. `doctor` fails a key file other users can read. +- Every request's User-Agent is `dataseek/ (+https://github.com/lmarkmann/dataseek; mailto:user@dataseek.dev)`, so a provider can tell releases apart, find the project, and write to the maintainer; DataCite and NCBI also receive the address as `mailto`/`email`. It is the project's address, the same for every user; no user's address is ever sent. + +## Consequences + +- Sources with an optional key work out of the box; FRED, Roboflow and Data Commons are skipped until their key is set, and say so. Data Commons publishes a trial key, but its documentation allows it for single requests and asks anyone building an application for an own key, so dataseek never ships it. +- Rotating a key never touches dataseek's config beyond the one line or variable. + +## Evidence + +- DataCite gives identified clients 1,000 requests per 5 minutes against 500 anonymous; api.data.gov gives a personal key 1,000 requests an hour against 30 for `DEMO_KEY` (both documented, checked 2026-10-06). diff --git a/docs/adr/0010-dsk-is-dataseek.md b/docs/adr/0010-dsk-is-dataseek.md new file mode 100644 index 0000000..a17962d --- /dev/null +++ b/docs/adr/0010-dsk-is-dataseek.md @@ -0,0 +1,18 @@ +# ADR 0010: `dsk` is the same program under a short name + +- Status: accepted +- Date: 2026-10-06 + +## Context + +`dataseek` is long to type for a tool used many times a day. A shell alias would need setting up per shell and would not get completions. + +## Decision + +The crate is a library plus two binaries: `src/main.rs` builds `dataseek`, `src/bin/dsk.rs` builds `dsk`, and both call `dataseek::main()`. clap takes the usage name from `argv[0]`, so `dsk -h` says `Usage: dsk`, and `completion` writes a script for whichever name ran it. `--version` prints the package name, `dataseek`, for both. + +## Consequences + +- `cargo install --path .` installs both names. Every flag, output and exit code is identical. +- The library exists only to share the entry point; every module stays private, so it is not a public API. +- A library target means doctests exist; CI runs `cargo test --doc` next to nextest. diff --git a/docs/adr/0011-tls-stack-per-platform.md b/docs/adr/0011-tls-stack-per-platform.md new file mode 100644 index 0000000..3d8d16c --- /dev/null +++ b/docs/adr/0011-tls-stack-per-platform.md @@ -0,0 +1,22 @@ +# ADR 0011: The TLS stack is chosen per platform + +- Status: amended by [ADR 0014](0014-system-trust-store-on-every-platform.md) (Linux roots) +- Date: 2026-10-06 + +## Context + +ureq's default TLS is rustls with ring. ring compiles C against the target's system headers, and CI is one Linux job that cross-checks Windows and macOS with clippy (ADR 0002): the cross-check failed with `fatal error: 'assert.h' file not found` for `x86_64-pc-windows-msvc`, and the same holds for the Apple target. + +## Decision + +`Cargo.toml` enables ureq per target: `native-tls` (SChannel on Windows, Security.framework on macOS, both Rust bindings with no C build) on Windows and macOS, the default rustls everywhere else. `src/http.rs` selects the matching provider with the same `cfg`, and on the native targets verifies against the platform trust store. + +## Consequences + +- Windows and macOS users get their OS trust store, so a corporate root CA works there without configuration; Linux users get Mozilla's bundled roots. +- Behavior can differ by platform at the TLS layer. Known case: `cn.dataone.org` renegotiates TLS, which rustls refuses and Security.framework accepts; the DataONE adapter uses `search.dataone.org`, which works on both. +- Reverting to rustls everywhere breaks the cross-check, or requires dropping it from CI, which reverses ADR 0002. + +## Evidence + +- 2026-10-06: `cargo clippy --target x86_64-pc-windows-msvc` failed in ring's build script with rustls; with the split, both cross-targets pass clippy and a live search on macOS answered from six sources over native TLS. diff --git a/docs/adr/0012-benchmarks-criterion-local-codspeed-ci.md b/docs/adr/0012-benchmarks-criterion-local-codspeed-ci.md new file mode 100644 index 0000000..9bbbd66 --- /dev/null +++ b/docs/adr/0012-benchmarks-criterion-local-codspeed-ci.md @@ -0,0 +1,29 @@ +# ADR 0012: Benchmarks run as Criterion locally and as CodSpeed's CPU simulation in CI + +- Status: accepted +- Date: 2026-10-06 + +## Context + +A search spends seconds on the network and milliseconds on the CPU, so a CPU regression is invisible in `dataseek bench` until it is large. The CPU work that grows with input is in five places: parsing a downloaded catalog (SDMX-ML, Eurostat's table of contents), loading a cached catalog from JSON, searching it locally, fusing the per-source lists, and cleaning remote text. Wall-clock numbers from GitHub's shared runners are too noisy to compare across commits, and this private repository pays for runner minutes (ADR 0002). + +## Decision + +`benches/search.rs` is one Criterion target with a group per stage, each at three geometrically spaced sizes. The harness is `codspeed-criterion-compat` renamed to `criterion`, which is plain Criterion under `cargo bench` and CodSpeed's instrumentation under `cargo codspeed`. + +- Locally, `just bench` measures wall time; `--save-baseline` and `--baseline` compare two states of the tree. +- In CI, `.github/workflows/codspeed.yml` runs the same benches once under CodSpeed's CPU simulation on `ubuntu-latest`. The simulation counts instructions and models the cache, so a pull request is compared with its base on main without runner noise. CodSpeed's own pull request check reports regressions; Criterion never gates, because it exits 0 on a regression. +- The library stays private. The `internals` feature re-exports exactly the benchmarked functions under `dataseek::internals`, and the public-API lints (`missing_docs`, `must_use_candidate`, `return_self_not_must_use`, `missing_errors_doc`) are allowed only while that feature is on, since none of them can fire in the default build. + +## Consequences + +- CI gains a second workflow: one job, Linux only, OIDC upload, no secret. Pull requests trigger it only when `src/`, `benches/` or the manifests change; every push to main runs it so each commit there is a baseline. This is the one exception to ADR 0002's single job, kept apart so its path filter does not touch the required `linux` check. +- CodSpeed is an external service: the repository has to stay imported at codspeed.io, on the free plan (CPU simulation, up to five users). +- `cargo-codspeed` in the workflow is pinned to the version of the `codspeed` crate in `Cargo.lock`; bumping one without the other breaks the job. +- The per-adapter JSON mappers are not benchmarked: each reads at most one API page, microseconds next to its request. An adapter that pages through results, or a profile that shows a mapper hot, is the trigger to add one. +- `cargo codspeed run` measures only on Linux; on a Mac, the local numbers are Criterion's wall time. + +## Evidence + +- 2026-10-06: the `codspeed` crate's build script compiles C through `cc` but falls back to a no-op when that fails, and `nix` compiles for the Windows target, so `just cross` (clippy for `x86_64-pc-windows-msvc` and `aarch64-apple-darwin` with `--all-targets --all-features`) still passes with the bench target in the graph. +- 2026-10-06: `just bench --test` ran all 18 benchmarks once; baseline numbers are in [`../bench/`](../bench/). diff --git a/docs/adr/0013-opt-in-sources.md b/docs/adr/0013-opt-in-sources.md new file mode 100644 index 0000000..b1bec8b --- /dev/null +++ b/docs/adr/0013-opt-in-sources.md @@ -0,0 +1,33 @@ +# ADR 0013: Opt-in sources are asked only when named + +- Status: accepted; supersedes [ADR 0008](0008-google-dataset-search-from-page-data.md) +- Date: 2026-10-06 + +## Context + +[ADR 0004](0004-every-source-is-searched.md) searches every source by default. That is right where a source publishes an API for clients like this one, and wrong where it does not. Google Dataset Search has no API; dataseek reads its results page (ADR 0008). Google's terms bar bypassing its protective measures and automated access that breaks the machine-readable instructions on a page, and the host serves no robots.txt, so the position rests on silence rather than on permission. With thousands of installs each sending that request on every search, silence is not enough to make it a default. Mendeley Data is the second case: its terms bar bots without written permission and its robots.txt disallows the API path the module requests (source-by-source quotes in [`../synthesis/terms.md`](../synthesis/terms.md)). + +## Decision + +A registry row can carry an opt-in reason. `select` in `src/sources.rs` leaves such a source out of every run unless `--source` names it; `-c`, `-x` and an empty `-s` never reach it. `dataseek sources` marks the row `opt-in` and prints the reason under the table, `--json` rows carry `opt_in` (the reason, or null), and `dataseek doctor` lists each one. Today that is Google Dataset Search and Mendeley Data. + +Everything else ADR 0008 decided for Google stands, restated here because that ADR is now superseded: + +- One request per query to the results page; the `ds:0` block is parsed, with field positions pinned by a fixture test. +- A consent or "unusual traffic" interstitial is `Blocked`, which counts as an outage (skipped for 10 minutes unless named). +- A page without the block, or a non-empty result list in which no record matches the known layout, is a shape error, never an empty result; the search falls back to the last cached answer. +- A record missing its title or link is skipped, not guessed at. +- No paging (start, page and offset change nothing), no retries against Google, results cached for 6 hours like every source. + +## Consequences + +- A default search asks 74 of the 76 registered sources. Google's results no longer appear unless asked for; the other sources' overlap is unchanged. +- `dsk search climate -s google` is the way to ask for it, and `-s google,zenodo` combines it with others. +- A source whose terms need written permission is marked opt-in, not removed, so the day permission arrives the change is one line in the registry. +- The plain `sources` output gained a seventh column, the opt-in reason, empty for every other row. + +## Evidence + +- 2026-10-06: `datasetsearch.research.google.com/robots.txt` answers 404; the parent `research.google.com/robots.txt` allows `/` and disallows `/app/`. The page still returns 20 results and a total hit count at `ds:0` position 8 (153 to 157 for "climate temperature"), and `start`, `page` and `offset` return the same first 20. +- Bench 2026-10-06 (ADR 0008): 6 of 6 queries answered, median 706 ms; Kaggle shared the most hits with Google (3 of 60). +- Mendeley Data: clause 3.5 of its terms and `Disallow: /api/` in its robots.txt, quoted in the terms table. diff --git a/docs/adr/0014-system-trust-store-on-every-platform.md b/docs/adr/0014-system-trust-store-on-every-platform.md new file mode 100644 index 0000000..04b2928 --- /dev/null +++ b/docs/adr/0014-system-trust-store-on-every-platform.md @@ -0,0 +1,24 @@ +# ADR 0014: Every platform trusts the system's root certificates + +- Status: accepted; amends [ADR 0011](0011-tls-stack-per-platform.md) +- Date: 2026-10-06 + +## Context + +ADR 0011 split the TLS stack by platform so CI's cross-checks compile: native-tls on Windows and macOS, rustls everywhere else. The split also split the trust: Windows and macOS verified against the OS's store, Linux against Mozilla's roots compiled into the binary. Behind a TLS-inspecting proxy, which re-signs every connection under a root certificate the organisation installs on each machine, Linux therefore reached no source at all, while the same network worked on the other two platforms. + +## Decision + +The TLS stack stays split as ADR 0011 describes. The roots do not: `src/http.rs` asks ureq for `RootCerts::PlatformVerifier` on every platform, and on Linux `Cargo.toml` enables ureq's `platform-verifier` feature, which verifies through rustls-platform-verifier against the certificates rustls-native-certs loads from the system (`/etc/ssl/certs` and the distribution's equivalents). + +## Consequences + +- A root installed with the distribution's tool (`update-ca-certificates`, `update-ca-trust`) is trusted on Linux as it already was on Windows and macOS. +- On Linux, setting either `SSL_CERT_FILE` or `SSL_CERT_DIR` replaces the whole system store, unlike OpenSSL, where each overrides only its own default; `dataseek help environment` lists them. +- A Linux system with no CA bundle at all, such as a bare container image, now reaches no source: every request fails with "No CA certificates were loaded from the system", which `-v` shows per source. A certificate failure is its own class, neither an outage nor retried, so `search` says the certificates could not be verified rather than that the machine looks offline, and its hint names the distribution's `ca-certificates` package, which fixes it. Before, the bundled roots hid the gap. +- The binary no longer follows Mozilla's root program on its own schedule; on Linux it trusts whatever the system's store says, as on the other platforms. +- Reverting means the bundled roots again, and a proxy's root again unreachable on Linux. + +## Evidence + +- 2026-10-06: `linux_trusts_the_root_certificates_the_system_names` in `tests/cli.rs` serves a page over HTTPS under a root generated for the test and points `SSL_CERT_FILE` at it. With the bundled roots, `inspect` failed with an unknown-issuer error; with the platform verifier it read the page. It ran both ways in a Linux container before the change merged, and runs on every CI build. diff --git a/docs/adr/0015-mcp-server-over-stdio.md b/docs/adr/0015-mcp-server-over-stdio.md new file mode 100644 index 0000000..49b83ee --- /dev/null +++ b/docs/adr/0015-mcp-server-over-stdio.md @@ -0,0 +1,40 @@ +# ADR 0015: `dsk mcp` is a hand-written stdio server that runs each tool as a child + +- Status: accepted +- Date: 2026-10-07 + +## Context + +Agents with a shell call `dsk search --json`. Chat apps and IDE panels without a shell reach tools only through the Model Context Protocol. The current revision, 2026-07-28, is stateless: every request names its protocol version and the client's capabilities in `_meta`, `server/discover` replaces the `initialize` handshake, and every result carries `resultType`. Most installed clients still speak the handshake revisions, 2025-11-25 and 2025-06-18. The spec lets one server serve both. + +dataseek is blocking (ureq) and its release binary size is tracked (#20). Its commands also lean on process globals: `--offline` switches the HTTP client off for good, the narration mode and the cache location are set once in `main`, and a search past its deadline leaves its slow sources' threads running (ADR 0007). + +## Decision + +- `dsk mcp` reads newline-delimited JSON-RPC on stdin and writes one response per line on stdout, by hand, with `serde_json` and no new dependency. It serves both eras: a request naming `2026-07-28` in `_meta` is served statelessly, and `initialize` negotiates a handshake revision. One result shape serves both, since the handshake revisions allow the extra keys the stateless one requires. +- Three tools, `search`, `sources` and `inspect`. Each one's input schema is generated from the object `help --json` prints, and a call's arguments become that command's flags through the same object. A flag added to a command is a tool argument at once, and clap validates it as on the command line. +- Each call runs the binary the server was started as, ` --json `, in a child process, at most four at a time. Its stdout is the tool's structured content and text copy; its stderr events are relayed to the server's stderr; a failed run's error event becomes an `isError` result carrying the usual message, causes and `Try:` hint. `notifications/cancelled` kills the child. +- Every `search` gets an explicit `--timeout`, the argument or the flag's default, so an inherited `DATASEEK_TIMEOUT=0` cannot unbound it, and a `timeout` of 0 or over 300 seconds is refused. + +## Consequences + +- A tool's result is byte for byte what `--json` prints, and `--offline`, the narration mode and detached search threads end with the child, so no call leaks into the next. +- The server's own stdout is written only by the response writer, so it carries protocol messages and nothing else. +- Each call pays one process start, under the 20 ms startup budget, against a search that spends seconds on the network. +- Moving to an SDK means taking on an async runtime; the protocol code to replace is `src/mcp.rs`. + +## Evidence + +Release builds of `dataseek` on an Apple M4 under the current release profile (`opt-level = 3` for dataseek and `"z"` for dependencies, fat LTO, one codegen unit, stripped), measured 2026-10-07. "Without the server" is the same tree before `dsk mcp` was added. Crates are the unique packages `cargo tree -e normal` lists for the build host; across every target (`--target all`) both builds have 125. + +| build | binary | crates | +|---|---|---| +| without the server | 2,415,088 bytes | 82 | +| with the server | 2,565,632 bytes (+150,544, +6.2%) | 82 | + +The SDK was measured once, against v0.6.0 under the release profile of that time (`opt-level = 3`, thin LTO, stripped), and the comparison is kept as it was taken, relative to v0.6.0: + +| build | binary | crates | +|---|---|---| +| v0.6.0 | 4,938,832 bytes | 123 | +| v0.6.0 plus `rmcp` 3.5.1 (default features and `transport-io`) serving three stub tools | 6,269,584 bytes (+1.33 MB, +27%) | 163 (+40: tokio, futures, tokio-util, tracing, schemars, uuid, ...) | diff --git a/docs/adr/0016-rank-by-fusion-and-weighted-coverage.md b/docs/adr/0016-rank-by-fusion-and-weighted-coverage.md new file mode 100644 index 0000000..bcac905 --- /dev/null +++ b/docs/adr/0016-rank-by-fusion-and-weighted-coverage.md @@ -0,0 +1,33 @@ +# ADR 0016: Merge by identity, rank by fusion and rarity-weighted coverage + +- Status: accepted; supersedes [ADR 0006](0006-merge-by-identity-rank-by-fusion.md) +- Date: 2026-10-07 + +## Context + +Results arrive as about 75 ranked lists with incomparable scores, and only about 4% of merged hits are found by more than one source (ADR 0006's bench). Fusion therefore mostly interleaves lists that rarely agree, and the order of the top 10 rests on the coverage step that rescales each hit by how much of the query it mentions. ADR 0006 counted every query word the same, so in a sentence such as "monthly inflation by country since 2000" a hit carrying "country" and "by" outscored one carrying only "inflation". The relevance benchmark (`just relevance`, [`../reference/development.md`](../reference/development.md#relevance)) now measures the merged top 10 offline against graded judgments, which makes ranking changes testable instead of argued. + +## Decision + +`src/dedup.rs` does three things in order. + +1. **Identity.** Unchanged from ADR 0006: two records are one dataset when they share a DOI (also a concept DOI or one hidden in a resolver link), a normalized landing URL, or a normalized title with the same publisher; a title key only joins different sources; merging is transitive; the first source's fields win. +2. **Fusion.** Unchanged: reciprocal rank fusion (Cormack, Clarke and Buettcher, SIGIR 2009, doi:10.1145/1571941.1572114) with k = 60 over each source's best rank. +3. **Coverage.** The fused score is scaled by `0.25 + 0.75 * coverage`, where coverage is the summed weight of the query terms found in the title or description over the weight of all of them. A term weighs its inverse document frequency among the hits being ranked, in the BM25 form `ln(1 + (n - df + 0.5) / (df + 0.5))` (Robertson and Zaragoza, Foundations and Trends in Information Retrieval 2009, doi:10.1561/1500000019), so a word nearly every hit carries counts for little. A described hit that mentions no term is dropped, as before. + +The weights come from the merged hits of the query itself, not from a corpus: with no shared index across sources, the candidate set is the only collection the query has, which is the broker-side scoring of returned summaries the federated search literature describes for uncooperative sources (Shokouhi and Si, Foundations and Trends in Information Retrieval 2011, doi:10.1561/1500000010). + +## Consequences + +- Scores still need no calibration across sources, and a new source needs none. +- Short keyword queries rank as before; the change moves sentence-like queries, which agents send. +- A rare token that is not topical, a year or a code, also weighs a lot: "since 2000" lifts a table "in 2000$". +- Only the first 64 query terms are weighed. Terms past the 64th are ignored, so a hit matching only those counts as matching nothing. +- Against the adopted ranking, as `just relevance variants` measures it, reverting to plain coverage costs 0.028 nDCG@10 on the held-out queries and dropping coverage altogether costs 0.157. +- A change to this file is measured by `just relevance`, which CI runs; the gate fails when nDCG@10, P@10 or known-item MRR falls by more than a quarter of its bootstrap standard error, or when one query slips on its own (nDCG@10 down by more than 0.1, or a known item out of the top 10). + +## Evidence + +- Relevance benchmark 2026-10-07 ([`../bench/2026-10-07-relevance.md`](../bench/2026-10-07-relevance.md)): 48 queries, 11,657 recorded records, 882 judgments. Among 26 single changes (RRF constants, fusion depth, CombMNZ, Borda, round robin, source priors, coverage floors and shapes, title weighting, phrase bonus, function words, thin records) and a greedy stack, only IDF weighting improved the held-out half beyond the noise: nDCG@10 +0.028, paired 95% interval [+0.004, +0.066], with known-item MRR unchanged (0.554). +- Shipped ranking before and after, all 32 graded queries: nDCG@10 0.626 [0.538, 0.710] to 0.650 [0.575, 0.725]; P@10 0.697 to 0.722; non-relevant top-10 slots 97 of 320 to 89. +- Source priors fitted on the tuning half gained 0.060 there and lost 0.010 held out; RRF constants from 40 to 200 moved nDCG@10 by at most 0.006. diff --git a/docs/adr/0017-release-builds-on-a-platform-matrix.md b/docs/adr/0017-release-builds-on-a-platform-matrix.md new file mode 100644 index 0000000..140eecf --- /dev/null +++ b/docs/adr/0017-release-builds-on-a-platform-matrix.md @@ -0,0 +1,22 @@ +# ADR 0017: Release builds run on a per-platform matrix + +- Status: accepted +- Date: 2026-10-07 + +## Context + +PyPI wheels and `cargo binstall` both need prebuilt binaries for Linux (x86_64, aarch64), macOS (aarch64, x86_64) and Windows (x86_64). ADR 0002 keeps CI to one Linux job, which cross-checks Windows and macOS with clippy but cannot produce their binaries. + +## Decision + +`.github/workflows/release.yml` runs when a GitHub release is published, which release-plz does when its release PR merges. One job per target builds the wheel with maturin, on a machine of the target's OS (Linux aarch64 in maturin's cross container), and archives the same binaries as `dataseek-.tar.gz` (`.zip` on Windows) with a SHA-256 file. The archives are attested and attached to the release; the wheels and an sdist go to PyPI with `uv publish` through trusted publishing. A pull request that changes the release build runs the builds and publishes nothing. CI stays one Linux job. + +## Consequences + +- Each release starts eight machines, two of them macOS. They run once per version, never per push. +- A build that fails fails only this workflow. The tag and GitHub release already exist, so the fix is a rerun or a patch release, never a retag. +- macOS and Windows binaries are built only at release and on pull requests that change the release build; the clippy cross-checks in CI still catch compile errors there. + +## Evidence + +`maturin build --release --locked --target aarch64-apple-darwin` packs both `dataseek` and `dsk` into one `py3-none-macosx_11_0_arm64` wheel, `uvx --from dsk --version` runs it, and the workflow's archive step, run locally on that build, produces `dataseek-aarch64-apple-darwin/{dataseek,dsk}` with its checksum (2026-10-07). diff --git a/docs/adr/0018-a-search-never-waits-for-a-catalog-download.md b/docs/adr/0018-a-search-never-waits-for-a-catalog-download.md new file mode 100644 index 0000000..507b16b --- /dev/null +++ b/docs/adr/0018-a-search-never-waits-for-a-catalog-download.md @@ -0,0 +1,37 @@ +# ADR 0018: A search never waits for a catalog download it can do without + +- Status: accepted; amends [ADR 0007](0007-cache-budget-and-failure-handling.md) +- Date: 2026-10-08 + +## Context + +ADR 0007 downloads a missing or expired catalog inside the search and gives up on it at the deadline. Two catalogs take longer than the 20 second default to download: OpenNeuro pages its list 100 datasets at a time behind a cursor, and PhysioNet builds its one response for about 30 seconds. A thread past the deadline dies with the process before it stores anything, so these catalogs never reached the cache. Every search then waited the full 20 seconds and warned about them, on the first run, again a week later when the catalogs expired, and after every upgrade, since a catalog written by another release counts as expired. + +Fetching the work in parallel does not remove the wait. The OpenNeuro cursor is base64 of an offset, so every page can be asked for at once, but the server is the limit: 20 pages took 42.3 s one at a time, 11.5 s four at a time (with one HTTP 502), 18.2 s eight at a time and 12.0 s twenty at a time. PhysioNet is one request. An async runtime would add what ADR 0015 measured against (+1.33 MB, +40 crates) for sources that already run one thread each. + +## Decision + +- A catalog with a copy on disk is searched from that copy, fresh or not. An expired copy is reported as `expired catalog` and downloaded again after the search. +- A catalog with no copy at all downloads during the search. With a deadline set and the catalog not named with `-s`, the search stops waiting for it once every other source has finished, and reports it as still downloading. A named catalog, `--timeout 0` and `bench` wait for it, bounded only by the deadline. A catalog whose warming mark another search holds is not downloaded again; it reads as downloading at once. A cache entry that cannot be parsed is removed when read, so it counts as no copy. +- After a search, the catalogs it searched expired or stopped waiting for are handed to a detached `dataseek --quiet cache warm --source ` child with no stdin, stdout or stderr, in its own process group on Unix, writing to the same cache directory. The mark in the cache's `warming` directory is claimed by creating its file exclusively before the child starts, and released when it cannot start, so two searches never start the same download; it lasts 10 minutes, and the child releases it once the catalog has downloaded. A download that fails is recorded in the cache's `failures` directory until one succeeds, and a search that finds the catalog expired or still missing names the failure in its warnings. `--offline` starts none. +- `cache warm --source` downloads only the named catalogs. +- The trim evicts query results first, catalogs next and the marks last. A search writes about 42 query files (the 26 catalogs, Kaggle and the sources without their key write none) and a catalog is written once a week, so oldest first emptied the catalogs after some 45 searches under the 2,000 file cap: a cache measured at 1,972 query files held queries from only the last four minutes, and its catalogs had been evicted and downloaded again many times over. + +## Consequences + +- The first search on an empty cache costs what the live sources cost; the slow catalogs join from the next search on. +- A search can leave a process running for up to a minute after it exits. It writes only the cache, so a `dsk mcp` call still leaks nothing into the next call's output. +- A catalog whose background download fails is tried in the search again (still bounded by the other sources), and in the background again after 10 minutes; until one succeeds, each search that needed it says why the last one failed. +- An expired catalog's results are up to a week older than a fresh download's would be, for one search. + +## Evidence + +Release builds on an Apple M4, 2026-10-07 and 2026-10-08, against the live sources. The first row was measured again with the quorum of ADR 0019 in place, three new queries each on an empty cache. + +| run | before | after | +|---|---|---| +| first search, empty cache, default deadline | 20.0 s, 3 catalogs missing, every time | 2.00 to 2.41 s, 62 or 63 of 71 sources answered, 5 to 7 catalogs downloading in the background | +| the same search once the background download finished (about 33 s) | 20.0 s | 0.25 s from the query cache, 2.3 s for a new query | +| a search with PhysioNet's catalog expired | 20.0 s until `cache warm` ran | PhysioNet answered from the expired copy in 2 ms and was downloaded again in the background | + +Per-source latency on an empty cache with no deadline: median 0.55 s, 90th percentile 2.0 s; the tail was OpenNeuro 30.9 s, PhysioNet 24.1 s and ArrayExpress timing out at 15 s. With the catalogs cached, five new queries had a median source latency of about 0.2 s and a slowest source between 1.4 and 5.3 s. diff --git a/docs/adr/0019-stop-waiting-past-a-quorum.md b/docs/adr/0019-stop-waiting-past-a-quorum.md new file mode 100644 index 0000000..a8ce04d --- /dev/null +++ b/docs/adr/0019-stop-waiting-past-a-quorum.md @@ -0,0 +1,28 @@ +# ADR 0019: Past 90% of the sources, the rest get one second + +- Status: accepted; amends [ADR 0007](0007-cache-budget-and-failure-handling.md) +- Date: 2026-10-08 + +## Context + +ADR 0007 waits for every source up to a 20 second deadline. With catalogs searched from the cache (ADR 0018), most of the 71 default sources answer within two seconds, and a search still lasts as long as its slowest one: 3.55 s at the median and 9.57 s at the 90th percentile over the 48 relevance queries asked for the first time. The late source is a different one each time, though DataONE, whose server takes about 2.5 s on any new query, is late in two searches of three. + +## Decision + +- With a deadline set and no source named, once 90% of the sources waited for have answered, counted out of those that have not failed, a search waits at most one second longer for the rest. The share is rounded up, so a search of nine sources or fewer waits for all of them. Failures do not count toward the quorum, so a network that fails most sources quickly does not cut the one that would have answered. A catalog's first download, which the search does not wait for (ADR 0018), is not counted either. +- Sources named with `-s` get the whole deadline: naming one says its answer is wanted. `--timeout 0` and `bench` wait for every source, as before. +- A source left behind is not a failure, and its answer is discarded: the summary line names it (`68 of 71 sources answered, dataone not waited for`), `-v` and `--json` give it the status `not waited for after N s`, and `--json` sets `complete` to false. + +## Consequences + +- A default search ends about a second after 90% of its sources have answered, unless that never happens, when the 20 second deadline still bounds it. +- A source left behind is told so: the search sets a stop flag, and every adapter that pages checks it before its next page and gives up with an error that never marks the host as down and is never cached as an answer. The same flag is set at the deadline and when only first catalog downloads are left, so nothing the search stopped waiting for keeps paging until the process exits. +- The merged top 10 differs from waiting for all in about one slot in eleven, and nDCG@10 falls by 0.033 on the tuning half and not measurably on the held-out half. Anyone who wants every source pays for it with `--timeout 0`. +- `dsk mcp` refuses a `timeout` of 0, so an MCP client cannot ask for every source; it gets the same rule as the command line. +- Changing the share or the grace is one constant each in `src/search.rs`; `just relevance cutoff` replays a new pair, added to `RULES` in `examples/relevance/cutoff.rs`, against the recorded latencies before it ships. + +## Evidence + +[`../bench/2026-10-08-straggler-cutoff.md`](../bench/2026-10-08-straggler-cutoff.md): thirteen rules replayed against the relevance snapshot with per-source latencies measured live. Under this rule the median search falls from 3.55 s to 1.83 s, the 90th percentile from 9.57 s to 1.97 s and the slowest from 11.99 s to 2.05 s; the full top 10 keeps 91.2% of its results; nDCG@10 changes by -0.033 [-0.057, -0.012] on the tuning half and +0.001 [-0.016, +0.018] on the held-out half, and known-item MRR by +0.006 [+0.000, +0.017]. + +It is not the fastest rule with that loss: 80% plus one second ends 0.2 s sooner and leaves out 1.46 answering sources a search against 1.10. A fixed two-second deadline scores the same as this rule on the recorded connection, but it would cut every slower source on a slower connection, where a quorum waits for most of them; that argument is not something one recording measures. diff --git a/docs/adr/README.md b/docs/adr/README.md new file mode 100644 index 0000000..2920ee2 --- /dev/null +++ b/docs/adr/README.md @@ -0,0 +1,43 @@ +# Architecture decision records + +A decision that constrains future work lives here, once, and is cited from wherever it is load-bearing. Config files and workflow headers carry a one-line pointer at most. + +## What belongs here, and what does not + +| the fact | its home | +|---|---| +| a decision that would be expensive to reverse or tempting to re-litigate | **here**, one numbered file each | +| something parked as *not yet*, with the trigger that revisits it | [`watchlist.md`](watchlist.md) | +| how to run, configure or extend something | [`../reference/`](../reference/) | +| what reads across several dataset sources | [`../synthesis/`](../synthesis/) | +| a speed measurement of the code, with its machine | [`../bench/`](../bench/) | +| what shipped | [`../CHANGELOG.md`](../CHANGELOG.md) | +| an invariant a caller must not break | the source comment, in one line | + +## Format + +`NNNN-kebab-title.md` with four sections: **Context** (what forced the decision), **Decision** (present tense), **Consequences** (what it costs, and what breaks if it is reverted), **Evidence** (the measurement or incident that settled it). Under about fifty lines, except where the decision is a list: ADR 0004 carries the full source registry. Superseding an ADR means writing a new one and marking both, never editing the old one into agreement. + +## The record + +| # | decision | status | +|---|---|---| +| [0001](0001-release-plz-owns-the-version.md) | release-plz owns the version, the tag and the changelog | accepted | +| [0002](0002-one-linux-ci-job.md) | CI is one Linux job that cross-checks Windows and macOS | accepted | +| [0003](0003-the-cli-surface-sets-the-version.md) | The CLI surface sets the version | accepted | +| [0004](0004-every-source-is-searched.md) | Every source is searched, none is tiered; the full source list | accepted | +| [0005](0005-one-adapter-per-shared-protocol.md) | One adapter per shared protocol (CKAN, Dataverse, NADA, Socrata, STAC, SDMX, ...) | accepted | +| [0006](0006-merge-by-identity-rank-by-fusion.md) | Merge by identity, rank by fusion and query coverage | superseded by 0016 | +| [0007](0007-cache-budget-and-failure-handling.md) | A 30 MB cache, a search deadline, and sources that fail alone | amended by 0018, 0019 | +| [0008](0008-google-dataset-search-from-page-data.md) | Google Dataset Search is read from its results page data | superseded by 0013 | +| [0009](0009-keys-and-contact-address.md) | Keys come from the environment or files, never flags | accepted | +| [0010](0010-dsk-is-dataseek.md) | `dsk` is the same program under a short name | accepted | +| [0011](0011-tls-stack-per-platform.md) | The TLS stack is chosen per platform | amended by 0014 | +| [0012](0012-benchmarks-criterion-local-codspeed-ci.md) | Benchmarks run as Criterion locally and as CodSpeed's CPU simulation in CI | accepted | +| [0013](0013-opt-in-sources.md) | Opt-in sources are asked only when named | accepted | +| [0014](0014-system-trust-store-on-every-platform.md) | Every platform trusts the system's root certificates | accepted | +| [0015](0015-mcp-server-over-stdio.md) | `dsk mcp` is a hand-written stdio server that runs each tool as a child | accepted | +| [0016](0016-rank-by-fusion-and-weighted-coverage.md) | Merge by identity, rank by fusion and rarity-weighted coverage | accepted | +| [0017](0017-release-builds-on-a-platform-matrix.md) | Release builds run on a per-platform matrix | accepted | +| [0018](0018-a-search-never-waits-for-a-catalog-download.md) | A search never waits for a catalog download it can do without | accepted | +| [0019](0019-stop-waiting-past-a-quorum.md) | Past 90% of the sources, the rest get one second | accepted | diff --git a/docs/adr/watchlist.md b/docs/adr/watchlist.md new file mode 100644 index 0000000..29d8bc0 --- /dev/null +++ b/docs/adr/watchlist.md @@ -0,0 +1,89 @@ +# Watch list + +Things that are not adopted yet: each one is a clear *not yet*, with the trigger that would make it worth revisiting. When the trigger fires, the entry leaves this file and becomes a commit or an ADR. + +Keep entries small: the item, why it is parked, and the trigger. If you cannot name the trigger, the item does not belong here. + +## clap_complete dynamic completions + +Completing *values* (branch names, file arguments from the tool's own index) instead of just flags, by having the shell call back into the binary. Parked because the mechanism lives behind clap_complete's `unstable-dynamic` feature and upstream warns that shell code and binary can drift apart. + +Trigger: the feature drops the `unstable-` prefix in a clap_complete release. Check `cargo info clap_complete` and its CHANGELOG. + +## insta-cmd + +From the insta authors: snapshots a spawned process's stdout, stderr, and exit code in a single `.snap`, collapsing the assert_cmd + insta pairing in `tests/cli.rs` into one tool. Parked because the current pairing works and rewriting a working test harness for ergonomics alone churns every snapshot. + +Trigger: the next time the test harness is touched anyway (a new kind of assertion, a snapshot format annoyance), evaluate `insta-cmd` as part of that change. + +## clap 5 + +A `5.0` milestone exists in the clap repo with no date. The template's styling (`palette::help()`), error-kind matching in `main.rs`, and derive attributes all touch APIs that a major release tends to move. Parked because there is nothing to migrate to yet. + +Trigger: a clap 5.0 release. Read the migration guide before bumping; expect the `styles` and `error` modules and possibly the `unstable-dynamic` completion story above to land in the same move. + +## terminal-colorsaurus + +Queries the terminal for a dark or light background so defaults stay readable; bat and delta use it. Parked because the palette is five semantic constants chosen to work on both, and a runtime query adds a fallback path (what happens when the terminal does not answer) for a problem nobody has reported. + +Trigger: the palette gains a color that is genuinely unreadable on one background, or a user reports one. + +## A local OAI-PMH index + +Nearly every research repository speaks OAI-PMH, but it is harvest-only: searching it means keeping a local index of the harvested records, which for any large repository exceeds the 30 MB cache budget (ADR 0007). DataCite and OpenAIRE already harvest most of these repositories. + +Trigger: a repository users ask for that is in neither DataCite nor OpenAIRE, small enough to index within the budget. + +## Web Data Commons schema.org Dataset extracts + +Common Crawl's schema.org `Dataset` extracts are the same signal Google Dataset Search indexes, published as offline dumps of tens of gigabytes. Usable only as a downloaded local index. + +Trigger: Google Dataset Search's page data stops parsing for good (ADR 0013), so dataseek needs its own copy of the signal. + +## DataForSEO's Google Dataset Search endpoint + +A paid reseller endpoint ($0.0006 to $0.002 per 20 results, 2026-10-06) returning Google Dataset Search results as JSON. One module would replace `google.rs` and add a key. + +Trigger: Google blocks or breaks the results page for longer than a week. + +## OpenAlex datasets + +28.8 million works typed `dataset`, mostly sourced from DataCite. Since February 2026 search costs $0.001 per call, with $1 a day free per key and $0.10 without one. + +Trigger: OpenAlex adds dataset records that DataCite lacks, measured by a bench run with both. + +## Mendeley Data over OAuth + +The documented Digital Commons Data API now has `GET /search` with a `query` parameter (October 2026) but needs an OAuth client registered by e-mail, so it adds nothing a shipped tool can use. Its OAI-PMH repository (`https://data.mendeley.com/oai`) is open without registration, but at 50 records a page and at least 156,533 records (versions are separate records) a catalog adapter would take about 3,100 requests. The adapter stays opt-in (ADR 0013) because the site terms bar automated access without written permission. + +Trigger: Mendeley grants written permission for the site search, or publishes anonymous search on the documented host. + +## Roboflow Universe response layout + +The Universe search endpoint needs a key, so its response could not be recorded. `roboflow.rs` reads the `results` list that Roboflow's SDK reads, sends the key as a Bearer header and walks `page`; the fixture is the documentation's example hit inside that list. + +Trigger: the first run with a `ROBOFLOW_API_KEY`. Record a real response into `tests/fixtures/sources/roboflow.json`, check that the Bearer header is accepted and that `page=2` returns different hits, and drop the list keys `/data`, `/projects` and the bare array if `results` holds. + +## OpenNeuro live search + +OpenNeuro is downloaded as a catalog: 20 GraphQL requests, 37 to 90 seconds cold. A search does not wait for that download (ADR 0018), so on an empty cache OpenNeuro's results arrive only once the background download has landed, about a minute later. `advancedSearch(query: {keywords: [...], publicOnly: true}, first: N)` answers anonymously, ranked by relevance, in 0.9 seconds for 100 hits (October 2026), while the plain `search` field still returns null. Parked because switching `openneuro` from `listed` to `live` needs a new request, a re-recorded fixture and a `live_parsers` entry, which is a change of its own. + +Trigger: the next change to `openneuro.rs`, or `dataseek bench` showing OpenNeuro past the deadline on a cold cache. + +## World Bank Data360 search + +`POST https://data360api.worldbank.org/data360/searchv2` with `{"count":true,"search":"poverty headcount","top":20,"skip":0,"select":"series_description/idno, series_description/name, series_description/database_id"}` returns relevance-ranked indicators with a score and `@odata.count` (1,375 for that query), pages with `top` and `skip`, and is newer than the v2 indicator list (it carries the 2021 PPP series). Parked because the API is marked Beta, its documentation and terms could not be read, and adopting it means moving `worldbank` from `listed` to `live`. + +Trigger: published documentation and terms for the API, or the v2 indicator list going away. + +## Nightly size levers + +`-Zfmt-debug=none` (-224 KiB), `-Zlocation-detail=none` (-96 KiB) and the `optimize_for_size` std feature through `build-std` (-288 KiB) all shrink the release binary further ([measurement](../bench/2026-10-07-binary-size.md)). Parked because `rust-toolchain.toml` pins stable and a release profile cannot set them there. + +Trigger: any of them stabilizes as a `[profile]` key or a stable `-C` flag. Re-run `just bloat --what-if --levers=` before adopting it. + +## ureq without the bundled root store on macOS and Windows + +`src/http.rs` verifies through the platform's trust store there, yet ureq's `native-tls` feature also links `webpki-root-certs`. `native-tls-no-default` would drop it, but ureq 3.4.2 compiles its native-tls connector only under `native-tls`, so that build panics on the first HTTPS request. + +Trigger: a ureq release whose native-tls connector works under `native-tls-no-default`. A live `dataseek search` on macOS is the test, because no test here makes a real TLS connection. diff --git a/docs/assets/dataseek-banner.png b/docs/assets/dataseek-banner.png new file mode 100644 index 0000000..358532d Binary files /dev/null and b/docs/assets/dataseek-banner.png differ diff --git a/docs/bench/2026-10-06-algorithmic-speedups.md b/docs/bench/2026-10-06-algorithmic-speedups.md new file mode 100644 index 0000000..ee4fc71 --- /dev/null +++ b/docs/bench/2026-10-06-algorithmic-speedups.md @@ -0,0 +1,62 @@ +# CPU stages after the allocation and complexity pass, 2026-10-06 + +## Question + +Which CPU stages of a search spend their time on avoidable copies or on work that grows faster than the input, and how much does removing it save without changing any output? Primary metric: Criterion's median wall time per call, witnessed by retired instruction counts because wall time on this machine is noisy ([baseline](2026-10-06-baseline.md)). + +## Machine + +```text +date 2026-10-06 18:25 UTC +os macOS-27.0-arm64-arm-64bit-Mach-O +cpu Apple M4 +performance_cores 4 +efficiency_cores 6 +memory_gib 16 +power Battery Power +battery_percent 31 +low_power_mode False +thermal_warning False +rustc 1.99.0 +host aarch64-apple-darwin +llvm 23.1.1 +load_1m 5.49 +commit 40521d8 +dirty True +``` + +- warning: on battery: wall time follows the power manager +- warning: 1-minute load is 5.49: something else is running +- warning: efficiency cores present and macOS cannot pin threads: compare runs from one session + +## Setup + +- `just bench --save-baseline main` on the untouched tree (40521d8), then `just bench --baseline main` with the changes, both under `flock /tmp/heavy-build.lock`. The new `clean/ampersands` group was measured on an export of 40521d8 with the new bench file. +- Instruction counts: the same bench file under Criterion with a measurement that reads the benchmark thread's retired instructions (`thread_selfcounts`), in a scratch crate outside the repository, once against an export of 40521d8 and once against the changed tree. Counts repeat to within 0.01% between runs. +- Before and after were checked for identical output by a differential property test outside the repository: 20,000 random cases each for `clean`, catalog search, `merge` followed by `weigh`, and the Eurostat parser, with HTML, entities, bare ampersands, final sigma, dotted capital I and invisible characters in the inputs. A deliberately broken build failed it. + +## Results + +| stage | before | after | instructions before | after | change | +|---|---|---|---|---|---| +| `parse/sdmx/10000` | 8.34 ms | 6.80 ms | 154.4 M | 122.3 M | -20.8% | +| `parse/eurostat/16000` | 11.9 ms | 6.18 ms | 230.4 M | 118.6 M | -48.5% | +| `catalog/search/16000` | 11.7 ms | 3.15 ms | 227.7 M | 77.4 M | -66.0% | +| `catalog/load/16000` | 2.94 ms | 2.81 ms | 52.7 M | 45.4 M | -13.8% | +| `merge/6080` | 10.5 ms | 6.82 ms | 208.7 M | 127.7 M | -38.8% | +| `clean/200` | 1.12 us | 945 ns | 23.1 K | 20.1 K | -13.0% | +| `clean/20000` | 60.6 us | 53.2 us | 1.167 M | 1.131 M | -3.1% | +| `clean/ampersands/2000` | 12.8 us | 7.29 us | 300 K | 164 K | -45.4% | +| `clean/ampersands/20000` | 494 us | 72.4 us | 14.05 M | 1.61 M | -88.5% | + +The smaller sizes of each group moved by the same share. + +## Verdict + +Every stage is cheaper, and no output changed. The one complexity bug was in `clean`: each `&` searched the whole rest of the text for the `;` that would end an entity, so prose with bare ampersands and no semicolon cost O(n m) for n bytes and m ampersands, 38x the time for 10x the input. Bounding the search to the longest entity name makes it linear. Everything else was allocation: catalog search tokenized every entry into a vector of owned words and now folds it into one reused buffer, where a term is a word prefix exactly when the term led by a space occurs; the top results come from introselect instead of a full stable sort; merge sorts small keys instead of moving whole hits; the SDMX parser walks each element's attributes once; cached catalogs are checked as UTF-8 once instead of per string. + +## Caveats + +- Wall time comes from a machine on battery with other work running; the instruction counts are the claim, the milliseconds are a rough guide. +- The instruction counts are Apple Silicon counts and are not comparable with CodSpeed's Linux simulation, which judges the pull request (ADR 0012). +- The tree was dirty with the changes under test; the commits that follow 40521d8 on this branch identify the measured code. diff --git a/docs/bench/2026-10-06-baseline.md b/docs/bench/2026-10-06-baseline.md new file mode 100644 index 0000000..c036c45 --- /dev/null +++ b/docs/bench/2026-10-06-baseline.md @@ -0,0 +1,103 @@ +# Baseline of the CPU stages of a search, 2026-10-06 + +Detected: codspeed-criterion-compat (1 manifest), 1 bench target(s), profile.bench, no bench job in CI + +## Question + +How long does each CPU stage of a search take at realistic input sizes, does each grow linearly with its input, and how large is the wall-clock noise on this machine? This is the reference later changes are compared against. Primary metric: Criterion's median wall time per call. + +## Machine + +```text +date 2026-10-06 15:38 UTC +os macOS-27.0-arm64-arm-64bit-Mach-O +cpu Apple M4 +performance_cores 4 +efficiency_cores 6 +memory_gib 16 +power AC Power +battery_percent 3 +low_power_mode False +thermal_warning False +rustc 1.99.0 +host aarch64-apple-darwin +llvm 23.1.1 +load_1m 12.44 +commit cabd593 +dirty True +``` +- warning: 1-minute load is 12.44: something else is running +- warning: efficiency cores present and macOS cannot pin threads: compare runs from one session +- warning: working tree has uncommitted changes: the commit does not identify the code measured + +## Setup + +- `just bench --save-baseline main`, then `just bench --baseline main` on the same code (an A/A pair), both under `flock /tmp/heavy-build.lock`. +- The `bench` profile is release (`opt-level = 3`, thin LTO, one codegen unit) with symbols kept; feature `internals`; host target `aarch64-apple-darwin`; harness `codspeed-criterion-compat` 5.0.2 in its plain Criterion mode, 100 samples. +- Inputs are synthetic and shaped after real responses: `parse/sdmx` uses ECB-style SDMX-ML with 100, 1k and 10k dataflows; `parse/eurostat` uses table-of-contents TSV with 1k, 4k and 16k lines (the real file has 12,237 lines, of which 10,311 are datasets or tables); `catalog/search` and `catalog/load` use 1k, 4k and 16k entries with the query "sea surface temperature"; `merge` is 76 sources of 5, 20 and 80 records with 4% shared DOIs, followed by `weigh`; `clean` uses 200 B, 2 KB and 20 KB of HTML with entities and an escape sequence. + +Median per call, from the second, quieter run (load falling from 5 to 4): + +| stage | small | middle | large | +|---|---|---|---| +| `parse/sdmx` (100 / 1k / 10k flows) | 233 us | 2.33 ms | 19.7 ms | +| `parse/eurostat` (1k / 4k / 16k lines) | 2.25 ms | 8.56 ms | 36.8 ms | +| `catalog/search` (1k / 4k / 16k entries) | 1.20 ms | 5.02 ms | 23.0 ms | +| `catalog/load` (1k / 4k / 16k entries) | 492 us | 1.80 ms | 6.56 ms | +| `merge` (380 / 1,520 / 6,080 records) | 1.31 ms | 4.04 ms | 15.9 ms | +| `clean` (200 B / 2 KB / 20 KB) | 2.42 us | 11.3 us | 86.6 us | + +## Results + +`just scaling`, from the first run: + +```text +catalog/load 1000 -> 4000 p = 0.81 +catalog/load 4000 -> 16000 p = 1.07 +catalog/search 1000 -> 4000 p = 0.90 +catalog/search 4000 -> 16000 p = 1.13 +clean 200 -> 2000 p = 0.54 +clean 2000 -> 20000 p = 0.90 +merge 380 -> 1520 p = 1.08 +merge 1520 -> 6080 p = 1.14 +parse/eurostat 1000 -> 4000 p = 1.02 +parse/eurostat 4000 -> 16000 p = 0.83 +parse/sdmx 100 -> 1000 p = 1.00 +parse/sdmx 1000 -> 10000 p = 1.00 +``` + +`just verdict`, the second run against the first, on identical code: + +```text +catalog/load/1000 [ -16.52% -12.96% -9.56%] faster +catalog/load/16000 [ -10.94% -8.47% -5.72%] faster +catalog/load/4000 [ -3.02% +1.60% +6.82%] no change +catalog/search/1000 [ -56.52% -51.65% -47.09%] faster +catalog/search/16000 [ -46.92% -41.94% -37.14%] faster +catalog/search/4000 [ -40.53% -36.98% -34.29%] faster +clean/200 [ -29.50% -27.13% -24.77%] faster +clean/2000 [ +4.91% +6.63% +8.29%] slower +clean/20000 [ +4.02% +5.25% +6.50%] slower +merge/1520 [ -37.36% -35.16% -32.91%] faster +merge/380 [ -10.90% -8.51% -6.15%] faster +merge/6080 [ -48.85% -46.98% -45.19%] faster +parse/eurostat/1000 [ -37.21% -32.37% -28.89%] faster +parse/eurostat/16000 [ -35.62% -27.71% -19.34%] faster +parse/eurostat/4000 [ -35.81% -34.77% -33.70%] faster +parse/sdmx/100 [ -22.98% -15.61% -7.58%] faster +parse/sdmx/1000 [ -33.16% -21.73% -11.42%] faster +parse/sdmx/10000 [ -40.63% -33.68% -26.40%] faster +``` + +## Verdict + +Every stage is linear in its input: p stays between 0.81 and 1.14, and no family is flat, so each benchmark measures work that grows. The one exception is `clean`, whose p of 0.54 between 200 B and 2 KB is fixed per-call cost from its seven `replace` passes. The A/A pair is the important result. The code is identical, yet 15 of 18 rows say "faster" by up to 52%, so local wall time on this machine, with other agents compiling, cannot detect a regression smaller than about half. These rows are noise, not a change. Regressions are judged on CodSpeed's CPU simulation in CI (ADR 0012); local runs answer "roughly how long" and "does it scale". + +In absolute terms, one search with a warm cache pays about 23 ms of `catalog/search` per 16k-entry catalog and 7 ms to load it, against network latencies of 0.1 to 1.5 s (`docs/synthesis/bench-2026-10-06.md`). No stage is worth optimizing yet. + +## Caveats + +- The first run had 1-minute load between 12 and 39 at 3% battery while charging. The second had load 5 falling to 4. Neither was a quiet machine; the medians above are upper bounds. +- The tree was dirty with docs only (`docs/`), so commit cabd593 identifies the measured code. +- Synthetic inputs match the real responses in shape and size, not in word distribution; real titles repeat words more often, which favors the catalog search's early exits. +- No instruction-count witness was taken locally (`assets/apple_instructions.rs`): CodSpeed's simulation in CI is the layout-insensitive witness for this repository. diff --git a/docs/bench/2026-10-07-binary-size.md b/docs/bench/2026-10-07-binary-size.md new file mode 100644 index 0000000..826dd97 --- /dev/null +++ b/docs/bench/2026-10-07-binary-size.md @@ -0,0 +1,117 @@ +# Release binary size, 2026-10-07 + +## Question + +Where do the release binary's bytes go, what does each size lever save, and which levers are worth their cost (issue #20)? Primary metric: the file size of the release `dataseek` binary per target, which is what a download costs. Speed must not regress: Criterion on the CPU stages of a search, the startup bench, and CodSpeed on the pull request. + +## Machine + +```text +date 2026-10-07 01:20-01:40 UTC +os macOS 27.0 arm64 +cpu Apple M4 +performance_cores 4 +efficiency_cores 6 +memory_gib 16 +power battery, 66% and discharging at the end +rustc 1.99.0 +host aarch64-apple-darwin +llvm 23.1.1 +load_1m 4 to 6 +cross builds cargo-zigbuild with zig 0.17.0 +size tool cargo-bsize 0.0.2 +baseline commit 4ec54bb (v0.6.0) +``` + +## Setup + +- Every build ran under `flock /tmp/heavy-build.lock`, so nothing else compiled while a size or a time was taken. +- macOS targets are built with `cargo build --release --locked --target `. Linux and Windows targets are built with `cargo zigbuild --release --locked --target `. `x86_64-pc-windows-msvc` was not built: it needs cargo-xwin or a Windows machine, and neither is available here. Its size should follow `x86_64-pc-windows-gnu`, which links the same Rust code. +- `cargo bsize --bin dataseek` ranked crates, functions and generics. `cargo bsize --what-if --levers=all` rebuilt once per lever, each lever alone on top of the v0.6.0 profile. +- Each profile variant was built from the same tree with `--config profile.release...` overrides, so variants differ only in the profile. +- Speed: `just bench --save-baseline main` on v0.6.0, then `just bench --baseline main` per candidate profile; `just bench-startup` before and after. + +## Results + +File size of the release binary. "Profile" is the release profile change alone, "final" adds dropping `--jq`. + +| target | v0.6.0 | profile | final | +|---|---|---|---| +| `aarch64-apple-darwin` | 4.94 MB | 3.79 MB (-23.2%) | 2.42 MB (-51.1%) | +| `x86_64-apple-darwin` | 5.26 MB | 4.23 MB (-19.7%) | 2.65 MB (-49.6%) | +| `x86_64-unknown-linux-gnu` | 6.90 MB | 5.57 MB (-19.3%) | 3.87 MB (-43.9%) | +| `aarch64-unknown-linux-gnu` | 6.05 MB | 4.84 MB (-20.0%) | 3.36 MB (-44.5%) | +| `x86_64-unknown-linux-musl` | 6.64 MB | 5.37 MB (-19.1%) | 3.73 MB (-43.9%) | +| `aarch64-unknown-linux-musl` | 5.84 MB | 4.65 MB (-20.3%) | 3.22 MB (-44.8%) | +| `x86_64-pc-windows-gnu` | 5.61 MB | 4.57 MB (-18.5%) | 2.75 MB (-51.0%) | + +### Levers + +Measured on `aarch64-apple-darwin`. The `--what-if` column is cargo-bsize's shipped size (code, data and unwind tables, 4.5 MiB at v0.6.0), each lever alone. The file column is the stripped release binary, 4,938,704 bytes at v0.6.0. + +| lever | `--what-if` | file | cost | adopted | +|---|---|---|---|---| +| `lto = "fat"` | -272 KiB | 4.55 MB (-7.9%) | release build of the crate 10 s -> 42 s with dependencies cached | yes | +| `opt-level = "z"` for dependencies, with fat LTO | | 3.79 MB (-23.2%) | none measured (below) | yes | +| `opt-level = "z"` for dependencies, thin LTO | | 4.70 MB (-4.7%) | | no, fat LTO is what makes it pay | +| `opt-level = "z"` everywhere | -1.3 MiB | 4.39 MB thin, 2.97 MB fat | every CPU stage 43% to 287% slower | no | +| `opt-level = "s"` everywhere | | 5.06 MB thin (+2.4%), 3.74 MB fat | | no, larger than `z` and slower than 3 | +| `panic = "abort"` | -864 KiB | | a panicking adapter takes down the whole search | no | +| `codegen-units = 1` | 0 | | | already set | +| `share-generics=yes` | +240 KiB | | grows | no | +| `-C no-vectorize-loops` | -32 KiB | | slower hot loops for 0.7% | no | +| `-C force-unwind-tables=no` | -864 KiB | | only valid with `panic = "abort"` | no | +| `fmt-debug=none` | -224 KiB | | nightly only | no | +| `location-detail=none` | -96 KiB | | nightly only | no | +| `build-std` | +16 KiB | | nightly only, and grows | no | +| `optimize_for_size` (std feature) | -288 KiB | | nightly only, through build-std | no | +| `panic = "immediate-abort"` | -1.2 MiB | | nightly only, and the `panic = "abort"` cost | no | +| `min-size` (all of the above) | -2.8 MiB | | nightly only | no | +| `virtual-function-elimination` | | | the build failed on stable | no | + +Every dependency at `opt-level = "z"` turned out no slower than keeping the speed-relevant ones (quick-xml, serde_json, pulldown-cmark, memchr, the number formatters, gzip) at 3, and 82 KB smaller. Fat LTO inlines their hot functions into `dataseek`'s own code, which stays at 3, so no exception list is kept. + +### Speed + +Criterion, `just bench --baseline main`, median change against v0.6.0: + +| stage | fat LTO, dependencies at `z` (adopted) | `dataseek` at `z` as well | +|---|---|---| +| `parse/sdmx` 100 / 1k / 10k | -1.7% / -3.1% / -2.6% | +82% / +81% / +77% | +| `parse/eurostat` 1k / 4k / 16k | -3.9% / -4.5% / -3.8% | +108% / +105% / +106% | +| `catalog/search` 1k / 4k / 16k | -6.8% / -8.5% / -7.1% | +225% / +215% / +217% | +| `catalog/load` 1k / 4k / 16k | -7.4% / -2.5% / -5.7% | +43% / +50% / +46% | +| `merge` 380 / 1520 / 6080 | -5.1% / -8.2% / -8.0% | +106% / +98% / +91% | +| `clean` 200 / 2k / 20k | -3.5% / -4.4% / -3.6% | +281% / +286% / +287% | + +`just bench-startup`, mean ms, v0.6.0 -> adopted profile: `--version` 3.0 -> 2.6, `--help` 3.1 -> 2.7, bare 2.8 -> 2.5, `completion fish` 3.4 -> 3.2, `sources` 3.7 -> 2.7. All within noise or faster, all far inside their budgets. + +### Where the bytes went + +`just bloat --baseline` against v0.6.0, by crate: `core` -552 KiB, `clap_builder` -97 KiB, `alloc` -65 KiB, `pulldown_cmark` -38 KiB, `ureq_proto` -37 KiB, `ureq` -37 KiB from the profile; `jaq_core` -164 KiB, `jiff` -113 KiB, `jaq_json` -97 KiB, `aho_corasick` -81 KiB, `jaq_std` -80 KiB, `num_bigint` -57 KiB, `jiff_core` -41 KiB, `libm` -39 KiB, `regex_bites` -34 KiB removed with `--jq`. + +### Dependencies + +- `toml`, `signal-hook` and `indicatif` lost the default features dataseek never uses (`display`, `channel` and `iterator`, `wasmbind`). Thin LTO had already dropped that code, so the binary did not change; the lockfile lost 13 crates. +- `ureq` on macOS and Windows still bundles the Mozilla root store (`webpki-root-certs`), which the platform verifier never reads. ureq 3.4.2 compiles its native-tls connector only under the `native-tls` feature, which always pulls the roots in; `native-tls-no-default` builds, then panics on the first HTTPS request. See the watch list. +- The duplicate `base64` (0.22 through jaq-std, 0.23 through ureq) left with `--jq`. + +### --jq + +| build, on the adopted profile | `aarch64-apple-darwin` | +|---|---| +| with jaq, every built-in | 3,792,624 bytes | +| jaq-core and jaq-json only, no jaq-std built-ins | 3,161,808 bytes | +| without `--jq` | 2,415,024 bytes | + +`--jq` cost 1.38 MB, 36% of the binary after the profile change. jaq-std exposes its native built-ins only with every one of its features on, so a cheaper `--jq` would be missing `test`, `split`, `@csv`, `floor`, dates and more, failing on expressions a jq user expects to work. A default-on cargo feature would save nothing in the binaries people download. `--jq` was dropped; `--json | jq` does the same. + +## Verdict + +The release profile now uses fat LTO and builds every dependency at `opt-level = "z"`, while dataseek's own code stays at 3. The binary is 18% to 23% smaller per target, and no measured stage got slower. With `--jq` dropped, the binary is 44% to 51% smaller than v0.6.0. `panic = "abort"` saved 864 KiB on the v0.6.0 profile, but it would turn one adapter's panic into a failed search, so it stays off. + +## Caveats + +- Local wall time on this machine is direction only; an A/A run once reported identical code 52% faster ([baseline](2026-10-06-baseline.md)). The adopted profile's changes are small and all in the faster direction. The `dataseek` at `z` regression is far beyond the noise. CodSpeed's CPU simulation on the pull request is the verdict. +- No benchmark covers gzip decompression or HTTP parsing, which now run at `opt-level = "z"`. Both are dominated by network time, which runs from tenths of a second to seconds per source. +- The Linux and Windows binaries were cross-built with zig as the linker, and a release built on each platform may link differently. Their relative changes are the result; their absolute sizes are not. diff --git a/docs/bench/2026-10-07-relevance.md b/docs/bench/2026-10-07-relevance.md new file mode 100644 index 0000000..c65e7e2 --- /dev/null +++ b/docs/bench/2026-10-07-relevance.md @@ -0,0 +1,90 @@ +# Relevance of the merged ranking, 2026-10-07 + +## Question + +How good is the top 10 of a default search, and which change to merging and ranking makes it better on queries it was not tuned on? Primary metric: nDCG@10 over graded queries; known-item reciprocal rank must not fall. The method and the commands are in [`../reference/development.md`](../reference/development.md#relevance). + +## Setup + +- Snapshot recorded 2026-10-07 with dataseek 0.6.0 (`just relevance record`): 48 queries against the 73 default sources that may be stored (Kaggle is `persist: false` and never recorded), 10 results asked of each, no key, an empty cache. 68 sources answered every query and Hugging Face 46 of 48: it answered HTTP 400 on `iris` and `github-issues`. FRED, Roboflow and Data Commons were skipped for want of a key, and WHO failed on every query with a shape error ("not JSON"), which is an adapter defect outside this measurement. 11,657 records, 5.99 MB as committed and 1.58 MB gzipped. +- 882 judgments, one per dataset and query, over the pooled top 10 of every variant below and of the shipped ranking: 378 not relevant, 229 partly, 275 relevant. Labels were assigned blind to source and rank from the worksheets `just relevance pool` writes, with the rubric at the head of `judgments.tsv`: four grading passes under that one rubric, each over whole queries, then the rounds that followed as new variants surfaced new results. +- Known items are scored against `targets` in `queries.toml`, each with the page or registry entry that confirmed it. MIMIC-IV was retrieved by no source (only its 100-patient demo and separate modules came back), so its reciprocal rank is 0 for every ranking. +- Intervals are percentile bootstrap 95% over queries, 10,000 resamples; a change between rankings is the paired bootstrap of per-query differences. The bounds move by at most 0.0044 under two other seeds. + +## Results + +The shipped ranking before and after the adopted change, on the final labels: + +| metric | half | before | after | +|---|---|---|---| +| nDCG@10 (32 graded) | all | 0.626 [0.538, 0.710] | 0.650 [0.575, 0.725] | +| | tune | 0.642 [0.503, 0.780] | 0.663 [0.536, 0.789] | +| | held | 0.609 [0.505, 0.703] | 0.637 [0.561, 0.716] | +| P@10 (32 graded) | all | 0.697 [0.594, 0.794] | 0.722 [0.628, 0.809] | +| | tune | 0.663 [0.512, 0.806] | 0.688 [0.538, 0.825] | +| | held | 0.731 [0.587, 0.850] | 0.756 [0.637, 0.856] | +| known-item MRR (16) | all | 0.514 [0.304, 0.730] | 0.517 [0.308, 0.733] | +| | tune | 0.474 [0.199, 0.781] | 0.480 [0.210, 0.781] | +| | held | 0.554 [0.226, 0.887] | 0.554 [0.226, 0.887] | +| known items in the top 10 | | 13 of 16 | 13 of 16 | + +Every variant, each alone on top of the ranking shipped before (nDCG@10 by half, the paired held-out change, MRR by half): + +| variant | tune | held | held change [95% CI] | MRR tune | MRR held | adopted | +|---|---|---|---|---|---|---| +| shipped: RRF k = 60, term coverage | 0.642 | 0.609 | | 0.474 | 0.554 | | +| RRF k = 1 | 0.575 | 0.525 | -0.084 [-0.143, -0.026] | 0.505 | 0.580 | no | +| RRF k = 10 | 0.657 | 0.600 | -0.009 [-0.060, +0.032] | 0.480 | 0.559 | no | +| RRF k = 20 | 0.653 | 0.584 | -0.025 [-0.070, +0.003] | 0.480 | 0.556 | no | +| RRF k = 40 | 0.642 | 0.615 | +0.006 [+0.000, +0.017] | 0.474 | 0.554 | no | +| RRF k = 100 | 0.642 | 0.609 | +0.000 | 0.470 | 0.554 | no | +| RRF k = 200 | 0.641 | 0.609 | +0.000 | 0.470 | 0.554 | no | +| top 3 per source | 0.606 | 0.608 | -0.001 [-0.078, +0.076] | 0.526 | 0.582 | no | +| top 5 per source | 0.614 | 0.580 | -0.029 [-0.094, +0.032] | 0.505 | 0.570 | no | +| CombMNZ | 0.641 | 0.597 | -0.012 [-0.028, -0.000] | 0.466 | 0.552 | no | +| Borda, list-length normalized | 0.648 | 0.574 | -0.035 [-0.100, +0.028] | 0.492 | 0.569 | no | +| round robin | 0.535 | 0.507 | -0.102 [-0.166, -0.039] | 0.507 | 0.596 | no | +| source priors from tuning labels | 0.702 | 0.600 | -0.010 [-0.075, +0.056] | 0.385 | 0.553 | no | +| coverage floor 0 | 0.637 | 0.584 | -0.025 [-0.064, -0.000] | 0.480 | 0.567 | no | +| coverage floor 0.1 | 0.641 | 0.592 | -0.017 [-0.051, +0.000] | 0.480 | 0.556 | no | +| coverage floor 0.5 | 0.641 | 0.593 | -0.016 [-0.033, -0.002] | 0.469 | 0.552 | no | +| coverage squared | 0.641 | 0.604 | -0.005 [-0.026, +0.011] | 0.480 | 0.567 | no | +| title-weighted coverage | 0.638 | 0.619 | +0.010 [-0.053, +0.071] | 0.495 | 0.554 | no | +| **IDF-weighted coverage** | **0.663** | **0.637** | **+0.028 [+0.004, +0.066]** | 0.480 | 0.554 | **yes** | +| no rescoring (plain RRF) | 0.499 | 0.480 | -0.129 [-0.210, -0.058] | 0.450 | 0.539 | no | +| keep described hits that match no term | 0.634 | 0.609 | +0.000 | 0.474 | 0.554 | no | +| ignore function words | 0.673 | 0.605 | -0.004 [-0.054, +0.032] | 0.474 | 0.554 | no | +| whole query in the title x1.5 | 0.636 | 0.611 | +0.002 [-0.051, +0.045] | 0.422 | 0.578 | no | +| whole query in the title x2 | 0.635 | 0.621 | +0.012 [-0.045, +0.065] | 0.453 | 0.632 | no | +| thin records x0.5 / x0.75 / dropped when unmatched | 0.642 | 0.609 | +0.000 | 0.474 | 0.554 | no | +| greedy stack on tune: priors + function words + coverage squared + floor 0.5 | 0.747 | 0.608 | -0.001 [-0.080, +0.082] | 0.385 | 0.552 | no | + +The decision was taken on the labels that existed when it was made, 806 once each dataset is graded once per query: +0.047 [+0.004, +0.121] held out. The 76 labels added since, for results that later variants surfaced, shrank the estimate to the +0.028 above without changing the decision. The greedy stack rows carry up to five unjudged results, counted as not relevant. + +Re-run on top of the adopted ranking, no family's tuning-half winner improves the held-out half (the best, coverage squared, +0.007 [-0.018, +0.030]); `just relevance variants` prints that table. + +Pollution of the top 10 over the graded queries (slots a source fills, of which not relevant): + +| source | before | after | +|---|---|---| +| openaire | 100, 18 | 102, 19 | +| zenodo | 62, 17 | 63, 15 | +| europa | 29, 14 | 26, 11 | +| datacite | 72, 12 | 73, 13 | +| data-gov-uk | 20, 9 | 16, 7 | +| b2find | 20, 7 | 20, 7 | +| every slot | 320, 97 (30.3%) | 320, 89 (27.8%) | + +## Verdict + +Only one change beat the noise: weighting each query term by its inverse document frequency among the merged hits before measuring coverage. The fusion side is flat. Every RRF constant from 40 up scores within 0.006 of 60, because with 4% overlap the constant only reorders the few hits that two sources share; smaller constants, Borda and round robin interleave sources more aggressively and lose. Source priors are the clearest case of tuning to the benchmark: +0.060 on the tuning half they were fitted on, -0.010 held out. The rescoring step carries the ranking (dropping it costs 0.129 against the old ranking and 0.157 against the adopted one), and IDF is the one refinement of it that holds up. Its gain is entirely on natural-language queries: all 16 topical queries keep their nDCG@10, while the 16 natural-language ones gain 0.049 on average (10 better, 3 worse, the worst by 0.018, the best "labeled images of skin lesions for melanoma detection" by 0.276). A sentence carries words that most of its hits share, and under plain coverage each counted as much as the one word that names the data. + +## Caveats + +- The labels come from four grading passes under one rubric, not from an independent panel; they are a proposal. `just relevance variants` lists the labels whose flip would change the decision. +- Hugging Face failed on `iris`, and the Hugging Face copy of the dataset is one of that query's targets, so its reciprocal rank was measured without one of the sources that could have found it. +- DBnomics returns some Eurostat tables twice, under links that differ only in the case of the table code; dataseek does not merge them, so each copy is a separate result with its own label. +- With 16 graded queries per half, the held-out intervals are wide; +0.028 is the estimate, not a promise. +- Rare tokens that are not topical get large weights too: "monthly inflation by country since 2000" now ranks an income table "in 2000$" first. +- The snapshot has no Kaggle and none of the three keyed sources, so it measures ranking over the lists a keyless search sees. +- Catalog sources require every query term to match (`src/catalog.rs`), so long natural-language queries retrieve almost nothing from them; the ECB catalog returned nothing for "ECB euro foreign exchange reference rates". That is retrieval, which a frozen snapshot cannot measure. diff --git a/docs/bench/2026-10-08-straggler-cutoff.md b/docs/bench/2026-10-08-straggler-cutoff.md new file mode 100644 index 0000000..d909d40 --- /dev/null +++ b/docs/bench/2026-10-08-straggler-cutoff.md @@ -0,0 +1,40 @@ +# What it costs to stop waiting for the slowest sources, 2026-10-08 + +## Question + +A default search lasts as long as its slowest source. How much faster is a search that stops waiting once most sources have answered, and how much of the merged top 10 does it lose? Primary measures: wall time, the share of the full top 10 still shown, and nDCG@10 and known-item reciprocal rank against the relevance judgments ([`2026-10-07-relevance.md`](2026-10-07-relevance.md)). + +## Setup + +- `tests/fixtures/relevance/latency.jsonl`: the 48 relevance queries, each searched once with `search --json --timeout 0 --refresh` by dataseek 0.8.0 plus the cold-start branch, on an Apple M4 over a home connection in Germany, 2026-10-08, with every catalog cached and no key. Each line keeps every source's status and milliseconds. These are first asks: DataONE answers a repeated query in 0.46 s and a new one in about 2.5 s, so a second round would understate the tail. +- `just relevance cutoff tests/fixtures/relevance/latency.jsonl` replays each rule in `RULES` (`examples/relevance/cutoff.rs`) against the snapshot's per-source lists: a source that would have answered after the rule stopped waiting gets an empty list, and merging and ranking run as shipped. A quorum rule is counted as the search loop counts it, through its own `quorum`: answers out of the sources that have not failed. Catalog sources count as answering at once, as they do from the cache (ADR 0018). +- Deltas are against waiting for every source, with paired bootstrap 95% intervals over queries (10,000 resamples, fixed seed). The snapshot is the one `just relevance` scores, Hugging Face's lists included as recorded on 2026-10-08. + +## Results + +| rule | p50 | p90 | max | sources left out | full top 10 kept | nDCG@10 tune | nDCG@10 held | known-item MRR | +|---|---|---|---|---|---|---|---|---| +| wait for all | 3.55 s | 9.57 s | 11.99 s | 0 | 100% | | | | +| deadline 1 s | 1.00 s | 1.00 s | 1.00 s | 4.15 | 79.6% | -0.043 [-0.072, -0.016] | +0.006 [-0.054, +0.066] | +0.018 [+0.004, +0.034] | +| deadline 2 s | 2.00 s | 2.00 s | 2.00 s | 1.06 | 91.7% | -0.033 [-0.057, -0.012] | +0.005 [-0.009, +0.021] | +0.006 [+0.000, +0.017] | +| deadline 3 s | 3.00 s | 3.00 s | 3.00 s | 0.81 | 94.6% | -0.035 [-0.064, -0.011] | +0.006 [-0.010, +0.029] | +0.006 [+0.000, +0.017] | +| 80% + 0 s | 0.61 s | 0.68 s | 0.76 s | 10.90 | 56.9% | -0.160 [-0.288, -0.063] | -0.043 [-0.136, +0.045] | +0.070 [+0.010, +0.170] | +| 80% + 1 s | 1.60 s | 1.66 s | 1.76 s | 1.46 | 90.2% | -0.033 [-0.058, -0.012] | -0.001 [-0.017, +0.017] | +0.006 [+0.000, +0.017] | +| 90% + 0 s | 0.86 s | 0.98 s | 1.05 s | 5.71 | 73.5% | -0.086 [-0.149, -0.031] | -0.040 [-0.110, +0.023] | +0.059 [+0.004, +0.157] | +| 90% + 0.5 s | 1.36 s | 1.49 s | 1.55 s | 1.96 | 86.0% | -0.040 [-0.065, -0.018] | -0.026 [-0.064, +0.007] | +0.008 [+0.000, +0.020] | +| **90% + 1 s** | **1.83 s** | **1.97 s** | **2.05 s** | **1.10** | **91.2%** | **-0.033 [-0.057, -0.012]** | **+0.001 [-0.016, +0.018]** | **+0.006 [+0.000, +0.017]** | +| 90% + 2 s | 2.75 s | 2.95 s | 3.02 s | 0.81 | 94.6% | -0.035 [-0.064, -0.011] | +0.006 [-0.010, +0.029] | +0.006 [+0.000, +0.017] | +| 95% + 0.5 s | 1.64 s | 2.00 s | 2.99 s | 1.23 | 91.2% | -0.032 [-0.056, -0.012] | +0.004 [-0.009, +0.020] | +0.006 [+0.000, +0.017] | +| 95% + 1 s | 2.05 s | 2.48 s | 3.49 s | 0.96 | 92.3% | -0.036 [-0.064, -0.013] | +0.013 [-0.007, +0.037] | +0.006 [+0.000, +0.017] | +| 95% + 2 s | 2.99 s | 3.48 s | 4.49 s | 0.75 | 95.0% | -0.034 [-0.062, -0.010] | +0.006 [-0.010, +0.029] | +0.001 [+0.000, +0.002] | + +The snapshot's nDCG@10 is 0.655 on the tuning half and 0.626 on the held-out half, so the tuning-half loss of 0.033 is about 5% of it. + +Under 90% + 1 s, the answering sources left out were DataONE in 31 of 48 searches (median 3.7 s when late), Zenodo in 11 (5.6 s), DBnomics and DataCite in 4 each, CESSDA, recherche.data.gouv and BioStudies in 2, and DANDI and OmicsDI in 1. + +## Reading + +- Every rule that waits at least about a second past most answers, or two seconds in all, costs about the same 0.033 of tuning-half nDCG, from deadline 2 s to 95% + 2 s: the loss is the one source that is almost always late, DataONE, and Zenodo when it is slow. Waiting longer buys little until the wait covers DataONE's first-ask latency, which is waiting for all. Shorter waits cost more: 0.043 at deadline 1 s, 0.086 at 90% + 0 s, 0.160 at 80% + 0 s. +- The held-out half shows no loss under any of those rules, and known-item MRR rises slightly: the late sources put a little less noise above the targets than they add relevant results. +- Among them, 80% + 1 s is fastest (1.60 s at the median, 1.76 s at worst) and leaves out 1.46 answering sources a search; 90% + 1 s takes 0.2 s longer and leaves out 1.10, keeping 91.2% of the full top 10 against 90.2%. A fixed 2 s deadline matches 90% + 1 s on every column here, but it is set for this connection: on a slower one it cuts every source that needs more than two seconds, while a quorum waits for most of them wherever they are. One connection's recording cannot show that difference, so it is the reason for the quorum rather than a measured result. +- DataONE's time is its server's: the same Solr request takes 2.5 s for a new query and 0.46 s repeated, with or without the abstract field and the filter query. Zenodo answered new queries in 0.3 to 1.1 s on a later check, so its slow answers here were load on its side. diff --git a/docs/bench/baseline-darwin-arm64.json b/docs/bench/baseline-darwin-arm64.json new file mode 100644 index 0000000..24e6de2 --- /dev/null +++ b/docs/bench/baseline-darwin-arm64.json @@ -0,0 +1,384 @@ +{ + "results": [ + { + "command": "target/release/dataseek --version", + "mean": 0.0027013186500000003, + "stddev": 0.0002525547923683878, + "median": 0.0026273750000000004, + "user": 0.0014202499999999999, + "system": 0.0007911, + "min": 0.0023718330000000003, + "max": 0.0033407080000000004, + "times": [ + 0.0029062090000000003, + 0.0033407080000000004, + 0.0027210420000000003, + 0.002900208, + 0.002668417, + 0.0025341250000000004, + 0.0025843330000000003, + 0.002608584, + 0.0024308750000000003, + 0.00251875, + 0.002612792, + 0.0023727080000000003, + 0.003000458, + 0.002855916, + 0.002786666, + 0.003099833, + 0.0026419580000000002, + 0.0023718330000000003, + 0.002513541, + 0.002557417 + ], + "memory_usage_byte": [ + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360, + 6799360 + ], + "exit_codes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + { + "command": "target/release/dataseek --help", + "mean": 0.002689208250000001, + "stddev": 0.00010576937273684075, + "median": 0.002671021, + "user": 0.0014118999999999998, + "system": 0.00074625, + "min": 0.002505083, + "max": 0.0028914580000000004, + "times": [ + 0.002678625, + 0.0028914580000000004, + 0.0028141250000000002, + 0.002555083, + 0.0028037500000000003, + 0.002698583, + 0.002574083, + 0.002647125, + 0.002759917, + 0.002505083, + 0.002601083, + 0.0026605, + 0.002592292, + 0.002663417, + 0.0028517910000000002, + 0.0026897500000000003, + 0.0026589580000000003, + 0.002833, + 0.00268, + 0.0026255420000000002 + ], + "memory_usage_byte": [ + 7028736, + 7028736, + 7028736, + 7028736, + 7028736, + 7028736, + 7028736, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504 + ], + "exit_codes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + { + "command": "target/release/dataseek", + "mean": 0.00265785425, + "stddev": 0.00011512437851932369, + "median": 0.002671021, + "user": 0.00137965, + "system": 0.0007389, + "min": 0.002487792, + "max": 0.00286075, + "times": [ + 0.002728958, + 0.002713292, + 0.002510083, + 0.002695584, + 0.0026076660000000002, + 0.0025245420000000003, + 0.00286075, + 0.0027651670000000002, + 0.0025282910000000002, + 0.002592084, + 0.002817958, + 0.002647834, + 0.002694208, + 0.002774167, + 0.002487792, + 0.0026108340000000002, + 0.0027287080000000003, + 0.002572459, + 0.0025032080000000003, + 0.0027935 + ], + "memory_usage_byte": [ + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504, + 7061504 + ], + "exit_codes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + { + "command": "target/release/dataseek completion fish", + "mean": 0.0030980188000000004, + "stddev": 0.00009654486082787467, + "median": 0.0030867710000000003, + "user": 0.0017672, + "system": 0.0007849999999999999, + "min": 0.00289775, + "max": 0.00327725, + "times": [ + 0.003007459, + 0.00327725, + 0.0032135830000000003, + 0.003176167, + 0.003199042, + 0.0030591670000000002, + 0.003072041, + 0.003095959, + 0.00289775, + 0.003167875, + 0.002992666, + 0.003077583, + 0.0031593750000000003, + 0.003140167, + 0.0030310830000000004, + 0.0031957920000000003, + 0.002978875, + 0.003160041, + 0.003055042, + 0.003003459 + ], + "memory_usage_byte": [ + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544 + ], + "exit_codes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + { + "command": "target/release/dataseek sources", + "mean": 0.00285293545, + "stddev": 0.00015436674942571194, + "median": 0.002844854, + "user": 0.0014918499999999999, + "system": 0.0008346000000000001, + "min": 0.0026446250000000003, + "max": 0.0032054170000000003, + "times": [ + 0.002893208, + 0.002728959, + 0.002817875, + 0.003161792, + 0.0029356250000000003, + 0.0032054170000000003, + 0.0030236670000000003, + 0.002702167, + 0.002942375, + 0.00273775, + 0.002663833, + 0.0028852080000000002, + 0.0028718330000000003, + 0.002728583, + 0.002909375, + 0.002750792, + 0.0026446250000000003, + 0.0027603750000000002, + 0.002938875, + 0.002756375 + ], + "memory_usage_byte": [ + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544, + 8044544 + ], + "exit_codes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + } + ] +} diff --git a/docs/bench/baseline-linux-x86_64.json b/docs/bench/baseline-linux-x86_64.json new file mode 100644 index 0000000..5247d7d --- /dev/null +++ b/docs/bench/baseline-linux-x86_64.json @@ -0,0 +1,384 @@ +{ + "results": [ + { + "command": "target/release/dataseek --version", + "mean": 0.0013930515, + "stddev": 0.00003891771870241113, + "median": 0.001394561, + "user": 0.0002854, + "system": 0.0008587000000000001, + "min": 0.001319733, + "max": 0.0014953820000000002, + "times": [ + 0.0013737640000000002, + 0.001414469, + 0.001389072, + 0.001421973, + 0.001393979, + 0.001349759, + 0.0013773000000000001, + 0.001319733, + 0.0014035990000000002, + 0.0013951430000000002, + 0.001401756, + 0.001379714, + 0.0014018160000000002, + 0.001422424, + 0.001436351, + 0.001424969, + 0.001349469, + 0.001346423, + 0.0013639350000000001, + 0.0014953820000000002 + ], + "memory_usage_byte": [ + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000, + 5120000 + ], + "exit_codes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + { + "command": "target/release/dataseek --help", + "mean": 0.00148691425, + "stddev": 0.00003172450230354911, + "median": 0.0014884780000000001, + "user": 0.0002516, + "system": 0.0010047, + "min": 0.0014349380000000002, + "max": 0.001553591, + "times": [ + 0.001535834, + 0.0014856320000000002, + 0.001503636, + 0.0014467500000000001, + 0.0014931360000000002, + 0.001444495, + 0.001524856, + 0.0014903310000000001, + 0.001509087, + 0.001512712, + 0.001553591, + 0.001493788, + 0.001496563, + 0.001469742, + 0.00147393, + 0.0014807730000000001, + 0.001486625, + 0.0014531820000000001, + 0.0014349380000000002, + 0.001448684 + ], + "memory_usage_byte": [ + 5255168, + 5255168, + 5255168, + 5255168, + 5255168, + 5255168, + 5255168, + 5255168, + 5255168, + 5255168, + 5255168, + 5255168, + 5255168, + 5255168, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896 + ], + "exit_codes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + { + "command": "target/release/dataseek", + "mean": 0.00140043335, + "stddev": 0.00003044489054924101, + "median": 0.001398149, + "user": 0.0004724, + "system": 0.00070495, + "min": 0.001354719, + "max": 0.0014499340000000002, + "times": [ + 0.0014371330000000002, + 0.0014499340000000002, + 0.0014178160000000001, + 0.0013886010000000002, + 0.001361681, + 0.0013725710000000002, + 0.0014342970000000002, + 0.001386768, + 0.0014352780000000001, + 0.0014107520000000001, + 0.0014034490000000002, + 0.0014214520000000001, + 0.001368304, + 0.001429668, + 0.0013593770000000002, + 0.0014301090000000002, + 0.0013650070000000001, + 0.001392849, + 0.001388902, + 0.001354719 + ], + "memory_usage_byte": [ + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896, + 5328896 + ], + "exit_codes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + { + "command": "target/release/dataseek completion fish", + "mean": 0.0021043349999999997, + "stddev": 0.00005822186537719313, + "median": 0.0020861935, + "user": 0.0008881, + "system": 0.00098005, + "min": 0.002051949, + "max": 0.002273605, + "times": [ + 0.00208433, + 0.002117351, + 0.0021283820000000003, + 0.0021698670000000002, + 0.002060405, + 0.002079591, + 0.00206819, + 0.002093437, + 0.0020728780000000002, + 0.0020612670000000003, + 0.002198312, + 0.002273605, + 0.00205219, + 0.002062318, + 0.002063431, + 0.0020940480000000003, + 0.002051949, + 0.002088057, + 0.002176491, + 0.002090601 + ], + "memory_usage_byte": [ + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552 + ], + "exit_codes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + { + "command": "target/release/dataseek sources", + "mean": 0.0016013402000000002, + "stddev": 0.00004337564386490115, + "median": 0.0015904375000000003, + "user": 0.00041165000000000006, + "system": 0.0009561499999999999, + "min": 0.0015342930000000002, + "max": 0.001714409, + "times": [ + 0.00161325, + 0.001714409, + 0.0015593500000000001, + 0.0015841260000000002, + 0.001571632, + 0.001567435, + 0.001653696, + 0.0016199430000000002, + 0.001565231, + 0.001606498, + 0.0015614140000000001, + 0.001572033, + 0.001629971, + 0.001582854, + 0.0016628740000000002, + 0.001616767, + 0.001574819, + 0.0016394600000000001, + 0.0015342930000000002, + 0.0015967490000000002 + ], + "memory_usage_byte": [ + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552, + 5783552 + ], + "exit_codes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + } + ] +} diff --git a/docs/reference/README.md b/docs/reference/README.md new file mode 100644 index 0000000..fd8ef53 --- /dev/null +++ b/docs/reference/README.md @@ -0,0 +1,14 @@ +# Reference + +How the project works and how to operate it, one file per domain. Each file describes the current state; when that state changes, the file changes with it. + +What is not here: why a choice was made ([`../adr/`](../adr/)) and what shipped ([`../CHANGELOG.md`](../CHANGELOG.md)). + +| file | covers | read when | +|---|---|---| +| [setup.md](setup.md) | dev tools to install, `just description` | setting up a machine | +| [development.md](development.md) | daily recipes, lints, tests, dependencies, MSRV | writing code | +| [contract.md](contract.md) | flags, streams, errors, exit codes, color, the lints that enforce them | changing what the CLI prints or accepts | +| [supply-chain.md](supply-chain.md) | cargo-deny, zizmor, action pins, workflow permissions | touching dependencies or workflows | +| [keys-and-cache.md](keys-and-cache.md) | API keys, where they are read from, the contact address, the cache and its commands | setting up a key or wondering why a result is old | +| [release.md](release.md) | conventional commits, the release loop, `.github/release-plz.toml`, the App token | merging anything, or when a release did not happen | diff --git a/docs/reference/contract.md b/docs/reference/contract.md new file mode 100644 index 0000000..e358e8a --- /dev/null +++ b/docs/reference/contract.md @@ -0,0 +1,154 @@ +# Quality contract + +The code, not the README, enforces this contract. The lints in `Cargo.toml` exist for exactly that reason: a rule that only fires in CI is found too late to be useful. + +## Version + +The version lives only in `Cargo.toml`. Clap reads it via `#[command(version)]`, so `--version` prints `name x.y.z` and nothing else. Never hardcode a version string anywhere else. + +## Flags + +- `-h/--help`, `-V/--version` +- Global `-q/--quiet`, `-v/--verbose` (repeatable) +- `--json`, `--color=auto|always|never`, `--no-color`, `--plain`, `--no-progress` +- `--cache-dir DIR` and `--connect-timeout SECS`, each with a `DATASEEK_*` variable; the cache size budget has only its variable, `DATASEEK_CACHE_MAX_MB` + +`search` reads `-x`, `--per-source`, `-n` and `--timeout` from `DATASEEK_EXCLUDE`, `DATASEEK_PER_SOURCE`, `DATASEEK_LIMIT` and `DATASEEK_TIMEOUT` too. A flag beats its variable, which beats the default; `dataseek help environment` lists them all. A source marked `opt-in` in `dataseek sources` runs only when `-s` names it ([ADR 0013](../adr/0013-opt-in-sources.md)). + +`-v` is verbose, never version. `--color` follows the ecosystem standard used by git, ripgrep, and fd: + +- `auto` colors only on a terminal and honors `NO_COLOR`. +- `never` strips color. +- `always` forces color even through a pipe, for `| less -R`. + +`--no-color` and `--plain` are shorthands for `--color=never`. Because clap prints its own help and usage errors before the flags are resolved, `src/lib.rs` scans the arguments for these three first and hands clap the result, so `dsk --no-color nonsense` is as colorless as `dsk --no-color sources`. + +`-h` lists the flags people type daily and at most three examples; `--help` adds the rest (`--no-color`, `--no-progress`, `--cache-dir`, `--connect-timeout`), the exit codes, the help topics and the issues address. + +Secrets never arrive as flags, which leak into shell history and process listings: API keys come from the environment or `credentials.toml` ([`keys-and-cache.md`](keys-and-cache.md), ADR 0009). + +## Help surfaces + +- A bare `dataseek` prints the overview on **stdout** and exits `0`: the name and version, the commands in three small groups (Search, Upkeep, Shell), and a footer pointing at `-h` and `--help`. It is orientation, so `dsk | head` shows it. `src/help.rs` holds the groups as names only; each line's description is the command's `about`, the same line `-h` shows. A unit test fails when the overview and `-h` list different commands or list them in a different order. +- `dataseek help ` is that command's `--help`. `dataseek help environment` lists the variables that change what it does, `dataseek help exit-codes` every code it returns. +- `dataseek help --json` describes the whole surface as data for scripts and agents: commands, flags with their type (`boolean`, `integer`, `string` or `count`), value names, possible values, defaults, the `minimum` and `maximum` of a ranged integer, and variables, and the exit codes, all generated from the clap definition. A bare `dataseek --json` prints the same object. `dataseek help --json` prints that command's entry of it: its own flags, with the global ones listed once, on the root. + +## stdout is data, stderr is status + +Every byte of stdout goes through a handle from `src/output.rs`, including the two commands whose output is raw data, `completion` and `man`. Narration, spinners, and progress go through `src/ui.rs` on stderr, in one of four modes: + +| who reads stderr | what it gets | +|---|---| +| a terminal | status lines plus live bars and spinners with elapsed time | +| a pipe, or `--no-progress` | the same status lines, plain, and no frames | +| `--json` | each status line, and each `-v` note, as an NDJSON event tagged `dataseek-events/1` | +| `--quiet` | nothing but the error | + +So a piped search still announces itself at once and sums up at the end, and no spinner frame can reach a log. What must never happen is a frame on stdout, and that is guaranteed by the layer only ever writing to stderr. `doctor` does not narrate: its checks take milliseconds, so it prints only its report. + +`search` opens with the number of sources it will ask. A source missing its required key is skipped before any request, so it is left out of that number and counted after it (`1 needs a key, see dataseek doctor`); when no chosen source can run, there is no opening line, only the error. + +`search` prints its summary after the results, so the last line says how many matched, how many sources answered, which ones it stopped waiting for, and how to see more. An empty result is a stderr line, never text on stdout. + +Each text result is four lines: the rank and title, the URL, a muted line of facts, and the description. The facts are the sources that found it, then publisher, date, size, license and DOI, whichever are known, separated by ` | `. + +Other text output fits the terminal by wrapping, never by cutting: on a terminal a long value continues under its own column, and in a pipe it stays on one line so a script can read it. `inspect` wraps its fields that way, its description within 40 to 80 columns like a search result's, and `doctor` each check's detail. `sources` sizes each column to its longest value and wraps the notes under its table, and `help environment` wraps what each variable does under its column. On a terminal its file list opens with the count and total size and gives each file two lines, name, size and format, then the link and checksum indented under them; when name, size and format do not fit side by side, size and format get a line of their own. In a pipe each file stays one line. + +This is why `Cargo.toml` denies `print_stdout` and `print_stderr`: a stray `println!` is a contract violation, not a style preference. + +## JSON + +Every `--json` output is one object with a `schema` tag naming its shape and version (`dataseek-search/1`, `dataseek-sources/1`, `dataseek-doctor/1`, ...). A key that changes meaning or disappears bumps the tag; a new key does not. On a terminal the JSON is indented, in a pipe it is one line. To pick fields, pipe it into `jq`. A failed run prints its error event on stderr and nothing on stdout, and `jq` exits 0 on empty input, so a script runs the pipeline under `set -o pipefail` (bash, zsh) or checks `$pipestatus[1]` (fish) to see the failure. `search --json` carries `complete`, false when the search stopped waiting for a source or a catalog was still downloading, so its results may lack what those would add. `completion` and `man` print their script and page whatever the flag when stdout is not a terminal. `tests/snapshots/` freezes the search, sources, doctor, cache info, inspect, exit-codes and error-event shapes. + +`inspect --json` (`dataseek-inspect/1`) prints `dataset`, the page's own JSON-LD node as the page wrote it, and beside it `files`, dataseek's reading of the file list, so a `files` key on the page is never overwritten. Every string of the page's metadata, keys included, has its control characters (C0 other than newline and tab, DEL, and C1) replaced by a space before it is printed, as text or as JSON, so a page cannot drive the terminal that shows it. + +## MCP mode + +`dataseek mcp` serves `search`, `sources` and `inspect` to MCP clients over stdio ([ADR 0015](../adr/0015-mcp-server-over-stdio.md)). A client registers it as command `dsk` with arguments `["mcp"]`. + +- **Protocol.** Requests naming revision `2026-07-28` in `_meta` are served statelessly, with `server/discover`; clients that open with `initialize` get revision `2025-11-25` or `2025-06-18`. A request naming any other revision gets `-32022` with the supported list. +- **stdout** carries one JSON-RPC message per line and nothing else. stderr carries the server's own status line, as plain text, and its calls' narration, as `dataseek-events/1` lines. `-q`, `-v`, `--cache-dir` and `--connect-timeout` given to `dataseek mcp` reach every call. +- **Tools.** Each tool's input schema is its command's `help --json` entry: one property per flag, named by its long form, typed, with its possible values and default; `search`'s words are one `query` string. A call runs `dataseek --json` with those flags, and the result carries the object that prints as `structuredContent` and again as text. +- **Failures.** A failed call is a result with `isError: true`: the text is the `Error:`, `Cause:` and `Try:` lines the command line prints, and `structuredContent` the error event. A bad or missing argument is such a failure too, since the model can fix it, and so is a call made while four are already running. A JSON-RPC error answers the rest: a line that is not JSON in UTF-8 gets `-32700`, and the session goes on; a request without a string method, or reusing the id of a call still running, `-32600`; an unknown method `-32601`; an unknown tool or `arguments` that is not an object `-32602`; a server fault `-32603`, whose message says what the command left. A notification is never answered. +- **Deadline.** Every search runs with `--timeout`, the argument or its default of 20 seconds, and with the command line's rule for stragglers: past 90% of the sources asked, the rest get one more second unless `source` names them ([ADR 0019](../adr/0019-stop-waiting-past-a-quorum.md)). A `timeout` outside 1 to 300 seconds is refused, so every call ends in a time a client waits for; the schema says so with `minimum` and `maximum`, as it does for every ranged integer. +- **Keys** come from the environment and `credentials.toml`, as everywhere ([ADR 0009](../adr/0009-keys-and-contact-address.md)); no tool takes one as an argument. +- **Lifetime.** Closing stdin ends the server at once, and any call still running is killed; so does closing its stdout, which the next response finds. `notifications/cancelled` kills one call, which then gets no answer. Every call runs the binary the server was started as, even after an upgrade replaces it. + +## SIGPIPE + +`src/lib.rs` resets `SIGPIPE` to the Unix default so `tool | head` exits quietly instead of panicking. `dataseek mcp` is the exception: there a client that closes the pipe must not kill the server outright, so the signal is ignored, the next response fails as a write error, and the server kills the calls still running before it exits. + +Both the call and the `signal-hook` dependency are gated to `cfg(unix)`, because signals are a Unix concept: `signal_hook::consts::SIGPIPE` does not exist on Windows, where the crate re-exports only `SIGABRT`, `SIGFPE`, `SIGILL`, `SIGINT`, `SIGSEGV`, and `SIGTERM`. An unconditional import there is not a runtime problem, it is a build failure, and it went unnoticed until Windows joined the CI matrix. Nothing is lost on Windows: a closed pipe surfaces as an ordinary write error, which the broken-pipe arm of `report()` already turns into a quiet success. + +The dependency is scoped under `[target.'cfg(unix)'.dependencies]` rather than imported and `cfg`'d away at the call site, so Windows does not build `signal-hook` or `libc` at all and `cargo-deny` stops reasoning about crates that platform never compiles. + +## Errors + +Failures are typed with `thiserror` and printed on stderr as: + +```text +Error: + Cause: + Try: +``` + +The hint is baked into the thiserror message after a `\n Try:` marker; `report()` splits it off and prints the `Cause:` chain between the two, so the order is the problem, why, then what to do. A cause is printed once, from the chain; a message that also interpolates its own `{source}` prints it twice. An error with no hint was not anticipated, so its `Try:` line is the issues address. Under `--json` the same three parts are one `error` event on stderr, and clap's usage errors take that shape too: the lines clap prints under its first, such as the missing argument or the possible values, are the causes, and clap's tip, when it has one, is the hint. + +Expected failures never show a stack trace. `Cargo.toml` denies every route a panic takes into production code, because a panic is a bug and never a way to exit: `unwrap_used`, `expect_used`, `panic`, `panic_in_result_fn`, `unreachable`, `unimplemented`, `todo`, and the two that are easy to overlook because they carry no macro name, `indexing_slicing` and `arithmetic_side_effects`. Exit codes are returned as `ExitCode` from `main` so destructors still run. + +## Exit codes + +- `0`: success +- `1`: failure +- `2`: usage error (clap) +- `130`: interrupted by Ctrl-C (death by SIGINT, which the shell reports as 130) + +For `search`, success means at least one source answered, even with no results: an empty answer is a result (ADR 0007). `1` means every attempted source failed, or none could run: each lacks its key, each is resting after an outage in the last ten minutes, or `-s`, `-c` and `-x` left none. When every attempted source was unreachable (no DNS answer, a refused connection, a failed TLS handshake; a timeout does not count), the error says the machine looks offline and points at `--offline`; under `--offline` with nothing cached, it says so instead; when none answered and the search stopped waiting for at least one, the error says no source answered before the deadline, the warnings name the ones it stopped waiting for, and it points at `--timeout 0`. A 401 or 403 to a request that carried no key reads as refused rather than as rejected credentials, rests nothing, and for a source that takes a key names the variable that may lift it. A certificate dataseek cannot verify is not an outage: the source is neither retried nor rested. On Linux that happens when the system has no CA bundle or lacks the root a TLS-inspecting proxy signs with; when every attempted source fails this way, the error says so and its `Try:` names the distribution's `ca-certificates` package and `SSL_CERT_FILE`, or, when `SSL_CERT_FILE` or `SSL_CERT_DIR` points at a path that cannot be read, that variable and path. `inspect` gives the same hint. `--offline` and `-s` ask resting sources anyway. A source that fails while others answer is a warning on stderr, never a failure. Whatever part of a failure's reason came from the source (a malformed tag name, a transport error's text) has its control characters replaced before it is kept, so a source cannot drive the terminal through its own error. `cache warm` is the exception that fails partway: any catalog that did not download makes the run exit `1`, after every success is printed and every failure named, on stderr and again in the error, so `-q` still says which. + +`src/help.rs` holds the list `help exit-codes` prints, and `tests/cli.rs` asserts every code on it. + +## Completion and the man page + +`dataseek completion fish` (or `bash`, `zsh`, ...) prints a completion script to stdout. On a terminal, where a script would scroll past unread, it prints no script and says on stderr where to save it so the shell loads it (`dsk completion fish > ~/.config/fish/completions/dsk.fish`), for the name it was run as. `dataseek man` prints the man page, in roff, to the same place when stdout is not a terminal; on a terminal it shows the page through `man`, by way of a temporary file because BSD and macOS `man` cannot read stdin, and prints the roff if `man` is missing. `cargo install` cannot install a man page, so `man dsk` finds nothing until it is saved where `man` looks: + +```sh +dsk man > ~/.local/share/man/man1/dsk.1 # then: man dsk +``` + +`man` is a hidden command: the overview, `-h` and `--help` leave it out, `dataseek help --json` still lists it, as it lists every command that runs. + +Both are data, so both go to stdout, and both are derived from the clap definition rather than maintained by hand. The man page is rendered on demand by `clap_mangen` instead of at build time by a build script, so it cannot drift from the flags. `help::man_page` adds two things clap_mangen does not: a flag hidden from `-h` still gets its description, and the examples, exit codes (from `EXIT_CODES`, like `help exit-codes`) and bug address become EXAMPLES, EXIT STATUS and REPORTING BUGS sections. The tests assert the page carries the manifest version, renders without errors, names every command, describes every option and has those three sections, and that fish parses the completion script. + +## Color + +Every color the tool emits is defined once in `src/palette.rs`: + +```rust +const ACCENT: Color = ansi(AnsiColor::Blue); // headers, the signature hue +const SUCCESS: Color = ansi(AnsiColor::Green); // values, "it worked" +const WARNING: Color = ansi(AnsiColor::Yellow); // soft alerts, placeholders +const DANGER: Color = ansi(AnsiColor::Red); // errors, destructive prompts +const MUTED: Color = ansi(AnsiColor::BrightBlack); // secondary detail +``` + +Roles are semantic (`accent`, `success`, `danger`), not literal, so swapping a color is one edit. Use a named ANSI color for portability, or 24-bit truecolor with `rgb(0x7a, 0xa2, 0xf7)`. + +The same roles drive clap help styling, stdout text, and the stderr progress accent. `anstream` strips escapes whenever the stream is not a terminal, so call sites style unconditionally and never branch on color. On a color terminal, result URLs are OSC 8 hyperlinks. When stdout is a terminal, color or not, a result's title and facts line are cut to the terminal width (`COLUMNS` wins) with an ellipsis, and its description to that width held between 40 and 80 columns, so it reads as prose on a wide terminal; URLs are never cut. In a pipe, and with `--plain`, every line stays whole. + +indicatif parses its color token with `console::Style::from_dotted_str`, which understands named colors, `#rrggbb` truecolor, and a bare 256-color index, so `palette::accent_token()` renders whichever shape the accent takes exactly. Spinners and bars match help and stdout rather than approximating them. + +## Platform directories + +`src/paths.rs` resolves config, cache, and state separately through `etcetera`, using XDG-style directories. The tool never writes dotfiles directly into `$HOME`. `--cache-dir` (or `DATASEEK_CACHE_DIR`) moves the cache alone. + +## Atomic writes + +`src/fs.rs` writes to a temp file in the target directory and then renames, so a crash mid-write cannot corrupt the original file. `cache clear --dry-run` and `cache warm --dry-run` report what the real run would do, in the same shape, and touch nothing. + +## Extending the CLI + +Add a subcommand by adding a variant to `Command` in `src/cli.rs`, a match arm in `run()` in `src/lib.rs`, its name in `COMMANDS` and, unless it is hidden like `man`, a line in `GROUPS` in `src/help.rs`. Keep one domain per tool; prefer support subcommands (`doctor`, `cache`) over piling flags onto the root. Add a test in `tests/cli.rs` for every behavior you add, and give a command that takes arguments people get wrong at most three examples, and add its `-h` to the list `every_example_in_help_and_readme_parses` reads. + +A flag that takes one of a fixed set of values names them in its own help, as `Colorize output (auto, always, or never)` does, because `-h` does not list them. Build the command through `cli::command()`, never `Cli::command()` directly: it hides clap's `[possible values: ...]` list from `-h` and moves each value's meaning, taken from the `ValueEnum` doc comments, into the long help `--help` shows. The man page alone builds from the plain definition, so roff draws its own list of values. + +The unit test at the bottom of `src/cli.rs` calls clap's `debug_assert()` on the built command, which catches a malformed definition that still compiles: a short flag used twice, a `default_value` outside the possible values, an arg that conflicts with itself. Those otherwise panic the first time a user reaches them, inside clap, where the `panic = "deny"` lint cannot see them. A proptest beside it feeds arbitrary argv to the parser for the same reason. diff --git a/docs/reference/development.md b/docs/reference/development.md new file mode 100644 index 0000000..ffe3ff5 --- /dev/null +++ b/docs/reference/development.md @@ -0,0 +1,169 @@ +# Development + +## Daily commands + +```sh +just # list recipes +just check # fmt --check + clippy -D warnings + nextest +just test # cargo nextest run +just run search sea surface temperature +just build # release build +just ci # everything CI gates on, before you push +``` + +`check` is the inner loop and runs in seconds. `ci` is `check` plus the unused-dependency, MSRV, and supply-chain gates, so a green `just ci` means a green pipeline **on your platform**. CI is one Linux machine. A `cfg` boundary can still fail to compile on a platform nobody develops on, so the `cross-check` step (and `just cross`) runs clippy for the Windows and macOS targets from that machine ([ADR 0002](../adr/0002-one-linux-ci-job.md)). + +## Format and lint + +`prek` runs `cargo fmt`, `cargo clippy`, `cargo shear`, and `typos` on every commit. Install it once with `prek install`. `typos` also runs as a CI step, because a commit hook is advisory: `--no-verify`, an edit made in the GitHub web UI, or a contributor who never ran `prek install` all reach `main` without it. + +The clippy lints are configured in `Cargo.toml`, not in CI, so `cargo build`, the editor, `prek`, and CI all report the same thing. The few test-specific exceptions live in `clippy.toml` because an unwrap in a test is the assertion, and the same goes for an `expect`, a `panic!`, and a `v[0]`. `arithmetic_side_effects` has no such key and does not need one: a clone that does real numeric work will meet it the first time it writes `a + b`, which is the moment to decide between `checked_`, `saturating_`, and a local `#[expect(...)]` with the reason the overflow cannot happen. One more sits at the top of `tests/cli.rs`, as a file-level allow: `clippy.toml` exempts `#[test]` bodies, and the helpers in that file are not inside one. + +`typos` is the only hook that reads prose rather than code, and it is there because the doc comments in `src/cli.rs` *are* the `--help` text, so a typo in one is a user-visible defect that fmt, clippy, and shear all look straight past. It earned its place on the first run by catching a hyphenated misspelling of "misfire" in a comment in `fs.rs`. (Quoting the misspelled form here would trip the hook, which is the check working.) Unlike the other three it needs nothing on `PATH`: `prek` fetches it from the tag pinned in `prek.toml`, so a clone gets the check without a seventh tool to install. When it flags a word that is genuinely correct, prefer rewording; reach for a `typos.toml` allowlist only for a term you will use repeatedly, such as a domain word or a proper noun. + +## Tests + +The CLI surface is tested in `tests/cli.rs` with `assert_cmd`, and help output with [insta](https://insta.rs) snapshots. Everything below the CLI is tested in `#[cfg(test)]` modules beside the code: each source adapter against a recorded response, the search loop and the catalog fallback against fake adapters and a scratch cache, the HTTP client against a local socket, and the record, DOI and merge helpers with [proptest](https://proptest-rs.github.io/proptest/) properties as well as examples. + +After changing help text or any printed output, run: + +```sh +just review # step through changed snapshots +just bless # accept them all, unread +``` + +CI runs the same nextest as `just test`. nextest does not run doctests, so CI and `just check` run `cargo test --doc --locked` beside it: the crate has a library target since `dsk` joined `dataseek` ([ADR 0010](../adr/0010-dsk-is-dataseek.md)). + +No test touches the network. `tests/cli.rs` gives every run its own home, config and cache directories and routes HTTP through a proxy on a closed port, which is exactly how an offline machine looks to dataseek. The HTTP tests in `src/http.rs` talk to a listener on `127.0.0.1` that answers with canned responses. Live behavior is what `dataseek bench` measures. + +Every adapter splits its request (`search` or `list`) from a pure `parse`, and every `parse` has one test against a real response stored in `tests/fixtures/sources/.{json,html,xml,txt}`. The test compares the first record field by field, as one `Dataset` literal, with values read off the fixture by hand. Never paste the test's own output in as the expectation: an expectation the code produced cannot catch the code being wrong, and a hand-written fixture built from the adapter's own JSON pointers cannot catch a pointer the real API never fills, which is how most adapter bugs so far were found. One table in `src/sources.rs` holds every live `parse` to the two rules in that module's header: an unrelated body is `SourceError::Shape`, never an empty list, and the result stops at `limit`. + +`inspect` reads whole pages, and `tests/fixtures/inspect/` keeps real responses: `zenodo.html` is a record page with its `` and a `` cut down to its `application/ld+json` script, and the other fixtures are the JSON documents Dataverse and Hugging Face serve. The MCP session test in `tests/cli.rs` serves `zenodo.html` through a helper on `127.0.0.1` that acts as the proxy and answers every request with the page, tunnelled through `CONNECT` or not, so `inspect` runs end to end on an `http://` URL without the network. + +To re-record a fixture after a source changes, repeat the adapter's request with `xh` and the dataseek User-Agent (`dataseek/ (+https://github.com/lmarkmann/dataseek; mailto:user@dataseek.dev)`), never with a key, trim arrays to a few rows with `jq 'walk(if type=="array" then .[:4] else . end)'`, shorten long descriptions to a real prefix, replace any individual's e-mail address with `contact@example.org`, and then re-derive the expected record by reading the new file. Sources that need a key (FRED, Roboflow) use the example response from their API docs, linked above the test. + +`inspect` reads its file lists from recorded pages in `tests/fixtures/inspect/`, recorded under the same rules. Its `--json` shape is part of `json_shapes_snapshot` in `tests/cli.rs`, read from a page served on a random local port that a snapshot filter replaces with `[LOCAL_ADDR]`. + +proptest writes the inputs that once failed to `proptest-regressions/`; they are committed so every run replays them first. + +Not every test can live in `tests/cli.rs`. That file runs the compiled binary, so it can assert on flags, exit codes, and stdout, but it cannot reach into the crate: the library's modules are private, so there is nothing for an integration test to import. Anything that needs a Rust value rather than a process is a `#[cfg(test)]` module beside the code, which is why `palette`, `ui`, `fs`, and `cli` each carry one. + +The unit test in `src/cli.rs` is the one worth knowing about. It calls clap's `debug_assert()` on the built command, which walks the whole definition and rejects the mistakes that compile perfectly: a short flag used twice, a `default_value` that is not among the possible values, an arg that conflicts with itself. Left uncaught, those panic inside clap the first time a user reaches the broken path, which is precisely the runtime panic `panic = "deny"` cannot see, because the panic is in the dependency and not in this crate. Add a flag, and this test is what tells you the flag is well formed before a user does. + +## Benchmarks + +```sh +just bench --save-baseline main # Criterion wall time on this machine, saved as "main" +just bench --baseline main # after a change: the difference, with an interval +just bench catalog/search # one group; the filter is a regex over names +``` + +`benches/search.rs` measures the CPU stages of a search at three input sizes each: SDMX and Eurostat catalog parsing, loading a cached catalog, local catalog search, merging 76 source lists, and cleaning remote text, both HTML and prose full of bare ampersands. The library is private, so the bench reaches these through `dataseek::internals`, which exists only with the `internals` feature. `just bench` turns the feature on; a bare `cargo bench` skips the target. + +CI runs the same benches through CodSpeed's CPU simulation on every push to main and on pull requests that touch code ([ADR 0012](../adr/0012-benchmarks-criterion-local-codspeed-ci.md)). The simulation counts instructions instead of timing, so its numbers hold steady across runs but are not milliseconds; compare them only with other CodSpeed runs. `cargo codspeed` measures only on Linux. Local wall time is a rough guide: an A/A run on a busy Mac reported identical code up to 52% faster ([baseline](../bench/2026-10-06-baseline.md)). Measured results go in [`../bench/`](../bench/) with the machine they came from. + +`merge` takes ownership of the per-source lists, so the merge bench hands it a fresh copy made outside the measurement and cannot see a copy on the way in. That one is a test instead: `ranking_moves_the_records_instead_of_copying_them` in `src/find.rs` counts the bytes `ranked` allocates, from the search loop's outcomes to the merged and weighed hits, with `allocation-counter`, which swaps in a counting allocator for the unit-test binary only. Its records carry 16 KB publishers that merging has to hand from one record to another, both when a later record joins a hit and when one hit absorbs another. It fails once the count reaches the figure measured when the test was written plus one publisher's bytes, so a single copied publisher trips it; a change that legitimately allocates more moves that figure. + +Startup is measured separately, on the release binary: + +```sh +just bench-startup # hyperfine over --version, --help, the overview, completion fish, sources +just bench-startup --bless # rewrite this machine class's baseline +``` + +`scripts/bench_check.py` reads hyperfine's export (`docs/bench/startup.json`) and fails on any path over its budget: 10 ms for `--version`, 20 ms for the rest, doubled under `CI` because runners are slower and noisier. A path more than 25% and 2 ms slower than `docs/bench/baseline--.json` only warns. The CI job runs it after the tests and uploads the JSON, so a slow path can be traced to its commit. + +## Relevance + +```sh +just relevance # score the shipped ranking against the judgments; fails on a regression +just relevance variants # every ranking variant on the tuning and held-out halves +just relevance pool # worksheets for every unjudged result a ranking puts in its top 10 +just relevance absorb # fold graded worksheets into judgments.tsv +just relevance --bless # accept the current scores as the baseline +just relevance record # re-record the snapshot from the live sources (network) +just relevance record --source huggingface # re-record one source's lists only +just relevance cutoff tests/fixtures/relevance/latency.jsonl # what stopping before the slowest sources costs +``` + +The speed benchmarks say how fast a search is; this one says whether its top 10 is any good. It separates retrieval from ranking: what each source returned for a fixed set of queries is recorded once and committed, and the merged ranking is then scored offline, deterministically, against graded judgments. No key and no network are involved after recording. `just ci` and the CI job run `just relevance`. The harness is `examples/relevance/`, built against `dataseek::internals` like the Criterion bench, and its files live in `tests/fixtures/relevance/`. + +`queries.toml` holds 48 queries in three kinds: 16 known-item queries naming one dataset ("MNIST handwritten digits"), 16 topical keyword queries ("sea surface temperature monthly", seeded from `dataseek bench`'s defaults) and 16 natural-language queries phrased the way an agent asks ("monthly inflation by country since 2000"), spread over the `--category` domains. Every query is run against every default source, as a plain search would be. Each query sits in one half, `tune` or `held`, fixed before any ranking change was tried: a change is chosen on the tuning half and adopted only if it also helps the held-out half. Never move a query between halves after seeing its scores. + +`retrieval/.jsonl` is the snapshot: a header line with every source's status when recorded, then one line per record with the source and its rank. Records keep what merging and ranking read (title, link, description, publisher, DOI, aliases) and the popularity count, which nothing in merging or ranking reads; license, size and date are dropped, and every e-mail address becomes `contact@example.org`. Sources whose terms bar storing results (`persist: false`, today Kaggle) are never recorded, and sources that need a key are recorded as skipped, because recording runs with no credentials at all. Both are gaps between the benchmark and a search with keys set. A source that was asked but failed has an empty list and scores as if it had found nothing; `just relevance` lists every such source with the queries it missed. + +`judgments.tsv` grades results 0 (not relevant), 1 (partly) or 2 (relevant), one record per line with a one-line reason; its header holds the rubric. A label matches a merged result by identity (DOI or normalized link), so it holds whichever source returned the record. Each dataset has one label per query: two labels of one query sharing a DOI or link are an error, and `just relevance absorb` replaces a label by identity rather than adding a second one. Known-item queries need no labels: their `targets` in `queries.toml` are the dataset's identifiers, and the first result sharing one is the hit. + +The metrics: nDCG@10 with gains 0, 1, 3 for the three grades and P@10 counting grades 1 and 2, both over the 32 graded queries; reciprocal rank of the first target, averaged over the 16 known items. Every mean comes with a percentile bootstrap 95% interval over queries (10,000 resamples, fixed seed). Per source, the report counts the top-10 slots it fills with results judged not relevant, its pollution of the top 10. + +The gate compares the shipped ranking with `baseline.json`. The evaluation is deterministic, so any drop is a real change on this set; the gate tolerates a drop of a quarter of the metric's bootstrap standard error, which passes drops below what the interval can resolve; a deliberate trade-off goes through `--bless` instead. Because a mean can hide one bad query, the gate also fails when any graded query's nDCG@10 falls by more than 0.1 against its value in the baseline, or a known item that was in the baseline's top 10 leaves it. A metric missing from the baseline, or a query set that differs from the baseline's, fails too. A gain past the tolerance passes with a note asking for `--bless`, so the next drop is measured from the new level, and `--bless` prints the old means against the new ones before it writes. The gate also fails when the shipped ranking's top 10 holds a result with no grade: scoring it as not relevant would let the score move for reasons that have nothing to do with quality. + +### After changing the ranking + +Run `just relevance`. If it fails on unjudged results, run `just relevance pool`, grade the worksheets in `target/relevance-pool/` (the rows are shuffled and do not show which source or ranking produced them), then `just relevance absorb`. If it reports a regression you mean to accept, run `just relevance --bless` and say why in the commit. To try a new idea, add it to `examples/relevance/variants.rs` as a setting and compare with `just relevance variants`; a test holds the variant code to the shipped ranking, so the comparison is against the real code. + +A change is adopted when, on the held-out half, the paired bootstrap interval of its nDCG@10 change lies above zero and known-item MRR falls by no more than the gate's tolerance. The paired interval resamples per-query differences, which is far tighter than comparing two intervals. While either held-out top 10 holds a result with no grade, `variants` prints `unjudged` instead of a verdict. + +### Re-recording + +`just relevance record` asks every default source every query, live, with an empty cache and no key, and rewrites the snapshot; `just relevance record ...` re-records only those queries. When a source that answered last time fails now, that query keeps its old snapshot and the run fails at the end; `--accept-lost` records the failure anyway. `just relevance record --source [query ids]` asks only that source and splices its lists into the recorded snapshot, leaving every other source's as it was, so an adapter change is measured on its own. Re-recording after an adapter changes is how that change is measured, but it changes what each source returned, so expect new unjudged results: pool, grade, absorb, and re-bless in the same commit as the new snapshot. The first recording, its size and the excluded sources are in [`../bench/2026-10-07-relevance.md`](../bench/2026-10-07-relevance.md). + +`just relevance cutoff ` measures how long a search waits for its slowest sources ([ADR 0019](../adr/0019-stop-waiting-past-a-quorum.md)). The file holds one `search --json` source report per line, `{"query": id, "sources": [...]}`, recorded live with `--timeout 0 --refresh` and every catalog cached; `tests/fixtures/relevance/latency.jsonl` is one such round. For each stopping rule in `examples/relevance/cutoff.rs`, the sources that would have answered after the rule stopped waiting get empty lists, the snapshot is merged and ranked as shipped, and the table gives wall time, the share of the full top 10 still shown, and the paired change in nDCG@10 per half and in known-item MRR. Record a new round as first asks only: some sources cache repeated queries on their side. The 2026-10-08 measurement is [`../bench/2026-10-08-straggler-cutoff.md`](../bench/2026-10-08-straggler-cutoff.md). + +## Dependencies + +```sh +just shear # declared but never used, also a commit hook +just outdated # everything this repo pins +just crates-outdated # only the crates +just actions-outdated # only the action and hook tags +``` + +`cargo shear` runs on every commit because it takes milliseconds and catches the dependency you stopped using two commits ago. + +`just outdated` covers two kinds of pin, because they rot differently. `cargo outdated` reads the manifest, where requirements are major-only and the lockfile decides the build, so a stale crate is still visible to `cargo update` and a vulnerable one to `cargo-deny`. The tags in `.github/workflows/` and `prek.toml` have neither backstop: nothing in the repo resolves them and nothing says when they fall behind, which is how the `crate-ci/typos` pin came to sit a release behind in both files at once. `just actions-outdated` asks GitHub for each latest tag and compares only the components the pin declares, so `@v2` stays quiet until a v3 exists while `@v1.48.0` reports the next patch. It needs `gh` authenticated, and it skips branch pins like `@stable`, which move on their own. A hash pin is compared through the `# v7.0.1` comment `pinact` writes beside it, since a 40-character SHA carries no version to compare; a SHA with no such comment is reported as an error rather than skipped, because silently dropping an action from the freshness report is the one way pinning could leave the repo less current than tags did. + +## MSRV + +```sh +just msrv # does the crate still compile on the declared floor? +just msrv-find # what the floor actually is, when you want to move it +``` + +`rust-version` in `Cargo.toml` is the single source of truth, and the CI job reads the number out of the manifest rather than repeating it. This matters more than it looks: `rust-toolchain.toml` pins everyone to `stable`, so without this gate the first use of a newer-than-floor API would break the claim silently. + +`just msrv-find` measures the floor; `cargo msrv find` on its own does not, which is why the recipe exists. The search works by shelling out to `cargo check`, and cargo refuses the build on the `rust-version` field before compiling a line, so a bare run never looks below the number already declared and reports it back as though it had tested it. The recipe passes `-- cargo check --ignore-rust-version` to replace the inner command; there is no flag on the subcommand itself. This is the same failure as the paragraph above, arriving from the other direction: there the gate passes for the wrong reason, here the measurement confirms itself. + +The floor is a claim you choose, not the compiler anyone builds with. Everything local, every commit hook, and the main CI job run current stable no matter what the number says, and the floor only decides who is refused and which dependency versions the resolver considers. Two consequences. Setting it to whatever stable happens to be today makes the MSRV job a copy of the stable job until the next release, which on Rust's six-week train is at most six weeks of a gate that tests nothing; check [releases.rs](https://releases.rs) for where the train currently is rather than assuming. And raising it relaxes the resolver, so a later `cargo update` can pull dependency versions that were previously held back; compare `cargo update --dry-run` against `cargo update --dry-run --ignore-rust-version` to see what a bump would let in. Move the number when a language feature earns it, and if you are publishing, run `just msrv-find` and declare what the code actually needs. + +If `just msrv` fails locally with *"some components are unavailable for download for channel '1.xx': 'miri' ... 'rustc-codegen-cranelift'"*, the problem is your machine, not the crate. `cargo msrv` installs the floor toolchain through rustup, and a fresh install uses whatever `profile` is set in `~/.rustup/settings.toml`. If that is `complete`, rustup asks for every component it knows about, including `miri` and `rustc-codegen-cranelift`, which are nightly-only artifacts and are never published for a stable release, so the install cannot succeed. Fix it once with `rustup set profile default`; it changes future installs only and leaves existing toolchains alone. Note that `rust-toolchain.toml` saying `profile = "minimal"` does not help here, because that line only applies when rustup installs *from that file*, and `cargo msrv` names the toolchain itself. CI never sees this: `rustup toolchain install` there reads the profile from `rust-toolchain.toml`. + +That same pin is why the CI job sets `RUSTUP_TOOLCHAIN` on the step instead of trusting the toolchain it just installed. `rust-toolchain.toml` says `stable`, and rustup honors that file over any toolchain installed beside it, so installing the floor and calling `cargo check` would have quietly checked against stable and passed for the wrong reason. rustup's precedence runs `+toolchain` first, then `RUSTUP_TOOLCHAIN`, then the file, so the env var is what makes the job build against the floor. A gate that passes for the wrong reason is worse than no gate, because it also stops you looking. + +## Audit commands + +```sh +just deny # cargo-deny: advisories, licenses, bans, sources +just zizmor # zizmor: static analysis of the workflows +just audit # both, the pair CI runs +``` + +`cargo-audit` is deliberately absent: `cargo deny check advisories` reads the same RustSec database, and running both means two database clones for one signal. + +## Code review + +[CodeRabbit](https://docs.coderabbit.ai) reviews pull requests through its GitHub App, configured in `.coderabbit.yaml`: the code rules above as path instructions, `development.md`, `contract.md` and the ADRs as guidelines, the lockfile and changelog left out. Release and Renovate PRs are skipped. Its review is advisory and never a required check. CodeRabbit reviews a public repository with fewer than 10 stars only when a person asks, and ignores the same request from a bot, so until dataseek passes 10 stars every PR needs a maintainer comment: `@coderabbitai review` reviews what changed since its last review, `@coderabbitai full review` starts over. Before a push, `coderabbit review --deep --base main` runs the same review policy locally. + +## On demand + +Not gates, and not run by `just ci`. Reach for them when the question comes up. + +```sh +just cov # line coverage, browsable under target/llvm-cov/html +just mutants # mutate what the branch changed against main +just bloat # where the release binary's size goes +``` + +`just bloat` runs [cargo-bsize](https://crates.io/crates/cargo-bsize) on the `dataseek` binary (`dsk` is the same program). It ranks crates, functions and generic instantiations by the bytes they ship, and lists panic, formatting and unwind overhead beside them. Before a change that might move the size, run `just bloat` and copy the binary it builds, `target/bsize/release/dataseek`, somewhere outside `target/`; afterwards `just bloat --baseline ` reports what grew and what shrank, by crate and by function. The baseline has to be that build: the release binary is stripped, so there is nothing left in it to attribute bytes to. `just bloat --what-if` rebuilds with `opt-level = "z"` and with `panic = "abort"` and reports what each saves; `just bloat --what-if --levers=all` adds LTO mode, codegen settings and the nightly-only levers such as `fmt-debug=none` and `build-std`, one build each, so it takes minutes. Nightly-only levers are measured for reference and cannot go into a profile while the toolchain is pinned to stable. The last measurement is in [`../bench/2026-10-07-binary-size.md`](../bench/2026-10-07-binary-size.md). + +`just mutants` passes `--in-diff` so it stays in the minutes rather than mutating the whole crate. A surviving mutant means a line the tests execute but never assert on, which is the failure mode coverage percentages hide. diff --git a/docs/reference/keys-and-cache.md b/docs/reference/keys-and-cache.md new file mode 100644 index 0000000..859c9b6 --- /dev/null +++ b/docs/reference/keys-and-cache.md @@ -0,0 +1,56 @@ +# Keys and cache + +## API keys + +No key is needed for most sources: 73 of the 76 answer without one. Keys raise rate limits or unlock three sources. Set a key as an environment variable, or put it in `credentials.toml` in the config directory (`dataseek doctor` prints the path) with permissions `600`: + +```toml +fred = "..." +datagov = "..." +``` + +| source | environment variable | file key | without it | get one | +|---|---|---|---|---| +| Hugging Face | `HF_TOKEN` | `huggingface` | 500 requests per 5 min per IP | https://huggingface.co/settings/tokens | +| Kaggle | `KAGGLE_API_TOKEN`, or `~/.kaggle/access_token`, or `~/.kaggle/kaggle.json` | `kaggle` | anonymous requests reach every page; a key changed nothing observable | https://www.kaggle.com/settings/api | +| Data.gov | `DATAGOV_API_KEY` | `datagov` | catalog.data.gov's keyless search | https://api.data.gov/signup/ | +| GitHub | `GITHUB_TOKEN` | `github` | 10 searches per minute | https://github.com/settings/tokens | +| FRED | `FRED_API_KEY` | `fred` | source skipped | https://fredaccount.stlouisfed.org/apikeys | +| Roboflow Universe | `ROBOFLOW_API_KEY` | `roboflow` | source skipped | https://app.roboflow.com/settings/api | +| Data Commons | `DATACOMMONS_API_KEY` | `datacommons` | source skipped | https://apikeys.datacommons.org | +| NCBI | `NCBI_API_KEY` | `ncbi` | 3 requests per second | https://account.ncbi.nlm.nih.gov/settings/ | + +An environment variable is visible to every program started from that shell and to anything that dumps the environment (a crash report, `ps e`, a CI log); it suits CI and one-off runs. For a key that stays on a machine, prefer `credentials.toml` with permissions `600`. + +Kaggle's files are the ones its CLI writes (`kaggle auth login`, or the token from the settings page); `KAGGLE_CONFIG_DIR` moves them. `dataseek sources` shows each key's status and `dataseek doctor` where it was found; neither ever prints a key, and `doctor` fails a key file other users can read. + +A data.gov key: sign up at https://api.data.gov/signup/ with a name and an address, and the key arrives by email at once. It gives 1,000 requests an hour; the shared `DEMO_KEY` gives 30 an hour and 50 a day. + +Every request carries the repository URL and the contact address `user@dataseek.dev` in its User-Agent (and the address as `mailto` for DataCite, `email` for NCBI). It is the project's address, read by the maintainer, and the same for every user. + +## Cache + +| kind | lives | what | +|---|---|---| +| query results | 6 hours | one file per source and query; never for Kaggle | +| catalogs | 7 days | the full lists of the `local` sources | +| outage marks | 10 minutes | sources skipped after an outage unless named with `--source` | +| warming marks | 10 minutes | catalogs a search already set downloading in the background | +| download failures | until a download succeeds | why a catalog's last download failed, named in the next search's warnings | + +The cache directory is trimmed to 30 MB and 2,000 files after every search: query results go first, catalogs next and the marks last, the oldest first within each. A search writes about 42 query files, so oldest-first alone would evict every catalog within some 45 searches. A malformed entry is removed when read. `DATASEEK_CACHE_MAX_MB` sets another size budget, in whole megabytes from 1 to 10,000; a larger one keeps more downloaded catalogs between searches, a smaller one fetches them again sooner. A value outside that range is a usage error (exit 2). `--cache-dir DIR` or `DATASEEK_CACHE_DIR` moves the directory. + +```sh +dataseek cache info # path, size and budget +dataseek cache warm # download every catalog now, no deadline +dataseek cache warm -s openneuro # only the named catalogs +dataseek cache clear --dry-run # what clearing would delete +dataseek cache clear # delete every entry; other files in the directory stay +dataseek search ... --refresh # ask every live source again +dataseek search ... --offline # cached answers and catalogs only, no network +dataseek search ... --timeout 0 # wait for every source, however slow +``` + +A fetch that fails serves the expired entry when one exists; `-v` and `--json` label an answer served that way as stale. An entry written by another release counts as expired, because that release may have parsed the source differently: a query is asked again when online and its old answer served when that fails, and a catalog is searched as it is and downloaded again in the background. + +A search never waits for a catalog download it can do without ([ADR 0018](../adr/0018-a-search-never-waits-for-a-catalog-download.md)). An expired catalog is searched as it is, labeled `expired catalog`, and downloaded again in the background. A catalog with no copy yet downloads during the search until every other source has finished; if it is not done by then, the search reports it as still downloading and the download carries on in a detached `dataseek cache warm --source ` that outlives the search, so the next search has it. A catalog named with `-s` and `--timeout 0` wait for the download, a catalog another search is already downloading is not downloaded twice, and `--offline` starts none. When a download fails, the next search that needs the catalog says why. `--offline` sends no request at all, so it never marks a source as down or clears that mark. A host that misses a `--connect-timeout` you set is not marked as down either: that limit is your choice, and the source is asked again on the next search. Why the numbers are what they are: [ADR 0007](../adr/0007-cache-budget-and-failure-handling.md). diff --git a/docs/reference/release.md b/docs/reference/release.md new file mode 100644 index 0000000..3fdcaca --- /dev/null +++ b/docs/reference/release.md @@ -0,0 +1,69 @@ +# Release + +Versioning is automatic: release-plz bumps `Cargo.toml`, writes [`../CHANGELOG.md`](../CHANGELOG.md), tags `vX.Y.Z` and cuts the GitHub release. Why it is built this way is [ADR 0001](../adr/0001-release-plz-owns-the-version.md); what moves the number is [ADR 0003](../adr/0003-the-cli-surface-sets-the-version.md). + +## Conventional commits + +Write [conventional commits](https://www.conventionalcommits.org). The prefix decides both the changelog group and whether a release happens at all: + +| prefix | changelog group | cuts a release | +|---|---|---| +| `feat:` | Added | yes, minor | +| `fix:` | Fixed | yes, patch | +| `perf:` | Performance | yes, patch | +| `refactor:` | Changed | yes, patch | +| `doc:` | Docs | no | +| `build:`, `chore:` | Other | no | +| `chore(release):`, `test:`, `ci:` | skipped | no | +| anything else | Uncategorized | no | + +Uncategorized is the changelog telling you a subject was not conventional. Add `!` after the prefix for a breaking change; its changelog line then starts with "Breaking:". + +## The loop + +On every push to `main`, the `release-pr` job opens or updates a PR that bumps the version and writes the changelog section from the commits since the last tag, then queues it for auto-merge. CI runs on that PR like on any other; once the required `linux` check is green, GitHub squash-merges it and deletes the branch, and the `release` job on that merge commit tags it and cuts the GitHub release, whose body is the changelog section. Publishing that GitHub release starts `.github/workflows/release.yml`, which builds the wheels and uploads them to PyPI (below). Nobody clicks anything between a `feat:` landing and its release. + +Nothing earlier than v0.3.0 exists: release-plz diffs against the newest `v*` tag, and that baseline was tagged by hand. + +## The config + +`.github/release-plz.toml`, passed through the action's `config` input in both jobs and `--config` locally: + +- `git_release_enable = true`, `git_release_type = "auto"`, `git_release_body = "{{ changelog }}"`: every tag gets a GitHub release carrying that version's section. +- `release_commits`: release-plz decides whether to release from changed files, not from changelog groups, so without it a `ci:` merge alone opens a release with an empty section. That is how v0.3.1 happened. +- `features_always_increment_minor = true`: see ADR 0003. +- `semver_check = false`: a binary has no public API for cargo-semver-checks to compare. +- `release_always = false`: tag only when the release PR merges. +- `pr_name` and `pr_body` replace the defaults, which carry a robot emoji and a generated-with footer. +- `[[package]] changelog_path = "docs/CHANGELOG.md"`: relative to the root `Cargo.toml`. It cannot be set under `[workspace]`. +- `commit_parsers`: git-cliff takes the first match, so `^chore\(release\)` sits ahead of `^chore`. The trailing `.*` catch-all exists because without it a subject matching no rule is dropped from the changelog silently. `test` and `ci` are skipped because a user of the binary cannot observe them, and so are merge commits, whose branches' own commits already carry the changes; `build` stays because it carries MSRV and toolchain moves. + +Section headings read `## - `. + +## The release token + +Both jobs mint a one-hour token from the `lmarkmann-release` GitHub App with Contents and Pull requests write; the job's own `GITHUB_TOKEN` stays read-only. The repository holds `RELEASE_APP_CLIENT_ID` (an Actions variable) and `RELEASE_APP_PRIVATE_KEY` (a secret), set from 1Password (`GITHUB_RELEASE_APP` in the Developer vault) by the ci-vcm skill's `app_secrets.sh`, and the App is installed on the repo. The key does not expire. + +Auto-merge needs squash merges titled by the PR, auto-merge allowed, branches deleted on merge, and a ruleset requiring the `linux` check. + +## Preview the next release + +```sh +just release-preview +``` + +No release-plz subcommand has a dry-run flag, so the recipe runs the real `release-plz update`, prints the diff and restores the tree on every exit path. It refuses to start on a dirty tree, untracked files included, because the restore ends in `git clean`. + +## Publishing to crates.io + +`cargo install dataseek` installs `dataseek` and `dsk`. The package holds only what building needs (`cargo package --list`); the `internals` feature is for the benches and unstable. + +The `release` job publishes through crates.io trusted publishing (`lmarkmann/dataseek`, workflow `release-plz.yml`, environment `crates-io`); no registry token is stored. + +## Publishing to PyPI + +`uvx dataseek` runs a wheel holding both binaries, built by maturin with the version from `Cargo.toml`. `release.yml` builds the wheels on each GitHub release and uploads them with `uv publish` through trusted publishing ([ADR 0017](../adr/0017-release-builds-on-a-platform-matrix.md)). The same jobs attach `dataseek-.tar.gz` (`.zip` on Windows) with a `.sha256` to the release, which `cargo binstall dataseek` downloads, and its `homebrew` job rewrites `Formula/dataseek.rb` in [lmarkmann/homebrew-tap](https://github.com/lmarkmann/homebrew-tap) from them with `scripts/homebrew-formula.sh`, through a release App token scoped to the tap. + +Before the first release, add a pending publisher at : project `dataseek`, `lmarkmann/dataseek`, workflow `release.yml`, environment `pypi`. + +`dsk` is also an unrelated PyPI project; installing both into one environment makes their scripts collide. diff --git a/docs/reference/setup.md b/docs/reference/setup.md new file mode 100644 index 0000000..7da2d9c --- /dev/null +++ b/docs/reference/setup.md @@ -0,0 +1,38 @@ +# Setup + +## Keep the description in step + +```sh +just description "WHAT THE CLI DOES" +``` + +`just description` writes the supplied summary to `Cargo.toml`, the marked paragraph in `README.md`, and the current GitHub repository. Clap reads the same Cargo field for its `about` text, so the CLI help cannot drift from the package description. The summary must fit on one line. + +## Install dev tools + +The daily workflow assumes these are on `PATH`: + +- Rust toolchain with `clippy` and `rustfmt`; the channel is pinned by `rust-toolchain.toml` +- [`just`](https://just.systems) for recipes +- [`cargo-nextest`](https://nexte.st) for tests +- [`prek`](https://prek.j178.dev) for git hooks: `prek install` +- [`cargo-shear`](https://github.com/Boshen/cargo-shear) for unused dependencies, on the commit hook +- [`cargo-insta`](https://insta.rs) for `just review` +- [`cargo-msrv`](https://gribnau.dev/cargo-msrv/) for `just msrv` +- [`cargo-deny`](https://embarkstudios.github.io/cargo-deny/) and [`zizmor`](https://woodruffw.github.io/zizmor/) for `just audit` +- [`release-plz`](https://release-plz.dev) for `just release-preview` +- [`gh`](https://cli.github.com) for `just description` and `just actions-outdated`, both of which talk to GitHub + +[`typos`](https://github.com/crate-ci/typos) also runs on every commit, but is not on this list: `prek` fetches it from a pinned tag, so it needs nothing on `PATH`. + +Install the Rust tools with `cargo binstall`: + +```sh +cargo binstall cargo-nextest cargo-shear cargo-insta cargo-msrv cargo-deny zizmor release-plz +``` + +The on-demand recipes need four more, worth installing only when you reach for them: + +```sh +cargo binstall cargo-llvm-cov cargo-mutants cargo-bsize cargo-outdated +``` diff --git a/docs/reference/supply-chain.md b/docs/reference/supply-chain.md new file mode 100644 index 0000000..fc06eef --- /dev/null +++ b/docs/reference/supply-chain.md @@ -0,0 +1,39 @@ +# Supply chain + +dataseek runs two supply-chain gates in CI and locally through `just audit`. + +## cargo-deny + +`cargo-deny` is configured in `deny.toml`. + +- `advisories`: RUSTSEC advisories are errors by default. Add an ID with a note and a date only when there is no fix and the code path is unreachable. +- `licenses`: only permissive licenses are allowed. The allowlist is deliberately wider than the current dependency tree so a new dependency does not fail on a license that was always going to be fine. +- `bans`: duplicate versions are warned, not failed. Wildcards in dependency requirements are denied. +- `sources`: only crates.io is allowed. + +Run it with `just deny`. + +## zizmor + +`zizmor` audits the GitHub Actions workflows themselves. There is no `.github/zizmor.yml`: every rule runs at its default. + +Every `uses:` in both workflows is pinned to a full commit SHA with its tag in a trailing comment (`actions/checkout@3d3c... # v7.0.1`). The earlier split, tags in `ci.yml` and SHAs only in `release-plz.yml`, rested on hash pins rotting without a bot to refresh them; Renovate's `helpers:pinGitHubActionDigests` is now that bot, with a seven-day `minimumReleaseAge` on action updates so a pin never moves to a release younger than a week. That removes the condition the split was built on. The trailing comment is still load-bearing: `just actions-outdated` reads it, and `pinact run --verify --check` fails on a SHA whose comment does not match. Re-pin by hand with: + +```sh +just repin +``` + +CI runs zizmor as the `workflows` step of the single `linux` job, installed at the version the `taiki-e/install-action` pin carries, with the job's read-only token so its online audits (impostor commits, known-vulnerable actions) run too. `just zizmor` runs offline, so CI audits strictly more than a laptop; a finding that appears only in CI is one of the online audits. The same step runs `actionlint` over the workflow syntax and the shell inside `run:` blocks. + +There are no rule exemptions. `artipacked` was once ignored for `release-plz.yml`, on the assumption that release-plz needed its checkout credentials to push; it pushes through the GitHub API instead, so every checkout in the repo sets `persist-credentials: false`. The two cases that would need the credentials back are signed tags and a step that runs `git push` after release-plz. + +Run it with `just zizmor`. + +## Workflow permissions + +Workflows use the smallest permissions they can: + +- `ci.yml` sets `permissions: {}` at workflow level and grants the `linux` job `contents: read`. +- `release-plz.yml` sets `permissions: {}` and grants each job `contents: read` only. Writes go through the release App's token, minted per job with Contents and Pull requests write and revoked when the job ends. Each job starts with `step-security/harden-runner` in audit mode, which logs its outbound connections. + +Every checkout sets `persist-credentials: false`, including the two in `release-plz.yml`. diff --git a/docs/synthesis/README.md b/docs/synthesis/README.md new file mode 100644 index 0000000..74dbdba --- /dev/null +++ b/docs/synthesis/README.md @@ -0,0 +1,17 @@ +# Synthesis + +What reads across several dataset sources at once: how registries such as Hugging Face, Kaggle or Zenodo differ in search semantics, metadata, licensing fields and rate limits, and what that means for one query surface over all of them. A file lands here when the same comparison is wanted by more than one source adapter. + +| the fact | its home | +|---|---| +| a comparison across sources | **here** | +| one source's API shape, used by one adapter | the adapter's module docstring in `src/sources/` | +| a decision drawn from a comparison | [`../adr/`](../adr/), citing the file here | +| what shipped | [`../CHANGELOG.md`](../CHANGELOG.md) | + +| file | covers | +|---|---| +| [search-methods.md](search-methods.md) | endpoint, query syntax, matching, ranking, paging and rate limits of every search interface, plus the quirks that shaped the adapters | +| [terms.md](terms.md) | each source's terms verdict for a public release, the quoted sentence it rests on, the date checked, and what the terms ask the tool to show | +| [capabilities.md](capabilities.md) | what each source offers for filters, file lists, paging, hit counts, related records and machine-readable metadata, one row per source | +| [bench-2026-10-06.md](bench-2026-10-06.md) | latency, answer rate, results and overlap per source from `dataseek bench` | diff --git a/docs/synthesis/bench-2026-10-06.md b/docs/synthesis/bench-2026-10-06.md new file mode 100644 index 0000000..d3d1d4f --- /dev/null +++ b/docs/synthesis/bench-2026-10-06.md @@ -0,0 +1,86 @@ +# Bench, 2026-10-06 + +`dataseek bench` with its default queries ("climate temperature", "image classification", "unemployment rate", "gene expression cancer", "air quality", "population census"), 10 results asked per source, cache bypassed for live sources, catalogs warm. Run from Germany on a home connection; one run, so treat single-digit differences as noise. + +How to read it: `answered` is queries answered out of attempts; `results` is the sum over six queries; `contributed` is the merged hits the source took part in; `unique` is the merged hits no other source found; the last column is the source sharing most hits, with the count, or the reason a source did not run. + +Totals: 2,463 results, 2,355 unique hits, 2,417 contributions. About 4% of hits were found by more than one source, so the sources are complementary rather than redundant. Local catalogs answer in milliseconds; the slowest live sources (data.gov.au, data.europa.eu) take 1 to 1.5 s at the median. + +| source | answered | median ms | worst ms | results | unique | contributed | overlaps most with | +|---|---|---|---|---|---|---|---| +| `bis` | 6/6 | 0 | 6 | 0 | 0 | 0 | | +| `undata` | 6/6 | 0 | 6 | 0 | 0 | 0 | | +| `earth-search` | 6/6 | 0 | 5 | 0 | 0 | 0 | | +| `bundesbank` | 6/6 | 1 | 4 | 0 | 0 | 0 | | +| `fiscal-data` | 6/6 | 3 | 7 | 0 | 0 | 0 | | +| `tfds` | 6/6 | 5 | 15 | 0 | 0 | 0 | | +| `ecb` | 6/6 | 6 | 10 | 0 | 0 | 0 | | +| `planetary-computer` | 6/6 | 9 | 15 | 11 | 11 | 11 | | +| `materials-project` | 6/6 | 10 | 18 | 0 | 0 | 0 | | +| `uci` | 6/6 | 11 | 21 | 4 | 4 | 4 | | +| `imf` | 6/6 | 12 | 23 | 2 | 2 | 2 | | +| `copernicus-cds` | 6/6 | 15 | 21 | 10 | 9 | 10 | google (1) | +| `earth-engine` | 6/6 | 23 | 30 | 2 | 2 | 2 | | +| `nomad` | 6/6 | 28 | 29 | 0 | 0 | 0 | | +| `openneuro` | 6/6 | 29 | 35 | 0 | 0 | 0 | | +| `cellxgene` | 6/6 | 32 | 36 | 5 | 5 | 5 | | +| `copernicus-dataspace` | 6/6 | 33 | 44 | 3 | 3 | 3 | | +| `physionet` | 6/6 | 37 | 45 | 4 | 4 | 4 | | +| `openml` | 6/6 | 40 | 49 | 6 | 6 | 6 | | +| `who` | 6/6 | 48 | 56 | 2 | 2 | 2 | | +| `aws` | 6/6 | 64 | 72 | 30 | 30 | 30 | | +| `ilo` | 6/6 | 68 | 74 | 10 | 8 | 10 | dbnomics (2) | +| `oecd` | 6/6 | 76 | 85 | 14 | 14 | 14 | | +| `census` | 6/6 | 79 | 85 | 10 | 10 | 10 | | +| `github` | 6/6 | 94 | 129 | 28 | 28 | 28 | | +| `eurostat` | 6/6 | 108 | 113 | 14 | 10 | 14 | dbnomics (4) | +| `datagov` | 6/6 | 120 | 155 | 60 | 53 | 57 | socrata (4) | +| `omicsdi` | 6/6 | 128 | 158 | 60 | 60 | 60 | | +| `biostudies` | 6/6 | 194 | 290 | 15 | 15 | 15 | | +| `pangaea` | 6/6 | 198 | 315 | 46 | 43 | 46 | b2find (3) | +| `socrata-eu` | 6/6 | 207 | 297 | 14 | 14 | 14 | | +| `cern` | 6/6 | 209 | 241 | 0 | 0 | 0 | | +| `arrayexpress` | 6/6 | 221 | 343 | 48 | 48 | 48 | | +| `data-gov-uk` | 6/6 | 224 | 295 | 60 | 57 | 58 | europa (1) | +| `cessda` | 6/6 | 244 | 290 | 60 | 59 | 60 | b2find (1) | +| `dataverse-nl` | 6/6 | 248 | 296 | 60 | 60 | 60 | | +| `owid` | 6/6 | 253 | 258 | 49 | 49 | 49 | | +| `figshare` | 6/6 | 256 | 530 | 60 | 58 | 60 | datacite (2) | +| `huggingface` | 6/6 | 256 | 277 | 46 | 45 | 46 | google (1) | +| `datacommons` | 6/6 | 261 | 523 | 45 | 45 | 45 | | +| `govdata` | 6/6 | 267 | 326 | 42 | 42 | 42 | | +| `unhcr-microdata` | 6/6 | 271 | 325 | 33 | 33 | 33 | | +| `gbif` | 6/6 | 286 | 304 | 43 | 43 | 43 | | +| `opendatasoft` | 6/6 | 290 | 522 | 51 | 51 | 51 | | +| `cmr` | 6/6 | 291 | 349 | 40 | 40 | 40 | | +| `kaggle` | 6/6 | 292 | 361 | 60 | 57 | 60 | google (3) | +| `mendeley` | 6/6 | 294 | 418 | 60 | 60 | 60 | | +| `osf` | 6/6 | 333 | 377 | 60 | 60 | 60 | | +| `b2find` | 6/6 | 339 | 376 | 60 | 46 | 50 | pangaea (3) | +| `worldbank` | 6/6 | 377 | 446 | 25 | 25 | 25 | | +| `zenodo` | 6/6 | 430 | 857 | 60 | 60 | 60 | | +| `openaire` | 6/6 | 480 | 601 | 60 | 55 | 60 | borealis (3) | +| `geo` | 6/6 | 491 | 586 | 50 | 50 | 50 | | +| `worldbank-microdata` | 6/6 | 509 | 537 | 60 | 57 | 60 | ihsn (3) | +| `hdx` | 6/6 | 509 | 895 | 53 | 53 | 53 | | +| `dataverse-no` | 6/6 | 525 | 641 | 60 | 60 | 60 | | +| `ncei` | 6/6 | 560 | 972 | 27 | 26 | 26 | | +| `arcgis` | 6/6 | 583 | 754 | 50 | 50 | 50 | | +| `fao-microdata` | 6/6 | 588 | 613 | 41 | 40 | 41 | ihsn (1) | +| `dandi` | 6/6 | 597 | 1241 | 4 | 4 | 4 | | +| `ihsn` | 6/6 | 612 | 777 | 48 | 44 | 48 | worldbank-microdata (3) | +| `dataone` | 6/6 | 633 | 3092 | 60 | 60 | 60 | | +| `google` | 6/6 | 653 | 908 | 60 | 54 | 59 | kaggle (3) | +| `dbnomics` | 6/6 | 654 | 7018 | 37 | 31 | 37 | eurostat (4) | +| `synapse` | 6/6 | 657 | 961 | 60 | 60 | 60 | | +| `open-canada` | 6/6 | 658 | 993 | 55 | 55 | 55 | | +| `socrata` | 6/6 | 675 | 8282 | 47 | 42 | 47 | datagov (4) | +| `datacite` | 6/6 | 685 | 4590 | 60 | 37 | 39 | figshare (2) | +| `recherche-data-gouv` | 6/6 | 763 | 1195 | 60 | 60 | 60 | | +| `borealis` | 6/6 | 800 | 1131 | 60 | 57 | 60 | openaire (3) | +| `harvard-dataverse` | 6/6 | 829 | 966 | 60 | 60 | 60 | | +| `europa` | 6/6 | 902 | 1381 | 60 | 58 | 60 | openaire (1) | +| `modelscope` | 6/6 | 1030 | 2942 | 19 | 19 | 19 | | +| `data-gov-au` | 6/6 | 1443 | 1829 | 60 | 52 | 52 | | +| `roboflow` | 0/0 | 0 | 0 | 0 | 0 | 0 | needs $ROBOFLOW_API_KEY | +| `fred` | 0/0 | 0 | 0 | 0 | 0 | 0 | needs $FRED_API_KEY | diff --git a/docs/synthesis/capabilities.md b/docs/synthesis/capabilities.md new file mode 100644 index 0000000..e58ffe4 --- /dev/null +++ b/docs/synthesis/capabilities.md @@ -0,0 +1,100 @@ +# What each source offers for the next features + +The filter and file-list features planned for dataseek (server-side filters by license, update date, format and resource type; a resolve step that lists a dataset's files without downloading them; paging past the first page; total hit counts; links from a dataset to the papers and datasets related to it; machine-readable metadata for `inspect`) depend on what each provider exposes. One row per registry id, as probed or read from the provider's documentation on 2026-10-06. A cell is the exact parameter, field or endpoint, or `none`. This file records only; none of these is implemented, because each needs new `Dataset` fields and CLI flags. + +Columns: **license**, **date** and **format** filters; **type** is a resource-type filter; **manifest** is a file list with names, sizes, checksums or download URLs; **paging** is the parameter and the deepest reachable result; **total** is a hit count; **related** is papers or datasets linked to a record; **machine** is Croissant, schema.org JSON-LD, DCAT or another structured record. Rows of one protocol module (CKAN, Dataverse, NADA, SDMX, STAC, Socrata, EBI) repeat the protocol's cells; a difference between portals is named in the cell. + +| id | license | date | format | type | manifest | paging | total | related | machine | +|---|---|---|---|---|---|---|---|---|---| +| `datacite` | `license=` | `published=`, `created=`, `registered=` (years); `query=updated:[...]` | `query=formats:csv` (no parameter) | `resource-type-id=dataset` | none (`contentUrl` is null) | `page[number]` and `page[size]` (to 1000), 10,000 deep; `page[cursor]=1` unlimited | `meta.total` | `attributes.relatedIdentifiers[]`; `relationships.citations`, `references`, `parts`, `versions` | `Accept: application/vnd.schemaorg.ld+json` on `/dois/{doi}` | +| `openaire` | `hasLicense` (boolean) | `fromPublicationDate`, `toPublicationDate`, `publicationYear` | none | `type` (publication, dataset, software, other) | none | `page` and `pageSize` (100), 10,000 deep; `cursor=*` beyond | `header.numFound` | `/v3/research-products/links` (Scholix) | `/skg-if/v1/products/{id}` | +| `google` | none (UI "Usage rights" only) | none (UI "Last updated" only) | none (UI only) | none | none (format names at record position 10) | none (first 20 only) | `ds:0` `data[8]` (undocumented position) | none | none (a Croissant facet count only) | +| `b2find` | `fq=license_id:` | `fq=metadata_modified:[ TO *]` | `fq=res_format:CSV` | `fq=dataset_type:dataset` | `resources[]` in each result, or `package_show?id=` | `start` and `rows` (to 1,000, site-configurable) | `result.count` | `RelatedIdentifier` extra | none (`.jsonld` answers 404) | +| `huggingface` | `filter=license:cc0-1.0` | none (`sort=lastModified` or `createdAt`) | `filter=format:parquet` | `filter=task_categories:...`, `filter=modality:...` | `/api/datasets/{id}/tree/main`, or `expand[]=siblings` | `limit` (to 1,000) and `skip`; `Link: rel="next"` cursor | none | tags `arxiv:`, `doi:`, `source_datasets:` | `/api/datasets/{id}/croissant` | +| `kaggle` | `license` (cc, gpl, odb, other, all) | none (`sortBy=updated` or `published`) | `fileType` (csv, sqlite, json, bigQuery, parquet, all) | none (datasets only) | `/api/v1/datasets/list/{owner}/{dataset}` (names, sizes; no checksums) | `page` (20 a page; depth 100 confirmed) | none | none | Croissant at `/datasets/{owner}/{dataset}/croissant/download` (a web route) | +| `openml` | none (per dataset in `/data/{id}`) | none | none | none (`status` filter only) | `/data/{id}` (file URL, md5, Parquet URL); `/data/features/{id}` | `limit/N/offset/M` | none | none (tasks and studies reference dataset ids) | `/data/{id}`, `/data/qualities/{id}` (JSON) | +| `uci` | none | none | `filter=python` on the list (no true format filter) | none | `/api/dataset?id=N` (`data_url`, `variables` table) | none (`take` and `skip` ignored) | none | `intro_paper` at `/api/dataset?id=N` | `/api/dataset?id=N` (UCI's own schema) | +| `roboflow` | none documented | inline `updated:30d` in `q` | none (project-type words in `q`) | `type` (dataset or model) | none | `page` (from 1); `limit` may be ignored | none documented | inline `like:` in `q` | none documented | +| `modelscope` | `License=` (undocumented); OpenAPI `filter.license` | none (sort only) | none | none on this endpoint; OpenAPI `filter.task` | `/api/v1/datasets/{ns}/{name}/repo/tree?Revision=master&Recursive=true` (name, path, size, sha256) | `PageNumber` and `PageSize` (to 100) | `TotalCount` | none observed | `GET /api/v1/datasets/{ns}/{name}`; page `.md` | +| `aws` | none (free text per entry in the YAML) | none | none (tag pages `/tag//`) | none (`Resources[].Type` in the YAML) | none (`Resources[].ARN` and `Region` in the per-entry YAML) | none | none (local search) | `DataAtWork` in the YAML | schema.org JSON-LD on entry pages; per-entry YAML | +| `tfds` | none | none | none | none (83 category headings) | none | none | none | none | none | +| `github` | `license:` in `q` | `pushed:`, `created:` in `q` | none | none (`topic:`, `fork:`, `archived:`, `is:`) | `GET /repos/{owner}/{repo}/git/trees/{branch}?recursive=1` | `page` and `per_page` (100), 1,000 deep | `total_count` | none (`homepage`, `topics`) | none (`CITATION.cff` through `/contents/`) | +| `zenodo` | `q` field `metadata.rights.id:cc-by-4.0` | `q` fields `updated:[...]`, `publication_date:[...]` | `q` field `filetype:csv` | `type=dataset`, `subtype` | `/api/records/{id}/files` (key, size, md5, link) | `page` and `size` (25 anonymous), `links.next`, 10,000 deep | `hits.total` | `metadata.related_identifiers[]`, `conceptdoi` | `Accept: application/ld+json` or `application/dcat+xml`; OAI-PMH `/oai2d` | +| `figshare` | none (`:license:` is rejected) | `published_since`, `modified_since` | none | `item_type` (integer) | `/v2/articles/{id}/files` (name, size, md5, download_url) | `page` and `page_size`, or `offset` and `limit`; `X-Cursor` header | none | `related_materials`, `references`, `resource_doi` (detail record) | OAI-PMH `/v3/oai` (oai_dc, oai_datacite, qdc, rdf, cerif) | +| `harvard-dataverse` | `fq=license:"CC0 1.0"` (facet) | `fq=publicationDate:`; `sort=date` | `type=file` with `fq=fileTypeGroupFacet:...` (file level) | `type=dataverse`, `dataset` or `file` | `/api/datasets/:persistentId/versions/:latest-published/files` | `start` and `per_page` (guide: 1,000) | `data.total_count` | `publications` in the search item | `/api/datasets/export?exporter=...` (schema.org, croissant, croissantSlim, dcterms, ddi, Datacite) | +| `borealis` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | `data.total_count` | `publications` in the search item | `exporter=schema.org` and the others (croissant not listed) | +| `recherche-data-gouv` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | `start` and `per_page` (504 at 1,000) | `data.total_count` | `publications` in the search item | schema.org (formats not listed by v6.0) | +| `dataverse-nl` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | `data.total_count` | `publications` in the search item | exporters including croissant | +| `dataverse-no` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | as `harvard-dataverse` | `data.total_count` | `publications` in the search item | `exporter=schema.org` and the others (croissant not listed) | +| `osf` | `cardSearchFilter[rights]=` | `cardSearchFilter[dateModified][after]` (also `before`, `at-date`); `sort=-dateModified` | none | `cardSearchFilter[resourceType]`, `cardSearchFilter[resourceNature]` | none in trove (`api.osf.io` `/v2/nodes/{id}/files/`) | `links.next` cursor (not with `page[size]`); `page[size]` 100 | `meta.total` (a string for broad queries) | `hasVersion`, `isVersionOf`, `supplements`, `hasPart`, `sameAs`, `funder`, `references` | the card itself; `acceptMediatype` `application/ld+json` or `text/turtle` | +| `mendeley` | none in search (OAI `oai_datacite` rightsList) | `publication_year_from`, `publication_year_to` | none | `data_type`, `access_type`, `source_id`, `funder_id`, `institution_id` | `GET /datasets/publics/{id}/files` (OAuth only) | `page` (to 10,000) and `page_size` (to 500) | `total_records` | OAI `relatedIdentifiers` | OAI-PMH `/oai` (oai_dc, oai_datacite, datacite) | +| `europa` | `facets={"license":["CC_BY_4_0"]}` | `minDate`, `maxDate`, `dateType=issued`, `modified` or `temporal` | `facets={"format":["CSV"]}` | `filters=dataset`, `dataservice`, `datasetseries`, `catalogue`, `resource`, `vocabulary`, `organization` | `GET /api/hub/search/datasets/{id}` (access_url, download_url, format, byte_size) | `page` (0-based) and `limit` (to 1,000), 10,000 deep; `scroll` | `result.count` | DCAT-AP relations; `in_series` facet | `/api/hub/repo/datasets/{id}.jsonld`, `.ttl`, `.rdf` | +| `datagov` | none | none (`sort=last_harvested_date`) | none (`has_download`) | `spatial_filter`, `org_type`, `publisher`, `keyword`, `theme`, `collection` | `dcat.distribution[]` in each result (no sizes) | `after` cursor and `per_page` (to 1,000) | none | `dcat.isPartOf`, `dcat.references`, `parent_identifier` | DCAT-US JSON in `dcat`; `/openapi.json` | +| `data-gov-uk` | `fq=license_id:` | `fq=metadata_modified:[ TO *]` | `fq=res_format:CSV` | `fq=dataset_type:dataset` | `resources[]`, or `package_show?id=` | `start` and `rows` (to 1,000) | `result.count` | `relationships_as_subject`, `relationships_as_object` (empty in samples) | `/dataset/.jsonld` | +| `open-canada` | `fq=license_id:` | `fq=metadata_modified:[ TO *]` | `fq=res_format:CSV` | `fq=dataset_type:dataset` (also `info`) | `resources[]`, or `package_show?id=` | `start` and `rows` (to 1,000) | `result.count` | `relationships_as_subject`, `relationships_as_object` (empty in samples) | `/dataset/.jsonld` | +| `data-gov-au` | `fq=license_id:` | `fq=metadata_modified:[ TO *]` | `fq=res_format:CSV` | `fq=dataset_type:dataset` | `resources[]`, or `package_show?id=` | `start` and `rows` (to 1,000) | `result.count` | `relationships_as_subject`, `relationships_as_object` (empty in samples) | `/dataset/.jsonld` | +| `govdata` | `fq=license_id:` | `fq=metadata_modified:[ TO *]` | `fq=res_format:CSV` | `fq=dataset_type:dataset` | `resources[]`, or `package_show?id=` | `start` and `rows` (to 1,000) | `result.count` | `related_resource` extra | `/dataset/.jsonld` | +| `hdx` | `fq=license_id:` | `fq=metadata_modified:[ TO *]`; `fq=last_modified:[...]` | `fq=res_format:CSV` | `fq=dataset_type:dataset` | `resources[]` (sizes filled on HDX) | `start` and `rows` (to 1,000) | `result.count` | `relationships_as_subject`, `relationships_as_object` (empty in samples) | `/dataset/.jsonld` | +| `socrata` | `license=` (repeatable) | none (`order=updatedAt` or `createdAt`) | none (`resource.blob_mime_type` not filterable) | `only=dataset`, `href`, `file`, `filter`, `map`, `chart`, `story`, `link`, `measure`, `federated_href` | none in Discovery (`https:///api/views/.json`, `rows.csv`) | `limit` (to 10,000) and `offset` (sum to 10,000); `scroll_id` beyond | `resultSetSize` | `resource.parent_fxf`; `parent_ids`, `derived_from` filters | `https:///data.json`, `/api/dcat.json` | +| `socrata-eu` | as `socrata` | as `socrata` | as `socrata` | as `socrata` | as `socrata` | as `socrata` | `resultSetSize` | as `socrata` | as `socrata` | +| `opendatasoft` | `where=license="..."` or `refine=license: