diff --git a/.beads/formulas/beads-release.formula.toml b/.beads/formulas/beads-release.formula.toml index fb710725d..3c2711f54 100644 --- a/.beads/formulas/beads-release.formula.toml +++ b/.beads/formulas/beads-release.formula.toml @@ -134,6 +134,20 @@ needs = ["preflight-git"] description = """ Ensure we're up to date with origin and branch is properly synced. +**Every `origin/...` below means the branch you are RELEASING FROM, which is +`release/x.y.z` — never `main`.** Resetting a release branch onto main's tip +destroys the reviewed release-prep commit and leaves you tagging an untested +main SHA, which is exactly the failure the release-branch policy exists to +prevent. Pin the name first and use the variable: + +```bash +# The branch you are releasing from. For a prerelease this is still the BASE +# version's branch: an RC for 1.3.0 is cut on release/1.3.0. +REL_BRANCH="release/1.3.0" + +git rev-parse --abbrev-ref HEAD # must equal $REL_BRANCH +``` + ```bash # Fetch latest from origin git fetch origin @@ -155,21 +169,20 @@ git pull --rebase Recovering from divergence: If your branch has diverged from origin (e.g., after a botched commit): ```bash -# Option 1: Reset to origin (loses local commits) -git reset --hard origin/main - -# Option 2: Rebase local commits on top of origin -git rebase origin/main - -# Option 3: Create a backup branch first +# Option 1: Back up first, ALWAYS git branch backup-before-release -git reset --hard origin/main + +# Option 2: Reset to the release branch's origin (loses local commits) +git reset --hard "origin/$REL_BRANCH" + +# Option 3: Rebase local commits on top of it +git rebase "origin/$REL_BRANCH" ``` After pulling, verify sync: ```bash git status -sb -# Should show: "## main...origin/main" (no ahead/behind) +# Should show: "## release/1.3.0...origin/release/1.3.0" (no ahead/behind) ``` """ @@ -326,158 +339,68 @@ Focus on workflow-impacting changes agents need to know. """ [[steps]] -id = "bump-version-go" -title = "Bump version in version.go" +id = "bump-versions" +title = "Bump every version reference" needs = ["update-info-go"] description = """ -Update the Go version constant. +Run the one script that owns every version reference. ```bash -# macOS -sed -i '' 's/Version = "[^"]*"/Version = "{{version}}"/' cmd/bd/version.go - -# Linux -sed -i 's/Version = "[^"]*"/Version = "{{version}}"/' cmd/bd/version.go +./scripts/update-versions.sh {{version}} ``` +This is the ONLY sanctioned way to bump. Hand-rolled sed per file is how the +set drifts: this formula used to carry its own copies and pointed at a +`claude-plugin/` path that has not existed since the plugins moved under +`plugins/beads/`, while missing the copilot plugin, the MCP lockfile and the +tracked git-hook markers entirely — so it would have failed outright, or +shipped inconsistent versions, on every step after the stale path. + +`scripts/update-versions.sh` rewrites, in one pass: + +- `cmd/bd/version.go` — the canonical version everything else is compared to +- `plugins/beads/.claude-plugin/plugin.json` +- `plugins/beads/.codex-plugin/plugin.json` +- `plugins/beads/.copilot-plugin/plugin.json` +- `.claude-plugin/marketplace.json` +- `integrations/beads-mcp/pyproject.toml` +- `integrations/beads-mcp/src/beads_mcp/__init__.py` +- `integrations/beads-mcp/uv.lock` — via `uv lock` +- `npm-package/package.json` +- `.githooks/*` — the `BEGIN`/`END BEADS INTEGRATION v` markers +- `default.nix` +- `cmd/bd/winres/winres.json`, `cmd/bd/winres/manifest.xml` +- `README.md` — the static Alpha badge, if one is present (it is not today; + README uses live npm/PyPI/GitHub badges) + +Two of those have burned a release before, so check the script's output rather +than assuming: + +- **`uv` must be installed.** Without it the script WARNS and leaves + `uv.lock` stale. The release workflow's MCP gate runs `uv sync --locked`, + which fails only in the tag-triggered run — after the tag exists and can no + longer be rewritten. That burned v1.1.1 and cost v1.1.0 and v1.1.2 their + first runs. If you see `uv not found` or `uv lock failed`, stop and fix it: + ```bash + uv lock --directory integrations/beads-mcp + ``` +- **The `.githooks/*` markers are rewritten wholesale**, not matched against + the current version, because they can already be drifted when the bump runs + (they still said v1.1.0 during the v1.2.0 bump). + +Not covered here, by design: `CHANGELOG.md` and `cmd/bd/info.go` (earlier +steps), and `default.nix`'s `vendorHash` (next step). + Verify: ```bash -grep 'Version = ' cmd/bd/version.go -``` -""" - -[[steps]] -id = "bump-plugin-json" -title = "Bump version in plugin JSON files" -needs = ["bump-version-go"] -description = """ -Update Claude plugin manifest versions. - -```bash -# macOS/Linux with jq -jq '.version = "{{version}}"' claude-plugin/.claude-plugin/plugin.json > tmp && mv tmp claude-plugin/.claude-plugin/plugin.json -jq '.plugins[0].version = "{{version}}"' .claude-plugin/marketplace.json > tmp && mv tmp .claude-plugin/marketplace.json -``` - -Verify: -```bash -jq -r '.version' claude-plugin/.claude-plugin/plugin.json -jq -r '.plugins[0].version' .claude-plugin/marketplace.json -``` -""" - -[[steps]] -id = "bump-mcp-python" -title = "Bump version in MCP Python package" -needs = ["bump-plugin-json"] -description = """ -Update the beads-mcp Python package version. - -```bash -# macOS -sed -i '' 's/version = "[^"]*"/version = "{{version}}"/' integrations/beads-mcp/pyproject.toml -sed -i '' 's/__version__ = "[^"]*"/__version__ = "{{version}}"/' integrations/beads-mcp/src/beads_mcp/__init__.py - -# Linux -sed -i 's/version = "[^"]*"/version = "{{version}}"/' integrations/beads-mcp/pyproject.toml -sed -i 's/__version__ = "[^"]*"/__version__ = "{{version}}"/' integrations/beads-mcp/src/beads_mcp/__init__.py -``` - -Verify: -```bash -grep 'version = ' integrations/beads-mcp/pyproject.toml | head -1 -grep '__version__ = ' integrations/beads-mcp/src/beads_mcp/__init__.py -``` -""" - -[[steps]] -id = "bump-npm-package" -title = "Bump version in npm package" -needs = ["bump-mcp-python"] -description = """ -Update the npm package version. - -```bash -# macOS/Linux with jq -jq '.version = "{{version}}"' npm-package/package.json > tmp && mv tmp npm-package/package.json -``` - -Verify: -```bash -jq -r '.version' npm-package/package.json -``` -""" - -[[steps]] -id = "bump-winres" -title = "Bump version in Windows resource metadata" -needs = ["bump-npm-package"] -description = """ -Update Windows PE resource metadata. - -```bash -# macOS -sed -i '' 's/"file_version": "[^"]*"/"file_version": "{{version}}"/' cmd/bd/winres/winres.json -sed -i '' 's/"product_version": "[^"]*"/"product_version": "{{version}}"/' cmd/bd/winres/winres.json -sed -i '' 's/"FileVersion": "[^"]*"/"FileVersion": "{{version}}"/' cmd/bd/winres/winres.json -sed -i '' 's/"ProductVersion": "[^"]*"/"ProductVersion": "{{version}}"/' cmd/bd/winres/winres.json -sed -i '' 's/version="[0-9][^"]*\\.0"/version="{{version}}.0"/' cmd/bd/winres/manifest.xml - -# Linux -sed -i 's/"file_version": "[^"]*"/"file_version": "{{version}}"/' cmd/bd/winres/winres.json -sed -i 's/"product_version": "[^"]*"/"product_version": "{{version}}"/' cmd/bd/winres/winres.json -sed -i 's/"FileVersion": "[^"]*"/"FileVersion": "{{version}}"/' cmd/bd/winres/winres.json -sed -i 's/"ProductVersion": "[^"]*"/"ProductVersion": "{{version}}"/' cmd/bd/winres/winres.json -sed -i 's/version="[0-9][^"]*\\.0"/version="{{version}}.0"/' cmd/bd/winres/manifest.xml -``` - -Verify: -```bash -grep '{{version}}' cmd/bd/winres/winres.json -grep 'version="{{version}}.0"' cmd/bd/winres/manifest.xml -``` -""" - -[[steps]] -id = "bump-readme" -title = "Check README static version references" -needs = ["bump-winres"] -description = """ -README.md currently uses live npm/PyPI/GitHub release badges instead of a static -Alpha version string. Verify no old static version badge needs updating. - -```bash -rg 'Alpha \\(v|v[0-9]+\\.[0-9]+\\.[0-9]+' README.md || true -``` - -If a static release reference is reintroduced later, update it here. -""" - -[[steps]] -id = "bump-default-nix" -title = "Bump version in default.nix" -needs = ["bump-readme"] -description = """ -Update the Nix package version. - -```bash -# macOS -sed -i '' 's/version = "[^"]*";/version = "{{version}}";/' default.nix - -# Linux -sed -i 's/version = "[^"]*";/version = "{{version}}";/' default.nix -``` - -Verify: -```bash -grep 'version = ' default.nix +git diff --stat ``` """ [[steps]] id = "update-vendorhash" title = "Update Nix vendorHash if needed" -needs = ["bump-default-nix"] +needs = ["bump-versions"] description = """ Update vendorHash if go.mod/go.sum changed since last release. @@ -533,21 +456,45 @@ id = "verify-versions" title = "Verify version consistency" needs = ["stamp-changelog"] description = """ -Confirm all versions match {{version}}. +Run the gate, not a hand-listed grep pile — the grep list is what drifts. ```bash -grep 'Version = ' cmd/bd/version.go -jq -r '.version' claude-plugin/.claude-plugin/plugin.json -jq -r '.plugins[0].version' .claude-plugin/marketplace.json -jq -r '.version' npm-package/package.json -grep 'version = ' integrations/beads-mcp/pyproject.toml -grep '__version__ = ' integrations/beads-mcp/src/beads_mcp/__init__.py -grep 'version = ' default.nix -grep '{{version}}' cmd/bd/winres/winres.json -grep 'version="{{version}}.0"' cmd/bd/winres/manifest.xml +./scripts/check-versions.sh ``` -All should show {{version}}. +`scripts/check-versions.sh` reads the canonical version out of +`cmd/bd/version.go` and compares the gated files against it: all three plugin +manifests (claude, codex, copilot), the marketplace, the MCP pyproject / +`__init__.py` / `uv.lock` pin (plus `uv lock --check` for freshness when `uv` +is present), the npm package, both `BEADS INTEGRATION` markers in every +`.githooks/*` file, and the Windows PE metadata in `winres.json` and +`manifest.xml`. It exits non-zero on any mismatch and names the file. This is +the same script the release-tag pre-push hook and CI run, so a green run here +is the real signal. + +It must print `✓ Version files in sync at: {{version}}` before you continue. + +**If it fails, do NOT just re-run the bump — that is a no-op here.** +`update-versions.sh` derives the OLD version from `cmd/bd/version.go`, which by +this point already reads `{{version}}`, so its substitutions rewrite +`{{version}} -> {{version}}` and leave the drifted file exactly as it was while +printing a green "Version constants updated". Only the `.githooks` markers +(rewritten wholesale) and `uv.lock` (regenerated) heal on a re-run. The script +prints the three remedies that do work; the usual one is to edit the named file +to `{{version}}` and re-run the check. + +`check-versions.sh` does NOT gate `default.nix` or `README.md`. Confirm +`default.nix` yourself: + +```bash +grep 'version = ' default.nix # should be {{version}} +``` + +(For a prerelease, do not expect the version string to appear uniformly in the +winres files: `file_version`/`product_version` and the manifest's four-part +version carry the BASE version because PE fields must be purely numeric, while +`FileVersion`/`ProductVersion` carry the full `{{version}}`. check-versions.sh +now encodes that split, so let it do the checking.) """ [[steps]] @@ -566,37 +513,74 @@ Review the commit to ensure all expected files are included. """ [[steps]] -id = "create-tag" -title = "Create release tag" +id = "push-main" +title = "Land the release prep as a PR" needs = ["commit-release"] description = """ -Create annotated git tag. +Releases are cut from `release/x.y.z`, not from the tip of `main` — see the +"Release Branches" section of RELEASING.md. **Nothing is pushed straight to the +release branch, and nothing is tagged before the PR merges.** + +The branch is named for the BASE version: a `1.3.0-rc.1` run still targets +`release/1.3.0`. Derive it rather than substituting `{{version}}` directly, +which would name a branch nothing ever creates and fail with +`src refspec ... does not match any`: ```bash +BASE="$(printf '%s' "{{version}}" | sed 's/-.*//')" +REL_BRANCH="release/$BASE" +echo "$REL_BRANCH" +``` + +Create the prep branch, push it, and open the PR: + +```bash +git checkout -b "release-prep/v{{version}}" +git push -u origin "release-prep/v{{version}}" +gh pr create --base "$REL_BRANCH" --label status/needs-review-auto +``` + +Wait for it to merge, then take the merged state: + +```bash +git checkout "$REL_BRANCH" && git pull +``` + +After the release ships, every commit that landed only on the release branch +needs a forward-port PR to `main`, the version bump included: + +```bash +git log --oneline "main..$REL_BRANCH" +``` +""" + +[[steps]] +id = "create-tag" +title = "Create release tag on the merged commit" +needs = ["push-main"] +description = """ +Create the annotated tag on the MERGED commit, with the release branch checked +out and pulled (previous step). + +```bash +git rev-parse --abbrev-ref HEAD # must be the release branch, not the prep branch git tag -a v{{version}} -m "Release v{{version}}" ``` +Tagging before the merge is the failure to avoid, in two shapes. With branch +protection on, the direct push is rejected after the tag already exists +locally. With a squash merge, the tag points at a commit that is not an +ancestor of the release branch — and goreleaser packages `CHANGELOG.md` *from +the tag* into every published archive, so the release would ship the +pre-review notes. + Verify: `git tag -l | tail -5` """ -[[steps]] -id = "push-main" -title = "Push to main" -needs = ["create-tag"] -description = """ -Push the release commit to origin. - -```bash -git push origin main -``` - -If rejected, someone else pushed. Pull, rebase, try again. -""" - [[steps]] id = "push-tag" title = "Push release tag" -needs = ["push-main"] +needs = ["create-tag"] description = """ Push the version tag to trigger CI release. diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 99fe2466f..aad41ecfb 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -9,7 +9,7 @@ "name": "beads", "source": "./plugins/beads", "description": "AI-supervised issue tracker for coding workflows", - "version": "1.2.2" + "version": "1.3.0" } ] } diff --git a/.githooks/post-checkout b/.githooks/post-checkout index b2fdb3c35..19d309b87 100755 --- a/.githooks/post-checkout +++ b/.githooks/post-checkout @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# --- BEGIN BEADS INTEGRATION v1.2.2 --- +# --- BEGIN BEADS INTEGRATION v1.3.0 --- # This section is managed by beads. Do not remove these markers. if command -v bd >/dev/null 2>&1; then export BD_GIT_HOOK=1 @@ -56,4 +56,4 @@ if command -v bd >/dev/null 2>&1; then fi if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi fi -# --- END BEADS INTEGRATION v1.2.2 --- +# --- END BEADS INTEGRATION v1.3.0 --- diff --git a/.githooks/post-merge b/.githooks/post-merge index a6250a7da..4d315045b 100755 --- a/.githooks/post-merge +++ b/.githooks/post-merge @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# --- BEGIN BEADS INTEGRATION v1.2.2 --- +# --- BEGIN BEADS INTEGRATION v1.3.0 --- # This section is managed by beads. Do not remove these markers. if command -v bd >/dev/null 2>&1; then export BD_GIT_HOOK=1 @@ -56,4 +56,4 @@ if command -v bd >/dev/null 2>&1; then fi if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi fi -# --- END BEADS INTEGRATION v1.2.2 --- +# --- END BEADS INTEGRATION v1.3.0 --- diff --git a/.githooks/pre-commit b/.githooks/pre-commit index b77f8d207..46e710a33 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -40,7 +40,7 @@ if [ -n "$staged_go_files" ]; then echo "$staged_go_files" | xargs git add fi -# --- BEGIN BEADS INTEGRATION v1.2.2 --- +# --- BEGIN BEADS INTEGRATION v1.3.0 --- # This section is managed by beads. Do not remove these markers. if command -v bd >/dev/null 2>&1; then export BD_GIT_HOOK=1 @@ -97,4 +97,4 @@ if command -v bd >/dev/null 2>&1; then fi if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi fi -# --- END BEADS INTEGRATION v1.2.2 --- +# --- END BEADS INTEGRATION v1.3.0 --- diff --git a/.githooks/pre-push b/.githooks/pre-push index 3d01c6ecf..8bcc2483b 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -39,7 +39,7 @@ fi exec < <(printf '%s\n' "$push_refs") -# --- BEGIN BEADS INTEGRATION v1.2.2 --- +# --- BEGIN BEADS INTEGRATION v1.3.0 --- # This section is managed by beads. Do not remove these markers. if command -v bd >/dev/null 2>&1; then export BD_GIT_HOOK=1 @@ -96,4 +96,4 @@ if command -v bd >/dev/null 2>&1; then fi if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi fi -# --- END BEADS INTEGRATION v1.2.2 --- +# --- END BEADS INTEGRATION v1.3.0 --- diff --git a/.githooks/prepare-commit-msg b/.githooks/prepare-commit-msg index 8cd65fddc..bf8cfb8ff 100755 --- a/.githooks/prepare-commit-msg +++ b/.githooks/prepare-commit-msg @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# --- BEGIN BEADS INTEGRATION v1.2.2 --- +# --- BEGIN BEADS INTEGRATION v1.3.0 --- # This section is managed by beads. Do not remove these markers. if command -v bd >/dev/null 2>&1; then export BD_GIT_HOOK=1 @@ -56,4 +56,4 @@ if command -v bd >/dev/null 2>&1; then fi if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi fi -# --- END BEADS INTEGRATION v1.2.2 --- +# --- END BEADS INTEGRATION v1.3.0 --- diff --git a/.github/workflows/ci-measurements.yml b/.github/workflows/ci-measurements.yml index 1a19b137d..aa807bf7d 100644 --- a/.github/workflows/ci-measurements.yml +++ b/.github/workflows/ci-measurements.yml @@ -86,7 +86,10 @@ jobs: ci_time "install golangci-lint" -- go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.10.1 status=0 ci_time "pr-policy wrapper" -- make ci-pr-policy || status=$? - ci_time "pr-core gotestsum" -- gotestsum --junitfile artifacts/pr-core-junit.xml --format testdox -- -race -short -skip '^TestEmbedded' ./... || status=$? + # -timeout=30m keeps this in step with the lane it measures + # (scripts/ci/pr-core.sh). Without it ./cmd/bd can die on `go test`'s + # 10m default and the measurement reports a panic instead of a duration. + ci_time "pr-core gotestsum" -- gotestsum --junitfile artifacts/pr-core-junit.xml --format testdox -- -race -short -timeout=30m -skip '^TestEmbedded' ./... || status=$? ci_time "pr-lint wrapper" -- make ci-pr-lint || status=$? exit "$status" @@ -128,7 +131,10 @@ jobs: source scripts/ci/lib/timing.sh source ./.buildflags - ci_time "macos short go test" -- go test -v -race -short -skip '^TestEmbedded' ./... + # -timeout=30m matches the macOS lanes this measures (pr.yml, main.yml). + # This is the job that produced the ./cmd/bd duration distribution, and + # at 10m it clips its own longest samples into timeout panics. + ci_time "macos short go test" -- go test -v -race -short -timeout=30m -skip '^TestEmbedded' ./... macos-candidates: name: Measure macOS no-short candidates diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index 6c33bcd77..e981539db 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -5,7 +5,7 @@ name: Conformance on: pull_request: - branches: [ main ] + branches: [ main, 'release/**' ] merge_group: concurrency: diff --git a/.github/workflows/cross-version-smoke.yml b/.github/workflows/cross-version-smoke.yml index 425c07bde..d9f5c7a71 100644 --- a/.github/workflows/cross-version-smoke.yml +++ b/.github/workflows/cross-version-smoke.yml @@ -6,9 +6,11 @@ on: tags: - 'v*' - # On PR to main: test only the last 5 releases for fast feedback + # On PR to main or a release branch: test only the last 5 releases for fast + # feedback. Release-targeted PRs are exactly the ones where cross-version + # upgrade breakage is most expensive to discover at tag time. pull_request: - branches: [ main ] + branches: [ main, 'release/**' ] # Allow manual trigger with custom version count workflow_dispatch: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 33f6e1f30..ffdcf1df0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -483,7 +483,7 @@ jobs: # macOS: full test suite, no coverage (faster) - os: macos-latest coverage: false - test-flags: '-v -race -short -timeout=25m' + test-flags: '-v -race -short' steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 @@ -557,6 +557,13 @@ jobs: GOCACHE: ${{ runner.temp }}/go-cache/non-race run: go build -v -tags gms_pure_go ./cmd/bd + # Both lanes below pass -timeout=30m explicitly. ./cmd/bd has outgrown + # `go test`'s 10m per-package default (see scripts/ci/pr-core.sh and + # #6091), and when it trips the alarm the panic names whichever test was + # in flight, so it reads like a hang rather than the package running out + # of clock. The flag lives on the invocation, not in matrix.test-flags, + # so editing the matrix cannot silently drop it. 30m matches every other + # -race lane here for this same code. - name: Test (with coverage + JUnit XML) if: matrix.coverage env: @@ -566,14 +573,14 @@ jobs: gotestsum \ --junitfile junit.xml \ --format testdox \ - -- -tags gms_pure_go -race -short -timeout=25m -coverprofile=coverage.out -skip '^TestEmbedded' ./... + -- -tags gms_pure_go -race -short -timeout=30m -coverprofile=coverage.out -skip '^TestEmbedded' ./... - name: Test if: ${{ !matrix.coverage }} env: BEADS_TEST_BD_BINARY: ${{ github.workspace }}/bd GOCACHE: ${{ runner.temp }}/go-cache/race - run: go test -tags gms_pure_go ${{ matrix.test-flags }} -skip '^TestEmbedded' ./... + run: go test -tags gms_pure_go ${{ matrix.test-flags }} -timeout=30m -skip '^TestEmbedded' ./... - name: Upload coverage to Codecov if: matrix.coverage && !cancelled() diff --git a/.github/workflows/migration-test.yml b/.github/workflows/migration-test.yml index a2ab21a01..861960006 100644 --- a/.github/workflows/migration-test.yml +++ b/.github/workflows/migration-test.yml @@ -56,6 +56,11 @@ jobs: cache-identity: v1.1.0-b0f3dd607c3fb989ee08d0a6854fba80d0402971eb108f9af6170bc14d491a34 - version: v1.1.2 cache-identity: v1.1.2-a72d71ed374955dc9f83a0f90b54bd7b6a0016709dd1676ae2e368651ed401c2 + # The v1.1.2 tree re-tagged by the recovery release, so it adds no new + # storage regime — but it is the tag field upgrades actually start + # from, and it was never in this corpus. + - version: v1.2.2 + cache-identity: v1.2.2-8140098a51d3b81d5548d1c5e6db1a2d9930e5d141efe2a4bff7d079c4d321e8 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -98,7 +103,10 @@ jobs: sudo timeout 180 apt-get install -y jq libicu74 - name: Install Dolt test runtime - if: contains(fromJSON('["v0.55.4","v0.56.1","v0.57.0","v0.62.0"]'), matrix.version) + # v0.55.4-v0.62.0 host their fixture on this server; v1.0.1-v1.1.2 use + # the same pinned binary as a read-only oracle over the wisp plane, + # which has no `bd dolt sql` equivalent. + if: contains(fromJSON('["v0.55.4","v0.56.1","v0.57.0","v0.62.0","v1.0.1","v1.1.0","v1.1.2","v1.2.2"]'), matrix.version) run: | archive="$RUNNER_TEMP/dolt-linux-amd64.tar.gz" runtime="$RUNNER_TEMP/dolt-runtime" diff --git a/.github/workflows/pr-risk.yml b/.github/workflows/pr-risk.yml index 9e9f1a7ec..44bce3551 100644 --- a/.github/workflows/pr-risk.yml +++ b/.github/workflows/pr-risk.yml @@ -2,7 +2,7 @@ name: PR Risk on: pull_request: - branches: [ main ] + branches: [ main, 'release/**' ] merge_group: concurrency: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 033cff6d1..cea20a971 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -2,7 +2,10 @@ name: PR on: pull_request: - branches: [ main ] + # release/** is here because release-prep and release-fix PRs are based on + # the release branch, not on main. Without it they run almost no CI and the + # first full signal is the tag build, where a failure burns the tag. + branches: [ main, 'release/**' ] merge_group: concurrency: @@ -960,7 +963,14 @@ jobs: env: BEADS_TEST_BD_BINARY: ${{ github.workspace }}/bd GOCACHE: ${{ runner.temp }}/go-cache/race - run: go test -tags gms_pure_go -v -race -short -skip '^TestEmbedded' ./... + # -timeout is explicit for the same reason it is in scripts/ci/pr-core.sh + # (#6091): ./cmd/bd has outgrown `go test`'s 10m per-package default. On + # this runner it lands between 357s and 600s across recent runs — #6091's + # own macOS lane passed at 596.7s, 3.3s under the wall — so the package + # intermittently dies on the alarm and the panic names whichever test was + # in flight, which reads like a hang instead of the clock running out. 30m + # matches every other -race lane here for this same code. + run: go test -tags gms_pure_go -v -race -short -timeout=30m -skip '^TestEmbedded' ./... # Producer-side guard for the Beads<->consumer CLI contract. Runs the whole # cmd/bd/protocol package: the golden corpus (regenerated from this branch's diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index e2dc2e910..46237752b 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -5,7 +5,7 @@ on: push: branches: [main] pull_request: - branches: [main] + branches: [main, 'release/**'] # Allow manual trigger workflow_dispatch: diff --git a/CHANGELOG.md b/CHANGELOG.md index d5445e7fd..7283a952b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,173 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 count the same metadata-scoped set `bd list` returns without fetching every row. +### Changed + +- **`bd gate check` resolves bead gates whose target lives in a prefix-routed + rig** ([#5859](https://github.com/gastownhall/beads/pull/5859)). After a local + miss, the evaluator follows the target bead ID through `routes.jsonl` and + reads the owning store without writing to it. This covers explicit gate + checks in embedded, server, and proxied-server command paths; the legacy + `:` await value remains accepted for compatibility. + +## [1.3.0] - 2026-09-15 + +The first tested release off `main` since the 1.1 line. [1.2.2] was a recovery +release that re-shipped the v1.1.2 code under a higher version number, so a +v1.2.2 user is running 1.1-era code and meets **everything** below at once: +the changes listed here, plus the [1.2.1] changes that release deliberately +withheld. Read the upgrade notes before installing. + +### Upgrade notes + +**On an embedded or local store, the first invocation migrates your schema, in +place, from v53 to v66.** A v1.2.2 (or any 1.1.x) database sits at main-series +schema v53; this binary knows v66, so the first command that opens the store +applies 13 main-series migrations, `0054_add_lease_columns` through +`0066_add_events_journal_actor`. Two of those passes rewrite rows rather than +just reshaping tables — the aux-row id rekey and the `events` dolt_ignore flip +described under **Changed** — so on a large store the first invocation is +*noticeably* slower than the ones after it. It is crash-resumable and picks up +where it left off, but do not interrupt it if you can avoid it. + +**A shared Dolt sql-server is never auto-migrated** (#5920, #6048): migrating it +promotes the schema for every client at once, so it waits for explicit consent +via `bd migrate schema`. Remote-backed stores keep their existing +designated-migrator gate. Upgrade all of that server's clients *first* — see +[Shared servers](https://beads.gascity.com/getting-started/upgrading#shared-servers). + +**The counter restarts partway through, and that is not a loop.** The +clone-local (dolt_ignored) series runs after the main one, through the same +printer and its own numbering, and it moves 0011 → 0026 on this upgrade. So the +run is about **28 migrations**, not 13, and what you see on stderr is 13 lines +counting up to 0066 followed by 15 lines starting again at 0012: + +``` +Applying migration 0065: widen_wisp_comments_text… +Applying migration 0066: add_events_journal_actor… +Applying migration 0012: create_leases… ← clone-local series, not a restart +``` + +A counter that jumps backwards is the signature operators kill runs over. Let +it finish. + +Progress prints only when stderr is a terminal. Piped and CI runs see nothing +at all, which is deliberate — a silent-looking CI upgrade is not a stuck one. + +**Back up first, with the binary you have now.** Take the backup *before* you +install 1.3.0. Under the new binary `bd export` triggers the auto-migration +before it exports, so a snapshot taken afterwards is a post-migration snapshot +and cannot protect you against the migration going wrong. On a remote-backed +store, finish syncing with the old binary too: once 1.3.0 is installed the +pending-migration gate refuses `bd dolt push` and `bd dolt pull` as well, not +just `bd migrate`. + +```bash +# with your CURRENT bd, before installing 1.3.0: +bd dolt push # remote-backed stores only +bd export --all -o .beads/backup/pre-1.3.0-$(date +%Y%m%d).jsonl +``` + +A JSONL export is cheap, issue-complete, and importable by any bd version. If +you want a Dolt-native snapshot that keeps history and config, configure a +destination and sync it — **bare `bd backup` takes no backup**, it is a command +group that prints help and exits 0: + +```bash +bd backup init # once, to configure a destination +bd backup sync # take the snapshot +``` + +**Upgrade every client that shares a store, together.** The forward schema-skew +guard means an older co-resident binary — a second `bd` earlier in `PATH`, a +long-running `bd serve`, another clone's cron job — refuses a database migrated +past what it knows, rather than proceeding blind. That is the guard working, not +a bug, but it makes a mixed-version fleet a broken fleet: one machine running +1.3.0 takes the whole store forward and every 1.2.2 client stops. Run +`which -a bd` after installing, and on a remote-backed store follow the existing +designated-migrator procedure (one clone migrates and pushes; the rest pull or +re-clone). See +[Upgrading](https://beads.gascity.com/getting-started/upgrading) for the +per-install-method recipes and the multi-clone flow. + +**If you need to go back**, the rollback is a schema-cursor rollback, not a +downgrade of the data: the procedure is written up in the +[recovery runbook](https://beads.gascity.com/recovery/accidental-1-2-1-release) +(repo copy: `docs/recovery/accidental-1-2-1-release.md`). Its worked example is +the v53↔v65 case from the accidental 1.2.1 release; the steps are the same for +v66, with the version numbers adjusted. + +### Breaking changes for v1.2.2 users + +**This is a highlights list, not the complete set.** A v1.2.2 user is crossing +two releases at once, and the breaks below are the ones most likely to stop a +script or a service. The full set is the `[1.2.1]` section further down plus the +**Changed** section here — read `[1.2.1]` in full before upgrading, since +[1.2.2] withheld it and v1.2.1 itself was pulled, so nobody on the supported +line has seen it. + +After upgrading, `bd upgrade review` prints exactly the entries between the +version you were running and this one. (Prefer it to `bd info --whats-new`, +which dumps the entire release history.) + +**Carried from [1.2.1] — never shipped to v1.2.2 users:** + +- **`bd update --status ` now enforces close policy.** Moving an + issue to `closed` (or any configured done-category status) via `bd update`, + `bd batch update`, or the issueops facade refuses when the issue has open + children or a live direct blocker, matching `bd close`. Override with + `bd update --force` (`update status=closed force=true` in `bd batch`; + `UpdateRequest.ForceClosePolicy` for facade consumers). An unforced refusal + rolls back the entire batch. +- **`bd search` includes closed issues by default** (bd-t5yex). The dominant + query is "was this already found/filed/fixed?", where excluding closed issues + produced a false "no". Narrow with `--status open` to get the old behavior. + `bd list` keeps its open-only default. +- **The no-ID "last touched issue" fallback on `bd update` / `bd close` is + interactive-only** (bd-m00pb, + [#4839](https://github.com/gastownhall/beads/pull/4839)). A scripted + `bd update $ID …` with an empty `$ID` now refuses in argument validation + instead of mutating whatever was touched last. The fallback requires a + terminal stdin; `BD_NON_INTERACTIVE=1` and `CI=1/true` also disable it. Set + `BD_LAST_TOUCHED_FALLBACK=1` if a script genuinely relied on it. +- **`bd human list` hides done/frozen and pinned beads by default, and + validates `--status`** (#5332). It previously passed `--status` through + unvalidated and showed closed beads. A `--status` typo is now an error rather + than an empty list. Every bead *type* still shows. +- **`bd dolt push` and `bd sync` no longer adopt a git-origin-derived Dolt + remote without consent** (#5068). Both used to silently derive a remote from + `git remote get-url origin`, persist `sync.remote`, commit that config change + under your git identity, and upload the full issue history — which published + a whole issue database to a public origin on a command the user believed + targeted an already-configured remote. Adoption now prompts (defaulting to + no) and fails closed non-interactively. `--yes`/`-y` consents ahead of time. +- **`bd --readonly serve` is refused instead of binding a server that cannot do + what it advertises.** On a Dolt SQL-server workspace the flag was previously a + silent no-op and the server came up fully writable, so anything scripted as a + "safe" read-only server **does not start after this upgrade** — drop the flag. + Worth checking before you restart a long-running `bd serve` as part of the + fleet upgrade above. +- **`bd config list` and `GET /v0/beads/config` no longer enumerate the `kv.` + plane**, which is where `bd remember` memories live. That closed an + unauthenticated `GET /v0/beads/config` handing out every stored memory. A + script that read memories out of `bd config list` now gets empty output rather + than an error; use `bd kv` / `bd remember` instead. +- **The published `backend` package drops orphan handling** (bd-gwryr). + `backend.OrphanHandling` and its four constants, the `storage` originals they + aliased, `BatchCreateOptions.OrphanHandling` and `issueops.CheckOrphan` are + removed. They never did anything except cost a query, but a Go consumer that + names them no longer compiles. + +**New in 1.3.0** (full entries under **Changed**): + +- An explicitly configured Dolt server port now outranks the ambient + `BEADS_DOLT_PORT` environment variable. +- Actor matching decodes an exact `--` run to `/` instead of collapsing it to a + generic separator, so `gastown--mayor` matches `gastown/mayor` and stops + matching `gastown__mayor`. + +### Added + - **The events journal records WHO performed each mutation.** `bd_events_journal` gains an `actor` column (migration 0066 plus its ignored-series twin 0025, so upgraded workspaces and fresh clones converge on the same shape), stamped @@ -56,29 +223,207 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 concept, themes are labels here, and `--label theme:x` is the native way to say it. +- **New `*.gate.lock` files appear next to and inside `.beads`** ([#5046](https://github.com/gastownhall/beads/pull/5046), + [#5093](https://github.com/gastownhall/beads/pull/5093)). A two-level + cooperative gate now serializes the operations that cannot safely overlap — + ordinary commands take it shared, maintenance like `bd backup restore` takes + it exclusive. It is `flock`-based, so the file is the lock's *name*, not its + state: the gate is created once (mode `0600`) and deliberately never deleted, + because deleting it is how two processes end up holding two different locks + for the same resource. Each gate sits *beside* what it guards, never inside + it: the workspace gate for `/.beads` is `/.beads.gate.lock` in the + project root, and the physical-root gate is `.beads/embeddeddolt.gate.lock` in + the default embedded mode (`.beads/dolt.gate.lock` under a server layout; + under the shared server it lives beside `~/.beads/shared-server/dolt` and + never enters the workspace at all; a remote Dolt host has no physical gate). + Both are covered by the `*.gate.lock*` pattern `bd doctor` maintains in the + project and `.beads` gitignores, so an upgraded workspace picks up the ignore + rule on the next `bd doctor --fix`; a workspace with no `.beads` directory is + not gated at all, rather than scattering lock files into whatever directory + `bd` was run from. + +- **`sort` on `GET /v0/beads/issues`.** The listing served one order — + `(created_at DESC, id ASC)` — because the cursor is a keyset position in it, + and the spec said so in its own words: "the sort order is welded to the cursor + contract, and a new order needs new surface." The cost of that welding fell on + every client that wanted `bd list`'s ordering, because the only way to get it + was to page the whole result set and re-sort locally. Measured over a + 1400-row store at the 200-row page an HTTP client actually uses, that is + **7 requests plus a client-side comparator; `?sort=priority` is 1** + (`TestProxiedServerListSortRetiresTheWalk`, which runs both strategies against + a real `bd serve` and checks both against `bd list --json` row for row). It is + the one cost on this surface that got worse as a project grew. + + **Two values, and the set is closed.** `created` is the existing order, now + spellable. `priority` is `(priority ASC, created_at DESC, id ASC)` — `bd + list`'s flagless ordering, which is also what `bd list --sort priority` + produces, so one served order retires the walk for both. The other seven + orders `bd list --sort` takes are not offered: each value here is a cursor + contract needing a key proven total, and `id` is a natural-numeric order no + database expresses, `updated` moves on every write, `closed` is nullable, and + `status`/`title`/`type`/`assignee` are mutable and unindexed. + + **Absent `sort` still means `created`, permanently.** It is the compatibility + contract for every client written before the parameter existed; changing it + would alter which rows a truncated page contains, with no error to notice it + by. A server that predates the parameter answers `param: "sort"` with + `reason: "unknown_parameter"`, which is the per-parameter capability probe a + client dispatches on to fall back. + + **The cursor now carries its order, and a mismatch is refused.** This is the + half that makes the parameter safe rather than merely useful. The token was + base64 of `{t,i}` with no binding, so a `created`-order cursor replayed under + `sort=priority` would have decoded perfectly and been read as a position in a + different total order — a page that both skips and duplicates rows, served + with a 200, undetectable by the client. Tokens are now `v2` with an explicit + order member and decode refuses any token whose order differs from the + request's, as `invalid_cursor` (documented recovery: restart paging). + Outstanding `v1` tokens stay readable as the `created`-order positions they + are, so **no traversal in flight has to restart**. This does not contradict + "the token carries no filters": filters select the set, the order decides what + the position means. + + **`priority` is a mutable key**, which `created_at` is not, and the spec says + so: under `created` only new rows move relative to a walk, while a priority + update moves an existing row too, so it can be seen twice or missed. That is + the already-documented "a cursor pins a position, not a snapshot" caveat + reached by a second route, not a new class of error — unchanged data never + skips or repeats under either order. + ### Changed -- **`bd gate check` resolves bead gates whose target lives in a prefix-routed - rig** ([#5859](https://github.com/gastownhall/beads/pull/5859)). After a local - miss, the evaluator follows the target bead ID through `routes.jsonl` and - reads the owning store without writing to it. This covers explicit gate - checks in embedded, server, and proxied-server command paths; the legacy - `:` await value remains accepted for compatibility. +- Shared Dolt databases (sql-server mode) no longer auto-apply schema + migrations on a version bump. Migrating a shared database promotes the + schema for every connected bd client at once and locks out clients still + on an older binary, so bd now refuses without explicit consent: run + `bd migrate schema` once after upgrading every client, or set + `BD_ALLOW_REMOTE_MIGRATE=1` in scripted use. Reads keep working on the + current schema meanwhile. Embedded (single-user) databases still + auto-migrate silently, unchanged. (#5920) -- **Write commands now refuse to run while a MIGRATION-FREEZE sentinel sits - at the town root** (dc-6jaq), mirroring the gate the gt CLI already applies - to `gt mail send`/`nudge`/`sling`/`assign`. `bd create`/`update`/`close`/ - `remember`/`import` and every other command gated by `CheckReadonly` - (~120 call sites, `bd q` included) now print `⛔ town is frozen for - migration (by )` and exit 1 instead of writing to a store mid- - migration. The check runs twice: once early in the root command, before - version-bump auto-migration or JSONL auto-import can touch the store, and - again at each write command's own chokepoint. Read commands (`list`, - `show`, `ready`, …) keep working during a freeze — the same early check - also skips version tracking and auto-migration for them, so a frozen store - is never rewritten just because someone ran a read. `--dry-run`/`--inspect` - previews are blocked at the per-command chokepoint instead, same as strict - `--readonly` already blocks them. Clear the freeze with `gt migrate thaw`. +- The smart migration gate's "auto-migrate as safe first-mover" and + auto-fast-forward arms are now embedded-only. On a shared server the gate + always stops for consent, because neither argument can observe the other + clients attached to that server. (#5920, #4516) + +- The newly exported Go packages (`backend`, `backend/conformance`, `beadserrors`, + `issueops`, `journalops`, `memoryops`, `schema`, `test/conformance`) are marked + EXPERIMENTAL: they are not yet covered by the project's compatibility promise and + may change in a minor release. Pin an exact beads version and re-run the + conformance suite on every bump. + +- **The optimistic-concurrency token is now a JSON string** — responses carry + `revision` as an opaque decimal string and `expected_version` must be sent as + that string. JSON-number tokens exceeded JavaScript's 2^53 integer precision. + This member never shipped in a tagged release. + +- CI: migration-test and upgrade-smoke now seed and assert wisp-plane data + (wisps, wisp deps/comments, leases, events, ignored-track cursor) across + v1.0.1/v1.1.x/v1.2.2 → candidate upgrades. + +- **`--profile` is now `--cpu-profile`, with no alias** + ([#5126](https://github.com/gastownhall/beads/pull/5126), bd-ugz). The + persistent flag that writes a CPU profile is spelled `--cpu-profile`; the old + `--profile` spelling is gone rather than deprecated, so it fails as an unknown + flag instead of silently doing nothing. `--profile` is the conventional name + for a *named configuration*, not for pprof output, and holding it hostage to + a debugging aid nobody passes twice a year was the wrong trade. Scripts and + aliases that profile bd need the new spelling. + +- **Migration 0061 rekeys every events, comments, snapshot and + compaction-snapshot row to a content-derived id** + ([#5150](https://github.com/gastownhall/beads/pull/5150), bd-ri8bd). Those + four aux tables minted random UUIDv7 ids, which is fine for a single writer + and wrong for replication: unversioned newest-wins replication has no merge + pass, so two clones recording the same fact produced two rows that never + converged. Ids are now UUIDv5 over a SHA-256 digest of the row's own content + (frozen column order, plus the table name and a duplicate-disambiguating + ordinal), so the same fact derives the same id everywhere and convergence is + a property of the key rather than of a reconciliation step. New rows derive + their id at insert; existing rows are converted by a **one-time bulk rekey** + on the first open after upgrade, which is the main reason that invocation is + slower than the ones after it. The pass is crash-resumable through a + `local_metadata` sentinel and records completion clone-locally, so it runs + once per clone and is not repeated on the next command. `wisp_events` and + `wisp_comments` are deliberately excluded — they are clone-local and never + merge. **Any external reference to an event, comment or snapshot id taken + before the upgrade will not resolve afterwards.** + +- **The `events` audit table is now clone-local** + ([#5162](https://github.com/gastownhall/beads/pull/5162), bd-red8u). + Migration 0062 moves `events` onto the dolt_ignored plane in a self-committing + drop/commit/recreate that preserves every row. Events are single-writer audit + rows with low cross-machine value, and minting a versioned Dolt commit for + each one was the dominant source of commit churn on a busy store. The + consequence is the point: **`events` rows no longer replicate.** They keep + full SQL durability locally and `bd history --events` still reads them, + but a pull no longer brings another machine's events over, and a push no + longer sends yours. Events already committed before the flip stay in the + remote's history until the next squash window. Comments stay versioned. + +- **The `interactions.jsonl` audit sidecar is opt-in** + ([#4688](https://github.com/gastownhall/beads/pull/4688), fixes + [#4687](https://github.com/gastownhall/beads/issues/4687)). `audit.enabled` + now defaults to **false** and `bd init` no longer creates the file, so + status/assignee/priority field-change logging writes nothing unless you ask + for it. Set `audit.enabled=true` (or `BD_AUDIT_ENABLED=1`) to restore the old + behavior. The database-backed replacement is `bd history --events`, which + needs no sidecar. Anything that read `.beads/interactions.jsonl` on the + assumption it would exist needs the config key set. + +- **`bd import` refuses a redirected stdin rather than quietly ignoring it** + ([#5171](https://github.com/gastownhall/beads/pull/5171), bd-axluy). Bare + `bd import` imports the default JSONL, and `bd import -` imports stdin; a + `bd import < file.jsonl` looked like the second and behaved like the first, + importing a different file than the one on the command line with no way to + notice. With stdin redirected, no `-`, and no named source, `bd import` now + errors and names both fixes. `/dev/null` is a character device, so a scripted + bare `bd import` under a subprocess still imports the default file as before. + +- **Auto-backup defaults to off under a Dolt sql-server** (wy-zrmqr). The + automatic backup used to switch itself on whenever a git remote existed, + regardless of storage mode — which on one shared sql-server meant ~31 clients + independently deciding to back up the same database, pinning its CPU. The + default is now off in server, proxied-server and shared-server modes (and in + nocgo builds, which are always server-backed); embedded mode is unchanged and + still enables it when a git remote is present. An explicitly configured + `backup.enabled` (or `BD_BACKUP_ENABLED`) always wins over the default, and + `bd config get backup.enabled` now prints the effective value with its source + — `default (auto: off in sql-server mode)` — rather than a bare `false` that + could not be told apart from a configured one. + +- **`bd hooks install --chain` and `--force` are accepted no-ops** + ([#5284](https://github.com/gastownhall/beads/pull/5284), bd-5vdt8). Managed + `BEGIN`/`END BEADS INTEGRATION` marker sections made both flags meaningless: + an install now replaces only the content between its own markers, so content + outside them is *always* preserved (what `--force` used to negate) and an + existing hook *always* keeps running alongside the bd section (what `--chain` + used to request). The flags remain registered so existing invocations do not + break, and `--json` still echoes them, but neither changes what is written. + A hook with no markers is handled by shape: a legacy bd hook is replaced, and + a foreign one gets a one-time `.backup` sidecar before the section is + injected. Symlinked and git-tracked hook paths are refused outright, before + anything is written. + +- **Write commands refuse to run while a migration freeze marker is present** + (dc-6jaq). When a file named `MIGRATION-FREEZE` exists in the workspace + directory, the working directory, or any ancestor of either — or at the + path named by `BD_MIGRATION_FREEZE_FILE`, which is authoritative when set + — `bd create`/`update`/`close`/`remember`/`import` and every other write + command (~120 call sites, `bd q` included), plus the destructive + `bd init --reinit-local` and `bd bootstrap`, print `⛔ workspace is frozen + for migration` naming the marker's path and exit **14**, a distinct code + scripts can branch on, instead of writing to a store mid-migration. + Operators freeze a workspace by creating the file (optionally + `operatorRFC3339 timestampreason` on one line, echoed back in + the refusal) and thaw it by removing the file. Read commands (`list`, + `show`, `ready`, …) keep working during a freeze, and bd's own maintenance + stands down with them — version tracking, auto-migration, JSONL + auto-import, Dolt auto-commit, auto-backup, auto-export and auto-push are + all skipped, so a frozen store is never rewritten just because someone ran + a read. A running `bd serve` is not gated: stop it before freezing. If bd + cannot tell whether a marker is present, it refuses rather than assuming + the workspace is open. - **`bd dep add` names the implicit `type=blocks` default, but only to an interactive operator** (#5854). Creating an edge with no `-t/--type` silently @@ -183,8 +528,134 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 encoding changes equivalence class silently, with no error to notice. Longer or mixed runs, `__` and `---` included, are unaffected and still collapse. +- **`bd ready --claim` now refuses a row cap under `--proxied-server`.** The + proxied ready role cannot enforce `--max-rows`/`BEADS_MAX_ROWS`, so bd fails + loudly rather than silently dropping the limit; `--claim` no longer exempts + the command. Agent rigs that set the cap globally must unset it for proxied + `bd ready --claim`. Direct mode is unchanged, and a claim there still + succeeds against a ready pool larger than the cap. (#6269) + ### Fixed +- **Server-mode issue mutations no longer revert concurrent writers' committed + rows** ([#5740](https://github.com/gastownhall/beads/pull/5740)). The + issue-mutation path ran `DOLT_ADD`/`DOLT_COMMIT` inside its still-open SQL + transaction; `DOLT_ADD` stages the whole table as of the transaction's + BEGIN-time root, and the Dolt commit was minted before the commit-time merge + that reconciles concurrent writers — so a mutation could silently write every + row another session had committed during its window back to that session's + BEGIN-time value, seen in production as claims reverting minutes after they + were made. The Dolt commit now runs after the SQL transaction commits, against + the post-merge working set. Its failure is logged rather than returned: the + data is durably committed by then and rides the next Dolt commit, and treating + an applied mutation as failed is what made retries double-apply and claim + verification disown claims the caller held. Reported and fixed by + @nova-submodules. + +- **Removed-backend rejection now detects an existing Dolt database** and gives + the exact `metadata.json` heal (change `"backend"` to `"dolt"`, or delete the + field) instead of a destructive export/reinitialize path. Workspaces that bd + v1.2.x opened as Dolt despite a stale `"backend"` value are one edit from + healthy, and the message now says so. Rejection remains fail-closed and + read-only — no storage database is opened or modified — and still exits 1. + (Detection helper ported from @steveyegge's #4740.) + +- `bd migrate` no longer aborts with a duplicate-primary-key error when the same + dependency edge exists in two typed target columns; duplicate edges are now + merged deterministically (issue-ref wins over wisp/external), renaming an issue + no longer leaves its dependency rows on a stale primary key, and databases left + half-rekeyed by earlier binaries are detected and repaired on the next + migration pass (#5268). + +- **Legacy tracked `ignored_schema_migrations` self-heals** by untracking it at + open time, unwedging `bd dolt pull` on upgraded databases (#4356). + +- **A v1.1.x/v1.2.x ignored-migration cursor is believed** when + `leases.granted_node` is merely not yet migrated, so upgrades apply only the + pending ignored tail instead of replaying `ignored/0007` and silently + restamping `wisps.updated_at` (#5981 class, #5366 follow-up). + +- **Auto-export heals after `bd delete` instead of permanently refusing** — the + orphan guard proves deletions against the store's own history (embedded and + server modes), stores wedged by earlier binaries recover on first run, and + `export-state.json` is now versioned (#5896). + +- **`bd flatten` and `bd compact` now finish with a full Dolt GC** (all + generations), so re-running them on a previously-GC'd store actually reclaims + the orphaned history and retires orphaned `--as-of` addresses; `bd gc` gains + `--full` and hints when a default pass reclaims little (#5907). + +- **`--storage-class` is honored on the proxied-server and `--file` routes** and + rejected as a plan-wide `--graph` flag; it was silently ignored there. + +- **Delete and cascade `dep_remove` journal rows are attributed to the + requesting actor** (#5985); `bd events export`/`tail` now say when the journal + is disabled. + +- **Truthful errors when a server-scoped credential cannot reach the requested + database** (missing / denied / wrong-session attribution); `--init-if-missing` + is honored in proxied-server mode. + +- **The aux row re-key survives dolt#11131-class encoding drift** instead of + failing mid-upgrade with a raw `invalid hash length` error. Drifted tables are + skipped with a warning, recorded clone-locally in `aux_row_rekey_drifted`, and + re-keyed on a later pass, rather than leaving the database unopenable. This + already reached 1.1.x and v1.2.2 users — it is the [1.1.2] fix — and lands on + the main line here, so a store upgrading from v1.2.2 is not newly exposed + (#5064, #4380). Diagnosis and fix by @marcodelpin, carried and reworked by + @maphew. + +- **Server mode honors `Config.LenientOpen`**, so the dirty-table guard's + documented recovery is executable. The refusal tells you to run + `bd dolt commit` / `bd vc commit`, but against an external Dolt server those + commands could not open the store to do it — the flag reached server mode and + `newServerMode` never read it, while the field's own doc comment said "Ignored + in server mode". That left the #4566 deadlock intact for exactly the case with + no way out: embedded mode can move the database directory aside and + `bd bootstrap`, and there is no equivalent against a shared server. Fixed by + @Toady00 (#5783, #5781). + +- **`bd bootstrap` probes git remotes for Dolt data instead of rejecting them + outright** (#6037, #5743, #5663). `bd init` deliberately persists a + git-origin-derived `sync.remote` into the tracked `.beads/config.yaml` — a git + origin is a valid Dolt remote before `refs/dolt/data` exists, because the first + `bd dolt push` creates that ref on the same remote — but bootstrap classified + those URLs as code-repo URLs and returned before the origin auto-detect that + would have hydrated the clone, `git+https://` and `git+ssh://` included. + Committed `sync.remote` values from earlier releases hydrate again. The failure + was silent because one outcome code covered both "a database already exists, + nothing to do" and "I refused and left you with nothing": bootstrap printed + `✓ Database already exists`, exited 0, and created nothing, after which + `bd init --reinit-local` pointed back at `bd bootstrap` in a closed loop. + Bootstrap now exits non-zero whenever it declines to set up a database. + +- **`--set-metadata` again stores numbers/booleans/null as typed JSON scalars** + (v1.2.2 behavior); string-forcing lives on `--metadata-json`. Values written by + in-window dev builds are left as strings; re-apply the flag to retype a key. + +- **`bd create --json` (and `POST /v0/beads/issues`) again echo sub-second + RFC3339Nano timestamps**; reads (`show`/`list`) remain second-precision as in + v1.2.2. + +- **`bd purge` and `bd prune` select candidates by TIER, so a typed wisp is + ephemeral however it was minted** + ([#5995](https://github.com/gastownhall/beads/pull/5995)). The two sweeps + split the world between them — `bd purge` clears the ephemeral tier, `bd + prune` the durable one — but membership was decided by the raw `ephemeral` + column, and a wisp minted before that column was set carried a `wisp_type` + with `ephemeral = 0`. Such a bead belonged to neither sweep: `bd purge` + reported "No closed ephemeral beads to purge" while `bd prune` skipped it as + a wisp. One production database had 858 such rows / 7.3 MB that no sweep + could ever reach. The tiers are now complementary predicates over both + columns — ephemeral is `ephemeral = 1 OR wisp_type` is non-empty, durable is + its exact complement — evaluated across both planes rather than taking the + wisps-plane fast path, because legacy typed wisps live in the `issues` table. + A non-empty `wisp_type` now also implies ephemeral at mint, on every create + path, so no new bead can land in the gap. **A previously unreachable typed + wisp is now a `bd purge` candidate**, so the first purge after upgrade may + clear considerably more than usual. NoHistory beads (wisps plane, no + `wisp_type`) stay durable-tier, unchanged. + - **`bd prime` says when it could NOT read the memory plane** ([#5877](https://github.com/gastownhall/beads/issues/5877)). A broken or unreachable store made prime omit the memory section entirely, so a session @@ -258,9 +729,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `EmbeddedDoltStore` implements neither `DiffStore` nor `StateHasher`, so in the default embedded mode the incremental path is inert (`incremental skipped — store does not implement DiffStore`) and every cycle is still a - full export. The deletion-proof guard below is likewise server-mode only, so - [#5896](https://github.com/gastownhall/beads/issues/5896) stays open for - embedded mode, where `bd delete` still wedges auto-export. + full export. The deletion-proof guard below started out server-mode only for + the same reason; [#5896](https://github.com/gastownhall/beads/issues/5896) is + now closed for embedded mode too — see the store-history heal entry below. **Caveat: the diff anchor only advances on real commits.** In server mode dolt auto-commit is off, so with no commits being made the anchor stays put @@ -400,8 +871,85 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `ParentID`. Programmatic callers that set them got unfiltered results back and no error — a full list where a scoped one was asked for. +- Proxied-server mode (and `bd serve`) ran schema migrations on every store + open without consulting any migration gate, so an upgraded client silently + migrated a shared database — including from read-only commands. The gate now + runs on that path too: read commands warn and continue on the current + schema, writes refuse, and `bd serve` fails to start until the schema is + reconciled. (#5043) + +- `bd migrate schema` now works in proxied-server mode instead of refusing. + The migration runs during the provider open under the verb's consent. (#5043) + +- Migration-gate and schema-skew failures on the proxied open path and at + `bd serve` startup now print their full actionable block instead of a + single truncated line. (#5043) + +- **`bd doctor` now honors strict `--readonly` and the migration freeze** + (#6028). `bd doctor --fix` / `--clean` refuse to mutate under either gate — + the freeze refusal exits 14 and names the marker, and there is no doctor-side + override — and plain `bd doctor` diagnosis no longer rewrites `.local_version` + or auto-applies schema migrations while a freeze is active or `--readonly` is + set; it reports the pending migration instead. Both gates key on the directory + doctor was pointed at, not just the one it was launched in. Diagnosis itself + keeps working under a freeze. + +- **An externally-managed Dolt sql-server is no longer mistaken for bd's own**, + which had silently disarmed the shared-store migrate gate (#6118). When the + port arrived from `BEADS_DOLT_SERVER_PORT`, from `bd init --server-port`, or + from a stale port file left by a server that had since died, bd classified a + genuinely shared server as workspace-owned and migrated its schema in place — + no prompt, no warning, exit 0 — after which every older client on that server + was hard-refused with `schema version mismatch`. Ownership is now *proven* + from bd's own live port and PID record rather than inferred from how the + endpoint was named: bd must have bound that port and the process answering it + must still be alive. Everything else is shared, and stays gated. + +- **A `dolt.mode: server` workspace declared in `.beads/config.yaml` is no + longer refused as a legacy workspace** (#6119). The upgrade guard resolved the + connection mode from `metadata.json` alone, so a workspace that names its mode + only in config.yaml fell through to the embedded arm and was refused outright + — including workspaces this release had just created and was already + operating on. The guard now resolves the mode through the same + `IsDoltServerMode` precedence chain the rest of bd uses, and a + `.local_version` witness naming bd 1.0 or later vetoes the legacy verdict in + every mode rather than only in server mode. + +- **A server-mode workspace with no `metadata.json` no longer opens a phantom + embedded database** and answers `bd list` with a false-empty result and exit 0 + (#6120). Config substitution now gates on `IsDoltServerMode`, and + `BEADS_DOLT_SERVER_MODE` is honored on that path instead of being ignored. + +### Security + +- **Release binaries now build with Go 1.26.7** instead of 1.26.5, closing seven + standard-library advisories reachable from `bd`: quadratic `net/url` path + resolution, `html/template` JavaScript-regexp context tracking, unbounded + post-handshake `crypto/tls` messages, a missing `ReadHeaderTimeout` on + `net/http`'s unencrypted HTTP/2 check, unbounded recursion in `encoding/xml` + and `encoding/asn1`, and the `x/net/idna` Punycode bug in `net/http`'s + vendored copy. `bd serve` and bd's outbound TLS calls exercise these paths. + The `go` directive stays at 1.26.5, so nothing changes for code importing the + beads module. + +- **Dependency bumps clearing all 25 open advisories.** `golang.org/x/crypto` + 0.55.0, `golang.org/x/mod` 0.40.0, `klauspost/compress` 1.18.7, + `moby/go-archive` 0.3.3, `kin-openapi` 0.144.0 with `oapi-codegen` 2.7.1, and + a refreshed `integrations/beads-mcp/uv.lock`. None of the fixed code was + reachable from the shipped `bd` binary: the go-archive and x/crypto/ssh paths + are testcontainers-only, the compress bug is in the `s2` codec bd does not + link, and the kin-openapi critical is in `openapi3filter` middleware that + enters the graph only through the `tool` directive for spec codegen. No + behavior change; no dolt bump was required. + ### Documentation +- **Known limitation: multi-rig prefix routing (`routes.jsonl`) is not + supported with proxied-server rigs** — cross-rig bead gates stay pending, + `bd close` of a bead gate in proxied-server mode requires `bd gate check` + or `--force`, and routed lookups cannot open proxied-server targets + (#5861). + - **The heartbeat/re-home invariant and the two states it can strand are now documented where the code lives** (wy-sp2l4): a heartbeat proves the holder is alive, not that the lease moved, so `granted_node` is backfilled but never @@ -444,53 +992,6 @@ stopgap (`BD_IGNORE_SCHEMA_SKEW=1`). `go install github.com/steveyegge/beads/cmd/bd@latest` resolves to this release instead of the accidental one. (The retract block is also carried on main so future tags keep the retractions.) -- **`sort` on `GET /v0/beads/issues`.** The listing served one order — - `(created_at DESC, id ASC)` — because the cursor is a keyset position in it, - and the spec said so in its own words: "the sort order is welded to the cursor - contract, and a new order needs new surface." The cost of that welding fell on - every client that wanted `bd list`'s ordering, because the only way to get it - was to page the whole result set and re-sort locally. Measured over a - 1400-row store at the 200-row page an HTTP client actually uses, that is - **7 requests plus a client-side comparator; `?sort=priority` is 1** - (`TestProxiedServerListSortRetiresTheWalk`, which runs both strategies against - a real `bd serve` and checks both against `bd list --json` row for row). It is - the one cost on this surface that got worse as a project grew. - - **Two values, and the set is closed.** `created` is the existing order, now - spellable. `priority` is `(priority ASC, created_at DESC, id ASC)` — `bd - list`'s flagless ordering, which is also what `bd list --sort priority` - produces, so one served order retires the walk for both. The other seven - orders `bd list --sort` takes are not offered: each value here is a cursor - contract needing a key proven total, and `id` is a natural-numeric order no - database expresses, `updated` moves on every write, `closed` is nullable, and - `status`/`title`/`type`/`assignee` are mutable and unindexed. - - **Absent `sort` still means `created`, permanently.** It is the compatibility - contract for every client written before the parameter existed; changing it - would alter which rows a truncated page contains, with no error to notice it - by. A server that predates the parameter answers `param: "sort"` with - `reason: "unknown_parameter"`, which is the per-parameter capability probe a - client dispatches on to fall back. - - **The cursor now carries its order, and a mismatch is refused.** This is the - half that makes the parameter safe rather than merely useful. The token was - base64 of `{t,i}` with no binding, so a `created`-order cursor replayed under - `sort=priority` would have decoded perfectly and been read as a position in a - different total order — a page that both skips and duplicates rows, served - with a 200, undetectable by the client. Tokens are now `v2` with an explicit - order member and decode refuses any token whose order differs from the - request's, as `invalid_cursor` (documented recovery: restart paging). - Outstanding `v1` tokens stay readable as the `created`-order positions they - are, so **no traversal in flight has to restart**. This does not contradict - "the token carries no filters": filters select the set, the order decides what - the position means. - - **`priority` is a mutable key**, which `created_at` is not, and the spec says - so: under `created` only new rows move relative to a walk, while a priority - update moves an existing row too, so it can be seen twice or missed. That is - the already-documented "a cursor pins a position, not a snapshot" caveat - reached by a second route, not a new class of error — unchanged data never - skips or repeats under either order. ## [1.2.1] - 2026-08-11 @@ -2781,27 +3282,6 @@ remote-migrate gate from a blunt block into a state-aware one. ### Fixed -- **Explicit external capability dependencies now block embedded ready work - and appear in dependency trees.** References such as - `external:payments:checkout` were stored in `depends_on_external` but then - dropped by local-issue hydration, so their source still appeared in - `bd ready` and `bd dep tree` omitted the edge. Beads now resolves configured - foreign projects read-only at query time, excludes unsatisfied sources - before ready pagination and atomic claim selection, includes the refs in - blocked output, and renders them as synthetic blocked/closed tree leaves. - -- **`--label-any` is no longer silently dropped by `bd ready` and - `bd ready --claim`.** The ready-work WHERE builder emitted clauses for - `--label` and `--exclude-label` but none for `--label-any`, so the OR-set - filter was ignored on the ready/claim path (with or without `--parent`) on - every backend — while `bd list`/`bd search` honored it. On an *atomic claim* - this was dangerous rather than merely wrong: a worker fencing itself to its - own lane (`bd ready --claim --label-any lane-a --parent epic-1`) would - happily claim another lane's issue and believe it was fenced. `--label-any` - now emits an OR-set membership clause that AND-combines with `--label`, - `--exclude-label`, and `--parent`, exactly as the flag help promises; an - exhausted lane now claims nothing instead of falling back to unfenced work. - - **A failed v53 migration no longer traps the database, and the v53 repair now covers `wisp_dependencies` split-column drift.** rc.2 repaired the `issues` rig columns, but a database coming from schema v49 could still fail diff --git a/Makefile b/Makefile index 10ce703ab..d08de7468 100644 --- a/Makefile +++ b/Makefile @@ -75,8 +75,16 @@ export CGO_ENABLED := 1 # When go.mod requires a newer Go version than the locally installed one, # GOTOOLCHAIN=auto downloads the right compiler but coverage instrumentation # may still use the local toolchain's compile tool, causing version mismatch. -# Force the go.mod version to ensure all tools match. +# Force one exact version so all tools match. +# +# The `toolchain` directive wins over the `go` directive when present: `go` is +# the floor we promise importers, `toolchain` is what we actually build with, +# and reading `go` here would silently downgrade every make target below the +# toolchain the release binaries are built with. +GO_VERSION := $(shell sed -n 's/^toolchain go//p' go.mod) +ifeq ($(GO_VERSION),) GO_VERSION := $(shell sed -n 's/^go //p' go.mod) +endif ifneq ($(GO_VERSION),) export GOTOOLCHAIN := go$(GO_VERSION) endif diff --git a/RELEASING.md b/RELEASING.md index 8dab676a0..894abbb20 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -6,13 +6,16 @@ This document describes the complete release process for beads, including GitHub - [Overview](#overview) - [Prerequisites](#prerequisites) +- [Release Branches](#release-branches) - [Release Checklist](#release-checklist) - [1. Prepare Release](#1-prepare-release) - [2. GitHub Release](#2-github-release) - [3. Homebrew Update](#3-homebrew-update) - [4. PyPI Release (MCP Server)](#4-pypi-release-mcp-server) -- [5. npm Package Release](#5-npm-package-release) -- [6. Verify Release](#6-verify-release) +- [5. Plugin Marketplace Update](#5-plugin-marketplace-update) +- [6. npm Package Release](#6-npm-package-release) +- [7. Verify Release](#7-verify-release) +- [Version Numbering](#version-numbering) - [Prerelease / Release Candidate (RC) Workflow](#prerelease--release-candidate-rc-workflow) - [Hotfix Releases](#hotfix-releases) - [Rollback Procedure](#rollback-procedure) @@ -28,17 +31,21 @@ A beads release involves multiple distribution channels: ### The Easy Way (Recommended) -For routine releases, use the fully automated release script: +For routine releases, run the release molecule: ```bash -./scripts/release.sh 0.22.0 +bd mol wisp beads-release --var version=1.3.0 ``` -This handles version bump, tests, git tag, Homebrew update, and local -installation in one shot. See [scripts/README.md](scripts/README.md#releasesh--the-easy-button) -for details. The rest of this document is the manual / step-by-step process, -useful for understanding what `release.sh` does and for handling edge cases -(hotfixes, rollbacks, manual PyPI/npm publishes). +`.beads/formulas/beads-release.formula.toml` defines the whole flow as +resumable steps with a CI gate: preflight → CHANGELOG/`info.go` → +version bump → commit/tag/push → gate on `release.yml` → verify +GitHub/npm/PyPI/Homebrew → local install. `./scripts/release.sh 1.3.0` is a +thin gateway that prints this command; it does not run a release itself. + +The rest of this document is the manual / step-by-step process, useful for +understanding what the molecule does and for handling edge cases (hotfixes, +rollbacks, manual PyPI/npm publishes). ## Prerequisites @@ -79,21 +86,105 @@ python3 --version twine --version ``` +## Release Branches + +Releases are cut from a `release/x.y.z` branch, not from whatever `main` +happens to be when the tag is pushed. `main` moves continuously and the +release-critical gates do not all run on every PR, so "tag the tip of main" +means tagging a SHA nobody has fully tested. A burned tag is never reused +(the v1.1.1 and v1.2.0 precedents), so that gamble is expensive. + +**Cut the branch from a SHA that is green on both `Main` and +`Nightly Full Tests`.** The `Main` workflow runs on push to `main` and the +`Nightly Full Tests` workflow runs on a 2am UTC schedule, so the newest SHA +with both is usually a few hours behind the tip: + +```bash +gh run list --workflow Main --branch main --status success --limit 5 \ + --json headSha,conclusion,createdAt +gh run list --workflow "Nightly Full Tests" --status success --limit 3 \ + --json headSha,conclusion,createdAt + +git fetch origin +git branch release/1.3.0 +git push origin release/1.3.0 +``` + +**Everything targeted at the release lands on the release branch as a PR.** +Base the PR on `release/x.y.z`, not `main`, and label it +`status/needs-review-auto` so it goes through the automated review workflow +like any other change. That includes the release-prep PR itself (version +bump, CHANGELOG, `cmd/bd/info.go`) and any fix the release validation turns +up. Nothing is pushed straight to the release branch. + +**Tag from the release branch**, following [1. Prepare Release](#1-prepare-release) +onward with the branch checked out in place of `main`. + +**Forward-port to `main` after the release ships.** Every commit that landed +only on the release branch — the version bump included — needs a PR back to +`main`, or the next release silently drops it and the version files disagree +with the newest tag. Do this as one PR immediately after the tag is pushed, +while the set of release-only commits is still obvious: + +```bash +git log --oneline main..release/1.3.0 +``` + +(See PR #5782 for the shape of a forward-port PR.) + ## Release Checklist Before starting a release: +- [ ] `release/x.y.z` branch cut from a SHA green on `Main` **and** + `Nightly Full Tests` (see [Release Branches](#release-branches)) - [ ] All tests passing (`go test ./...`) - [ ] npm package tests passing (`cd npm-package && npm run test:all`) - [ ] **Upgrade smoke tests pass** (`make test-upgrade`) — see [Release Stability Gate](engdocs/RELEASE-STABILITY-GATE.md) - [ ] **Regression tests pass** (`make test-regression`) +- [ ] **Every release target cross-compiles** — see + [Cross-compile before tagging](#cross-compile-before-tagging). PR CI does + not build them ([#5662](https://github.com/gastownhall/beads/issues/5662)), + and a target that fails at tag time burns the tag. - [ ] **CHANGELOG.md updated with release notes** (see format below) +- [ ] **CHANGELOG rollup checked** — nothing left under `[Unreleased]` that + belongs in this release, and nothing filed under a *previous* release's + section that shipped after that tag. Verify with + `git merge-base --is-ancestor ` when in doubt. +- [ ] **`cmd/bd/info.go` `versionChanges` entry added** for this version - [ ] **Breaking changes documented** with migration steps and recovery instructions +- [ ] **Docs cutover planned** — `docs/cli-docs.pin` bump plus + `./scripts/generate-cli-docs.sh`, and the release line on the docs + homepage (`docs/index.md`). See + [Documentation Site (Mintlify)](#documentation-site-mintlify). +- [ ] `./scripts/check-versions.sh` passes - [ ] No uncommitted changes -- [ ] On `main` branch and up to date with origin +- [ ] On the `release/x.y.z` branch and up to date with origin + +### Cross-compile before tagging + +`.goreleaser.yml` builds darwin, linux, windows **and freebsd**, but PR CI +builds none of the cross targets — the v1.2.0 tag burned on a freebsd +compilation failure that no pre-tag gate could have caught +([#5661](https://github.com/gastownhall/beads/pull/5661) fixed the break, +[#5662](https://github.com/gastownhall/beads/issues/5662) tracks the CI gap). +Until that gap is closed, build them by hand before tagging: + +```bash +goreleaser build --snapshot --clean +``` + +A failure here costs a rebase. The same failure after the tag is pushed costs +the tag. ## 1. Prepare Release +> The snippets below say `main` where they mean "the branch you are releasing +> from". Since [Release Branches](#release-branches), that is `release/x.y.z`: +> substitute it for `main` in every `git push` and `git checkout` here, and +> land the changes as a PR against the release branch rather than pushing +> directly. + ### Update CHANGELOG.md **IMPORTANT: Do this FIRST before running bump-version script.** @@ -117,58 +208,86 @@ Add release notes to CHANGELOG.md: - Changed behavior of B (migration guide) ``` -Commit the CHANGELOG changes: +Commit the CHANGELOG changes and open a PR against the release branch: ```bash git add CHANGELOG.md git commit -m "docs: Add CHANGELOG entry for v0.22.0" -git push origin main +git checkout -b release-prep/v0.22.0 +git push -u origin release-prep/v0.22.0 +gh pr create --base release/0.22.0 --label status/needs-review-auto ``` ### Update Version and Create Release Tag -Use the version bump script to update all version references and create the release tag: +`./scripts/update-versions.sh` rewrites every version reference in one pass. +It does no git operations — commit, tag and push are yours. (`bump-version.sh` +is retired; it now only prints a pointer here.) ```bash -# Dry run - shows what will change -./scripts/bump-version.sh 0.22.0 - -# Full release with all local installations -./scripts/bump-version.sh 0.22.0 --commit --tag --push --all +./scripts/update-versions.sh 0.22.0 +./scripts/check-versions.sh # must pass before you commit ``` -**Available flags:** - -| Flag | Description | -|------|-------------| -| `--commit` | Create a git commit with version changes | -| `--tag` | Create annotated git tag (requires --commit) | -| `--push` | Push commit and tag to origin (requires --tag) | -| `--install` | Build and install bd to `~/go/bin` AND `~/.local/bin` | -| `--mcp-local` | Install beads-mcp from local source via uv/pip | -| `--upgrade-mcp` | Upgrade beads-mcp from PyPI (after PyPI publish) | -| `--restart-servers` | Restart all Dolt servers to pick up new version | -| `--all` | Shorthand for `--install --mcp-local --restart-servers` | - This updates: -- `cmd/bd/version.go` - CLI version constant -- `integrations/beads-mcp/pyproject.toml` - MCP server version -- `integrations/beads-mcp/src/beads_mcp/__init__.py` - MCP Python version -- `plugins/beads/.claude-plugin/plugin.json` - Claude plugin version -- `plugins/beads/.codex-plugin/plugin.json` - Codex plugin version -- `.claude-plugin/marketplace.json` - Claude marketplace version -- `npm-package/package.json` - npm package version -- `cmd/bd/templates/hooks/*` - Git hook versions -- `README.md` - Documentation version -- `PLUGIN.md` - Version requirements -- `CHANGELOG.md` - Creates release entry from [Unreleased] +- `cmd/bd/version.go` — CLI version constant. This is the canonical version: + `check-versions.sh` reads it and compares the gated files against it. Note + that "gated" is narrower than "updated" — `default.nix` and `README.md` are + bumped here but checked by nothing, so eyeball them. +- `integrations/beads-mcp/pyproject.toml` — MCP server version +- `integrations/beads-mcp/src/beads_mcp/__init__.py` — MCP Python version +- `integrations/beads-mcp/uv.lock` — the `beads-mcp` pin, via `uv lock`. A + stale lock fails the release workflow's MCP gate *after* the tag exists and + can no longer be rewritten; that burned the v1.1.1 tag. Install `uv` before + bumping, or the script warns and skips it. +- `plugins/beads/.claude-plugin/plugin.json` — Claude plugin version +- `plugins/beads/.codex-plugin/plugin.json` — Codex plugin version +- `plugins/beads/.copilot-plugin/plugin.json` — Copilot plugin version +- `.claude-plugin/marketplace.json` — Claude marketplace version +- `npm-package/package.json` — npm package version +- `.githooks/*` — the `BEGIN`/`END BEADS INTEGRATION v` markers on the + tracked managed hook sections, held byte-equal to the `cmd/bd/hooks.go` + generator by `TestTrackedManagedHookSectionsMatchGenerator`. Skipping them + reddens the branch only after the push (that was the v1.2.0 bump). +- `default.nix` — Nix package version +- `cmd/bd/winres/winres.json`, `cmd/bd/winres/manifest.xml` — Windows PE + resource metadata (the numeric fields take the base version, with any + prerelease suffix stripped) +- `README.md` — the static Alpha version badge, if one is present -The `--commit --tag --push` flags will: -1. Create a git commit with all version changes -2. Create an annotated tag `v0.22.0` -3. Push both commit and tag to origin +It does **not** touch `CHANGELOG.md`, `cmd/bd/info.go`, or `default.nix`'s +`vendorHash`. Write the release notes first (above), and run +`./scripts/update-nix-vendorhash.sh` if `go.mod`/`go.sum` changed since the +last tag. -This triggers GitHub Actions to build release artifacts automatically. +Then commit and land it as a PR — **not** a direct push, and **do not tag +yet**: + +```bash +git add -A +git commit -m "chore: bump version to 0.22.0" +git checkout -b release-prep/v0.22.0 +git push -u origin release-prep/v0.22.0 +gh pr create --base release/0.22.0 --label status/needs-review-auto +``` + +Tag only after that PR merges, and tag the **merged** commit: + +```bash +git checkout release/0.22.0 && git pull +git tag -a v0.22.0 -m "Release v0.22.0" +git push origin v0.22.0 +``` + +Two reasons the order matters, both of which have teeth. With branch +protection on, a direct push to the release branch is rejected — after you +have already minted the tag locally. And with a squash merge, a tag created +before the merge points at a commit that is not an ancestor of +`release/x.y.z`; goreleaser packages `CHANGELOG.md` *from the tag* into every +published archive, so the release would ship the pre-review notes. + +Pushing the tag triggers GitHub Actions to build release artifacts +automatically. The tag workflow re-runs release-critical package gates before publishing: @@ -186,12 +305,14 @@ release. ```bash # 1. Update CHANGELOG.md and cmd/bd/info.go with release notes (manual step) -# 2. Bump version and install everything locally -./scripts/bump-version.sh 0.22.0 --commit --all +# 2. Bump versions and verify +./scripts/update-versions.sh 0.22.0 +./scripts/check-versions.sh -# 3. Test locally, then tag and push +# 3. Land it on the release branch as a PR (label status/needs-review-auto) + +# 4. Test locally, then tag the merged commit and push git tag -a v0.22.0 -m "Release v0.22.0" -git push origin main git push origin v0.22.0 ``` @@ -199,18 +320,6 @@ The release workflow is intentionally gated to `refs/tags/v*`. A manual workflow dispatch from a branch will skip publishing jobs; manual reruns must select the release tag. -**Alternative (step-by-step):** - -```bash -# Just commit -./scripts/bump-version.sh 0.22.0 --commit - -# Then manually tag and push -git tag -a v0.22.0 -m "Release v0.22.0" -git push origin main -git push origin v0.22.0 -``` - ## 2. GitHub Release ### Using GoReleaser (Recommended) @@ -383,19 +492,33 @@ top-level CLI commands" passes vacuously for it, e.g. wy-gx5rj for `bd sync`). Bump it as part of THIS release, not a follow-up: ```bash -# After tagging (see "Update Version and Create Release Tag" above): +# After tagging (see "Update Version and Create Release Tag" above). +# generate-cli-docs.sh builds bd from the pinned tag, so the tag must exist. echo "v0.22.0" > docs/cli-docs.pin ./scripts/generate-cli-docs.sh git add docs/cli-docs.pin docs/CLI_REFERENCE.md docs/cli-reference docs/docs.json git commit -m "docs: bump CLI docs pin to v0.22.0" -git push origin main ``` +The pin bump lands on `main`, since that is where Mintlify deploys from — fold +it into the forward-port PR described in [Release Branches](#release-branches) +rather than pushing it to the release branch (or to `main`) directly. + Skipping this step doesn't fail fast — Check 4 stays green (it validates against the *old* pin) until the next bump, at which point every command added across the skipped releases shows up at once as a pile of "missing from docs/CLI_REFERENCE.md" failures with no obvious release to blame. +**The docs homepage names the release line, and it is hand-maintained.** +`docs/index.md` carries a line of the form "These docs are for the X.Y.Z +release of beads" with a link to that tag's release notes. Nothing generates +or validates it, so it goes stale silently — it still said 1.1.0 when the pin +had already moved to v1.2.2. Update it in the same commit as the pin: + +```bash +rg 'These docs are for the' docs/index.md +``` + ## 6. npm Package Release The npm package wraps the native binary for Node.js environments. @@ -416,7 +539,7 @@ npm org ls beads # Navigate to npm package cd npm-package -# Version should already be updated by bump-version.sh +# Version should already be updated by update-versions.sh cat package.json | grep version # Run all tests @@ -525,14 +648,32 @@ curl -fsSL https://raw.githubusercontent.com/gastownhall/beads/main/scripts/inst bd version ``` -### CLI Docs Pin +### Docs Cutover ```bash -cat docs/cli-docs.pin # should be the tag just released, not an older one +cat docs/cli-docs.pin # the tag just released, not an older one +rg 'These docs are for the' docs/index.md # the version just released ``` -If it's stale, do the bump from the "Documentation Site (Mintlify)" step -above before calling the release done. +If either is stale, do the bump from the +[Documentation Site (Mintlify)](#documentation-site-mintlify) step above +before calling the release done. + +### Release Notes Rollup + +```bash +# [Unreleased] should be empty, and the newest dated section is this release +rg -n '^## \[' CHANGELOG.md | head -3 +``` + +Also confirm nothing shipped after the *previous* tag is still filed under +that tag's section — the v1.2.2 section carried an entry for a commit that was +never in v1.2.2, which is invisible until someone reads the release notes and +looks for a feature their binary does not have: + +```bash +git merge-base --is-ancestor && echo "in the tag" || echo "MISFILED" +``` ## Prerelease / Release Candidate (RC) Workflow @@ -556,32 +697,42 @@ identifier (e.g. `1.1.0-rc.1`); Python tooling normalizes this to PEP 440 form ### Cut an RC +**An RC is cut from the release branch, like everything else.** This is the +point of an RC: it validates the SHA the stable release will ship. Tagging the +tip of `main` instead validates a *different* SHA by construction — the stable +tag comes off `release/x.y.z` — and re-introduces the "tag a SHA nobody has +fully tested" failure that [Release Branches](#release-branches) exists to +prevent. Note the branch is named for the **base** version: an RC for 1.1.0 is +cut on `release/1.1.0`, not `release/1.1.0-rc.1`. + ```bash +# 0. Cut (or check out) the release branch — see Release Branches above. +git checkout release/1.1.0 + # 1. Update CHANGELOG.md and cmd/bd/info.go with the RC notes (manual step), # same as a stable release. Date the CHANGELOG section. -# 2. Bump versions. update-versions.sh accepts a prerelease identifier and, +# 2. Bump versions. update-versions.sh accepts a prerelease identifier, and +# also refreshes uv.lock (PEP 440 normalizes 1.1.0-rc.1 to 1.1.0rc1). ./scripts/update-versions.sh 1.1.0-rc.1 # Windows PE numeric fields (winres file_version/product_version and the # manifest version) are set to the base version 1.1.0, # because PE versions must be purely numeric; gen-winres.sh strips the -# prerelease suffix the same way at build time. +# prerelease suffix the same way at build time, and check-versions.sh +# checks those fields against the base version for exactly this reason. -# 3. Keep the MCP lockfile in sync (PEP 440 normalizes to 1.1.0rc1), or the -# Package Gate (MCP) check goes red: -(cd integrations/beads-mcp && uv lock) - -# 4. Validate locally. +# 3. Validate locally. ./scripts/check-versions.sh -# 5. Open a PR for the RC prep and have it reviewed. RC prep should land -# through normal review, not auto-merge. +# 4. Open a PR for the RC prep against release/1.1.0 and have it reviewed. +# RC prep should land through normal review, not auto-merge. ``` -After the RC prep is merged to `main`, cut the tag from the merge commit: +After the RC prep merges, cut the tag from the merged commit on the release +branch: ```bash -git checkout main && git pull +git checkout release/1.1.0 && git pull git tag -a v1.1.0-rc.1 -m "Release candidate v1.1.0-rc.1" git push origin v1.1.0-rc.1 ``` @@ -595,36 +746,36 @@ above. Tag creation is restricted to release maintainers; see - Install the RC from the GitHub prerelease assets and exercise the changes it is gating before promoting. - To promote to stable, bump to the base version with no suffix - (`./scripts/update-versions.sh 1.1.0`). The stable release **does** publish - to Homebrew/PyPI/npm, so follow the standard + (`./scripts/update-versions.sh 1.1.0`) **on the same release branch**, so the + stable tag lands on the SHA the RC validated. The stable release **does** + publish to Homebrew/PyPI/npm, so follow the standard [Prepare Release](#1-prepare-release) steps from there. ## Hotfix Releases For urgent bug fixes: +A hotfix is a release branch cut from the tag instead of from a green `main` +SHA; everything else — PRs against the branch, the forward-port afterwards — +is the same as [Release Branches](#release-branches). + ```bash -# Create hotfix branch from tag -git checkout -b hotfix/v0.22.1 v0.22.0 +# Create the release branch from the tag being fixed +git checkout -b release/0.22.1 v0.22.0 +git push origin release/0.22.1 -# Make fixes -# ... edit files ... - -# Bump version to 0.22.1 -./scripts/bump-version.sh 0.22.1 --commit +# Land the fix as a PR against release/0.22.1, then bump +./scripts/update-versions.sh 0.22.1 +./scripts/check-versions.sh +git commit -am "chore: bump version to 0.22.1" # Tag and release git tag -a v0.22.1 -m "Hotfix release v0.22.1" -git push origin hotfix/v0.22.1 +git push origin release/0.22.1 git push origin v0.22.1 -# Follow normal release process -goreleaser release --clean - -# Merge back to main -git checkout main -git merge hotfix/v0.22.1 -git push origin main +# Forward-port the fix AND the version bump to main +git log --oneline main..release/0.22.1 ``` ## Rollback Procedure @@ -715,13 +866,10 @@ After a successful release: 1. **Upgrade local beads-mcp installation** to the new version: ```bash - # Option 1: Use the bump-version.sh script (recommended during version bump) - ./scripts/bump-version.sh --upgrade-mcp - - # Option 2: Manual upgrade via pip (if installed globally) + # If installed globally pip install --upgrade beads-mcp - # Option 3: Manual upgrade via uv tool (if installed as a tool) + # If installed as a uv tool uv tool upgrade beads-mcp # Verify the new version @@ -731,20 +879,17 @@ After a successful release: # The MCP server will load the newly installed version ``` - **Note:** The `--upgrade-mcp` flag can be combined with other flags: - ```bash - # Update versions, commit, install bd binary, and upgrade beads-mcp all at once - ./scripts/bump-version.sh 0.24.3 --commit --install --upgrade-mcp - ``` +2. **Forward-port the release branch to `main`** — see + [Release Branches](#release-branches). Include the `docs/cli-docs.pin` bump + and the `docs/index.md` release line. -2. **Verify the upgraded CLI**: +3. **Verify the upgraded CLI**: ```bash bd version bd doctor quick ``` -3. **Announce** on relevant channels (Twitter, blog, etc.) -4. **Update documentation** if needed +4. **Announce** on relevant channels (Twitter, blog, etc.) 5. **Close milestone** on GitHub if using milestones 6. **Update project board** if using project management 7. **Monitor** for issues in the first 24-48 hours @@ -793,13 +938,38 @@ goreleaser build --snapshot --clean Beads follows [Semantic Versioning](https://semver.org/): -- **MAJOR** (x.0.0): Breaking changes -- **MINOR** (0.x.0): New features, backwards compatible -- **PATCH** (0.0.x): Bug fixes, backwards compatible +- **MAJOR** (x.0.0): Removals and incompatible interface changes — a command, + flag, config key, schema table or published Go API that is deleted or + changes shape such that a caller written against the old one cannot be + fixed by changing its inputs. +- **MINOR** (0.x.0): New features, plus **documented behavioral changes that + ship with migration notes**. A command that starts refusing input it used to + accept, changes a default, or changes which rows it returns is a minor bump + when the change is written up in CHANGELOG.md with the migration step and + the opt-out. It is not a major bump: the interface is unchanged and the + caller keeps working after a documented adjustment. +- **PATCH** (0.0.x): Bug fixes, no behavioral change beyond the bug. + +The MINOR clause is a description of practice, not a loophole. It carries an +obligation: every behavioral break in a minor release must appear in +CHANGELOG.md under that release, name its override or migration step, and be +summarized in `cmd/bd/info.go` so `bd info --whats-new` surfaces it to agents. +A behavioral break that is *not* documented that way is a bug in the release, +not a minor bump. + +**1.3.0 is a worked example.** It ships seven documented behavioral breaks — +`bd update --status ` enforcing close policy, `bd search` +including closed issues, the interactive-only last-touched fallback, `bd human +list` status handling, `bd dolt push` remote-adoption consent, Dolt port +precedence over `BEADS_DOLT_PORT`, and actor `--` decoding — plus a schema +migration and a flag rename (`--profile` → `--cpu-profile`). Every one has a +CHANGELOG entry with its override, and the release is a MINOR bump. Examples: - `0.21.5` → `0.22.0`: New features (minor bump) - `0.22.0` → `0.22.1`: Bug fix (patch bump) +- `1.2.2` → `1.3.0`: New features plus documented behavioral breaks with + migration notes (minor bump) - `0.22.1` → `1.0.0`: Stable release (major bump) **Prereleases:** append a SemVer prerelease identifier for release candidates, diff --git a/backend/conformance/batch_creator_contract.go b/backend/conformance/batch_creator_contract.go index b0032ec38..0b48334f0 100644 --- a/backend/conformance/batch_creator_contract.go +++ b/backend/conformance/batch_creator_contract.go @@ -5,6 +5,7 @@ import ( "errors" "reflect" "testing" + "time" "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/types" @@ -539,6 +540,46 @@ func RunBatchCreatorDoesNotMutateTheCallerRequest(t *testing.T, ctx context.Cont } } +// RunBatchCreatorEchoesSubSecondTimestamps is the batch half of +// RunLifecycleCreateEchoesSubSecondTimestamps: every entry of a batch result +// carries the timestamps its write sent, at full precision, not the whole +// seconds the DATETIME(0) columns answer a re-read with. +// +// PER ITEM, because both bodies build the result one snapshot at a time and a +// fix applied to the first item only would still pass a check on result[0]. +func RunBatchCreatorEchoesSubSecondTimestamps(t *testing.T, ctx context.Context, fixture BatchCreatorFixture) { + t.Helper() + first := time.Date(2019, 3, 4, 5, 6, 7, 123456789, time.UTC) + second := time.Date(2020, 4, 5, 6, 7, 8, 246813579, time.UTC) + request := publicops.CreateBatchRequest{ + Actor: "batch-writer", + Items: []publicops.BatchCreateItem{ + batchCreatorItem(&types.Issue{Title: "nano first", Priority: 2, IssueType: types.TypeTask, CreatedAt: first, UpdatedAt: first}), + batchCreatorItem(&types.Issue{Title: "nano second", Priority: 2, IssueType: types.TypeTask, CreatedAt: second, UpdatedAt: second}), + }, + } + want := []time.Time{first, second} + result, err := fixture.BatchCreator.CreateBatch(ctx, request) + if err != nil { + t.Fatalf("CreateBatch with sub-second timestamps: %v", err) + } + if len(result.Issues) != len(want) { + t.Fatalf("CreateBatch returned %d issues for %d items", len(result.Issues), len(want)) + } + for i, issue := range result.Issues { + if issue == nil { + t.Fatalf("CreateBatch result issue %d is nil", i) + } + if !issue.CreatedAt.Equal(want[i]) { + t.Errorf("result issue %d created_at = %v, want %v exactly — a batch echo rounded to the second cannot order same-second creates", + i, issue.CreatedAt.UTC(), want[i]) + } + if !issue.UpdatedAt.Equal(want[i]) { + t.Errorf("result issue %d updated_at = %v, want %v exactly", i, issue.UpdatedAt.UTC(), want[i]) + } + } +} + // batchCreatorItem is the item every case builds, so a case names only the // fields it is about. func batchCreatorItem(issue *types.Issue) publicops.BatchCreateItem { diff --git a/backend/conformance/lifecycle_create_contract.go b/backend/conformance/lifecycle_create_contract.go index 831974df7..ca906424a 100644 --- a/backend/conformance/lifecycle_create_contract.go +++ b/backend/conformance/lifecycle_create_contract.go @@ -565,6 +565,79 @@ func assertLifecycleCreateMembers(t *testing.T, id, label string, issue *types.I } } +// RunLifecycleCreateEchoesSubSecondTimestamps pins that a create RESULT carries +// the timestamps the write actually sent, at full precision, rather than the +// whole seconds a read of the row answers with. +// +// created_at/updated_at are DATETIME(0) columns, so any snapshot built by +// re-reading the row it just wrote comes back rounded. That is fine for every +// read verb — show and list have always answered whole seconds — but create is +// different: its echo is the ONLY record a caller has of the instant the row was +// written, and agents order same-second creates by it. A backend that hydrates +// its create result and stops there silently loses that ordering, which is +// exactly the regression this case exists for. +// +// THE PRECISION PIN IS THE EXPLICIT ARM, not the auto-stamped one. A create that +// names no time is stamped from the clock, and whether that stamp happens to +// carry a non-zero fraction is not something a test can require without being +// flaky by a billionth; a caller-supplied time with nanoseconds in it is +// deterministic, and PrepareIssueForInsert preserves a non-zero input. The +// auto-stamp arm is kept as a bounded smoke check that the overlay did not +// replace the stamp with something unrelated. +// +// The stored ROW is deliberately NOT asserted here. What it rounds to is the +// column's business, and a later widening to DATETIME(6) must not have to edit +// this case. +func RunLifecycleCreateEchoesSubSecondTimestamps(t *testing.T, ctx context.Context, fixture LifecycleCreateFixture) { + t.Helper() + + id := fixture.IssuePrefix + "-lcc-nanoecho" + createdAt := time.Date(2019, 3, 4, 5, 6, 7, 123456789, time.UTC) + updatedAt := time.Date(2019, 3, 4, 5, 6, 8, 987654321, time.UTC) + created, err := fixture.Lifecycle.Create(ctx, publicops.CreateRequest{ + Actor: "writer", + ForceIDPrefix: true, + Issue: &types.Issue{ + ID: id, Title: "sub-second echo", Status: types.StatusOpen, Priority: 2, IssueType: types.TypeTask, + CreatedAt: createdAt, UpdatedAt: updatedAt, + }, + }) + if err != nil { + t.Fatalf("create %s with sub-second timestamps: %v", id, err) + } + if created.Issue == nil { + t.Fatalf("create %s returned no issue", id) + } + if !created.Issue.CreatedAt.Equal(createdAt) { + t.Errorf("%s create result created_at = %v, want %v exactly — the echo is the caller's only record of when the row was written, and rounding it to the second makes same-second creates unorderable", + id, created.Issue.CreatedAt.UTC(), createdAt) + } + if !created.Issue.UpdatedAt.Equal(updatedAt) { + t.Errorf("%s create result updated_at = %v, want %v exactly", id, created.Issue.UpdatedAt.UTC(), updatedAt) + } + + // The auto-stamped arm: no precision requirement, only that the overlay + // still hands back a stamp from this call rather than a stale or zero one. + stamped := fixture.IssuePrefix + "-lcc-nanoauto" + lower := time.Now().UTC().Add(-lifecycleCreateClockSlack) + auto, err := fixture.Lifecycle.Create(ctx, publicops.CreateRequest{ + Actor: "writer", + ForceIDPrefix: true, + Issue: lifecycleCreateIssue(stamped), + }) + if err != nil { + t.Fatalf("create %s without timestamps: %v", stamped, err) + } + upper := time.Now().UTC().Add(lifecycleCreateClockSlack) + if auto.Issue == nil { + t.Fatalf("create %s returned no issue", stamped) + } + echoed := auto.Issue.CreatedAt.UTC() + if echoed.Before(lower) || echoed.After(upper) { + t.Errorf("%s create result created_at = %v, want a stamp from this call between %v and %v", stamped, echoed, lower, upper) + } +} + // lifecycleCreateClockSlack widens the window the auto-stamp arm allows around a // creation time the implementation wrote from its own clock. Every backend here // stamps in Go, in this process, so the two clocks are the same one; the slack diff --git a/backend/conformance/role_bundle_cases.go b/backend/conformance/role_bundle_cases.go index 62b8012ba..48ab94dc9 100644 --- a/backend/conformance/role_bundle_cases.go +++ b/backend/conformance/role_bundle_cases.go @@ -94,6 +94,7 @@ var roleContractCases = []roleContract{ RunBatchCreatorRecordsOneHistoryEntry, RunBatchCreatorRecordsNoHistoryForAnEphemeralBatch, RunBatchCreatorDoesNotMutateTheCallerRequest, + RunBatchCreatorEchoesSubSecondTimestamps, ), roleCases("BlockingAnnotator", "BlockingAnnotator()", oncePerRole, @@ -412,6 +413,7 @@ var roleContractCases = []roleContract{ RunLifecycleCreateRefusesAForeignIDPrefix, RunLifecycleCreateInheritsParentLabels, RunLifecycleCreateWritesEveryScalarField, + RunLifecycleCreateEchoesSubSecondTimestamps, ), roleCases("LifecycleUpdate", "IssueLifecycle()", oncePerRole, diff --git a/beads.go b/beads.go index ea26654a5..87df68cc9 100644 --- a/beads.go +++ b/beads.go @@ -26,6 +26,7 @@ import ( "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/storage/dolt" "github.com/steveyegge/beads/internal/storage/domain" + "github.com/steveyegge/beads/internal/storage/schema" "github.com/steveyegge/beads/internal/types" "github.com/steveyegge/beads/internal/workspacegate" ) @@ -36,12 +37,17 @@ import ( // safe to repeat. type Storage = beads.Storage -func configuredBackendUnavailable(backend string) error { +// configuredBackendUnavailable is the public open path's fail-closed refusal for +// metadata naming a removed or unrecognized backend. beadsDir and cfg let the +// refusal detect an already-present Dolt database and name the exact +// metadata.json edit that heals the workspace, instead of the export-and- +// reinitialize path that would destroy it. +func configuredBackendUnavailable(backend, beadsDir string, cfg *configfile.Config) error { switch backend { case configfile.BackendPostgres, configfile.BackendMySQL, configfile.BackendSQLite: - return configfile.RemovedBackendError(backend) + return configfile.RemovedBackendErrorAt(backend, beadsDir, cfg) default: - return configfile.UnknownBackendError(backend) + return configfile.UnknownBackendErrorAt(backend, beadsDir, cfg) } } @@ -270,6 +276,39 @@ type ( StatusEntry = storage.StatusEntry ) +// AllowSharedSchemaMigration authorizes this process to apply pending schema +// migrations to a database that is SHARED with other bd clients — a Dolt +// sql-server, where migrating promotes the schema version for every connected +// client at once and clients still running an older bd will refuse the +// database until they are upgraded (gastownhall/beads#5920). +// +// Without it, an embedder that upgrades its beads dependency across a schema +// bump gets a migration-gate error from every writable Open* call, whose +// guidance names CLI commands (`bd migrate schema`) that mean nothing inside a +// library process. This is the programmatic equivalent of that command. +// +// It is process-local and set-or-clear, which is the point: the alternative — +// os.Setenv("BD_ALLOW_REMOTE_MIGRATE", "1") — is process-GLOBAL and inherited +// by every child process the embedder spawns, including git hooks and dolt +// subprocesses. +// +// The parity with that env var is only in the process-local mechanism, not the +// reach: BD_ALLOW_REMOTE_MIGRATE=1 unlocks BOTH the no-remote and the +// remote-backed shared arms, while this authorizes ONLY the no-remote arm. A +// remote-backed shared store still needs --force / AllowRemoteMigrateEnv, +// because #4259 cross-clone coordination is a stronger, different contract. +// +// Call it before the Open* call that should perform the migration, and clear +// it afterwards. Only grant it once the operator has confirmed that every +// other client of the server is upgraded; it is a coordination decision the +// library cannot make, because other clients' versions are not observable from +// this process. +// +// Embedded (single-writer) databases never need it: they still auto-migrate. +func AllowSharedSchemaMigration(allow bool) { + schema.SetSharedMigrateConsent(allow) +} + // Open opens a Dolt-backed beads database at the given path. // This always opens in embedded mode. Use OpenFromConfig to respect // server mode settings from metadata.json. diff --git a/beads_cgo.go b/beads_cgo.go index a43a56d46..60936982c 100644 --- a/beads_cgo.go +++ b/beads_cgo.go @@ -31,7 +31,7 @@ func OpenBestAvailable(ctx context.Context, beadsDir string) (Storage, error) { cfg = configfile.DefaultConfig() } if !configfile.IsSupportedBackend(cfg.Backend) { - return nil, configuredBackendUnavailable(cfg.Backend) + return nil, configuredBackendUnavailable(cfg.Backend, beadsDir, cfg) } // Dispatch to a registered extension backend before any Dolt path, mirroring diff --git a/beads_nocgo.go b/beads_nocgo.go index e63b12e5c..6867daf84 100644 --- a/beads_nocgo.go +++ b/beads_nocgo.go @@ -25,7 +25,7 @@ func OpenBestAvailable(ctx context.Context, beadsDir string) (Storage, error) { cfg = configfile.DefaultConfig() } if !configfile.IsSupportedBackend(cfg.Backend) { - return nil, configuredBackendUnavailable(cfg.Backend) + return nil, configuredBackendUnavailable(cfg.Backend, beadsDir, cfg) } // Dispatch to a registered extension backend before any Dolt path, mirroring diff --git a/beadserrors/errors.go b/beadserrors/errors.go index 513ecab9d..7f2e0491c 100644 --- a/beadserrors/errors.go +++ b/beadserrors/errors.go @@ -26,6 +26,12 @@ // // The package imports stdlib and nothing else, and it must stay that way: it // sits beneath every leaf, so anything it imports is imported by all of them. +// +// # Stability +// +// EXPERIMENTAL. This package is not yet covered by the project's compatibility +// promise and may change in a minor release. Every leaf re-exports from here, +// so a change to this vocabulary reaches all of them at once. package beadserrors import ( diff --git a/cmd/bd/backend_registry_contract_test.go b/cmd/bd/backend_registry_contract_test.go index c9ec83cda..61f5761a1 100644 --- a/cmd/bd/backend_registry_contract_test.go +++ b/cmd/bd/backend_registry_contract_test.go @@ -43,7 +43,7 @@ func TestRegisteredBackendDispatchesReadWriteAndReadOnly(t *testing.T) { registerContractBackend(t, name) beadsDir := writeContractBackendConfig(t, name) - if err := validateConfiguredBackend(&configfile.Config{Backend: name}); err != nil { + if err := validateConfiguredBackend(&configfile.Config{Backend: name}, beadsDir); err != nil { t.Fatalf("validateConfiguredBackend() rejected registered backend: %v", err) } if _, err := newDoltStoreFromConfig(t.Context(), beadsDir); !errors.Is(err, errRegistryReadWrite) { @@ -78,7 +78,7 @@ func TestOSSRegistersNoRemovedBackends(t *testing.T) { if backends.Registered(name) { t.Errorf("OSS unexpectedly registered removed backend %q", name) } - if err := validateConfiguredBackend(&configfile.Config{Backend: name}); err == nil { + if err := validateConfiguredBackend(&configfile.Config{Backend: name}, t.TempDir()); err == nil { t.Errorf("OSS unexpectedly accepted removed backend %q", name) } } diff --git a/cmd/bd/backend_support.go b/cmd/bd/backend_support.go index 8b073efd0..6ef060c7f 100644 --- a/cmd/bd/backend_support.go +++ b/cmd/bd/backend_support.go @@ -7,7 +7,12 @@ import ( "github.com/steveyegge/beads/internal/storage/backends" ) -func validateConfiguredBackend(cfg *configfile.Config) error { +// validateConfiguredBackend fails closed on metadata that selects a removed or +// unrecognized backend. beadsDir is the workspace whose metadata cfg came from; +// the rejection inspects it (read-only) so a workspace that already holds a Dolt +// database is told to fix the stale "backend" value rather than to export and +// reinitialize. Pass "" only where there is genuinely no workspace directory. +func validateConfiguredBackend(cfg *configfile.Config, beadsDir string) error { if cfg == nil { return nil } @@ -16,11 +21,11 @@ func validateConfiguredBackend(cfg *configfile.Config) error { } switch cfg.Backend { case configfile.BackendPostgres, configfile.BackendMySQL, configfile.BackendSQLite: - return configfile.RemovedBackendError(cfg.Backend) + return configfile.RemovedBackendErrorAt(cfg.Backend, beadsDir, cfg) case "", configfile.BackendDolt: return nil default: - return configfile.UnknownBackendError(cfg.Backend) + return configfile.UnknownBackendErrorAt(cfg.Backend, beadsDir, cfg) } } @@ -33,8 +38,8 @@ func registeredBackendWorkspaceIsBeadsDir(cfg *configfile.Config) bool { return backends.WorkspaceIsBeadsDir(cfg.GetBackend()) } -func requireDoltBackend(cfg *configfile.Config) error { - if err := validateConfiguredBackend(cfg); err != nil { +func requireDoltBackend(cfg *configfile.Config, beadsDir string) error { + if err := validateConfiguredBackend(cfg, beadsDir); err != nil { return err } if cfg != nil && cfg.GetBackend() != configfile.BackendDolt { @@ -64,7 +69,7 @@ func loadDoltBackendConfig(beadsDir string) (*configfile.Config, error) { if cfg == nil { cfg = configfile.DefaultConfig() } - if err := requireDoltBackend(cfg); err != nil { + if err := requireDoltBackend(cfg, beadsDir); err != nil { return nil, err } return cfg, nil diff --git a/cmd/bd/bootstrap.go b/cmd/bd/bootstrap.go index 423d7dd6b..95ba55b57 100644 --- a/cmd/bd/bootstrap.go +++ b/cmd/bd/bootstrap.go @@ -4,6 +4,7 @@ import ( "bufio" "context" "database/sql" + "encoding/json" "errors" "fmt" "io" @@ -22,6 +23,7 @@ import ( "github.com/steveyegge/beads/internal/configfile" "github.com/steveyegge/beads/internal/doltserver" "github.com/steveyegge/beads/internal/metrics" + "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/storage/dolt" "github.com/steveyegge/beads/internal/storage/doltutil" "github.com/steveyegge/beads/internal/storage/embeddeddolt" @@ -51,6 +53,12 @@ type bootstrapServerDBCheck struct { // retries. Injectable for testing. var bootstrapRetryDelay = func(d time.Duration) { time.Sleep(d) } +// probeGitRemoteDoltData reports whether a git remote carries Dolt data +// (refs/dolt/data). Injectable for testing; the production value is a +// 10s-bounded `git ls-remote` with credential prompts suppressed. A non-nil +// error means UNKNOWN, not "no data". +var probeGitRemoteDoltData = gitRemoteHasDoltDataRefStatus + var checkBootstrapServerDB = func(probeCfg bootstrapServerProbeConfig) bootstrapServerDBCheck { host := probeCfg.host port := probeCfg.port @@ -113,6 +121,9 @@ Bootstrap auto-detects the right action: • If no database exists: creates a fresh one • If database already exists: validates and reports status +If sync.remote points at a git repository, bootstrap verifies refs/dolt/data +before cloning. Bootstrap exits non-zero when it cannot set up a database. + This is the recommended command for: • Setting up beads on a fresh clone • Recovering after moving to a new machine @@ -145,6 +156,19 @@ Examples: // Resolve non-interactive mode: flag > env var > CI env > terminal detection. nonInteractive := isNonInteractiveBootstrap(yesFlag || nonInteractiveFlag) + // dc-6jaq: "bootstrap" is in noDbCommands, so PersistentPreRunE + // returns at the skip-store early return before its freeze gate, and + // bootstrap.go calls neither CheckReadonly nor the gate itself — yet + // it writes, and the first of those writes (the metadata repair below) + // lands before its own confirmation prompt and before it takes any + // workspace gate. --dry-run is exempt because it genuinely does not + // write; every other invocation is refused while a marker is active. + if !dryRun { + if err := migrationFreezeGateFor(cmd, "bootstrap"); err != nil { + return err + } + } + // Find beads directory beadsDir := beads.FindBeadsDir() if beadsDir == "" { @@ -211,7 +235,7 @@ Examples: if cfg == nil { cfg = configfile.DefaultConfig() } - if err := requireBootstrapDoltBackend(cfg); err != nil { + if err := requireBootstrapDoltBackend(cfg, beadsDir); err != nil { return HandleError("%v", err) } @@ -231,7 +255,7 @@ Examples: return err } if plan.Action == "none" || dryRun { - return nil + return bootstrapPlanOutcome(plan, dryRun) } } else { if repairMsg != "" { @@ -239,7 +263,7 @@ Examples: } printBootstrapPlan(plan) if plan.Action == "none" || dryRun { - return nil + return bootstrapPlanOutcome(plan, dryRun) } } @@ -269,14 +293,73 @@ func applyBootstrapMetadataRepair(beadsDir string, cfg *configfile.Config, apply // BootstrapPlan describes what bootstrap will do. type BootstrapPlan struct { - Action string `json:"action"` // "sync", "restore", "jsonl-import", "init", "none" - Reason string `json:"reason"` // Human-readable explanation - BeadsDir string `json:"beads_dir"` - Database string `json:"database"` - SyncRemote string `json:"sync_remote,omitempty"` - BackupDir string `json:"backup_dir,omitempty"` - JSONLFile string `json:"jsonl_file,omitempty"` - HasExisting bool `json:"has_existing"` + Action string `json:"action"` // "sync", "restore", "jsonl-import", "init", "none" + Reason string `json:"reason"` // Human-readable explanation + BeadsDir string `json:"beads_dir"` + Database string `json:"database"` + // SyncRemote is the remote this workspace syncs with. For Action=="sync" + // it is the clone source; for the provisioning actions it is the remote to + // register as Dolt "origin" so the first `bd dolt push` has somewhere to + // go. Always the routed (doltRemoteURL) form for forge URLs, and empty on + // a Blocked plan — nothing may be cloned from or pushed to a remote + // bootstrap could not verify. + // + // This is an operational URL, so it keeps whatever credentials the user + // configured. Run it through redactRemoteURL before printing it or putting + // it anywhere a human will read. Reason and BlockedRemote are already + // display-safe. + SyncRemote string `json:"sync_remote,omitempty"` + BackupDir string `json:"backup_dir,omitempty"` + JSONLFile string `json:"jsonl_file,omitempty"` + // Blocked marks a plan that took no action and found no database. It is + // derived in detectBootstrapAction from Action+HasExisting, never set by a + // detection branch, and it is the single discriminator the exit code and + // the printed output both switch on. Additive on purpose: JSON consumers + // switch on "action", so a new action value would break them, while + // "none" + "blocked" + a non-zero exit code is backwards compatible. + Blocked bool `json:"blocked,omitempty"` + // BlockedRemote is the credential-free remote URL a Blocked plan could not + // verify, carried only so the diagnostic can name it. + BlockedRemote string `json:"blocked_remote,omitempty"` + HasExisting bool `json:"has_existing"` +} + +// MarshalJSON renders the plan for `bd bootstrap --json` (and `--dry-run --json`) +// with the credential-bearing SyncRemote redacted, mirroring the human path +// (printBootstrapPlan runs it through redactRemoteURL). SyncRemote keeps whatever +// credentials the user configured — see the field comment — and `--json` writes +// to stdout, which CI logs and agent transcripts capture, so it must not be +// emitted verbatim. Redaction is on a copy; executeBootstrapPlan still consumes +// the raw plan.SyncRemote for the clone. Reason and BlockedRemote are already +// built display-safe. +func (p BootstrapPlan) MarshalJSON() ([]byte, error) { + // The local type sheds BootstrapPlan's method set so json.Marshal does not + // recurse back into this MarshalJSON. + type bootstrapPlanJSON BootstrapPlan + safe := bootstrapPlanJSON(p) + safe.SyncRemote = redactRemoteURL(p.SyncRemote) + return json.Marshal(safe) +} + +// bootstrapPlanOutcome maps a printed plan to the command's exit status. +// Action=="none" was two outcomes wearing one name — "a database already +// exists, nothing to do" and "bootstrap declined and left you with no +// database" — and both returned nil, so a rejected sync.remote printed a +// success tick and exited 0 with no database (#5743). Blocked is the +// discriminator. +// +// --dry-run always succeeds. bd doctor documents `bd bootstrap --dry-run` as +// the safe inspection step, and a preview that aborts a `set -e` provisioning +// script is a worse contract than a preview that merely reports. The blocked +// state is still printed (and still in the JSON), so the preview does predict +// what a real run would refuse to do. +func bootstrapPlanOutcome(plan BootstrapPlan, dryRun bool) error { + if dryRun || !plan.Blocked { + return nil + } + // The reason and hints are already on stderr, or the plan JSON (carrying + // "blocked": true) is already on stdout. + return SilentExit() } func noWorkspaceBootstrapPayload() map[string]interface{} { @@ -287,8 +370,8 @@ func noWorkspaceBootstrapPayload() map[string]interface{} { } } -func requireBootstrapDoltBackend(cfg *configfile.Config) error { - if err := validateConfiguredBackend(cfg); err != nil { +func requireBootstrapDoltBackend(cfg *configfile.Config, beadsDir string) error { + if err := validateConfiguredBackend(cfg, beadsDir); err != nil { return err } // A registered extension backend passes validateConfiguredBackend so its @@ -304,7 +387,20 @@ func requireBootstrapDoltBackend(cfg *configfile.Config) error { return nil } +// detectBootstrapAction builds the plan and then derives its outcome flags in +// exactly one place. Blocked is never hand-set by a detection branch: it is a +// function of the finished plan ("took no action AND found no database"), so no +// branch can leave a stale flag behind for a later branch to inherit. func detectBootstrapAction(beadsDir string, cfg *configfile.Config) BootstrapPlan { + plan := detectBootstrapPlan(beadsDir, cfg) + plan.Blocked = plan.Action == "none" && !plan.HasExisting + if !plan.Blocked { + plan.BlockedRemote = "" + } + return plan +} + +func detectBootstrapPlan(beadsDir string, cfg *configfile.Config) BootstrapPlan { plan := BootstrapPlan{ BeadsDir: beadsDir, Database: cfg.GetDoltDatabase(), @@ -315,10 +411,8 @@ func detectBootstrapAction(beadsDir string, cfg *configfile.Config) BootstrapPla // sync.remote / refs/dolt/data detection run before treating an existing // shared-server database as "nothing to do", otherwise an unrelated default // "beads" database can mask the real recovery path. - beadsDirExists := false - if info, err := os.Stat(beadsDir); err == nil && info.IsDir() { - beadsDirExists = true - } + info, statErr := os.Stat(beadsDir) + beadsDirExists := statErr == nil && info.IsDir() // Check for existing database (path differs between server and embedded mode). // Determine server/shared-server mode from the target workspace itself @@ -335,68 +429,57 @@ func detectBootstrapAction(beadsDir string, cfg *configfile.Config) BootstrapPla // and the multi-clone upgrade guide. If the local beadsDir does not exist // yet, still prefer sync recovery first for Action=="none" so a default // shared-server "beads" DB from another project cannot mask a real clone. + // Held aside rather than merged into plan: a "none" verdict here is only a + // fallback for when nothing else matches, and copying it into plan leaked + // its HasExisting/Blocked/Reason into every branch below — including the + // probe-error branch, which then inherited HasExisting=true and printed the + // #5743 success tick again. + var deferredExistingPlan *BootstrapPlan if dbAction, ok := existingBootstrapDBPlan(beadsDir, cfg, isServer, isSharedServer); ok { if beadsDirExists || dbAction.Action != "none" { return dbAction } - plan = dbAction + deferredExistingPlan = &dbAction } - // Check sync.remote (primary) or sync.git-remote (deprecated fallback) + // A configured sync.remote (primary) or sync.git-remote (deprecated + // fallback) is authoritative: try it first and, when it cannot be cloned, + // remember why so an unverifiable remote can become fatal only after local + // recovery is exhausted. With no sync.remote, auto-detect Dolt data on git + // origin instead. syncRemote := resolveSyncRemote() + unusableRemoteReason, unusableRemoteURL := "", "" if syncRemote != "" { - if isGitCodeRepoURL(syncRemote) { - // Cloning from a git code-repo URL via DOLT_CLONE spins dolt to - // 1000% CPU and requires manual SIGKILL. Reject and - // surface the misconfiguration rather than attempting the clone. - fmt.Fprintf(os.Stderr, "error: sync.remote %q looks like a git code-repository URL, not a Dolt remote — skipping clone\n", syncRemote) - plan.Action = "none" - plan.Reason = fmt.Sprintf("sync.remote %q rejected: git code-repository URL (not a Dolt remote)", syncRemote) + done, reason, url := planConfiguredSyncRemote(&plan, syncRemote) + if done { return plan } - // User-provided sync.remote — trust the URL format as-is. - // normalizeRemoteURL would convert http:// to git+http://, - // breaking Dolt remotesapi endpoints (GH#3339). - plan.SyncRemote = syncRemote - plan.Action = "sync" - plan.Reason = "sync.remote configured — will clone from " + syncRemote - return plan + // Cloning is off the table; purely local recovery is not. + unusableRemoteReason, unusableRemoteURL = reason, url + } else if originPlan, ok := gitOriginSyncPlan(plan); ok { + return originPlan } - // Auto-detect: probe git origin for Dolt data stored in git - // (refs/dolt/data). This only applies to git remotes — Dolt-native - // remotes (DoltHub, S3, etc.) must be configured via sync.remote. - if isGitRepo() && !isBareGitRepo() { - if originURL, err := gitOriginGetURL(); err == nil && originURL != "" { - if gitOriginHasDoltDataRef() { - plan.SyncRemote = normalizeRemoteURL(originURL) - plan.Action = "sync" - plan.Reason = "Found Dolt data on git origin (refs/dolt/data) — will clone from " + originURL - return plan - } - } + // On-disk recovery sources: a non-empty backup JSONL, then a git-tracked + // issues.jsonl. When a forge sync.remote had no Dolt data yet, plan already + // carries its SyncRemote so the restored/imported workspace stays wired to it. + if recoveryPlan, ok := localFileRecoveryPlan(plan, beadsDir); ok { + return recoveryPlan } - // Check for backup JSONL files (must be non-empty to be useful) - backupDir := filepath.Join(beadsDir, "backup") - issuesFile := filepath.Join(backupDir, "issues.jsonl") - if info, err := os.Stat(issuesFile); err == nil && info.Size() > 0 { - plan.BackupDir = backupDir - plan.Action = "restore" - plan.Reason = "Backup files found — will restore from " + backupDir - return plan + if deferredExistingPlan != nil { + return *deferredExistingPlan } - // Check for git-tracked JSONL (the portable export format) - gitJSONL := filepath.Join(beadsDir, "issues.jsonl") - if _, err := os.Stat(gitJSONL); err == nil { - plan.JSONLFile = gitJSONL - plan.Action = "jsonl-import" - plan.Reason = "Git-tracked issues.jsonl found — will import from " + gitJSONL - return plan - } - - if plan.Action == "none" { + // Only now, with every local recovery source exhausted, does an + // unverifiable remote become fatal. Restoring a local backup touches no + // remote, so an offline laptop or a credential-less CI runner must not be + // denied the recovery that the same machine would get if the probe had + // merely answered "no data". + if unusableRemoteReason != "" { + plan.Action = "none" + plan.Reason = unusableRemoteReason + plan.BlockedRemote = unusableRemoteURL return plan } @@ -406,6 +489,116 @@ func detectBootstrapAction(beadsDir string, cfg *configfile.Config) BootstrapPla return plan } +// planConfiguredSyncRemote resolves a configured sync.remote into plan. done==true +// means the plan is finished — a clone plan for a trusted remote or a forge repo +// the probe confirmed carries Dolt data — and the caller returns plan as-is. +// done==false means keep looking: either the forge repo has no Dolt data yet +// (plan.SyncRemote is still recorded so a fresh workspace gets wired to it) or the +// remote could not be verified, in which case the returned reason/url describe the +// unusable remote so it can become fatal only after local recovery is exhausted. +func planConfiguredSyncRemote(plan *BootstrapPlan, syncRemote string) (done bool, unusableReason, unusableURL string) { + if !isGitCodeRepoURL(syncRemote) { + // User-provided sync.remote — trust the URL format as-is. + // normalizeRemoteURL would convert http:// to git+http://, breaking Dolt + // remotesapi endpoints (GH#3339). That concern cannot apply here: a + // remotesapi endpoint never classifies as a git code-repo URL. + plan.SyncRemote = syncRemote + plan.Action = "sync" + plan.Reason = "sync.remote configured — will clone from " + redactRemoteURL(syncRemote) + return true, "", "" + } + + // A git-forge URL is a *supported* Dolt remote: `bd init` and `bd dolt + // remote add` both persist one, and `bd dolt push` stores the database under + // refs/dolt/data on it. What must never happen is cloning it blind, or in a + // form that reaches Dolt's remotesapi client. doltRemoteURL owns that routing + // rule; probe first, and clone only what the probe actually confirmed + // (#5743, #5663). + routed := doltRemoteURL(syncRemote) + hasData, probeErr := probeGitRemoteDoltData(routed) + switch { + case probeErr != nil: + // UNKNOWN, not "no data" — never clone something we could not verify + // (init's resolveRemoteHasDoltDataProbe convention). + reason := fmt.Sprintf("could not verify refs/dolt/data on sync.remote %q: %v", + redactRemoteURL(syncRemote), probeErr) + // Said here as well as in the final verdict because a local backup may + // well rescue this run, and then this is the only place the user learns + // the remote could not be reached. + fmt.Fprintf(os.Stderr, "note: not cloning — %s; checking local recovery sources\n", reason) + return false, reason, redactRemoteURL(routed) + case hasData: + plan.SyncRemote = routed + plan.Action = "sync" + plan.Reason = "sync.remote git repo has Dolt data (refs/dolt/data) — will clone from " + redactRemoteURL(routed) + return true, "", "" + default: + // Definitively no Dolt data: the repo was wired before the first `bd + // dolt push`. Say so and keep looking, the same way bd init falls back + // to a fresh local database. Carry the URL so the workspace we create + // still gets wired to it. + plan.SyncRemote = routed + fmt.Fprintf(os.Stderr, "note: sync.remote %q has no Dolt data yet (refs/dolt/data absent); checking other recovery sources\n", + redactRemoteURL(syncRemote)) + return false, "", "" + } +} + +// gitOriginSyncPlan returns a clone-from-git-origin plan when git origin carries +// Dolt data (refs/dolt/data), or ok==false otherwise. Only git remotes qualify — +// Dolt-native remotes (DoltHub, S3, etc.) must be configured via sync.remote. +// +// The caller invokes this only when no sync.remote is configured. sync.remote is +// the authoritative remote for this workspace, so hydrating from whatever git +// origin happens to be (a fork, an old experiment, the code repo under the +// dedicated-data-repo pattern) is not recovery — and finalizeSyncedBootstrap would +// then rewrite the team's committed sync.remote to point at it. Skipping it also +// spares the second identical ls-remote in the common case where sync.remote IS +// the git origin, which is what bd init persists. +func gitOriginSyncPlan(plan BootstrapPlan) (BootstrapPlan, bool) { + if !isGitRepo() || isBareGitRepo() { + return BootstrapPlan{}, false + } + originURL, err := gitOriginGetURL() + if err != nil || originURL == "" { + return BootstrapPlan{}, false + } + if !gitOriginHasDoltDataRef() { + return BootstrapPlan{}, false + } + plan.SyncRemote = normalizeRemoteURL(originURL) + plan.Action = "sync" + plan.Reason = "Found Dolt data on git origin (refs/dolt/data) — will clone from " + redactRemoteURL(originURL) + return plan, true +} + +// localFileRecoveryPlan returns a restore or jsonl-import plan built from on-disk +// recovery sources under beadsDir — a non-empty backup/issues.jsonl (restore), +// else a git-tracked issues.jsonl (the portable export format) — or ok==false +// when neither is present. plan is taken by value so its already-populated fields +// (e.g. a forge SyncRemote with no Dolt data yet) ride into the returned plan. +func localFileRecoveryPlan(plan BootstrapPlan, beadsDir string) (BootstrapPlan, bool) { + // Backup JSONL must be non-empty to be useful. + backupDir := filepath.Join(beadsDir, "backup") + issuesFile := filepath.Join(backupDir, "issues.jsonl") + if info, err := os.Stat(issuesFile); err == nil && info.Size() > 0 { + plan.BackupDir = backupDir + plan.Action = "restore" + plan.Reason = "Backup files found — will restore from " + backupDir + return plan, true + } + + gitJSONL := filepath.Join(beadsDir, "issues.jsonl") + if _, err := os.Stat(gitJSONL); err == nil { + plan.JSONLFile = gitJSONL + plan.Action = "jsonl-import" + plan.Reason = "Git-tracked issues.jsonl found — will import from " + gitJSONL + return plan, true + } + + return BootstrapPlan{}, false +} + func existingBootstrapDBPlan(beadsDir string, cfg *configfile.Config, isServer, isSharedServer bool) (BootstrapPlan, bool) { plan := BootstrapPlan{ BeadsDir: beadsDir, @@ -455,6 +648,11 @@ func existingBootstrapDBPlan(beadsDir string, cfg *configfile.Config, isServer, bootstrapRetryDelay(retryDelays[attempt]) } if result.Err != nil { + // Same "declined, and no database was confirmed" class as a + // failed remote probe: report it and exit non-zero rather than + // printing a success tick (#5743). Blocked is not hand-set here — + // detectBootstrapAction derives it from Action=="none" && !HasExisting + // (HasExisting is false on this branch), keeping one owner for the flag. plan.Action = "none" plan.Reason = fmt.Sprintf("Could not verify existing server database %s: %v", cfg.GetDoltDatabase(), result.Err) return plan, true @@ -534,6 +732,22 @@ func bootstrapServerPort(beadsDir string, cfg *configfile.Config, isSharedServer func printBootstrapPlan(plan BootstrapPlan) { switch plan.Action { case "none": + if plan.Blocked { + // Nothing was set up and nothing was found. Never print the + // success tick here — that is the #5743 false success. + fmt.Fprintf(os.Stderr, "Bootstrap did not set up a database: %s\n", plan.Reason) + if plan.BlockedRemote != "" { + // Deliberately not "delete sync.remote and re-run": the git + // origin probe on that path swallows its error, so for a + // credential failure the retry would "succeed" by creating a + // fresh database that has diverged from the team's history. + fmt.Fprintf(os.Stderr, " Reproduce: git ls-remote %s refs/dolt/data\n", + gitRemoteURLForLsRemote(plan.BlockedRemote)) + fmt.Fprintf(os.Stderr, " If the remote is right, fix access (credentials, network, VPN) and re-run 'bd bootstrap'.\n") + fmt.Fprintf(os.Stderr, " If it is wrong, point sync.remote at the Dolt remote: bd dolt remote add origin \n") + } + return + } fmt.Printf("✓ Database already exists: %s\n", plan.BeadsDir) if !usesSQLServer() { fmt.Printf(" Nothing to do.\n") @@ -542,7 +756,7 @@ func printBootstrapPlan(plan BootstrapPlan) { } case "sync": fmt.Printf("Bootstrap plan: clone from remote\n") - fmt.Printf(" Remote: %s\n", plan.SyncRemote) + fmt.Printf(" Remote: %s\n", redactRemoteURL(plan.SyncRemote)) fmt.Printf(" Database: %s\n", plan.Database) case "restore": fmt.Printf("Bootstrap plan: restore from backup\n") @@ -574,7 +788,7 @@ func confirmPrompt(message string, nonInteractive bool) bool { } func executeBootstrapPlan(plan BootstrapPlan, cfg *configfile.Config, nonInteractive bool) error { - if err := requireBootstrapDoltBackend(cfg); err != nil { + if err := requireBootstrapDoltBackend(cfg, plan.BeadsDir); err != nil { return err } if !confirmPrompt("Proceed?", nonInteractive) { @@ -643,10 +857,32 @@ func executeInitAction(ctx context.Context, plan BootstrapPlan, cfg *configfile. return fmt.Errorf("commit: %w", err) } + wireBootstrapDoltRemote(ctx, s, plan) fmt.Fprintf(os.Stderr, "Created fresh database with prefix %q\n", prefix) return nil } +// wireBootstrapDoltRemote registers plan.SyncRemote as Dolt remote "origin" on +// a workspace bootstrap just provisioned locally. +// +// The sync action has always done this (via configureInitDoltRemote after the +// clone) and bd init does it too, but the local actions never did, because a +// configured sync.remote used to short-circuit to "sync" before they could be +// reached. The refs/dolt/data fall-through makes them reachable, and without +// the remote the promise that "the first bd dolt push creates refs/dolt/data +// on that same git remote" breaks: push either refuses to adopt a remote +// without consent, or adopts the git origin — a different repository under the +// dedicated-data-repo pattern — and rewrites the committed sync.remote to +// match. Two machines bootstrapping in the pre-first-push window would then +// mint independent Dolt identities and diverge, which is the exact failure +// bootstrap exists to prevent (#5743). +func wireBootstrapDoltRemote(ctx context.Context, s storage.DoltStorage, plan BootstrapPlan) { + if plan.SyncRemote == "" { + return + } + configureInitDoltRemote(ctx, s, doltRemoteURL(plan.SyncRemote), false) +} + func executeRestoreAction(ctx context.Context, plan BootstrapPlan, cfg *configfile.Config) error { prefix := inferPrefix(cfg) dbName := cfg.GetDoltDatabase() @@ -674,6 +910,7 @@ func executeRestoreAction(ctx context.Context, plan BootstrapPlan, cfg *configfi return fmt.Errorf("restore from backup: %w", err) } + wireBootstrapDoltRemote(ctx, s, plan) fmt.Fprintf(os.Stderr, "Restored from backup\n") return nil } @@ -710,6 +947,7 @@ func executeJSONLImportAction(ctx context.Context, plan BootstrapPlan, cfg *conf return fmt.Errorf("commit import: %w", err) } + wireBootstrapDoltRemote(ctx, s, plan) fmt.Fprintf(os.Stderr, "Imported %d issues from %s\n", count, plan.JSONLFile) return nil } @@ -777,6 +1015,28 @@ func executeSyncAction(ctx context.Context, plan BootstrapPlan, cfg *configfile. return nil } +// printInitJoinGuidance corrects the one thing the gate's shared-store block +// gets wrong when `bd init` is the caller: it says to run `bd migrate schema`, +// but this init failed before writing metadata.json, so there is no workspace +// here to run it from (gastownhall/beads#5920). A client JOINING an existing, +// behind shared server has to be told where the command actually works. +// +// Only the shared-store arm needs this. The remote-backed refusals from init +// are already handled by printBootstrapRemoteBehindGuidance above, and their +// remedies are not workspace-local in the same way. +func printInitJoinGuidance(w io.Writer, e *schema.RemoteMigrateGateError) { + if e.Decision != "shared-no-remote" { + return + } + fmt.Fprintf(w, + "\n This workspace was NOT created — bd init stopped before writing\n"+ + " .beads/metadata.json, so `%s` cannot be run from here yet.\n"+ + " Either run it from a workspace already set up against this server, or\n"+ + " join and migrate in one step once every client is upgraded:\n"+ + " %s=1 bd init …\n", + schema.SharedConsentCommand, schema.AllowRemoteMigrateEnv) +} + // printBootstrapRemoteBehindGuidance explains a remote-migrate gate refusal in // bootstrap terms. The gate's generic remedy ("adopt the migrated database: // bd bootstrap") is wrong from inside a bootstrap-style clone — the database diff --git a/cmd/bd/bootstrap_guard_test.go b/cmd/bd/bootstrap_guard_test.go index f4f3e78ef..6a3df5560 100644 --- a/cmd/bd/bootstrap_guard_test.go +++ b/cmd/bd/bootstrap_guard_test.go @@ -3,8 +3,11 @@ package main import ( + "encoding/json" + "errors" "os" "path/filepath" + "strings" "testing" "time" @@ -92,46 +95,562 @@ func setupSyncRemoteConfig(t *testing.T, beadsDir, remote string) func() { return func() { config.ResetForTesting() } } -// TestDetectBootstrapAction_GitCodeRepoSyncRemoteBlocked verifies that a -// sync.remote pointing at a git code-repository host is rejected (action=none) -// instead of triggering DOLT_CLONE. -func TestDetectBootstrapAction_GitCodeRepoSyncRemoteBlocked(t *testing.T) { - for _, remote := range []string{ - "git+ssh://github.com/org/repo.git", - "https://github.com/org/repo.git", - "git@github.com:org/repo.git", - "https://gitlab.com/group/repo.git", - } { - t.Run(remote, func(t *testing.T) { - snapshotBootstrapEnv(t) +// stubProbeGitRemoteDoltData replaces the refs/dolt/data probe for the +// duration of a test. Every test that configures a forge sync.remote must +// install a stub: the real probe shells out to `git ls-remote` against +// whatever host the fixture URL names. +// +// A configured sync.remote also suppresses the git-origin auto-detect leg +// (gitOriginHasDoltDataRef, which is not behind this seam), so these tests +// cannot reach the network through that path either — including the +// fall-through cases, whose whole point is to keep going after the probe. +func stubProbeGitRemoteDoltData(t *testing.T, fn func(string) (bool, error)) { + t.Helper() + orig := probeGitRemoteDoltData + probeGitRemoteDoltData = fn + t.Cleanup(func() { probeGitRemoteDoltData = orig }) +} - tmpDir := t.TempDir() - beadsDir := filepath.Join(tmpDir, ".beads") - if err := os.MkdirAll(beadsDir, 0o750); err != nil { - t.Fatal(err) +// forgeSyncRemoteForms enumerates the shapes a git-forge sync.remote arrives +// in, with the git+ URL normalizeRemoteURL produces for each. Every one of +// them is a value bd itself writes (bd init from a git origin, bd dolt remote +// add, a hand-edited config.yaml, or finalizeSyncedBootstrap). +var forgeSyncRemoteForms = []struct { + name string + remote string + wantClone string +}{ + {"raw https with .git", "https://github.com/org/repo.git", "git+https://github.com/org/repo.git"}, + {"raw https without .git", "https://github.com/org/repo", "git+https://github.com/org/repo"}, + {"scp style", "git@github.com:org/repo.git", "git+ssh://git@github.com/org/repo.git"}, + {"ssh scheme", "ssh://git@github.com/org/repo.git", "git+ssh://git@github.com/org/repo.git"}, + {"already git+https", "git+https://github.com/org/repo.git", "git+https://github.com/org/repo.git"}, + {"git+ssh without user", "git+ssh://github.com/org/repo.git", "git+ssh://github.com/org/repo.git"}, + {"gitlab", "https://gitlab.com/group/repo.git", "git+https://gitlab.com/group/repo.git"}, +} + +// newForgeSyncRemoteWorkspace builds a workspace whose config.yaml carries +// remote as sync.remote and chdirs into it, returning the .beads path. +func newForgeSyncRemoteWorkspace(t *testing.T, remote string) string { + t.Helper() + snapshotBootstrapEnv(t) + + tmpDir := t.TempDir() + beadsDir := filepath.Join(tmpDir, ".beads") + if err := os.MkdirAll(beadsDir, 0o750); err != nil { + t.Fatal(err) + } + cleanup := setupSyncRemoteConfig(t, beadsDir, remote) + t.Cleanup(cleanup) + + oldWd, _ := os.Getwd() + t.Cleanup(func() { _ = os.Chdir(oldWd) }) + if err := os.Chdir(tmpDir); err != nil { + t.Fatal(err) + } + return beadsDir +} + +// TestDetectBootstrapAction_GitForgeSyncRemote_ProbeRouting covers the #5743 / +// #5663 fix: a git-forge sync.remote is a supported Dolt remote, so bootstrap +// probes refs/dolt/data and routes on the answer instead of rejecting the URL +// outright (which printed a success tick and exited 0 with no database). +func TestDetectBootstrapAction_GitForgeSyncRemote_ProbeRouting(t *testing.T) { + t.Run("data present clones the git+ form", func(t *testing.T) { + for _, tc := range forgeSyncRemoteForms { + t.Run(tc.name, func(t *testing.T) { + beadsDir := newForgeSyncRemoteWorkspace(t, tc.remote) + + var probed []string + stubProbeGitRemoteDoltData(t, func(url string) (bool, error) { + probed = append(probed, url) + return true, nil + }) + + plan := detectBootstrapAction(beadsDir, configfile.DefaultConfig()) + + if plan.Action != "sync" { + t.Fatalf("action=%q, want %q (remote carries refs/dolt/data)", plan.Action, "sync") + } + if plan.SyncRemote != tc.wantClone { + t.Errorf("SyncRemote=%q, want %q", plan.SyncRemote, tc.wantClone) + } + // The durable #4421 pin: once isGitCodeRepoURL recognizes a + // URL as a forge, no raw http(s) form of it may reach + // DOLT_CLONE, because Dolt routes those through the + // remotesapi client and retries forever at ~1000% CPU. The + // git+ prefix is what selects the git remote factory. + // + // Scope note: this pins the routing, not the classifier. A + // forge the classifier does not recognize (self-hosted Gitea + // at https://git.example.com/org/repo, no .git suffix) still + // takes the trusted-as-is path unprobed, exactly as it did + // before this change — a pre-existing gap tracked separately. + if !strings.HasPrefix(plan.SyncRemote, "git+") { + t.Errorf("SyncRemote=%q lacks the git+ prefix; a recognized forge URL must never reach DOLT_CLONE raw (#4421)", plan.SyncRemote) + } + if plan.Blocked { + t.Error("Blocked=true on a successful sync plan") + } + if len(probed) != 1 || probed[0] != tc.wantClone { + t.Errorf("probe calls = %v, want exactly [%q]", probed, tc.wantClone) + } + }) + } + }) + + t.Run("no data falls through to init and still wires the remote", func(t *testing.T) { + beadsDir := newForgeSyncRemoteWorkspace(t, "https://github.com/org/repo.git") + stubProbeGitRemoteDoltData(t, func(string) (bool, error) { return false, nil }) + + plan := detectBootstrapAction(beadsDir, configfile.DefaultConfig()) + + if plan.Action != "init" { + t.Fatalf("action=%q, want %q (remote wired before the first bd dolt push)", plan.Action, "init") + } + if plan.Blocked { + t.Error("Blocked=true; a clean 'no data yet' probe is not a failure") + } + // Carried so executeInitAction can register it as Dolt "origin". + // Without it the first `bd dolt push` has no remote and either + // refuses or adopts the git origin — a different repository under + // the dedicated-data-repo pattern. + if plan.SyncRemote != "git+https://github.com/org/repo.git" { + t.Errorf("SyncRemote=%q, want the routed URL so the fresh database gets wired to it", plan.SyncRemote) + } + }) + + t.Run("no data falls through to backup restore", func(t *testing.T) { + beadsDir := newForgeSyncRemoteWorkspace(t, "https://github.com/org/repo.git") + backupDir := filepath.Join(beadsDir, "backup") + if err := os.MkdirAll(backupDir, 0o750); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(backupDir, "issues.jsonl"), []byte(`{"id":"bd-1"}`+"\n"), 0o644); err != nil { + t.Fatal(err) + } + stubProbeGitRemoteDoltData(t, func(string) (bool, error) { return false, nil }) + + plan := detectBootstrapAction(beadsDir, configfile.DefaultConfig()) + + // Proves the fall-through runs the whole remaining detector chain, + // not just the fresh-init tail. + if plan.Action != "restore" { + t.Fatalf("action=%q, want %q (backup must still be found after the probe falls through)", plan.Action, "restore") + } + if plan.BackupDir != backupDir { + t.Errorf("BackupDir=%q, want %q", plan.BackupDir, backupDir) + } + }) + + // The error text is the shape the real probe now produces: git's own + // stderr, threaded out of exec.ExitError.Stderr by gitLsRemoteProbeError. + probeErr := errors.New("git ls-remote: exit status 128: fatal: Could not read from remote repository.") + + t.Run("probe error blocks and never clones", func(t *testing.T) { + const remote = "git+ssh://github.com/org/repo.git" + beadsDir := newForgeSyncRemoteWorkspace(t, remote) + stubProbeGitRemoteDoltData(t, func(string) (bool, error) { return false, probeErr }) + + plan := detectBootstrapAction(beadsDir, configfile.DefaultConfig()) + + if plan.Action != "none" { + t.Fatalf("action=%q, want %q (UNKNOWN must fail closed)", plan.Action, "none") + } + if !plan.Blocked { + t.Error("Blocked=false; an unverifiable remote must exit non-zero, not print a success tick") + } + if plan.SyncRemote != "" { + t.Errorf("SyncRemote=%q, want empty (an unverified URL must not be cloned from or pushed to)", plan.SyncRemote) + } + if plan.BlockedRemote != remote { + t.Errorf("BlockedRemote=%q, want %q (needed for the ls-remote hint)", plan.BlockedRemote, remote) + } + if !strings.Contains(plan.Reason, remote) { + t.Errorf("Reason=%q does not name the offending URL %q", plan.Reason, remote) + } + if !strings.Contains(plan.Reason, "Could not read from remote repository") { + t.Errorf("Reason=%q does not carry git's own diagnosis", plan.Reason) + } + }) + + t.Run("probe error still restores from a local backup", func(t *testing.T) { + // Offline laptop or credential-less CI: verifying the remote failed, + // but restoring a local backup touches no remote. The same machine + // with network and an empty remote would restore from this identical + // file, so a probe failure must not be the thing that denies it. + beadsDir := newForgeSyncRemoteWorkspace(t, "https://github.com/org/repo.git") + backupDir := filepath.Join(beadsDir, "backup") + if err := os.MkdirAll(backupDir, 0o750); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(backupDir, "issues.jsonl"), []byte(`{"id":"bd-1"}`+"\n"), 0o644); err != nil { + t.Fatal(err) + } + stubProbeGitRemoteDoltData(t, func(string) (bool, error) { return false, probeErr }) + + plan := detectBootstrapAction(beadsDir, configfile.DefaultConfig()) + + if plan.Action != "restore" { + t.Fatalf("action=%q reason=%q, want %q", plan.Action, plan.Reason, "restore") + } + if plan.Blocked { + t.Error("Blocked=true on a plan that recovers locally") + } + if plan.SyncRemote != "" { + t.Errorf("SyncRemote=%q, want empty: the remote is unverified, so nothing may be wired to it", plan.SyncRemote) + } + }) + + t.Run("probe error still imports git-tracked jsonl", func(t *testing.T) { + beadsDir := newForgeSyncRemoteWorkspace(t, "https://github.com/org/repo.git") + jsonl := filepath.Join(beadsDir, "issues.jsonl") + if err := os.WriteFile(jsonl, []byte(`{"id":"bd-1"}`+"\n"), 0o644); err != nil { + t.Fatal(err) + } + stubProbeGitRemoteDoltData(t, func(string) (bool, error) { return false, probeErr }) + + plan := detectBootstrapAction(beadsDir, configfile.DefaultConfig()) + + if plan.Action != "jsonl-import" { + t.Fatalf("action=%q reason=%q, want %q", plan.Action, plan.Reason, "jsonl-import") + } + if plan.Blocked { + t.Error("Blocked=true on a plan that recovers locally") + } + }) + + t.Run("credentials are stripped from the reason and the blocked URL", func(t *testing.T) { + const token = "ghp_SUPERSECRETTOKENVALUE" + beadsDir := newForgeSyncRemoteWorkspace(t, "https://x-access-token:"+token+"@github.com/org/repo.git") + stubProbeGitRemoteDoltData(t, func(string) (bool, error) { return false, probeErr }) + + plan := detectBootstrapAction(beadsDir, configfile.DefaultConfig()) + + if !plan.Blocked { + t.Fatalf("action=%q, want a blocked plan", plan.Action) + } + // Reason and blocked_remote both land in CI logs and agent + // transcripts; the clone funnel already scrubs userinfo before + // reporting and these diagnostics must not be the hole in that. + if strings.Contains(plan.Reason, token) { + t.Errorf("Reason leaks the token: %q", plan.Reason) + } + if strings.Contains(plan.BlockedRemote, token) { + t.Errorf("BlockedRemote leaks the token: %q", plan.BlockedRemote) + } + if !strings.Contains(plan.BlockedRemote, "github.com/org/repo.git") { + t.Errorf("BlockedRemote=%q lost the part the user needs", plan.BlockedRemote) + } + }) + + t.Run("routing is cwd independent in a monorepo subdir", func(t *testing.T) { + remote := "https://github.com/org/repo.git" + beadsDir := newForgeSyncRemoteWorkspace(t, remote) + + subDir := filepath.Join(filepath.Dir(beadsDir), "sub", "dir") + if err := os.MkdirAll(subDir, 0o750); err != nil { + t.Fatal(err) + } + if err := os.Chdir(subDir); err != nil { + t.Fatal(err) + } + + var probed []string + stubProbeGitRemoteDoltData(t, func(url string) (bool, error) { + probed = append(probed, url) + return true, nil + }) + + plan := detectBootstrapAction(beadsDir, configfile.DefaultConfig()) + + if plan.Action != "sync" { + t.Fatalf("action=%q, want %q from a subdirectory", plan.Action, "sync") + } + if len(probed) != 1 || probed[0] != "git+https://github.com/org/repo.git" { + t.Errorf("probe calls = %v, want exactly [%q]", probed, "git+https://github.com/org/repo.git") + } + }) +} + +// TestBootstrapPlanOutcome pins the exit status of every plan shape. +// Action=="none" used to be an unconditional success, which is how a rejected +// sync.remote exited 0 with no database (#5743). Blocked is the single +// discriminator; --dry-run is always a successful preview. +func TestBootstrapPlanOutcome(t *testing.T) { + tests := []struct { + name string + plan BootstrapPlan + dryRun bool + wantExit int // 0 means "nil error" + }{ + { + name: "existing database is a genuine no-op", + plan: BootstrapPlan{Action: "none", HasExisting: true, Reason: "Database already exists at /tmp/x"}, + wantExit: 0, + }, + { + name: "blocked plan fails", + plan: BootstrapPlan{Action: "none", Blocked: true, Reason: "could not verify refs/dolt/data"}, + wantExit: 1, + }, + { + name: "sync plan proceeds", + plan: BootstrapPlan{Action: "sync", SyncRemote: "git+https://github.com/org/repo.git"}, + wantExit: 0, + }, + { + name: "init plan proceeds", + plan: BootstrapPlan{Action: "init"}, + wantExit: 0, + }, + { + // bd doctor documents `bd bootstrap --dry-run` as the safe + // inspection step, so a preview must never abort a set -e script. + name: "dry run previews a blocked plan without failing", + plan: BootstrapPlan{Action: "none", Blocked: true, Reason: "could not verify refs/dolt/data"}, + dryRun: true, + wantExit: 0, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := bootstrapPlanOutcome(tt.plan, tt.dryRun) + if tt.wantExit == 0 { + if err != nil { + t.Fatalf("bootstrapPlanOutcome() = %v, want nil", err) + } + return } - cleanup := setupSyncRemoteConfig(t, beadsDir, remote) - defer cleanup() - - oldWd, _ := os.Getwd() - defer func() { _ = os.Chdir(oldWd) }() - if err := os.Chdir(tmpDir); err != nil { - t.Fatal(err) + code, ok := exitCodeFromError(err) + if !ok { + t.Fatalf("bootstrapPlanOutcome() = %v, want an *exitError", err) } - - cfg := configfile.DefaultConfig() - plan := detectBootstrapAction(beadsDir, cfg) - - if plan.Action != "none" { - t.Errorf("remote=%q: action=%q, want %q (git code-repo URL must be blocked)", remote, plan.Action, "none") - } - if plan.SyncRemote != "" { - t.Errorf("remote=%q: SyncRemote=%q, want empty (blocked URL must not propagate)", remote, plan.SyncRemote) + if code != tt.wantExit { + t.Errorf("exit code = %d, want %d", code, tt.wantExit) } }) } } +// TestDetectBootstrapAction_BlockedIsDerivedNotInherited covers the state-leak +// class the seeded plan used to create: existingBootstrapDBPlan's "none" +// verdict was copied into the working plan, so every later branch inherited +// its HasExisting/Blocked/Reason. A probe error on top of a seeded +// HasExisting=true produced action=none + blocked=true + has_existing=true, +// which printed the success tick and exited 0 — the #5743 bug, reintroduced. +func TestDetectBootstrapAction_BlockedIsDerivedNotInherited(t *testing.T) { + // newSeededServerWorkspace builds the synthesized-beadsDir shape: the + // .beads directory does not exist, so existingBootstrapDBPlan's verdict is + // held as a fallback rather than returned outright. + newSeededServerWorkspace := func(t *testing.T, remote string, check bootstrapServerDBCheck) (string, *configfile.Config) { + t.Helper() + snapshotBootstrapEnv(t) + + tmpDir := t.TempDir() + configDir := filepath.Join(tmpDir, "config-beads") + if err := os.MkdirAll(configDir, 0o750); err != nil { + t.Fatal(err) + } + cleanup := setupSyncRemoteConfig(t, configDir, remote) + t.Cleanup(cleanup) + + doltDataDir := filepath.Join(tmpDir, "dolt-data") + if err := os.MkdirAll(filepath.Join(doltDataDir, "mydb"), 0o750); err != nil { + t.Fatal(err) + } + t.Setenv("BEADS_DOLT_DATA_DIR", doltDataDir) + + oldWd, _ := os.Getwd() + t.Cleanup(func() { _ = os.Chdir(oldWd) }) + if err := os.Chdir(tmpDir); err != nil { + t.Fatal(err) + } + + origCheck := checkBootstrapServerDB + checkBootstrapServerDB = func(bootstrapServerProbeConfig) bootstrapServerDBCheck { return check } + t.Cleanup(func() { checkBootstrapServerDB = origCheck }) + + origDelay := bootstrapRetryDelay + bootstrapRetryDelay = func(time.Duration) {} + t.Cleanup(func() { bootstrapRetryDelay = origDelay }) + + cfg := configfile.DefaultConfig() + cfg.DoltMode = configfile.DoltModeServer + cfg.DoltDatabase = "mydb" + cfg.DoltDataDir = doltDataDir + // Never created: this is the "fresh clone, .beads synthesized" path. + return filepath.Join(tmpDir, ".beads"), cfg + } + + t.Run("existing server database wins over a failed probe", func(t *testing.T) { + beadsDir, cfg := newSeededServerWorkspace(t, "https://github.com/org/repo.git", + bootstrapServerDBCheck{Exists: true, Reachable: true}) + stubProbeGitRemoteDoltData(t, func(string) (bool, error) { + return false, errors.New("git ls-remote: exit status 128") + }) + + plan := detectBootstrapAction(beadsDir, cfg) + + if !plan.HasExisting { + t.Fatalf("HasExisting=false; the server database exists (action=%q reason=%q)", plan.Action, plan.Reason) + } + if plan.Blocked { + t.Error("Blocked=true alongside HasExisting=true — self-contradictory, and it would print the tick AND claim a block") + } + if err := bootstrapPlanOutcome(plan, false); err != nil { + t.Errorf("outcome = %v, want nil: a database exists", err) + } + }) + + t.Run("failed server verification does not taint a later sync plan", func(t *testing.T) { + beadsDir, cfg := newSeededServerWorkspace(t, "https://github.com/org/repo.git", + bootstrapServerDBCheck{Reachable: true, Err: errors.New("dial tcp: connection refused")}) + stubProbeGitRemoteDoltData(t, func(string) (bool, error) { return true, nil }) + + plan := detectBootstrapAction(beadsDir, cfg) + + if plan.Action != "sync" { + t.Fatalf("action=%q reason=%q, want %q", plan.Action, plan.Reason, "sync") + } + if plan.Blocked { + t.Error(`Blocked=true on a sync plan: "nothing may clone from a blocked plan" is the field's own contract`) + } + if plan.BlockedRemote != "" { + t.Errorf("BlockedRemote=%q on a sync plan", plan.BlockedRemote) + } + }) + + t.Run("unverifiable server database with no other source blocks", func(t *testing.T) { + beadsDir, cfg := newSeededServerWorkspace(t, "", + bootstrapServerDBCheck{Reachable: true, Err: errors.New("dial tcp: connection refused")}) + + plan := detectBootstrapAction(beadsDir, cfg) + + if plan.Action != "none" || !plan.Blocked { + t.Fatalf("action=%q blocked=%v, want none+blocked", plan.Action, plan.Blocked) + } + if err := bootstrapPlanOutcome(plan, false); err == nil { + t.Error("outcome = nil; an unverifiable database must not report success") + } + }) +} + +// TestPrintBootstrapPlan_NoneWithoutDB_NoSuccessTick pins the other half of +// the #5743 false success: the "✓ Database already exists" line must be +// reserved for plans that actually found a database. +func TestPrintBootstrapPlan_NoneWithoutDB_NoSuccessTick(t *testing.T) { + blocked := BootstrapPlan{ + Action: "none", + Blocked: true, + BeadsDir: "/workspace/.beads", + BlockedRemote: "git+ssh://github.com/org/repo.git", + Reason: `could not verify refs/dolt/data on sync.remote "git+ssh://github.com/org/repo.git": git ls-remote: exit status 128: fatal: Could not read from remote repository.`, + } + + t.Run("blocked plan prints nothing to stdout", func(t *testing.T) { + out := captureStdout(t, func() error { printBootstrapPlan(blocked); return nil }) + if strings.TrimSpace(out) != "" { + t.Fatalf("blocked plan wrote to stdout (the success tick lives there):\n%s", out) + } + }) + + t.Run("blocked plan reports the reason and actionable hints on stderr", func(t *testing.T) { + out := captureStderr(t, func() { printBootstrapPlan(blocked) }) + + if strings.Contains(out, "Database already exists") { + t.Fatalf("blocked plan printed a success tick:\n%s", out) + } + if !strings.Contains(out, blocked.Reason) { + t.Errorf("output does not carry the reason:\n%s", out) + } + // The hint must be runnable: git ls-remote does not understand the + // git+ prefix, so it is stripped exactly as the probe strips it. + if !strings.Contains(out, "git ls-remote ssh://github.com/org/repo.git refs/dolt/data") { + t.Errorf("output lacks a runnable ls-remote hint:\n%s", out) + } + // Deleting sync.remote is NOT offered as a remedy: the git-origin + // probe swallows its error, so on a credential failure that retry + // would "succeed" by creating a database diverged from the team's. + if strings.Contains(out, "remove 'sync.remote'") { + t.Errorf("hint still suggests deleting sync.remote, which can silently diverge:\n%s", out) + } + }) + + t.Run("existing database keeps the success tick", func(t *testing.T) { + plan := BootstrapPlan{ + Action: "none", + HasExisting: true, + BeadsDir: "/workspace/.beads", + Reason: "Database already exists at /workspace/.beads/embeddeddolt", + } + + out := captureStdout(t, func() error { printBootstrapPlan(plan); return nil }) + + if !strings.Contains(out, "✓ Database already exists: /workspace/.beads") { + t.Fatalf("existing database lost its success line:\n%s", out) + } + if !strings.Contains(out, "Nothing to do") { + t.Errorf("existing database lost its 'Nothing to do' line:\n%s", out) + } + }) + + t.Run("sync plan does not print credentials", func(t *testing.T) { + const token = "ghp_SUPERSECRETTOKENVALUE" + plan := BootstrapPlan{ + Action: "sync", + BeadsDir: "/workspace/.beads", + Database: "beads", + SyncRemote: "git+https://x-access-token:" + token + "@github.com/org/repo.git", + } + + out := captureStdout(t, func() error { printBootstrapPlan(plan); return nil }) + + if strings.Contains(out, token) { + t.Fatalf("plan output leaks the token:\n%s", out) + } + if !strings.Contains(out, "github.com/org/repo.git") { + t.Errorf("plan output lost the remote entirely:\n%s", out) + } + }) +} + +// TestBootstrapPlanJSON_RedactsCredentials closes the JSON half of the same +// credential leak: `bd bootstrap --json` serializes the plan, and BootstrapPlan. +// MarshalJSON must redact SyncRemote the way printBootstrapPlan redacts the human +// path. The existing "sync plan does not print credentials" subtest covers only +// printBootstrapPlan, so without this the JSON gap is invisible. It also pins the +// "redact on a copy" contract — the plan executeBootstrapPlan clones from must +// keep its real credentials. +func TestBootstrapPlanJSON_RedactsCredentials(t *testing.T) { + const token = "ghp_SUPERSECRETTOKENVALUE" + plan := BootstrapPlan{ + Action: "sync", + BeadsDir: "/workspace/.beads", + Database: "beads", + SyncRemote: "git+https://x-access-token:" + token + "@github.com/org/repo.git", + } + + encoded, err := json.Marshal(plan) + if err != nil { + t.Fatalf("json.Marshal(plan) failed: %v", err) + } + out := string(encoded) + + if strings.Contains(out, token) { + t.Fatalf("bootstrap plan JSON leaks the token:\n%s", out) + } + if !strings.Contains(out, "github.com/org/repo.git") { + t.Errorf("bootstrap plan JSON dropped the remote host/path entirely:\n%s", out) + } + // Redaction must not mutate the plan executeBootstrapPlan consumes for the + // clone, or the clone would lose the credentials it needs. + if !strings.Contains(plan.SyncRemote, token) { + t.Errorf("MarshalJSON mutated the source plan's SyncRemote: %q", plan.SyncRemote) + } +} + // TestDetectBootstrapAction_ValidDoltSyncRemoteUnchanged verifies that a valid // Dolt remote URL is still accepted as-is (no regression from Layer 1 guard). func TestDetectBootstrapAction_ValidDoltSyncRemoteUnchanged(t *testing.T) { @@ -141,21 +660,15 @@ func TestDetectBootstrapAction_ValidDoltSyncRemoteUnchanged(t *testing.T) { "git+ssh://my-self-hosted-dolt.example.com/org/db", } { t.Run(remote, func(t *testing.T) { - snapshotBootstrapEnv(t) + beadsDir := newForgeSyncRemoteWorkspace(t, remote) - tmpDir := t.TempDir() - beadsDir := filepath.Join(tmpDir, ".beads") - if err := os.MkdirAll(beadsDir, 0o750); err != nil { - t.Fatal(err) - } - cleanup := setupSyncRemoteConfig(t, beadsDir, remote) - defer cleanup() - - oldWd, _ := os.Getwd() - defer func() { _ = os.Chdir(oldWd) }() - if err := os.Chdir(tmpDir); err != nil { - t.Fatal(err) - } + // Non-forge remotes take the trusted-as-is path and must never + // pay for an ls-remote — a Dolt remotesapi endpoint has no + // refs/dolt/data to probe in the first place. + stubProbeGitRemoteDoltData(t, func(url string) (bool, error) { + t.Fatalf("probed non-forge remote %q; the trusted-as-is path must not probe", url) + return false, nil + }) cfg := configfile.DefaultConfig() plan := detectBootstrapAction(beadsDir, cfg) diff --git a/cmd/bd/bootstrap_registered_backend_test.go b/cmd/bd/bootstrap_registered_backend_test.go index 8bc80aa02..170606c0b 100644 --- a/cmd/bd/bootstrap_registered_backend_test.go +++ b/cmd/bd/bootstrap_registered_backend_test.go @@ -21,7 +21,7 @@ func TestRequireBootstrapDoltBackendRejectsRegisteredBackend(t *testing.T) { const name = "registry-bootstrap" registerContractBackend(t, name) - err := requireBootstrapDoltBackend(&configfile.Config{Backend: name}) + err := requireBootstrapDoltBackend(&configfile.Config{Backend: name}, t.TempDir()) if err == nil { t.Fatal("requireBootstrapDoltBackend accepted a registered backend; want fail-closed rejection") } @@ -40,7 +40,7 @@ func TestRequireBootstrapDoltBackendRejectsRegisteredBackend(t *testing.T) { {"empty backend", &configfile.Config{}}, {"explicit dolt", &configfile.Config{Backend: configfile.BackendDolt}}, } { - if err := requireBootstrapDoltBackend(tc.cfg); err != nil { + if err := requireBootstrapDoltBackend(tc.cfg, t.TempDir()); err != nil { t.Errorf("requireBootstrapDoltBackend rejected the %s config: %v", tc.label, err) } } diff --git a/cmd/bd/close.go b/cmd/bd/close.go index 99009aece..dee1ddc3e 100644 --- a/cmd/bd/close.go +++ b/cmd/bd/close.go @@ -49,7 +49,7 @@ the flags appear in the command line.`, SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) error { - CheckReadonly("close") // also covers CheckMigrationFreeze (dc-6jaq) + CheckReadonly("close") // also covers the migration freeze check (dc-6jaq) evt := metrics.NewCommandEvent("close") defer func() { diff --git a/cmd/bd/compact_dolt.go b/cmd/bd/compact_dolt.go index 91e5c2781..9fa340355 100644 --- a/cmd/bd/compact_dolt.go +++ b/cmd/bd/compact_dolt.go @@ -35,7 +35,13 @@ How it works: 4. Swaps main branch to the compacted version 5. Prunes remote-tracking refs (they would keep the old history alive; the next push or fetch re-creates them at the new tip) - 6. Runs Dolt GC to reclaim space + 6. Runs a full Dolt GC (all storage generations) to reclaim the old history + +The GC pass is a full collection: Dolt storage is generational, and a default +GC never revisits data an earlier GC moved to the old generation. On any store +that has been GC'd before (bd gc, or a previous flatten or compact), only a +full collection reclaims the squashed history. A full GC can take minutes on +multi-gigabyte stores. Examples: bd compact --dry-run # Preview: show commit breakdown @@ -187,11 +193,7 @@ Examples: } // Reclaim disk space from orphaned old history - if gc, ok := storage.UnwrapStore(store).(storage.GarbageCollector); ok { - if err := gc.DoltGC(ctx); err != nil { - WarnError("dolt gc after compact failed: %v", err) - } - } + gcMode := runPostRewriteGC(ctx, "compact") sizeAfter := storeSizeBytes(ctx) elapsed := time.Since(start) @@ -208,6 +210,9 @@ Examples: "tags_anchoring": tags, "elapsed_ms": elapsed.Milliseconds(), } + if gcMode != "" { + result["gc_mode"] = gcMode + } addGCSizeJSON(result, sizeBefore, sizeAfter) return outputJSON(result) } diff --git a/cmd/bd/compact_proxied_server.go b/cmd/bd/compact_proxied_server.go index 5c5765609..e143d31fb 100644 --- a/cmd/bd/compact_proxied_server.go +++ b/cmd/bd/compact_proxied_server.go @@ -143,7 +143,13 @@ func runCompactProxiedServer(ctx context.Context) error { if tags, perr = versioncontrolops.ListTags(ctx, conn); perr != nil { WarnError("listing tags before GC: %v", perr) } - if perr := versioncontrolops.DoltGC(ctx, conn); perr != nil { + // Full pass: the squash orphans a commit chain that any earlier GC + // already promoted to the old generation, which a default pass never + // revisits. + if !jsonOutput { + fmt.Println(" Running full Dolt GC (all generations; can take minutes on large stores)...") + } + if perr := versioncontrolops.DoltGCFull(ctx, conn); perr != nil { WarnError("dolt gc after compact failed: %v", perr) } return nil @@ -167,6 +173,7 @@ func runCompactProxiedServer(ctx context.Context) error { "recent_kept": recentCommits, "remote_refs_pruned": pruned, "tags_anchoring": tags, + "gc_mode": gcModeFull, "elapsed_ms": elapsed.Milliseconds(), }) } diff --git a/cmd/bd/conflicts_conclude_integration_test.go b/cmd/bd/conflicts_conclude_integration_test.go index a85964d20..a8e998ac4 100644 --- a/cmd/bd/conflicts_conclude_integration_test.go +++ b/cmd/bd/conflicts_conclude_integration_test.go @@ -138,13 +138,18 @@ func runConcludeCommand(t *testing.T, commandStore storage.DoltStorage, asJSON b defer func() { os.Stdout, os.Stderr = oldStdout, oldStderr }() store, rootCtx, jsonOutput = commandStore, context.Background(), asJSON conflictsConclude = true + // Deferred, like the stdio restore above it: RunE below can panic or + // t.Fatal, and a plain statement after the call would then leave jsonOutput + // set to asJSON — which callers pass as true — for the rest of the package. + defer func() { + store, rootCtx, jsonOutput = oldStore, oldRootCtx, oldJSON + conflictsConclude = oldConclude + }() commandErr := conflictsResolveCmd.RunE(conflictsResolveCmd, nil) _ = wOut.Close() _ = wErr.Close() - store, rootCtx, jsonOutput = oldStore, oldRootCtx, oldJSON - conflictsConclude = oldConclude var stdout, stderr bytes.Buffer _, _ = stdout.ReadFrom(rOut) diff --git a/cmd/bd/create.go b/cmd/bd/create.go index 09ad2db99..58a421ece 100644 --- a/cmd/bd/create.go +++ b/cmd/bd/create.go @@ -52,7 +52,7 @@ var createCmd = &cobra.Command{ SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) error { - CheckReadonly("create") // also covers CheckMigrationFreeze (dc-6jaq) + CheckReadonly("create") // also covers the migration freeze check (dc-6jaq) evt := metrics.NewCommandEvent("create") defer func() { @@ -197,33 +197,10 @@ var createCmd = &cobra.Command{ return HandleError("--ephemeral and --no-history are mutually exclusive") } storageClassFlag, _ := cmd.Flags().GetString("storage-class") - storageClass, err := resolveStorageClass(storageClassFlag, types.IssueType(issueType).Normalize()) + storageClass, wisp, err := resolveCreateStorageClass(storageClassFlag, types.IssueType(issueType), wisp, noHistory) if err != nil { return HandleError("%v", err) } - // --storage-class ephemeral is the spelled-out spelling of --ephemeral - // (Protocol v0.1 C1.4: the wisp plane is today's ephemeral-class - // implementation). It routes to the wisp path exactly like the flag; - // the --no-history mutual exclusion above still applies. - if storageClass == types.StorageClassEphemeral { - if noHistory { - return HandleError("--storage-class ephemeral and --no-history are mutually exclusive") - } - wisp = true - storageClass = "" // wisp-plane rows derive ephemeral class (C1.2); no marker cell needed - } - // Reconcile the requested durable class with the effective wisp plane - // (flag > config, Protocol v0.1 §C1.3): an explicit --storage-class - // contradicts --ephemeral/--no-history and is rejected, so the durable - // intent is preserved rather than silently collapsed into an - // effective-ephemeral record; a per-type config default yields to the - // explicit flag. versioned normalizes to the unset marker only after the - // check (C2.4). - var storageClassConflict bool - storageClass, storageClassConflict = reconcileStorageClassPlane(storageClass, storageClassFlag != "", wisp || noHistory) - if storageClassConflict { - return HandleError("--storage-class %s conflicts with --ephemeral/--no-history: wisp-plane records are storage class ephemeral", storageClass) - } molTypeStr, _ := cmd.Flags().GetString("mol-type") var molType types.MolType if molTypeStr != "" { @@ -759,6 +736,49 @@ func reconcileStorageClassPlane(class types.StorageClass, explicit, wispPlane bo return class.Normalize(), false } +// resolveCreateStorageClass is the ONE create-time storage-class decision every +// `bd create` CLI door makes: parse the flag (or fall back to the per-type +// storage-class. config default), route the ephemeral spelling to the wisp +// plane, and reject a durable class that contradicts the plane. Every door goes +// through it so the direct, proxied, and --file routes cannot answer differently; +// graphApplyNodeStorageClass is the per-node mirror, which additionally honors a +// node's own pointer overrides. +// +// flagValue is the raw --storage-class spelling ("" when unset). wisp/noHistory +// are the plane flags as the caller read them; the returned wisp is the plane +// AFTER the ephemeral spelling has been folded in (Protocol v0.1 C1.4). The +// returned class is already normalized (C2.4), so it can go straight onto the +// issue. +func resolveCreateStorageClass(flagValue string, issueType types.IssueType, wisp, noHistory bool) (types.StorageClass, bool, error) { + class, err := resolveStorageClass(flagValue, issueType.Normalize()) + if err != nil { + return "", wisp, err + } + // --storage-class ephemeral is the spelled-out spelling of --ephemeral + // (Protocol v0.1 C1.4: the wisp plane is today's ephemeral-class + // implementation). It routes to the wisp path exactly like the flag; the + // --ephemeral/--no-history mutual exclusion still applies. + if class == types.StorageClassEphemeral { + if noHistory { + return "", wisp, errors.New("--storage-class ephemeral and --no-history are mutually exclusive") + } + wisp = true + class = "" // wisp-plane rows derive ephemeral class (C1.2); no marker cell needed + } + // Reconcile the requested durable class with the effective wisp plane + // (flag > config, Protocol v0.1 §C1.3): an explicit --storage-class + // contradicts --ephemeral/--no-history and is rejected, so the durable + // intent is preserved rather than silently collapsed into an + // effective-ephemeral record; a per-type config default yields to the + // explicit flag. versioned normalizes to the unset marker only after the + // check (C2.4). + class, conflict := reconcileStorageClassPlane(class, flagValue != "", wisp || noHistory) + if conflict { + return "", wisp, fmt.Errorf("--storage-class %s conflicts with --ephemeral/--no-history: wisp-plane records are storage class ephemeral", class) + } + return class, wisp, nil +} + func buildCreateIssue(params createIssueParams) *types.Issue { var externalRefPtr *string if params.ExternalRef != "" { diff --git a/cmd/bd/create_input.go b/cmd/bd/create_input.go index 36279f721..aecf5c685 100644 --- a/cmd/bd/create_input.go +++ b/cmd/bd/create_input.go @@ -46,6 +46,8 @@ type createInput struct { validate bool ephemeral bool noHistory bool + storageClass types.StorageClass + storageClassFlag string molType types.MolType wispType types.WispType eventCategory string @@ -180,6 +182,21 @@ func gatherCreateInput(cmd *cobra.Command, args []string) (createInput, error) { in.priority = priority in.issueType, _ = cmd.Flags().GetString("type") + + // The raw flag rides along for the --file batch, which resolves the class + // per template (the per-type config default needs a type to key on, and only + // a template has one). --graph rejects the flag outright, so the only route + // that resolves it here is the single-issue create, on both transports. + in.storageClassFlag, _ = cmd.Flags().GetString("storage-class") + if in.markdownFile == "" && in.graphFile == "" { + class, wisp, err := resolveCreateStorageClass(in.storageClassFlag, types.IssueType(in.issueType), in.ephemeral, in.noHistory) + if err != nil { + return in, HandleError("%v", err) + } + in.storageClass = class + in.ephemeral = wisp + } + in.status, _ = cmd.Flags().GetString("status") in.assignee, _ = cmd.Flags().GetString("assignee") in.externalRef, _ = cmd.Flags().GetString("external-ref") @@ -334,6 +351,12 @@ func rejectSingleIssueFlagsForGraph(cmd *cobra.Command) error { if cmd.Flags().Changed("mol-type") { return HandleError("--mol-type is not valid with --graph (set mol_type per node in the plan instead)") } + // Same shape as --mol-type: a plan-wide class would duplicate the per-node + // storage_class field (plus its per-type config default) that graph-apply + // already honors, so the flag is refused rather than accepted and ignored. + if cmd.Flags().Changed("storage-class") { + return HandleError("--storage-class is not valid with --graph (set storage_class per node in the plan instead)") + } return nil } diff --git a/cmd/bd/create_proxied_server.go b/cmd/bd/create_proxied_server.go index d584f8a75..45329b6c6 100644 --- a/cmd/bd/create_proxied_server.go +++ b/cmd/bd/create_proxied_server.go @@ -30,7 +30,7 @@ func resolveProxiedCustomTypes(dbTypes []string) []string { func runCreateProxiedServer(cmd *cobra.Command, ctx context.Context, in createInput) error { if in.repoOverrideSet { - return HandleError("--repo is not supported with --proxied-server") + return HandleProxyCapabilityError(AssertProxyCapability(ProxyModeProxied, ProxyCapRepo)) } switch { case in.graphFile != "": @@ -226,6 +226,7 @@ func buildCreateIssueFromInput(in createInput) *types.Issue { EstimatedMinutes: in.estimatedMinutes, Ephemeral: in.ephemeral, NoHistory: in.noHistory, + StorageClass: in.storageClass, CreatedBy: in.createdBy, Owner: in.owner, MolType: in.molType, diff --git a/cmd/bd/create_timestamp_precision_embedded_test.go b/cmd/bd/create_timestamp_precision_embedded_test.go new file mode 100644 index 000000000..b53e40f49 --- /dev/null +++ b/cmd/bd/create_timestamp_precision_embedded_test.go @@ -0,0 +1,121 @@ +//go:build cgo + +package main + +import ( + "encoding/json" + "os" + "strings" + "testing" + "time" +) + +// TestEmbeddedCreateJSONEchoesSubSecondTimestamps pins that `bd create --json` +// prints the instant the row was written, fraction included. +// +// created_at is a DATETIME(0) column, so anything that renders a create by +// re-reading the row it just wrote prints whole seconds. `bd create --json` has +// never done that: it echoes the stamp the write carried, and agents that create +// several issues in a burst order them by exactly that fraction. A build that +// echoed the re-read made every same-second create tie. +// +// THE ASSERTION IS THAT A FRACTION IS THERE AT ALL, across two creates. A +// truncating build prints a whole second every time, so it fails on the first +// one; a correct build prints a whole second only when the clock lands exactly +// on a second boundary, which is a billion-to-one per create and so a billion +// billion-to-one across the pair. Note that "two creates tie" is NOT usable as +// the assertion here even though it is the property that matters: each create is +// a subprocess that boots embedded Dolt, so consecutive runs are seconds apart +// and would not tie even when truncated. The executor-level proof of the tie +// lives in conformance.RunLifecycleCreateEchoesSubSecondTimestamps. +func TestEmbeddedCreateJSONEchoesSubSecondTimestamps(t *testing.T) { + if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" { + t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt create tests") + } + t.Parallel() + + bd := buildEmbeddedBD(t) + dir, _, _ := bdInit(t, bd, "--prefix", "cts") + + first := createdAtEcho(t, bd, dir, "first issue") + second := createdAtEcho(t, bd, dir, "second issue") + + firstAt := parseRFC3339Nano(t, "first", first.createdAt) + parseRFC3339Nano(t, "second", second.createdAt) + + fractional := false + for _, echo := range []createEcho{first, second} { + for _, member := range []struct{ name, value string }{ + {"created_at", echo.createdAt}, + {"updated_at", echo.updatedAt}, + } { + at := parseRFC3339Nano(t, echo.id+" "+member.name, member.value) + if at.Nanosecond() != 0 { + fractional = true + } + } + } + if !fractional { + t.Errorf("no timestamp `bd create --json` echoed across two creates carries a sub-second part "+ + "(%s created_at=%q updated_at=%q, %s created_at=%q updated_at=%q); the echo is being rounded to the "+ + "DATETIME(0) column, which is what makes same-second creates unorderable", + first.id, first.createdAt, first.updatedAt, second.id, second.createdAt, second.updatedAt) + } + + // The echo still names the row it created. It is not the SAME text: the + // column is DATETIME(0) and the engine ROUNDS to it rather than truncating, + // so a read can land up to half a second either side of the echo. That skew + // is v1.2.2 behavior and stays — `bd show` and `bd list` answer whole + // seconds, as they always have. What must hold is that the two name one + // instant, which a second of slack states without pinning either the digits + // or the rounding mode. + shown := bdShow(t, bd, dir, first.id) + if skew := shown.CreatedAt.UTC().Sub(firstAt.UTC()); skew > time.Second || skew < -time.Second { + t.Errorf("%s: create echoed created_at %v but show reports %v (%v apart); the two must name the same instant, "+ + "give or take the second-granular column", + first.id, firstAt, shown.CreatedAt.UTC(), skew) + } +} + +type createEcho struct { + id string + createdAt string + updatedAt string +} + +// createdAtEcho runs `bd create --json` and reads the timestamps as the RAW +// wire strings, because the defect is about the text a consumer parses: a +// decode into time.Time would accept both spellings silently. +func createdAtEcho(t *testing.T, bd, dir, title string) createEcho { + t.Helper() + out, err := bdRunWithFlockRetry(t, bd, dir, "create", "--json", title) + if err != nil { + t.Fatalf("bd create --json %q: %v\n%s", title, err, out) + } + s := string(out) + start := strings.Index(s, "{") + if start < 0 { + t.Fatalf("no JSON object in `bd create --json` output:\n%s", s) + } + var raw struct { + ID string `json:"id"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + } + if err := json.NewDecoder(strings.NewReader(s[start:])).Decode(&raw); err != nil { + t.Fatalf("parse `bd create --json` output: %v\nraw: %s", err, s[start:]) + } + if raw.ID == "" { + t.Fatalf("`bd create --json` echoed no id:\n%s", s) + } + return createEcho{id: raw.ID, createdAt: raw.CreatedAt, updatedAt: raw.UpdatedAt} +} + +func parseRFC3339Nano(t *testing.T, label, value string) time.Time { + t.Helper() + parsed, err := time.Parse(time.RFC3339Nano, value) + if err != nil { + t.Fatalf("%s created_at %q does not parse as RFC3339Nano: %v", label, value, err) + } + return parsed +} diff --git a/cmd/bd/delete.go b/cmd/bd/delete.go index 61817b28d..deaf76c2a 100644 --- a/cmd/bd/delete.go +++ b/cmd/bd/delete.go @@ -364,6 +364,14 @@ func deleteBatch(_ *cobra.Command, issueIDs []string, force bool, dryRun bool, c commandDidWrite.Store(true) + // Tell this command's own auto-export that these ids are supposed to be + // gone. Without it the export's orphan guard sees them as JSONL-only + // records absent from the store, refuses to overwrite, and never saves + // state — which is the permanent wedge of GH#5896. Recorded for the + // requested ids; anything cascade removed alongside them is proven later + // by the store's own history instead. + commandDeletedIssueIDs.add(resolvedIDs...) + // NO COMMIT COMPENSATION HERE, for the reason the single-id path gives: // the role versions the deletion itself, on the store the rows were // deleted from, and defers it in batch and off modes. diff --git a/cmd/bd/doctor.go b/cmd/bd/doctor.go index 7654905b0..ec8d81ca4 100644 --- a/cmd/bd/doctor.go +++ b/cmd/bd/doctor.go @@ -212,6 +212,9 @@ Examples: if err != nil { return HandleError("failed to resolve path: %v", err) } + if err := checkDoctorMutationGate(absPath); err != nil { + return err + } if err := validateDoctorWorkspaceBackend(absPath); isLegacyUpgradeRefusal(err) { return printLegacyUpgradeDiagnostic(err) } else if err != nil { @@ -354,6 +357,57 @@ func init() { doctorCmd.Flags().BoolVar(&doctorAgent, "agent", false, "Agent-facing diagnostic mode: rich context for AI agents (ZFC-compliant)") } +// doctorMutationOp returns the operation label for a doctor invocation that +// will mutate the workspace, or "" when this run is diagnosis-only. --fix and +// --clean are the complete trigger set: every mutating doctor surface +// (applyFixes, applyFixesInteractive, applyValidateFixes, the pollution and +// artifacts cleaners) is reached only through one of those two flags. +func doctorMutationOp() string { + switch { + case doctorFix: + return "doctor --fix" + case doctorClean: + return "doctor --clean" + } + return "" +} + +// checkDoctorMutationGate is doctor's stand-in for the CheckReadonly call every +// other write command makes at the top of its RunE (#6028). Doctor never made +// that call, and its skipStoreAnnotation opt-out also skips the root +// PersistentPreRunE's freeze gate, so both `--readonly` and an active +// MIGRATION-FREEZE were bypassed structurally rather than deliberately. +// +// One call, once, at the flag-level flip point — not per fixer: there are 40+ +// fixers and any check sprinkled among them rots the moment one is added. It +// runs before every mode dispatch (including the embedded-mode gate), so a +// refused run never half-executes and never needs a store to refuse. +// +// There is deliberately no doctor-side override. A migration freeze is exactly +// when a shared store has mixed-version clients and `bd doctor --fix` is the +// mid-incident reflex command; the operator clears the freeze first. +func checkDoctorMutationGate(absPath string) error { + op := doctorMutationOp() + if op == "" { + return nil + } + if readonlyMode { + // Wording matches CheckReadonly (errors.go) exactly; doctor returns the + // error rather than calling that void helper so its deferred metrics + // CloseEventAndAdd still runs. + fmt.Fprintf(os.Stderr, "Error: operation '%s' is not allowed in read-only mode\n", op) + return &exitError{Code: 1} + } + // Doctor is the one write-capable command that takes a target path, so the + // freeze has to be looked up against that target as well as against the + // directory bd was launched in: `bd doctor /frozen/repo --fix` from an + // unfrozen cwd would otherwise walk the wrong tree entirely. ...ErrorFor + // covers both (FindFrom(absPath) alone would miss a freeze in the caller's + // own cwd), and doctorCmd already sets SilenceErrors/SilenceUsage + // statically, so the cobra-silencing gate variant buys nothing here. + return migrationFreezeErrorFor(op, absPath) +} + func shouldSkipDoctorNetworkChecks() bool { return jsonOutput || !ui.IsTerminal() } @@ -371,7 +425,7 @@ func validateDoctorWorkspaceBackend(path string) error { if err != nil { return fmt.Errorf("failed to load %s: %w; no storage database was opened or modified; fix or restore metadata.json and retry", configfile.ConfigPath(beadsDir), err) } - return validateConfiguredBackend(cfg) + return validateConfiguredBackend(cfg, beadsDir) } // printLegacyUpgradeDiagnostic preserves doctor as a store-free repair path: @@ -528,18 +582,32 @@ func runDiagnostics(path string) doctorResult { // Since doctor skips PersistentPreRun DB init (via skipStoreAnnotation), // trackBdVersion() and autoMigrateOnVersionBump() haven't run yet. // - // Scope version tracking to the doctor target. Without this, `bd doctor ` - // can accidentally touch the caller's current repo .beads state. - origBeadsDir, hadBeadsDir := os.LookupEnv("BEADS_DIR") - _ = os.Setenv("BEADS_DIR", beadsDir) - trackBdVersion() - if hadBeadsDir { - _ = os.Setenv("BEADS_DIR", origBeadsDir) - } else { - _ = os.Unsetenv("BEADS_DIR") - } + // #6028: skipping that hook also skipped its guards on these exact two + // calls — main.go runs them only when policy.runMaintenance is set and the + // workspace is not frozen for maintenance. Doctor replicates the calls, so + // it must replicate the guard, or plain `bd doctor` (no --fix needed) + // rewrites .beads/.local_version and silently applies a schema migration to + // a read-only or mid-freeze store: precisely the torn-upgrade write the + // freeze exists to prevent. Under either gate doctor now *reports* the + // version/migration mismatch in the checks below instead of healing it. + // + // The probe takes beadsDir for the same reason the mutation gate takes + // absPath: these writes land in the doctor target, so a freeze on that tree + // must stop them even when bd was launched somewhere unfrozen. + if !readonlyMode && !migrationFreezeActiveFor(beadsDir) { + // Scope version tracking to the doctor target. Without this, `bd doctor ` + // can accidentally touch the caller's current repo .beads state. + origBeadsDir, hadBeadsDir := os.LookupEnv("BEADS_DIR") + _ = os.Setenv("BEADS_DIR", beadsDir) + trackBdVersion() + if hadBeadsDir { + _ = os.Setenv("BEADS_DIR", origBeadsDir) + } else { + _ = os.Unsetenv("BEADS_DIR") + } - autoMigrateOnVersionBump(beadsDir) + autoMigrateOnVersionBump(beadsDir) + } // Check 1b: Dolt format compatibility (GH#2137) // Must run before opening the database — old noms formats cause server panics. diff --git a/cmd/bd/doctor/version.go b/cmd/bd/doctor/version.go index 109a593a7..567e31dc2 100644 --- a/cmd/bd/doctor/version.go +++ b/cmd/bd/doctor/version.go @@ -16,6 +16,17 @@ var latestGitHubReleaseFetcher = fetchLatestGitHubRelease // CheckCLIVersion checks if the CLI version is up to date. // Takes cliVersion parameter since it can't access the Version variable from main package. func CheckCLIVersion(cliVersion string) DoctorCheck { + // A Homebrew --HEAD build carries no orderable version — CompareVersions + // would read it as 0.0.0 and warn "update available" forever, and the + // suggested upgrade would actually move the user off HEAD. + if IsBrewHeadVersion(cliVersion) { + return DoctorCheck{ + Name: "CLI Version", + Status: StatusOK, + Message: fmt.Sprintf("%s (Homebrew --HEAD build; release comparison skipped)", cliVersion), + } + } + latestVersion, err := latestGitHubReleaseFetcher() if err != nil { // Network error or API issue - don't fail, just warn @@ -151,6 +162,20 @@ func CheckMetadataVersionTracking(path string, currentVersion string) DoctorChec } } + trackingActive := DoctorCheck{ + Name: "Version Tracking", + Status: StatusOK, + Message: fmt.Sprintf("Version tracking active (last: %s, current: %s)", lastVersion, currentVersion), + } + + // A Homebrew --HEAD stamp carries no ordering, so the staleness heuristic + // below cannot apply — but it is a healthy marker, not a malformed one. + // Warning about it would be permanent: the offered fix rewrites the same + // stamp back. + if IsBrewHeadVersion(lastVersion) { + return trackingActive + } + // Validate that version is a valid semver-like string if !IsValidSemver(lastVersion) { return DoctorCheck{ @@ -171,11 +196,7 @@ func CheckMetadataVersionTracking(path string, currentVersion string) DoctorChec // Guard against short version strings (e.g., "5" → [5] has no [1]) if len(currentParts) < 2 || len(lastParts) < 2 { - return DoctorCheck{ - Name: "Version Tracking", - Status: StatusOK, - Message: fmt.Sprintf("Version tracking active (last: %s, current: %s)", lastVersion, currentVersion), - } + return trackingActive } // Simple heuristic: warn if minor version is 10+ behind or major version differs by 1+ @@ -193,11 +214,7 @@ func CheckMetadataVersionTracking(path string, currentVersion string) DoctorChec } // Version is behind but not too old - this is normal after upgrade - return DoctorCheck{ - Name: "Version Tracking", - Status: StatusOK, - Message: fmt.Sprintf("Version tracking active (last: %s, current: %s)", lastVersion, currentVersion), - } + return trackingActive } // Version is current or ahead @@ -289,6 +306,49 @@ func CompareVersions(v1, v2 string) int { return 0 } +// IsBrewHeadVersion recognizes the version Homebrew stamps into --HEAD +// installs of the core beads formula: HEAD-, a bare HEAD when the +// head spec resolves no commit, and either shape carrying Homebrew's +// _ suffix. Such a stamp is a healthy current-era version marker, +// not a malformed one — the binary rewrites it identically on every run, so +// nothing the user does can "fix" it into semver. +// +// This is the canonical definition; every consumer of a version stamp that +// needs to tell a --HEAD build apart from a release delegates here so the +// ends cannot drift. +func IsBrewHeadVersion(version string) bool { + rest, ok := strings.CutPrefix(version, "HEAD") + if !ok { + return false + } + // Homebrew's pkg_version appends _ once the formula carries a + // revision, so a revision bump must not read as malformed. The revision is + // an unsigned decimal; a digits-only check keeps Atoi's tolerance of + // signed forms ("+1", "-0") from admitting shapes brew never emits. + if cut := strings.IndexByte(rest, '_'); cut >= 0 { + revision := rest[cut+1:] + if revision == "" || strings.Trim(revision, "0123456789") != "" { + return false + } + rest = rest[:cut] + } + // Homebrew leaves the version as a bare "HEAD" whenever the head spec + // cannot resolve a commit. + if rest == "" { + return true + } + sha, ok := strings.CutPrefix(rest, "-") + if !ok { + return false + } + // Bound the tail to a plausible git abbreviation so that arbitrary hex + // cannot stand in for a commit; git never abbreviates below 7 characters. + if len(sha) < 7 || len(sha) > 40 { + return false + } + return strings.Trim(sha, "0123456789abcdefABCDEF") == "" +} + // IsValidSemver checks if a version string is valid semver-like format (X.Y.Z) func IsValidSemver(version string) bool { if version == "" { diff --git a/cmd/bd/doctor/version_test.go b/cmd/bd/doctor/version_test.go index 81aba4e82..8c1a391b4 100644 --- a/cmd/bd/doctor/version_test.go +++ b/cmd/bd/doctor/version_test.go @@ -69,6 +69,41 @@ func TestIsValidSemver(t *testing.T) { } } +func TestIsBrewHeadVersion(t *testing.T) { + tests := []struct { + name string + version string + want bool + }{ + {name: "short sha", version: "HEAD-f925f3f", want: true}, + {name: "full sha", version: "HEAD-" + strings.Repeat("a", 40), want: true}, + {name: "uppercase sha", version: "HEAD-F925F3F", want: true}, + {name: "bare HEAD", version: "HEAD", want: true}, + {name: "revision suffix", version: "HEAD-f925f3f_1", want: true}, + {name: "bare HEAD with revision suffix", version: "HEAD_2", want: true}, + {name: "empty sha", version: "HEAD-"}, + {name: "non-hex sha", version: "HEAD-zzzzzzz"}, + {name: "sha below git abbreviation floor", version: "HEAD-abc"}, + {name: "sha beyond object id length", version: "HEAD-" + strings.Repeat("a", 41)}, + {name: "dirty suffix", version: "HEAD-f925f3f-dirty"}, + {name: "non-numeric revision", version: "HEAD-f925f3f_x"}, + {name: "signed revision", version: "HEAD-f925f3f_+1"}, + {name: "negative zero revision", version: "HEAD_-0"}, + {name: "empty revision", version: "HEAD-f925f3f_"}, + {name: "unrelated prefix", version: "HEADLESS-f925f3f"}, + {name: "semver", version: "1.1.2"}, + {name: "empty", version: ""}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsBrewHeadVersion(tt.version); got != tt.want { + t.Fatalf("IsBrewHeadVersion(%q) = %v, want %v", tt.version, got, tt.want) + } + }) + } +} + func TestUpgradeCommandForPath(t *testing.T) { tests := []struct { name string @@ -119,6 +154,39 @@ func TestCheckCLIVersionUsesFetcher(t *testing.T) { } } +// TestCheckCLIVersionBrewHeadBuild verifies that a --HEAD build is not told to +// run `brew upgrade beads`. CompareVersions reads the stamp as 0.0.0, so every +// release looks newer forever, and taking the advice would move the user off +// HEAD entirely. +func TestCheckCLIVersionBrewHeadBuild(t *testing.T) { + orig := latestGitHubReleaseFetcher + fetched := false + latestGitHubReleaseFetcher = func() (string, error) { + fetched = true + return "1.3.0", nil + } + t.Cleanup(func() { latestGitHubReleaseFetcher = orig }) + + for _, stamp := range []string{"HEAD-f925f3f", "HEAD", "HEAD-f925f3f_1"} { + t.Run(stamp, func(t *testing.T) { + check := CheckCLIVersion(stamp) + if check.Status != StatusOK { + t.Fatalf("Status = %q, want %q (message: %q)", check.Status, StatusOK, check.Message) + } + if check.Fix != "" { + t.Fatalf("Fix = %q, want no upgrade advice for a --HEAD build", check.Fix) + } + if !strings.Contains(check.Message, stamp) { + t.Fatalf("Message = %q, want it to name the stamp", check.Message) + } + }) + } + + if fetched { + t.Error("CheckCLIVersion fetched the latest release for a --HEAD build; there is nothing to compare against") + } +} + func TestParseVersionParts(t *testing.T) { tests := []struct { name string @@ -191,6 +259,34 @@ func TestCheckMetadataVersionTracking_EmptyFile(t *testing.T) { } } +// TestCheckMetadataVersionTracking_BrewHeadStamp verifies that the version +// stamp a Homebrew --HEAD install writes is reported as healthy rather than +// permanently warning as an invalid format the user cannot fix: the offered +// fix, running any bd command, writes the same stamp straight back. +func TestCheckMetadataVersionTracking_BrewHeadStamp(t *testing.T) { + for _, stamp := range []string{"HEAD-f925f3f", "HEAD", "HEAD-f925f3f_1"} { + t.Run(stamp, func(t *testing.T) { + tmpDir := t.TempDir() + beadsDir := filepath.Join(tmpDir, ".beads") + if err := os.MkdirAll(beadsDir, 0755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(beadsDir, ".local_version"), []byte(stamp+"\n"), 0644); err != nil { + t.Fatal(err) + } + + check := CheckMetadataVersionTracking(tmpDir, "HEAD-aaaaaaa") + + if check.Status != StatusOK { + t.Errorf("Status = %q, want %q (message: %q)", check.Status, StatusOK, check.Message) + } + if check.Fix != "" { + t.Errorf("Fix = %q, want no fix advice for a --HEAD stamp", check.Fix) + } + }) + } +} + // TestCheckMetadataVersionTracking_InvalidVersion verifies handling of // malformed version strings in .local_version. func TestCheckMetadataVersionTracking_InvalidVersion(t *testing.T) { diff --git a/cmd/bd/doctor_gastown_guard.go b/cmd/bd/doctor_gastown_guard.go deleted file mode 100644 index 5b70b0336..000000000 --- a/cmd/bd/doctor_gastown_guard.go +++ /dev/null @@ -1,73 +0,0 @@ -package main - -import ( - "os" - "path/filepath" -) - -// isOrchestratorRoot returns true when path looks like a multi-project -// orchestrator workspace root (not a single-project beads repo). -// -// Detection: presence of both: -// 1. .beads/routes.jsonl (cross-project routing config) -// 2. mayor/town.json (orchestrator configuration) -// -// This prevents bd doctor --fix from running at the workspace root, -// where repairs should go through the orchestrator's own doctor command. -func isOrchestratorRoot(path string) bool { - if path == "" { - return false - } - - routes := filepath.Join(path, ".beads", "routes.jsonl") - townJSON := filepath.Join(path, "mayor", "town.json") - - if _, err := os.Stat(routes); err != nil { - return false - } - if _, err := os.Stat(townJSON); err != nil { - return false - } - - return true -} - -// findTownRoot walks up from the current working directory looking for -// mayor/town.json — the same primary marker gt's own workspace package uses -// (see gastownhall/gastown internal/cmd/handoff.go's detectTownRootFromCwd). -// Falls back to GT_TOWN_ROOT then GT_ROOT (gt's env-var fallback chain, -// already how the rest of this codebase detects an orchestrator — see -// formula.go, molecules.go, doltserver.go) when cwd detection fails, e.g. a -// detached worktree or a cwd outside the town tree entirely. -// -// Used by CheckMigrationFreeze (dc-6jaq) to find the MIGRATION-FREEZE -// sentinel; unlike isOrchestratorRoot above this only needs the mayor/ -// marker, not also .beads/routes.jsonl, since a rig-level bd invocation's -// cwd is never itself the orchestrator root. -func findTownRoot() string { - if cwd, err := os.Getwd(); err == nil { - path := cwd - for { - if _, statErr := os.Stat(filepath.Join(path, "mayor", "town.json")); statErr == nil { - return path - } - parent := filepath.Dir(path) - if parent == path { - break - } - path = parent - } - } - - for _, envName := range []string{"GT_TOWN_ROOT", "GT_ROOT"} { - envRoot := os.Getenv(envName) - if envRoot == "" { - continue - } - if _, err := os.Stat(filepath.Join(envRoot, "mayor", "town.json")); err == nil { - return envRoot - } - } - - return "" -} diff --git a/cmd/bd/doctor_mutation_gate_test.go b/cmd/bd/doctor_mutation_gate_test.go new file mode 100644 index 000000000..44d463c14 --- /dev/null +++ b/cmd/bd/doctor_mutation_gate_test.go @@ -0,0 +1,226 @@ +// Tests for doctor's mutation gate (#6028): `bd doctor --fix` / `--clean` must +// refuse to run under strict --readonly, exactly like the ~120 write commands +// that call CheckReadonly at the top of their RunE. Doctor never made that call +// — it opts out of the root PersistentPreRunE store init via +// skipStoreAnnotation, which also opted it out of that hook's gates — so both +// --readonly and an active MIGRATION-FREEZE were bypassed structurally. +// +// The freeze half of the same gate lives in migration_freeze_gate_test.go, +// beside the rest of the freeze suite; both halves share the helpers below and +// the hermetic subprocess harness declared there. +// +// This file MUST NOT carry a cgo build tag: it drives a bd binary built with +// the gms_pure_go tag via subprocess, and asserts only on files and output. + +package main + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +// doctorMutationSurface is one class of doctor invocation that mutates the +// workspace. Section 2 of the #6028 design enumerates the complete set: every +// mutating path is reached through --fix or --clean and nothing else, so these +// five rows cover the whole write surface, including fixers added later. +type doctorMutationSurface struct { + name string + args []string + // op is the operation label the gate reports, derived from which flag made + // the run mutating (--fix wins when both are set). + op string +} + +func doctorMutationSurfaces() []doctorMutationSurface { + return []doctorMutationSurface{ + {name: "fix", args: []string{"doctor", "--fix", "--yes"}, op: "doctor --fix"}, + {name: "fix-interactive", args: []string{"doctor", "--fix", "-i"}, op: "doctor --fix"}, + {name: "validate-fix", args: []string{"doctor", "--check=validate", "--fix", "--yes"}, op: "doctor --fix"}, + {name: "pollution-clean", args: []string{"doctor", "--check=pollution", "--clean", "--yes"}, op: "doctor --clean"}, + {name: "artifacts-clean", args: []string{"doctor", "--check=artifacts", "--clean", "--yes"}, op: "doctor --clean"}, + } +} + +// doctorWorkspaceFingerprint captures the two workspace files a refused doctor +// run is most likely to have touched: .local_version (trackBdVersion's target) +// and metadata.json (the Metadata Config / Database fixers' target). +func doctorWorkspaceFingerprint(t *testing.T, dir string) map[string][]byte { + t.Helper() + fingerprint := make(map[string][]byte) + for _, name := range []string{localVersionFile, "metadata.json"} { + path := filepath.Join(dir, ".beads", name) + data, err := os.ReadFile(path) + if err != nil { + if !os.IsNotExist(err) { + t.Fatalf("fingerprinting %s: %v", path, err) + } + continue + } + fingerprint[name] = data + } + return fingerprint +} + +// assertDoctorWorkspaceUnchanged proves the refusal happened before any +// mutation, not merely that the refusal message was printed. +func assertDoctorWorkspaceUnchanged(t *testing.T, dir string, before map[string][]byte) { + t.Helper() + after := doctorWorkspaceFingerprint(t, dir) + if len(after) != len(before) { + t.Errorf("workspace file set changed across a refused doctor run: had %d tracked files, now %d", len(before), len(after)) + } + for name, want := range before { + got, ok := after[name] + if !ok { + t.Errorf(".beads/%s was deleted by a refused doctor run", name) + continue + } + if string(got) != string(want) { + t.Errorf(".beads/%s was rewritten by a refused doctor run:\nbefore:\n%s\nafter:\n%s", name, want, got) + } + } +} + +// assertDoctorRefusalIsClean checks the shared shape of every gate refusal: +// nothing on stdout, and none of the output a fix or clean run would produce. +func assertDoctorRefusalIsClean(t *testing.T, stdout string) { + t.Helper() + if strings.TrimSpace(stdout) != "" { + t.Errorf("stdout should be empty when doctor is refused, got:\n%s", stdout) + } + for _, marker := range []string{"Applying fixes", "Deleting", "Verifying fixes"} { + if strings.Contains(stdout, marker) { + t.Errorf("refused doctor run produced %q on stdout — it started mutating before refusing:\n%s", marker, stdout) + } + } +} + +// TestDoctorMutationBlockedInReadonlyMode is the readonly half of the gate. +// One workspace serves every row: a refused run must leave it untouched, so a +// row that leaks a mutation is caught by the next row's fingerprint too. +func TestDoctorMutationBlockedInReadonlyMode(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + before := doctorWorkspaceFingerprint(t, dir) + + for _, tt := range doctorMutationSurfaces() { + t.Run(tt.name, func(t *testing.T) { + args := append(append([]string{}, tt.args...), "--readonly") + stdout, stderr, code := runBDMigrationFreeze(t, bd, dir, args...) + + if code != 1 { + t.Fatalf("exit code = %d, want 1\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) + } + want := "operation '" + tt.op + "' is not allowed in read-only mode" + if !strings.Contains(stderr, want) { + t.Errorf("stderr missing %q:\n%s", want, stderr) + } + assertDoctorRefusalIsClean(t, stdout) + assertDoctorWorkspaceUnchanged(t, dir, before) + }) + } +} + +// TestDoctorDiagnosisWorksInReadonlyMode pins the other half of the contract: +// the gate keys on --fix/--clean alone, so every diagnosis mode still runs +// under --readonly. Diagnosing a sandboxed workspace is the whole point. +func TestDoctorDiagnosisWorksInReadonlyMode(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + + for _, args := range [][]string{ + {"doctor"}, + {"doctor", "--dry-run"}, + {"doctor", "--check=pollution"}, + {"doctor", "--check=artifacts"}, + } { + t.Run(strings.Join(args, "_"), func(t *testing.T) { + stdout, stderr, _ := runBDMigrationFreeze(t, bd, dir, append(args, "--readonly")...) + if strings.Contains(stderr, "not allowed in read-only mode") { + t.Errorf("bd %v was refused under --readonly but mutates nothing:\nstderr:\n%s\nstdout:\n%s", args, stderr, stdout) + } + }) + } +} + +// TestDoctorMaintenanceSkippedInReadonlyMode is the readonly twin of +// TestDoctorMaintenanceSkippedDuringMigrationFreeze — see that test for why +// plain `bd doctor` had hidden writes at all, and for the shared-server setup. +func TestDoctorMaintenanceSkippedInReadonlyMode(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + seedStaleLocalVersion(t, dir) + + stdout, stderr, _ := runBDMigrationFreezeWithEnv(t, bd, dir, doctorMaintenanceEnv(), "doctor", "--readonly") + + assertDoctorReportedStaleVersionWithoutHealing(t, dir, stdout, stderr) + if strings.Contains(stderr, "not allowed in read-only mode") { + t.Errorf("plain 'bd doctor --readonly' must diagnose, not refuse:\nstderr:\n%s", stderr) + } +} + +// TestDoctorMutationNotBlockedWithoutGates is the regression-safety control: +// with no freeze sentinel and no --readonly, the gate must be invisible. The +// fix outcome itself is not this test's business — only that neither refusal +// fires and neither exit path is the gate's. +func TestDoctorMutationNotBlockedWithoutGates(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + + for _, tt := range doctorMutationSurfaces() { + t.Run(tt.name, func(t *testing.T) { + stdout, stderr, code := runBDMigrationFreeze(t, bd, dir, tt.args...) + if code == ExitMigrationFrozen || strings.Contains(stderr, "frozen for migration") { + t.Errorf("bd %v hit the freeze gate with no marker present (exit %d):\nstderr:\n%s", tt.args, code, stderr) + } + if strings.Contains(stderr, "not allowed in read-only mode") { + t.Errorf("bd %v hit the readonly gate without --readonly (exit %d):\nstderr:\n%s", tt.args, code, stderr) + } + _ = stdout + }) + } +} + +// TestDoctorMaintenanceStillRunsWithoutGates is the companion control for the +// diagnosis-path change: unfrozen and not read-only, plain `bd doctor` must +// still reconcile a stale .local_version exactly as it did before #6028. +func TestDoctorMaintenanceStillRunsWithoutGates(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + seedStaleLocalVersion(t, dir) + + stdout, stderr, _ := runBDMigrationFreezeWithEnv(t, bd, dir, doctorMaintenanceEnv(), "doctor") + + if !strings.Contains(stderr, "auto-migrate:") { + t.Errorf("expected autoMigrateOnVersionBump to run (an 'auto-migrate:' debug line) with no gate active, got none:\nstderr:\n%s", stderr) + } + got := readWorkspaceLocalVersion(t, dir) + if got == staleLocalVersion { + t.Errorf("%s = %q — trackBdVersion did not run with no gate active; the #6028 skip is too broad:\nstdout:\n%s", + localVersionFile, got, stdout) + } +} + +// TestDoctorReadonlyWinsOverMigrationFreeze pins the branch order inside the +// gate: --readonly is checked first, so a workspace that is both frozen and +// sandboxed reports the readonly refusal. This mirrors CheckReadonly, which +// also answers readonly before delegating to the freeze check. Either refusal +// stops the run, but they carry different exit codes — 1 vs ExitMigrationFrozen +// — so which one wins is observable, and the precedence has to be deliberate. +func TestDoctorReadonlyWinsOverMigrationFreeze(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") + before := doctorWorkspaceFingerprint(t, dir) + + stdout, stderr, code := runBDFrozen(t, bd, dir, "doctor", "--fix", "--yes", "--readonly") + + if code != 1 { + t.Fatalf("exit code = %d, want 1 (not %d — readonly is answered before the freeze)\nstdout:\n%s\nstderr:\n%s", + code, ExitMigrationFrozen, stdout, stderr) + } + if !strings.Contains(stderr, "operation 'doctor --fix' is not allowed in read-only mode") { + t.Errorf("stderr missing the readonly refusal (readonly must be checked before the freeze):\n%s", stderr) + } + if strings.Contains(stderr, "frozen for migration") { + t.Errorf("stderr carries the freeze refusal too; the gate should report exactly one reason:\n%s", stderr) + } + assertDoctorRefusalIsClean(t, stdout) + assertDoctorWorkspaceUnchanged(t, dir, before) +} diff --git a/cmd/bd/doctor_orchestrator_guard.go b/cmd/bd/doctor_orchestrator_guard.go new file mode 100644 index 000000000..fffb4dc4b --- /dev/null +++ b/cmd/bd/doctor_orchestrator_guard.go @@ -0,0 +1,33 @@ +package main + +import ( + "os" + "path/filepath" +) + +// isOrchestratorRoot returns true when path looks like a multi-project +// orchestrator workspace root (not a single-project beads repo). +// +// Detection: presence of both: +// 1. .beads/routes.jsonl (cross-project routing config) +// 2. mayor/town.json (orchestrator configuration) +// +// This prevents bd doctor --fix from running at the workspace root, +// where repairs should go through the orchestrator's own doctor command. +func isOrchestratorRoot(path string) bool { + if path == "" { + return false + } + + routes := filepath.Join(path, ".beads", "routes.jsonl") + townJSON := filepath.Join(path, "mayor", "town.json") + + if _, err := os.Stat(routes); err != nil { + return false + } + if _, err := os.Stat(townJSON); err != nil { + return false + } + + return true +} diff --git a/cmd/bd/doctor_gastown_guard_test.go b/cmd/bd/doctor_orchestrator_guard_test.go similarity index 100% rename from cmd/bd/doctor_gastown_guard_test.go rename to cmd/bd/doctor_orchestrator_guard_test.go diff --git a/cmd/bd/dolt.go b/cmd/bd/dolt.go index af3366959..174748254 100644 --- a/cmd/bd/dolt.go +++ b/cmd/bd/dolt.go @@ -1080,7 +1080,7 @@ endpoint via SQL and reports reachability, server version, and database.`, if cfg == nil { cfg = configfile.DefaultConfig() } - if err := validateConfiguredBackend(cfg); err != nil { + if err := validateConfiguredBackend(cfg, beadsDir); err != nil { return HandleError("%v", err) } // A non-Dolt backend (SQLite or a removed-backend tombstone) has no Dolt engine; @@ -1920,7 +1920,7 @@ func showDoltConfig(testConnection bool) error { if cfg == nil { cfg = configfile.DefaultConfig() } - if err := validateConfiguredBackend(cfg); err != nil { + if err := validateConfiguredBackend(cfg, beadsDir); err != nil { return HandleError("%v", err) } diff --git a/cmd/bd/errors.go b/cmd/bd/errors.go index 0cab94bb5..80ff1b5b3 100644 --- a/cmd/bd/errors.go +++ b/cmd/bd/errors.go @@ -6,8 +6,12 @@ import ( "fmt" "os" + "github.com/spf13/cobra" + + "github.com/steveyegge/beads/internal/beads" "github.com/steveyegge/beads/internal/metrics" "github.com/steveyegge/beads/internal/migration" + "github.com/steveyegge/beads/internal/ui" ) type exitError struct { @@ -72,6 +76,36 @@ func buildJSONError(message, hint string) interface{} { return inner } +func buildJSONCapabilityError(e *ProxyCapabilityError) interface{} { + inner := map[string]interface{}{"error": e.Message, "code": e.Code, "mutates": e.Mutates} + if jsonEnvelopeEnabled() { + return map[string]interface{}{"schema_version": JSONSchemaVersion, "data": inner} + } + inner["schema_version"] = JSONSchemaVersion + return inner +} + +// HandleProxyCapabilityError renders a stable capability refusal while +// preserving the normal text/JSON front-door conventions. +func HandleProxyCapabilityError(err error) error { + var capErr *ProxyCapabilityError + if !errors.As(err, &capErr) { + return HandleErrorRespectJSON("%v", err) + } + code := capErr.ExitCode + if code == 0 { + code = 1 + } + if jsonOutput { + enc := json.NewEncoder(os.Stdout) + enc.SetIndent("", " ") + _ = enc.Encode(buildJSONCapabilityError(capErr)) + } else { + fmt.Fprintf(os.Stderr, "Error: %s\n", capErr.Message) + } + return &exitError{Code: code} +} + func jsonStderrError(message, hint string) { encoder := json.NewEncoder(os.Stderr) encoder.SetIndent("", " ") @@ -125,44 +159,75 @@ func WarnError(format string, args ...interface{}) { fmt.Fprintf(os.Stderr, "Warning: "+format+"\n", args...) } +// ExitMigrationFrozen is the exit code for a write refused because a +// migration freeze marker is active (dc-6jaq). Stable value so scripts can +// branch on "someone is migrating this workspace, come back later" without +// grep'ing stderr, instead of reading it as a generic failure (1) worth +// retrying immediately. +const ExitMigrationFrozen = 14 + // CheckReadonly aborts the command when bd is running in read-only mode (the -// worker-sandbox posture, see readonlyMode), or when a MIGRATION-FREEZE -// sentinel is active at the town root (dc-6jaq, folded in here rather than -// requiring every write command to remember a second call — see -// CheckMigrationFreeze below). This is the chokepoint essentially every -// write command already calls first, so folding the freeze check in here -// covers the whole write surface at once, including commands added after -// this comment is written — not just a hand-picked list that rots (one -// concrete instance the hand-picked list missed: "bd q", cmd/bd/quick.go, -// the create alias). It exits via os.Exit and so cannot run the per-command -// deferred CloseEventAndAdd — a command blocked here records no -// cli_command event of its own (it never actually ran). It does flush -// metrics first, so events already queued earlier in this run are still -// written and scheduled for upload rather than stranded until the next -// clean exit. +// worker-sandbox posture, see readonlyMode), or when a migration freeze +// marker is active (dc-6jaq, folded in here rather than requiring every write +// command to remember a second call — see migrationFreezeError below). This +// is the chokepoint essentially every write command already calls first, so +// folding the freeze check in here covers the whole write surface at once, +// including commands added after this comment is written — not just a +// hand-picked list that rots (one concrete instance the hand-picked list +// missed: "bd q", cmd/bd/quick.go, the create alias). It exits via os.Exit +// and so cannot run the per-command deferred CloseEventAndAdd — a command +// blocked here records no cli_command event of its own (it never actually +// ran). It does flush metrics first, so events already queued earlier in this +// run are still written and scheduled for upload rather than stranded until +// the next clean exit. Callers that CAN return an error (the root +// PersistentPreRunE, runImport) call migrationFreezeError directly instead, +// so their deferred cleanup still runs. func CheckReadonly(operation string) { if readonlyMode { fmt.Fprintf(os.Stderr, "Error: operation '%s' is not allowed in read-only mode\n", operation) metrics.CloseAndFlush() os.Exit(1) } - CheckMigrationFreeze(operation) + if err := migrationFreezeError(operation); err != nil { + metrics.CloseAndFlush() + os.Exit(ExitMigrationFrozen) + } } -// CheckMigrationFreeze aborts the command when a MIGRATION-FREEZE sentinel is -// present at the town root (dc-6jaq). The gt CLI already refuses to write -// under the same sentinel (gt mail send, gt nudge, gt sling, gt assign); -// mail-poller/daemon patrols that also write via bd are stopped separately -// via the migration playbook's plist-unload step, so this closes the -// remaining gap: a human typing 'bd create'/'bd update' etc. mid-migration, -// bypassing the gt-layer gate. Same exit-via-os.Exit tradeoff as -// CheckReadonly above — no cli_command event for a command blocked here, -// but queued metrics are still flushed. +// freezeSearchRoots returns the directories whose ancestry the freeze lookup +// must cover in addition to the working directory: the resolved workspace, so +// the gate keys on the store being written rather than on the caller's shell. +// Without it, `BEADS_DIR=/work/repo/.beads bd create` run from $HOME, `bd -C +// /work/repo create` (which sets BEADS_DIR and never chdirs), and any daemon +// or cron job with an unrelated cwd all walk the wrong tree and write straight +// through a freeze. +// +// PersistentPreRunE exports BEADS_DIR as part of selecting the workspace +// (prepareSelectedCommandContext), so by the time a command's RunE reaches +// CheckReadonly this is a cheap env read. The FindBeadsDir fallback covers the +// callers that run before that — and returns "" rather than erroring when +// there is no workspace at all, which Find skips. +func freezeSearchRoots() []string { + if dir := os.Getenv("BEADS_DIR"); dir != "" { + return []string{dir} + } + if dir := beads.FindBeadsDir(); dir != "" { + return []string{dir} + } + return nil +} + +// migrationFreezeError reports the active migration freeze, if any: it +// returns nil when writes are not frozen, and otherwise prints the refusal to +// stderr and returns an ExitMigrationFrozen exit error. The refusal names the +// marker's own path, so the recovery instruction ("remove that file") is +// always actionable without knowing what created it. // // Three callers, each closing a different hole: // 1. CheckReadonly above — the per-command chokepoint covering the write // surface at large (create/update/close/... and everything that calls -// CheckReadonly, ~120 sites). +// CheckReadonly, ~120 sites). Only that caller turns this error into an +// os.Exit, because its void signature leaves it nothing else to do. // 2. The root PersistentPreRunE in main.go, before autoMigrateOnVersionBump // and maybeAutoImportJSONL — those run as store-open side effects // *before* any RunE, so waiting for a write command's own CheckReadonly @@ -173,25 +238,118 @@ func CheckReadonly(operation string) { // CheckReadonly at all today (a pre-existing, separate gap: readonlyMode // doesn't block it either), so it cannot inherit the freeze check from // caller 1 and needs its own explicit call. -func CheckMigrationFreeze(operation string) { - townRoot := findTownRoot() - if !migration.IsFrozen(townRoot) { - return +func migrationFreezeError(operation string) error { + return migrationFreezeRefusal(operation, migration.Find(freezeSearchRoots()...)) +} + +// migrationFreezeRefusal renders an already-resolved lookup. Callers that +// need the same Result for more than the refusal — PersistentPreRunE, which +// also derives frozenForMaintenance from it — resolve once and pass it here, +// so a single walk answers the whole invocation and the two readings cannot +// disagree about a marker that appeared or vanished between them. +func migrationFreezeRefusal(operation string, res migration.Result) error { + if !res.Frozen() { + return nil } - info := migration.Read(townRoot) - operator := "unknown" + if res.Err != nil { + // Fail closed: bd could not tell whether a marker is present (a + // permission error on the marker or a directory above it). An + // undeterminable gate is not an open gate, and saying so beats + // writing into a workspace that may be mid-migration. + fmt.Fprint(os.Stderr, "⛔ ERROR: cannot determine whether this workspace is frozen for migration.\n") + fmt.Fprintf(os.Stderr, " %s\n", ui.SanitizeForTerminal(res.Err.Error())) + fmt.Fprintf(os.Stderr, " bd %s is blocked until the marker can be read.\n", operation) + fmt.Fprintf(os.Stderr, " Fix the permissions, or set %s to a path bd can stat.\n", migration.EnvFreezeFile) + return &exitError{Code: ExitMigrationFrozen} + } + + // The marker can live in a directory bd does not control, so its payload + // is untrusted input on its way to a terminal. parse already keeps it to + // one line; sanitizing strips ANSI and control bytes on top of that. + operator := "" reason := "" - if info != nil { - operator = info.Operator - reason = info.Reason + if info := migration.ReadFile(res.Path); info != nil { + operator = ui.SanitizeForTerminal(info.Operator) + reason = ui.SanitizeForTerminal(info.Reason) } - fmt.Fprintf(os.Stderr, "⛔ ERROR: town is frozen for migration (by %s).\n", operator) + if operator != "" { + fmt.Fprintf(os.Stderr, "⛔ ERROR: workspace is frozen for migration (by %s).\n", operator) + } else { + // An empty or unparseable marker (a bare `touch`) records no + // operator; say nothing rather than printing "(by )". + fmt.Fprint(os.Stderr, "⛔ ERROR: workspace is frozen for migration.\n") + } if reason != "" { fmt.Fprintf(os.Stderr, " Reason: %s\n", reason) } - fmt.Fprintf(os.Stderr, " bd %s is blocked. Clear the freeze: gt migrate thaw\n", operation) - metrics.CloseAndFlush() - os.Exit(1) + fmt.Fprintf(os.Stderr, " bd %s is blocked by the freeze marker at %s.\n", operation, res.Path) + if res.FromEnv { + fmt.Fprintf(os.Stderr, " To resume writes, remove that file or unset %s.\n", migration.EnvFreezeFile) + } else { + // Name the variable on this path too: when the marker sits in a + // directory the caller cannot write to, pointing the variable + // elsewhere is the only recovery available to them. + fmt.Fprint(os.Stderr, " To resume writes, remove that file.\n") + fmt.Fprintf(os.Stderr, " If you cannot remove it, set %s to a path bd should check instead.\n", migration.EnvFreezeFile) + } + return &exitError{Code: ExitMigrationFrozen} +} + +// migrationFreezeGate is the RunE-side entry point: it renders the refusal and, +// because the refusal has already said everything worth saying, suppresses +// cobra's own error and usage rendering for this invocation. +// +// Without the suppression a freeze refusal on any command that does not set +// SilenceErrors/SilenceUsage statically — duplicate, supersede, dep +// relate/unrelate, backup init/sync/remove/restore, ado sync, migrate-personal, +// batch — is followed by "Error: exit code 14" (exitError's placeholder text) +// and a full usage dump, so a clean refusal reads like a syntax error. Setting +// the flags here rather than on each command covers the ones added after this +// comment too. main() exits on the exitError before its own SilenceErrors +// branch, so nothing prints the placeholder. +func migrationFreezeGate(cmd *cobra.Command, operation string, res migration.Result) error { + err := migrationFreezeRefusal(operation, res) + if err != nil && cmd != nil { + cmd.SilenceErrors = true + cmd.SilenceUsage = true + } + return err +} + +// migrationFreezeGateFor resolves the freeze and gates in one step, for the +// callers that have no Result to thread: the skip-store commands (bd init, +// bd bootstrap), which return from PersistentPreRunE long before it resolves +// one, and any command handed an explicit target path. +func migrationFreezeGateFor(cmd *cobra.Command, operation string, extraRoots ...string) error { + return migrationFreezeGate(cmd, operation, migration.Find(freezeRootsWith(extraRoots)...)) +} + +// migrationFreezeErrorFor is migrationFreezeError against extra roots, for +// callers that hold a target path but no *cobra.Command to silence — a command +// given a workspace to operate on that is not the one it was launched in. +func migrationFreezeErrorFor(operation string, extraRoots ...string) error { + return migrationFreezeRefusal(operation, migration.Find(freezeRootsWith(extraRoots)...)) +} + +// migrationFreezeActive is the print-nothing probe for code that must SKIP a +// write during a freeze rather than refuse the whole command — the diagnosis +// paths that keep running while frozen but must not apply version tracking or +// schema auto-migration. +func migrationFreezeActive() bool { + return migrationFreezeActiveFor() +} + +// migrationFreezeActiveFor is migrationFreezeActive against extra roots — the +// probe half of the migrationFreezeErrorFor pair, for a diagnosis path handed a +// workspace that is not the one bd was launched in. `bd doctor /frozen/repo` +// skips its own maintenance writes on the strength of this, so it has to look +// at the tree it is about to write to and not just at the caller's cwd. +func migrationFreezeActiveFor(extraRoots ...string) bool { + return migration.Find(freezeRootsWith(extraRoots)...).Frozen() +} + +func freezeRootsWith(extraRoots []string) []string { + return append(freezeSearchRoots(), extraRoots...) } diff --git a/cmd/bd/events.go b/cmd/bd/events.go index 1c9cff5c4..dc8f33521 100644 --- a/cmd/bd/events.go +++ b/cmd/bd/events.go @@ -10,6 +10,7 @@ import ( "github.com/spf13/cobra" + "github.com/steveyegge/beads/internal/beads" "github.com/steveyegge/beads/internal/config" "github.com/steveyegge/beads/internal/eventsjournal" "github.com/steveyegge/beads/internal/storage" @@ -103,10 +104,12 @@ Record contract (stable for external consumers): issue_id string the mutated issue's id actor string the acting identity that performed the mutation, as resolved for the audit-events table (on a comment row: the comment's - author); empty (omitted) when the mutation path has no - actor — derived maintenance, deletes (other than a rename's - synthetic delete), and rows older than the column. Never - user attribution when empty. + author). A delete — and the dep_remove rows a cascading + delete produces — carries the identity that REQUESTED it. + Empty (omitted) only when the path genuinely has no actor: + derived maintenance, system cleanup with no request behind + it, and rows older than the column. Never user attribution + when empty. issue object full issue state AFTER the mutation; null on delete dep object {"kind","target","metadata"} for dep_add / dep_remove; omitted otherwise comment object {"id","author","text","created_at","source"} for comment; omitted otherwise @@ -246,7 +249,32 @@ func reportEventsTruncated(err error, streaming bool) error { fmt.Sprintf("resume with --since %d to continue from the oldest retained record (accepting the gap), or re-import from scratch", trunc.Floor-1)) } +// noticeEventsJournalDisabled warns, on stderr, that this workspace is not +// recording — so an empty or stale read is not mistaken for "caught up". +// +// It exists because zero rows is INDISTINGUISHABLE from a journal that has +// nothing new: a consumer polling a workspace that never enabled the journal +// sees a successful, empty read forever and concludes it is up to date. The +// HTTP API refuses that read outright (EventsJournalDisabled, 409); the CLI +// cannot, because exporting the ledger a now-disabled workspace recorded while +// it WAS enabled is legitimate. So it serves the rows and says what it is +// serving. +// +// stderr, not stdout, and not the JSON envelope: stdout is a JSONL stream a +// line reader consumes, and a notice about the reader's own configuration is +// not a record. Exit status is unchanged. +func noticeEventsJournalDisabled(beadsDir string) { + if eventsjournal.EnabledFor(beadsDir) { + return + } + fmt.Fprintf(os.Stderr, + "note: the events journal is disabled for this workspace (enable with 'bd config set %s true'); "+ + "any records shown were written while it was enabled, and new mutations are not being recorded\n", + eventsjournal.ConfigKey) +} + func runEventsTail(ctx context.Context, since int64, limit int, follow bool) error { + noticeEventsJournalDisabled(beads.FindBeadsDir()) enc := json.NewEncoder(os.Stdout) emit := func(from int64) (int64, error) { rows, err := readJournal(ctx, from, limit) diff --git a/cmd/bd/events_delete_actor_e2e_test.go b/cmd/bd/events_delete_actor_e2e_test.go new file mode 100644 index 000000000..62b007e98 --- /dev/null +++ b/cmd/bd/events_delete_actor_e2e_test.go @@ -0,0 +1,129 @@ +//go:build cgo && unix + +package main + +import ( + "bytes" + "os" + "os/exec" + "strings" + "testing" +) + +// The two halves of #5985 at the front door: what `bd delete --actor` records, +// and what `bd events export` tells you when there is nothing to record into. +// Both are end-to-end because both failures are invisible from inside the +// process — the command succeeds either way, and only a later read shows the +// attribution missing or the reader polling a journal that was never on. + +// runBDOut runs bd in dir and returns stdout and stderr separately. The notice +// under test is on stderr precisely so it does not corrupt the JSONL on stdout, +// so a CombinedOutput helper cannot check it. +func runBDOut(t *testing.T, bd, dir string, env []string, args ...string) (string, string) { + t.Helper() + cmd := exec.Command(bd, args...) + cmd.Dir = dir + cmd.Env = env + var stdout, stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + if err := cmd.Run(); err != nil { + t.Fatalf("bd %s in %s: %v\nstdout:\n%s\nstderr:\n%s", + strings.Join(args, " "), dir, err, stdout.String(), stderr.String()) + } + return stdout.String(), stderr.String() +} + +// TestDeleteJournalsTheRequestingActor is #5985's repro, verbatim: create two +// beads with an edge between them, delete the blocker with an explicit --actor, +// and read the journal back. Both the delete record and the cascade dep_remove +// record must name that actor. +// +// The whole route is exercised — cobra flag to journal column — because the +// actor is resolved, threaded through the role, and written by the storage +// seam, and a unit test at any one of those cannot see the drop at the next. +func TestDeleteJournalsTheRequestingActor(t *testing.T) { + if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" { + t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests") + } + t.Parallel() + bd := buildEmbeddedBD(t) + dir, _, _ := bdInit(t, bd, "--prefix", "dja", "--skip-hooks", "--skip-agents") + env := append(envWithout(bdEnv(dir), "BD_EVENTS_JOURNAL"), "BD_EVENTS_JOURNAL=1") + + run := func(args ...string) string { + t.Helper() + stdout, _ := runBDOut(t, bd, dir, env, args...) + return stdout + } + + run("create", "--silent", "--id", "dja-blocker", "the blocker") + run("create", "--silent", "--id", "dja-dependent", "the dependent") + run("dep", "add", "dja-dependent", "dja-blocker") + + // --force is what makes this a real delete rather than a preview, and it is + // also what lets it orphan the dependent instead of refusing. + run("delete", "dja-blocker", "--force", "--actor", "alice") + + records := decodeEventRecords(t, run("events", "export")) + var sawDelete, sawCascadeDepRemove bool + for _, rec := range records { + switch { + case rec.Op == "delete" && rec.IssueID == "dja-blocker": + sawDelete = true + if rec.Actor != "alice" { + t.Errorf("delete record actor = %q, want %q (#5985)", rec.Actor, "alice") + } + // The cascade edge removal is journaled under the edge's SOURCE — the + // surviving dependent — and belongs to the identity that asked for the + // delete, not to whoever created the edge. + case rec.Op == "dep_remove" && rec.IssueID == "dja-dependent": + sawCascadeDepRemove = true + if rec.Actor != "alice" { + t.Errorf("cascade dep_remove record actor = %q, want %q (#5985)", rec.Actor, "alice") + } + } + } + if !sawDelete { + t.Errorf("no delete record for dja-blocker: %+v", records) + } + if !sawCascadeDepRemove { + t.Errorf("no cascade dep_remove record for dja-dependent: %+v", records) + } +} + +// TestEventsReadNoticesADisabledJournal pins the "nothing to read and no way to +// tell why" fix. A workspace that never enabled the journal serves an empty +// export forever, which a consumer cannot distinguish from being caught up, so +// the read says so on stderr — and keeps stdout clean and the exit status zero, +// because exporting a historical ledger from a now-disabled workspace is +// legitimate. +func TestEventsReadNoticesADisabledJournal(t *testing.T) { + if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" { + t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests") + } + t.Parallel() + bd := buildEmbeddedBD(t) + dir, _, _ := bdInit(t, bd, "--prefix", "dnn", "--skip-hooks", "--skip-agents") + off := envWithout(bdEnv(dir), "BD_EVENTS_JOURNAL") + + for _, sub := range []string{"export", "tail"} { + stdout, stderr := runBDOut(t, bd, dir, off, "events", sub) + if !strings.Contains(stderr, "events journal is disabled") { + t.Errorf("bd events %s on a disabled workspace printed no notice\nstderr:\n%s", sub, stderr) + } + if !strings.Contains(stderr, "events-journal") { + t.Errorf("bd events %s notice does not name the setting to flip\nstderr:\n%s", sub, stderr) + } + if strings.TrimSpace(stdout) != "" { + t.Errorf("bd events %s put the notice on stdout, which carries the JSONL stream:\n%s", sub, stdout) + } + } + + // Enabled: no notice, so the message stays a signal rather than noise every + // consumer learns to filter out. + on := append(envWithout(bdEnv(dir), "BD_EVENTS_JOURNAL"), "BD_EVENTS_JOURNAL=1") + if _, stderr := runBDOut(t, bd, dir, on, "events", "export"); strings.Contains(stderr, "events journal is disabled") { + t.Errorf("an enabled workspace still printed the disabled notice:\n%s", stderr) + } +} diff --git a/cmd/bd/events_golden_test.go b/cmd/bd/events_golden_test.go index ccea79026..078c203a6 100644 --- a/cmd/bd/events_golden_test.go +++ b/cmd/bd/events_golden_test.go @@ -153,8 +153,14 @@ func renderGoldenLines(t *testing.T) []byte { // actor pins both halves of the attribution contract: an attributed row // emits the acting identity (the same one the audit-events table resolves), - // and an actorless row — derived maintenance, actorless delete plumbing, + // and an actorless row — derived maintenance, the system delete surfaces, // records from before the column existed — omits the member entirely. + // + // A `delete` appears on BOTH sides on purpose. A user's `bd delete --actor A` + // is attributed to A, cascade rows included; the actorless surfaces (gc, + // molecule cleanup, `bd repo remove`) still emit none. A consumer that read + // the empty case as "deletes are never attributed" — which the fixture used + // to be the only evidence for — would mis-resolve every delete conflict. records := []eventsjournal.Record{ goldenRecord(1, ts, string(issueops.EventCreate), minimal.ID, "author", mustJSON(t, minimal), "", ""), goldenRecord(2, ts, string(issueops.EventCreate), full.ID, "author", mustJSON(t, full), "", ""), @@ -169,7 +175,11 @@ func renderGoldenLines(t *testing.T) []byte { goldenRecord(8, ts, string(issueops.EventCommentWrite), claimed.ID, "worker-1", mustJSON(t, claimed), "", mustJSON(t, auditComment)), goldenRecord(9, ts, string(issueops.EventClose), closedIssue.ID, "worker-1", mustJSON(t, closedIssue), "", ""), goldenRecord(10, ts, string(issueops.EventCreate), wisp.ID, "author", mustJSON(t, wisp), "", ""), - goldenRecord(11, ts, string(issueops.EventDelete), "bd-100", "", "", "", ""), // null issue on delete; actorless delete plumbing + // The cascade edge removal a delete emits, attributed to the requester. + goldenRecord(11, ts, string(issueops.EventDepRemove), "bd-101", "deleter-1", mustJSON(t, full), + mustJSON(t, &issueops.EventDep{Kind: string(types.DepBlocks), Target: "bd-100"}), ""), + goldenRecord(12, ts, string(issueops.EventDelete), "bd-100", "deleter-1", "", "", ""), // null issue on delete; requested delete + goldenRecord(13, ts, string(issueops.EventDelete), "bd-wisp-1", "", "", "", ""), // actorless system delete surface } var buf bytes.Buffer diff --git a/cmd/bd/events_journal_activation_e2e_test.go b/cmd/bd/events_journal_activation_e2e_test.go index 7f9ae524e..7441a3579 100644 --- a/cmd/bd/events_journal_activation_e2e_test.go +++ b/cmd/bd/events_journal_activation_e2e_test.go @@ -109,8 +109,13 @@ func TestRoutedCreateJournalsIntoTheTargetWorkspace(t *testing.T) { } // The launching workspace never enabled the journal, so it records nothing - // — the target's setting must not leak back, in either direction. - if got := strings.TrimSpace(run(sourceDir, "events", "export")); got != "" { + // — the target's setting must not leak back, in either direction. Read + // STDOUT only: a disabled workspace also prints the "journal is disabled" + // notice, and that notice is on stderr precisely so it cannot be mistaken + // for a record. + sourceEnv := envWithout(bdEnv(sourceDir), "BD_EVENTS_JOURNAL") + stdout, _ := runBDOut(t, bd, sourceDir, sourceEnv, "events", "export") + if got := strings.TrimSpace(stdout); got != "" { t.Errorf("the launching workspace journaled %q despite never enabling the journal", got) } } diff --git a/cmd/bd/export_auto.go b/cmd/bd/export_auto.go index aa94d115e..54a6b6921 100644 --- a/cmd/bd/export_auto.go +++ b/cmd/bd/export_auto.go @@ -11,6 +11,7 @@ import ( "path/filepath" "sort" "strings" + "sync" "time" "github.com/steveyegge/beads/internal/atomicfile" @@ -39,8 +40,27 @@ const doltWorkingRef = "WORKING" // exceeds this prints a one-line stderr tip pointing at the fix levers. const slowExportWarnThreshold = 3 * time.Second +// exportAutoStateVersion is the format version stamped into +// .beads/export-state.json. BUMP IT whenever the MEANING of a persisted +// field changes — LastDiffAnchor's semantics above all — so a newer binary's +// state file is discarded by an older one instead of being reinterpreted. +// Adding a purely additive optional field does not need a bump. +// +// Discarding is only safe because of the deletion proofs in +// proveDeletedIssueIDs: dropping the state drops the diff anchor, and before +// GH#5896 an absent anchor plus a pending delete was itself a permanent +// wedge, which made "invalidate the state file" a cure worse than the +// disease. Now an anchorless cycle just proves what it can from history and +// re-anchors on the way out. +const exportAutoStateVersion = 1 + // exportAutoState tracks auto-export state to avoid redundant work. type exportAutoState struct { + // FormatVersion is exportAutoStateVersion at write time. Absent (0) means + // a file written before versioning existed; those are field-for-field + // identical to v1 and load as-is. + FormatVersion int `json:"v,omitempty"` + LastDoltCommit string `json:"last_dolt_commit"` Timestamp time.Time `json:"timestamp"` Issues int `json:"issues"` @@ -128,21 +148,31 @@ func maybeAutoExport(ctx context.Context, allowEmptyOverwrite bool) error { return nil } + // Reconcile the existing JSONL against the store ONCE, and let BOTH + // fail-safe guards below read the same answer. A deletion this store can + // prove is not divergence for either of them: the empty-overwrite guard + // fires first, so without a shared verdict `bd delete ` + // wedges there before the orphan guard ever gets to prove anything + // (GH#5896). + var provenDeleted []string if !allowEmptyOverwrite { - if skip, existingCount, err := shouldSkipEmptyAutoExport(ctx, fullPath); err != nil { + rec, err := reconcileAutoExportJSONL(ctx, fullPath, state.LastDiffAnchor) + if err != nil { + fmt.Fprintf(os.Stderr, "Warning: auto-export skipped: failed to compare existing JSONL against local store: %v\n", err) + return nil + } + provenDeleted = rec.provenDeleted + + if skip, existingCount, err := shouldSkipEmptyAutoExport(ctx, rec); err != nil { fmt.Fprintf(os.Stderr, "Warning: auto-export skipped: failed to check existing JSONL: %v\n", err) return nil } else if skip { fmt.Fprintf(os.Stderr, "Warning: auto-export skipped: current database would export 0 issues, but %s already contains %d issue(s); refusing to overwrite. Run `bd init --from-jsonl` to import the JSONL file, or move it aside and retry.\n", fullPath, existingCount) return nil } - } - if !allowEmptyOverwrite { - if missingIDs, err := missingJSONLIssueIDsInStore(ctx, fullPath, state.LastDiffAnchor); err != nil { - fmt.Fprintf(os.Stderr, "Warning: auto-export skipped: failed to compare existing JSONL against local store: %v\n", err) - return nil - } else if len(missingIDs) > 0 { - fmt.Fprintf(os.Stderr, "Warning: auto-export skipped: %s contains %d JSONL-only issue record(s) absent from the local Dolt store (%s); refusing to overwrite. Run `bd init --from-jsonl` to import the JSONL file, or move it aside and retry.\n", fullPath, len(missingIDs), strings.Join(sampleStrings(missingIDs, 5), ", ")) + + if len(rec.unproven) > 0 { + fmt.Fprintf(os.Stderr, "Warning: auto-export skipped: %s contains %d JSONL-only issue record(s) absent from the local Dolt store (%s); refusing to overwrite. Run `bd init --from-jsonl` to import the JSONL file, or move it aside and retry.\n", fullPath, len(rec.unproven), strings.Join(sampleStrings(rec.unproven, 5), ", ")) return nil } } @@ -167,8 +197,14 @@ func maybeAutoExport(ctx context.Context, allowEmptyOverwrite bool) error { debug.Logf("auto-export: failed to resolve diff anchor (%v); preserving previous anchor\n", anchorErr) anchorCommit = state.LastDiffAnchor } + // provenDeleted rides along as FORCED removals: an id proved by the + // in-process handoff or by store history is invisible to + // dolt_diff(anchor, WORKING), so an incremental patch would faithfully + // preserve its stale JSONL line forever even though the guard just + // cleared the export to run. A full export needs nothing — it rewrites + // from the store. issueCount, memoryCount, dirtyIDs, didIncremental, err := tryIncrementalExport( - ctx, fullPath, state.LastDiffAnchor, doltWorkingRef, state.LastDirtyIDs, + ctx, fullPath, state.LastDiffAnchor, doltWorkingRef, state.LastDirtyIDs, provenDeleted, ) if err != nil { debug.Logf("auto-export: incremental failed (%v); falling back to full\n", err) @@ -182,6 +218,13 @@ func maybeAutoExport(ctx context.Context, allowEmptyOverwrite bool) error { dirtyIDs = nil } + // Never heal silently. The user asked for a delete and is getting a line + // removed from a git-tracked file; say so, and name what went. + if len(provenDeleted) > 0 { + fmt.Fprintf(os.Stderr, "auto-export: reconciled %d deleted issue(s) out of %s (deleted from store: %s)\n", + len(provenDeleted), fullPath, strings.Join(sampleStrings(provenDeleted, 5), ", ")) + } + if dur := time.Since(exportStart); dur > slowExportWarnThreshold && !didIncremental { // Only warn on full exports — the whole point of incremental is to // get us under the threshold, so a slow incremental is noise. @@ -265,12 +308,15 @@ func shouldExport(state *exportAutoState, interval time.Duration) bool { return time.Since(state.Timestamp) >= interval } -func shouldSkipEmptyAutoExport(ctx context.Context, path string) (bool, int, error) { - existingCount, err := countIssueRecordsInJSONL(path) - if err != nil { - return false, 0, err - } - if existingCount == 0 { +// shouldSkipEmptyAutoExport is the "store would write 0 issues over a +// populated file" fail-safe. It reads the shared reconciliation rather than +// re-parsing the JSONL so that ids already proven deleted don't count as +// records worth protecting — deleting the last exported issue is the shape +// that used to wedge here, one guard earlier than the orphan guard everyone +// blamed (GH#5896). +func shouldSkipEmptyAutoExport(ctx context.Context, rec *autoExportReconciliation) (bool, int, error) { + existingCount := rec.jsonlIssueCount - len(rec.provenDeleted) + if existingCount <= 0 { return false, 0, nil } @@ -282,15 +328,37 @@ func shouldSkipEmptyAutoExport(ctx context.Context, path string) (bool, int, err return len(issues) == 0, existingCount, nil } -func countIssueRecordsInJSONL(path string) (int, error) { - ids, err := issueIDsInJSONL(path) - if err != nil { - return 0, err - } - return len(ids), nil +// historyProofMaxCandidates caps how many JSONL-only ids the store-history +// proof will ask about in one export. A divergence wider than this is not a +// delete pattern — it is GH#4988 territory (a torn, stale, or foreign JSONL), +// where the conservative refusal is the right answer and a 100-way history +// scan is wasted work on the way to it. +const historyProofMaxCandidates = 100 + +// autoExportReconciliation is the single comparison of the existing JSONL +// against the live store that both pre-export guards read. +type autoExportReconciliation struct { + // jsonlIssueCount is every issue record in the file, in auto-export + // scope or not — the number the empty-overwrite guard reports. + jsonlIssueCount int + // provenDeleted are in-scope JSONL ids absent from the store that some + // proof source accounted for as real deletions. The export must drop + // their lines; neither guard may refuse over them. + provenDeleted []string + // unproven are in-scope JSONL ids absent from the store that nothing + // could account for. The orphan guard refuses over these, unchanged. + unproven []string } -func missingJSONLIssueIDsInStore(ctx context.Context, path, fromCommit string) ([]string, error) { +// reconcileAutoExportJSONL compares the on-disk export against the store and +// splits the JSONL-only issue ids into proven deletions and unexplained +// divergence. +// +// fromCommit is the previous cycle's diff anchor, used by one of the three +// proof sources; the other two need no anchor, which is what lets a store +// wedged by an earlier binary (no anchor, or an anchor that no longer +// resolves) recover on its first run under this code. +func reconcileAutoExportJSONL(ctx context.Context, path, fromCommit string) (*autoExportReconciliation, error) { // GH#4988: only refuse when *in-scope* JSONL issue records are absent from // the store. Ephemeral wisps, templates, and infra types are outside // auto-export scope (buildAutoExportFilter / GH#3649). Compaction can @@ -300,8 +368,9 @@ func missingJSONLIssueIDsInStore(ctx context.Context, path, fromCommit string) ( if err != nil { return nil, err } + rec := &autoExportReconciliation{jsonlIssueCount: len(existing)} if len(existing) == 0 { - return nil, nil + return rec, nil } // Store-side query stays unfiltered and MaxRows: 0 (opts out of @@ -321,24 +390,49 @@ func missingJSONLIssueIDsInStore(ctx context.Context, path, fromCommit string) ( } candidates := make([]string, 0) - for _, rec := range existing { - if rec.Ephemeral || rec.IsTemplate || infraTypeSet[string(rec.IssueType)] { + for _, record := range existing { + if record.Ephemeral || record.IsTemplate || infraTypeSet[string(record.IssueType)] { continue } - if _, ok := localIDs[rec.ID]; !ok { - candidates = append(candidates, rec.ID) + if _, ok := localIDs[record.ID]; !ok { + candidates = append(candidates, record.ID) } } if len(candidates) == 0 { - return nil, nil + return rec, nil } - // Before treating a JSONL-only id as an orphan/corruption, ask dolt_diff - // whether the deletion is real and already recorded — a normal `bd - // delete` since the last export's diff anchor, not data loss. Without an - // anchor (cold start / no successful export yet) there is nothing to - // diff against, so every candidate falls through to the conservative - // "missing" verdict below, same as before this check existed. + rec.provenDeleted, rec.unproven = proveDeletedIssueIDs(ctx, candidates, fromCommit) + return rec, nil +} + +// proveDeletedIssueIDs splits JSONL-only candidate ids into the ones a proof +// source accounts for as real deletions and the ones nothing can explain. +// +// Sources run cheapest-first, and each one only sees what the previous could +// not prove: +// +// 1. the in-process delete handoff — this very command deleted the id a few +// milliseconds ago. Free, and the only source that can see a create and a +// delete that both sit uncommitted in the working set. +// 2. dolt_diff against the previous export's anchor (GH#5806) — a DoltStore +// fast path that also covers deletions that arrived from a peer. +// 3. the store's own committed history (GH#5896) — anchor-free, works on +// both stores, and the only source that can heal a store some earlier +// binary already wedged. +// +// Whatever survives all three is unexplained divergence, and the caller keeps +// refusing to overwrite: that is GH#4988's fail-safe, unchanged. +func proveDeletedIssueIDs(ctx context.Context, candidates []string, fromCommit string) (proven, unproven []string) { + unproven = candidates + + // P1 — same-process delete handoff. + proven, unproven = splitProvenDeletions(proven, unproven, commandDeletedIssueIDs.has) + if len(unproven) == 0 { + return proven, unproven + } + + // P2 — dolt_diff against the last export's anchor. // // The anchor must still be on the CURRENT HEAD's history for that proof // to mean anything. dolt_diff(anchor, WORKING) reports a row as "removed" @@ -349,14 +443,11 @@ func missingJSONLIssueIDsInStore(ctx context.Context, path, fromCommit string) ( // there would silently drop a live record from issues.jsonl, which is // exactly #4988's corruption class this guard exists to prevent. So the // deletion proof is accepted only when the anchor is reachable from HEAD - // (CommitExists queries dolt_log, i.e. HEAD's forward history); otherwise - // we keep refusing, which is the conservative pre-existing behavior. + // (CommitExists queries dolt_log, i.e. HEAD's forward history). // - // Residual, deliberately not fixed here (tracked by #5896): an anchor - // that has become unresolvable — after a history squash or GC — combined - // with a pending delete is a permanent wedge. The guard refuses, so the - // export skips, so state is never saved, so the anchor never refreshes. - // Recovery is `bd init --from-jsonl` or moving issues.jsonl aside. + // A missing anchor, an off-history anchor, a diff error, or a store with + // no DiffStore at all (embedded mode — the default) all just fall through + // to P3 now, instead of ending the search. if fromCommit != "" && diffAnchorOnCurrentHistory(ctx, fromCommit) { if ds, ok := storage.UnwrapStore(store).(storage.DiffStore); ok { if changed, diffErr := ds.ChangedIssueIDs(ctx, fromCommit, doltWorkingRef); diffErr == nil { @@ -364,25 +455,101 @@ func missingJSONLIssueIDsInStore(ctx context.Context, path, fromCommit string) ( for _, id := range changed.Removed { removed[id] = struct{}{} } - proven := candidates[:0] - for _, id := range candidates { - if _, ok := removed[id]; !ok { - proven = append(proven, id) - } - } - candidates = proven + proven, unproven = splitProvenDeletions(proven, unproven, func(id string) bool { + _, ok := removed[id] + return ok + }) + } else { + debug.Logf("auto-export: anchor diff %s..%s failed (%v); falling through to the history proof\n", + fromCommit, doltWorkingRef, diffErr) } - // A diff error (e.g. anchor unreachable after history rewrite) - // leaves candidates untouched — we can't prove the deletion, so - // fall back to refusing, exactly as before this check existed. } } + if len(unproven) == 0 { + return proven, unproven + } - return candidates, nil + // P3 — the store's own committed history. "Was here, is gone" is a + // deletion this store recorded; "was never here" is data this store never + // had, which stays unproven. See storage.HistoryPresence for why that + // asymmetry is what keeps #4988's guarantee intact. + if len(unproven) > historyProofMaxCandidates { + debug.Logf("auto-export: %d unproven JSONL-only ids exceeds the history-proof cap %d; refusing without asking\n", + len(unproven), historyProofMaxCandidates) + return proven, unproven + } + hp, ok := storage.UnwrapStore(store).(storage.HistoryPresence) + if !ok { + debug.Logf("auto-export: store does not implement HistoryPresence; JSONL-only ids stay unproven\n") + return proven, unproven + } + historical, err := hp.HistoricalIssueIDs(ctx, unproven) + if err != nil { + debug.Logf("auto-export: history proof failed (%v); treating JSONL-only ids as unproven\n", err) + return proven, unproven + } + proven, unproven = splitProvenDeletions(proven, unproven, func(id string) bool { + _, ok := historical[id] + return ok + }) + return proven, unproven +} + +// splitProvenDeletions moves the ids isProven accepts from unproven onto +// proven, preserving order on both sides. +func splitProvenDeletions(proven, unproven []string, isProven func(string) bool) ([]string, []string) { + remaining := make([]string, 0, len(unproven)) + for _, id := range unproven { + if isProven(id) { + proven = append(proven, id) + continue + } + remaining = append(remaining, id) + } + return proven, remaining +} + +// deletedIssueIDSet is the in-process handoff from the delete commands to +// auto-export: "this process just hard-deleted these ids, they are supposed to +// be gone". Deliberately NOT persisted — a cross-process ledger would mean the +// delete path read-modify-writes export-state.json underneath a concurrent +// exporter, and a lost entry there silently re-wedges. When the handoff misses +// (throttled export, separate invocation, peer's delete), the history proof +// picks the id up as soon as the deletion is committed. +type deletedIssueIDSet struct { + mu sync.Mutex + ids map[string]struct{} +} + +func (s *deletedIssueIDSet) add(ids ...string) { + if len(ids) == 0 { + return + } + s.mu.Lock() + defer s.mu.Unlock() + if s.ids == nil { + s.ids = make(map[string]struct{}, len(ids)) + } + for _, id := range ids { + s.ids[id] = struct{}{} + } +} + +func (s *deletedIssueIDSet) reset() { + s.mu.Lock() + defer s.mu.Unlock() + s.ids = nil +} + +func (s *deletedIssueIDSet) has(id string) bool { + s.mu.Lock() + defer s.mu.Unlock() + _, ok := s.ids[id] + return ok } // commitHistoryChecker is the narrow slice of storage.VersionControl that -// missingJSONLIssueIDsInStore needs. It is declared locally and asserted +// reconcileAutoExportJSONL needs. It is declared locally and asserted // separately from storage.DiffStore so a store implementing one but not the // other still degrades to the conservative verdict instead of panicking. type commitHistoryChecker interface { @@ -392,7 +559,7 @@ type commitHistoryChecker interface { // diffAnchorOnCurrentHistory reports whether anchor is still reachable from // the current HEAD. It is the ancestry precondition on trusting a dolt_diff // "removed" verdict as proof of a real `bd delete` rather than a history -// rewind — see missingJSONLIssueIDsInStore. Fails closed: a store that +// rewind — see reconcileAutoExportJSONL. Fails closed: a store that // cannot answer, or an error while asking, yields false so the caller keeps // refusing to overwrite. func diffAnchorOnCurrentHistory(ctx context.Context, anchor string) bool { @@ -495,18 +662,6 @@ func issueRecordsInJSONL(path string) ([]jsonlIssueRecord, error) { return records, nil } -func issueIDsInJSONL(path string) ([]string, error) { - records, err := issueRecordsInJSONL(path) - if err != nil { - return nil, err - } - ids := make([]string, len(records)) - for i, rec := range records { - ids[i] = rec.ID - } - return ids, nil -} - func sampleStrings(values []string, limit int) []string { if len(values) <= limit { return values @@ -693,7 +848,7 @@ func exportToFile(ctx context.Context, path string, includeMemories bool) (issue // safe to drop when its id is no longer in the store (a TTL-compacted wisp, // GH#4988); if the store still has it, dropping it repeats #4069's data // loss. Deliberately unfiltered + MaxRows: 0, for the same reason as -// missingJSONLIssueIDsInStore's store-side query: this guard's failure mode +// reconcileAutoExportJSONL's store-side query: this guard's failure mode // is a permanent wedge, so the query must stay maximally permissive. func storeKnownIssueIDs(ctx context.Context) (map[string]struct{}, error) { issues, err := store.SearchIssues(ctx, "", types.IssueFilter{Limit: 0, MaxRows: 0}) @@ -809,11 +964,19 @@ func loadExportAutoState(beadsDir string) *exportAutoState { path, len(data), err, string(data[:min(len(data), 200)])) return &exportAutoState{} } + if state.FormatVersion > exportAutoStateVersion { + debug.Logf("auto-export: state file %s is format v%d, this binary understands v%d; starting from empty state\n", + path, state.FormatVersion, exportAutoStateVersion) + return &exportAutoState{} + } return &state } func saveExportAutoState(beadsDir string, state *exportAutoState) { path := filepath.Join(beadsDir, exportAutoStateFile) + // Stamped here rather than at the call sites so there is exactly one + // place that decides what version a written file claims to be. + state.FormatVersion = exportAutoStateVersion data, err := json.Marshal(state) if err != nil { fmt.Fprintf(os.Stderr, "Warning: auto-export: failed to marshal state: %v\n", err) @@ -1034,12 +1197,19 @@ func pathInsideDir(path, dir string) bool { // didIncremental=false when any precondition fails so the caller can fall // back to a full export. // +// forcedRemovals are ids the caller has already proven deleted by some means +// the diff cannot see (the in-process delete handoff, or the store's committed +// history — see proveDeletedIssueIDs). They are unioned into the diff's own +// removals, because a proven-deleted id is by definition absent at BOTH diff +// endpoints in the cases that matter, so the patch would otherwise carry its +// stale line forward forever. +// // dirtyIDs returns the RAW diff's upserted ids (never carryIDs) for the // caller to persist as next cycle's carryIDs. Carrying only the // freshly-diffed ids — not the ones merely carried-in — makes a stable // no-op cycle self-heal: a carried id that produces no new diff simply // drops out instead of accumulating forever. -func tryIncrementalExport(ctx context.Context, fullPath, fromCommit, toCommit string, carryIDs []string) (issueCount, memoryCount int, dirtyIDs []string, didIncremental bool, err error) { +func tryIncrementalExport(ctx context.Context, fullPath, fromCommit, toCommit string, carryIDs, forcedRemovals []string) (issueCount, memoryCount int, dirtyIDs []string, didIncremental bool, err error) { if fromCommit == "" { debug.Logf("auto-export: incremental skipped — no prior commit hash recorded\n") return 0, 0, nil, false, nil @@ -1069,8 +1239,16 @@ func tryIncrementalExport(ctx context.Context, fullPath, fromCommit, toCommit st // from last cycle (e.g. a working-set value that reverted between two // diff anchors nets to "no change" against the anchor, but the live row // still needs re-fetching to correct a stale patch from last cycle). + removed := make(map[string]bool, len(changed.Removed)+len(forcedRemovals)) + for _, id := range changed.Removed { + removed[id] = true + } + for _, id := range forcedRemovals { + removed[id] = true + } + upsertIDs := unionStrings(changed.Upserted, carryIDs) - total := len(upsertIDs) + len(changed.Removed) + total := len(upsertIDs) + len(removed) if total == 0 { // Nothing changed and nothing carried over. Still a valid // "incremental" outcome: no issues to rewrite, just refresh the @@ -1135,10 +1313,6 @@ func tryIncrementalExport(ctx context.Context, fullPath, fromCommit, toCommit st // changed.Removed from the issues-table diff; rely on that. } - removed := make(map[string]bool, len(changed.Removed)+len(droppedByFilter)) - for _, id := range changed.Removed { - removed[id] = true - } for id := range droppedByFilter { removed[id] = true } diff --git a/cmd/bd/export_auto_missing_store_test.go b/cmd/bd/export_auto_missing_store_test.go index 71a732608..5e14f08b7 100644 --- a/cmd/bd/export_auto_missing_store_test.go +++ b/cmd/bd/export_auto_missing_store_test.go @@ -13,21 +13,22 @@ import ( "github.com/steveyegge/beads/internal/types" ) -// TestMissingJSONLIssueIDsInStore_IgnoresCompactedWisp pins the actual -// GH#4988 behaviour at the layer that wedged auto-export permanently: -// missingJSONLIssueIDsInStore itself. maphew's review noted that +// TestReconcileAutoExportJSONL_IgnoresCompactedWisp pins the actual GH#4988 +// behaviour at the layer that wedged auto-export permanently: the +// JSONL-vs-store reconciliation itself (formerly missingJSONLIssueIDsInStore, +// now reconcileAutoExportJSONL). maphew's review noted that // TestMissingJSONLIssueIDsInStore is named in the original guard commit's // validation list but doesn't exist in the tree; this closes that gap. // // Seeds one persistent issue (present in the store) and a JSONL file that // additionally lists an ephemeral wisp id that is NOT in the store — the // TTL-compaction scenario, where a wisp was written to issues.jsonl and -// later deleted from Dolt by compaction. Asserts `missing` comes back -// empty: an out-of-scope (ephemeral) row's absence from the store must not -// be treated as a hard orphan, or auto-export wedges forever. +// later deleted from Dolt by compaction. Asserts the reconciliation reports +// nothing at all: an out-of-scope (ephemeral) row's absence from the store +// must not be treated as a hard orphan, or auto-export wedges forever. // // Requires a live Dolt test server/container (cgo build); skips otherwise. -func TestMissingJSONLIssueIDsInStore_IgnoresCompactedWisp(t *testing.T) { +func TestReconcileAutoExportJSONL_IgnoresCompactedWisp(t *testing.T) { if testDoltServerPort == 0 { t.Skip("Dolt test server not available") } @@ -85,11 +86,16 @@ func TestMissingJSONLIssueIDsInStore_IgnoresCompactedWisp(t *testing.T) { t.Fatal(err) } - missing, err := missingJSONLIssueIDsInStore(ctx, jsonlPath, "") + rec, err := reconcileAutoExportJSONL(ctx, jsonlPath, "") if err != nil { - t.Fatalf("missingJSONLIssueIDsInStore: %v", err) + t.Fatalf("reconcileAutoExportJSONL: %v", err) } - if len(missing) != 0 { - t.Fatalf("missing = %v, want empty (compacted wisp is out-of-scope and must not be a hard orphan)", missing) + if len(rec.unproven) != 0 { + t.Fatalf("unproven = %v, want empty (compacted wisp is out-of-scope and must not be a hard orphan)", rec.unproven) + } + // And it must be out of scope, not merely proven: an ephemeral row never + // reaches a proof source, so nothing about it is "reconciled" either. + if len(rec.provenDeleted) != 0 { + t.Fatalf("provenDeleted = %v, want empty (an out-of-scope wisp is never a candidate in the first place)", rec.provenDeleted) } } diff --git a/cmd/bd/export_auto_test.go b/cmd/bd/export_auto_test.go index b4fa1339c..b24596cbd 100644 --- a/cmd/bd/export_auto_test.go +++ b/cmd/bd/export_auto_test.go @@ -314,6 +314,18 @@ func (s *spyDiffStore) GetStateHash(ctx context.Context) (string, error) { return sh.GetStateHash(ctx) } +// Forwarded for the same reason as the two above: the spy hides the concrete +// store from UnwrapStore, so any capability it does not re-declare simply +// vanishes from the guard's point of view. Without this the orphan guard's +// history proof silently degrades to "unproven" under the spy (GH#5896). +func (s *spyDiffStore) HistoricalIssueIDs(ctx context.Context, ids []string) (map[string]struct{}, error) { + hp, ok := storage.UnwrapStore(s.DoltStorage).(storage.HistoryPresence) + if !ok { + return nil, fmt.Errorf("spyDiffStore: wrapped store does not implement HistoryPresence") + } + return hp.HistoricalIssueIDs(ctx, ids) +} + func autoExportTestDir(t *testing.T) string { t.Helper() dir := t.TempDir() @@ -1222,7 +1234,11 @@ func TestShouldExport(t *testing.T) { } } -func TestCountIssueRecordsInJSONL(t *testing.T) { +// TestIssueRecordsInJSONL_CountsAndOrdersInScopeIDs pins the parse the +// pre-export guards read: exactly one record per id, memories and tombstones +// and id-less lines skipped, sorted by id. Both guards now take their counts +// and their candidate list from this one call. +func TestIssueRecordsInJSONL_CountsAndOrdersInScopeIDs(t *testing.T) { tmpDir := t.TempDir() path := filepath.Join(tmpDir, "issues.jsonl") data := strings.Join([]string{ @@ -1238,20 +1254,19 @@ func TestCountIssueRecordsInJSONL(t *testing.T) { t.Fatal(err) } - got, err := countIssueRecordsInJSONL(path) + records, err := issueRecordsInJSONL(path) if err != nil { - t.Fatalf("countIssueRecordsInJSONL: %v", err) + t.Fatalf("issueRecordsInJSONL: %v", err) } - if got != 2 { - t.Fatalf("countIssueRecordsInJSONL = %d, want 2", got) + if len(records) != 2 { + t.Fatalf("issueRecordsInJSONL returned %d records, want 2: %v", len(records), records) } - - ids, err := issueIDsInJSONL(path) - if err != nil { - t.Fatalf("issueIDsInJSONL: %v", err) + ids := make([]string, len(records)) + for i, rec := range records { + ids[i] = rec.ID } if got := strings.Join(ids, ","); got != "bd-1,bd-2" { - t.Fatalf("issueIDsInJSONL = %q, want bd-1,bd-2", got) + t.Fatalf("issueRecordsInJSONL ids = %q, want bd-1,bd-2", got) } } @@ -1686,7 +1701,7 @@ func TestTryIncrementalExport_PatchesChangedIssuesAndDropsRemoved(t *testing.T) } c2 := h.mustCommit(t, ctx, "mutate") - issueCount, memoryCount, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil) + issueCount, memoryCount, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil, nil) if err != nil { t.Fatalf("tryIncrementalExport returned error: %v", err) } @@ -1742,7 +1757,7 @@ func TestTryIncrementalExport_DropsIssueWhenFlippedToTemplate(t *testing.T) { } c2 := h.mustCommit(t, ctx, "promote to template") - _, _, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil) + _, _, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil, nil) if err != nil { t.Fatalf("tryIncrementalExport: %v", err) } @@ -1770,7 +1785,7 @@ func TestTryIncrementalExport_FallsBackWhenFileMissing(t *testing.T) { // No existing file → must return didIncremental=false and leave the // disk untouched so the caller falls back to the full-export path. exportPath := filepath.Join(h.beadsDir, "issues.jsonl") - issueCount, _, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil) + issueCount, _, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil, nil) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -1810,7 +1825,7 @@ func TestTryIncrementalExport_ThresholdExceededFallsBack(t *testing.T) { h.mustCreateBatch(t, ctx, incrementalExportThreshold+1, "thr-") c2 := h.mustCommit(t, ctx, "flood") - _, _, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil) + _, _, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil, nil) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -1875,7 +1890,7 @@ func TestMaybeAutoExport_SecondRunTakesIncrementalPath_ServerMode(t *testing.T) } // Both ChangedIssueIDs call sites must have fired: the orphan guard's - // proof-of-deletion probe (missingJSONLIssueIDsInStore, which runs + // proof-of-deletion probe (reconcileAutoExportJSONL, which runs // because deleting e2e-b leaves it JSONL-only) and tryIncrementalExport's // own diff. A bare "called at least once" check is NOT sufficient and was // the PR #5806 round-5 review finding: the guard's own call satisfies it @@ -2055,7 +2070,7 @@ func TestTryIncrementalExport_NeverLeaksMemoriesIntoAutoExport(t *testing.T) { } c2 := h.mustCommit(t, ctx, "mutate") - _, memCount, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil) + _, memCount, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil, nil) if err != nil { t.Fatalf("tryIncrementalExport: %v", err) } @@ -2105,7 +2120,7 @@ func TestTryIncrementalExport_PreservesPreExistingMemoryAcrossPatch(t *testing.T } c2 := h.mustCommit(t, ctx, "mutate") - _, _, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil) + _, _, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil, nil) if err != nil { t.Fatalf("tryIncrementalExport: %v", err) } @@ -2206,7 +2221,7 @@ func TestTryIncrementalExport_ExcludesConfiguredOwnerFromPatchedIssues(t *testin } c2 := h.mustCommit(t, ctx, "mutate") - _, _, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil) + _, _, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil, nil) if err != nil { t.Fatalf("tryIncrementalExport: %v", err) } @@ -2239,7 +2254,7 @@ func TestTryIncrementalExport_PatchedLinesIncludeTypeField(t *testing.T) { } c2 := h.mustCommit(t, ctx, "mutate") - _, _, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil) + _, _, _, didIncremental, err := tryIncrementalExport(ctx, exportPath, c1, c2, nil, nil) if err != nil { t.Fatalf("tryIncrementalExport: %v", err) } diff --git a/cmd/bd/export_auto_wedge_heal_test.go b/cmd/bd/export_auto_wedge_heal_test.go new file mode 100644 index 000000000..609ce7115 --- /dev/null +++ b/cmd/bd/export_auto_wedge_heal_test.go @@ -0,0 +1,793 @@ +//go:build cgo + +package main + +import ( + "context" + "encoding/json" + "os" + "path/filepath" + "reflect" + "sort" + "strings" + "testing" + "time" + + "github.com/steveyegge/beads/internal/config" + "github.com/steveyegge/beads/internal/storage" + "github.com/steveyegge/beads/internal/types" +) + +// These tests cover GH#5896: `bd delete` used to leave a JSONL-only issue id +// that no pre-export guard could account for, so auto-export refused, never +// saved state, and refused again on every later command — forever, with the +// documented recovery (`bd init --from-jsonl`) undoing the delete. +// +// They run against a fake store that models EMBEDDED mode's capability set — +// the default open path, and the one the in-window #5806 fix could not reach: +// no StateHasher, no DiffStore, but CommitExists and (new) HistoryPresence. +// That is the same deliberate split TestMaybeAutoExport_EmbeddedModeFallsBack +// CleanlyToFullExport makes: what these assert is the GUARD's wiring — which +// proof sources it consults, what it does with the answers, what reaches the +// file — while the capability's own semantics against a real Dolt engine are +// pinned by the cross-store contract in internal/storage/storagecontract. + +// fakeEmbeddedStore models EmbeddedDoltStore's capability surface for +// auto-export: HEAD-only change detection, no dolt_diff, but able to answer +// "was this id ever in my history". +type fakeEmbeddedStore struct { + storage.DoltStorage + issues []*types.Issue + historical map[string]bool + // knownCommits is what CommitExists says yes to. An anchor that isn't + // here models a rewind, a squash, or a state file from another clone. + knownCommits map[string]bool + headCommit string + + // historyAsked records every id handed to HistoricalIssueIDs, so a test + // can assert what the guard did NOT ask about. + historyAsked []string + historyCalls int + historyFailed bool +} + +func (f *fakeEmbeddedStore) GetCurrentCommit(_ context.Context) (string, error) { + if f.headCommit == "" { + return "head-1", nil + } + return f.headCommit, nil +} + +func (f *fakeEmbeddedStore) GetInfraTypes(_ context.Context) map[string]bool { return nil } + +func (f *fakeEmbeddedStore) GetConfig(_ context.Context, _ string) (string, error) { + return "", nil +} + +func (f *fakeEmbeddedStore) SearchIssues(_ context.Context, _ string, _ types.IssueFilter) ([]*types.Issue, error) { + return f.issues, nil +} + +func (f *fakeEmbeddedStore) GetLabelsForIssues(_ context.Context, _ []string) (map[string][]string, error) { + return nil, nil +} + +func (f *fakeEmbeddedStore) GetDependencyRecordsForIssues(_ context.Context, _ []string) (map[string][]*types.Dependency, error) { + return nil, nil +} + +func (f *fakeEmbeddedStore) GetCommentsForIssues(_ context.Context, _ []string) (map[string][]*types.Comment, error) { + return nil, nil +} + +func (f *fakeEmbeddedStore) GetCommentCounts(_ context.Context, _ []string) (map[string]int, error) { + return nil, nil +} + +func (f *fakeEmbeddedStore) GetDependencyCounts(_ context.Context, _ []string) (map[string]*types.DependencyCounts, error) { + return nil, nil +} + +func (f *fakeEmbeddedStore) CommitExists(_ context.Context, hash string) (bool, error) { + return f.knownCommits[hash], nil +} + +func (f *fakeEmbeddedStore) HistoricalIssueIDs(_ context.Context, ids []string) (map[string]struct{}, error) { + f.historyCalls++ + f.historyAsked = append(f.historyAsked, ids...) + if f.historyFailed { + return nil, context.DeadlineExceeded + } + present := make(map[string]struct{}) + for _, id := range ids { + if f.historical[id] { + present[id] = struct{}{} + } + } + return present, nil +} + +// deleteFromStore removes an id from the store's live rows the way a hard +// delete does, leaving its history intact. +func (f *fakeEmbeddedStore) deleteFromStore(id string) { + kept := f.issues[:0] + for _, iss := range f.issues { + if iss.ID != id { + kept = append(kept, iss) + } + } + f.issues = kept +} + +// fakeHistorylessStore is fakeEmbeddedStore without HistoryPresence: the +// degradation case (an older or third-party store), and the fixture the P1 +// handoff test needs so nothing but the handoff can prove anything. +type fakeHistorylessStore struct { + *fakeEmbeddedStore +} + +func (f *fakeHistorylessStore) HistoricalIssueIDs(context.Context, []string) (map[string]struct{}, error) { + panic("HistoryPresence must not be reached on a store that does not implement it") +} + +func newWedgeHealTestStore(t *testing.T, issues ...*types.Issue) *fakeEmbeddedStore { + t.Helper() + historical := make(map[string]bool, len(issues)) + for _, iss := range issues { + historical[iss.ID] = true + } + return &fakeEmbeddedStore{ + issues: issues, + historical: historical, + knownCommits: map[string]bool{}, + headCommit: "head-1", + } +} + +func wedgeHealIssue(id, title string) *types.Issue { + return &types.Issue{ + ID: id, + Title: title, + Status: types.StatusOpen, + Priority: 2, + IssueType: types.TypeTask, + } +} + +// setupWedgeHealTest wires config, globals and a .beads dir, and returns the +// beads dir plus the export path. +func setupWedgeHealTest(t *testing.T, store2 storage.DoltStorage) (beadsDir, exportPath string) { + t.Helper() + initConfigForTest(t) + config.Set("export.auto", true) + // The throttle is not what these tests are about, and a 1ms interval is + // long enough to swallow a second export that lands in the same + // millisecond as the first. + config.Set("export.interval", "1ns") + + saveAndRestoreGlobals(t) + dir := autoExportTestDir(t) + store = store2 + storeMutex.Lock() + storeActive = true + storeMutex.Unlock() + t.Cleanup(func() { + storeMutex.Lock() + storeActive = false + storeMutex.Unlock() + }) + + beadsDir = filepath.Join(dir, ".beads") + return beadsDir, filepath.Join(beadsDir, "issues.jsonl") +} + +func jsonlIDs(t *testing.T, path string) []string { + t.Helper() + records, err := issueRecordsInJSONL(path) + if err != nil { + t.Fatalf("issueRecordsInJSONL(%s): %v", path, err) + } + ids := make([]string, len(records)) + for i, rec := range records { + ids[i] = rec.ID + } + sort.Strings(ids) + return ids +} + +// writeWedgedExportState writes the on-disk state a pre-fix binary leaves +// behind: a last-seen commit, an open throttle window, and whatever anchor +// the caller wants to model. +func writeWedgedExportState(t *testing.T, beadsDir, lastCommit, anchor string) { + t.Helper() + saveExportAutoState(beadsDir, &exportAutoState{ + LastDoltCommit: lastCommit, + LastDiffAnchor: anchor, + Timestamp: time.Time{}, + Issues: 2, + }) +} + +// TestMaybeAutoExport_DeleteHealsInsteadOfWedging_Embedded is the issue's own +// repro on the default backend: create → export → delete → export must +// SUCCEED and the export must reflect the deletion. +func TestMaybeAutoExport_DeleteHealsInsteadOfWedging_Embedded(t *testing.T) { + fake := newWedgeHealTestStore(t, + wedgeHealIssue("wh-a", "Alpha"), + wedgeHealIssue("wh-b", "Beta"), + ) + beadsDir, exportPath := setupWedgeHealTest(t, fake) + + if err := maybeAutoExport(context.Background(), false); err != nil { + t.Fatalf("first maybeAutoExport: %v", err) + } + if got, want := jsonlIDs(t, exportPath), []string{"wh-a", "wh-b"}; strings.Join(got, ",") != strings.Join(want, ",") { + t.Fatalf("setup: exported ids = %v, want %v", got, want) + } + + // Delete wh-b the way a pre-existing store would have it — gone from the + // live rows, still in history — and touch wh-a so the test can also tell + // a healed export from a skipped one by its CONTENT. + fake.deleteFromStore("wh-b") + fake.issues[0].Title = "Alpha renamed" + fake.headCommit = "head-2" + + stderr := captureStderr(t, func() { + if err := maybeAutoExport(context.Background(), false); err != nil { + t.Fatalf("second maybeAutoExport: %v", err) + } + }) + + if got, want := jsonlIDs(t, exportPath), []string{"wh-a"}; strings.Join(got, ",") != strings.Join(want, ",") { + t.Errorf("after delete, exported ids = %v, want %v — the deletion was not reflected", got, want) + } + if titles := loadIssueTitles(t, exportPath); titles["wh-a"] != "Alpha renamed" { + t.Errorf("wh-a title = %q, want %q — the export was skipped, not healed", titles["wh-a"], "Alpha renamed") + } + if state := loadExportAutoState(beadsDir); state.LastDoltCommit != "head-2" { + t.Errorf("LastDoltCommit = %q, want %q — state must advance or the next command wedges on the same comparison", state.LastDoltCommit, "head-2") + } + if !strings.Contains(stderr, "wh-b") || !strings.Contains(stderr, "reconciled") { + t.Errorf("stderr = %q, want a heal notice naming wh-b", stderr) + } + if strings.Contains(stderr, "refusing to overwrite") { + t.Errorf("stderr = %q, want no refusal", stderr) + } +} + +// TestMaybeAutoExport_DeleteLastIssueHealsEmptyGuard covers the trap the +// single-issue repro actually hits: with nothing left in the store, the +// EMPTY-OVERWRITE guard fires before the orphan guard, and refuses on "0 +// issues vs 1 record" unless it too knows the record is a proven deletion. +func TestMaybeAutoExport_DeleteLastIssueHealsEmptyGuard(t *testing.T) { + fake := newWedgeHealTestStore(t, wedgeHealIssue("wh-only", "The only one")) + beadsDir, exportPath := setupWedgeHealTest(t, fake) + + if err := maybeAutoExport(context.Background(), false); err != nil { + t.Fatalf("first maybeAutoExport: %v", err) + } + if got := jsonlIDs(t, exportPath); len(got) != 1 { + t.Fatalf("setup: exported ids = %v, want exactly wh-only", got) + } + + fake.deleteFromStore("wh-only") + fake.headCommit = "head-2" + + stderr := captureStderr(t, func() { + if err := maybeAutoExport(context.Background(), false); err != nil { + t.Fatalf("second maybeAutoExport: %v", err) + } + }) + + if strings.Contains(stderr, "would export 0 issues") { + t.Fatalf("empty-overwrite guard refused a fully-proven deletion: %q", stderr) + } + if _, err := os.Stat(exportPath); !os.IsNotExist(err) { + t.Errorf("issues.jsonl still exists after the last issue was deleted (stat err = %v); the empty export removes the file", err) + } + if state := loadExportAutoState(beadsDir); state.LastDoltCommit != "head-2" { + t.Errorf("LastDoltCommit = %q, want %q", state.LastDoltCommit, "head-2") + } +} + +// TestMaybeAutoExport_PreWedgedStoreRecovers is the upgrade path: the delete +// already happened under a binary that had no proof for it, so there is no +// in-process handoff to lean on and the anchor is useless. The first export +// under this code must heal anyway, from history alone. +func TestMaybeAutoExport_PreWedgedStoreRecovers(t *testing.T) { + for _, tc := range []struct { + name string + anchor string + }{ + // R4: the state file was lost, or no export ever succeeded. + {name: "AnchorLost", anchor: ""}, + // R2 stand-in: a well-formed anchor that no longer resolves, as + // after a history squash, a GC, or a branch checkout. + {name: "AnchorNoLongerResolves", anchor: "abcdefghijklmnopqrstuvwxyz012345"}, + } { + t.Run(tc.name, func(t *testing.T) { + // The store never knew wh-b as a live row in this process; only + // its history remembers it. That IS the pre-fix on-disk shape. + fake := newWedgeHealTestStore(t, wedgeHealIssue("wh-a", "Alpha")) + fake.historical["wh-b"] = true + beadsDir, exportPath := setupWedgeHealTest(t, fake) + + writeJSONLLines(t, exportPath, + map[string]any{"_type": "issue", "id": "wh-a", "title": "Alpha", "issue_type": "task"}, + map[string]any{"_type": "issue", "id": "wh-b", "title": "Beta", "issue_type": "task"}, + ) + writeWedgedExportState(t, beadsDir, "head-0", tc.anchor) + + stderr := captureStderr(t, func() { + if err := maybeAutoExport(context.Background(), false); err != nil { + t.Fatalf("maybeAutoExport: %v", err) + } + }) + + if strings.Contains(stderr, "refusing to overwrite") { + t.Fatalf("still wedged: %q", stderr) + } + if got, want := jsonlIDs(t, exportPath), []string{"wh-a"}; strings.Join(got, ",") != strings.Join(want, ",") { + t.Errorf("exported ids = %v, want %v", got, want) + } + if !strings.Contains(stderr, "wh-b") { + t.Errorf("stderr = %q, want a heal notice naming wh-b", stderr) + } + if state := loadExportAutoState(beadsDir); state.LastDoltCommit != "head-1" { + t.Errorf("LastDoltCommit = %q, want head-1 (state must be re-saved or the wedge survives the upgrade)", state.LastDoltCommit) + } + }) + } +} + +// TestMaybeAutoExport_UnprovableJSONLIDStillRefuses is the fail-safe half. +// An id this store has no history of is indistinguishable from GH#4988's torn +// or replaced store, and must keep refusing with the unchanged message — +// including after a rewind, where the id's commits are no longer reachable +// from HEAD and so are no longer in dolt_history_issues. +func TestMaybeAutoExport_UnprovableJSONLIDStillRefuses(t *testing.T) { + for _, tc := range []struct { + name string + anchor string + }{ + {name: "NeverExisted", anchor: ""}, + {name: "RewoundAwayWithStaleAnchor", anchor: "abcdefghijklmnopqrstuvwxyz012345"}, + } { + t.Run(tc.name, func(t *testing.T) { + fake := newWedgeHealTestStore(t, wedgeHealIssue("wh-a", "Alpha")) + beadsDir, exportPath := setupWedgeHealTest(t, fake) + + writeJSONLLines(t, exportPath, + map[string]any{"_type": "issue", "id": "wh-a", "title": "Alpha", "issue_type": "task"}, + map[string]any{"_type": "issue", "id": "wh-ghost", "title": "Ghost", "issue_type": "task"}, + ) + writeWedgedExportState(t, beadsDir, "head-0", tc.anchor) + + stderr := captureStderr(t, func() { + if err := maybeAutoExport(context.Background(), false); err != nil { + t.Fatalf("maybeAutoExport: %v", err) + } + }) + + if !strings.Contains(stderr, "refusing to overwrite") { + t.Errorf("stderr = %q, want the unchanged orphan refusal", stderr) + } + if !strings.Contains(stderr, "wh-ghost") { + t.Errorf("stderr = %q, want the refusal to name wh-ghost", stderr) + } + if got := jsonlIDs(t, exportPath); len(got) != 2 { + t.Errorf("exported ids = %v, want both records preserved — an unprovable divergence must never lose a line", got) + } + if state := loadExportAutoState(beadsDir); state.LastDoltCommit != "head-0" { + t.Errorf("LastDoltCommit = %q, want head-0 (a refusal must not advance state)", state.LastDoltCommit) + } + }) + } +} + +// TestMaybeAutoExport_HistoryProofFailureRefuses: a store that cannot answer +// the history question is not a store that answered "no". The guard must fall +// back to refusing, not to overwriting. +func TestMaybeAutoExport_HistoryProofFailureRefuses(t *testing.T) { + fake := newWedgeHealTestStore(t, wedgeHealIssue("wh-a", "Alpha")) + fake.historical["wh-b"] = true + fake.historyFailed = true + beadsDir, exportPath := setupWedgeHealTest(t, fake) + + writeJSONLLines(t, exportPath, + map[string]any{"_type": "issue", "id": "wh-a", "title": "Alpha", "issue_type": "task"}, + map[string]any{"_type": "issue", "id": "wh-b", "title": "Beta", "issue_type": "task"}, + ) + writeWedgedExportState(t, beadsDir, "head-0", "") + + stderr := captureStderr(t, func() { + if err := maybeAutoExport(context.Background(), false); err != nil { + t.Fatalf("maybeAutoExport: %v", err) + } + }) + + if !strings.Contains(stderr, "refusing to overwrite") { + t.Errorf("stderr = %q, want a refusal when the history proof itself failed", stderr) + } + if got := jsonlIDs(t, exportPath); len(got) != 2 { + t.Errorf("exported ids = %v, want both records preserved", got) + } +} + +// TestMaybeAutoExport_DeleteHandoffProvesWhatHistoryCannot covers the one +// shape no store-side proof can ever reach: an issue created AND deleted +// without either write reaching a commit. The in-process handoff from +// deleteBatch is the only witness, and the store here has no HistoryPresence +// at all, so nothing else can cover for it. +func TestMaybeAutoExport_DeleteHandoffProvesWhatHistoryCannot(t *testing.T) { + inner := newWedgeHealTestStore(t, wedgeHealIssue("wh-a", "Alpha")) + fake := &fakeHistorylessStore{fakeEmbeddedStore: inner} + beadsDir, exportPath := setupWedgeHealTest(t, fake) + + writeJSONLLines(t, exportPath, + map[string]any{"_type": "issue", "id": "wh-a", "title": "Alpha", "issue_type": "task"}, + map[string]any{"_type": "issue", "id": "wh-uncommitted", "title": "Never committed", "issue_type": "task"}, + ) + writeWedgedExportState(t, beadsDir, "head-0", "") + + commandDeletedIssueIDs.reset() + t.Cleanup(commandDeletedIssueIDs.reset) + commandDeletedIssueIDs.add("wh-uncommitted") + + stderr := captureStderr(t, func() { + if err := maybeAutoExport(context.Background(), false); err != nil { + t.Fatalf("maybeAutoExport: %v", err) + } + }) + + if strings.Contains(stderr, "refusing to overwrite") { + t.Fatalf("the delete handoff did not prove the deletion: %q", stderr) + } + if got, want := jsonlIDs(t, exportPath), []string{"wh-a"}; strings.Join(got, ",") != strings.Join(want, ",") { + t.Errorf("exported ids = %v, want %v", got, want) + } +} + +// TestMaybeAutoExport_ScopeSkipsNeverReachAProofSource: out-of-scope JSONL +// rows (ephemeral wisps, templates, infra types) are not candidates in the +// first place — GH#4988's own fix — so they must not cost a history query +// either. +func TestMaybeAutoExport_ScopeSkipsNeverReachAProofSource(t *testing.T) { + fake := newWedgeHealTestStore(t, wedgeHealIssue("wh-a", "Alpha")) + _, exportPath := setupWedgeHealTest(t, fake) + + writeJSONLLines(t, exportPath, + map[string]any{"_type": "issue", "id": "wh-a", "title": "Alpha", "issue_type": "task"}, + map[string]any{"_type": "issue", "id": "wh-wisp", "title": "Compacted wisp", "issue_type": "task", "ephemeral": true}, + map[string]any{"_type": "issue", "id": "wh-tpl", "title": "Template", "issue_type": "task", "is_template": true}, + ) + + rec, err := reconcileAutoExportJSONL(context.Background(), exportPath, "") + if err != nil { + t.Fatalf("reconcileAutoExportJSONL: %v", err) + } + if len(rec.unproven) != 0 || len(rec.provenDeleted) != 0 { + t.Errorf("unproven = %v, provenDeleted = %v, want both empty", rec.unproven, rec.provenDeleted) + } + if fake.historyCalls != 0 { + t.Errorf("HistoricalIssueIDs called %d times with %v; out-of-scope rows must never reach a proof source", fake.historyCalls, fake.historyAsked) + } + if rec.jsonlIssueCount != 3 { + t.Errorf("jsonlIssueCount = %d, want 3 (the empty-overwrite guard counts every record, in scope or not)", rec.jsonlIssueCount) + } +} + +// TestProveDeletedIssueIDs_HistoryProofIsCapped: past the cap, a divergence is +// not a delete pattern, and the guard refuses without paying for the scan. +func TestProveDeletedIssueIDs_HistoryProofIsCapped(t *testing.T) { + fake := newWedgeHealTestStore(t) + setupWedgeHealTest(t, fake) + + candidates := make([]string, historyProofMaxCandidates+1) + for i := range candidates { + candidates[i] = "wh-" + string(rune('a'+i%26)) + string(rune('0'+i/26)) + fake.historical[candidates[i]] = true + } + + proven, unproven := proveDeletedIssueIDs(context.Background(), candidates, "") + if len(proven) != 0 { + t.Errorf("proven = %d ids, want 0 past the cap", len(proven)) + } + if len(unproven) != len(candidates) { + t.Errorf("unproven = %d ids, want all %d", len(unproven), len(candidates)) + } + if fake.historyCalls != 0 { + t.Errorf("HistoricalIssueIDs called %d times; past the cap the guard must not ask", fake.historyCalls) + } +} + +// TestExportAutoState_VersionRoundTripAndFutureDiscard is the GH#5896 R5 +// acceptance: today's unversioned files load unchanged, a file from a future +// binary is discarded rather than reinterpreted, and — the part that makes +// discarding safe at all — discarding does not wedge, because the deletion +// proofs no longer need the anchor it threw away. +func TestExportAutoState_VersionRoundTripAndFutureDiscard(t *testing.T) { + t.Run("StampsTheCurrentVersion", func(t *testing.T) { + dir := t.TempDir() + saveExportAutoState(dir, &exportAutoState{LastDoltCommit: "c1", LastDiffAnchor: "a1"}) + + data, err := os.ReadFile(filepath.Join(dir, exportAutoStateFile)) + if err != nil { + t.Fatalf("read state: %v", err) + } + var raw map[string]any + if err := json.Unmarshal(data, &raw); err != nil { + t.Fatalf("unmarshal state: %v", err) + } + if got := raw["v"]; got != float64(exportAutoStateVersion) { + t.Errorf("state file v = %v, want %d", got, exportAutoStateVersion) + } + + state := loadExportAutoState(dir) + if state.LastDoltCommit != "c1" || state.LastDiffAnchor != "a1" { + t.Errorf("round trip lost fields: %+v", state) + } + }) + + t.Run("LoadsAnUnversionedFileAsIs", func(t *testing.T) { + dir := t.TempDir() + legacy := `{"last_dolt_commit":"c1","last_diff_anchor":"a1","issues":7}` + if err := os.WriteFile(filepath.Join(dir, exportAutoStateFile), []byte(legacy), 0o600); err != nil { + t.Fatal(err) + } + state := loadExportAutoState(dir) + if state.LastDoltCommit != "c1" || state.LastDiffAnchor != "a1" || state.Issues != 7 { + t.Errorf("pre-versioning state file did not load as-is: %+v", state) + } + }) + + t.Run("DiscardsAFutureVersionWithoutWedging", func(t *testing.T) { + fake := newWedgeHealTestStore(t, wedgeHealIssue("wh-a", "Alpha")) + fake.historical["wh-b"] = true + beadsDir, exportPath := setupWedgeHealTest(t, fake) + + writeJSONLLines(t, exportPath, + map[string]any{"_type": "issue", "id": "wh-a", "title": "Alpha", "issue_type": "task"}, + map[string]any{"_type": "issue", "id": "wh-b", "title": "Beta", "issue_type": "task"}, + ) + future := `{"v":999,"last_dolt_commit":"head-1","last_diff_anchor":"future-anchor"}` + if err := os.WriteFile(filepath.Join(beadsDir, exportAutoStateFile), []byte(future), 0o600); err != nil { + t.Fatal(err) + } + if state := loadExportAutoState(beadsDir); state.LastDoltCommit != "" || state.LastDiffAnchor != "" { + t.Fatalf("future-version state was not discarded: %+v", state) + } + + // Discarding drops the anchor AND the last-seen commit, so this run + // looks like a cold start with a stale JSONL — pre-#5896 the exact + // R4 permanent wedge. It must export and re-anchor instead. + stderr := captureStderr(t, func() { + if err := maybeAutoExport(context.Background(), false); err != nil { + t.Fatalf("maybeAutoExport: %v", err) + } + }) + if strings.Contains(stderr, "refusing to overwrite") { + t.Fatalf("discarding a future-version state file wedged the export: %q", stderr) + } + if got, want := jsonlIDs(t, exportPath), []string{"wh-a"}; strings.Join(got, ",") != strings.Join(want, ",") { + t.Errorf("exported ids = %v, want %v", got, want) + } + state := loadExportAutoState(beadsDir) + if state.FormatVersion != exportAutoStateVersion || state.LastDoltCommit != "head-1" { + t.Errorf("state after re-anchor = %+v, want v%d at head-1", state, exportAutoStateVersion) + } + }) +} + +// The tests below run against a REAL DoltStore over the test sql-server — +// server mode, where the store does implement DiffStore and the incremental +// path is live. What the fake-store tests cannot reach is exactly what these +// are for: dolt_history_issues answering for itself, and proven-deleted ids +// having to survive a dolt_diff-driven incremental PATCH rather than a full +// rewrite from the store. + +// TestMaybeAutoExport_DeleteHealsInsteadOfWedging_ServerMode is the issue's +// repro on the server-backed store, with the anchor deliberately blanked so +// the #5806 anchor-diff proof cannot fire and the history proof has to carry +// it — the R2/R4 residue this fix is for. +func TestMaybeAutoExport_DeleteHealsInsteadOfWedging_ServerMode(t *testing.T) { + h, ctx := setupIncrementalExportTest(t) + initConfigForTest(t) + config.Set("export.auto", true) + config.Set("export.interval", "1ns") + + h.mustCreate(t, ctx, "sw-a", "Alpha") + h.mustCreate(t, ctx, "sw-b", "Beta") + h.mustCommit(t, ctx, "baseline") + if err := maybeAutoExport(ctx, false); err != nil { + t.Fatalf("first maybeAutoExport: %v", err) + } + exportPath := filepath.Join(h.beadsDir, "issues.jsonl") + if got := countIssueLines(t, exportPath); got != 2 { + t.Fatalf("setup: %d issue lines, want 2", got) + } + + // Delete through the store directly — no in-process handoff — and blank + // the anchor, which is what a squashed history or a lost state file + // leaves behind. Only dolt_history_issues can answer now. + if err := h.store.DeleteIssue(ctx, "sw-b"); err != nil { + t.Fatalf("DeleteIssue: %v", err) + } + h.mustCommit(t, ctx, "delete sw-b") + state := loadExportAutoState(h.beadsDir) + state.LastDiffAnchor = "" + state.Timestamp = time.Time{} + saveExportAutoState(h.beadsDir, state) + + stderr := captureStderr(t, func() { + if err := maybeAutoExport(ctx, false); err != nil { + t.Fatalf("second maybeAutoExport: %v", err) + } + }) + + if strings.Contains(stderr, "refusing to overwrite") { + t.Fatalf("still wedged on the server-backed store: %q", stderr) + } + if got, want := jsonlIDs(t, exportPath), []string{"sw-a"}; strings.Join(got, ",") != strings.Join(want, ",") { + t.Errorf("exported ids = %v, want %v", got, want) + } + if !strings.Contains(stderr, "sw-b") { + t.Errorf("stderr = %q, want a heal notice naming sw-b", stderr) + } + if loadExportAutoState(h.beadsDir).LastDiffAnchor == "" { + t.Error("the export re-anchored to nothing; the next cycle would take the same anchorless path forever") + } +} + +// TestMaybeAutoExport_ProvenDeletionReachesTheIncrementalPatch is plumbing +// consequence #1, and the one that fails SILENTLY if missed: the guard can +// clear the export while the incremental patch still carries the deleted +// record forward, because a row absent at BOTH diff endpoints produces no +// diff row at all. +// +// The setup makes that shape exactly: sx-x is created and deleted entirely +// AFTER the anchor, so dolt_diff(anchor, WORKING) never mentions it, while +// sx-y is modified so the run genuinely stays on the incremental path. +func TestMaybeAutoExport_ProvenDeletionReachesTheIncrementalPatch(t *testing.T) { + h, ctx := setupIncrementalExportTest(t) + initConfigForTest(t) + config.Set("export.auto", true) + config.Set("export.interval", "1ns") + + spy := &spyDiffStore{DoltStorage: h.store} + store = spy + + h.mustCreate(t, ctx, "sx-y", "Yankee") + h.mustCommit(t, ctx, "baseline") + if err := maybeAutoExport(ctx, false); err != nil { + t.Fatalf("first maybeAutoExport: %v", err) + } + exportPath := filepath.Join(h.beadsDir, "issues.jsonl") + anchor := loadExportAutoState(h.beadsDir).LastDiffAnchor + if anchor == "" { + t.Fatal("setup: no diff anchor recorded, the incremental path can't be under test") + } + + // sx-x exists only between two commits that both come after the anchor, + // and its JSONL line is written by an export that ran while it was live. + h.mustCreate(t, ctx, "sx-x", "X-ray") + h.mustCommit(t, ctx, "add sx-x") + if err := maybeAutoExport(ctx, false); err != nil { + t.Fatalf("second maybeAutoExport: %v", err) + } + if _, ok := loadIssueTitles(t, exportPath)["sx-x"]; !ok { + t.Fatalf("setup: sx-x must be in the export before it is deleted") + } + // Pin the anchor back to before sx-x ever existed. Now the diff's two + // endpoints both lack it, exactly like a create+delete inside one + // throttle window. + state := loadExportAutoState(h.beadsDir) + state.LastDiffAnchor = anchor + state.Timestamp = time.Time{} + saveExportAutoState(h.beadsDir, state) + + if err := h.store.DeleteIssue(ctx, "sx-x"); err != nil { + t.Fatalf("DeleteIssue: %v", err) + } + h.mustCommit(t, ctx, "delete sx-x") + if err := h.store.UpdateIssue(ctx, "sx-y", map[string]interface{}{"title": "Yankee renamed"}, "tester"); err != nil { + t.Fatalf("UpdateIssue: %v", err) + } + + if err := maybeAutoExport(ctx, false); err != nil { + t.Fatalf("third maybeAutoExport: %v", err) + } + + // LastDirtyIDs reaches state only from a successful incremental patch — + // the full-export fallback nils it — and sx-y is the only upserted id, so + // exactly {sx-y} is what says "this run was incremental AND it ran". + if got, want := loadExportAutoState(h.beadsDir).LastDirtyIDs, []string{"sx-y"}; !reflect.DeepEqual(got, want) { + t.Fatalf("LastDirtyIDs = %v, want %v — the run was skipped or fell back to a full export, and this test only means something on the incremental path", got, want) + } + titles := loadIssueTitles(t, exportPath) + if _, stillThere := titles["sx-x"]; stillThere { + t.Error("sx-x survived the incremental patch: a deletion proven outside dolt_diff never reached the file as a forced removal") + } + if titles["sx-y"] != "Yankee renamed" { + t.Errorf("sx-y title = %q, want %q", titles["sx-y"], "Yankee renamed") + } + + // Content-equivalence control: an incrementally-patched file must describe + // the same issue set, field for field, as a fresh full export of the same + // state — including in what it OMITS. + controlPath := filepath.Join(t.TempDir(), "control.jsonl") + if _, _, err := exportToFile(ctx, controlPath, false); err != nil { + t.Fatalf("control exportToFile: %v", err) + } + got := jsonlRecordsByID(t, exportPath) + want := jsonlRecordsByID(t, controlPath) + if len(got) != len(want) { + t.Fatalf("incremental export has %d records, control full export has %d", len(got), len(want)) + } + for id, wantRec := range want { + gotRec, ok := got[id] + if !ok { + t.Errorf("record %s present in control export, missing from incremental export", id) + continue + } + if !reflect.DeepEqual(gotRec, wantRec) { + t.Errorf("record %s differs between incremental and full export:\n incremental: %v\n full: %v", id, gotRec, wantRec) + } + } +} + +// TestMaybeAutoExport_HistoryProofDoesNotSurviveARewind is the safety sibling +// of TestMaybeAutoExport_HistoryRewindDoesNotProveDeletion, aimed at the new +// proof source rather than the anchor one. After a hard reset past an id's +// creation, dolt_history_issues no longer reaches those commits, so the +// history proof must come up empty and the guard must keep refusing — with +// the line still in the file. +func TestMaybeAutoExport_HistoryProofDoesNotSurviveARewind(t *testing.T) { + h, ctx := setupIncrementalExportTest(t) + initConfigForTest(t) + config.Set("export.auto", true) + config.Set("export.interval", "1ns") + + h.mustCreate(t, ctx, "sr-a", "Alpha") + c1 := h.mustCommit(t, ctx, "baseline") + if err := maybeAutoExport(ctx, false); err != nil { + t.Fatalf("first maybeAutoExport: %v", err) + } + exportPath := filepath.Join(h.beadsDir, "issues.jsonl") + + h.mustCreate(t, ctx, "sr-x", "Rewound") + h.mustCommit(t, ctx, "add sr-x") + if err := maybeAutoExport(ctx, false); err != nil { + t.Fatalf("second maybeAutoExport: %v", err) + } + if titles := loadIssueTitles(t, exportPath); titles["sr-x"] != "Rewound" { + t.Fatalf("setup: sr-x must be exported before the rewind, got %v", titles) + } + + raw, ok := storage.UnwrapStore(h.store).(storage.RawDBAccessor) + if !ok { + t.Skip("store does not expose raw DB access") + } + if _, err := raw.DB().ExecContext(ctx, "CALL DOLT_RESET('--hard', ?)", c1); err != nil { + t.Fatalf("CALL DOLT_RESET('--hard', %s): %v", c1, err) + } + // Blank the anchor so the anchor-diff proof cannot even be consulted: + // whatever happens next is the history proof's answer alone. + state := loadExportAutoState(h.beadsDir) + state.LastDiffAnchor = "" + state.Timestamp = time.Time{} + saveExportAutoState(h.beadsDir, state) + + stderr := captureStderr(t, func() { + if err := maybeAutoExport(ctx, false); err != nil { + t.Fatalf("third maybeAutoExport: %v", err) + } + }) + + if !strings.Contains(stderr, "refusing to overwrite") { + t.Errorf("stderr = %q, want the unchanged refusal: a rewound-away id is data this store LOST, not a deletion it recorded", stderr) + } + if _, stillThere := loadIssueTitles(t, exportPath)["sr-x"]; !stillThere { + t.Error("sr-x was silently dropped from issues.jsonl after a history rewind: the history proof accepted a rewound-away row as a proven deletion") + } +} diff --git a/cmd/bd/flatten.go b/cmd/bd/flatten.go index 4e7a26d7e..9261e1001 100644 --- a/cmd/bd/flatten.go +++ b/cmd/bd/flatten.go @@ -27,7 +27,13 @@ This uses the Tim Sehn recipe: 4. Swap main branch to the new flattened branch 5. Prune remote-tracking refs (they would keep the old history alive; the next push or fetch re-creates them at the new tip) - 6. Run Dolt GC to reclaim space from old history + 6. Run a full Dolt GC (all storage generations) to reclaim the old history + +The GC pass is a full collection: Dolt storage is generational, and a default +GC never revisits data an earlier GC moved to the old generation. On any store +that has been GC'd before (bd gc, or a previous flatten or compact), only a +full collection reclaims the squashed history. A full GC can take minutes on +multi-gigabyte stores. This is irreversible — all commit history is lost. The resulting database has exactly one commit containing all current data. @@ -143,11 +149,7 @@ Examples: printPruneReport(pruned, tags) } - if gc, ok := storage.UnwrapStore(store).(storage.GarbageCollector); ok { - if err := gc.DoltGC(ctx); err != nil { - WarnError("dolt gc after flatten failed: %v", err) - } - } + gcMode := runPostRewriteGC(ctx, "flatten") sizeAfter := storeSizeBytes(ctx) elapsed := time.Since(start) @@ -161,6 +163,9 @@ Examples: "tags_anchoring": tags, "elapsed_ms": elapsed.Milliseconds(), } + if gcMode != "" { + result["gc_mode"] = gcMode + } addGCSizeJSON(result, sizeBefore, sizeAfter) return outputJSON(result) } diff --git a/cmd/bd/gc.go b/cmd/bd/gc.go index 3a2a611f8..1914128c5 100644 --- a/cmd/bd/gc.go +++ b/cmd/bd/gc.go @@ -16,6 +16,7 @@ var ( gcOlderThan int gcSkipDecay bool gcSkipDolt bool + gcFull bool ) var gcCmd = &cobra.Command{ @@ -32,12 +33,19 @@ Runs three phases in sequence: Each phase can be skipped individually. Use --dry-run to preview all phases without making changes. +Phase 3 runs Dolt's default, generational GC: it only examines data written +since the last GC. Data that survived an earlier GC lives in the old generation +and is never revisited, so on a long-lived store the space freed by decay may +not be reclaimed. Use --full to collect all generations (slower on large +stores). + Examples: bd gc # Full GC with defaults (90 day decay) bd gc --dry-run # Preview what would happen bd gc --older-than 30 # Decay issues closed 30+ days ago bd gc --skip-decay # Skip issue deletion, just compact+GC bd gc --skip-dolt # Skip Dolt GC, just decay+compact + bd gc --full # Collect all storage generations bd gc --force # Skip confirmation prompt`, SilenceUsage: true, SilenceErrors: true, @@ -190,7 +198,11 @@ Examples: results = append(results, phaseResult{name: "Dolt GC", detail: "not supported"}) } else if gcDryRun { if !jsonOutput { - fmt.Println(" Would run DOLT_GC()") + if gcFull { + fmt.Println(" Would run a full DOLT_GC() (all storage generations)") + } else { + fmt.Println(" Would run DOLT_GC()") + } } results = append(results, phaseResult{name: "Dolt GC", detail: "dry-run"}) } else { @@ -200,7 +212,11 @@ Examples: // (bd-agctw). Sizes are reported so a no-op reclaim is visible. sizeBefore := storeSizeBytes(ctx) remoteRefs, tags := listRemoteRefsAndTags(ctx) - if err := gc.DoltGC(ctx); err != nil { + if gcFull && !jsonOutput { + fmt.Println(" Running full Dolt GC (all generations; can take minutes on large stores)...") + } + gcMode, err := runDoltGCPass(ctx, gc, gcFull) + if err != nil { WarnError("dolt gc failed: %v", err) results = append(results, phaseResult{name: "Dolt GC", detail: "failed"}) } else { @@ -211,6 +227,9 @@ Examples: } if !jsonOutput { fmt.Printf(" Done (%s)\n", detail) + if gcMode != gcModeFull && suggestFullGC(sizeBefore, sizeAfter) { + printFullGCHint() + } if len(remoteRefs)+len(tags) > 0 { fmt.Printf(" Note: %d remote-tracking ref(s) and %d tag(s) anchor history;\n", len(remoteRefs), len(tags)) fmt.Printf(" after a history squash, use bd flatten / bd compact so they are pruned first.\n") @@ -220,6 +239,7 @@ Examples: gcSizeInfo = map[string]interface{}{ "remote_refs": len(remoteRefs), "tags": len(tags), + "mode": gcMode, } addGCSizeJSON(gcSizeInfo, sizeBefore, sizeAfter) } @@ -275,6 +295,7 @@ func init() { gcCmd.Flags().IntVar(&gcOlderThan, "older-than", 90, "Delete closed issues older than N days") gcCmd.Flags().BoolVar(&gcSkipDecay, "skip-decay", false, "Skip issue deletion phase") gcCmd.Flags().BoolVar(&gcSkipDolt, "skip-dolt", false, "Skip Dolt garbage collection phase") + gcCmd.Flags().BoolVar(&gcFull, "full", false, "Run a full Dolt GC (all generations; slower, reclaims space default passes cannot)") rootCmd.AddCommand(gcCmd) } diff --git a/cmd/bd/gc_embedded_test.go b/cmd/bd/gc_embedded_test.go index 617cd5c2a..26f72588f 100644 --- a/cmd/bd/gc_embedded_test.go +++ b/cmd/bd/gc_embedded_test.go @@ -126,6 +126,34 @@ func TestEmbeddedGC(t *testing.T) { } }) + // ===== Full GC ===== + + t.Run("gc_full", func(t *testing.T) { + gcDir, _, _ := bdInit(t, bd, "--prefix", "gu") + for i := 0; i < 3; i++ { + bdCreate(t, bd, gcDir, fmt.Sprintf("Full GC issue %d", i), "--type", "task") + } + + // A default pass first, so the second one has an old generation to + // collect — the case a generational pass cannot reclaim (#5907). + bdGC(t, bd, gcDir, "--force", "--skip-decay") + + out := bdGC(t, bd, gcDir, "--full", "--force", "--skip-decay") + if !strings.Contains(out, "GC complete") { + t.Errorf("expected 'GC complete' from bd gc --full: %s", out) + } + if !strings.Contains(out, "full Dolt GC") { + t.Errorf("expected the full-GC notice: %s", out) + } + }) + + t.Run("gc_full_dry_run", func(t *testing.T) { + out := bdGC(t, bd, dir, "--full", "--dry-run") + if !strings.Contains(out, "full DOLT_GC()") { + t.Errorf("dry run does not say it would run a full GC: %s", out) + } + }) + // ===== No --force prompts ===== t.Run("gc_no_force_prompts", func(t *testing.T) { diff --git a/cmd/bd/gc_proxied_server.go b/cmd/bd/gc_proxied_server.go index d234dc5dc..ed4818373 100644 --- a/cmd/bd/gc_proxied_server.go +++ b/cmd/bd/gc_proxied_server.go @@ -155,12 +155,23 @@ func runGCProxiedServer(ctx context.Context) error { } if gcDryRun { if !jsonOutput { - fmt.Println(" Would run DOLT_GC() and DOLT_STATS_GC()") + if gcFull { + fmt.Println(" Would run a full DOLT_GC() (all storage generations) and DOLT_STATS_GC()") + } else { + fmt.Println(" Would run DOLT_GC() and DOLT_STATS_GC()") + } } results = append(results, phaseResult{name: "Dolt GC", detail: "dry-run"}) } else { + if gcFull && !jsonOutput { + fmt.Println(" Running full Dolt GC (all generations; can take minutes on large stores)...") + } err := runProxiedNonTx(ctx, func(ctx context.Context, conn *sql.Conn) error { - if err := versioncontrolops.DoltGC(ctx, conn); err != nil { + doltGC := versioncontrolops.DoltGC + if gcFull { + doltGC = versioncontrolops.DoltGCFull + } + if err := doltGC(ctx, conn); err != nil { return err } if _, err := conn.ExecContext(ctx, "CALL DOLT_STATS_GC()"); err != nil { diff --git a/cmd/bd/gc_prune.go b/cmd/bd/gc_prune.go index 22831a730..a4030508e 100644 --- a/cmd/bd/gc_prune.go +++ b/cmd/bd/gc_prune.go @@ -74,6 +74,78 @@ func printPruneReport(pruned, tags []string) { } } +// Dolt GC pass kinds, reported as the "mode"/"gc_mode" JSON field. +const ( + gcModeGenerational = "generational" + gcModeFull = "full" +) + +// runDoltGCPass runs the requested Dolt GC pass and reports which pass actually +// ran. Dolt GC is generational: a default pass only visits data written since +// the last GC, while a full pass also collects the old generation. A store that +// does not implement FullGarbageCollector degrades to a generational pass with +// a warning. +func runDoltGCPass(ctx context.Context, gc storage.GarbageCollector, full bool) (string, error) { + if full { + if fullGC, ok := gc.(storage.FullGarbageCollector); ok { + return gcModeFull, fullGC.DoltGCFull(ctx) + } + WarnError("storage backend does not support a full GC; running a generational pass, " + + "which cannot reclaim data an earlier GC moved to the old generation") + } + return gcModeGenerational, gc.DoltGC(ctx) +} + +// runPostRewriteGC runs the GC that follows a history rewrite and reports which +// pass ran ("" when the backend has no GC at all). It is always a full pass: +// the rewrite orphans a commit chain that any earlier GC already promoted to +// the old generation, and a generational pass never revisits it. Failures are +// warnings — the rewrite itself already succeeded. +func runPostRewriteGC(ctx context.Context, op string) string { + gc, ok := storage.UnwrapStore(store).(storage.GarbageCollector) + if !ok { + return "" + } + if !jsonOutput { + fmt.Println(" Running full Dolt GC (all generations; can take minutes on large stores)...") + } + mode, err := runDoltGCPass(ctx, gc, true) + if err != nil { + WarnError("dolt gc after %s failed: %v", op, err) + } + return mode +} + +const ( + // fullGCHintMinStoreBytes keeps the hint off small stores, where a few + // reclaimed kilobytes are not worth a multi-minute full pass. + fullGCHintMinStoreBytes = 64 << 20 + // fullGCHintMaxFreedFraction is what counts as "reclaimed ~nothing". + fullGCHintMaxFreedFraction = 0.01 +) + +// suggestFullGC reports whether a completed generational GC pass freed so +// little of a non-trivial store that the caller should suggest --full. +// before/after are ActiveDatabaseSize measurements; negative means unmeasurable +// and disables the hint. +func suggestFullGC(before, after int64) bool { + if before < 0 || after < 0 || before < fullGCHintMinStoreBytes { + return false + } + freed := before - after + if freed < 0 { + freed = 0 + } + return float64(freed) < fullGCHintMaxFreedFraction*float64(before) +} + +// printFullGCHint explains why a default pass can reclaim nothing (text mode). +func printFullGCHint() { + fmt.Println(" Tip: little space was reclaimed. A default Dolt GC never revisits data an") + fmt.Println(" earlier GC moved to the old generation — run 'bd gc --full' to collect all") + fmt.Println(" generations.") +} + // gcSizeLine formats a before/after size pair as "X → Y (freed Z)", or "" // when either measurement failed. func gcSizeLine(before, after int64) string { diff --git a/cmd/bd/gc_prune_test.go b/cmd/bd/gc_prune_test.go index 534ab2db3..ee902eeff 100644 --- a/cmd/bd/gc_prune_test.go +++ b/cmd/bd/gc_prune_test.go @@ -3,6 +3,7 @@ package main import ( "context" "errors" + "strings" "testing" "github.com/steveyegge/beads/internal/storage" @@ -95,3 +96,73 @@ func TestAddGCSizeJSONOmitsUnavailableMeasurements(t *testing.T) { t.Fatalf("freed_bytes was emitted without both measurements: %#v", result) } } + +func TestSuggestFullGC(t *testing.T) { + t.Parallel() + + const mib = 1 << 20 + tests := []struct { + name string + before, after int64 + want bool + }{ + {name: "unmeasurable before", before: -1, after: 100 * mib}, + {name: "unmeasurable after", before: 100 * mib, after: -1}, + {name: "both unmeasurable", before: -1, after: -1}, + {name: "small store freeing nothing is not worth a full pass", before: 8 * mib, after: 8 * mib}, + {name: "just below the store floor", before: 64*mib - 1, after: 64*mib - 1}, + {name: "at the store floor, freed nothing", before: 64 * mib, after: 64 * mib, want: true}, + {name: "large store freed nothing", before: 4096 * mib, after: 4096 * mib, want: true}, + {name: "freed 0.9% of the store", before: 1000 * mib, after: 991 * mib, want: true}, + {name: "freed exactly 1% is not ~nothing", before: 1000 * mib, after: 990 * mib}, + {name: "field report: 1276 MB -> 971 MB freed 24%", before: 1276 * mib, after: 971 * mib}, + {name: "store grew during the pass", before: 1000 * mib, after: 1001 * mib, want: true}, + } + + for _, tc := range tests { + tc := tc + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + if got := suggestFullGC(tc.before, tc.after); got != tc.want { + t.Fatalf("suggestFullGC(%d, %d) = %v, want %v", tc.before, tc.after, got, tc.want) + } + }) + } +} + +// TestGCHelpDocumentsFullPass pins the help text explaining why a default Dolt +// GC can reclaim nothing. These Long strings are the source the CLI reference +// pages are generated from, so this wording is maintained only here. +func TestGCHelpDocumentsFullPass(t *testing.T) { + t.Parallel() + + full := gcCmd.Flags().Lookup("full") + if full == nil { + t.Fatal("bd gc has no --full flag") + } + if !strings.Contains(full.Usage, "all generations") { + t.Errorf("--full usage does not mention all generations: %q", full.Usage) + } + + for _, want := range []string{"--full", "old generation", "generational"} { + if !strings.Contains(gcCmd.Long, want) { + t.Errorf("gcCmd.Long does not mention %q", want) + } + } + + rewrites := []struct { + name string + long string + }{ + {"flatten", flattenCmd.Long}, + {"compact", compactDoltCmd.Long}, + } + for _, cmd := range rewrites { + if !strings.Contains(cmd.long, "full Dolt GC") { + t.Errorf("%s help does not say it runs a full Dolt GC", cmd.name) + } + if !strings.Contains(cmd.long, "old generation") { + t.Errorf("%s help does not explain the old generation", cmd.name) + } + } +} diff --git a/cmd/bd/history_capability.go b/cmd/bd/history_capability.go new file mode 100644 index 000000000..c3e5fd3f7 --- /dev/null +++ b/cmd/bd/history_capability.go @@ -0,0 +1,28 @@ +package main + +// HistoryCapabilityClass classifies history/version-control commands on the +// proxied topology without coupling them to a particular backend engine. +type HistoryCapabilityClass string + +const ( + HistoryProxySupported HistoryCapabilityClass = "proxy-supported" + HistoryProxyAPI HistoryCapabilityClass = "proxy-api" + HistoryDirectOnly HistoryCapabilityClass = "direct-only" +) + +var historyCapabilityMatrix = map[string]HistoryCapabilityClass{ + "history": HistoryProxySupported, + "branch": HistoryDirectOnly, "conflicts": HistoryDirectOnly, "repo": HistoryDirectOnly, + "federation": HistoryDirectOnly, "vc": HistoryDirectOnly, "flatten": HistoryDirectOnly, + "dolt push": HistoryDirectOnly, "dolt pull": HistoryDirectOnly, "dolt commit": HistoryDirectOnly, + "dolt remote": HistoryDirectOnly, "dolt remote add": HistoryDirectOnly, "dolt remote list": HistoryDirectOnly, + "dolt remote reset-data": HistoryDirectOnly, "dolt remote remove": HistoryProxySupported, + "sync": HistoryDirectOnly, +} + +// LookupHistoryCapability classifies an exact command path. Unknown paths are +// intentionally absent so callers cannot accidentally advertise support. +func LookupHistoryCapability(commandPath string) (HistoryCapabilityClass, bool) { + c, ok := historyCapabilityMatrix[commandPath] + return c, ok +} diff --git a/cmd/bd/history_capability_test.go b/cmd/bd/history_capability_test.go new file mode 100644 index 000000000..cc277190d --- /dev/null +++ b/cmd/bd/history_capability_test.go @@ -0,0 +1,138 @@ +package main + +import ( + "encoding/json" + "strings" + "testing" + + "github.com/spf13/cobra" +) + +func TestHistoryCapabilityMatrixExactPaths(t *testing.T) { + if got, ok := LookupHistoryCapability("history"); !ok || got != HistoryProxySupported { + t.Fatalf("history = %q, %v; want proxy-supported", got, ok) + } + for _, path := range []string{"branch", "conflicts", "repo", "federation", "vc", "flatten", "dolt push", "dolt pull", "dolt commit", "dolt remote", "sync"} { + if got, ok := LookupHistoryCapability(path); !ok || got != HistoryDirectOnly { + t.Errorf("%q = %q, %v; want direct-only", path, got, ok) + } + } + if got, ok := LookupHistoryCapability("dolt remote remove"); !ok || got != HistoryProxySupported { + t.Fatalf("dolt remote remove = %q, %v; want proxy-supported", got, ok) + } + for _, path := range []string{"dolt remote add", "dolt remote list", "dolt remote reset-data"} { + if got, ok := LookupHistoryCapability(path); !ok || got != HistoryDirectOnly { + t.Errorf("%q = %q, %v; want direct-only", path, got, ok) + } + } +} + +func TestSyncRefusesBeforeProvider(t *testing.T) { + root := &cobra.Command{Use: "bd"} + cmd := &cobra.Command{Use: "sync"} + root.AddCommand(cmd) + err := validateProxyMaintenanceBeforeProvider(cmd) + if err == nil { + t.Fatalf("sync refusal = %#v", err) + } + if code, ok := exitCodeFromError(err); !ok || code != 1 { + t.Fatalf("sync exit = %#v", err) + } +} + +func TestHistoryDirectOnlyRefusalContract(t *testing.T) { + expected := map[string]struct{ code, message string }{ + "branch": {"proxy.branch.unsupported", "branch is not supported in proxied-server mode"}, + "conflicts": {"proxy.conflicts.unsupported", "conflicts is not supported in proxied-server mode"}, + "repo": {"proxy.repo.unsupported", "repo is not supported in proxied-server mode"}, + "federation": {"proxy.federation.unsupported", "federation is not supported in proxied-server mode"}, + "vc": {"proxy.vc.unsupported", "vc is not supported in proxied-server mode"}, + "flatten": {"proxy.flatten.unsupported", "flatten is not supported in proxied-server mode"}, + "dolt push": {"proxy.dolt_push.unsupported", "dolt push is not supported in proxied-server mode"}, + "dolt pull": {"proxy.dolt_pull.unsupported", "dolt pull is not supported in proxied-server mode"}, + "dolt commit": {"proxy.dolt_commit.unsupported", "dolt commit is not supported in proxied-server mode"}, + "dolt remote add": {"proxy.dolt_remote.unsupported", "dolt remote add is not supported in proxied-server mode"}, + "dolt remote list": {"proxy.dolt_remote.unsupported", "dolt remote list is not supported in proxied-server mode"}, + "dolt remote reset-data": {"proxy.dolt_remote.unsupported", "dolt remote reset-data is not supported in proxied-server mode"}, + "sync": {"proxy.sync.unsupported", "sync is not supported in proxied-server mode"}, + } + oldProvider := uowProvider + oldJSON := jsonOutput + t.Cleanup(func() { uowProvider = oldProvider; jsonOutput = oldJSON }) + for _, path := range []string{"branch", "conflicts", "repo", "federation", "vc", "flatten", "dolt push", "dolt pull", "dolt commit", "dolt remote add", "sync"} { + parts := strings.Split(path, " ") + root := &cobra.Command{Use: "bd"} + cmd := &cobra.Command{Use: parts[0]} + root.AddCommand(cmd) + for _, part := range parts[1:] { + child := &cobra.Command{Use: part} + cmd.AddCommand(child) + cmd = child + } + uowProvider = nil + jsonOutput = true + out := captureStdout(t, func() error { _ = validateProxyMaintenanceBeforeProvider(cmd); return nil }) + var got map[string]any + want := expected[path] + if err := json.Unmarshal([]byte(out), &got); err != nil || got["code"] != want.code || got["error"] != want.message || got["mutates"] != false { + t.Fatalf("%s refusal = %q (%v)", path, out, err) + } + if uowProvider != nil { + t.Fatal("refusal initialized provider") + } + } +} + +func TestHistoryNestedFrontDoorsRefuseAndSupportedPathsPass(t *testing.T) { + oldJSON := jsonOutput + jsonOutput = true + t.Cleanup(func() { jsonOutput = oldJSON }) + expected := map[string]struct{ code, message string }{ + "vc merge": {"proxy.vc.unsupported", "vc merge is not supported in proxied-server mode"}, + "vc commit": {"proxy.vc.unsupported", "vc commit is not supported in proxied-server mode"}, + "repo add": {"proxy.repo.unsupported", "repo add is not supported in proxied-server mode"}, + "conflicts resolve": {"proxy.conflicts.unsupported", "conflicts resolve is not supported in proxied-server mode"}, + "federation sync": {"proxy.federation.unsupported", "federation sync is not supported in proxied-server mode"}, + } + for _, path := range []string{"vc merge", "vc commit", "repo add", "conflicts resolve", "federation sync", "dolt remote remove"} { + parts := strings.Split(path, " ") + root := &cobra.Command{Use: "bd"} + cmd := &cobra.Command{Use: parts[0]} + root.AddCommand(cmd) + for _, part := range parts[1:] { + child := &cobra.Command{Use: part} + cmd.AddCommand(child) + cmd = child + } + err := validateProxyMaintenanceBeforeProvider(cmd) + if path == "dolt remote remove" { + if err != nil { + t.Fatalf("supported %s refused: %v", path, err) + } + continue + } + if err == nil { + t.Fatalf("direct-only %s unexpectedly allowed", path) + } + if code, ok := exitCodeFromError(err); !ok || code != 1 { + t.Fatalf("%s exit=%v, want 1", path, err) + } + var got map[string]any + // validateProxyMaintenanceBeforeProvider renders the typed refusal to + // stdout in JSON mode; the command must retain its nested path. + out := captureStdout(t, func() error { _ = validateProxyMaintenanceBeforeProvider(cmd); return nil }) + if err := json.Unmarshal([]byte(out), &got); err != nil { + t.Fatalf("%s refusal JSON: %v (%q)", path, err, out) + } + want := expected[path] + if got["code"] != want.code || got["error"] != want.message || got["mutates"] != false { + t.Fatalf("%s refusal = %#v, want code=%q message=%q mutates=false", path, got, want.code, want.message) + } + } + root := &cobra.Command{Use: "bd"} + history := &cobra.Command{Use: "history"} + root.AddCommand(history) + if err := validateProxyMaintenanceBeforeProvider(history); err != nil { + t.Fatalf("history --events supported path refused: %v", err) + } +} diff --git a/cmd/bd/history_remote_frontdoor_matrix_test.go b/cmd/bd/history_remote_frontdoor_matrix_test.go new file mode 100644 index 000000000..41223bd21 --- /dev/null +++ b/cmd/bd/history_remote_frontdoor_matrix_test.go @@ -0,0 +1,167 @@ +//go:build cgo && unix + +package main + +import ( + "context" + "encoding/json" + "os" + "path/filepath" + "strconv" + "strings" + "testing" + "time" + + "github.com/steveyegge/beads/internal/storage/dbproxy/proxy" + "github.com/steveyegge/beads/internal/testutil" +) + +// TestHistoryRemoteRefusalFrontDoorMatrix runs the real bd binary through all +// supported proxied transports. Valid command arguments are intentional: a +// typed capability refusal must win over Cobra usage validation and must not +// start a provider or touch durable state. +func TestHistoryRemoteRefusalFrontDoorMatrix(t *testing.T) { + bd := buildEmbeddedBD(t) + type fixture struct { + name string + make func(*testing.T) proxiedProject + } + fixtures := []fixture{{ + name: "managed-local", + make: func(t *testing.T) proxiedProject { + requireManagedLocalProxiedEnv(t) + return bdManagedLocalInit(t, bd, "hm_managed", 5*time.Minute) + }, + }} + if os.Getenv("BEADS_TEST_PROXIED_SERVER") == "1" { + fixtures = append(fixtures, + fixture{name: "external-tcp", make: func(t *testing.T) proxiedProject { + return newSharedProxiedProject(t, bd, "hm_tcp") + }}, + fixture{name: "external-unix", make: func(t *testing.T) proxiedProject { + requireProxiedServerEnv(t) + upstream := testutil.StartIsolatedDoltContainerHandle(t) + socket := filepath.Join(t.TempDir(), "dolt.sock") + bridge := startOutageBridge(t, socket, upstream.Port, true) + t.Cleanup(func() { _ = bridge.Process.Kill() }) + return bdProxiedInit(t, bd, "hm_unix", "--proxied-server-external-socket-path", socket) + }}, + ) + } + commands := []struct { + name, code, message string + args []string + }{ + {"branch", "proxy.branch.unsupported", "branch is not supported in proxied-server mode", []string{"branch", "feature"}}, + {"conflicts list", "proxy.conflicts.unsupported", "conflicts list is not supported in proxied-server mode", []string{"conflicts", "list"}}, + {"repo add", "proxy.repo.unsupported", "repo add is not supported in proxied-server mode", []string{"repo", "add", "."}}, + {"federation sync", "proxy.federation.unsupported", "federation sync is not supported in proxied-server mode", []string{"federation", "sync"}}, + {"vc merge", "proxy.vc.unsupported", "vc merge is not supported in proxied-server mode", []string{"vc", "merge", "feature"}}, + {"vc commit", "proxy.vc.unsupported", "vc commit is not supported in proxied-server mode", []string{"vc", "commit"}}, + {"flatten", "proxy.flatten.unsupported", "flatten is not supported in proxied-server mode", []string{"flatten"}}, + {"dolt push", "proxy.dolt_push.unsupported", "dolt push is not supported in proxied-server mode", []string{"dolt", "push"}}, + {"dolt pull", "proxy.dolt_pull.unsupported", "dolt pull is not supported in proxied-server mode", []string{"dolt", "pull"}}, + {"dolt commit", "proxy.dolt_commit.unsupported", "dolt commit is not supported in proxied-server mode", []string{"dolt", "commit"}}, + {"dolt remote add", "proxy.dolt_remote.unsupported", "dolt remote add is not supported in proxied-server mode", []string{"dolt", "remote", "add", "backup", "https://example.invalid/backup"}}, + {"dolt remote list", "proxy.dolt_remote.unsupported", "dolt remote list is not supported in proxied-server mode", []string{"dolt", "remote", "list"}}, + {"dolt remote reset-data", "proxy.dolt_remote.unsupported", "dolt remote reset-data is not supported in proxied-server mode", []string{"dolt", "remote", "reset-data", "backup"}}, + {"sync", "proxy.sync.unsupported", "sync is not supported in proxied-server mode", []string{"sync"}}, + } + for _, f := range fixtures { + t.Run(f.name, func(t *testing.T) { + p := f.make(t) + bdProxiedCreate(t, bd, p.dir, "matrix sentinel") + _ = proxy.Shutdown(p.proxyRoot) + before := snapshotHistoryArtifacts(t, p) + for _, tc := range commands { + t.Run(tc.name, func(t *testing.T) { + // Put the global flag before the subcommand. A few nested + // front doors do not inherit persistent flags after their args. + args := append([]string{"--json"}, tc.args...) + stdout, stderr, err := bdProxiedRunBuffersWithEnv(t, bd, p.dir, []string{"BEADS_JSON=1"}, args...) + if err == nil { + t.Fatalf("%v unexpectedly succeeded", tc.args) + } + var got struct { + Code string `json:"code"` + Error string `json:"error"` + Mutates bool `json:"mutates"` + } + if jsonErr := json.Unmarshal([]byte(strings.TrimSpace(stdout)), &got); jsonErr == nil { + if got.Code != tc.code || got.Error != tc.message || got.Mutates { + t.Fatalf("refusal=%+v, want code=%q error=%q mutates=false", got, tc.code, tc.message) + } + } else if strings.TrimSpace(stderr) != "Error: "+tc.message { + // Some nested commands render the same typed refusal through + // the text path before config-backed JSON is applied. + t.Fatalf("refusal JSON=%v stdout=%q stderr=%q", jsonErr, stdout, stderr) + } + if _, statErr := os.Stat(filepath.Join(p.proxyRoot, proxy.PIDFileName)); statErr == nil { + t.Fatal("provider proxy started for direct-only refusal") + } + after := snapshotHistoryArtifacts(t, p) + if string(before) != string(after) { + t.Fatal("durable artifacts changed during refusal") + } + }) + } + }) + } +} + +func snapshotHistoryArtifacts(t *testing.T, p proxiedProject) []byte { + t.Helper() + var out []byte + for _, path := range []string{ + filepath.Join(p.beadsDir, "config.yaml"), filepath.Join(p.beadsDir, "metadata.json"), + filepath.Join(p.beadsDir, "events.jsonl"), filepath.Join(p.beadsDir, ".local_version"), + filepath.Join(p.proxyRoot, proxy.LockFileName), filepath.Join(p.proxyRoot, proxy.PIDFileName), + } { + b, err := os.ReadFile(path) + if err != nil && !os.IsNotExist(err) { + t.Fatalf("snapshot %s: %v", path, err) + } + out = append(out, []byte(strconv.Itoa(len(path))+":"+path+":"+string(b)+"\n")...) + } + return out +} + +// TestHistoryRemoteSupportedFrontDoorParity checks the two operations that +// are intentionally shared by direct and proxied providers. +func TestHistoryRemoteSupportedFrontDoorParity(t *testing.T) { + if os.Getenv("BEADS_TEST_PROXIED_SERVER") != "1" && os.Getenv(managedLocalProxiedEnvVar) != "1" { + t.Skip("set a proxied test lane to run history parity") + } + bd := buildEmbeddedBD(t) + for _, tc := range []struct { + name string + make func(*testing.T) proxiedProject + }{ + {"managed-local", func(t *testing.T) proxiedProject { + requireManagedLocalProxiedEnv(t) + return bdManagedLocalInit(t, bd, "hs_managed", 5*time.Minute) + }}, + {"external-tcp", func(t *testing.T) proxiedProject { + requireProxiedServerEnv(t) + return newSharedProxiedProject(t, bd, "hs_tcp") + }}, + } { + t.Run(tc.name, func(t *testing.T) { + p := tc.make(t) + issue := bdProxiedCreate(t, bd, p.dir, "history parity") + bdProxiedUpdate(t, bd, p.dir, issue.ID, "--title", "history parity updated") + out, err := bdProxiedRun(t, bd, p.dir, "--json", "history", issue.ID, "--events") + if err != nil || !strings.Contains(string(out), issue.ID) { + t.Fatalf("history --events failed: %v\n%s", err, out) + } + db := openProxiedDB(t, p) + if _, err := db.ExecContext(context.Background(), "CALL DOLT_REMOTE('add', ?, ?)", "backup", "https://example.invalid/backup"); err != nil { + t.Fatalf("seed remote: %v", err) + } + out, err = bdProxiedRun(t, bd, p.dir, "--json", "dolt", "remote", "remove", "backup") + if err != nil || !strings.Contains(string(out), "backup") { + t.Fatalf("remote remove failed: %v\n%s", err, out) + } + }) + } +} diff --git a/cmd/bd/import.go b/cmd/bd/import.go index 6c2eb4f28..849476263 100644 --- a/cmd/bd/import.go +++ b/cmd/bd/import.go @@ -144,7 +144,13 @@ func runImport(cmd *cobra.Command, args []string) error { // CheckReadonly at all (a separate, pre-existing gap — readonlyMode // doesn't gate bd import either), so it can't pick up the freeze check // folded into CheckReadonly the way create/update/close/remember do. - CheckMigrationFreeze("import") + // The path that makes this call load-bearing rather than redundant is + // `bd import --dry-run`: a preview sets useReadOnly, so it skips the early + // gate in PersistentPreRunE, and runImport is the only chokepoint left. + // Plain `bd import` is already stopped by that early gate. + if err := migrationFreezeGateFor(cmd, "import"); err != nil { + return err + } evt := metrics.NewCommandEvent("import") defer func() { diff --git a/cmd/bd/info.go b/cmd/bd/info.go index 06e5c5386..e8fee1860 100644 --- a/cmd/bd/info.go +++ b/cmd/bd/info.go @@ -220,6 +220,47 @@ type VersionChange struct { // versionChanges contains agent-actionable changes for recent versions var versionChanges = []VersionChange{ + { + Version: "1.3.0", + Date: "2026-09-15", + Changes: []string{ + "RELEASE: first tested release off main since the 1.1 line. v1.2.2 shipped the v1.1.2 tree, so a v1.2.2 user gets the 1.2.1 changes AND the 1.3.0 changes in one step; read the [1.3.0] AND [1.2.1] sections of CHANGELOG.md. 'bd upgrade review' prints exactly the entries between your previous version and this one — prefer it to 'bd info --whats-new', which dumps the whole release history.", + "MIGRATION: on an embedded/local store the first invocation auto-migrates from schema v53 to v66 in place. That is ~28 migrations, not 13: the main series runs 0054->0066, then the clone-local series runs 0012->0026 through the same printer, so the counter VISIBLY RESTARTS partway through. That is not a loop — let it finish. Two passes rewrite rows, so the first command is noticeably slower; it is crash-resumable, do not interrupt it. Progress prints per step on stderr only when stderr is a terminal — a silent CI upgrade is not a stuck one.", + "SHARED SERVER: a shared Dolt sql-server is NEVER auto-migrated (#5920, #6048) — migrating promotes the schema for every connected client at once, so it waits for explicit consent via 'bd migrate schema' (add --global for the shared global database). Upgrade every client of that server FIRST; between upgrade and consent, upgraded clients read normally and their writes are refused with guidance. If the shared server also has a Dolt remote, use 'bd migrate --force' from exactly one machine, then 'bd dolt push'.", + "BACKUP: back up BEFORE installing, with your OLD binary. Under 1.3.0 'bd export' triggers the migration before exporting, so a snapshot taken afterwards cannot protect you against the migration going wrong. Old binary: 'bd dolt push' (remote-backed stores) then 'bd export --all -o .beads/backup/pre-1.3.0.jsonl'. For a Dolt-native snapshot use 'bd backup init ' then 'bd backup sync' — bare 'bd backup' is a command group that prints help and takes NO backup. Remote-backed stores stay gated after install; one designated clone migrates and pushes.", + "UPGRADE: after migrating, older co-resident binaries REFUSE the store (forward schema-skew guard), so every client sharing a store must be upgraded together. Check with 'which -a bd' and restart any long-running 'bd serve'. Rollback is a schema-cursor rollback: https://beads.gascity.com/recovery/accidental-1-2-1-release", + "BREAKING (highlights, not the full set — read the [1.2.1] CHANGELOG section too): 'bd update -s ' enforces close policy (override with --force); 'bd search' includes closed by default (narrow with --status open); the no-ID last-touched fallback on update/close is interactive-only; 'bd human list' hides done/frozen/pinned and validates --status; 'bd dolt push'/'bd sync' no longer adopt a git-origin-derived Dolt remote without consent; an explicitly configured Dolt port outranks BEADS_DOLT_PORT; and actor matching decodes an exact '--' run to '/'.", + "BREAKING: 'bd --readonly serve' is now REFUSED instead of binding a writable server, so a scripted read-only server does not come back up after this upgrade — drop the flag. 'bd config list' and GET /v0/beads/config no longer enumerate the kv. plane where 'bd remember' memories live (use 'bd kv'/'bd remember'; scripts get empty output, not an error). The published backend package drops OrphanHandling and issueops.CheckOrphan, so a Go consumer naming them no longer compiles.", + "BREAKING: the CPU profiling flag is now --cpu-profile; the old --profile spelling is gone with no alias and fails as an unknown flag.", + "CHANGE: migration 0061 rekeys every events/comments/snapshot/compaction-snapshot row to a content-derived (UUIDv5-over-SHA-256) id, once per clone, on the first open after upgrade. Ids captured before the upgrade will not resolve afterwards.", + "CHANGE: migration 0062 moves the events audit table to the clone-local plane — events keep full local durability and 'bd history --events' still reads them, but they no longer replicate on push or pull.", + "CHANGE: the interactions.jsonl audit sidecar is opt-in (audit.enabled defaults false, or BD_AUDIT_ENABLED=1); use 'bd history --events' instead. Auto-backup now defaults OFF under a Dolt sql-server (embedded is unchanged); set backup.enabled explicitly to override.", + "CHANGE: 'bd import' now ERRORS on a redirected stdin with no source argument instead of importing the default JSONL — use 'bd import -' or name the file. 'bd hooks install --chain/--force' are accepted no-ops; marker sections always preserve non-bd hook content.", + "FIX: 'bd purge'/'bd prune' select candidates by tier (#5995), so typed wisps minted before the ephemeral column are reachable again — the first purge after upgrade may clear considerably more than usual.", + "NEW: a two-level cooperative gate writes *.gate.lock files beside .beads and beside the Dolt physical root (e.g. .beads/embeddeddolt.gate.lock). They are flock names, never deleted; 'bd doctor --fix' adds the *.gate.lock* gitignore pattern.", + }, + }, + { + Version: "1.3.0-rc.2", + Date: "2026-09-05", + Changes: []string{ + "RC: candidate for the 1.3.0 line, carrying three server-mode fixes reported against rc.1; the [1.3.0] entry below still describes everything a 1.2.2 user meets, including the migration and backup notes — read it first.", + "FIX: an env-pointed Dolt sql-server (BEADS_DOLT_SERVER_PORT) is classified shared, not owned, so the #5920/#6048 shared-store consent gate runs instead of being bypassed. Before this, bd migrated the shared database in place and exited 0, and older co-resident clients were then hard-refused with a schema version mismatch (#6118).", + "FIX: a config.yaml server-mode workspace (dolt.mode: server, no metadata.json) is no longer misread as a legacy workspace — the guard resolves mode through the IsDoltServerMode precedence chain, and a .local_version witness naming bd 1.0 or later vetoes the legacy verdict in every mode (#6119).", + "FIX: a metadata-less server-mode workspace no longer opens a phantom .beads/embeddeddolt database that answered 'bd list' with a false-empty exit 0; substitution gates on IsDoltServerMode and honors BEADS_DOLT_SERVER_MODE (#6120).", + "CHANGE: 'bd ready --claim' under --proxied-server now refuses a --max-rows/BEADS_MAX_ROWS cap instead of silently dropping it; --claim is no longer exempt. Agent rigs that set the cap globally must unset it for proxied 'bd ready --claim'. Direct mode is unchanged.", + }, + }, + { + // Keyed so an rc.1 tester upgrading to rc.2 gets the rc.2 digest + // above instead of the whole release history: getVersionsSince + // returns every entry when it cannot find the previous version. + Version: "1.3.0-rc.1", + Date: "2026-08-31", + Changes: []string{ + "RC: first candidate for the 1.3.0 line. Everything a 1.2.2 user meets on the way here — the in-place schema migration, the shared-server consent gate, the backup ordering, and the breaking changes — is described in the [1.3.0] entry below; read it first.", + }, + }, { Version: "1.2.2", Date: "2026-08-15", diff --git a/cmd/bd/init.go b/cmd/bd/init.go index dc4ee929b..45e4b23cf 100644 --- a/cmd/bd/init.go +++ b/cmd/bd/init.go @@ -399,6 +399,32 @@ Non-interactive mode (--non-interactive or BD_NON_INTERACTIVE=1): fmt.Fprintf(os.Stderr, " See 'bd help init-safety' for the init flag surface.\n\n") reinitLocal = true } + + // dc-6jaq: "init" is in noDbCommands, so PersistentPreRunE returns at + // the skip-store early return before its freeze gate ever runs, and + // init.go calls neither CheckReadonly nor the gate itself. That left + // the single most destructive command in the CLI free to run during a + // migration: `bd init --reinit-local` (or its --force alias) drops and + // recreates the very database the marker is protecting, permanently, + // and exited 0 without consulting the marker. Gate the destructive + // variants here — the earliest point where every one of them is + // resolved and nothing has been written yet, and ahead of the + // --proxied-server branch below, which reaches its own writes without + // passing through the init mutation gate at all. + // + // A plain first-time init is deliberately not gated: it creates a new + // database rather than touching the frozen one, and an existing + // workspace already refuses it via checkExistingBeadsData. + if reinitLocal || discardRemote { + op := "init --reinit-local" + if discardRemote { + op = "init --discard-remote" + } + if err := migrationFreezeGateFor(cmd, op, resolveInitBeadsDir()); err != nil { + return err + } + } + sharedServer, _ := cmd.Flags().GetBool("shared-server") externalServer, _ := cmd.Flags().GetBool("external") debugMode, _ := cmd.Flags().GetBool("debug") @@ -639,6 +665,15 @@ Non-interactive mode (--non-interactive or BD_NON_INTERACTIVE=1): fromJSONL: fromJSONL, nonInteractive: nonInteractive, }); err != nil { + // runInitProxiedServer runs the same checkExistingBeadsData + // the route below does, but it runs it inside itself — so + // --init-if-missing used to end here as a plain exit-1 + // "Aborting.", and its mismatch guards never ran at all. The + // check happens before any .beads/ write, so nothing has been + // touched by the time we get this error. + if initIfMissing && !reinitLocal && errors.Is(err, errWorkspaceAlreadyInitialized) { + return resolveInitIfMissingAlreadyInitialized(cmd, database, prefix, quiet) + } return err } return nil @@ -771,26 +806,7 @@ Non-interactive mode (--non-interactive or BD_NON_INTERACTIVE=1): // directory) must still abort rather than be masked as a // successful skip. if initIfMissing && errors.Is(err, errWorkspaceAlreadyInitialized) { - // Guard against masking a genuine mismatch: an explicit - // --prefix or --database that does not match the existing - // workspace must abort, since silently skipping would ignore - // the request and reuse a different database. --database is - // the authoritative selector, so it is checked even when - // --prefix is also set. - existing := existingWorkspaceDBName() - if cmd.Flags().Changed("database") { - if initIfMissingDatabaseMismatch(existing, database) { - return fmt.Errorf("workspace already initialized as database %q, but --database %q was requested.\nRemove --database (or pass a matching value) to reuse the existing workspace", existing, database) - } - } else if cmd.Flags().Changed("prefix") { - if initIfMissingPrefixMismatch(existing, prefix) { - return fmt.Errorf("workspace already initialized as database %q, but --prefix %q was requested.\nRemove --prefix (or pass a matching value) to reuse the existing workspace", existing, prefix) - } - } - if !quiet { - fmt.Fprintln(os.Stderr, "Skipping init: workspace already initialized.") - } - return nil + return resolveInitIfMissingAlreadyInitialized(cmd, database, prefix, quiet) } return fmt.Errorf("%v", err) } @@ -1289,6 +1305,10 @@ Non-interactive mode (--non-interactive or BD_NON_INTERACTIVE=1): } } if syncFromRemote { + // A raw https:// forge URL would route through Dolt's remotesapi + // client and spin forever (#4421); its git+ form routes through + // the git remote factory. Non-forge URLs are untouched (GH#3339). + syncURL = doltRemoteURL(syncURL) cloneCfg := initTimeCloneConfig(initServerMode, serverHost, serverPort, serverSocket, serverUser, dbName) disposition, err := runInitRemoteClone(syncURL, func(remoteURL string) error { return cloneFromRemoteWithMode(ctx, beadsDir, remoteURL, dbName, cloneCfg, initRemoteCloneMode(initServerMode, externalServer)) @@ -1480,6 +1500,7 @@ Non-interactive mode (--non-interactive or BD_NON_INTERACTIVE=1): printBootstrapRemoteBehindGuidance(os.Stderr, gateErr, syncURL, "bd init") } else { fmt.Fprint(os.Stderr, gateErr.UserMessage()) + printInitJoinGuidance(os.Stderr, gateErr) } return &exitError{Code: 1} } @@ -1504,8 +1525,14 @@ Non-interactive mode (--non-interactive or BD_NON_INTERACTIVE=1): // falling back to JSONL-as-sync. Gateway mode skips it: the hosted // server owns the database, so DOLT_REMOTE('add', ...) must not run // against it (see shouldWriteInitDoltRemote). + // The URL is routed here too, not just on the clone path: the + // no-Dolt-data-yet case (the pre-first-push wiring this is for) never + // clones, so without routing a raw https forge URL would be stored + // verbatim in dolt_remotes and the *first* `bd dolt push` would take + // it to the remotesapi client — the #4421 storm, one leg further down + // (#5743). if shouldWriteInitDoltRemote(doltCfg.Gateway, syncURL, syncFromRemote, syncURLFromConfig, syncURLFromGitOrigin, isDoltLocalOnly()) { - configureInitDoltRemote(ctx, store, syncURL, quiet) + configureInitDoltRemote(ctx, store, doltRemoteURL(syncURL), quiet) } // === CONFIGURATION METADATA (Pattern A: Fatal) === @@ -1740,7 +1767,9 @@ Non-interactive mode (--non-interactive or BD_NON_INTERACTIVE=1): // Must run AFTER createConfigYaml which creates the file. // Persist the effective remote so future bootstrap and hooks know // Dolt, not JSONL, is the cross-machine sync path. Plain git - // origins are valid here: the first push creates refs/dolt/data. + // origins are valid here: the first push creates refs/dolt/data, + // and bootstrap resolves such a URL by probing refs/dolt/data + // rather than rejecting it (#5743). if err := persistInitSyncRemote(beadsDir, initRemote, syncURL, syncFromRemote, syncURLFromConfig, syncURLFromGitOrigin); err != nil { return fmt.Errorf("failed to persist sync.remote to config.yaml: %v", err) } @@ -2463,7 +2492,7 @@ func checkExistingBeadsDataAt(beadsDir string, prefix string) error { return fmt.Errorf("failed to load %s: %w; refusing to reinitialize automatically (restore the metadata or use --reinit-local after safeguarding existing data)", configfile.ConfigPath(beadsDir), cfgErr) } if cfg != nil { - if guardErr := validateConfiguredBackend(cfg); guardErr != nil { + if guardErr := validateConfiguredBackend(cfg, beadsDir); guardErr != nil { return guardErr } } @@ -2762,6 +2791,40 @@ func initIfMissingPrefixMismatch(existingDBName, requestedPrefix string) bool { return requested != "" && !strings.EqualFold(existingDBName, requested) } +// resolveInitIfMissingAlreadyInitialized decides what --init-if-missing does +// once the workspace is known to be initialized already: nil for the benign +// skip (message printed here), or the abort for a request that would be +// silently ignored by skipping. +// +// Guard against masking a genuine mismatch: an explicit --prefix or --database +// that does not match the existing workspace must abort, since silently +// skipping would ignore the request and reuse a different database. --database +// is the authoritative selector, so it is checked even when --prefix is also +// set. +// +// Both init routes share this: the embedded/server route reaches it from its +// own checkExistingBeadsData, the proxied-server route from the identical check +// inside runInitProxiedServer. Before that wiring existed, --init-if-missing was +// simply inert on the proxied route — an already-initialized workspace exited 1 +// with the "Aborting." banner, and the two mismatch guards this delegates to had +// never once run. +func resolveInitIfMissingAlreadyInitialized(cmd *cobra.Command, database, prefix string, quiet bool) error { + existing := existingWorkspaceDBName() + if cmd.Flags().Changed("database") { + if initIfMissingDatabaseMismatch(existing, database) { + return fmt.Errorf("workspace already initialized as database %q, but --database %q was requested.\nRemove --database (or pass a matching value) to reuse the existing workspace", existing, database) + } + } else if cmd.Flags().Changed("prefix") { + if initIfMissingPrefixMismatch(existing, prefix) { + return fmt.Errorf("workspace already initialized as database %q, but --prefix %q was requested.\nRemove --prefix (or pass a matching value) to reuse the existing workspace", existing, prefix) + } + } + if !quiet { + fmt.Fprintln(os.Stderr, "Skipping init: workspace already initialized.") + } + return nil +} + // initIfMissingDatabaseMismatch reports whether an explicit --database request // conflicts with the existing workspace. --database is the authoritative database // selector (it overrides prefix-based naming later in init), so an explicit @@ -3400,6 +3463,15 @@ func initGlobalDatabaseConfig(ctx context.Context, projectCfg *dolt.Config, quie globalStore, err := newDoltStore(ctx, globalCfg) if err != nil { fmt.Fprintf(os.Stderr, "Warning: failed to open global database: %v\n", err) + // The gate's own block prescribes `bd migrate schema`, which migrates + // the PROJECT database — on this path that leaves the global database + // exactly as refused. Name the command that actually reaches it + // (#5920); this warning is the only place the global refusal surfaces. + if schema.IsRemoteMigrateGateError(err) { + fmt.Fprintf(os.Stderr, + " The global database is shared by every workspace on this server. To migrate it, run:\n %s\n", + schema.SharedConsentCommandGlobal) + } return } defer func() { _ = globalStore.Close() }() diff --git a/cmd/bd/init_policy_test.go b/cmd/bd/init_policy_test.go index 273a0bdab..4db77eb49 100644 --- a/cmd/bd/init_policy_test.go +++ b/cmd/bd/init_policy_test.go @@ -192,3 +192,61 @@ func TestNormalizeIssuePrefixAndDatabaseName(t *testing.T) { }) } } + +// TestDoltRemoteURL pins which URLs bd rewrites before handing them to Dolt — +// for DOLT_CLONE, for DOLT_REMOTE('add', ...) and therefore for DOLT_PUSH. +// Forge URLs must arrive in git+ form so Dolt uses the git remote factory +// rather than the remotesapi retry storm (#4421); a user-configured remotesapi +// endpoint must arrive byte-identical (GH#3339). bd init and bd bootstrap +// share this one helper so they can never disagree about the URL derived from +// a single committed sync.remote. +func TestDoltRemoteURL(t *testing.T) { + tests := []struct { + name string + in string + want string + }{ + {"raw https forge", "https://github.com/org/repo.git", "git+https://github.com/org/repo.git"}, + {"forge without .git", "https://github.com/org/repo", "git+https://github.com/org/repo"}, + {"scp style forge", "git@github.com:org/repo.git", "git+ssh://git@github.com/org/repo.git"}, + {"ssh forge", "ssh://git@gitlab.com/org/repo.git", "git+ssh://git@gitlab.com/org/repo.git"}, + {"already normalized", "git+https://github.com/org/repo.git", "git+https://github.com/org/repo.git"}, + + {"remotesapi endpoint", "http://myserver:7007/mydb", "http://myserver:7007/mydb"}, + {"remotesapi https endpoint", "https://doltremoteapi.dolthub.com/org/db", "https://doltremoteapi.dolthub.com/org/db"}, + {"dolthub native", "dolthub://myorg/mydb", "dolthub://myorg/mydb"}, + {"s3 native", "s3://bucket/path", "s3://bucket/path"}, + {"self-hosted dolt over ssh", "git+ssh://my-dolt.example.com/org/db", "git+ssh://my-dolt.example.com/org/db"}, + {"empty", "", ""}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := doltRemoteURL(tt.in); got != tt.want { + t.Errorf("doltRemoteURL(%q) = %q, want %q", tt.in, got, tt.want) + } + }) + } +} + +// TestRunInitRemoteCloneReceivesRoutedURL proves the routing survives the call +// into runInitRemoteClone — the seam the init RunE body actually uses. +func TestRunInitRemoteCloneReceivesRoutedURL(t *testing.T) { + for _, tt := range []struct{ in, want string }{ + {"https://github.com/org/repo.git", "git+https://github.com/org/repo.git"}, + {"http://myserver:7007/mydb", "http://myserver:7007/mydb"}, + } { + t.Run(tt.in, func(t *testing.T) { + var gotURL string + if _, err := runInitRemoteClone(doltRemoteURL(tt.in), func(url string) error { + gotURL = url + return nil + }); err != nil { + t.Fatalf("runInitRemoteClone: %v", err) + } + if gotURL != tt.want { + t.Errorf("clone received %q, want %q", gotURL, tt.want) + } + }) + } +} diff --git a/cmd/bd/init_proxied_if_missing_test.go b/cmd/bd/init_proxied_if_missing_test.go new file mode 100644 index 000000000..fa183e880 --- /dev/null +++ b/cmd/bd/init_proxied_if_missing_test.go @@ -0,0 +1,96 @@ +//go:build cgo + +package main + +import ( + "strings" + "testing" +) + +// TestProxiedServerInitIfMissing covers --init-if-missing on the proxied-server +// route, where it used to be inert: runInitProxiedServer runs its own +// already-initialized check and returns before init.go's --init-if-missing +// block, so a scaffold script re-running init got exit 1 and the "Aborting." +// banner, and the mismatch guards that protect the flag had never run at all. +func TestProxiedServerInitIfMissing(t *testing.T) { + requireProxiedServerEnv(t) + + bd := buildEmbeddedBD(t) + p := bdProxiedInit(t, bd, "pim") + + initArgs := func(extra ...string) []string { + return append([]string{ + "init", "--proxied-server", "--non-interactive", "--skip-agents", "--skip-hooks", + }, extra...) + } + + t.Run("re-init skips benignly", func(t *testing.T) { + _, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, initArgs("--init-if-missing")...) + if err != nil { + t.Fatalf("init --init-if-missing should exit 0 on an initialized workspace: %v\nstderr:\n%s", err, stderr) + } + if !strings.Contains(stderr, "Skipping init: workspace already initialized") { + t.Errorf("expected the benign skip message, got stderr:\n%s", stderr) + } + }) + + t.Run("matching prefix skips benignly", func(t *testing.T) { + _, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, initArgs("--init-if-missing", "--prefix", p.prefix)...) + if err != nil { + t.Fatalf("matching --prefix should still skip: %v\nstderr:\n%s", err, stderr) + } + if !strings.Contains(stderr, "Skipping init: workspace already initialized") { + t.Errorf("expected the benign skip message, got stderr:\n%s", stderr) + } + }) + + // The multi-project ask. Skipping here would silently ignore --database and + // keep using the existing one, so it must refuse — and say which database + // the workspace is actually on. + t.Run("different database is refused, not skipped", func(t *testing.T) { + stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, initArgs("--init-if-missing", "--database", "some_other_db")...) + if err == nil { + t.Fatalf("mismatched --database must abort; got success\nstdout:\n%s\nstderr:\n%s", stdout, stderr) + } + out := stdout + stderr + for _, want := range []string{ + "workspace already initialized as database " + `"` + p.database + `"`, + `--database "some_other_db" was requested`, + } { + if !strings.Contains(out, want) { + t.Errorf("abort message missing %q, got:\n%s", want, out) + } + } + if strings.Contains(out, "Skipping init") { + t.Errorf("a mismatched --database must not be skipped, got:\n%s", out) + } + }) + + t.Run("different prefix is refused, not skipped", func(t *testing.T) { + stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, initArgs("--init-if-missing", "--prefix", "somethingelse")...) + if err == nil { + t.Fatalf("mismatched --prefix must abort; got success\nstdout:\n%s\nstderr:\n%s", stdout, stderr) + } + out := stdout + stderr + for _, want := range []string{ + "workspace already initialized as database " + `"` + p.database + `"`, + `--prefix "somethingelse" was requested`, + } { + if !strings.Contains(out, want) { + t.Errorf("abort message missing %q, got:\n%s", want, out) + } + } + }) + + // Without the flag, the existing refusal is unchanged: --init-if-missing is + // what makes re-init benign, not this change. + t.Run("without the flag re-init still aborts", func(t *testing.T) { + stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, initArgs()...) + if err == nil { + t.Fatalf("re-init without --init-if-missing must abort; got success\nstdout:\n%s\nstderr:\n%s", stdout, stderr) + } + if out := stdout + stderr; !strings.Contains(out, "already initialized") { + t.Errorf("expected the existing already-initialized refusal, got:\n%s", out) + } + }) +} diff --git a/cmd/bd/init_safety.go b/cmd/bd/init_safety.go index a0616609d..2d77066be 100644 --- a/cmd/bd/init_safety.go +++ b/cmd/bd/init_safety.go @@ -38,6 +38,10 @@ const ( // in non-interactive mode without a valid `--destroy-token`: either // `--discard-remote`, or `--reinit-local` over existing local issues. // The caller must look up the token format via `bd help init-safety`. + // It is also returned when the interactive `--discard-remote` typed-token + // confirmation is declined at the prompt, so a 12 does not on its own + // prove the caller was non-interactive. Supplying the token is the + // correct remedy for all three sources. ExitDestroyTokenMissing = 12 ) diff --git a/cmd/bd/init_safety_help.go b/cmd/bd/init_safety_help.go index 79773a22a..607191fad 100644 --- a/cmd/bd/init_safety_help.go +++ b/cmd/bd/init_safety_help.go @@ -80,7 +80,8 @@ EXIT CODES (interactive mode only) 12 refused: destructive re-init (--discard-remote, or --reinit-local over existing issues) without a valid --destroy-token - (non-interactive mode) + (non-interactive mode); also returned when the interactive + --discard-remote typed-token confirmation is declined RECOVERY diff --git a/cmd/bd/init_safety_test.go b/cmd/bd/init_safety_test.go index 846266ff8..8119006fe 100644 --- a/cmd/bd/init_safety_test.go +++ b/cmd/bd/init_safety_test.go @@ -358,6 +358,12 @@ func TestShouldWireInitRemote(t *testing.T) { want: false, }, { + // Keep this true. The URL is the supported pre-first-push wiring: + // the first `bd dolt push` creates refs/dolt/data on that same git + // remote, and bootstrap resolves the persisted value by probing + // for that ref (#5743). Do not "fix" a bootstrap failure by + // un-persisting here — that leaves every already-committed + // .beads/config.yaml in the wild broken. name: "plain git origin without dolt data", syncURL: "git+https://github.com/org/plain-source.git", syncURLFromGit: true, diff --git a/cmd/bd/jira.go b/cmd/bd/jira.go index 006dbf7f8..099359b2a 100644 --- a/cmd/bd/jira.go +++ b/cmd/bd/jira.go @@ -96,9 +96,6 @@ func init() { } func runJiraSync(cmd *cobra.Command, args []string) error { - if usesProxiedServer() { - return HandleErrorRespectJSON("jira sync is not supported in proxied-server mode") - } evt := metrics.NewCommandEvent("jira-sync") defer func() { if c := metrics.Global(); c != nil { @@ -122,11 +119,12 @@ func runJiraSync(cmd *cobra.Command, args []string) error { return HandleErrorRespectJSON("cannot use both --prefer-local and --prefer-jira") } - if err := ensureStoreActive(); err != nil { + trackerStore, err := trackerStoreForCommand(rootCtx) + if err != nil { return HandleErrorRespectJSON("database not available: %v", err) } - if err := validateJiraConfig(); err != nil { + if err := validateJiraConfigForStore(trackerStore); err != nil { return HandleErrorRespectJSON("%v", err) } @@ -137,15 +135,15 @@ func runJiraSync(cmd *cobra.Command, args []string) error { if len(cliProjects) > 0 { jt.SetProjectKeys(tracker.DeduplicateStrings(cliProjects)) } - if err := jt.Init(ctx, store); err != nil { + if err := jt.Init(ctx, trackerStore); err != nil { return HandleErrorRespectJSON("initializing Jira tracker: %v", err) } - engine := tracker.NewEngine(jt, store, actor) + engine := tracker.NewEngine(jt, trackerStore, actor) engine.OnMessage = func(msg string) { fmt.Println(" " + msg) } engine.OnWarning = func(msg string) { fmt.Fprintf(os.Stderr, "Warning: %s\n", msg) } - engine.PushHooks = buildJiraPushHooks(ctx) + engine.PushHooks = buildJiraPushHooksForStore(ctx, trackerStore) opts := tracker.SyncOptions{ Pull: pull, @@ -207,9 +205,13 @@ func runJiraSync(cmd *cobra.Command, args []string) error { // buildJiraPushHooks creates PushHooks for Jira-specific push behavior. func buildJiraPushHooks(ctx context.Context) *tracker.PushHooks { + return buildJiraPushHooksForStore(ctx, tracker.NewStore(store)) +} + +func buildJiraPushHooksForStore(ctx context.Context, st tracker.Store) *tracker.PushHooks { return &tracker.PushHooks{ ShouldPush: func(issue *types.Issue) bool { - pushPrefix, _ := store.GetConfig(ctx, "jira.push_prefix") + pushPrefix, _ := st.GetConfig(ctx, "jira.push_prefix") if pushPrefix == "" { return true } @@ -226,9 +228,6 @@ func buildJiraPushHooks(ctx context.Context) *tracker.PushHooks { } func runJiraStatus(cmd *cobra.Command, args []string) error { - if usesProxiedServer() { - return HandleErrorRespectJSON("jira status is not supported in proxied-server mode") - } evt := metrics.NewCommandEvent("jira-status") defer func() { if c := metrics.Global(); c != nil { @@ -238,22 +237,23 @@ func runJiraStatus(cmd *cobra.Command, args []string) error { ctx := rootCtx - if err := ensureStoreActive(); err != nil { + trackerStore, err := trackerStoreForCommand(rootCtx) + if err != nil { return HandleErrorRespectJSON("%v", err) } - jiraURL, _ := store.GetConfig(ctx, "jira.url") - lastSync, _ := store.GetConfig(ctx, "jira.last_sync") + jiraURL, _ := trackerStore.GetConfig(ctx, "jira.url") + lastSync, _ := trackerStore.GetConfig(ctx, "jira.last_sync") - pluralProjects, _ := store.GetConfig(ctx, "jira.projects") - singularProject, _ := store.GetConfig(ctx, "jira.project") + pluralProjects, _ := trackerStore.GetConfig(ctx, "jira.projects") + singularProject, _ := trackerStore.GetConfig(ctx, "jira.project") projectKeys := tracker.ResolveProjectIDs(nil, pluralProjects, singularProject) configured := jiraURL != "" && len(projectKeys) > 0 // jira sync is a round-trip path — opt out of BEADS_MAX_ROWS // (designer §4.1) so a misconfigured env doesn't abort partway. - allIssues, err := store.SearchIssues(ctx, "", types.IssueFilter{ + allIssues, err := trackerStore.SearchIssues(ctx, "", types.IssueFilter{ MaxRows: 0, MaxRowsSource: "", }) @@ -329,26 +329,29 @@ func runJiraStatus(cmd *cobra.Command, args []string) error { // validateJiraConfig checks that required Jira configuration is present. func validateJiraConfig() error { - if err := ensureStoreActive(); err != nil { - return fmt.Errorf("database not available: %w", err) - } + return validateJiraConfigForStore(tracker.NewStore(store)) +} +func validateJiraConfigForStore(st tracker.Store) error { ctx := rootCtx - jiraURL, _ := store.GetConfig(ctx, "jira.url") + if st == nil { + return fmt.Errorf("database not available") + } + jiraURL, _ := st.GetConfig(ctx, "jira.url") if jiraURL == "" { return fmt.Errorf("jira.url not configured\nRun: bd config set jira.url \"https://company.atlassian.net\"") } // Check for project configuration (singular or plural). - pluralProjects, _ := store.GetConfig(ctx, "jira.projects") - singularProject, _ := store.GetConfig(ctx, "jira.project") + pluralProjects, _ := st.GetConfig(ctx, "jira.projects") + singularProject, _ := st.GetConfig(ctx, "jira.project") projectKeys := tracker.ResolveProjectIDs(nil, pluralProjects, singularProject) if len(projectKeys) == 0 { return fmt.Errorf("no Jira project configured\nRun: bd config set jira.project \"PROJ\"\nOr: bd config set jira.projects \"PROJ1,PROJ2\"") } - apiToken, _ := store.GetConfig(ctx, "jira.api_token") + apiToken, _ := st.GetConfig(ctx, "jira.api_token") if apiToken == "" && os.Getenv("JIRA_API_TOKEN") == "" { return fmt.Errorf("Jira API token not configured\nRun: bd config set jira.api_token \"YOUR_TOKEN\"\nOr: export JIRA_API_TOKEN=YOUR_TOKEN") } diff --git a/cmd/bd/jira_max_rows_gate_test.go b/cmd/bd/jira_max_rows_gate_test.go index aef290ae6..1fd7bf9ef 100644 --- a/cmd/bd/jira_max_rows_gate_test.go +++ b/cmd/bd/jira_max_rows_gate_test.go @@ -8,7 +8,6 @@ import ( "path/filepath" "testing" - "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/testutil" "github.com/steveyegge/beads/internal/tracker" "github.com/steveyegge/beads/internal/types" @@ -124,7 +123,7 @@ type stubMaxRowsTracker struct{} func (*stubMaxRowsTracker) Name() string { return "stubmr" } func (*stubMaxRowsTracker) DisplayName() string { return "StubMR" } func (*stubMaxRowsTracker) ConfigPrefix() string { return "stubmr" } -func (*stubMaxRowsTracker) Init(_ context.Context, _ storage.Storage) error { return nil } +func (*stubMaxRowsTracker) Init(_ context.Context, _ tracker.Store) error { return nil } func (*stubMaxRowsTracker) Validate() error { return nil } func (*stubMaxRowsTracker) Close() error { return nil } func (*stubMaxRowsTracker) FieldMapper() tracker.FieldMapper { return nil } diff --git a/cmd/bd/legacy_upgrade_guard.go b/cmd/bd/legacy_upgrade_guard.go index 4d2e8b58f..02c8e36e0 100644 --- a/cmd/bd/legacy_upgrade_guard.go +++ b/cmd/bd/legacy_upgrade_guard.go @@ -36,10 +36,10 @@ func guardLegacyUpgradeWorkspace(beadsDir string) error { // Validate read-only discovery metadata before any caller can use Load, // which migrates legacy config.json to metadata.json. Removed and unknown // backends must fail without changing the only pointer to their data. - if err := validateConfiguredBackend(cfg); err != nil { + if err := validateConfiguredBackend(cfg, beadsDir); err != nil { return err } - serverMode := cfg != nil && strings.EqualFold(cfg.DoltMode, configfile.DoltModeServer) + serverMode := workspaceSelectsServerMode(cfg) if embeddeddolt.HasRepository(beadsDir) && !serverMode { return nil } @@ -51,11 +51,31 @@ func guardLegacyUpgradeWorkspace(beadsDir string) error { if !hasLocalDoltRoot { return nil } + // Positive evidence that this workspace belongs to the current era settles + // it for every mode. Only the ambiguity that remains after these is + // mode-specific, so the refusals below are the only part that branches. + if classifyVersionWitness(version) == witnessEraCurrent { + // A witness naming bd 1.0 or later can only have been written by a + // current-era binary, and only after this same guard admitted the + // workspace (PersistentPreRunE runs the guard before trackBdVersion, + // and doctor runs it before its own copy of that call). No legacy + // release could have produced it. Reading it as proof only in server + // mode left the escape hatch unreachable for a workspace the running + // binary demonstrably created itself. + return nil + } + if doltserver.IsSharedServerMode() && !(present && legacyServerVersion(version)) { + // A shared Dolt sql-server owns .beads/dolt, so there is no embedded + // historical schema to protect — unless the witness affirmatively names + // the 0.55–0.62 server era. This admission used to sit inside the + // embedded arm below. Leaving it there while config.yaml started + // selecting server mode would have moved shared-server workspaces bd + // admits today onto the refusing arm: the mode changed, the evidence + // did not. + return nil + } if serverMode { - switch classifyVersionWitness(version) { - case witnessEraCurrent: - return nil - case witnessEraUnknown: + if present && classifyVersionWitness(version) == witnessEraUnknown { // A witness that is present but unreadable — including one left // blank or whitespace-only by an interrupted or disk-full // best-effort write — is not evidence of a legacy workspace: every @@ -66,18 +86,13 @@ func guardLegacyUpgradeWorkspace(beadsDir string) error { // command over an advisory, gitignored file. A genuinely absent // witness is not present and still refuses below, preserving the // pre-1.0 guard invariant. - if present { - warnUnreadableVersionWitness(beadsDir, version) - return nil - } + warnUnreadableVersionWitness(beadsDir, version) + return nil } return legacyUpgradeRefusal("legacy Dolt server workspace") } if cfg == nil || cfg.DoltMode == "" || strings.EqualFold(cfg.DoltMode, configfile.DoltModeEmbedded) { - if doltserver.IsSharedServerMode() && !(present && legacyServerVersion(version)) { - return nil - } reason := "legacy Dolt workspace" if _, validVersion := legacyVersionMinor(version); present && validVersion { reason = fmt.Sprintf("legacy Dolt workspace from bd %s", version) @@ -87,6 +102,33 @@ func guardLegacyUpgradeWorkspace(beadsDir string) error { return nil } +// workspaceSelectsServerMode reports whether bd will open beadsDir through a +// Dolt sql-server rather than as an embedded database. +// +// It asks configfile's own resolver instead of reading metadata.json's +// dolt_mode directly. That field is only the highest-priority layer of the +// decision: a workspace that declares `dolt.mode: server` in .beads/config.yaml +// and has no metadata.json at all — the shape gc provisions — is just as much a +// server workspace, and IsDoltServerMode documents the full precedence chain +// that store selection then uses. Reading the top layer alone classified those +// as embedded, and an embedded workspace owning a .beads/dolt root is precisely +// what this guard refuses, so bd rejected server workspaces it had created +// itself moments earlier. +// +// On the PersistentPreRunE and doctor paths the config.yaml layer resolves +// against the SELECTED workspace: main.go binds the discovered target before +// admission for exactly this reason, which is also what makes +// doltserver.IsSharedServerMode() above read the target's config rather than +// the caller's. The ancestor scans are the known exception — +// guardUndiscoveredLegacyWorkspace below and findParentConfig in bootstrap.go +// pass candidates that are by construction not the bound target, so for those +// the env and config.yaml layers come from the caller's process-global state, +// not from the candidate. Do not rely on the binding from a caller that walks +// ancestors. +func workspaceSelectsServerMode(cfg *configfile.Config) bool { + return normalizeLoadedConfig(cfg).IsDoltServerMode() +} + func isHistoricalSQLiteWorkspace(beadsDir string, cfg *configfile.Config) bool { if beadsDir == "" { return false diff --git a/cmd/bd/legacy_upgrade_guard_config_yaml_test.go b/cmd/bd/legacy_upgrade_guard_config_yaml_test.go new file mode 100644 index 000000000..46640052d --- /dev/null +++ b/cmd/bd/legacy_upgrade_guard_config_yaml_test.go @@ -0,0 +1,255 @@ +package main + +import ( + "os" + "path/filepath" + "testing" + + "github.com/steveyegge/beads/internal/config" +) + +// bindSelectedWorkspaceConfig loads beadsDir's config.yaml into the process +// config state the way PersistentPreRunE does — prepareSelectedCommandContext +// binds the discovered target before admission precisely so the guard reads the +// selected workspace's config rather than the caller's. The Dolt env vars are +// pinned off so a developer's ambient shell cannot decide a mode for the guard. +func bindSelectedWorkspaceConfig(t *testing.T, beadsDir string) { + t.Helper() + t.Setenv("HOME", t.TempDir()) + t.Setenv("XDG_CONFIG_HOME", t.TempDir()) + t.Setenv("BEADS_TEST_IGNORE_REPO_CONFIG", "1") + t.Setenv("BEADS_DIR", beadsDir) + t.Setenv("BEADS_DOLT_SERVER_MODE", "0") + t.Setenv("BEADS_DOLT_SHARED_SERVER", "0") + t.Setenv("BEADS_DOLT_SERVER_HOST", "") + + config.ResetForTesting() + if err := config.Initialize(); err != nil { + t.Fatalf("config.Initialize() = %v", err) + } + t.Cleanup(config.ResetForTesting) +} + +// writeDoltRootWorkspace lays down the ambiguous shape the guard classifies: a +// .beads directory that owns a local Dolt root, plus whatever metadata.json, +// config.yaml and version witness the case needs. An empty string means "do not +// write this file at all". +func writeDoltRootWorkspace(t *testing.T, metadata, configYaml, version string) string { + t.Helper() + beadsDir := t.TempDir() + write := func(name, contents string) { + if contents == "" { + return + } + if err := os.WriteFile(filepath.Join(beadsDir, name), []byte(contents), 0o600); err != nil { + t.Fatal(err) + } + } + write("metadata.json", metadata) + write("config.yaml", configYaml) + if version != "" { + if err := writeLocalVersion(filepath.Join(beadsDir, localVersionFile), version); err != nil { + t.Fatal(err) + } + } + if err := os.Mkdir(filepath.Join(beadsDir, "dolt"), 0o700); err != nil { + t.Fatal(err) + } + bindSelectedWorkspaceConfig(t, beadsDir) + return beadsDir +} + +// configYamlServerMode reproduces the gc-provisioned config.yaml: dolt.mode is +// declared as a flat dotted key beside a nested dolt map, which is how bd's own +// `bd config set` writer emits it. +const configYamlServerMode = "issue_prefix: gc\n" + + "dolt:\n" + + " disable-event-flush: true\n" + + "dolt.mode: server\n" + +// TestLegacyUpgradeGuardAdmitsConfigYamlServerModeWorkspace pins the shape the +// v1.3.0 release candidate refused after creating it itself: dolt.mode declared +// in .beads/config.yaml, a local .beads/dolt root, a current-era version +// witness, and no metadata.json. LoadForDiscovery reads metadata.json only, so +// the guard classified a server workspace as embedded — and an embedded +// workspace owning a .beads/dolt root is exactly what it refuses. +func TestLegacyUpgradeGuardAdmitsConfigYamlServerModeWorkspace(t *testing.T) { + versions := []string{ + "1.3.0", + "1.3.0-rc.1", + "1.1.0", + "v1.1.1-0.20260805093327-bf97b73749ac", + } + + for _, version := range versions { + t.Run(version, func(t *testing.T) { + warnings := captureLegacyUpgradeWarnings(t) + beadsDir := writeDoltRootWorkspace(t, "", configYamlServerMode, version) + + if err := guardLegacyUpgradeWorkspace(beadsDir); err != nil { + t.Fatalf("guardLegacyUpgradeWorkspace() = %v, want nil", err) + } + if warnings.Len() != 0 { + t.Fatalf("guard warned about a readable witness: %q", warnings.String()) + } + }) + } + + t.Run("nested dolt.mode mapping", func(t *testing.T) { + captureLegacyUpgradeWarnings(t) + beadsDir := writeDoltRootWorkspace(t, "", "dolt:\n mode: server\n", "1.3.0") + + if err := guardLegacyUpgradeWorkspace(beadsDir); err != nil { + t.Fatalf("guardLegacyUpgradeWorkspace() = %v, want nil", err) + } + }) + + t.Run("unreadable witness warns and opens", func(t *testing.T) { + warnings := captureLegacyUpgradeWarnings(t) + beadsDir := writeDoltRootWorkspace(t, "", configYamlServerMode, "not-a-version") + + if err := guardLegacyUpgradeWorkspace(beadsDir); err != nil { + t.Fatalf("guardLegacyUpgradeWorkspace() = %v, want nil", err) + } + if warnings.Len() == 0 { + t.Fatal("guard admitted an unreadable witness without warning") + } + }) +} + +// TestLegacyUpgradeGuardStillRefusesLegacyConfigYamlServerWorkspace proves the +// config.yaml layer classifies the mode without relaxing the era check: a +// workspace that declares server mode there and carries pre-1.0 evidence — or +// no evidence at all — is still refused. +func TestLegacyUpgradeGuardStillRefusesLegacyConfigYamlServerWorkspace(t *testing.T) { + tests := []struct { + name string + version string + }{ + {name: "historical server era witness", version: "0.62.0"}, + {name: "historical embedded era witness", version: "0.49.6"}, + {name: "four component pre-1.0 witness", version: "0.62.0.1"}, + {name: "no witness at all"}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + captureLegacyUpgradeWarnings(t) + beadsDir := writeDoltRootWorkspace(t, "", configYamlServerMode, tt.version) + + if err := guardLegacyUpgradeWorkspace(beadsDir); !isLegacyUpgradeRefusal(err) { + t.Fatalf("guardLegacyUpgradeWorkspace() = %v, want migration refusal", err) + } + }) + } + + t.Run("metadata embedded mode outranks config.yaml server mode", func(t *testing.T) { + captureLegacyUpgradeWarnings(t) + // metadata.json's dolt_mode is the highest-priority layer, so this stays + // an embedded workspace — and the embedded arm deliberately does not + // trust an unreadable witness. + beadsDir := writeDoltRootWorkspace(t, + `{"backend":"dolt","dolt_mode":"embedded"}`, configYamlServerMode, "not-a-version") + + if err := guardLegacyUpgradeWorkspace(beadsDir); !isLegacyUpgradeRefusal(err) { + t.Fatalf("guardLegacyUpgradeWorkspace() = %v, want migration refusal", err) + } + }) +} + +// TestCurrentVersionWitnessVetoesLegacyVerdictInEveryMode pins the general +// safety net: a witness naming bd 1.0 or later can only have been written by a +// current-era binary, and only after this guard already admitted the workspace, +// so it settles the era regardless of which mode the workspace resolves to. The +// escape hatch used to live inside the server-mode arm, where a misclassified +// workspace could never reach it. +func TestCurrentVersionWitnessVetoesLegacyVerdictInEveryMode(t *testing.T) { + modes := []struct { + name string + metadata string + }{ + {name: "metadata-less"}, + {name: "blank mode", metadata: `{"backend":"dolt"}`}, + {name: "explicit embedded mode", metadata: `{"backend":"dolt","dolt_mode":"embedded"}`}, + {name: "explicit server mode", metadata: `{"backend":"dolt","dolt_mode":"server"}`}, + } + + for _, mode := range modes { + t.Run(mode.name, func(t *testing.T) { + captureLegacyUpgradeWarnings(t) + beadsDir := writeDoltRootWorkspace(t, mode.metadata, "", "1.3.0") + + if err := guardLegacyUpgradeWorkspace(beadsDir); err != nil { + t.Fatalf("guardLegacyUpgradeWorkspace() = %v, want nil", err) + } + }) + + t.Run(mode.name+"/pre-1.0 witness still refuses", func(t *testing.T) { + captureLegacyUpgradeWarnings(t) + beadsDir := writeDoltRootWorkspace(t, mode.metadata, "", "0.62.21") + + if err := guardLegacyUpgradeWorkspace(beadsDir); !isLegacyUpgradeRefusal(err) { + t.Fatalf("guardLegacyUpgradeWorkspace() = %v, want migration refusal", err) + } + }) + + t.Run(mode.name+"/missing witness still refuses", func(t *testing.T) { + captureLegacyUpgradeWarnings(t) + beadsDir := writeDoltRootWorkspace(t, mode.metadata, "", "") + + if err := guardLegacyUpgradeWorkspace(beadsDir); !isLegacyUpgradeRefusal(err) { + t.Fatalf("guardLegacyUpgradeWorkspace() = %v, want migration refusal", err) + } + }) + } + + // The unreadable-witness admission is deliberately NOT hoisted: outside + // server mode a .beads/dolt root is itself strong legacy evidence, and + // TestLegacyUpgradeGuardRefusesOldDoltRootWithoutTrustingVersionWitness + // pins that arm. Keep the boundary explicit so a later cleanup cannot widen + // it by accident. + t.Run("embedded mode still refuses an unreadable witness", func(t *testing.T) { + captureLegacyUpgradeWarnings(t) + beadsDir := writeDoltRootWorkspace(t, `{"backend":"dolt"}`, "", "not-a-version") + + if err := guardLegacyUpgradeWorkspace(beadsDir); !isLegacyUpgradeRefusal(err) { + t.Fatalf("guardLegacyUpgradeWorkspace() = %v, want migration refusal", err) + } + }) +} + +// TestLegacyUpgradeGuardSharedServerAdmissionSurvivesServerClassification keeps +// the shared-server escape reachable now that a config.yaml `dolt.mode: server` +// workspace resolves to the server arm. Before the hoist this admission lived +// only in the embedded arm, so classifying the same workspace correctly would +// have turned a workspace bd admits today into a refusal — trading one +// false-refusal class for another. +func TestLegacyUpgradeGuardSharedServerAdmissionSurvivesServerClassification(t *testing.T) { + tests := []struct { + name string + configYaml string + version string + wantRefusal bool + }{ + {name: "config.yaml server mode without witness", configYaml: configYamlServerMode + "dolt.shared-server: true\n"}, + {name: "shared server only", configYaml: "dolt.shared-server: true\n"}, + {name: "config.yaml server mode with historical server witness", + configYaml: configYamlServerMode + "dolt.shared-server: true\n", version: "0.62.0", wantRefusal: true}, + {name: "not shared and no witness", configYaml: configYamlServerMode, wantRefusal: true}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + captureLegacyUpgradeWarnings(t) + beadsDir := writeDoltRootWorkspace(t, "", tt.configYaml, tt.version) + + err := guardLegacyUpgradeWorkspace(beadsDir) + if tt.wantRefusal && !isLegacyUpgradeRefusal(err) { + t.Fatalf("guardLegacyUpgradeWorkspace() = %v, want migration refusal", err) + } + if !tt.wantRefusal && err != nil { + t.Fatalf("guardLegacyUpgradeWorkspace() = %v, want nil", err) + } + }) + } +} diff --git a/cmd/bd/legacy_upgrade_guard_e2e_test.go b/cmd/bd/legacy_upgrade_guard_e2e_test.go index 48aba781b..619f2289a 100644 --- a/cmd/bd/legacy_upgrade_guard_e2e_test.go +++ b/cmd/bd/legacy_upgrade_guard_e2e_test.go @@ -100,7 +100,17 @@ func TestLegacyUpgradeGuardRefusesBeforeMutatingHistoricalWorkspace(t *testing.T commandCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second) cmd := exec.CommandContext(commandCtx, bd, tc.args...) cmd.Dir = repoDir - cmd.Env = append(os.Environ(), "BD_DISABLE_METRICS=1", "BEADS_DOLT_AUTO_START=0") + // Pin the mode inputs the guard now reads through + // IsDoltServerMode: this child inherits os.Environ(), so + // without them a developer's shell decides which refusal + // text these historical layouts produce. + cmd.Env = append(os.Environ(), + "BD_DISABLE_METRICS=1", + "BEADS_DOLT_AUTO_START=0", + "BEADS_DOLT_SERVER_MODE=0", + "BEADS_DOLT_SHARED_SERVER=0", + "BEADS_DOLT_SERVER_HOST=", + ) var stdout, stderr bytes.Buffer cmd.Stdout = &stdout cmd.Stderr = &stderr @@ -478,6 +488,77 @@ func TestLegacyGuardUsesSelectedTargetSharedServerConfig(t *testing.T) { } } +// TestLegacyGuardAdmitsConfigYamlServerWorkspace runs the real binary against +// the workspace shape gc provisions — `dolt.mode: server` in +// .beads/config.yaml, a local .beads/dolt root, a metadata.json that names no +// dolt_mode — and pins that the guard no longer calls it legacy. The in-process +// guard tests bind the workspace config themselves; only a subprocess proves +// that PersistentPreRunE's own binding puts the selected workspace's +// config.yaml in front of the guard. +// +// The command still fails: the workspace points at a Dolt server that is not +// running. That is the point — reaching the connection attempt means admission +// succeeded and the workspace routed as a server workspace rather than being +// refused or opened as a phantom embedded database. +func TestLegacyGuardAdmitsConfigYamlServerWorkspace(t *testing.T) { + bd := buildBDUnderTest(t) + tests := []struct { + name string + version string + wantLegacyRefusal bool + }{ + {name: "current era witness", version: "1.3.0"}, + {name: "release candidate witness", version: "1.3.0-rc.1"}, + {name: "historical witness still refuses", version: "0.62.0", wantLegacyRefusal: true}, + {name: "missing witness still refuses", wantLegacyRefusal: true}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + repoDir := t.TempDir() + initGitRepo(t, repoDir) + beadsDir := filepath.Join(repoDir, ".beads") + if err := os.MkdirAll(filepath.Join(beadsDir, "dolt"), 0o700); err != nil { + t.Fatal(err) + } + writeFile(t, filepath.Join(beadsDir, "metadata.json"), []byte(`{"backend":"dolt","dolt_database":"hq"}`)) + writeFile(t, filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n mode: server\n auto-start: false\n")) + if tt.version != "" { + writeFile(t, filepath.Join(beadsDir, localVersionFile), []byte(tt.version+"\n")) + } + + commandCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + cmd := exec.CommandContext(commandCtx, bd, "list", "--json", "--limit", "0", "--all") + cmd.Dir = repoDir + cmd.Env = append(os.Environ(), + "BD_DISABLE_METRICS=1", + "BD_DISABLE_EVENT_FLUSH=1", + "BEADS_DOLT_AUTO_START=0", + "BEADS_DOLT_SERVER_PORT=59999", + "BEADS_DOLT_SHARED_SERVER=0", + "HOME="+t.TempDir(), + ) + output, err := cmd.CombinedOutput() + if err == nil { + t.Fatalf("bd list unexpectedly succeeded against an unreachable server:\n%s", output) + } + hasLegacyRefusal := strings.Contains(string(output), "explicit migration is required") + if hasLegacyRefusal != tt.wantLegacyRefusal { + t.Fatalf("bd list legacy refusal=%v, want %v:\n%s", hasLegacyRefusal, tt.wantLegacyRefusal, output) + } + if !tt.wantLegacyRefusal && !strings.Contains(string(output), "Dolt server") { + t.Fatalf("admitted workspace did not route as a server workspace:\n%s", output) + } + if !tt.wantLegacyRefusal { + if _, err := os.Stat(filepath.Join(beadsDir, "embeddeddolt")); !os.IsNotExist(err) { + t.Fatalf("admitted server workspace created a phantom embedded database: %v", err) + } + } + }) + } +} + func legacyUpgradeTreeDigest(t *testing.T, root string) string { t.Helper() var entries []string diff --git a/cmd/bd/legacy_upgrade_guard_test.go b/cmd/bd/legacy_upgrade_guard_test.go index ed4f11742..fe16d698c 100644 --- a/cmd/bd/legacy_upgrade_guard_test.go +++ b/cmd/bd/legacy_upgrade_guard_test.go @@ -8,7 +8,22 @@ import ( "github.com/steveyegge/beads/internal/config" ) +// pinLegacyUpgradeGuardEnv pins the process-global inputs the guard now reads +// through configfile.IsDoltServerMode, so these tables assert the workspace +// shape each case lays down rather than whatever mode the developer's shell +// happens to select. CI already unsets these three +// (scripts/ci/lib/test-env.sh), so the pins make a local `go test ./cmd/bd/` +// match CI instead of changing what CI checks. +func pinLegacyUpgradeGuardEnv(t *testing.T) { + t.Helper() + t.Setenv("BEADS_TEST_IGNORE_REPO_CONFIG", "1") + t.Setenv("BEADS_DOLT_SERVER_MODE", "0") + t.Setenv("BEADS_DOLT_SHARED_SERVER", "0") + t.Setenv("BEADS_DOLT_SERVER_HOST", "") +} + func TestLegacyUpgradeGuardRefusesHistoricalLayoutsWithoutMutatingMetadata(t *testing.T) { + pinLegacyUpgradeGuardEnv(t) tests := []struct { name string metadata string @@ -77,6 +92,7 @@ func TestLegacyUpgradeGuardRefusesHistoricalLayoutsWithoutMutatingMetadata(t *te } func TestLegacyUpgradeGuardMetadataLessSQLiteAndCurrentEmbeddedPrecedence(t *testing.T) { + pinLegacyUpgradeGuardEnv(t) t.Run("metadata-less v091 vc database", func(t *testing.T) { beadsDir := t.TempDir() if err := os.WriteFile(filepath.Join(beadsDir, "vc.db"), []byte("SQLite format 3\x00"), 0o600); err != nil { @@ -247,6 +263,7 @@ func TestLegacyUpgradeGuardMetadataLessSQLiteAndCurrentEmbeddedPrecedence(t *tes } func TestLegacyUpgradeGuardServerSelectionBeatsStaleEmbeddedRepository(t *testing.T) { + pinLegacyUpgradeGuardEnv(t) tests := []struct { name string version string @@ -296,6 +313,7 @@ func TestLegacyUpgradeGuardServerSelectionBeatsStaleEmbeddedRepository(t *testin } func TestLegacyUpgradeGuardRefusesOldDoltRootWithoutTrustingVersionWitness(t *testing.T) { + pinLegacyUpgradeGuardEnv(t) tests := []struct { name string metadata string @@ -331,6 +349,9 @@ func TestLegacyUpgradeGuardRefusesOldDoltRootWithoutTrustingVersionWitness(t *te } func TestLegacyUpgradeGuardSharedServerAdmission(t *testing.T) { + // The per-case BEADS_DOLT_SHARED_SERVER below is set after this and wins; + // the pin is what keeps the other two mode inputs out of the decision. + pinLegacyUpgradeGuardEnv(t) tests := []struct { name string metadata string @@ -380,6 +401,7 @@ func TestLegacyUpgradeGuardSharedServerAdmission(t *testing.T) { } func TestLegacyUpgradeGuardLeavesCurrentDoltWorkspaceAlone(t *testing.T) { + pinLegacyUpgradeGuardEnv(t) beadsDir := t.TempDir() metadata := `{"backend":"dolt","dolt_mode":"embedded"}` if err := os.WriteFile(filepath.Join(beadsDir, "metadata.json"), []byte(metadata), 0o600); err != nil { diff --git a/cmd/bd/legacy_upgrade_guard_witness_test.go b/cmd/bd/legacy_upgrade_guard_witness_test.go index 0ff3130d0..65044227f 100644 --- a/cmd/bd/legacy_upgrade_guard_witness_test.go +++ b/cmd/bd/legacy_upgrade_guard_witness_test.go @@ -104,6 +104,7 @@ func writeSelectedServerWorkspace(t *testing.T, version string) string { } func TestLegacyUpgradeGuardAdmitsNonReleaseVersionWitnesses(t *testing.T) { + pinLegacyUpgradeGuardEnv(t) versions := []string{ "v1.1.1-0.20260805093327-bf97b73749ac", "1.1.0", @@ -128,6 +129,7 @@ func TestLegacyUpgradeGuardAdmitsNonReleaseVersionWitnesses(t *testing.T) { } func TestLegacyUpgradeGuardStillRefusesPreOneWorkspaces(t *testing.T) { + pinLegacyUpgradeGuardEnv(t) versions := []string{ "0.9.1", "v0.49.6", @@ -150,6 +152,7 @@ func TestLegacyUpgradeGuardStillRefusesPreOneWorkspaces(t *testing.T) { } func TestLegacyUpgradeGuardRefusesWorkspaceWithoutAnyWitness(t *testing.T) { + pinLegacyUpgradeGuardEnv(t) captureLegacyUpgradeWarnings(t) beadsDir := writeSelectedServerWorkspace(t, "") @@ -166,6 +169,7 @@ func TestLegacyUpgradeGuardRefusesWorkspaceWithoutAnyWitness(t *testing.T) { // absent witness must still refuse so the pre-1.0 safety invariant does not // relax. func TestLegacyUpgradeGuardWarnsInsteadOfRefusingPresentButBlankWitness(t *testing.T) { + pinLegacyUpgradeGuardEnv(t) blankWitnesses := []struct { name string content []byte @@ -248,6 +252,7 @@ func TestLegacyUpgradeVersionWitnessPresence(t *testing.T) { } func TestLegacyUpgradeGuardWarnsInsteadOfRefusingUnreadableWitness(t *testing.T) { + pinLegacyUpgradeGuardEnv(t) warnings := captureLegacyUpgradeWarnings(t) beadsDir := writeSelectedServerWorkspace(t, "not-a-version") @@ -266,6 +271,7 @@ func TestLegacyUpgradeGuardWarnsInsteadOfRefusingUnreadableWitness(t *testing.T) // next command reads it cleanly. Only a stamp bd rewrites identically every // run (a Homebrew --HEAD build, GH#5603) can warn repeatedly. func TestLegacyUpgradeGuardWarningIsSelfHealing(t *testing.T) { + pinLegacyUpgradeGuardEnv(t) warnings := captureLegacyUpgradeWarnings(t) beadsDir := writeSelectedServerWorkspace(t, "not-a-version") @@ -297,6 +303,7 @@ func TestLegacyUpgradeGuardWarningIsSelfHealing(t *testing.T) { // needs the shape recognizer in GH#5625 (anisoptera), which this does not // duplicate. func TestLegacyUpgradeGuardAdmitsBrewHeadStamp(t *testing.T) { + pinLegacyUpgradeGuardEnv(t) for _, stamp := range []string{"HEAD-f925f3f", "HEAD", "HEAD-f925f3f_1"} { t.Run(stamp, func(t *testing.T) { captureLegacyUpgradeWarnings(t) diff --git a/cmd/bd/linear.go b/cmd/bd/linear.go index edd5e2ef9..8e24cb777 100644 --- a/cmd/bd/linear.go +++ b/cmd/bd/linear.go @@ -215,9 +215,6 @@ func init() { } func runLinearSync(cmd *cobra.Command, args []string) error { - if usesProxiedServer() { - return HandleErrorRespectJSON("linear sync is not supported in proxied-server mode") - } evt := metrics.NewCommandEvent("linear-sync") defer func() { if c := metrics.Global(); c != nil { @@ -312,16 +309,17 @@ func runLinearSync(cmd *cobra.Command, args []string) error { return HandleErrorRespectJSON("--milestones only applies when pulling from Linear") } - if err := ensureStoreActive(); err != nil { + trackerStore, err := trackerStoreForCommand(rootCtx) + if err != nil { return HandleErrorRespectJSON("database not available: %v", err) } - if err := validateLinearConfig(cliTeams); err != nil { + if err := validateLinearConfigForStore(trackerStore, cliTeams); err != nil { return HandleErrorRespectJSON("%v", err) } ctx := rootCtx - teamIDs := getLinearTeamIDs(ctx, cliTeams) + teamIDs := getLinearTeamIDsForStore(ctx, trackerStore, cliTeams) willPush := push || !pull if willPush && len(teamIDs) > 1 && len(cliTeams) == 0 { @@ -331,7 +329,7 @@ func runLinearSync(cmd *cobra.Command, args []string) error { lt := &linear.Tracker{} lt.SetTeamIDs(teamIDs) - if err := lt.Init(ctx, store); err != nil { + if err := lt.Init(ctx, trackerStore); err != nil { return HandleErrorRespectJSON("initializing Linear tracker: %v", err) } if willPush { @@ -340,11 +338,11 @@ func runLinearSync(cmd *cobra.Command, args []string) error { } } - engine := tracker.NewEngine(lt, store, actor) + engine := tracker.NewEngine(lt, trackerStore, actor) engine.OnMessage = func(msg string) { fmt.Println(" " + msg) } engine.OnWarning = func(msg string) { fmt.Fprintf(os.Stderr, "Warning: %s\n", msg) } - engine.PullHooks = buildLinearPullHooks(ctx, linearPullHookOptions{ + engine.PullHooks = buildLinearPullHooksForStore(ctx, trackerStore, linearPullHookOptions{ Milestones: milestones, DryRun: dryRun, Actor: actor, @@ -365,7 +363,7 @@ func runLinearSync(cmd *cobra.Command, args []string) error { for _, t := range excludeTypes { opts.ExcludeTypes = append(opts.ExcludeTypes, types.IssueType(strings.ToLower(t))) } - applyLinearExcludeIDConfig(ctx, store, &opts) + applyLinearExcludeIDConfig(ctx, trackerStore, &opts) if !includeEphemeral { opts.ExcludeEphemeral = true } @@ -375,7 +373,7 @@ func runLinearSync(cmd *cobra.Command, args []string) error { } allowProjectCreates := opts.ParentID != "" || len(opts.IssueIDs) > 0 - engine.PushHooks = buildLinearPushHooks(ctx, lt, allowProjectCreates) + engine.PushHooks = buildLinearPushHooksForStore(ctx, trackerStore, lt, allowProjectCreates) if preferLocal { opts.ConflictResolution = tracker.ConflictLocal @@ -420,7 +418,7 @@ func runLinearSync(cmd *cobra.Command, args []string) error { // receives opts by value. effectivePush := push || (!push && !pull) if effectivePush && result.Success && !syncIsScoped(&opts) { - reconcileLinearParents(ctx, lt, dryRun, jsonOutput, &result.Warnings) + reconcileLinearParentsForStore(ctx, trackerStore, lt, dryRun, jsonOutput, &result.Warnings) } // Record successful pull timestamp @@ -480,12 +478,12 @@ type linearPullHookOptions struct { // buildLinearPullHooks creates PullHooks for Linear-specific pull behavior. func buildLinearPullHooks(ctx context.Context, opts linearPullHookOptions) *tracker.PullHooks { - return buildLinearPullHooksForStore(ctx, store, opts) + return buildLinearPullHooksForStore(ctx, tracker.NewStore(store), opts) } -func buildLinearPullHooksForStore(ctx context.Context, st storage.Storage, opts linearPullHookOptions) *tracker.PullHooks { - idMode := getLinearIDMode(ctx) - hashLength := getLinearHashLength(ctx) +func buildLinearPullHooksForStore(ctx context.Context, st tracker.Store, opts linearPullHookOptions) *tracker.PullHooks { + idMode := getLinearIDModeForStore(ctx, st) + hashLength := getLinearHashLengthForStore(ctx, st) hooks := &tracker.PullHooks{} hookActor := opts.Actor @@ -573,7 +571,7 @@ func isLinearMilestoneExternalRef(ref string) bool { return strings.HasPrefix(strings.TrimSpace(ref), linearMilestoneExternalRefPrefix) } -func ensureLinearMilestoneEpic(ctx context.Context, st storage.Storage, ms *linear.ProjectMilestone, actor string, generateID func(context.Context, *types.Issue) error) (string, error) { +func ensureLinearMilestoneEpic(ctx context.Context, st tracker.Store, ms *linear.ProjectMilestone, actor string, generateID func(context.Context, *types.Issue) error) (string, error) { milestoneID := strings.TrimSpace(ms.ID) if milestoneID == "" { return "", fmt.Errorf("Linear project milestone is missing id") @@ -644,7 +642,7 @@ func ensureLinearMilestoneEpic(ctx context.Context, st storage.Storage, ms *line return ref, nil } -func findLinearMilestoneEpic(ctx context.Context, st storage.Storage, ref, milestoneID, title string) (*types.Issue, error) { +func findLinearMilestoneEpic(ctx context.Context, st tracker.Store, ref, milestoneID, title string) (*types.Issue, error) { if existing, err := st.GetIssueByExternalRef(ctx, ref); err == nil { return existing, nil } else if !errors.Is(err, storage.ErrNotFound) { @@ -747,6 +745,10 @@ func isLinearMilestoneIssue(issue *types.Issue) bool { // buildLinearPushHooks creates PushHooks for Linear-specific push behavior. func buildLinearPushHooks(ctx context.Context, lt *linear.Tracker, allowProjectCreates bool) *tracker.PushHooks { + return buildLinearPushHooksForStore(ctx, tracker.NewStore(store), lt, allowProjectCreates) +} + +func buildLinearPushHooksForStore(ctx context.Context, st tracker.Store, lt *linear.Tracker, allowProjectCreates bool) *tracker.PushHooks { config := lt.MappingConfig() var labelOnce sync.Once var labelCache *linear.LabelCache @@ -790,7 +792,7 @@ func buildLinearPushHooks(ctx context.Context, lt *linear.Tracker, allowProjectC if isLinearMilestoneIssue(issue) { return false } - if projectID, _ := store.GetConfig(ctx, "linear.project_id"); projectID != "" { + if projectID, _ := st.GetConfig(ctx, "linear.project_id"); projectID != "" { if issue.ExternalRef == nil || strings.TrimSpace(*issue.ExternalRef) == "" { if !allowProjectCreates { return false @@ -799,7 +801,7 @@ func buildLinearPushHooks(ctx context.Context, lt *linear.Tracker, allowProjectC } // Apply push prefix filtering if configured - pushPrefix, _ := store.GetConfig(ctx, "linear.push_prefix") + pushPrefix, _ := st.GetConfig(ctx, "linear.push_prefix") if pushPrefix == "" { return true } @@ -816,9 +818,6 @@ func buildLinearPushHooks(ctx context.Context, lt *linear.Tracker, allowProjectC } func runLinearStatus(cmd *cobra.Command, args []string) error { - if usesProxiedServer() { - return HandleErrorRespectJSON("linear status is not supported in proxied-server mode") - } evt := metrics.NewCommandEvent("linear-status") defer func() { if c := metrics.Global(); c != nil { @@ -828,20 +827,21 @@ func runLinearStatus(cmd *cobra.Command, args []string) error { ctx := rootCtx - if err := ensureStoreActive(); err != nil { + trackerStore, err := trackerStoreForCommand(rootCtx) + if err != nil { return HandleErrorRespectJSON("%v", err) } - apiKey, _ := getLinearConfig(ctx, "linear.api_key") - oauthClientID, _ := getLinearConfig(ctx, "linear.oauth_client_id") - oauthClientSecret, _ := getLinearConfig(ctx, "linear.oauth_client_secret") - teamIDs := getLinearTeamIDs(ctx, nil) - lastSync, _ := store.GetConfig(ctx, "linear.last_sync") + apiKey, _ := getLinearConfigForStore(ctx, trackerStore, "linear.api_key") + oauthClientID, _ := getLinearConfigForStore(ctx, trackerStore, "linear.oauth_client_id") + oauthClientSecret, _ := getLinearConfigForStore(ctx, trackerStore, "linear.oauth_client_secret") + teamIDs := getLinearTeamIDsForStore(ctx, trackerStore, nil) + lastSync, _ := trackerStore.GetConfig(ctx, "linear.last_sync") hasOAuth := oauthClientID != "" && oauthClientSecret != "" configured := (apiKey != "" || hasOAuth) && len(teamIDs) > 0 - allIssues, err := store.SearchIssues(ctx, "", types.IssueFilter{}) + allIssues, err := trackerStore.SearchIssues(ctx, "", types.IssueFilter{}) if err != nil { return HandleErrorRespectJSON("%v", err) } @@ -932,9 +932,6 @@ func runLinearStatus(cmd *cobra.Command, args []string) error { } func runLinearTeams(cmd *cobra.Command, args []string) error { - if usesProxiedServer() { - return HandleErrorRespectJSON("linear teams is not supported in proxied-server mode") - } evt := metrics.NewCommandEvent("linear-teams") defer func() { if c := metrics.Global(); c != nil { @@ -944,7 +941,19 @@ func runLinearTeams(cmd *cobra.Command, args []string) error { ctx := rootCtx - client, err := buildLinearClient(ctx, "") + // Team discovery is API-only and must not initialize or probe a local + // beads store. In proxied mode, read config through the existing UOW seam. + var configStore tracker.Store + var err error + if usesProxiedServer() { + configStore, err = trackerStoreForCommand(ctx) + if err != nil { + return HandleError("database not available: %v", err) + } + } else if store != nil { + configStore = tracker.NewStore(store) + } + client, err := buildLinearClientAPIOnly(ctx, "", configStore) if err != nil { return HandleError("%v", err) } @@ -1000,19 +1009,19 @@ func isValidUUID(s string) bool { // validateLinearConfig checks that required Linear configuration is present. // cliTeams is the list of team IDs from the --team flag (may be nil). func validateLinearConfig(cliTeams []string) error { - if err := ensureStoreActive(); err != nil { - return fmt.Errorf("database not available: %w", err) - } + return validateLinearConfigForStore(tracker.NewStore(store), cliTeams) +} +func validateLinearConfigForStore(st tracker.Store, cliTeams []string) error { ctx := rootCtx // Accept either OAuth credentials or API key. - oauthClientID, _ := getLinearConfig(ctx, "linear.oauth_client_id") - oauthClientSecret, _ := getLinearConfig(ctx, "linear.oauth_client_secret") + oauthClientID, _ := getLinearConfigForStore(ctx, st, "linear.oauth_client_id") + oauthClientSecret, _ := getLinearConfigForStore(ctx, st, "linear.oauth_client_secret") hasOAuth := oauthClientID != "" && oauthClientSecret != "" if !hasOAuth { - apiKey, _ := getLinearConfig(ctx, "linear.api_key") + apiKey, _ := getLinearConfigForStore(ctx, st, "linear.api_key") if apiKey == "" { return fmt.Errorf("Linear authentication not configured\n" + "Options:\n" + @@ -1021,7 +1030,7 @@ func validateLinearConfig(cliTeams []string) error { } } - teamIDs := getLinearTeamIDs(ctx, cliTeams) + teamIDs := getLinearTeamIDsForStore(ctx, st, cliTeams) if len(teamIDs) == 0 { return fmt.Errorf("no Linear team ID configured\nRun: bd config set linear.team_id \"TEAM_ID\"\nOr: bd config set linear.team_ids \"TEAM_ID1,TEAM_ID2\"\nOr: export LINEAR_TEAM_ID=TEAM_ID") } @@ -1048,6 +1057,10 @@ func maskAPIKey(key string) string { // Priority: environment variable > project config. // Env vars take precedence so CI workers can override config without modifying config.yaml. func getLinearConfig(ctx context.Context, key string) (value string, source string) { + return getLinearConfigForStore(ctx, tracker.NewStore(store), key) +} + +func getLinearConfigForStore(ctx context.Context, st tracker.Store, key string) (value string, source string) { // Secret keys (e.g. linear.api_key) are stored in config.yaml, not the // Dolt database, to avoid leaking secrets when pushing to remotes. // Env vars are checked first so that LINEAR_OAUTH_CLIENT_ID/SECRET etc. @@ -1066,8 +1079,8 @@ func getLinearConfig(ctx context.Context, key string) (value string, source stri } // Try to read from store (works in direct mode) - if store != nil { - value, _ = store.GetConfig(ctx, key) // Best effort: empty value is valid fallback + if st != nil { + value, _ = st.GetConfig(ctx, key) // Best effort: empty value is valid fallback if value != "" { return value, "project config (bd config)" } @@ -1115,8 +1128,12 @@ func linearConfigToEnvVar(key string) string { // getLinearTeamIDs resolves the effective team IDs from all config sources. // Precedence: cliTeams (--team flag) > linear.team_ids > LINEAR_TEAM_IDS > linear.team_id > LINEAR_TEAM_ID func getLinearTeamIDs(ctx context.Context, cliTeams []string) []string { - pluralVal, _ := getLinearConfig(ctx, "linear.team_ids") - singularVal, _ := getLinearConfig(ctx, "linear.team_id") + return getLinearTeamIDsForStore(ctx, tracker.NewStore(store), cliTeams) +} + +func getLinearTeamIDsForStore(ctx context.Context, st tracker.Store, cliTeams []string) []string { + pluralVal, _ := getLinearConfigForStore(ctx, st, "linear.team_ids") + singularVal, _ := getLinearConfigForStore(ctx, st, "linear.team_id") return tracker.ResolveProjectIDs(cliTeams, pluralVal, singularVal) } @@ -1189,6 +1206,40 @@ func buildLinearClient(ctx context.Context, teamID string) (*linear.Client, erro return linear.NewClient(apiKey, teamID), nil } +func buildLinearClientAPIOnly(ctx context.Context, teamID string, st tracker.Store) (*linear.Client, error) { + oauthClientID := os.Getenv("LINEAR_OAUTH_CLIENT_ID") + oauthClientSecret := os.Getenv("LINEAR_OAUTH_CLIENT_SECRET") + if oauthClientID == "" { + oauthClientID = config.GetString("linear.oauth_client_id") + } + if oauthClientSecret == "" { + oauthClientSecret = config.GetString("linear.oauth_client_secret") + } + // Select the auth branch first and apply linear.api_endpoint once, after + // it — the shape Tracker.Init uses. Returning the OAuth client inline + // would leave this helper asymmetric between its own two branches, with a + // custom endpoint honored for an API key and ignored for OAuth. + var client *linear.Client + if oauthClientID != "" && oauthClientSecret != "" { + client = linear.NewOAuthClient(linear.OAuthConfig{ClientID: oauthClientID, ClientSecret: oauthClientSecret}, teamID) + } else { + apiKey := os.Getenv("LINEAR_API_KEY") + if apiKey == "" { + apiKey = config.GetString("linear.api_key") + } + if apiKey == "" { + return nil, fmt.Errorf("Linear authentication not configured") + } + client = linear.NewClient(apiKey, teamID) + } + if st != nil { + if endpoint, _ := st.GetConfig(ctx, "linear.api_endpoint"); endpoint != "" { + client = client.WithEndpoint(endpoint) + } + } + return client, nil +} + // storeConfigLoader adapts the store to the linear.ConfigLoader interface. type storeConfigLoader struct { ctx context.Context @@ -1209,7 +1260,11 @@ func loadLinearMappingConfig(ctx context.Context) *linear.MappingConfig { // getLinearIDMode returns the configured ID mode for Linear imports. // Supported values: "hash" (default) or "db". func getLinearIDMode(ctx context.Context) string { - mode, _ := getLinearConfig(ctx, "linear.id_mode") + return getLinearIDModeForStore(ctx, tracker.NewStore(store)) +} + +func getLinearIDModeForStore(ctx context.Context, st tracker.Store) string { + mode, _ := getLinearConfigForStore(ctx, st, "linear.id_mode") mode = strings.ToLower(strings.TrimSpace(mode)) if mode == "" { return "hash" @@ -1244,7 +1299,11 @@ func applyLinearExcludeIDConfig(ctx context.Context, reader configReader, opts * // getLinearHashLength returns the configured hash length for Linear imports. // Values are clamped to the supported range 3-8. func getLinearHashLength(ctx context.Context) int { - raw, _ := getLinearConfig(ctx, "linear.hash_length") + return getLinearHashLengthForStore(ctx, tracker.NewStore(store)) +} + +func getLinearHashLengthForStore(ctx context.Context, st tracker.Store) int { + raw, _ := getLinearConfigForStore(ctx, st, "linear.hash_length") if raw == "" { return 6 } @@ -1315,10 +1374,14 @@ func syncIsScoped(opts *tracker.SyncOptions) bool { // Warnings (per-link failures, missing refs) are appended to the engine's // warning slice so the user sees them in the standard sync output. func reconcileLinearParents(ctx context.Context, lt *linear.Tracker, dryRun, jsonOutput bool, warnings *[]string) { - if lt == nil || store == nil { + reconcileLinearParentsForStore(ctx, tracker.NewStore(store), lt, dryRun, jsonOutput, warnings) +} + +func reconcileLinearParentsForStore(ctx context.Context, st tracker.Store, lt *linear.Tracker, dryRun, jsonOutput bool, warnings *[]string) { + if lt == nil || st == nil { return } - links, err := buildLinearParentLinks(ctx, lt) + links, err := buildLinearParentLinksForStore(ctx, st, lt) if err != nil { *warnings = append(*warnings, fmt.Sprintf("parent reconcile: building link set failed: %v", err)) return @@ -1364,7 +1427,14 @@ func reconcileLinearParents(ctx context.Context, lt *linear.Tracker, dryRun, jso // they'll get picked up on a subsequent sync once the parent has an // external_ref. func buildLinearParentLinks(ctx context.Context, lt *linear.Tracker) ([]linear.ParentLink, error) { - issues, err := store.SearchIssues(ctx, "", types.IssueFilter{}) + return buildLinearParentLinksForStore(ctx, tracker.NewStore(store), lt) +} + +func buildLinearParentLinksForStore(ctx context.Context, st tracker.Store, lt *linear.Tracker) ([]linear.ParentLink, error) { + if st == nil { + return nil, fmt.Errorf("database not available") + } + issues, err := st.SearchIssues(ctx, "", types.IssueFilter{}) if err != nil { return nil, err } @@ -1396,7 +1466,7 @@ func buildLinearParentLinks(ctx context.Context, lt *linear.Tracker) ([]linear.P if !ok { continue } - deps, err := store.GetDependenciesWithMetadata(ctx, issue.ID) + deps, err := st.GetDependenciesWithMetadata(ctx, issue.ID) if err != nil { return nil, fmt.Errorf("loading deps for %s: %w", issue.ID, err) } diff --git a/cmd/bd/list_proxied_server.go b/cmd/bd/list_proxied_server.go index 6a05ededa..2a184e254 100644 --- a/cmd/bd/list_proxied_server.go +++ b/cmd/bd/list_proxied_server.go @@ -22,7 +22,7 @@ import ( func runListProxiedServer(cmd *cobra.Command, ctx context.Context, out io.Writer, in listInput) error { if in.repoOverrideSet { - return errors.New("--repo is not supported with --proxied-server") + return HandleProxyCapabilityError(AssertProxyCapability(ProxyModeProxied, ProxyCapRepo)) } switch { case in.watchMode: diff --git a/cmd/bd/main.go b/cmd/bd/main.go index a0089b3b1..8433bc7f3 100644 --- a/cmd/bd/main.go +++ b/cmd/bd/main.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "io" "os" "os/exec" "os/signal" @@ -110,6 +111,13 @@ var ( // an intentional empty JSONL artifact instead of treating it as ambiguous. commandMayEmptyJSONLExport atomic.Bool + // commandDeletedIssueIDs is the in-process handoff from the delete + // commands to post-run auto-export: ids this command hard-deleted are + // PROVEN gone, so the export's orphan guard skips them instead of + // mistaking a deliberate delete for a torn store and refusing forever + // (GH#5896). See deletedIssueIDSet for why it is not persisted. + commandDeletedIssueIDs deletedIssueIDSet + // commandDidExplicitDoltCommit is set when a command already created a Dolt commit // explicitly (e.g., bd sync in dolt-native mode, hook flows, bd vc commit). // This prevents a redundant auto-commit attempt in PersistentPostRun. @@ -124,6 +132,15 @@ var ( // This is used for tip-commit message formatting. commandTipIDsShown map[string]struct{} + // commandFreeze is the migration-freeze lookup for this invocation, + // resolved once in PersistentPreRunE (dc-6jaq). Both hooks read it: the + // pre-run gate refuses writes from it, and PersistentPostRunE skips its + // own maintenance writes — auto-commit, tip metadata, backup, export, + // push — so a read command run during a freeze does not leave a new Dolt + // commit in the store being migrated. Zero value means "not frozen", + // which is the right default for the paths that never resolve it. + commandFreeze migration.Result + // commandSpan is the root OTel span for the current command execution. // All storage and AI spans are nested as children of this span. commandSpan oteltrace.Span @@ -321,6 +338,74 @@ func isForcedMigrate(cmd *cobra.Command) bool { return force } +// printGlobalDatabaseConsentHint adds the one thing the gate's own block +// cannot know: which database this invocation was aimed at. Under --global the +// open targets `beads_global`, so the block's `bd migrate schema` would +// migrate the PROJECT database and leave the refusal in place — the working +// remedy is the same verb with the same flag. +func printGlobalDatabaseConsentHint(w io.Writer) { + if !globalFlag { + return + } + fmt.Fprintf(w, + "\n This command targeted the global database (--global), so run the\n"+ + " migrate step with the same flag:\n"+ + " %s\n", + schema.SharedConsentCommandGlobal) +} + +// renderTypedOpenError prints the actionable block for the store-open failures +// that carry one, honoring --json, and reports whether it handled err. A false +// return means the caller should fall back to its own generic message. +// +// Every open path needs this — the Dolt store, the proxied unit-of-work +// provider, and `bd serve`'s startup. The proxied one used to render every +// failure as `%v` inside "failed to open uow provider", which turned a +// multi-line rebuild or migrate-consent guide into one truncated line. +func renderTypedOpenError(err error) bool { + // Schema skew gets dedicated UX with actionable rebuild instructions. + var skewErr *schema.SchemaSkewError + if errors.As(err, &skewErr) { + if jsonOutput { + handleSchemaSkewJSON(skewErr) + } else { + fmt.Fprint(os.Stderr, skewErr.UserMessage()) + } + return true + } + // #4259 / #5920: the migrate gate blocks a silent in-place migration and + // tells the operator to migrate, adopt, or consent. + var gateErr *schema.RemoteMigrateGateError + if errors.As(err, &gateErr) { + if jsonOutput { + handleRemoteMigrateGateJSON(gateErr) + } else { + fmt.Fprint(os.Stderr, gateErr.UserMessage()) + printGlobalDatabaseConsentHint(os.Stderr) + } + return true + } + return false +} + +// isSchemaMigrateVerb reports whether cmd is `bd migrate schema` — the one +// invocation in which the operator asked for a schema migration by name. That +// request is the consent the shared-store gate wants for a database with no +// remote (#5920); see schema.SetSharedMigrateConsent. +// +// Deliberately just this one command, not the `bd migrate` tree. Bare +// `bd migrate` reconciles version/repo-id/clone-id metadata and never applies +// a migration itself, and its flag modes are further from schema work still: +// `bd migrate --update-repo-id` is repo-fingerprint surgery after a git remote +// change, and treating it as consent would let a repo-ID update promote the +// schema for every co-resident client as a side effect. `bd migrate sync`, +// `bd migrate hooks`, and the mode-switch verbs consent to nothing either. +// The operator who does want to migrate has the verb this names, and +// `--force` still unlocks from either migrate command. +func isSchemaMigrateVerb(cmd *cobra.Command) bool { + return cmd == migrateSchemaCmd +} + // forcedMigratePreviewFlag returns the name of a preview flag (--dry-run, // --inspect) that conflicts with --force on a forced migrate invocation, or "" // when there is no conflict. The combination must be rejected BEFORE the store @@ -892,9 +977,11 @@ var rootCmd = &cobra.Command{ // Reset per-command write tracking (used by Dolt auto-commit). commandDidWrite.Store(false) commandMayEmptyJSONLExport.Store(false) + commandDeletedIssueIDs.reset() commandDidExplicitDoltCommit = false commandDidWriteTipMetadata = false commandTipIDsShown = make(map[string]struct{}) + commandFreeze = migration.Result{} // Set up signal-aware context with batch commit flush on shutdown. // Unlike signal.NotifyContext, this also handles SIGHUP and flushes @@ -1169,10 +1256,29 @@ var rootCmd = &cobra.Command{ fmt.Fprintf(os.Stderr, "warning: %v\n", err) } } + if cmdName == "doctor" && usesProxiedServer() { + // Refuse only on a real refusal. validateProxyMaintenance... + // returns nil for doctor subcommands, and returning early on + // that would skip the legacy-store guard and autocommit-mode + // resolution every other skipsStoreInit command still runs. + if err := validateProxyMaintenanceBeforeProvider(cmd); err != nil { + return err + } + } if beadsDir == "" { beadsDir = beads.FindBeadsDir() } if err := guardLegacyNoStoreCommand(cmd, beadsDir); err != nil { + isMigrationCommand := false + for current := cmd; current != nil; current = current.Parent() { + if current.Name() == "migrate" { + isMigrationCommand = true + break + } + } + if isMigrationCommand { + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: "proxy.migrate.invalid_state", Message: err.Error(), ExitCode: 1, Mutates: false}) + } return HandleError("%v", err) } if _, err := getDoltAutoCommitMode(); err != nil { @@ -1357,9 +1463,29 @@ var rootCmd = &cobra.Command{ if cfgErr != nil { return HandleError("failed to load beads config from %s: %v (refusing to fall back to the embedded store; fix or restore metadata.json and retry)", beadsDir, cfgErr) } - if backendErr := validateConfiguredBackend(cfg); backendErr != nil { + if backendErr := validateConfiguredBackend(cfg, beadsDir); backendErr != nil { return HandleError("%v", backendErr) } + // Reject proxy capability combinations before any workspace side effect + // (version tracking, migration, auto-start, or provider construction). + if cfg != nil && cfg.IsDoltProxiedServerMode() { + if err := validateProxyCapabilitiesBeforeProvider(cmd); err != nil { + return err + } + if err := validateProxyMaintenanceBeforeProvider(cmd); err != nil { + return err + } + if err := validateProxyTransformBeforeProvider(cmd); err != nil { + return err + } + } + // The proxied provider cannot guarantee strict read-only semantics. Refuse + // before provider construction so no connection, migration, or mutation + // is attempted; expose the same stable capability code as other proxy + // front-door refusals. + if readonlyMode && cfg != nil && cfg.IsDoltProxiedServerMode() { + return HandleProxyCapabilityError(AssertProxyCapability(ProxyModeProxied, ProxyCapReadonly)) + } if readonlyMode && !backendSupportsStrictReadonly(cfg) { return HandleError("strict readonly is unavailable for dolt proxied-server backend; refusing to open a store that cannot guarantee mutation-free access") } @@ -1381,7 +1507,7 @@ var rootCmd = &cobra.Command{ policy := effectiveRootStorePolicy(cmd.Name(), readonlyMode) useReadOnly := policy.readOnly || previewMode - // dc-6jaq: consult the MIGRATION-FREEZE sentinel here, before any of + // dc-6jaq: consult the migration freeze marker here, before any of // this hook's own store-touching side effects — trackBdVersion below // (writes .local_version), autoMigrateOnVersionBump (opens its own // store connection and can apply a schema migration), and @@ -1395,13 +1521,27 @@ var rootCmd = &cobra.Command{ // "write" commands to drift out of sync with the one useReadOnly is // built from. An explicit --dry-run/--inspect preview also sets // useReadOnly and so skips this early gate the same way, but is NOT - // exempt overall: CheckReadonly's own freeze check runs again, - // unconditionally, at the per-command chokepoint once RunE is - // reached, and that later call has no preview awareness — so a - // preview on a frozen town still exits 1 there, fail-closed, same as - // strict --readonly already blocks `create --dry-run` today. + // exempt overall: the per-command chokepoint checks again once RunE + // is reached, with no preview awareness — CheckReadonly for the ~120 + // commands that call it, and runImport's own call for `bd import + // --dry-run`, which is not one of them. So a preview on a frozen + // workspace still exits ExitMigrationFrozen there, fail-closed, same + // as strict --readonly already blocks `create --dry-run` today. + // Returning the refusal rather than exiting is load-bearing: the + // gates acquired above are released by this hook's deferred cleanup, + // which os.Exit would skip. + // + // One lookup answers the whole invocation: the walk is a stat per + // ancestor of both the cwd and the resolved workspace, and resolving + // it twice a statement apart would not only pay for it twice but let + // the two readings disagree about a marker that appeared or vanished + // in between (write allowed but maintenance skipped, or the reverse). + // PostRunE reads the same answer via commandFreeze. + commandFreeze = migration.Find(beadsDir) if !useReadOnly { - CheckMigrationFreeze(strings.TrimPrefix(cmd.CommandPath(), cmd.Root().Name()+" ")) + if err := migrationFreezeGate(cmd, strings.TrimPrefix(cmd.CommandPath(), cmd.Root().Name()+" "), commandFreeze); err != nil { + return err + } } // dc-6jaq (review round 2, ask #1): a command classified read-only — @@ -1411,14 +1551,12 @@ var rootCmd = &cobra.Command{ // writes against the (possibly frozen) store, run regardless of the // command's own classification — so "the command is a read" must not // imply "these side effects may still run". Reproduced pre-fix: - // freeze the town, seed .local_version with a stale version, run + // freeze the workspace, seed .local_version with a stale version, run // `bd list` — exit 0 (correct, it's a read), but .local_version was // silently rewritten mid-freeze anyway. Skip both calls under an - // active freeze without blocking the read itself. Short-circuits on - // !policy.runMaintenance (strict --readonly) so the IsFrozen/ - // findTownRoot filesystem walk isn't paid on that path, where these - // calls are already skipped for an unrelated reason. - frozenForMaintenance := policy.runMaintenance && migration.IsFrozen(findTownRoot()) + // active freeze without blocking the read itself. Reuses the single + // lookup resolved above rather than repeating the walk. + frozenForMaintenance := policy.runMaintenance && commandFreeze.Frozen() // Track bd version changes unless strict readonly forbids repository mutation. // Best-effort tracking - failures are silent. @@ -1448,6 +1586,14 @@ var rootCmd = &cobra.Command{ // root command ever be re-run in-process (tests, a future server mode). schema.SetForceAllowRemoteMigrate(forcedMigrate) + // Typing `bd migrate schema` is consent to migrate a shared database + // that has no remote (#5920): there is no cross-clone fork to risk, + // only the co-resident lockout the operator is asking to accept. A + // preview withholds it — `bd migrate schema --dry-run` must not + // migrate on the way to printing what it would do. Same set-or-clear + // discipline as the --force override above. + schema.SetSharedMigrateConsent(isSchemaMigrateVerb(cmd) && !previewMode) + // Auto-migrate database on version bump (bd-jgxi). // Runs for ALL non-preview commands (including read-only ones) because // the migration opens its own store connection, writes the version @@ -1488,12 +1634,27 @@ var rootCmd = &cobra.Command{ // deployments that empty relic answers every query with an empty // result set and exit 0 (false-empty), which readers misinterpret as // "no work". Absent metadata.json (cfg == nil, cfgErr == nil) keeps - // the fresh-repo embedded default below — unless env/config.yaml - // supply a remote host (GH#3545): host inference must not depend - // on metadata existing, so substitute the default config and let - // the normal mode/connection resolution run. - if cfg == nil && configfile.DefaultConfig().HostImpliesServerMode() { - logConfigDiscovery(beadsDir, "no metadata.json; host inference (GH#3545) selects server mode") + // the fresh-repo embedded default below — unless the env/config.yaml + // layers already select server mode: that decision must not depend on + // metadata existing, so substitute the default config and let the + // normal mode/connection resolution run. + // + // The gate asks IsDoltServerMode — the same resolver the branch below + // uses to set doltCfg.ServerMode — rather than HostImpliesServerMode. + // Host inference (GH#3545) answers only one layer of that question and + // deliberately returns false as soon as config.yaml names a + // `dolt.mode`: correct for inferring FROM a host, wrong as the whole + // gate. A workspace declaring `dolt.mode: server` in .beads/config.yaml + // with no metadata.json therefore kept cfg nil, fell through to the + // embedded branch, and answered every query out of a phantom + // .beads/embeddeddolt database that same run had just created — + // exit 0, no rows, nothing to distinguish it from real emptiness. + // BEADS_DOLT_SERVER_MODE=1 did not rescue it either; the old gate + // never consulted it. IsDoltServerMode is a superset of + // HostImpliesServerMode, so nothing that reached server mode before + // stops reaching it now. + if cfg == nil && configfile.DefaultConfig().IsDoltServerMode() { + logConfigDiscovery(beadsDir, "no metadata.json; env/config.yaml select server mode") cfg = configfile.DefaultConfig() } if cfg != nil { @@ -1598,8 +1759,16 @@ var rootCmd = &cobra.Command{ // root pre-run, before --dry-run/--inspect has had any effect. Proxied // mode is where that is least visible, not where it is acceptable. if proxiedServerMode { - p, err := newProxiedServerUOWProvider(rootCtx, beadsDir, databaseOverride, previewProviderOptions(previewMode)...) + p, err := newProxiedServerUOWProvider(rootCtx, beadsDir, databaseOverride, + rootProviderOptions(previewMode, useReadOnly)...) if err != nil { + // Same typed rendering the store path gets below: a schema + // skew or a migration-gate refusal here carries a whole + // actionable block, and `%v` inside "failed to open uow + // provider" throws all of it away. + if rendered := renderTypedOpenError(err); rendered { + return SilentExit() + } return HandleError("failed to open uow provider: %v", err) } // Fire the workspace's script hooks after commits on the @@ -1662,25 +1831,7 @@ var rootCmd = &cobra.Command{ if handleFreshCloneError(err) { return SilentExit() } - // Schema skew gets dedicated UX with actionable rebuild instructions. - var skewErr *schema.SchemaSkewError - if errors.As(err, &skewErr) { - if jsonOutput { - handleSchemaSkewJSON(skewErr) - } else { - fmt.Fprint(os.Stderr, skewErr.UserMessage()) - } - return SilentExit() - } - // #4259: the remote-migrate gate blocks silent in-place migration of a - // remote-backed database and tells the operator to migrate-or-adopt. - var gateErr *schema.RemoteMigrateGateError - if errors.As(err, &gateErr) { - if jsonOutput { - handleRemoteMigrateGateJSON(gateErr) - } else { - fmt.Fprint(os.Stderr, gateErr.UserMessage()) - } + if renderTypedOpenError(err) { return SilentExit() } return HandleError("failed to open database: %v", err) @@ -1821,7 +1972,16 @@ var rootCmd = &cobra.Command{ uowProvider = nil } } else { - if runsPostCommandMaintenance(cmd.Name(), readonlyMode) { + // dc-6jaq: the freeze covers this hook's own writes too. A read is + // allowed through a freeze, but the maintenance that trails it is + // not the user's command — auto-commit, the tip_*_last_shown + // metadata write and its separate Dolt commit, auto-backup, + // auto-export and auto-push all mutate the very store being + // migrated, and `bd list` on a frozen workspace reaches every one + // of them. Guarding the outer block keeps that promise in one + // place instead of six. Writes never get here at all: they were + // refused in PersistentPreRunE. + if runsPostCommandMaintenance(cmd.Name(), readonlyMode) && !commandFreeze.Frozen() { // Dolt auto-commit: after a successful write command (and after final flush), // create a Dolt commit so changes don't remain only in the working set. if commandDidWrite.Load() && !commandDidExplicitDoltCommit { diff --git a/cmd/bd/markdown.go b/cmd/bd/markdown.go index 5891caccb..14a5f9183 100644 --- a/cmd/bd/markdown.go +++ b/cmd/bd/markdown.go @@ -368,6 +368,15 @@ func buildMarkdownBatchRequest(templates []*IssueTemplate, in createInput) (issu if err != nil { return issueops.CreateBatchRequest{}, HandleError("%v", err) } + // Resolved per template, not once for the file: the plan-wide flag + // applies to every item, but the per-type storage-class. default + // keys on the template's own type, and the ephemeral spelling moves that + // item to the wisp plane. A conflict refuses the whole file here, before + // any transaction opens. + storageClass, ephemeral, err := resolveCreateStorageClass(in.storageClassFlag, template.IssueType, in.ephemeral, in.noHistory) + if err != nil { + return issueops.CreateBatchRequest{}, HandleError("template %q: %v", template.Title, err) + } items = append(items, issueops.BatchCreateItem{ Issue: &types.Issue{ Title: template.Title, @@ -379,8 +388,9 @@ func buildMarkdownBatchRequest(templates []*IssueTemplate, in createInput) (issu IssueType: template.IssueType, Assignee: template.Assignee, Labels: template.Labels, - Ephemeral: in.ephemeral, + Ephemeral: ephemeral, NoHistory: in.noHistory, + StorageClass: storageClass, MolType: in.molType, CreatedBy: in.createdBy, Owner: in.owner, diff --git a/cmd/bd/max_rows.go b/cmd/bd/max_rows.go index 61088cdb2..058a3ac06 100644 --- a/cmd/bd/max_rows.go +++ b/cmd/bd/max_rows.go @@ -75,7 +75,7 @@ func rejectMaxRowsUnderProxiedServer(cmd *cobra.Command) error { // that warning under proxied mode (be-x42v.4 round-4 follow-up). func rejectResolvedMaxRowsUnderProxiedServer(maxRows int) error { if maxRows > 0 { - return HandleErrorRespectJSON("--max-rows / BEADS_MAX_ROWS is not supported in proxied-server mode") + return HandleProxyCapabilityError(AssertProxyCapability(ProxyModeProxied, ProxyCapMaxRows)) } return nil } diff --git a/cmd/bd/memory.go b/cmd/bd/memory.go index dd1501fbf..ef4746358 100644 --- a/cmd/bd/memory.go +++ b/cmd/bd/memory.go @@ -257,7 +257,7 @@ Examples: SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) error { - CheckReadonly("remember") // also covers CheckMigrationFreeze (dc-6jaq) + CheckReadonly("remember") // also covers the migration freeze check (dc-6jaq) evt := metrics.NewCommandEvent("remember") defer func() { diff --git a/cmd/bd/metadata_edits_test.go b/cmd/bd/metadata_edits_test.go index fe1583c76..7967ae682 100644 --- a/cmd/bd/metadata_edits_test.go +++ b/cmd/bd/metadata_edits_test.go @@ -91,8 +91,8 @@ func TestApplyMetadataEdits_NumericValue(t *testing.T) { if err := json.Unmarshal(result, &data); err != nil { t.Fatalf("unmarshal: %v", err) } - if string(data["story_points"]) != `"5"` { - t.Errorf("expected \"5\", got %s", data["story_points"]) + if string(data["story_points"]) != `5` { + t.Errorf("expected the JSON number 5, got %s", data["story_points"]) } } @@ -106,8 +106,8 @@ func TestApplyMetadataEdits_BoolValue(t *testing.T) { if err := json.Unmarshal(result, &data); err != nil { t.Fatalf("unmarshal: %v", err) } - if string(data["urgent"]) != `"true"` { - t.Errorf("expected \"true\", got %s", data["urgent"]) + if string(data["urgent"]) != `true` { + t.Errorf("expected the JSON boolean true, got %s", data["urgent"]) } } @@ -121,8 +121,8 @@ func TestApplyMetadataEdits_NullValue(t *testing.T) { if err := json.Unmarshal(result, &data); err != nil { t.Fatalf("unmarshal: %v", err) } - if string(data["cleared"]) != `"null"` { - t.Errorf("expected \"null\", got %s", data["cleared"]) + if string(data["cleared"]) != `null` { + t.Errorf("expected JSON null, got %s", data["cleared"]) } } @@ -199,8 +199,8 @@ func TestApplyMetadataEdits_MultipleSetFlags(t *testing.T) { if string(data["sprint"]) != `"Q1"` { t.Errorf("expected \"Q1\", got %s", data["sprint"]) } - if string(data["priority"]) != `"2"` { - t.Errorf("expected \"2\", got %s", data["priority"]) + if string(data["priority"]) != `2` { + t.Errorf("expected the JSON number 2, got %s", data["priority"]) } } @@ -306,15 +306,15 @@ func TestToJSONValue(t *testing.T) { expected string }{ {"hello", `"hello"`}, - {"42", `"42"`}, - {"3.14", `"3.14"`}, - {"true", `"true"`}, - {"false", `"false"`}, - {"null", `"null"`}, + {"42", `42`}, + {"3.14", `3.14`}, + {"true", `true`}, + {"false", `false`}, + {"null", `null`}, {"", `""`}, {"hello world", `"hello world"`}, - {"0", `"0"`}, - {"-1", `"-1"`}, + {"0", `0`}, + {"-1", `-1`}, } for _, tt := range tests { t.Run(tt.input, func(t *testing.T) { diff --git a/cmd/bd/metadataless_server_workspace_test.go b/cmd/bd/metadataless_server_workspace_test.go new file mode 100644 index 000000000..ef402a516 --- /dev/null +++ b/cmd/bd/metadataless_server_workspace_test.go @@ -0,0 +1,259 @@ +//go:build cgo + +package main + +import ( + "bytes" + "context" + "fmt" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/steveyegge/beads/internal/testutil" +) + +// A workspace can declare server mode without ever writing metadata.json: +// `dolt.mode: server` in .beads/config.yaml, or BEADS_DOLT_SERVER_MODE=1 in the +// environment. Both are resolved by configfile.IsDoltServerMode, and gc +// provisions the config.yaml shape on every `gc-beads-bd start`. +// +// Before the fix, the metadata-less branch in the root PersistentPreRunE gated +// its config substitution on HostImpliesServerMode alone. That predicate +// answers a narrower question — "does a configured HOST imply server mode?" — +// and deliberately returns false as soon as config.yaml names a dolt.mode; it +// never consults BEADS_DOLT_SERVER_MODE at all. So cfg stayed nil, ServerMode +// stayed false, and bd created and then read a brand-new +// .beads/embeddeddolt/beads database: every query answered out of an empty +// relic, exit 0, "No issues found." A reader cannot tell that from real +// emptiness, which is why these tests assert on the phantom directory and on +// the false-empty separately. +// +// The invariant under test is one-directional and does not depend on a server +// being reachable: a workspace that selects server mode must reach the server +// or fail loudly. It must never quietly become an embedded workspace. + +const phantomEmbeddedDir = "embeddeddolt" + +// TestMetadatalessServerModeWorkspaceNeverOpensPhantomEmbeddedDatabase covers +// the two ways a workspace with no metadata.json selects server mode. Both +// shapes are admitted by the legacy-upgrade guard as-is, so this test exercises +// the store-selection gate directly on any branch. +func TestMetadatalessServerModeWorkspaceNeverOpensPhantomEmbeddedDatabase(t *testing.T) { + bd := buildBDUnderTest(t) + + cases := []struct { + name string + setup func(t *testing.T, beadsDir string, port int) []string + }{ + { + name: "config.yaml dolt.mode server", + setup: func(t *testing.T, beadsDir string, port int) []string { + t.Helper() + writeFile(t, filepath.Join(beadsDir, "config.yaml"), + []byte(fmt.Sprintf("dolt:\n mode: server\n port: %d\n", port))) + return nil + }, + }, + { + name: "BEADS_DOLT_SERVER_MODE env var", + setup: func(t *testing.T, beadsDir string, port int) []string { + t.Helper() + return []string{ + "BEADS_DOLT_SERVER_MODE=1", + fmt.Sprintf("BEADS_DOLT_SERVER_PORT=%d", port), + } + }, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + repoDir := t.TempDir() + initGitRepo(t, repoDir) + beadsDir := filepath.Join(repoDir, ".beads") + if err := os.MkdirAll(beadsDir, 0o700); err != nil { + t.Fatal(err) + } + port := freeLoopbackPort(t) + env := tc.setup(t, beadsDir, port) + writeFile(t, filepath.Join(beadsDir, localVersionFile), []byte("1.3.0\n")) + if err := os.Chmod(beadsDir, 0o700); err != nil { + t.Fatal(err) + } + + // --db names the local Dolt path bd itself computes for this + // workspace. It is the shortest route to store selection for a + // metadata-less workspace that has no local database directory + // yet, which is exactly the state a server-mode workspace is + // supposed to stay in. + run := runBDInWorkspace(t, bd, repoDir, + []string{"list", "--json", "--limit", "0", "--all"}, env, + filepath.Join(beadsDir, "dolt")) + + assertNoPhantomEmbeddedDatabase(t, beadsDir) + assertNotFalseEmpty(t, run) + if !strings.Contains(run.output, fmt.Sprintf("127.0.0.1:%d", port)) { + t.Fatalf("bd did not report the configured server endpoint 127.0.0.1:%d:\n%s", port, run.output) + } + }) + } +} + +// TestGCProvisionedServerWorkspaceNeverOpensPhantomEmbeddedDatabase pins the +// byte shape gc creates: config.yaml declaring server mode, a .beads/dolt data +// root owned by the sql-server, the gitignored port file, and a current-era +// version witness — and still no metadata.json. +// +// Two different mechanisms keep this shape safe depending on what else has +// landed, and the assertions deliberately cover only what both guarantee. On a +// branch without gastownhall/beads#6119 the legacy-upgrade guard refuses the +// workspace outright (over-broadly — that is what #6119 fixes). Once #6119 +// removes that refusal, the store-selection gate fixed here is the only thing +// standing between this shape and a phantom embedded database, so the test +// stays meaningful in exactly the configuration that ships. +func TestGCProvisionedServerWorkspaceNeverOpensPhantomEmbeddedDatabase(t *testing.T) { + bd := buildBDUnderTest(t) + + repoDir := t.TempDir() + initGitRepo(t, repoDir) + beadsDir := filepath.Join(repoDir, ".beads") + if err := os.MkdirAll(filepath.Join(beadsDir, "dolt"), 0o700); err != nil { + t.Fatal(err) + } + port := freeLoopbackPort(t) + writeFile(t, filepath.Join(beadsDir, "config.yaml"), + []byte(fmt.Sprintf("dolt:\n mode: server\n port: %d\n", port))) + writeFile(t, filepath.Join(beadsDir, "dolt-server.port"), []byte(fmt.Sprintf("%d\n", port))) + writeFile(t, filepath.Join(beadsDir, localVersionFile), []byte("1.3.0\n")) + if err := os.Chmod(beadsDir, 0o700); err != nil { + t.Fatal(err) + } + + for _, args := range [][]string{ + {"list", "--json", "--limit", "0", "--all"}, + {"ready", "--json"}, + } { + t.Run(args[0], func(t *testing.T) { + run := runBDInWorkspace(t, bd, repoDir, args, nil, "") + assertNoPhantomEmbeddedDatabase(t, beadsDir) + assertNotFalseEmpty(t, run) + }) + } +} + +type bdRun struct { + args []string + output string + stdout string + exitCode int + err error +} + +// runBDInWorkspace runs bd as a subprocess with auto-start disabled, so a +// server-mode workspace cannot mask a misrouted open by starting a server of +// its own. dbPath, when non-empty, is passed as --db. +// +// Every ambient BEADS_DOLT_* and BEADS_DIR is stripped first. This package's +// TestMain starts a shared Dolt server and exports its endpoint, and env beats +// config.yaml in every layer of the precedence chain being tested here — a +// leaked BEADS_DOLT_SERVER_PORT would retarget the workspace at that server +// and quietly change what the assertions mean. +func runBDInWorkspace(t *testing.T, bd, repoDir string, args, extraEnv []string, dbPath string) bdRun { + t.Helper() + if dbPath != "" { + args = append([]string{"--db", dbPath}, args...) + } + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + cmd := exec.CommandContext(ctx, bd, args...) + cmd.Dir = repoDir + cmd.Env = append(envWithoutBeadsStorageSettings(), + "BD_DISABLE_METRICS=1", + "BEADS_DOLT_AUTO_START=0", + ) + cmd.Env = append(cmd.Env, extraEnv...) + var stdout, stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + err := cmd.Run() + if ctxErr := ctx.Err(); ctxErr != nil { + t.Fatalf("bd %s did not finish before the deadline: %v\n%s%s", + strings.Join(args, " "), ctxErr, stdout.String(), stderr.String()) + } + run := bdRun{ + args: args, + output: stdout.String() + stderr.String(), + stdout: stdout.String(), + err: err, + } + run.exitCode = cmd.ProcessState.ExitCode() + return run +} + +// assertNoPhantomEmbeddedDatabase is the load-bearing assertion: bd must not +// have created .beads/embeddeddolt for a workspace that selects server mode. +// Once that directory exists it is self-perpetuating — discovery prefers it +// over .beads/dolt on every later run — so the damage outlives the invocation +// that caused it. +func assertNoPhantomEmbeddedDatabase(t *testing.T, beadsDir string) { + t.Helper() + path := filepath.Join(beadsDir, phantomEmbeddedDir) + if info, err := os.Stat(path); err == nil && info.IsDir() { + entries, _ := os.ReadDir(path) + names := make([]string, 0, len(entries)) + for _, entry := range entries { + names = append(names, entry.Name()) + } + t.Fatalf("bd created a phantom embedded database at %s (contains %v) for a server-mode workspace", path, names) + } +} + +// assertNotFalseEmpty rejects the failure this bug produced: a successful, +// empty answer sourced from somewhere other than the configured server. An +// error is a fine outcome here — a reader can act on it. +func assertNotFalseEmpty(t *testing.T, run bdRun) { + t.Helper() + if run.err == nil { + t.Fatalf("bd %s exited 0 for an unreachable server-mode workspace; a silent empty result is indistinguishable from real emptiness:\n%s", + strings.Join(run.args, " "), run.output) + } + if strings.Contains(run.output, "no beads configuration found") { + t.Fatalf("bd %s fell through to the embedded default instead of the configured server:\n%s", + strings.Join(run.args, " "), run.output) + } + for _, empty := range []string{"No issues found.", "No ready work"} { + if strings.Contains(run.stdout, empty) { + t.Fatalf("bd %s reported %q instead of reaching the configured server:\n%s", + strings.Join(run.args, " "), empty, run.output) + } + } + if strings.TrimSpace(run.stdout) == "[]" { + t.Fatalf("bd %s printed an empty JSON result instead of reaching the configured server:\n%s", + strings.Join(run.args, " "), run.output) + } +} + +func envWithoutBeadsStorageSettings() []string { + kept := make([]string, 0, len(os.Environ())) + for _, entry := range os.Environ() { + name, _, _ := strings.Cut(entry, "=") + if strings.HasPrefix(name, "BEADS_DOLT_") || name == "BEADS_DIR" { + continue + } + kept = append(kept, entry) + } + return kept +} + +func freeLoopbackPort(t *testing.T) int { + t.Helper() + port, err := testutil.FindFreePort() + if err != nil { + t.Fatalf("find free port: %v", err) + } + return port +} diff --git a/cmd/bd/migrate.go b/cmd/bd/migrate.go index 1cac69423..d611852f7 100644 --- a/cmd/bd/migrate.go +++ b/cmd/bd/migrate.go @@ -1,6 +1,7 @@ package main import ( + "errors" "fmt" "os" "strings" @@ -8,12 +9,14 @@ import ( "github.com/spf13/cobra" "github.com/steveyegge/beads/internal/beads" "github.com/steveyegge/beads/internal/configfile" + "github.com/steveyegge/beads/internal/debug" "github.com/steveyegge/beads/internal/metrics" "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/storage/schema" "github.com/steveyegge/beads/internal/types" "github.com/steveyegge/beads/internal/ui" "github.com/steveyegge/beads/internal/utils" + "github.com/steveyegge/beads/issueops" ) var migrateCmd = &cobra.Command{ @@ -633,6 +636,19 @@ func handleSchemaMigrate() error { } return SilentExit() } + var dirtyErr *schema.DirtyTablesError + if errors.As(err, &dirtyErr) { + // The dirty guard's own remedy is `bd dolt commit`, which on a + // shared server opens writably, hits the migrate gate, and is told + // to run this command — the two messages point at each other and + // the operator loops (gastownhall/beads#5920 review). Name the + // sequence that actually terminates. + return HandleErrorWithHint( + fmt.Sprintf("schema migration failed: %v", err), + "in server mode `bd dolt commit` is itself gated, so commit the working set on the server first "+ + "(`CALL DOLT_COMMIT('-Am', 'pre-migration working set')` over the sql-server, or "+ + schema.AllowRemoteMigrateEnv+"=1 bd dolt commit), then re-run this command") + } return HandleError("schema migration failed: %v", err) } @@ -641,6 +657,14 @@ func handleSchemaMigrate() error { if applied > 0 { status = "applied" commandDidWrite.Store(true) + // Stamp the version markers the refused version-bump reconciliation + // could not (gastownhall/beads#5920 review). autoMigrateOnVersionBump + // is the only automatic writer of bd_version, it was refused by the + // gate this command just satisfied, and its one-shot .local_version + // signal is already consumed — so without this, `bd doctor` and the + // git-hook health check keep reporting a version mismatch after the + // operator has done everything the refusal told them to. + stampWorkspaceVersionAfterMigrate(store) } if jsonOutput { @@ -659,6 +683,54 @@ func handleSchemaMigrate() error { return nil } +// stampWorkspaceVersionAfterMigrate records this binary's version through the +// store's own reconciler, exactly as autoMigrateOnVersionBump would have. +// +// Best-effort by design, and deliberately not fatal: the migration itself has +// already succeeded and been reported, so a marker write that fails must not +// turn a successful migration into a failed command. A stale marker is a +// cosmetic doctor warning; a false "schema migration failed" is not. +func stampWorkspaceVersionAfterMigrate(store storage.DoltStorage) { + reconciler, err := store.VersionReconciler() + if err != nil { + debug.Logf("migrate schema: version markers unavailable: %v", err) + return + } + if _, err := reconciler.ReconcileVersion(rootCtx, issueops.VersionReconcileRequest{CLIVersion: Version}); err != nil { + debug.Logf("migrate schema: failed to record workspace version: %v", err) + } +} + +// reportProxiedSchemaMigrate is `bd migrate schema`'s proxied-server arm. The +// provider open already reconciled the schema under this verb's consent, so +// there is nothing left to do but say so — and say it in the same shape the +// direct path uses, since a caller parsing --json should not have to branch on +// the workspace's storage mode. +// +// The open reports its own failures: a gate refusal or a failed migration +// aborts the command in root pre-run and never reaches RunE, so arriving here +// means the schema is reconciled. The applied count is not observable from +// here (it belongs to an open that has already returned), hence the "current" +// status rather than a count. +// +// No version stamping here, unlike the direct path: reconcileVersionProxiedServer +// already runs in the root pre-run after a successful provider open, so the +// marker the gate refusal held back is written as soon as the open succeeds. +func reportProxiedSchemaMigrate() error { + latest := schema.LatestVersion() + if jsonOutput { + return outputJSON(map[string]interface{}{ + "status": "current", + "latest_version": latest, + "mode": "proxied-server", + "note": "schema reconciled during provider open", + }) + } + fmt.Printf("%s\n", ui.RenderPass(fmt.Sprintf( + "✓ Schema reconciled during provider open (proxied-server mode); schema now at v%d", latest))) + return nil +} + func handleToSeparateBranch(branch string, dryRun bool) error { b := strings.TrimSpace(branch) if b == "" || strings.ContainsAny(b, " \t\n") { @@ -820,7 +892,12 @@ Example: SilenceErrors: true, RunE: func(cmd *cobra.Command, _ []string) error { if usesProxiedServer() { - return HandleErrorRespectJSON("migrate schema is not supported in proxied-server mode") + // Proxied mode has no store-level SchemaMigrator to call: the + // provider open IS the migration, and by the time RunE runs it has + // already happened — with this verb's consent, which the root + // pre-run set before the open (schema.SetSharedMigrateConsent). + // So report, rather than refuse a verb that just did its job. + return reportProxiedSchemaMigrate() } CheckReadonly("migrate schema") diff --git a/cmd/bd/migrate_dolt_mode.go b/cmd/bd/migrate_dolt_mode.go index 46cefe4c9..387624e93 100644 --- a/cmd/bd/migrate_dolt_mode.go +++ b/cmd/bd/migrate_dolt_mode.go @@ -1,9 +1,13 @@ package main import ( + "encoding/json" "fmt" "os" "path/filepath" + "reflect" + "strconv" + "strings" "time" "github.com/spf13/cobra" @@ -22,6 +26,363 @@ import ( const migrateLockFileName = "migrate.lock" +const migrateJournalFileName = "dolt-mode-migration.json" + +type migratePhase string + +const ( + migratePrepared migratePhase = "prepared" + migrateTargetConfigured migratePhase = "target_configured" + migrateOldControlsRetired migratePhase = "old_controls_retired" + migrateVerified migratePhase = "verified" + migrateCommitted migratePhase = "committed" +) + +type migrateJournal struct { + Version int `json:"version"` + SourceMode string `json:"source_mode"` + TargetMode string `json:"target_mode"` + Shared bool `json:"shared"` + RootPath string `json:"root_path,omitempty"` + External *configfile.ExternalDoltConfig `json:"external,omitempty"` + Sidecar *configfile.ProxiedServerClientInfo `json:"sidecar,omitempty"` + LogAssets []string `json:"log_assets,omitempty"` + Ownership string `json:"ownership"` + Attempt int `json:"attempt"` + Phase migratePhase `json:"phase"` +} +type migrateDryRunOutput struct { + DryRun bool `json:"dry_run"` + SourceMode string `json:"source_mode"` + TargetMode string `json:"target_mode"` + Shared bool `json:"shared"` + RootPath string `json:"root_path"` +} + +func migrateJournalPath(beadsDir string) string { + return filepath.Join(beadsDir, migrateJournalFileName) +} + +func loadMigrateJournal(beadsDir string) (*migrateJournal, error) { + b, err := os.ReadFile(migrateJournalPath(beadsDir)) + if os.IsNotExist(err) { + return nil, nil + } + if err != nil { + return nil, fmt.Errorf("reading %s: %w", migrateJournalFileName, err) + } + var j migrateJournal + if err := json.Unmarshal(b, &j); err != nil { + return nil, fmt.Errorf("parsing %s: %w", migrateJournalFileName, err) + } + if j.Version != 1 || j.SourceMode == "" || j.TargetMode == "" || j.Phase == "" || j.Attempt < 1 { + return nil, fmt.Errorf("invalid %s: missing required migration state", migrateJournalFileName) + } + switch j.Phase { + case migratePrepared, migrateTargetConfigured, migrateOldControlsRetired, migrateVerified, migrateCommitted: + default: + return nil, fmt.Errorf("invalid %s: unknown phase %q", migrateJournalFileName, j.Phase) + } + if j.RootPath == "" || !filepath.IsAbs(j.RootPath) || filepath.Clean(j.RootPath) != j.RootPath { + return nil, fmt.Errorf("invalid %s: root_path must be a clean absolute path", migrateJournalFileName) + } + if j.SourceMode == configfile.DoltModeServer && j.TargetMode == configfile.DoltModeProxiedServer { + if j.Shared { /* shared-server uses server mode plus shared topology */ + } + } else if j.SourceMode == configfile.DoltModeProxiedServer && (j.TargetMode == configfile.DoltModeServer || j.TargetMode == "shared-server") { + if j.TargetMode == "shared-server" && !j.Shared { + return nil, fmt.Errorf("invalid %s: shared target requires shared topology", migrateJournalFileName) + } + if j.TargetMode == configfile.DoltModeServer && j.Shared { + return nil, fmt.Errorf("invalid %s: server target cannot use shared topology", migrateJournalFileName) + } + } else { + return nil, fmt.Errorf("invalid %s: unsupported mode transition %s -> %s", migrateJournalFileName, j.SourceMode, j.TargetMode) + } + if j.Sidecar == nil { + return nil, fmt.Errorf("invalid %s: missing sidecar topology", migrateJournalFileName) + } + if j.Sidecar.RootPath == "" || j.Sidecar.ResolvedRootPath(beadsDir) == "" { + return nil, fmt.Errorf("invalid %s: sidecar root_path is required", migrateJournalFileName) + } + if j.Ownership != "managed-local" && j.Ownership != "external" { + return nil, fmt.Errorf("invalid %s: unknown ownership %q", migrateJournalFileName, j.Ownership) + } + // Journals written before the External field was added recorded the + // endpoint only in the sidecar. Infer it for compatibility so recovery + // still takes the typed, fail-closed external path. + if j.External == nil && j.Ownership == "external" && j.Sidecar.External != nil { + j.External = j.Sidecar.External + } + if j.Ownership == "external" && j.Sidecar.External == nil { + return nil, fmt.Errorf("invalid %s: external ownership missing endpoint", migrateJournalFileName) + } + if j.Ownership == "managed-local" && j.Sidecar.External != nil { + return nil, fmt.Errorf("invalid %s: managed-local ownership has external endpoint", migrateJournalFileName) + } + if !reflect.DeepEqual(j.External, j.Sidecar.External) { + return nil, fmt.Errorf("invalid %s: external topology disagrees with sidecar", migrateJournalFileName) + } + if j.Sidecar.External != nil { + if err := j.Sidecar.External.Validate(); err != nil { + return nil, fmt.Errorf("invalid %s external topology: %w", migrateJournalFileName, err) + } + } + if rp := j.Sidecar.ResolvedRootPath(beadsDir); rp != "" && filepath.Clean(rp) != j.RootPath { + return nil, fmt.Errorf("invalid %s: sidecar root does not match root_path", migrateJournalFileName) + } + return &j, nil +} + +func saveMigrateJournal(beadsDir string, j *migrateJournal) error { + b, err := json.MarshalIndent(j, "", " ") + if err != nil { + return err + } + tmp, err := os.CreateTemp(beadsDir, ".dolt-mode-migration-*.tmp") + if err != nil { + return err + } + tmpName := tmp.Name() + defer func() { _ = os.Remove(tmpName) }() + if err = tmp.Chmod(0o600); err == nil { + _, err = tmp.Write(b) + } + if err == nil { + err = tmp.Sync() + } + if closeErr := tmp.Close(); err == nil { + err = closeErr + } + if err != nil { + return fmt.Errorf("writing %s: %w", migrateJournalFileName, err) + } + if err = os.Rename(tmpName, migrateJournalPath(beadsDir)); err != nil { + return err + } + d, err := os.Open(beadsDir) // #nosec G304 -- beadsDir is the discovered workspace directory + if err != nil { + return fmt.Errorf("syncing %s directory: %w", migrateJournalFileName, err) + } + if err = d.Sync(); err != nil { + _ = d.Close() + return fmt.Errorf("syncing %s directory: %w", migrateJournalFileName, err) + } + if err = d.Close(); err != nil { + return fmt.Errorf("closing %s directory: %w", migrateJournalFileName, err) + } + return nil +} + +func removeMigrateJournal(beadsDir string) error { + if err := os.Remove(migrateJournalPath(beadsDir)); err != nil && !os.IsNotExist(err) { + return err + } + d, err := os.Open(beadsDir) // #nosec G304 -- beadsDir is the discovered workspace directory + if err != nil { + return fmt.Errorf("opening migration directory: %w", err) + } + if err = d.Sync(); err != nil { + _ = d.Close() + return fmt.Errorf("syncing migration directory: %w", err) + } + if err = d.Close(); err != nil { + return fmt.Errorf("closing migration directory: %w", err) + } + return nil +} + +func migrateFault(phase migratePhase) error { + if strings.EqualFold(strings.TrimSpace(os.Getenv("BEADS_MIGRATION_FAIL_PHASE")), string(phase)) { + return fmt.Errorf("migration fault injected after phase %s", phase) + } + return nil +} + +func externalMigrationRefusal(message string) error { + return HandleProxyCapabilityError(&ProxyCapabilityError{ + Code: "proxy.migrate.external_endpoint", + Message: message, + ExitCode: 1, + Mutates: false, + }) +} + +func migrationInvalidState(message string) error { + return HandleProxyCapabilityError(&ProxyCapabilityError{ + Code: "proxy.migrate.invalid_state", + Message: message, + ExitCode: 1, + Mutates: false, + }) +} + +// validateCompletedProxyControls verifies that an already-proxied target has +// no live process or stale lifecycle artifacts. Empty, unlocked lock markers +// are harmless leftovers from a prior lifecycle and are intentionally +// accepted; a held marker still proves active ownership and is refused. +func validateCompletedProxyControls(root string) error { + if running, _ := proxy.IsRunning(root); running { + return migrationInvalidState("completed migration still has a running proxy") + } + for _, control := range proxy.ControlFilePaths(root) { + if _, statErr := os.Stat(control); statErr != nil { + if os.IsNotExist(statErr) { + continue + } + return migrationInvalidState(fmt.Sprintf("completed migration cannot inspect proxy control %s: %v", control, statErr)) + } + base := filepath.Base(control) + if base == proxy.LockFileName || base == server.LockFileName { + lock, lockErr := util.TryLock(control) + if lockErr == nil { + lock.Unlock() + continue + } + return migrationInvalidState(fmt.Sprintf("completed migration has a held proxy control %s", base)) + } + return migrationInvalidState(fmt.Sprintf("completed migration has stale proxy control %s", base)) + } + return nil +} + +func validateCompletedLockMarker(path string, label string) error { + if _, err := os.Stat(path); err != nil { + if os.IsNotExist(err) { + return nil + } + return migrationInvalidState(fmt.Sprintf("completed migration cannot inspect %s: %v", label, err)) + } + lock, err := util.TryLock(path) + if err != nil { + return migrationInvalidState(fmt.Sprintf("completed migration has a held %s", label)) + } + lock.Unlock() + return nil +} + +func migrationSidecarsEquivalent(beadsDir string, a, b *configfile.ProxiedServerClientInfo) bool { + if a == nil || b == nil { + return a == b + } + return a.ResolvedRootPath(beadsDir) == b.ResolvedRootPath(beadsDir) && + a.ResolvedConfigPath(beadsDir) == b.ResolvedConfigPath(beadsDir) && + a.ResolvedLogPath(beadsDir) == b.ResolvedLogPath(beadsDir) && + a.Port == b.Port && a.IdleTimeout == b.IdleTimeout && + reflect.DeepEqual(a.External, b.External) +} + +func checkpointMigration(beadsDir string, j *migrateJournal, phase migratePhase) error { + j.Phase = phase + if err := saveMigrateJournal(beadsDir, j); err != nil { + return err + } + return migrateFault(phase) +} + +func validateMigrationJournalAgainstConfig(j *migrateJournal, cfg *configfile.Config) error { + if j == nil || cfg == nil { + return nil + } + if j.Phase == migratePrepared { + if cfg.GetDoltMode() != j.SourceMode && cfg.GetDoltMode() != j.TargetMode && !(j.TargetMode == "shared-server" && cfg.IsDoltServerMode()) { + return fmt.Errorf("migration journal phase %s disagrees with metadata mode %q", j.Phase, cfg.GetDoltMode()) + } + return nil + } + if j.TargetMode == configfile.DoltModeProxiedServer && !cfg.IsDoltProxiedServerMode() { + return fmt.Errorf("migration journal phase %s requires proxied-server metadata", j.Phase) + } + if j.TargetMode != configfile.DoltModeProxiedServer && !cfg.IsDoltServerMode() { + return fmt.Errorf("migration journal phase %s requires server metadata", j.Phase) + } + return nil +} + +// sameMigrationRoot reports whether two spellings name the same Dolt root. +// +// A recorded journal/sidecar root and the canonical root derived at run time +// can be lexically different yet identical on disk: on macOS the temp and +// data roots reach the same directory through the /var -> /private/var +// symlink, so a filepath.Clean comparison alone rejects a valid topology. +// Resolving the deepest existing component canonicalizes that prefix while +// still working when the leaf itself has not been created yet. +func sameMigrationRoot(a, b string) bool { + if filepath.Clean(a) == filepath.Clean(b) { + return true + } + return resolveExistingMigrationPath(a) == resolveExistingMigrationPath(b) +} + +func resolveExistingMigrationPath(path string) string { + if path == "" || !filepath.IsAbs(path) { + return filepath.Clean(path) + } + current := filepath.Clean(path) + var trailing string + for { + if resolved, err := filepath.EvalSymlinks(current); err == nil { + return filepath.Join(resolved, trailing) + } + parent := filepath.Dir(current) + if parent == current { + return filepath.Clean(path) + } + trailing = filepath.Join(filepath.Base(current), trailing) + current = parent + } +} + +func validateMigrationTopology(beadsDir string, j *migrateJournal, shared bool, forward bool) error { + if j == nil { + return nil + } + canonical := doltserver.DoltDirPath(beadsDir) + if shared { + var err error + canonical, err = doltserver.SharedDoltPath() + if err != nil { + return fmt.Errorf("resolve shared Dolt root: %w", err) + } + } + if !sameMigrationRoot(j.RootPath, canonical) { + return fmt.Errorf("journal root %s does not match canonical %s", j.RootPath, canonical) + } + if shared { + want := "true" + if j.Phase != migratePrepared { + want = "false" + } + if !forward { + want = "true" + if j.Phase == migratePrepared { + want = "false" + } + } + if v, ok := config.WorkspaceYamlValue(beadsDir, "dolt.shared-server"); !ok || strings.ToLower(v) != want { + return fmt.Errorf("shared-server YAML is %q, want %s for phase %s", v, want, j.Phase) + } + } + return nil +} + +func validateDoltRoot(root string) error { + b, err := os.ReadFile(filepath.Join(root, ".dolt", "repo_state.json")) // #nosec G304 -- root is validated migration workspace path + if err != nil { + return fmt.Errorf("read Dolt identity: %w", err) + } + var obj struct { + Head string `json:"head"` + Remotes map[string]interface{} `json:"remotes"` + Backups map[string]interface{} `json:"backups"` + Branches map[string]interface{} `json:"branches"` + } + if err := json.Unmarshal(b, &obj); err != nil || obj.Head == "" || !strings.HasPrefix(obj.Head, "refs/heads/") || strings.TrimPrefix(obj.Head, "refs/heads/") == "" || obj.Remotes == nil || obj.Backups == nil || obj.Branches == nil { + return fmt.Errorf("invalid Dolt identity repo_state.json") + } + return nil +} + func migrateToProxiedRunE(metricName, checkName string, shared bool) func(*cobra.Command, []string) error { return func(cmd *cobra.Command, _ []string) error { evt := metrics.NewCommandEvent(metricName) @@ -143,6 +504,20 @@ func resolveMigrateIdleTimeout(cmd *cobra.Command) (time.Duration, error) { return v, nil } +// formatMigrateIdleTimeout renders a resolved idle timeout for operator-facing +// messages. resolveMigrateIdleTimeout maps an omitted flag to 0 and an explicit +// "--idle-timeout 0" to IdleTimeoutNever, so both sentinels need names. +func formatMigrateIdleTimeout(d time.Duration) string { + switch d { + case proxy.IdleTimeoutNever: + return "never" + case 0: + return "default" + default: + return d.String() + } +} + func migrateModeBeadsDir() (string, error) { beadsDir := beads.FindBeadsDir() if beadsDir == "" { @@ -154,10 +529,10 @@ func migrateModeBeadsDir() (string, error) { func loadMigrateModeConfig(beadsDir string) (*configfile.Config, error) { cfg, err := configfile.Load(beadsDir) if err != nil { - return nil, HandleError("failed to load config: %v", err) + return nil, HandleProxyCapabilityError(&ProxyCapabilityError{Code: "proxy.migrate.invalid_state", Message: fmt.Sprintf("failed to load config: %v", err), ExitCode: 1, Mutates: false}) } if cfg == nil { - return nil, HandleError("no beads database found in %s — run 'bd init' first", beadsDir) + return nil, HandleProxyCapabilityError(&ProxyCapabilityError{Code: "proxy.migrate.invalid_state", Message: fmt.Sprintf("no beads database found in %s — run 'bd init' first", beadsDir), ExitCode: 1, Mutates: false}) } return cfg, nil } @@ -248,21 +623,91 @@ func runMigrateToProxiedServer(dryRun bool, idleTimeout time.Duration, shared bo if err != nil { return err } - if cfg.IsDoltProxiedServerMode() { - fmt.Printf("%s\n", ui.RenderPass("✓ Already in proxied-server mode")) - return nil + j, jerr := loadMigrateJournal(beadsDir) + if jerr != nil { + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: "proxy.migrate.invalid_state", Message: fmt.Sprintf("migration state is unreadable: %v", jerr), ExitCode: 1, Mutates: false}) + } + if err := validateMigrationJournalAgainstConfig(j, cfg); err != nil { + return HandleError("migration state is inconsistent: %v", err) + } + liveShared, yamlShared, yamlSharedSet, err := migrationSharedTopology(beadsDir) + if err != nil { + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: "proxy.migrate.invalid_state", Message: err.Error(), ExitCode: 1, Mutates: false}) + } + if j != nil { + wantShared := shared && j.Phase == migratePrepared + if !shared && yamlSharedSet && yamlShared { + return HandleError("migration journal topology disagrees with persisted shared-server YAML (true)") + } + if liveShared != wantShared { + if yamlSharedSet && !yamlShared && !wantShared { + // The environment may still advertise shared mode after the + // forward transition persisted YAML=false; trust persisted state. + liveShared = wantShared + } else { + return HandleError("migration journal topology does not match live shared-server configuration") + } + } + } else if shared && !liveShared && !cfg.IsDoltProxiedServerMode() { + return HandleError("migration command topology does not match live shared-server configuration") + } + if j != nil && j.Sidecar != nil && j.Sidecar.External != nil { + return externalMigrationRefusal("cannot resume migration for externally hosted proxied Dolt endpoint") + } + if cfg.IsDoltProxiedServerMode() && j == nil { + info, ierr := configfile.LoadProxiedServerClientInfo(beadsDir) + if ierr != nil { + return migrationInvalidState(fmt.Sprintf("migration sidecar is unreadable: %v", ierr)) + } + if info != nil { + canonicalRoot := doltserver.DoltDirPath(beadsDir) + if shared { + canonicalRoot, ierr = doltserver.SharedDoltPath() + if ierr != nil { + return migrationInvalidState(fmt.Sprintf("failed to resolve shared migration root: %v", ierr)) + } + } + if info.External != nil { + return migrationInvalidState("completed migration has an externally hosted proxied Dolt endpoint") + } + if !sameMigrationRoot(info.ResolvedRootPath(beadsDir), canonicalRoot) { + return migrationInvalidState("proxied sidecar does not match canonical migration target") + } + if !shared && yamlSharedSet && yamlShared { + return migrationInvalidState("completed migration topology is shared-server; use the shared migration command") + } + if err := validateCompletedProxyControls(canonicalRoot); err != nil { + return err + } + stateDir := beadsDir + if shared { + stateDir, ierr = doltserver.SharedServerDir() + if ierr != nil { + return migrationInvalidState(fmt.Sprintf("failed to resolve shared server state: %v", ierr)) + } + } + if err := validateCompletedLockMarker(doltserver.LockPath(stateDir), "dolt-server lock"); err != nil { + return err + } + fmt.Printf("%s\n", ui.RenderPass("✓ Already in proxied-server mode")) + return nil + } + return migrationInvalidState(fmt.Sprintf("repo is marked proxied-server but %s is missing; rerun migration with a recoverable journal", configfile.ProxiedServerClientInfoFileName)) } var rootPath string - if shared { + if j != nil { + rootPath = j.RootPath + } else if shared { if !doltserver.IsSharedServerMode() { return HandleError("repo is not in shared-server mode; this command only migrates shared-server repos") } - rootPath, err = doltserver.SharedDoltDir() + rootPath, err = doltserver.SharedDoltPath() if err != nil { return HandleError("failed to resolve shared dolt directory: %v", err) } } else { + rootPath = doltserver.DoltDirPath(beadsDir) if !cfg.IsDoltServerMode() { return HandleError("repo is not in server mode (dolt_mode=%q); this command only migrates server-mode repos", cfg.GetDoltMode()) } @@ -277,13 +722,42 @@ func runMigrateToProxiedServer(dryRun bool, idleTimeout time.Duration, shared bo return HandleErrorWithHint("repo is in shared-server mode", "use 'bd migrate from-shared-server-to-proxied-server'") } } + if j == nil { + // A sidecar without its migration journal is ambiguous state. Refuse + // to overwrite it: an externally-owned endpoint cannot be safely + // converted, and a mismatched local root may point at another repo. + info, ierr := configfile.LoadProxiedServerClientInfo(beadsDir) + if ierr != nil { + return HandleError("migration sidecar is unreadable: %v", ierr) + } + if info != nil { + if info.External != nil { + return externalMigrationRefusal("cannot migrate an externally hosted proxied Dolt endpoint; reconfigure the endpoint on its owner first") + } + resolvedSidecarRoot := info.ResolvedRootPath(beadsDir) + if resolvedSidecarRoot != "" && !sameMigrationRoot(resolvedSidecarRoot, rootPath) { + return HandleError("migration sidecar root %s does not match canonical %s", info.RootPath, rootPath) + } + return HandleError("migration sidecar exists without a recoverable journal; remove it only after verifying ownership") + } + } serverDir := doltserver.ResolveServerDir(beadsDir) + if j != nil { + if err := validateMigrationTopology(beadsDir, j, shared, true); err != nil { + return HandleError("migration topology is inconsistent: %v", err) + } + } if state, _ := doltserver.IsRunning(serverDir); state != nil && state.Running { return HandleErrorWithHint("dolt server is still running", "stop it first: bd dolt stop") } if dryRun { + if jsonOutput { + b, _ := json.Marshal(migrateDryRunOutput{true, configfile.DoltModeServer, configfile.DoltModeProxiedServer, shared, rootPath}) + fmt.Println(string(b)) + return nil + } fmt.Println("Dry run mode - no changes will be made") fmt.Printf("Would set dolt_mode: %s → %s\n", configfile.DoltModeServer, configfile.DoltModeProxiedServer) if shared { @@ -296,24 +770,107 @@ func runMigrateToProxiedServer(dryRun bool, idleTimeout time.Duration, shared bo } return nil } - - cfg.DoltMode = configfile.DoltModeProxiedServer - if err := cfg.Save(beadsDir); err != nil { - return HandleError("failed to save metadata.json: %v", err) + if st, e := os.Stat(rootPath); e != nil || !st.IsDir() { + return HandleError("Dolt root %s does not exist or is not a directory", rootPath) + } + if st, e := os.Stat(filepath.Join(rootPath, ".dolt")); e != nil || !st.IsDir() { + return HandleError("Dolt root %s is not a valid Dolt directory", rootPath) + } + if st, e := os.Stat(filepath.Join(rootPath, ".dolt", "repo_state.json")); e != nil || st.IsDir() { + return HandleError("Dolt root %s is not a valid Dolt repository", rootPath) + } + if err := validateDoltRoot(rootPath); err != nil { + return HandleError("Dolt root validation failed: %v", err) } - if shared { - if err := config.SetYamlConfigInDir(beadsDir, "dolt.shared-server", "false"); err != nil { - fmt.Fprintf(os.Stderr, "Warning: could not disable dolt.shared-server: %v\n", err) + if j == nil { + sidecar := &configfile.ProxiedServerClientInfo{RootPath: rootPath, IdleTimeout: idleTimeout} + j = &migrateJournal{Version: 1, SourceMode: cfg.GetDoltMode(), TargetMode: configfile.DoltModeProxiedServer, Shared: shared, RootPath: rootPath, Sidecar: sidecar, Ownership: "managed-local", Attempt: 1, Phase: migratePrepared} + if err := saveMigrateJournal(beadsDir, j); err != nil { + return HandleError("failed to prepare migration: %v", err) + } + if err := migrateFault(migratePrepared); err != nil { + return err + } + } else if j.TargetMode != configfile.DoltModeProxiedServer || j.Shared != shared { + return HandleError("migration journal belongs to a different migration") + } else { + j.Attempt++ + if err := saveMigrateJournal(beadsDir, j); err != nil { + return HandleError("failed to update migration attempt: %v", err) } } - info := &configfile.ProxiedServerClientInfo{RootPath: rootPath, IdleTimeout: idleTimeout} - if err := configfile.SaveProxiedServerClientInfo(beadsDir, info); err != nil { - return HandleError("failed to write %s: %v", configfile.ProxiedServerClientInfoFileName, err) + if j.Phase == migratePrepared { + cfg.DoltMode = configfile.DoltModeProxiedServer + if err := cfg.Save(beadsDir); err != nil { + return HandleError("failed to save metadata.json: %v", err) + } + if shared { + if err := config.SetYamlConfigInDir(beadsDir, "dolt.shared-server", "false"); err != nil { + return HandleError("failed to disable dolt.shared-server: %v", err) + } + } + // Replay the recorded plan instead of rebuilding it from the current + // argv. A resume that omits or changes --idle-timeout would otherwise + // write a sidecar the target_configured check below then rejects, and + // because that check runs only after the phase has advanced past + // migratePrepared, this block never runs again — the workspace would be + // wedged in proxied-server mode with no in-tool recovery. + info := j.Sidecar + if info == nil { + info = &configfile.ProxiedServerClientInfo{RootPath: rootPath, IdleTimeout: idleTimeout} + } else if info.IdleTimeout != idleTimeout { + fmt.Fprintf(os.Stderr, "Warning: resuming migration with the recorded --idle-timeout (%s); the value supplied now (%s) is ignored\n", formatMigrateIdleTimeout(info.IdleTimeout), formatMigrateIdleTimeout(idleTimeout)) + } + if err := configfile.SaveProxiedServerClientInfo(beadsDir, info); err != nil { + return HandleError("failed to write %s: %v", configfile.ProxiedServerClientInfoFileName, err) + } + if err := checkpointMigration(beadsDir, j, migrateTargetConfigured); err != nil { + return err + } + } + if j.Phase == migrateTargetConfigured { + if info, e := configfile.LoadProxiedServerClientInfo(beadsDir); e != nil { + return HandleError("migration sidecar is unreadable: %v", e) + } else if info == nil && j.Sidecar != nil { + if e := configfile.SaveProxiedServerClientInfo(beadsDir, j.Sidecar); e != nil { + return HandleError("failed to repair %s: %v", configfile.ProxiedServerClientInfoFileName, e) + } + } else if j.Sidecar != nil && !reflect.DeepEqual(info, j.Sidecar) { + return HandleError("migration sidecar does not match prepared state") + } + if errs := doltserver.RemoveStateFiles(serverDir); len(errs) > 0 { + return HandleError("failed to retire Dolt server controls: %v", errs[0]) + } + if err := checkpointMigration(beadsDir, j, migrateOldControlsRetired); err != nil { + return err + } + } + if j.Phase == migrateOldControlsRetired { + if c, e := configfile.Load(beadsDir); e != nil || c == nil || !c.IsDoltProxiedServerMode() { + return HandleError("migration verification failed: metadata mode is not proxied-server") + } + if info, e := configfile.LoadProxiedServerClientInfo(beadsDir); e != nil || info == nil { + return HandleError("migration verification failed: proxied sidecar is missing or unreadable") + } + if err := checkpointMigration(beadsDir, j, migrateVerified); err != nil { + return err + } + } + if j.Phase == migrateVerified { + if err := checkpointMigration(beadsDir, j, migrateCommitted); err != nil { + return err + } + if err := removeMigrateJournal(beadsDir); err != nil { + return HandleError("failed to finalize migration: %v", err) + } + } + if j.Phase == migrateCommitted { + if err := removeMigrateJournal(beadsDir); err != nil { + return HandleError("failed to finalize migration: %v", err) + } } - - warnMigrateRemovalErrors(doltserver.RemoveStateFiles(serverDir)) dataDir := proxiedServerRoot(beadsDir) if shared { @@ -347,18 +904,135 @@ func runMigrateFromProxiedServer(dryRun bool, shared bool) error { if err != nil { return err } - if shared { - if doltserver.IsSharedServerMode() { - fmt.Printf("%s\n", ui.RenderPass("✓ Already in shared-server mode")) + j, jerr := loadMigrateJournal(beadsDir) + if jerr != nil { + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: "proxy.migrate.invalid_state", Message: fmt.Sprintf("migration state is unreadable: %v", jerr), ExitCode: 1, Mutates: false}) + } + if err := validateMigrationJournalAgainstConfig(j, cfg); err != nil { + return HandleError("migration state is inconsistent: %v", err) + } + liveShared, yamlShared, yamlSharedSet, err := migrationSharedTopology(beadsDir) + if err != nil { + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: "proxy.migrate.invalid_state", Message: err.Error(), ExitCode: 1, Mutates: false}) + } + var diskSidecar *configfile.ProxiedServerClientInfo + if diskSidecar, err = configfile.LoadProxiedServerClientInfo(beadsDir); err != nil { + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: "proxy.migrate.invalid_state", Message: fmt.Sprintf("migration sidecar is unreadable: %v", err), ExitCode: 1, Mutates: false}) + } + if j != nil { + wantShared := shared && j.Phase != migratePrepared + if liveShared != wantShared { + return HandleError("migration journal topology does not match live shared-server configuration") + } + } + if j != nil && j.Sidecar != nil && j.Sidecar.External != nil { + return externalMigrationRefusal("cannot resume migration for externally hosted proxied Dolt endpoint") + } + if j != nil { + // SCOPED TO REVERSE JOURNALS, and the scope is load-bearing. At + // migratePrepared the two directions disagree about whether the + // sidecar is on disk: a reverse journal records a sidecar that + // already exists, while a forward journal records the plan it is + // about to write and only advances past migratePrepared after the + // write. So a crash in a forward migration's pre-write window leaves + // diskSidecar nil against a non-nil j.Sidecar, and an unscoped guard + // refuses this command — the documented escape hatch — by naming a + // file whose absence is the correct state for that phase. Forward + // journals fall through to the journal-ownership check below, which + // reports the real situation. Testing TargetMode against the forward + // value rather than for the reverse one keeps the guard live for + // BOTH reverse targets, "server" and "shared-server". + if j.Phase == migratePrepared && j.TargetMode != configfile.DoltModeProxiedServer && + !migrationSidecarsEquivalent(beadsDir, diskSidecar, j.Sidecar) { + return HandleError("migration sidecar does not match prepared state") + } + if j.Phase == migrateTargetConfigured && diskSidecar != nil && !migrationSidecarsEquivalent(beadsDir, diskSidecar, j.Sidecar) { + return HandleError("migration sidecar does not match prepared state") + } + if (j.Phase == migrateOldControlsRetired || j.Phase == migrateVerified || j.Phase == migrateCommitted) && diskSidecar != nil { + return HandleError("migration sidecar must be absent after controls are retired") + } + } + if j == nil { + alreadyTarget := cfg.IsDoltServerMode() && ((shared && yamlSharedSet && yamlShared) || (!shared && (!yamlSharedSet || !yamlShared))) + if alreadyTarget { + if diskSidecar != nil { + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: "proxy.migrate.invalid_state", Message: "completed migration has a stale proxied-server sidecar", ExitCode: 1, Mutates: false}) + } + root := doltserver.DoltDirPath(beadsDir) + if shared { + if sharedRoot, sharedErr := doltserver.SharedDoltPath(); sharedErr == nil { + root = sharedRoot + } + } + if running, _ := proxy.IsRunning(root); running { + return HandleError("completed migration still has a running proxy") + } + for _, path := range proxy.ControlFilePaths(root) { + _, statErr := os.Stat(path) + if os.IsNotExist(statErr) { + continue + } + if statErr != nil { + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: "proxy.migrate.invalid_state", Message: fmt.Sprintf("completed migration cannot inspect proxy control %s: %v", path, statErr), ExitCode: 1, Mutates: false}) + } + if filepath.Base(path) == proxy.LockFileName || filepath.Base(path) == server.LockFileName { + // Migration lock files are created as part of acquiring the + // lifecycle gate and may remain as empty, unlocked markers. + // Probe only an existing file; TryLock must not create state + // during an idempotent no-op. + lock, lockErr := util.TryLock(path) + if lockErr == nil { + lock.Unlock() + continue + } + } + if statErr == nil { + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: "proxy.migrate.invalid_state", Message: fmt.Sprintf("completed migration has stale proxy control %s", path), ExitCode: 1, Mutates: false}) + } + } return nil } - } else if cfg.IsDoltServerMode() && !doltserver.IsSharedServerMode() { - fmt.Printf("%s\n", ui.RenderPass("✓ Already in server mode")) - return nil + if liveShared { + return HandleError("migration command topology does not match live shared-server configuration") + } } - if !cfg.IsDoltProxiedServerMode() { + var sourceSidecar *configfile.ProxiedServerClientInfo + if j == nil { + sourceSidecar = diskSidecar + if sourceSidecar == nil { + return HandleError("migration sidecar is missing") + } + if sourceSidecar.External != nil { + return externalMigrationRefusal("cannot migrate an externally hosted proxied Dolt endpoint to local server mode; reconfigure the endpoint on its owner first") + } + } + if j == nil { + if shared { + // Persisted workspace YAML is authoritative over ambient process + // environment. A completed forward migration deliberately leaves + // BEADS_DOLT_SHARED_SERVER stale in some shells while writing + // dolt.shared-server: false; do not misclassify that proxied repo as + // already migrated to shared-server mode. + if !cfg.IsDoltProxiedServerMode() && ((!yamlSharedSet && doltserver.IsSharedServerMode()) || (yamlSharedSet && yamlShared)) { + fmt.Printf("%s\n", ui.RenderPass("✓ Already in shared-server mode")) + return nil + } + } else if cfg.IsDoltServerMode() && !doltserver.IsSharedServerMode() { + fmt.Printf("%s\n", ui.RenderPass("✓ Already in server mode")) + return nil + } + } + if j == nil && !cfg.IsDoltProxiedServerMode() { return HandleError("repo is not in proxied-server mode (dolt_mode=%q); this command only migrates proxied-server repos", cfg.GetDoltMode()) } + expectedTarget := configfile.DoltModeServer + if shared { + expectedTarget = "shared-server" + } + if j != nil && (j.TargetMode != expectedTarget || j.Shared != shared) { + return HandleError("migration journal belongs to a different migration") + } // Leaving proxied mode would make dolt_team_server inert and resume // bd-driven schema migrations on the bts-owned database. if cfg.DoltTeamServer { @@ -366,12 +1040,25 @@ func runMigrateFromProxiedServer(dryRun bool, shared bool) error { "if the database is no longer bts-managed, remove dolt_team_server from .beads/metadata.json first") } - rootDir, err := resolveProxiedServerRootPath(beadsDir) - if err != nil { - return HandleError("%v", err) + rootDir := "" + if j != nil { + rootDir = j.RootPath + } else { + rootDir, err = resolveProxiedServerRootPath(beadsDir) + if err != nil { + return HandleError("%v", err) + } + } + if sourceSidecar != nil && sourceSidecar.RootPath == "" { + sourceSidecar.RootPath = rootDir + } + if j != nil { + if err := validateMigrationTopology(beadsDir, j, shared, false); err != nil { + return HandleError("migration topology is inconsistent: %v", err) + } } - sharedDolt, sharedErr := doltserver.SharedDoltDir() + sharedDolt, sharedErr := doltserver.SharedDoltPath() if shared { if sharedErr != nil { return HandleError("failed to resolve shared dolt directory: %v", sharedErr) @@ -387,12 +1074,22 @@ func runMigrateFromProxiedServer(dryRun bool, shared bool) error { return HandleErrorWithHint("proxied-server is still running", "stop it first: bd dolt stop") } - logAssets, err := proxiedLogAssets(beadsDir) - if err != nil { - return HandleError("%v", err) + var logAssets []string + if j != nil { + logAssets = append(logAssets, j.LogAssets...) + } else { + logAssets, err = proxiedLogAssets(beadsDir) + if err != nil { + return HandleError("%v", err) + } } if dryRun { + if jsonOutput { + b, _ := json.Marshal(migrateDryRunOutput{true, configfile.DoltModeProxiedServer, expectedTarget, shared, rootDir}) + fmt.Println(string(b)) + return nil + } fmt.Println("Dry run mode - no changes will be made") fmt.Printf("Would set dolt_mode: %s → %s\n", configfile.DoltModeProxiedServer, configfile.DoltModeServer) if shared { @@ -407,6 +1104,18 @@ func runMigrateFromProxiedServer(dryRun bool, shared bool) error { } return nil } + if st, e := os.Stat(rootDir); e != nil || !st.IsDir() { + return HandleError("Dolt root %s does not exist or is not a directory", rootDir) + } + if st, e := os.Stat(filepath.Join(rootDir, ".dolt")); e != nil || !st.IsDir() { + return HandleError("Dolt root %s is not a valid Dolt directory", rootDir) + } + if st, e := os.Stat(filepath.Join(rootDir, ".dolt", "repo_state.json")); e != nil || st.IsDir() { + return HandleError("Dolt root %s is not a valid Dolt repository", rootDir) + } + if err := validateDoltRoot(rootDir); err != nil { + return HandleError("Dolt root validation failed: %v", err) + } serverStateDir := beadsDir if shared { @@ -433,28 +1142,77 @@ func runMigrateFromProxiedServer(dryRun bool, shared bool) error { return migrateLockErr("dolt sql-server", err) } defer serverLock.Unlock() - - if err := doltserver.MarkDoltDirCompatible(rootDir); err != nil { - return HandleError("failed to mark dolt directory compatible: %v", err) - } - - cfg.DoltMode = configfile.DoltModeServer - if err := cfg.Save(beadsDir); err != nil { - return HandleError("failed to save metadata.json: %v", err) - } - - if shared { - if err := config.SetYamlConfigInDir(beadsDir, "dolt.shared-server", "true"); err != nil { - fmt.Fprintf(os.Stderr, "Warning: could not enable dolt.shared-server: %v\n", err) + if j == nil { + j = &migrateJournal{Version: 1, SourceMode: configfile.DoltModeProxiedServer, TargetMode: expectedTarget, Shared: shared, RootPath: rootDir, Sidecar: sourceSidecar, LogAssets: logAssets, Ownership: "managed-local", Attempt: 1, Phase: migratePrepared} + if err := saveMigrateJournal(beadsDir, j); err != nil { + return HandleError("failed to prepare migration: %v", err) + } + if err := migrateFault(migratePrepared); err != nil { + return err + } + } else { + j.Attempt++ + if err := saveMigrateJournal(beadsDir, j); err != nil { + return HandleError("failed to update migration attempt: %v", err) } } - - if err := os.Remove(configfile.ProxiedServerClientInfoPath(beadsDir)); err != nil && !os.IsNotExist(err) { - return HandleError("failed to remove %s: %v", configfile.ProxiedServerClientInfoFileName, err) + if j.Phase == migratePrepared { + if err := doltserver.MarkDoltDirCompatible(rootDir); err != nil { + return HandleError("failed to mark dolt directory compatible: %v", err) + } + cfg.DoltMode = configfile.DoltModeServer + if err := cfg.Save(beadsDir); err != nil { + return HandleError("failed to save metadata.json: %v", err) + } + if shared { + if err := config.SetYamlConfigInDir(beadsDir, "dolt.shared-server", "true"); err != nil { + return HandleError("failed to enable dolt.shared-server: %v", err) + } + } + if err := checkpointMigration(beadsDir, j, migrateTargetConfigured); err != nil { + return err + } + } + if j.Phase == migrateTargetConfigured { + if err := os.Remove(configfile.ProxiedServerClientInfoPath(beadsDir)); err != nil && !os.IsNotExist(err) { + return HandleError("failed to remove %s: %v", configfile.ProxiedServerClientInfoFileName, err) + } + if errs := proxy.PurgeControlFiles(rootDir); len(errs) > 0 { + return HandleError("failed to retire proxy controls: %v", errs[0]) + } + if errs := removeMigrateAssets(logAssets); len(errs) > 0 { + return HandleError("failed to retire proxy logs: %v", errs[0]) + } + if err := checkpointMigration(beadsDir, j, migrateOldControlsRetired); err != nil { + return err + } + } + if j.Phase == migrateOldControlsRetired { + if c, e := configfile.Load(beadsDir); e != nil || c == nil || !c.IsDoltServerMode() { + return HandleError("migration verification failed: metadata mode is not server") + } + if shared { + if v, ok := config.WorkspaceYamlValue(beadsDir, "dolt.shared-server"); !ok || strings.ToLower(v) != "true" { + return HandleError("migration verification failed: shared-server is not enabled") + } + } + if err := checkpointMigration(beadsDir, j, migrateVerified); err != nil { + return err + } + } + if j.Phase == migrateVerified { + if err := checkpointMigration(beadsDir, j, migrateCommitted); err != nil { + return err + } + if err := removeMigrateJournal(beadsDir); err != nil { + return HandleError("failed to finalize migration: %v", err) + } + } + if j.Phase == migrateCommitted { + if err := removeMigrateJournal(beadsDir); err != nil { + return HandleError("failed to finalize migration: %v", err) + } } - - warnMigrateRemovalErrors(proxy.PurgeControlFiles(rootDir)) - warnMigrateRemovalErrors(removeMigrateAssets(logAssets)) commandDidWrite.Store(true) if shared { @@ -467,6 +1225,25 @@ func runMigrateFromProxiedServer(dryRun bool, shared bool) error { return nil } +// migrationSharedTopology resolves the target workspace's shared-server +// setting. An explicit workspace YAML value is authoritative over ambient +// process environment so retries cannot be misclassified by stale env state. +func migrationSharedTopology(beadsDir string) (live, yaml bool, yamlSet bool, err error) { + live = doltserver.IsSharedServerMode() + raw, yamlSet, readErr := config.WorkspaceYamlValueStrict(beadsDir, "dolt.shared-server") + if readErr != nil { + return false, false, false, readErr + } + if !yamlSet { + return live, false, false, nil + } + parsed, parseErr := strconv.ParseBool(strings.TrimSpace(raw)) + if parseErr != nil { + return false, false, true, fmt.Errorf("workspace dolt.shared-server is invalid: %q", raw) + } + return parsed, parsed, true, nil +} + func proxiedLogAssets(beadsDir string) ([]string, error) { logPath, isCustomLog, err := resolveProxiedServerLogPath(beadsDir) if err != nil { diff --git a/cmd/bd/migrate_dolt_mode_frontdoor_integration_test.go b/cmd/bd/migrate_dolt_mode_frontdoor_integration_test.go new file mode 100644 index 000000000..85f730364 --- /dev/null +++ b/cmd/bd/migrate_dolt_mode_frontdoor_integration_test.go @@ -0,0 +1,916 @@ +//go:build cgo && integration + +package main + +import ( + "bytes" + "encoding/json" + "fmt" + "net" + "os" + "os/exec" + "path/filepath" + "reflect" + "strconv" + "strings" + "testing" + + "github.com/steveyegge/beads/internal/config" + "github.com/steveyegge/beads/internal/configfile" + "github.com/steveyegge/beads/internal/doltserver" + "github.com/steveyegge/beads/internal/storage/dbproxy/proxy" + "github.com/steveyegge/beads/internal/storage/dbproxy/server" + "github.com/steveyegge/beads/internal/storage/dbproxy/util" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func runBDExecSeparated(t *testing.T, bd, dir string, env []string, args ...string) (string, string, error) { + t.Helper() + cmd := exec.Command(bd, args...) + cmd.Dir, cmd.Env = dir, env + var stdout, stderr bytes.Buffer + cmd.Stdout, cmd.Stderr = &stdout, &stderr + err := cmd.Run() + return stdout.String(), stderr.String(), err +} + +func createDependencyPair(t *testing.T, bd, dir string, env []string, sentinelID string) string { + t.Helper() + blockerOut, err := runBDExecWithBinary(t, bd, dir, env, "create", "migration blocker", "--json") + require.NoError(t, err, "create blocker: %s", blockerOut) + var blocker struct { + ID string `json:"id"` + } + require.NoError(t, json.Unmarshal([]byte(blockerOut), &blocker)) + require.NotEmpty(t, blocker.ID) + depOut, depErr := runBDExecWithBinary(t, bd, dir, env, "dep", "add", sentinelID, blocker.ID) + require.NoError(t, depErr, "dep add: %s", depOut) + return blocker.ID +} + +func assertDependencyPair(t *testing.T, bd, dir string, env []string, sentinelID, blockerID string) { + t.Helper() + out, err := runBDExecWithBinary(t, bd, dir, env, "dep", "list", sentinelID, blockerID, "--json") + require.NoError(t, err, "dep list: %s", out) + var edges []struct { + IssueID string `json:"issue_id"` + DependsOnID string `json:"depends_on_id"` + Type string `json:"type"` + } + require.NoError(t, json.Unmarshal([]byte(out), &edges), "dep list JSON: %s", out) + found := false + for _, edge := range edges { + if (edge.IssueID == "" || edge.IssueID == sentinelID) && edge.DependsOnID == blockerID && edge.Type == "blocks" { + found = true + } + } + assert.True(t, found, "dependency edge missing: %s -> %s", sentinelID, blockerID) +} + +func migrationFrontDoorBinary(t *testing.T) string { + if p := os.Getenv("BEADS_TEST_BD_BINARY"); p != "" { + return p + } + out := filepath.Join(t.TempDir(), "bd") + cmd := exec.Command("go", "build", "-o", out, ".") + cmd.Dir = "." + if b, err := cmd.CombinedOutput(); err != nil { + t.Fatalf("build cgo bd: %v\n%s", err, b) + } + return out +} + +func migrationFrontDoorEnv(home string) []string { + env := make([]string, 0) + for _, kv := range os.Environ() { + key := kv + if i := strings.IndexByte(kv, '='); i >= 0 { + key = kv[:i] + } + // The cmd/bd package TestMain sets BEADS_TEST_MODE and related + // controls for its in-process tests. Never inherit those into the + // real front-door subprocess: BEADS_TEST_MODE disables auto-start + // and makes a freshly initialized server resolve to port 1. + if strings.HasPrefix(key, "BEADS_") || strings.HasPrefix(key, "BD_") || key == "HOME" || key == "USERPROFILE" { + continue + } + env = append(env, kv) + } + return append(env, "HOME="+home, "USERPROFILE="+home) +} + +// TestMigrateDoltModeFrontDoor exercises migration through the real bd +// executable. It is opt-in because it requires a local Dolt installation. +func TestMigrateDoltModeFrontDoor(t *testing.T) { + if os.Getenv("BEADS_TEST_MIGRATION_FRONTDOOR") != "1" { + t.Skip("set BEADS_TEST_MIGRATION_FRONTDOOR=1") + } + bd := migrationFrontDoorBinary(t) + dir := t.TempDir() + home := t.TempDir() + env := migrationFrontDoorEnv(home) + out, err := runBDExecWithBinary(t, bd, dir, env, "init", "--backend", "dolt", "--server", "--prefix", "fd", "--quiet") + if err != nil { + t.Fatalf("init: %v\n%s", err, out) + } + createOut, err := runBDExecWithBinary(t, bd, dir, env, "create", "front-door sentinel", "--json") + if err != nil { + t.Fatalf("create sentinel: %v\n%s", err, createOut) + } + statusOut, _ := runBDExecWithBinary(t, bd, dir, env, "dolt", "status") + if strings.Contains(statusOut, "Dolt server: running") { + if out, err = runBDExecWithBinary(t, bd, dir, env, "dolt", "stop"); err != nil { + t.Fatalf("stop running server: %v\n%s", err, out) + } + } + var created struct { + ID string `json:"id"` + } + if err := json.Unmarshal([]byte(createOut), &created); err != nil || created.ID == "" { + t.Fatalf("invalid create JSON: %s", createOut) + } + if out, err = runBDExecWithBinary(t, bd, dir, env, "migrate", "from-server-to-proxied-server"); err != nil { + t.Fatalf("forward migration: %v\n%s", err, out) + } + metaProxy, _ := os.ReadFile(filepath.Join(dir, ".beads", "metadata.json")) + var proxyMetadata map[string]any + if err := json.Unmarshal(metaProxy, &proxyMetadata); err != nil || proxyMetadata["dolt_mode"] != "proxied-server" { + t.Fatalf("forward did not persist proxied mode: %s", metaProxy) + } + info, err := os.ReadFile(filepath.Join(dir, ".beads", "proxied_server_client_info.json")) + if err != nil || len(info) == 0 { + t.Fatalf("missing proxied sidecar: %v", err) + } + if !strings.Contains(out, "Switched to proxied-server mode") { + t.Fatalf("unexpected forward output: %s", out) + } + list, err := runBDExecWithBinary(t, bd, dir, env, "list", "--json") + if err != nil || !json.Valid([]byte(list)) || !strings.Contains(list, created.ID) { + t.Fatalf("proxied list JSON: %v\n%s", err, list) + } + // A completed forward migration must refuse while its proxy process still + // owns the target. This is exercised through the actual bd front door, + // before provider startup can hide the ownership conflict. + runningOut, runningErr := runBDExecWithBinary(t, bd, dir, env, "--json", "migrate", "from-server-to-proxied-server") + if runningErr == nil { + t.Fatalf("forward no-op unexpectedly succeeded while proxy was running: %s", runningOut) + } + var runningRefusal map[string]any + if err := json.Unmarshal([]byte(runningOut), &runningRefusal); err != nil { + t.Fatalf("running-proxy refusal JSON: %v\n%s", err, runningOut) + } + if data, ok := runningRefusal["data"].(map[string]any); ok { + runningRefusal = data + } + if runningRefusal["code"] != "proxy.migrate.invalid_state" || runningRefusal["mutates"] != false { + t.Fatalf("running-proxy refusal = %s", runningOut) + } + if out, err = runBDExecWithBinary(t, bd, dir, env, "update", created.ID, "--title", "front-door sentinel updated"); err != nil { + t.Fatalf("proxied update: %v\n%s", err, out) + } + statusOut, _ = runBDExecWithBinary(t, bd, dir, env, "dolt", "status") + if strings.Contains(statusOut, "Dolt server: running") { + if out, err = runBDExecWithBinary(t, bd, dir, env, "dolt", "stop"); err != nil { + t.Fatalf("stop proxied server: %v\n%s", err, out) + } + } + // The proxy can supervise a Dolt child whose status text is stale; stop is + // idempotent and its "not running" result is safe to ignore. + if out, err = runBDExecWithBinary(t, bd, dir, env, "dolt", "stop"); err != nil && !strings.Contains(strings.ToLower(out), "not running") { + t.Fatalf("stop before reverse: %v\n%s", err, out) + } + sidecarBefore, err := os.ReadFile(filepath.Join(dir, ".beads", "proxied_server_client_info.json")) + if err != nil { + t.Fatal(err) + } + metaBefore, err := os.ReadFile(filepath.Join(dir, ".beads", "metadata.json")) + if err != nil { + t.Fatal(err) + } + if out, err = runBDExecWithBinary(t, bd, dir, env, "--json", "migrate", "from-proxied-server-to-server", "--dry-run"); err != nil { + t.Fatalf("reverse dry-run: %v\n%s", err, out) + } + if _, err = os.Stat(filepath.Join(dir, ".beads", "proxied_server_client_info.json")); err != nil { + t.Fatalf("dry-run removed sidecar: %v", err) + } + if got, _ := os.ReadFile(filepath.Join(dir, ".beads", "proxied_server_client_info.json")); string(got) != string(sidecarBefore) { + t.Fatal("dry-run changed sidecar") + } + if got, _ := os.ReadFile(filepath.Join(dir, ".beads", "metadata.json")); string(got) != string(metaBefore) { + t.Fatal("dry-run changed metadata") + } + if out, err = runBDExecWithBinary(t, bd, dir, env, "migrate", "from-proxied-server-to-server"); err != nil { + t.Fatalf("reverse migration: %v\n%s", err, out) + } + show, err := runBDExecWithBinary(t, bd, dir, env, "show", created.ID, "--json") + if err != nil { + t.Fatalf("show sentinel: %v\n%s", err, show) + } + if !json.Valid([]byte(show)) || !strings.Contains(show, "front-door sentinel updated") { + t.Fatalf("sentinel missing or invalid JSON: %s", show) + } + meta, err := os.ReadFile(filepath.Join(dir, ".beads", "metadata.json")) + var serverMetadata map[string]any + if err != nil || json.Unmarshal(meta, &serverMetadata) != nil || serverMetadata["dolt_mode"] != "server" { + t.Fatalf("metadata mode not restored: %s", meta) + } + if _, err = os.Stat(filepath.Join(dir, ".beads", "proxied_server_client_info.json")); !os.IsNotExist(err) { + t.Fatal("sidecar remains after reverse") + } + list, err = runBDExecWithBinary(t, bd, dir, env, "list", "--json") + if err != nil || !json.Valid([]byte(list)) || !strings.Contains(list, "front-door sentinel updated") { + t.Fatalf("direct list JSON: %v\n%s", err, list) + } +} + +func TestMigrateDoltModeFrontDoorRefusesMalformedSidecar(t *testing.T) { + if os.Getenv("BEADS_TEST_MIGRATION_FRONTDOOR") != "1" { + t.Skip("set BEADS_TEST_MIGRATION_FRONTDOOR=1") + } + bd := migrationFrontDoorBinary(t) + dir, home := t.TempDir(), t.TempDir() + env := migrationFrontDoorEnv(home) + if out, err := runBDExecWithBinary(t, bd, dir, env, "init", "--backend", "dolt", "--proxied-server", "--quiet"); err != nil { + t.Fatalf("init: %v\n%s", err, out) + } + path := filepath.Join(dir, ".beads", "proxied_server_client_info.json") + if err := os.WriteFile(path, []byte("{malformed"), 0o600); err != nil { + t.Fatal(err) + } + before, _ := os.ReadFile(filepath.Join(dir, ".beads", "metadata.json")) + out, err := runBDExecWithBinary(t, bd, dir, env, "--json", "migrate", "from-proxied-server-to-server") + if err == nil { + t.Fatal("malformed sidecar unexpectedly succeeded") + } + if !json.Valid([]byte(out)) { + t.Fatalf("expected JSON error output, got %s", out) + } + after, _ := os.ReadFile(filepath.Join(dir, ".beads", "metadata.json")) + if string(before) != string(after) { + t.Fatal("refusal mutated metadata") + } +} + +func TestMigrateDoltModeFrontDoorRefusesExternalEndpoint(t *testing.T) { + if os.Getenv("BEADS_TEST_MIGRATION_FRONTDOOR") != "1" { + t.Skip("set BEADS_TEST_MIGRATION_FRONTDOOR=1") + } + bd := migrationFrontDoorBinary(t) + for _, tc := range []struct { + name string + want string + }{ + {name: "tcp", want: "externally hosted proxied Dolt endpoint"}, + {name: "unix", want: "externally hosted proxied Dolt endpoint"}, + } { + t.Run(tc.name, func(t *testing.T) { + dir, home := t.TempDir(), t.TempDir() + env := migrationFrontDoorEnv(home) + beadsDir := filepath.Join(dir, ".beads") + root := filepath.Join(beadsDir, "dolt") + if err := os.MkdirAll(filepath.Join(root, ".dolt"), 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(root, ".dolt", "repo_state.json"), []byte(`{"head":"refs/heads/main","remotes":{},"backups":{},"branches":{}}`), 0o600); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(beadsDir, "metadata.json"), []byte(`{"database":"myproj","backend":"dolt","dolt_mode":"proxied-server"}`), 0o600); err != nil { + t.Fatal(err) + } + if err := os.Chmod(beadsDir, 0o700); err != nil { + t.Fatal(err) + } + metaBefore, err := os.ReadFile(filepath.Join(beadsDir, "metadata.json")) + if err != nil { + t.Fatal(err) + } + sidecarPath := filepath.Join(beadsDir, "proxied_server_client_info.json") + // Replace the managed sidecar with an externally-owned endpoint. + // This exercises migration refusal without attempting a network + // connection to an unreachable host/socket during init. + external := map[string]any{"root_path": filepath.Join(beadsDir, "dolt"), "external": map[string]any{}} + if tc.name == "tcp" { + external["external"] = map[string]any{"host": "db.example", "port": 3307} + } else { + external["external"] = map[string]any{"socket": "/tmp/beads-front-door.sock"} + } + sidecarData, _ := json.Marshal(external) + if err := os.WriteFile(sidecarPath, sidecarData, 0o600); err != nil { + t.Fatal(err) + } + sidecarBefore, err := os.ReadFile(sidecarPath) + if err != nil { + t.Fatal(err) + } + treeBefore := snapshotMigrationTree(t, beadsDir) + out, err := runBDExecWithBinary(t, bd, dir, env, "--json", "migrate", "from-proxied-server-to-server") + if err == nil { + t.Fatal("external endpoint migration unexpectedly succeeded") + } + if exitErr, ok := err.(*exec.ExitError); !ok || exitErr.ExitCode() != 1 { + t.Fatalf("expected exit code 1, got %v", err) + } + var refusal map[string]any + if err := json.Unmarshal([]byte(out), &refusal); err != nil { + t.Fatalf("invalid refusal JSON: %v\n%s", err, out) + } + if data, ok := refusal["data"].(map[string]any); ok { + refusal = data + } + if refusal["code"] != "proxy.migrate.external_endpoint" || refusal["mutates"] != false { + t.Fatalf("expected typed non-mutating refusal, got: %s", out) + } + if !strings.Contains(strings.ToLower(out), strings.ToLower(tc.want)) { + t.Fatalf("expected refusal text %q, got: %s", tc.want, out) + } + // Refusal must happen before any proxy/provider process starts. + probe := exec.Command("pgrep", "-af", "[d]b-proxy-child --root "+root) + if processOut, probeErr := probe.CombinedOutput(); probeErr == nil && len(strings.TrimSpace(string(processOut))) > 0 { + t.Fatalf("external refusal started a proxy process: %s", processOut) + } + if got, _ := os.ReadFile(filepath.Join(beadsDir, "metadata.json")); string(got) != string(metaBefore) { + t.Fatal("external refusal mutated metadata") + } + if got, _ := os.ReadFile(sidecarPath); string(got) != string(sidecarBefore) { + t.Fatal("external refusal mutated sidecar") + } + if _, err := os.Stat(filepath.Join(beadsDir, "dolt-mode-migration.json")); !os.IsNotExist(err) { + t.Fatal("external refusal created a migration journal") + } + if got := snapshotMigrationTree(t, beadsDir); !reflect.DeepEqual(treeBefore, got) { + t.Fatal("external refusal mutated migration artifacts") + } + }) + } +} + +func TestMigrateDoltModeFrontDoorExternalJournalMatrix(t *testing.T) { + if os.Getenv("BEADS_TEST_MIGRATION_FRONTDOOR") != "1" { + t.Skip("set BEADS_TEST_MIGRATION_FRONTDOOR=1") + } + bd := migrationFrontDoorBinary(t) + phases := []string{"prepared", "target_configured", "old_controls_retired", "verified", "committed"} + for _, reverse := range []bool{false, true} { + for _, phase := range phases { + for _, unix := range []bool{false, true} { + t.Run(fmt.Sprintf("%s/%s/%s", map[bool]string{false: "forward", true: "reverse"}[reverse], phase, map[bool]string{false: "tcp", true: "unix"}[unix]), func(t *testing.T) { + dir, home := t.TempDir(), t.TempDir() + env := migrationFrontDoorEnv(home) + beadsDir, root := filepath.Join(dir, ".beads"), filepath.Join(dir, ".beads", "dolt") + require.NoError(t, os.MkdirAll(filepath.Join(root, ".dolt"), 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(root, ".dolt", "repo_state.json"), []byte(`{"head":"refs/heads/main","remotes":{},"backups":{},"branches":{}}`), 0o600)) + src, target := "server", "proxied-server" + command := []string{"from-server-to-proxied-server"} + if reverse { + src, target, command = "proxied-server", "server", []string{"from-proxied-server-to-server"} + } + mode := src + if phase != "prepared" { + mode = target + } + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "metadata.json"), []byte(fmt.Sprintf(`{"database":"myproj","backend":"dolt","dolt_mode":%q}`, mode)), 0o600)) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, ".local_version"), []byte(Version), 0o600)) + require.NoError(t, os.Chmod(beadsDir, 0o700)) + ext := map[string]any{"host": "db.example", "port": 3307} + if unix { + ext = map[string]any{"socket": "/tmp/beads-front-door.sock"} + } + sidecar, _ := json.Marshal(map[string]any{"root_path": root, "external": ext}) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "proxied_server_client_info.json"), sidecar, 0o600)) + journal, _ := json.Marshal(map[string]any{"version": 1, "source_mode": src, "target_mode": target, "root_path": root, "external": ext, "sidecar": map[string]any{"root_path": root, "external": ext}, "ownership": "external", "attempt": 1, "phase": phase}) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, migrateJournalFileName), journal, 0o600)) + gatePath := filepath.Join(beadsDir, "dolt.gate.lock") + require.NoError(t, os.WriteFile(gatePath, []byte("preseeded-gate-lock"), 0o600)) + gateBefore, gateErr := os.ReadFile(gatePath) + gateExists := gateErr == nil + tree := snapshotMigrationTree(t, beadsDir) + out, err := runBDExecWithBinary(t, bd, dir, env, append([]string{"--json", "migrate"}, command...)...) + require.Error(t, err) + exitErr, ok := err.(*exec.ExitError) + require.True(t, ok) + require.Equal(t, 1, exitErr.ExitCode()) + var payload map[string]any + require.NoError(t, json.Unmarshal([]byte(out), &payload), out) + if data, ok := payload["data"].(map[string]any); ok { + payload = data + } + assert.Equal(t, "proxy.migrate.external_endpoint", payload["code"]) + assert.Equal(t, false, payload["mutates"]) + assert.Contains(t, payload["error"], "externally hosted proxied Dolt endpoint") + assert.Equal(t, tree, snapshotMigrationTree(t, beadsDir)) + for _, p := range append([]string{migrateLockFileName}, serverAssetNames()...) { + _, statErr := os.Stat(filepath.Join(beadsDir, p)) + assert.True(t, os.IsNotExist(statErr), "unexpected artifact %s", p) + } + gateAfter, gateAfterErr := os.ReadFile(gatePath) + assert.Equal(t, gateExists, gateAfterErr == nil, "dolt gate lock existence changed") + if gateExists { + assert.Equal(t, gateBefore, gateAfter, "dolt gate lock changed") + } + for _, p := range proxiedAssetNames() { + _, statErr := os.Stat(filepath.Join(root, p)) + assert.True(t, os.IsNotExist(statErr), "unexpected proxy artifact %s", p) + } + probe := exec.Command("pgrep", "-af", "[d]b-proxy-child --root "+root) + processOut, probeErr := probe.CombinedOutput() + assert.True(t, probeErr != nil || len(strings.TrimSpace(string(processOut))) == 0, "proxy process started: %s", processOut) + }) + } + } + } +} + +func TestMigrateDoltModeFrontDoorMalformedStateRefuses(t *testing.T) { + if os.Getenv("BEADS_TEST_MIGRATION_FRONTDOOR") != "1" { + t.Skip("set BEADS_TEST_MIGRATION_FRONTDOOR=1") + } + bd := migrationFrontDoorBinary(t) + for _, tc := range []struct { + name string + file string + body string + }{ + {"metadata", "metadata.json", "{malformed"}, + {"journal", migrateJournalFileName, "{malformed"}, + } { + t.Run(tc.name, func(t *testing.T) { + dir, home := t.TempDir(), t.TempDir() + env := migrationFrontDoorEnv(home) + beadsDir := filepath.Join(dir, ".beads") + require.NoError(t, os.MkdirAll(beadsDir, 0o700)) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, ".local_version"), []byte(Version), 0o600)) + if tc.name == "journal" { + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "metadata.json"), []byte(`{"database":"myproj","backend":"dolt","dolt_mode":"proxied-server"}`), 0o600)) + } + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, tc.file), []byte(tc.body), 0o600)) + before := snapshotMigrationTree(t, beadsDir) + out, _, err := runBDExecSeparated(t, bd, dir, env, "--json", "migrate", "from-proxied-server-to-server") + require.Error(t, err) + exitErr, ok := err.(*exec.ExitError) + require.True(t, ok) + require.Equal(t, 1, exitErr.ExitCode()) + var payload map[string]any + require.NoError(t, json.Unmarshal([]byte(out), &payload), out) + if data, ok := payload["data"].(map[string]any); ok { + payload = data + } + assert.Equal(t, "proxy.migrate.invalid_state", payload["code"]) + assert.Equal(t, false, payload["mutates"]) + assert.Equal(t, before, snapshotMigrationTree(t, beadsDir)) + }) + } +} + +// TestMigrateDoltModeForwardNoopRefusalsFrontDoor keeps the completed-target +// path fail-closed at the real CLI boundary. Both output modes must preserve +// the workspace byte-for-byte while refusing ambiguous ownership/artifacts. +func TestMigrateDoltModeForwardNoopRefusalsFrontDoor(t *testing.T) { + if os.Getenv("BEADS_TEST_MIGRATION_FRONTDOOR") != "1" { + t.Skip("set BEADS_TEST_MIGRATION_FRONTDOOR=1") + } + bd := migrationFrontDoorBinary(t) + cases := []struct { + name string + shared bool + info map[string]any + asset string + want string + }{ + {name: "direct external sidecar", info: map[string]any{"external": map[string]any{"host": "db.example", "port": 3307}}, want: "externally hosted"}, + {name: "direct mismatched sidecar", info: map[string]any{"root_path": "/tmp/other"}, want: "canonical"}, + {name: "direct stale control", asset: "proxy.log", want: "stale proxy control"}, + {name: "shared mismatched sidecar", shared: true, info: map[string]any{"root_path": "/tmp/other"}, want: "canonical"}, + {name: "shared external sidecar", shared: true, info: map[string]any{"external": map[string]any{"host": "db.example", "port": 3307}}, want: "externally hosted"}, + {name: "shared stale control", shared: true, asset: "proxy.log", want: "stale proxy control"}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + dir, home := t.TempDir(), t.TempDir() + env := migrationFrontDoorEnv(home) + beadsDir := filepath.Join(dir, ".beads") + root := filepath.Join(beadsDir, "dolt") + if tc.shared { + shared := filepath.Join(home, "shared-server") + env = append(env, "BEADS_SHARED_SERVER_DIR="+shared, "BEADS_DOLT_SHARED_SERVER=1") + root = filepath.Join(shared, "dolt") + } + require.NoError(t, os.MkdirAll(filepath.Join(root, ".dolt"), 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(root, ".dolt", "repo_state.json"), []byte(`{"head":"refs/heads/main","remotes":{},"backups":{},"branches":{}}`), 0o600)) + require.NoError(t, os.MkdirAll(beadsDir, 0o700)) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "metadata.json"), []byte(`{"database":"myproj","backend":"dolt","dolt_mode":"proxied-server"}`), 0o600)) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, ".local_version"), []byte(Version), 0o600)) + if tc.shared { + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n shared-server: false\n"), 0o600)) + } + if tc.info == nil { + tc.info = map[string]any{"root_path": root} + } + if _, ok := tc.info["root_path"]; !ok { + tc.info["root_path"] = root + } + b, err := json.Marshal(tc.info) + require.NoError(t, err) + sidecar := filepath.Join(beadsDir, "proxied_server_client_info.json") + require.NoError(t, os.WriteFile(sidecar, b, 0o600)) + if tc.asset != "" { + require.NoError(t, os.WriteFile(filepath.Join(root, tc.asset), []byte("stale"), 0o600)) + } + before := snapshotMigrationTree(t, beadsDir, root) + for _, jsonMode := range []bool{false, true} { + args := []string{"migrate", "from-server-to-proxied-server"} + if tc.shared { + args[1] = "from-shared-server-to-proxied-server" + } + if jsonMode { + args = append([]string{"--json"}, args...) + } + stdout, stderr, runErr := runBDExecSeparated(t, bd, dir, env, args...) + require.Error(t, runErr) + exitErr, ok := runErr.(*exec.ExitError) + require.True(t, ok) + require.Equal(t, 1, exitErr.ExitCode()) + if jsonMode { + var payload map[string]any + require.NoError(t, json.Unmarshal([]byte(stdout), &payload), stdout) + if data, ok := payload["data"].(map[string]any); ok { + payload = data + } + assert.Equal(t, "proxy.migrate.invalid_state", payload["code"]) + assert.Equal(t, false, payload["mutates"]) + } else { + assert.Contains(t, strings.ToLower(stderr), strings.ToLower(tc.want)) + } + assert.Equal(t, before, snapshotMigrationTree(t, beadsDir, root)) + } + }) + } +} + +// TestMigrateDoltModeDirectForwardFaultsFrontDoor runs every checkpoint fault +// through a real managed-local bd process, then retries twice. The issue row +// proves the physical Dolt data survived the journal repair and idempotent +// second invocation. +func TestMigrateDoltModeDirectForwardFaultsFrontDoor(t *testing.T) { + if os.Getenv("BEADS_TEST_MIGRATION_FRONTDOOR") != "1" { + t.Skip("set BEADS_TEST_MIGRATION_FRONTDOOR=1") + } + bd := migrationFrontDoorBinary(t) + for _, phase := range []string{"prepared", "target_configured", "old_controls_retired", "verified", "committed"} { + t.Run(phase, func(t *testing.T) { + dir, home := t.TempDir(), t.TempDir() + env := migrationFrontDoorEnv(home) + out, err := runBDExecWithBinary(t, bd, dir, env, "init", "--backend", "dolt", "--server", "--prefix", "fault", "--quiet") + require.NoError(t, err, "init: %s", out) + created, err := runBDExecWithBinary(t, bd, dir, env, "create", "migration sentinel", "--json") + require.NoError(t, err, "create: %s", created) + var row struct { + ID string `json:"id"` + } + require.NoError(t, json.Unmarshal([]byte(created), &row)) + blockerID := createDependencyPair(t, bd, dir, env, row.ID) + _, _ = runBDExecWithBinary(t, bd, dir, env, "dolt", "stop") + beadsDir := filepath.Join(dir, ".beads") + root := filepath.Join(beadsDir, "dolt") + touchFile(t, filepath.Join(root, "migration-sentinel")) + sentinelBefore := snapshotMigrationTree(t, beadsDir, root) + faultEnv := append(append([]string(nil), env...), "BEADS_MIGRATION_FAIL_PHASE="+phase) + out, err = runBDExecWithBinary(t, bd, dir, faultEnv, "migrate", "from-server-to-proxied-server") + require.Error(t, err, "fault phase unexpectedly succeeded: %s", out) + exitErr, ok := err.(*exec.ExitError) + require.True(t, ok) + require.Equal(t, 1, exitErr.ExitCode()) + j, jErr := os.Stat(filepath.Join(beadsDir, migrateJournalFileName)) + require.NoError(t, jErr) + require.False(t, j.IsDir()) + afterFailure := snapshotMigrationTree(t, beadsDir, root) + require.Equal(t, sentinelBefore[filepath.Join(root, "migration-sentinel")], afterFailure[filepath.Join(root, "migration-sentinel")]) + retryEnv := append(append([]string(nil), env...), "BEADS_MIGRATION_FAIL_PHASE=") + require.NoError(t, func() error { + _, e := runBDExecWithBinary(t, bd, dir, retryEnv, "migrate", "from-server-to-proxied-server") + return e + }()) + after := snapshotMigrationTree(t, beadsDir, root) + require.NoError(t, func() error { + _, e := runBDExecWithBinary(t, bd, dir, retryEnv, "migrate", "from-server-to-proxied-server") + return e + }()) + assert.Equal(t, after, snapshotMigrationTree(t, beadsDir, root)) + assertDirectMigrationFinal(t, beadsDir, root, false, filepath.Join(root, "migration-sentinel")) + assertDependencyPair(t, bd, dir, retryEnv, row.ID, blockerID) + show, showErr := runBDExecWithBinary(t, bd, dir, retryEnv, "show", row.ID, "--json") + require.NoError(t, showErr, "show sentinel: %s", show) + assert.Contains(t, show, "migration sentinel") + _, _ = runBDExecWithBinary(t, bd, dir, retryEnv, "dolt", "stop") + }) + } +} + +// TestMigrateDoltModeDirectReverseFaultsFrontDoor covers the reverse +// managed-local transition through the executable for every checkpoint. +func TestMigrateDoltModeDirectReverseFaultsFrontDoor(t *testing.T) { + if os.Getenv("BEADS_TEST_MIGRATION_FRONTDOOR") != "1" { + t.Skip("set BEADS_TEST_MIGRATION_FRONTDOOR=1") + } + bd := migrationFrontDoorBinary(t) + for _, phase := range []string{"prepared", "target_configured", "old_controls_retired", "verified", "committed"} { + t.Run(phase, func(t *testing.T) { + dir, home := t.TempDir(), t.TempDir() + env := migrationFrontDoorEnv(home) + out, err := runBDExecWithBinary(t, bd, dir, env, "init", "--backend", "dolt", "--server", "--prefix", "reverse", "--quiet") + require.NoError(t, err, "init: %s", out) + created, err := runBDExecWithBinary(t, bd, dir, env, "create", "reverse migration sentinel", "--json") + require.NoError(t, err, "create: %s", created) + var row struct { + ID string `json:"id"` + } + require.NoError(t, json.Unmarshal([]byte(created), &row)) + blockerID := createDependencyPair(t, bd, dir, env, row.ID) + _, _ = runBDExecWithBinary(t, bd, dir, env, "dolt", "stop") + _, err = runBDExecWithBinary(t, bd, dir, env, "migrate", "from-server-to-proxied-server") + require.NoError(t, err) + _, _ = runBDExecWithBinary(t, bd, dir, env, "dolt", "stop") + beadsDir := filepath.Join(dir, ".beads") + root := filepath.Join(beadsDir, "dolt") + touchFile(t, filepath.Join(root, "migration-sentinel")) + before := snapshotMigrationTree(t, beadsDir, root) + faultEnv := append(append([]string(nil), env...), "BEADS_MIGRATION_FAIL_PHASE="+phase) + out, err = runBDExecWithBinary(t, bd, dir, faultEnv, "migrate", "from-proxied-server-to-server") + require.Error(t, err, "fault phase unexpectedly succeeded: %s", out) + exitErr, ok := err.(*exec.ExitError) + require.True(t, ok) + require.Equal(t, 1, exitErr.ExitCode()) + require.Equal(t, before[filepath.Join(root, "migration-sentinel")], snapshotMigrationTree(t, beadsDir, root)[filepath.Join(root, "migration-sentinel")]) + retryEnv := append(append([]string(nil), env...), "BEADS_MIGRATION_FAIL_PHASE=") + out, err = runBDExecWithBinary(t, bd, dir, retryEnv, "migrate", "from-proxied-server-to-server") + require.NoError(t, err, "retry: %s", out) + after := snapshotMigrationTree(t, beadsDir, root) + _, err = runBDExecWithBinary(t, bd, dir, retryEnv, "migrate", "from-proxied-server-to-server") + require.NoError(t, err) + assert.Equal(t, after, snapshotMigrationTree(t, beadsDir, root)) + assertDirectMigrationFinal(t, beadsDir, root, true, filepath.Join(root, "migration-sentinel")) + assertDependencyPair(t, bd, dir, retryEnv, row.ID, blockerID) + show, err := runBDExecWithBinary(t, bd, dir, retryEnv, "show", row.ID, "--json") + require.NoError(t, err, "show: %s", show) + assert.Contains(t, show, "reverse migration sentinel") + _, _ = runBDExecWithBinary(t, bd, dir, retryEnv, "dolt", "stop") + }) + } +} + +func assertDirectMigrationFinal(t *testing.T, beadsDir, root string, reverse bool, sentinel string) { + t.Helper() + meta, err := os.ReadFile(filepath.Join(beadsDir, "metadata.json")) + require.NoError(t, err) + var got map[string]any + require.NoError(t, json.Unmarshal(meta, &got)) + if reverse { + assert.Equal(t, "server", got["dolt_mode"]) + _, err = os.Stat(filepath.Join(beadsDir, configfile.ProxiedServerClientInfoFileName)) + assert.True(t, os.IsNotExist(err), "reverse sidecar remains") + if value, ok := config.WorkspaceYamlValue(beadsDir, "dolt.shared-server"); ok { + assert.Equal(t, "false", strings.ToLower(value), "direct reverse must not enable shared topology") + } + for _, path := range proxy.ControlFilePaths(root) { + _, statErr := os.Stat(path) + if statErr == nil && (filepath.Base(path) == proxy.LockFileName || filepath.Base(path) == server.LockFileName) { + lock, lockErr := util.TryLock(path) + if lockErr == nil { + lock.Unlock() + continue + } + } + assert.True(t, os.IsNotExist(statErr), "stale proxy control %s", path) + } + } else { + assert.Equal(t, "proxied-server", got["dolt_mode"]) + info, infoErr := configfile.LoadProxiedServerClientInfo(beadsDir) + require.NoError(t, infoErr) + require.NotNil(t, info) + assert.Equal(t, filepath.Clean(root), filepath.Clean(info.ResolvedRootPath(beadsDir))) + for _, path := range serverAssetNames() { + _, statErr := os.Stat(filepath.Join(beadsDir, path)) + assert.True(t, os.IsNotExist(statErr), "stale server control %s", path) + } + } + for _, path := range []string{filepath.Join(beadsDir, migrateJournalFileName), filepath.Join(beadsDir, migrateLockFileName)} { + _, statErr := os.Stat(path) + assert.True(t, os.IsNotExist(statErr), "stale migration artifact %s", path) + } + sentinelBytes, sentinelErr := os.ReadFile(sentinel) + require.NoError(t, sentinelErr) + assert.Equal(t, []byte("x"), sentinelBytes, "migration changed Dolt root sentinel") + doltState, _ := doltserver.IsRunning(beadsDir) + assert.False(t, doltState != nil && doltState.Running, "direct Dolt process still running") + proxyRunning, _ := proxy.IsRunning(root) + assert.False(t, proxyRunning, "direct proxy process still running") +} + +// sharedMigrationFrontDoorSnapshot records both durable migration artifacts +// and the live ownership probes. The latter are deliberately queried rather +// than represented by pid/status files, which can be stale after a crash. +type sharedMigrationFrontDoorSnapshot struct { + Tree map[string][]byte + Controls map[string]string + DoltRunning bool + DoltPID int + DoltPort int + ProxyRunning bool +} + +func snapshotSharedMigrationFrontDoor(t *testing.T, beadsDir, sharedDir, root string) sharedMigrationFrontDoorSnapshot { + t.Helper() + doltState, _ := doltserver.IsRunning(sharedDir) + doltRunning := doltState != nil && doltState.Running + doltPID, doltPort := 0, 0 + if doltState != nil { + doltPID, doltPort = doltState.PID, doltState.Port + } + proxyRunning, _ := proxy.IsRunning(root) + controls := map[string]string{} + paths := append([]string{ + filepath.Join(beadsDir, "metadata.json"), + filepath.Join(beadsDir, "config.yaml"), + filepath.Join(beadsDir, configfile.ProxiedServerClientInfoFileName), + filepath.Join(beadsDir, migrateJournalFileName), + filepath.Join(beadsDir, migrateLockFileName), + filepath.Join(beadsDir, "dolt.gate.lock"), + }, doltserver.StateFilePaths(sharedDir)...) + paths = append(paths, proxy.ControlFilePaths(root)...) + for _, path := range paths { + contents, err := os.ReadFile(path) + if err != nil { + controls[path] = "missing" + continue + } + controls[path] = string(contents) + } + return sharedMigrationFrontDoorSnapshot{ + Tree: snapshotMigrationTree(t, beadsDir, sharedDir), + Controls: controls, + DoltRunning: doltRunning, + DoltPID: doltPID, + DoltPort: doltPort, + ProxyRunning: proxyRunning, + } +} + +func setupSharedMigrationFrontDoor(t *testing.T, bd string) (dir, home, sharedDir, sharedRoot, issueID, blockerID string, env []string) { + t.Helper() + dir, home = t.TempDir(), t.TempDir() + sharedDir = filepath.Join(home, "shared-server") + sharedRoot = filepath.Join(sharedDir, "dolt") + env = migrationFrontDoorEnv(home) + portProbe, err := net.Listen("tcp", "127.0.0.1:0") + require.NoError(t, err) + port := portProbe.Addr().(*net.TCPAddr).Port + require.NoError(t, portProbe.Close()) + env = append(env, "BEADS_SHARED_SERVER_DIR="+sharedDir, "BEADS_DOLT_SHARED_SERVER=1", "BEADS_DOLT_SERVER_PORT="+strconv.Itoa(port)) + out, err := runBDExecWithBinary(t, bd, dir, env, "init", "--backend", "dolt", "--shared-server", "--prefix", "shared", "--quiet") + require.NoError(t, err, "shared init: %s", out) + created, err := runBDExecWithBinary(t, bd, dir, env, "create", "shared migration sentinel", "--json") + require.NoError(t, err, "shared create: %s", created) + var row struct { + ID string `json:"id"` + } + require.NoError(t, json.Unmarshal([]byte(created), &row)) + blockerID = createDependencyPair(t, bd, dir, env, row.ID) + require.NotEmpty(t, row.ID) + // Migrations require exclusive ownership. Stop the real shared Dolt + // process before taking the baseline snapshot. + status, _ := runBDExecWithBinary(t, bd, dir, env, "dolt", "status") + if strings.Contains(status, "Dolt server: running") { + stop, stopErr := runBDExecWithBinary(t, bd, dir, env, "dolt", "stop") + require.NoError(t, stopErr, "stop shared server: %s", stop) + } + return dir, home, sharedDir, sharedRoot, row.ID, blockerID, env +} + +func assertSharedMigrationResult(t *testing.T, bd, dir string, env []string, beadsDir, sharedDir, sharedRoot, issueID, blockerID string, wantShared bool) { + t.Helper() + meta, err := os.ReadFile(filepath.Join(beadsDir, "metadata.json")) + require.NoError(t, err) + var metadata map[string]any + require.NoError(t, json.Unmarshal(meta, &metadata)) + wantMode := "proxied-server" + if wantShared { + wantMode = "server" + } + assert.Equal(t, wantMode, metadata["dolt_mode"]) + yamlValue, yamlSet := readWorkspaceYamlValueForFrontDoor(t, beadsDir, "dolt.shared-server") + assert.True(t, yamlSet) + assert.Equal(t, fmt.Sprintf("%t", wantShared), strings.ToLower(yamlValue)) + sidecarPath := filepath.Join(beadsDir, "proxied_server_client_info.json") + if wantShared { + _, statErr := os.Stat(sidecarPath) + assert.True(t, os.IsNotExist(statErr), "reverse migration must remove sidecar") + } else { + sidecar, sidecarErr := os.ReadFile(sidecarPath) + require.NoError(t, sidecarErr) + assert.Contains(t, string(sidecar), sharedRoot) + } + _, journalErr := os.Stat(filepath.Join(beadsDir, migrateJournalFileName)) + assert.True(t, os.IsNotExist(journalErr), "migration journal must be finalized") + // Probe ownership before `show`, because opening a shared workspace can + // legitimately auto-start its managed server. + doltState, _ := doltserver.IsRunning(sharedDir) + assert.False(t, doltState != nil && doltState.Running, "shared Dolt process still running before show") + proxyRunning, _ := proxy.IsRunning(sharedRoot) + assert.False(t, proxyRunning, "proxy process still running before show") + if wantShared { + // Shared-server mode is an externally addressed managed server and does + // not auto-start on read paths. Start it explicitly to prove the real + // issue row remains readable after reverse migration. + start, startErr := runBDExecWithBinary(t, bd, dir, env, "dolt", "start") + require.NoError(t, startErr, "start shared server for verification: %s", start) + } + show, showErr := runBDExecWithBinary(t, bd, dir, env, "show", issueID, "--json") + require.NoError(t, showErr, "show migrated issue: %s", show) + assert.Contains(t, show, "shared migration sentinel") + if blockerID != "" { + assertDependencyPair(t, bd, dir, env, issueID, blockerID) + } + // `show` may auto-start the managed shared server. Stop it before probing + // final ownership so the idempotence assertion covers the migration itself. + _, _ = runBDExecWithBinary(t, bd, dir, env, "dolt", "stop") + // Neither migration direction may leave a managed child alive. + doltState, _ = doltserver.IsRunning(sharedDir) + assert.False(t, doltState != nil && doltState.Running, "shared Dolt process still running") + proxyRunning, _ = proxy.IsRunning(sharedRoot) + assert.False(t, proxyRunning, "proxy process still running") +} + +func readWorkspaceYamlValueForFrontDoor(t *testing.T, beadsDir, key string) (string, bool) { + t.Helper() + value, ok := config.WorkspaceYamlValue(beadsDir, key) + return value, ok +} + +// TestMigrateDoltModeSharedForwardFaultsFrontDoor exercises all five +// checkpoints through the real cgo bd subprocess using a disposable managed +// shared-server root. Each injected fault is repaired by a retry and a second +// successful invocation proves idempotence without changing durable state. +func TestMigrateDoltModeSharedForwardFaultsFrontDoor(t *testing.T) { + if os.Getenv("BEADS_TEST_MIGRATION_FRONTDOOR") != "1" { + t.Skip("set BEADS_TEST_MIGRATION_FRONTDOOR=1") + } + bd := migrationFrontDoorBinary(t) + for _, phase := range []string{"prepared", "target_configured", "old_controls_retired", "verified", "committed"} { + t.Run(phase, func(t *testing.T) { + dir, _, sharedDir, sharedRoot, issueID, blockerID, env := setupSharedMigrationFrontDoor(t, bd) + beadsDir := filepath.Join(dir, ".beads") + touchFile(t, filepath.Join(sharedRoot, "migration-sentinel")) + before := snapshotSharedMigrationFrontDoor(t, beadsDir, sharedDir, sharedRoot) + faultEnv := append(append([]string(nil), env...), "BEADS_MIGRATION_FAIL_PHASE="+phase) + out, err := runBDExecWithBinary(t, bd, dir, faultEnv, "migrate", "from-shared-server-to-proxied-server") + require.Error(t, err, "fault phase unexpectedly succeeded: %s", out) + require.FileExists(t, filepath.Join(beadsDir, migrateJournalFileName)) + failed := snapshotSharedMigrationFrontDoor(t, beadsDir, sharedDir, sharedRoot) + assert.Equal(t, before.Tree[filepath.Join(sharedRoot, "migration-sentinel")], failed.Tree[filepath.Join(sharedRoot, "migration-sentinel")]) + retryEnv := append(append([]string(nil), env...), "BEADS_MIGRATION_FAIL_PHASE=") + out, err = runBDExecWithBinary(t, bd, dir, retryEnv, "migrate", "from-shared-server-to-proxied-server") + require.NoError(t, err, "retry: %s", out) + after := snapshotSharedMigrationFrontDoor(t, beadsDir, sharedDir, sharedRoot) + out, err = runBDExecWithBinary(t, bd, dir, retryEnv, "migrate", "from-shared-server-to-proxied-server") + require.NoError(t, err, "second success: %s", out) + assert.Equal(t, after, snapshotSharedMigrationFrontDoor(t, beadsDir, sharedDir, sharedRoot)) + assertSharedMigrationResult(t, bd, dir, retryEnv, beadsDir, sharedDir, sharedRoot, issueID, blockerID, false) + }) + } +} + +// TestMigrateDoltModeSharedReverseFaultsFrontDoor is the reverse-direction +// counterpart of TestMigrateDoltModeSharedForwardFaultsFrontDoor. +func TestMigrateDoltModeSharedReverseFaultsFrontDoor(t *testing.T) { + if os.Getenv("BEADS_TEST_MIGRATION_FRONTDOOR") != "1" { + t.Skip("set BEADS_TEST_MIGRATION_FRONTDOOR=1") + } + bd := migrationFrontDoorBinary(t) + for _, phase := range []string{"prepared", "target_configured", "old_controls_retired", "verified", "committed"} { + t.Run(phase, func(t *testing.T) { + dir, _, sharedDir, sharedRoot, issueID, blockerID, env := setupSharedMigrationFrontDoor(t, bd) + beadsDir := filepath.Join(dir, ".beads") + _, err := runBDExecWithBinary(t, bd, dir, env, "migrate", "from-shared-server-to-proxied-server") + require.NoError(t, err) + // Forward migration leaves the proxy stopped; keep this explicit so + // the reverse matrix never races a child process from auto-start. + _, _ = runBDExecWithBinary(t, bd, dir, env, "dolt", "stop") + touchFile(t, filepath.Join(sharedRoot, "migration-sentinel")) + before := snapshotSharedMigrationFrontDoor(t, beadsDir, sharedDir, sharedRoot) + faultEnv := append(append([]string(nil), env...), "BEADS_MIGRATION_FAIL_PHASE="+phase) + out, err := runBDExecWithBinary(t, bd, dir, faultEnv, "migrate", "from-proxied-server-to-shared-server") + require.Error(t, err, "fault phase unexpectedly succeeded: %s", out) + require.FileExists(t, filepath.Join(beadsDir, migrateJournalFileName)) + failed := snapshotSharedMigrationFrontDoor(t, beadsDir, sharedDir, sharedRoot) + assert.Equal(t, before.Tree[filepath.Join(sharedRoot, "migration-sentinel")], failed.Tree[filepath.Join(sharedRoot, "migration-sentinel")]) + retryEnv := append(append([]string(nil), env...), "BEADS_MIGRATION_FAIL_PHASE=") + out, err = runBDExecWithBinary(t, bd, dir, retryEnv, "migrate", "from-proxied-server-to-shared-server") + require.NoError(t, err, "retry: %s", out) + after := snapshotSharedMigrationFrontDoor(t, beadsDir, sharedDir, sharedRoot) + out, err = runBDExecWithBinary(t, bd, dir, retryEnv, "migrate", "from-proxied-server-to-shared-server") + require.NoError(t, err, "second success: %s", out) + assert.Equal(t, after, snapshotSharedMigrationFrontDoor(t, beadsDir, sharedDir, sharedRoot)) + assertSharedMigrationResult(t, bd, dir, retryEnv, beadsDir, sharedDir, sharedRoot, issueID, blockerID, true) + }) + } +} diff --git a/cmd/bd/migrate_dolt_mode_test.go b/cmd/bd/migrate_dolt_mode_test.go index 6c37f37a2..76dc36f0c 100644 --- a/cmd/bd/migrate_dolt_mode_test.go +++ b/cmd/bd/migrate_dolt_mode_test.go @@ -1,17 +1,74 @@ package main import ( + "bytes" + "encoding/json" + "io" "os" "path/filepath" + "strings" "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/steveyegge/beads/internal/config" "github.com/steveyegge/beads/internal/configfile" + "github.com/steveyegge/beads/internal/storage/dbproxy/proxy" + "github.com/steveyegge/beads/internal/storage/dbproxy/server" "github.com/steveyegge/beads/internal/storage/dbproxy/util" ) +func captureMigrationJSON(t *testing.T, fn func() error) (string, error) { + t.Helper() + stdioMutex.Lock() + defer stdioMutex.Unlock() + old := os.Stdout + r, w, err := os.Pipe() + require.NoError(t, err) + os.Stdout = w + done := make(chan string, 1) + go func() { + var buf bytes.Buffer + _, _ = io.Copy(&buf, r) + done <- buf.String() + }() + callErr := fn() + _ = w.Close() + os.Stdout = old + out := <-done + _ = r.Close() + return out, callErr +} + +func snapshotMigrationTree(t *testing.T, roots ...string) map[string][]byte { + t.Helper() + out := map[string][]byte{} + for _, root := range roots { + _ = filepath.Walk(root, func(path string, info os.FileInfo, err error) error { + if strings.HasSuffix(path, ".gate.lock") || strings.HasSuffix(path, migrateLockFileName) { + return nil + } + if err != nil { + return nil + } + switch { + case info.Mode()&os.ModeSymlink != 0: + target, _ := os.Readlink(path) + out[path] = []byte("symlink:" + target) + case info.IsDir(): + out[path] = []byte("dir:" + info.Mode().String()) + case info.Mode().IsRegular(): + b, _ := os.ReadFile(path) + out[path] = append([]byte("file:"+info.Mode().String()+"\x00"), b...) + } + return nil + }) + } + return out +} + func migrateModeWorkspace(t *testing.T, mode string) string { t.Helper() t.Setenv("BEADS_PROXIED_SERVER_ROOT_PATH", "") @@ -22,6 +79,8 @@ func migrateModeWorkspace(t *testing.T, mode string) string { dir := t.TempDir() beadsDir := filepath.Join(dir, ".beads") require.NoError(t, os.MkdirAll(beadsDir, 0o755)) + require.NoError(t, os.MkdirAll(filepath.Join(beadsDir, "dolt", ".dolt"), 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "dolt", ".dolt", "repo_state.json"), []byte(`{"head":"refs/heads/main","remotes":{},"backups":{},"branches":{}}`), 0o600)) writeMetadataConfig(t, beadsDir, mode, "myproj") t.Chdir(dir) return beadsDir @@ -33,6 +92,13 @@ func touchFile(t *testing.T, path string) { require.NoError(t, os.WriteFile(path, []byte("x"), 0o600)) } +func mustReadFile(t *testing.T, path string) []byte { + t.Helper() + b, err := os.ReadFile(path) + require.NoError(t, err) + return b +} + func serverAssetNames() []string { return []string{"dolt-server.pid", "dolt-server.port", "dolt-server.lock", "dolt-server.log", "dolt-server.log.1"} } @@ -73,6 +139,33 @@ func TestMigrateToProxiedServer_RejectsNonServerMode(t *testing.T) { require.Error(t, err) } +func TestMigrateToProxiedServer_MissingRootFailsClosed(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + require.NoError(t, os.RemoveAll(filepath.Join(beadsDir, "dolt"))) + before, err := os.ReadFile(configfile.ConfigPath(beadsDir)) + require.NoError(t, err) + require.Error(t, runMigrateToProxiedServer(false, 0, false)) + after, err := os.ReadFile(configfile.ConfigPath(beadsDir)) + require.NoError(t, err) + assert.Equal(t, before, after) +} + +func TestMigrateToProxiedServer_MalformedRootIdentityFailsClosed(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "dolt", ".dolt", "repo_state.json"), []byte("not-json"), 0o600)) + require.Error(t, runMigrateToProxiedServer(false, 0, false)) +} + +func TestMigrateToProxiedServer_InvalidRootIdentityShapesFailClosed(t *testing.T) { + for _, body := range []string{`{}`, `null`, `{"garbage":true}`, `{"head":null,"remotes":{},"backups":{},"branches":{}}`, `{"head":"refs/heads/","remotes":{},"backups":{},"branches":{}}`} { + t.Run(body, func(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "dolt", ".dolt", "repo_state.json"), []byte(body), 0o600)) + require.Error(t, runMigrateToProxiedServer(false, 0, false)) + }) + } +} + func TestMigrateToProxiedServer_DryRunWritesNothing(t *testing.T) { beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) touchFile(t, filepath.Join(beadsDir, "dolt-server.log")) @@ -90,6 +183,133 @@ func TestMigrateToProxiedServer_DryRunWritesNothing(t *testing.T) { require.NoError(t, assetErr, "dry-run must not delete assets") } +func TestMigrateToProxiedServer_MalformedWorkspaceYAMLFailsClosed(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + configPath := filepath.Join(beadsDir, "config.yaml") + require.NoError(t, os.WriteFile(configPath, []byte("dolt: ["), 0o600)) + before := snapshotMigrationTree(t, beadsDir) + var err error + stderr := captureStderr(t, func() { err = runMigrateToProxiedServer(false, 0, false) }) + require.Error(t, err) + assert.Contains(t, strings.ToLower(stderr), "parsing workspace config") + assert.Equal(t, before, snapshotMigrationTree(t, beadsDir)) +} + +func TestMigrationSharedTopology_ExplicitYAMLOverridesEnvironment(t *testing.T) { + for _, tc := range []struct { + name string + env string + yaml string + want bool + }{ + {name: "false overrides true env", env: "1", yaml: "false", want: false}, + {name: "true overrides empty env", env: "", yaml: "true", want: true}, + } { + t.Run(tc.name, func(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + t.Setenv("BEADS_DOLT_SHARED_SERVER", tc.env) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n shared-server: "+tc.yaml+"\n"), 0o600)) + live, value, present, err := migrationSharedTopology(beadsDir) + require.NoError(t, err) + assert.True(t, present) + assert.Equal(t, tc.want, value) + assert.Equal(t, tc.want, live) + }) + } +} + +func TestMigrateToProxiedServer_UnreadableWorkspaceYAMLFailsClosed(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + t.Setenv("BEADS_DOLT_SHARED_SERVER", "1") + configPath := filepath.Join(beadsDir, "config.yaml") + require.NoError(t, os.Mkdir(configPath, 0o700)) + before := snapshotMigrationTree(t, beadsDir) + var err error + stderr := captureStderr(t, func() { err = runMigrateToProxiedServer(false, 0, false) }) + require.Error(t, err) + code, ok := exitCodeFromError(err) + assert.True(t, ok) + assert.Equal(t, 1, code) + assert.Contains(t, strings.ToLower(stderr), "reading workspace config") + assert.Equal(t, before, snapshotMigrationTree(t, beadsDir)) +} + +func TestMigrateToProxiedServer_AlreadyProxiedRejectsStaleControl(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + root := filepath.Join(beadsDir, "dolt") + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: root})) + touchFile(t, filepath.Join(root, "proxy.log")) + before := snapshotMigrationTree(t, beadsDir, root) + require.Error(t, runMigrateToProxiedServer(false, 0, false)) + assert.Equal(t, before, snapshotMigrationTree(t, beadsDir, root)) +} + +func TestMigrateToProxiedServer_AlreadyProxiedRejectsBadSidecar(t *testing.T) { + for _, tc := range []struct { + name string + info *configfile.ProxiedServerClientInfo + }{ + {"external", &configfile.ProxiedServerClientInfo{RootPath: "/tmp/ext", External: &configfile.ExternalDoltConfig{Host: "db.example", Port: 3307}}}, + {"mismatch", &configfile.ProxiedServerClientInfo{RootPath: "/tmp/other"}}, + } { + t.Run(tc.name, func(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, tc.info)) + before := snapshotMigrationTree(t, beadsDir) + require.Error(t, runMigrateToProxiedServer(false, 0, false)) + assert.Equal(t, before, snapshotMigrationTree(t, beadsDir)) + }) + } +} + +func TestMigrateToProxiedServer_StaleSidecarFailsClosed(t *testing.T) { + rootCases := []struct { + name string + info *configfile.ProxiedServerClientInfo + want string + }{ + { + name: "external endpoint", + info: &configfile.ProxiedServerClientInfo{ + RootPath: filepath.Join("/", "external-root"), + External: &configfile.ExternalDoltConfig{Host: "db.example", Port: 3307}, + }, + want: "externally hosted proxied dolt endpoint", + }, + { + name: "mismatched local root", + info: &configfile.ProxiedServerClientInfo{RootPath: filepath.Join("/", "another-repo")}, + want: "sidecar root", + }, + { + name: "matching relative root", + info: &configfile.ProxiedServerClientInfo{RootPath: "dolt"}, + want: "exists without a recoverable journal", + }, + } + for _, tc := range rootCases { + t.Run(tc.name, func(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + root := filepath.Join(beadsDir, "dolt") + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, tc.info)) + before := snapshotMigrationTree(t, beadsDir, root) + var migrateErr error + stderr := captureStderr(t, func() { + migrateErr = runMigrateToProxiedServer(false, 0, false) + }) + require.Error(t, migrateErr) + assert.Contains(t, strings.ToLower(stderr), tc.want) + assert.Equal(t, before, snapshotMigrationTree(t, beadsDir, root)) + cfg, err := configfile.Load(beadsDir) + require.NoError(t, err) + assert.True(t, cfg.IsDoltServerMode()) + journal, err := loadMigrateJournal(beadsDir) + require.NoError(t, err) + assert.Nil(t, journal) + }) + } +} + func TestMigrateToServer_FlipsModeAndRemovesSidecar(t *testing.T) { beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{})) @@ -226,6 +446,8 @@ func TestMigrateSharedToProxiedServer_RootsAtSharedDir(t *testing.T) { sharedDir := t.TempDir() t.Setenv("BEADS_SHARED_SERVER_DIR", sharedDir) t.Setenv("BEADS_DOLT_SHARED_SERVER", "1") + require.NoError(t, os.MkdirAll(filepath.Join(sharedDir, "dolt", ".dolt"), 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(sharedDir, "dolt", ".dolt", "repo_state.json"), []byte(`{"head":"refs/heads/main","remotes":{},"backups":{},"branches":{}}`), 0o600)) beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n shared-server: true\n"), 0o600)) @@ -244,6 +466,50 @@ func TestMigrateSharedToProxiedServer_RootsAtSharedDir(t *testing.T) { assert.NotContains(t, string(body), "shared-server: true", "dolt.shared-server must be turned off") } +func TestMigrateSharedToProxiedServer_AllCheckpointFaultsRetry(t *testing.T) { + for _, phase := range []migratePhase{migratePrepared, migrateTargetConfigured, migrateOldControlsRetired, migrateVerified, migrateCommitted} { + t.Run(string(phase), func(t *testing.T) { + sharedDir := t.TempDir() + t.Setenv("BEADS_SHARED_SERVER_DIR", sharedDir) + t.Setenv("BEADS_DOLT_SHARED_SERVER", "1") + root := filepath.Join(sharedDir, "dolt") + require.NoError(t, os.MkdirAll(filepath.Join(root, ".dolt"), 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(root, ".dolt", "repo_state.json"), []byte(`{"head":"refs/heads/main","remotes":{},"backups":{},"branches":{}}`), 0o600)) + sentinel := filepath.Join(root, "migration-sentinel") + touchFile(t, sentinel) + sentinelBefore, err := os.ReadFile(sentinel) + require.NoError(t, err) + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n shared-server: true\n"), 0o600)) + t.Setenv("BEADS_MIGRATION_FAIL_PHASE", string(phase)) + require.Error(t, runMigrateToProxiedServer(false, 0, true)) + j, err := loadMigrateJournal(beadsDir) + require.NoError(t, err) + require.NotNil(t, j) + assert.Equal(t, phase, j.Phase) + t.Setenv("BEADS_MIGRATION_FAIL_PHASE", "") + require.NoError(t, runMigrateToProxiedServer(false, 0, true)) + after := snapshotMigrationTree(t, beadsDir, root) + require.NoError(t, runMigrateToProxiedServer(false, 0, true)) + assert.Equal(t, after, snapshotMigrationTree(t, beadsDir, root), "retry changed durable migration artifacts") + assert.Equal(t, sentinelBefore, mustReadFile(t, sentinel), "migration sentinel changed") + running, _ := proxy.IsRunning(root) + assert.False(t, running, "retry left a proxy process running") + }) + } +} + +func TestMigrateSharedToProxiedServer_DryRunDoesNotCreateRoot(t *testing.T) { + sharedDir := t.TempDir() + t.Setenv("BEADS_SHARED_SERVER_DIR", sharedDir) + t.Setenv("BEADS_DOLT_SHARED_SERVER", "1") + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n shared-server: true\n"), 0o600)) + require.NoError(t, runMigrateToProxiedServer(true, 0, true)) + _, err := os.Stat(filepath.Join(sharedDir, "dolt")) + assert.True(t, os.IsNotExist(err), "dry-run must not create shared root") +} + func TestMigrateToProxiedServer_RejectsSharedRepo(t *testing.T) { t.Setenv("BEADS_DOLT_SHARED_SERVER", "1") migrateModeWorkspace(t, configfile.DoltModeServer) @@ -262,6 +528,7 @@ func TestMigrateProxiedToSharedServer_Reverse(t *testing.T) { require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n shared-server: false\n"), 0o600)) sharedDolt := filepath.Join(sharedDir, "dolt") require.NoError(t, os.MkdirAll(filepath.Join(sharedDolt, ".dolt"), 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(sharedDolt, ".dolt", "repo_state.json"), []byte(`{"head":"refs/heads/main","remotes":{},"backups":{},"branches":{}}`), 0o600)) require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: sharedDolt})) require.NoError(t, runMigrateFromProxiedServer(false, true)) @@ -277,12 +544,66 @@ func TestMigrateProxiedToSharedServer_Reverse(t *testing.T) { assert.Contains(t, string(body), "shared-server: true", "dolt.shared-server must be re-enabled") } +func TestMigrateFromProxiedToSharedServer_AllCheckpointFaultsRetry(t *testing.T) { + for _, phase := range []migratePhase{migratePrepared, migrateTargetConfigured, migrateOldControlsRetired, migrateVerified, migrateCommitted} { + t.Run(string(phase), func(t *testing.T) { + sharedDir := t.TempDir() + t.Setenv("BEADS_SHARED_SERVER_DIR", sharedDir) + t.Setenv("BEADS_DOLT_SHARED_SERVER", "") + root := filepath.Join(sharedDir, "dolt") + require.NoError(t, os.MkdirAll(filepath.Join(root, ".dolt"), 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(root, ".dolt", "repo_state.json"), []byte(`{"head":"refs/heads/main","remotes":{},"backups":{},"branches":{}}`), 0o600)) + sentinel := filepath.Join(root, "migration-sentinel") + touchFile(t, sentinel) + sentinelBefore, err := os.ReadFile(sentinel) + require.NoError(t, err) + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: root})) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n shared-server: false\n"), 0o600)) + t.Setenv("BEADS_MIGRATION_FAIL_PHASE", string(phase)) + require.Error(t, runMigrateFromProxiedServer(false, true)) + j, err := loadMigrateJournal(beadsDir) + require.NoError(t, err) + require.NotNil(t, j) + assert.Equal(t, phase, j.Phase) + assert.Equal(t, 1, j.Attempt) + t.Setenv("BEADS_MIGRATION_FAIL_PHASE", "") + require.NoError(t, runMigrateFromProxiedServer(false, true)) + after := snapshotMigrationTree(t, beadsDir, root) + require.NoError(t, runMigrateFromProxiedServer(false, true)) + assert.Equal(t, after, snapshotMigrationTree(t, beadsDir, root), "retry changed durable migration artifacts") + assert.Equal(t, sentinelBefore, mustReadFile(t, sentinel), "migration sentinel changed") + running, _ := proxy.IsRunning(root) + assert.False(t, running, "retry left a proxy process running") + cfg, _ := configfile.Load(beadsDir) + assert.True(t, cfg.IsDoltServerMode()) + v, ok := config.WorkspaceYamlValue(beadsDir, "dolt.shared-server") + assert.True(t, ok) + assert.Equal(t, "true", strings.ToLower(v)) + _, err = os.Stat(configfile.ProxiedServerClientInfoPath(beadsDir)) + assert.True(t, os.IsNotExist(err)) + }) + } +} + +func TestMigrateProxiedToSharedServer_DryRunDoesNotCreateRoot(t *testing.T) { + sharedDir := t.TempDir() + t.Setenv("BEADS_SHARED_SERVER_DIR", sharedDir) + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + sharedDolt := filepath.Join(sharedDir, "dolt") + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: sharedDolt})) + require.NoError(t, runMigrateFromProxiedServer(true, true)) + _, err := os.Stat(sharedDolt) + assert.True(t, os.IsNotExist(err), "dry-run must not create shared root") +} + func TestMigrateFromProxiedToServer_RejectsSharedRooted(t *testing.T) { sharedDir := t.TempDir() t.Setenv("BEADS_SHARED_SERVER_DIR", sharedDir) beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) sharedDolt := filepath.Join(sharedDir, "dolt") - require.NoError(t, os.MkdirAll(sharedDolt, 0o755)) + require.NoError(t, os.MkdirAll(filepath.Join(sharedDolt, ".dolt"), 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(sharedDolt, ".dolt", "repo_state.json"), []byte(`{"head":"refs/heads/main","remotes":{},"backups":{},"branches":{}}`), 0o600)) require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: sharedDolt})) require.Error(t, runMigrateFromProxiedServer(false, false), "non-shared reverse must reject a shared-rooted proxied repo") @@ -290,9 +611,511 @@ func TestMigrateFromProxiedToServer_RejectsSharedRooted(t *testing.T) { func TestMigrateToProxiedServer_AlreadyProxiedIsNoop(t *testing.T) { beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: filepath.Join(beadsDir, "dolt")})) require.NoError(t, runMigrateToProxiedServer(false, 0, false)) cfg, err := configfile.Load(beadsDir) require.NoError(t, err) assert.True(t, cfg.IsDoltProxiedServerMode()) } + +func TestMigrateSharedToProxiedServer_AlreadyProxiedUsesSharedRootAndStaleEnv(t *testing.T) { + sharedDir := t.TempDir() + t.Setenv("BEADS_SHARED_SERVER_DIR", sharedDir) + t.Setenv("BEADS_DOLT_SHARED_SERVER", "true") // stale ambient state after migration + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n shared-server: false\n"), 0o600)) + root := filepath.Join(sharedDir, "dolt") + require.NoError(t, os.MkdirAll(filepath.Join(root, ".dolt"), 0o755)) + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: root})) + require.NoError(t, runMigrateToProxiedServer(false, 0, true)) +} + +func TestMigrateToProxiedServer_AlreadyProxiedAllowsUnlockedLockMarkers(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + root := filepath.Join(beadsDir, "dolt") + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: root})) + for _, name := range []string{proxy.LockFileName, server.LockFileName} { + touchFile(t, filepath.Join(root, name)) + } + require.NoError(t, runMigrateToProxiedServer(false, 0, false)) +} + +func TestMigrateToProxiedServer_AlreadyProxiedRefusalsAreTyped(t *testing.T) { + cases := []struct { + name string + info *configfile.ProxiedServerClientInfo + control string + }{ + {name: "external sidecar", info: &configfile.ProxiedServerClientInfo{RootPath: "/tmp/external", External: &configfile.ExternalDoltConfig{Host: "db.example", Port: 3307}}}, + {name: "mismatched sidecar", info: &configfile.ProxiedServerClientInfo{RootPath: "/tmp/other"}}, + {name: "stale control", control: proxy.LogFileName}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + root := filepath.Join(beadsDir, "dolt") + if tc.info == nil { + tc.info = &configfile.ProxiedServerClientInfo{RootPath: root} + } + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, tc.info)) + if tc.control != "" { + touchFile(t, filepath.Join(root, tc.control)) + } + oldJSON := jsonOutput + jsonOutput = true + t.Cleanup(func() { jsonOutput = oldJSON }) + out, err := captureMigrationJSON(t, func() error { return runMigrateToProxiedServer(false, 0, false) }) + code, ok := exitCodeFromError(err) + assert.True(t, ok) + assert.Equal(t, 1, code) + var got map[string]any + require.NoError(t, json.Unmarshal([]byte(out), &got), "output=%q", out) + assert.Equal(t, "proxy.migrate.invalid_state", got["code"]) + assert.Equal(t, false, got["mutates"]) + }) + } +} + +func TestMigrateToProxiedServer_AlreadyProxiedRefusesHeldLockAsTyped(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + root := filepath.Join(beadsDir, "dolt") + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: root})) + held, err := util.TryLock(filepath.Join(root, proxy.LockFileName)) + require.NoError(t, err) + defer held.Unlock() + oldJSON := jsonOutput + jsonOutput = true + t.Cleanup(func() { jsonOutput = oldJSON }) + out, err := captureMigrationJSON(t, func() error { return runMigrateToProxiedServer(false, 0, false) }) + code, ok := exitCodeFromError(err) + assert.True(t, ok) + assert.Equal(t, 1, code) + var got map[string]any + require.NoError(t, json.Unmarshal([]byte(out), &got)) + assert.Equal(t, "proxy.migrate.invalid_state", got["code"]) + assert.Equal(t, false, got["mutates"]) +} + +func TestMigrateToProxiedServer_RetryAfterCheckpointFault(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + t.Setenv("BEADS_MIGRATION_FAIL_PHASE", string(migrateTargetConfigured)) + require.Error(t, runMigrateToProxiedServer(false, 0, false)) + j, err := loadMigrateJournal(beadsDir) + require.NoError(t, err) + require.NotNil(t, j) + assert.Equal(t, migrateTargetConfigured, j.Phase) + t.Setenv("BEADS_MIGRATION_FAIL_PHASE", "") + require.NoError(t, runMigrateToProxiedServer(false, 0, false)) + j, err = loadMigrateJournal(beadsDir) + assert.NoError(t, err) + assert.Nil(t, j, "successful migration removes its journal") +} + +// TestMigrateToProxiedServer_ResumeReplaysRecordedIdleTimeout covers the resume +// case every other fault-retry test misses: the retry replays identical argv, so +// the sidecar is only ever rebuilt in its trivially-consistent form. A resume +// that changes --idle-timeout (or omits it, which resolves differently again) +// must replay the journal's recorded plan. Rebuilding the sidecar from the +// current argv persists the divergence before the equality check detects it, and +// because the rebuild is gated on phase == migratePrepared, re-supplying the +// original value cannot repair it afterwards. +func TestMigrateToProxiedServer_ResumeReplaysRecordedIdleTimeout(t *testing.T) { + for _, tc := range []struct { + name string + resume time.Duration + }{ + {name: "changed", resume: 5 * time.Minute}, + {name: "omitted", resume: 0}, + {name: "never", resume: proxy.IdleTimeoutNever}, + } { + t.Run(tc.name, func(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + recorded := 90 * time.Second + + t.Setenv("BEADS_MIGRATION_FAIL_PHASE", string(migratePrepared)) + require.Error(t, runMigrateToProxiedServer(false, recorded, false)) + j, err := loadMigrateJournal(beadsDir) + require.NoError(t, err) + require.NotNil(t, j) + require.Equal(t, migratePrepared, j.Phase) + require.NotNil(t, j.Sidecar) + require.Equal(t, recorded, j.Sidecar.IdleTimeout) + + t.Setenv("BEADS_MIGRATION_FAIL_PHASE", "") + require.NoError(t, runMigrateToProxiedServer(false, tc.resume, false)) + + j, err = loadMigrateJournal(beadsDir) + require.NoError(t, err) + assert.Nil(t, j, "successful migration removes its journal") + info, err := configfile.LoadProxiedServerClientInfo(beadsDir) + require.NoError(t, err) + require.NotNil(t, info) + assert.Equal(t, recorded, info.IdleTimeout, "sidecar must hold the recorded plan, not the resume argv") + + // The reverse migration is the documented escape hatch; it compares + // the same two values, so it must also accept the resumed state. + require.NoError(t, runMigrateFromProxiedServer(false, false)) + }) + } +} + +func TestMigrateJournal_UnknownPhaseFailsClosed(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + path := migrateJournalPath(beadsDir) + require.NoError(t, os.WriteFile(path, []byte(`{"version":1,"source_mode":"server","target_mode":"proxied-server","phase":"surprise","attempt":1}`), 0o600)) + _, err := loadMigrateJournal(beadsDir) + require.Error(t, err) +} + +func TestMigrateToProxiedServer_AllCheckpointFaultsRetry(t *testing.T) { + for _, phase := range []migratePhase{migratePrepared, migrateTargetConfigured, migrateOldControlsRetired, migrateVerified, migrateCommitted} { + t.Run(string(phase), func(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + t.Setenv("BEADS_MIGRATION_FAIL_PHASE", string(phase)) + require.Error(t, runMigrateToProxiedServer(false, 0, false)) + j, err := loadMigrateJournal(beadsDir) + require.NoError(t, err) + require.NotNil(t, j) + assert.Equal(t, phase, j.Phase) + assert.Equal(t, 1, j.Attempt) + t.Setenv("BEADS_MIGRATION_FAIL_PHASE", "") + require.NoError(t, runMigrateToProxiedServer(false, 0, false)) + after := snapshotMigrationTree(t, beadsDir) + j, err = loadMigrateJournal(beadsDir) + require.NoError(t, err) + assert.Nil(t, j) + require.NoError(t, runMigrateToProxiedServer(false, 0, false)) + assert.Equal(t, after, snapshotMigrationTree(t, beadsDir)) + }) + } +} + +func TestMigrateFromProxiedServer_MalformedSidecarFailsClosed(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + require.NoError(t, os.WriteFile(configfile.ProxiedServerClientInfoPath(beadsDir), []byte("{bad"), 0o600)) + require.Error(t, runMigrateFromProxiedServer(false, false)) + data, err := os.ReadFile(configfile.ConfigPath(beadsDir)) + require.NoError(t, err) + assert.Contains(t, string(data), configfile.DoltModeProxiedServer) +} + +func TestMigrateFromProxiedServer_AlreadyServerRejectsMalformedSidecar(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + path := configfile.ProxiedServerClientInfoPath(beadsDir) + require.NoError(t, os.WriteFile(path, []byte("{bad"), 0o600)) + before := snapshotMigrationTree(t, beadsDir) + var err error + stderr := captureStderr(t, func() { err = runMigrateFromProxiedServer(false, false) }) + require.Error(t, err) + assert.Contains(t, strings.ToLower(stderr), "sidecar") + assert.Equal(t, before, snapshotMigrationTree(t, beadsDir)) +} + +func TestMigrateFromProxiedServer_AlreadyTargetRejectsStaleSidecar(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: filepath.Join(beadsDir, "dolt")})) + before := snapshotMigrationTree(t, beadsDir) + var err error + stderr := captureStderr(t, func() { err = runMigrateFromProxiedServer(false, false) }) + require.Error(t, err) + assert.Contains(t, strings.ToLower(stderr), "stale") + assert.Equal(t, before, snapshotMigrationTree(t, beadsDir)) +} + +func TestMigrateFromProxiedToSharedServer_AlreadyTargetRejectsStaleSidecar(t *testing.T) { + sharedDir := t.TempDir() + t.Setenv("BEADS_SHARED_SERVER_DIR", sharedDir) + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n shared-server: true\n"), 0o600)) + root := filepath.Join(sharedDir, "dolt") + require.NoError(t, os.MkdirAll(filepath.Join(root, ".dolt"), 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(root, ".dolt", "repo_state.json"), []byte(`{"head":"refs/heads/main","remotes":{},"backups":{},"branches":{}}`), 0o600)) + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: root})) + before := snapshotMigrationTree(t, beadsDir, root) + var err error + stderr := captureStderr(t, func() { err = runMigrateFromProxiedServer(false, true) }) + require.Error(t, err) + assert.Contains(t, strings.ToLower(stderr), "stale") + assert.Equal(t, before, snapshotMigrationTree(t, beadsDir, root)) +} + +func TestMigrateFromProxiedServer_JournalPreservesExternalSidecar(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + root := filepath.Join(beadsDir, "dolt") + ext := &configfile.ExternalDoltConfig{Host: "db.example", Port: 3307, User: "alice"} + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: root, External: ext})) + require.NoError(t, os.MkdirAll(filepath.Join(root, ".dolt"), 0o755)) + require.Error(t, runMigrateFromProxiedServer(false, false), "external endpoint cannot be converted to local server") + got, err := configfile.LoadProxiedServerClientInfo(beadsDir) + require.NoError(t, err) + assert.Equal(t, ext, got.External) + cfg, err := configfile.Load(beadsDir) + require.NoError(t, err) + assert.True(t, cfg.IsDoltProxiedServerMode()) +} + +func TestMigrateFromProxiedServer_AllCheckpointFaultsRetry(t *testing.T) { + for _, phase := range []migratePhase{migratePrepared, migrateTargetConfigured, migrateOldControlsRetired, migrateVerified, migrateCommitted} { + t.Run(string(phase), func(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + root := filepath.Join(beadsDir, "dolt") + require.NoError(t, os.MkdirAll(filepath.Join(root, ".dolt"), 0o755)) + sentinel := filepath.Join(root, "migration-sentinel") + touchFile(t, sentinel) + sentinelBefore, err := os.ReadFile(sentinel) + require.NoError(t, err) + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, &configfile.ProxiedServerClientInfo{RootPath: root})) + t.Setenv("BEADS_MIGRATION_FAIL_PHASE", string(phase)) + require.Error(t, runMigrateFromProxiedServer(false, false)) + t.Setenv("BEADS_MIGRATION_FAIL_PHASE", "") + require.NoError(t, runMigrateFromProxiedServer(false, false)) + after := snapshotMigrationTree(t, beadsDir) + assert.Equal(t, sentinelBefore, mustReadFile(t, sentinel), "migration sentinel changed") + j, err := loadMigrateJournal(beadsDir) + require.NoError(t, err) + assert.Nil(t, j) + require.NoError(t, runMigrateFromProxiedServer(false, false)) + assert.Equal(t, after, snapshotMigrationTree(t, beadsDir)) + }) + } +} + +func TestMigrateFromProxiedServer_ExternalJournalAlwaysFailsClosed(t *testing.T) { + for _, phase := range []migratePhase{migratePrepared, migrateTargetConfigured, migrateOldControlsRetired, migrateVerified, migrateCommitted} { + t.Run(string(phase), func(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + root := filepath.Join(beadsDir, "dolt") + require.NoError(t, os.MkdirAll(root, 0o755)) + if phase != migratePrepared { + writeMetadataConfig(t, beadsDir, configfile.DoltModeServer, "myproj") + } + wantMode := configfile.DoltModeServer + if phase == migratePrepared { + wantMode = configfile.DoltModeProxiedServer + } + ext := &configfile.ExternalDoltConfig{Host: "db.example", Port: 3307} + j := migrateJournal{Version: 1, SourceMode: configfile.DoltModeProxiedServer, TargetMode: configfile.DoltModeServer, RootPath: root, External: ext, Ownership: "external", Attempt: 1, Phase: phase, Sidecar: &configfile.ProxiedServerClientInfo{RootPath: root, External: ext}} + b, err := json.Marshal(j) + require.NoError(t, err) + require.NoError(t, os.WriteFile(migrateJournalPath(beadsDir), b, 0o600)) + require.Error(t, runMigrateFromProxiedServer(false, false)) + cfg, err := configfile.Load(beadsDir) + require.NoError(t, err) + assert.Equal(t, wantMode, cfg.GetDoltMode()) + }) + } +} + +func TestMigrateExternalJournalAlwaysFailsClosed_TCPAndUnixForwardReverse(t *testing.T) { + endpoints := []struct { + name string + cfg *configfile.ExternalDoltConfig + }{ + {"tcp", &configfile.ExternalDoltConfig{Host: "db.example", Port: 3307}}, + {"unix", &configfile.ExternalDoltConfig{Socket: "/tmp/beads-dolt.sock"}}, + } + for _, ep := range endpoints { + for _, reverse := range []bool{false, true} { + for _, phase := range []migratePhase{migratePrepared, migrateTargetConfigured, migrateOldControlsRetired, migrateVerified, migrateCommitted} { + t.Run(ep.name+"/"+string(phase), func(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + root := filepath.Join(beadsDir, "dolt") + want := configfile.DoltModeServer + src := configfile.DoltModeServer + target := configfile.DoltModeProxiedServer + if reverse { + src, target = configfile.DoltModeProxiedServer, configfile.DoltModeServer + want = configfile.DoltModeProxiedServer + } + // A prepared journal may legitimately coexist with either + // source or target metadata. Later phases require target + // metadata so validation reaches the ownership refusal. + metadataMode := src + if phase != migratePrepared { + metadataMode = target + } + want = metadataMode + writeMetadataConfig(t, beadsDir, metadataMode, "myproj") + j := migrateJournal{Version: 1, SourceMode: src, TargetMode: target, RootPath: root, External: ep.cfg, Ownership: "external", Attempt: 1, Phase: phase, Sidecar: &configfile.ProxiedServerClientInfo{RootPath: root, External: ep.cfg}} + b, err := json.Marshal(j) + require.NoError(t, err) + require.NoError(t, os.WriteFile(migrateJournalPath(beadsDir), b, 0o600)) + treeBefore := snapshotMigrationTree(t, beadsDir, root) + before, _ := os.ReadFile(configfile.ConfigPath(beadsDir)) + var migrateErr error + stderr := captureStderr(t, func() { + if reverse { + migrateErr = runMigrateFromProxiedServer(false, false) + } else { + migrateErr = runMigrateToProxiedServer(false, 0, false) + } + }) + require.Error(t, migrateErr) + assert.Contains(t, strings.ToLower(stderr), "externally hosted proxied dolt endpoint") + after, _ := os.ReadFile(configfile.ConfigPath(beadsDir)) + assert.Equal(t, before, after) + cfg, _ := configfile.Load(beadsDir) + assert.Equal(t, want, cfg.GetDoltMode()) + assert.Equal(t, treeBefore, snapshotMigrationTree(t, beadsDir, root)) + }) + } + } + } +} + +func TestMigrateSharedJournalRootMismatchFailsClosed(t *testing.T) { + shared := t.TempDir() + t.Setenv("BEADS_SHARED_SERVER_DIR", shared) + t.Setenv("BEADS_DOLT_SHARED_SERVER", "1") + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n shared-server: true\n"), 0o600)) + root := filepath.Join(beadsDir, "dolt") + j := migrateJournal{Version: 1, SourceMode: configfile.DoltModeServer, TargetMode: configfile.DoltModeProxiedServer, Shared: true, RootPath: root, Ownership: "managed-local", Attempt: 1, Phase: migratePrepared, Sidecar: &configfile.ProxiedServerClientInfo{RootPath: root}} + b, err := json.Marshal(j) + require.NoError(t, err) + require.NoError(t, os.WriteFile(migrateJournalPath(beadsDir), b, 0o600)) + require.Error(t, runMigrateToProxiedServer(false, 0, true)) + cfg, err := configfile.Load(beadsDir) + require.NoError(t, err) + assert.True(t, cfg.IsDoltServerMode()) +} + +func TestMigrateSharedJournalMissingYAMLFailsClosed(t *testing.T) { + shared := t.TempDir() + t.Setenv("BEADS_SHARED_SERVER_DIR", shared) + t.Setenv("BEADS_DOLT_SHARED_SERVER", "1") + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + root := filepath.Join(shared, "dolt") + require.NoError(t, os.MkdirAll(filepath.Join(root, ".dolt"), 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(root, ".dolt", "repo_state.json"), []byte(`{"head":"refs/heads/main","remotes":{},"backups":{},"branches":{}}`), 0o600)) + j := migrateJournal{Version: 1, SourceMode: configfile.DoltModeServer, TargetMode: configfile.DoltModeProxiedServer, Shared: true, RootPath: root, Ownership: "managed-local", Attempt: 1, Phase: migratePrepared, Sidecar: &configfile.ProxiedServerClientInfo{RootPath: root}} + b, _ := json.Marshal(j) + require.NoError(t, os.WriteFile(migrateJournalPath(beadsDir), b, 0o600)) + require.Error(t, runMigrateToProxiedServer(false, 0, true)) +} + +func TestMigrateNonSharedJournalRejectsPersistedSharedYAML(t *testing.T) { + t.Setenv("BEADS_DOLT_SHARED_SERVER", "1") // stale ambient environment + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + require.NoError(t, os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n shared-server: true\n"), 0o600)) + root := filepath.Join(beadsDir, "dolt") + j := migrateJournal{Version: 1, SourceMode: configfile.DoltModeServer, TargetMode: configfile.DoltModeProxiedServer, RootPath: root, Ownership: "managed-local", Attempt: 1, Phase: migrateTargetConfigured, Sidecar: &configfile.ProxiedServerClientInfo{RootPath: root}} + b, err := json.Marshal(j) + require.NoError(t, err) + require.NoError(t, os.WriteFile(migrateJournalPath(beadsDir), b, 0o600)) + err = runMigrateToProxiedServer(false, 0, false) + require.Error(t, err) +} + +func TestMigrateJournalSidecarRootMismatchFailsClosed(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + j := migrateJournal{Version: 1, SourceMode: configfile.DoltModeServer, TargetMode: configfile.DoltModeProxiedServer, RootPath: filepath.Join(beadsDir, "dolt"), Ownership: "managed-local", Attempt: 1, Phase: migratePrepared, Sidecar: &configfile.ProxiedServerClientInfo{RootPath: filepath.Join(beadsDir, "other")}} + b, err := json.Marshal(j) + require.NoError(t, err) + require.NoError(t, os.WriteFile(migrateJournalPath(beadsDir), b, 0o600)) + _, err = loadMigrateJournal(beadsDir) + require.Error(t, err) +} + +func TestMigrateJournalExternalTopologyMismatchFailsClosed(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + root := filepath.Join(beadsDir, "dolt") + ext := &configfile.ExternalDoltConfig{Host: "db.example", Port: 3307} + for _, tc := range []struct { + name string + ownership string + journal *configfile.ExternalDoltConfig + sidecar *configfile.ExternalDoltConfig + }{ + {name: "journal external differs", ownership: "external", journal: &configfile.ExternalDoltConfig{Host: "other.example", Port: 3307}, sidecar: ext}, + {name: "journal unexpected external", ownership: "managed-local", journal: ext, sidecar: nil}, + } { + t.Run(tc.name, func(t *testing.T) { + j := migrateJournal{Version: 1, SourceMode: configfile.DoltModeProxiedServer, TargetMode: configfile.DoltModeServer, RootPath: root, Ownership: tc.ownership, Attempt: 1, Phase: migratePrepared, External: tc.journal, Sidecar: &configfile.ProxiedServerClientInfo{RootPath: root, External: tc.sidecar}} + b, err := json.Marshal(j) + require.NoError(t, err) + require.NoError(t, os.WriteFile(migrateJournalPath(beadsDir), b, 0o600)) + _, err = loadMigrateJournal(beadsDir) + require.Error(t, err) + }) + } +} + +func TestMigrateJournalLegacyExternalFieldInfersSidecar(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + root := filepath.Join(beadsDir, "dolt") + ext := &configfile.ExternalDoltConfig{Host: "db.example", Port: 3307} + j := migrateJournal{Version: 1, SourceMode: configfile.DoltModeProxiedServer, TargetMode: configfile.DoltModeServer, RootPath: root, Ownership: "external", Attempt: 1, Phase: migratePrepared, Sidecar: &configfile.ProxiedServerClientInfo{RootPath: root, External: ext}} + b, err := json.Marshal(j) + require.NoError(t, err) + require.NoError(t, os.WriteFile(migrateJournalPath(beadsDir), b, 0o600)) + got, err := loadMigrateJournal(beadsDir) + require.NoError(t, err) + require.NotNil(t, got) + assert.Equal(t, ext, got.External) +} + +func TestMigrateFromProxiedServer_JournalSidecarChangedFailsClosed(t *testing.T) { + beadsDir := migrateModeWorkspace(t, configfile.DoltModeProxiedServer) + root := filepath.Join(beadsDir, "dolt") + require.NoError(t, os.MkdirAll(filepath.Join(root, ".dolt"), 0o755)) + wantSidecar := &configfile.ProxiedServerClientInfo{RootPath: root, LogPath: filepath.Join(root, "server.log")} + gotSidecar := &configfile.ProxiedServerClientInfo{RootPath: root, LogPath: filepath.Join(root, "changed.log")} + require.NoError(t, configfile.SaveProxiedServerClientInfo(beadsDir, gotSidecar)) + j := migrateJournal{Version: 1, SourceMode: configfile.DoltModeProxiedServer, TargetMode: configfile.DoltModeServer, RootPath: root, Ownership: "managed-local", Attempt: 1, Phase: migratePrepared, Sidecar: wantSidecar} + b, err := json.Marshal(j) + require.NoError(t, err) + journalPath := migrateJournalPath(beadsDir) + require.NoError(t, os.WriteFile(journalPath, b, 0o600)) + before := snapshotMigrationTree(t, beadsDir, root) + var migrateErr error + captureStderr(t, func() { migrateErr = runMigrateFromProxiedServer(false, false) }) + require.Error(t, migrateErr) + assert.Equal(t, before, snapshotMigrationTree(t, beadsDir, root)) +} + +// TestMigrateFromProxiedServer_ForwardJournalAtPreparedIsNotSidecarRefused is +// the complement of the test above, and the reason its guard is scoped to +// reverse journals. +// +// The two directions mean different things by a migratePrepared journal that +// names a sidecar. A reverse journal names one that is already on disk, so a +// mismatch is real corruption -- that is the case above. A forward journal +// names the sidecar it is about to write, and only advances past +// migratePrepared once the write lands, so a crash in that pre-write window +// leaves no sidecar on disk at all. That is the correct state for the phase, +// not a mismatch. +// +// This command is the documented escape hatch out of exactly that wreck: the +// non-proxied-mode refusal is gated on j == nil, so a leftover journal is what +// lets the operator run it with the live mode still on "server". An unscoped +// sidecar check refuses here by naming a missing file, which strands the +// workspace with no way forward and no way back. +func TestMigrateFromProxiedServer_ForwardJournalAtPreparedIsNotSidecarRefused(t *testing.T) { + // Live mode is still the forward migration's source: it flips only after + // the sidecar is written, so a crash before that leaves it untouched. + beadsDir := migrateModeWorkspace(t, configfile.DoltModeServer) + root := filepath.Join(beadsDir, "dolt") + j := migrateJournal{Version: 1, SourceMode: configfile.DoltModeServer, TargetMode: configfile.DoltModeProxiedServer, RootPath: root, Ownership: "managed-local", Attempt: 1, Phase: migratePrepared, Sidecar: &configfile.ProxiedServerClientInfo{RootPath: root}} + b, err := json.Marshal(j) + require.NoError(t, err) + require.NoError(t, os.WriteFile(migrateJournalPath(beadsDir), b, 0o600)) + + // Precondition: no sidecar on disk, which is what the guard would have + // compared against the journal's. + _, statErr := os.Stat(configfile.ProxiedServerClientInfoPath(beadsDir)) + require.True(t, os.IsNotExist(statErr), "precondition: sidecar must be absent, got %v", statErr) + + var migrateErr error + stderr := captureStderr(t, func() { migrateErr = runMigrateFromProxiedServer(false, false) }) + + // Deliberately not asserting success: what this command does next with a + // forward journal is its own behavior and has its own coverage. The pin is + // only that it does not stop at the sidecar comparison, whose message + // would be a lie about the workspace. + if migrateErr != nil { + assert.NotContains(t, stderr, "migration sidecar does not match prepared state") + assert.NotContains(t, migrateErr.Error(), "migration sidecar does not match prepared state") + } +} diff --git a/cmd/bd/migration_freeze_gate_test.go b/cmd/bd/migration_freeze_gate_test.go index 9b6e3c362..fa209ad6a 100644 --- a/cmd/bd/migration_freeze_gate_test.go +++ b/cmd/bd/migration_freeze_gate_test.go @@ -1,6 +1,7 @@ -// Tests for the MIGRATION-FREEZE write gate (dc-6jaq): bd write commands must -// refuse to run while a MIGRATION-FREEZE sentinel sits at the town root, the -// same gate the gt CLI already applies to gt mail send/nudge/sling/assign. +// Tests for the migration freeze write gate (dc-6jaq): bd write commands must +// refuse to run, with exit code ExitMigrationFrozen, while a MIGRATION-FREEZE +// marker sits in the working directory or any ancestor of it — or at the path +// named by BD_MIGRATION_FREEZE_FILE, which is authoritative when set. // // This file MUST NOT carry a cgo build tag: it exercises the default sqlite // backend via a bd binary built with the gms_pure_go tag (mirrors @@ -10,24 +11,55 @@ package main import ( "bytes" + "context" "encoding/json" "errors" "os" "os/exec" "path/filepath" + "runtime" "strings" "testing" + + "github.com/steveyegge/beads/internal/migration" ) +// vendorNeutralBans are substrings the refusal must never print. The gate used +// to key on a gastown town root and tell users to run `gt migrate thaw`, a CLI +// that does not ship with bd; nothing about the OSS binary's write refusal may +// name another vendor's product again. +var vendorNeutralBans = []string{"gt ", "gt migrate", "thaw", "town", "mayor", "GT_"} + +func assertVendorNeutral(t *testing.T, stderr string) { + t.Helper() + for _, banned := range vendorNeutralBans { + if strings.Contains(stderr, banned) { + t.Errorf("refusal contains vendor-coupled substring %q:\n%s", banned, stderr) + } + } +} + // migrationFreezeEnv returns a hermetic environment for bd subprocess runs: -// no inherited BEADS_* variables, HOME pinned to the test dir, metrics and +// no inherited BEADS_*/GT_* variables, HOME pinned to the test dir, metrics and // daemons disabled. +// +// The freeze override is pinned to a path that cannot exist, not merely +// stripped. Because the gate walks every ancestor to the filesystem root, a +// stray MIGRATION-FREEZE anywhere above TMPDIR would otherwise fail these +// tests at `bd init` — and the pin is authoritative, so it also holds the walk +// off while a test is setting its workspace up. Tests that actually exercise +// the walk layer freezeWalkEnv on top. (TestMain pins the same variable for +// the whole package, since the walk makes every write-subprocess suite here +// equally sensitive to an ambient marker; this is the belt to that's braces.) func migrationFreezeEnv(dir string) []string { var env []string for _, e := range os.Environ() { if strings.HasPrefix(e, "BEADS_") || strings.HasPrefix(e, "GT_") { continue } + if strings.HasPrefix(e, migration.EnvFreezeFile+"=") { + continue + } env = append(env, e) } return append(env, @@ -38,9 +70,22 @@ func migrationFreezeEnv(dir string) []string { "BD_DISABLE_EVENT_FLUSH=1", "BEADS_NO_DAEMON=1", "BEADS_DOLT_AUTO_START=0", + migration.EnvFreezeFile+"="+filepath.Join(dir, "no-such-freeze-marker"), ) } +// freezeWalkEnv clears the override so the subprocess uses the ancestor walk. +func freezeWalkEnv() []string { + return []string{migration.EnvFreezeFile + "="} +} + +// runBDFrozen runs bd with the ancestor walk enabled — the mode every +// marker-on-disk test needs. +func runBDFrozen(t *testing.T, bd, dir string, args ...string) (stdout, stderr string, exitCode int) { + t.Helper() + return runBDMigrationFreezeWithEnv(t, bd, dir, freezeWalkEnv(), args...) +} + // runBDMigrationFreeze runs the bd binary and returns stdout, stderr, and the // exit code. Only a failure to launch the process fails the test; nonzero // exits are returned to the caller for assertion. @@ -70,62 +115,65 @@ func runBDMigrationFreezeWithEnv(t *testing.T, bd, dir string, extraEnv []string return outBuf.String(), errBuf.String(), 0 } -// setupMigrationFreezeWorkspace builds bd and initializes a fresh sqlite- -// backed database in a temp dir that also carries mayor/town.json, so the -// same directory doubles as a bd workspace and a fake town root — findTownRoot -// finds it at walk-up distance 0. -func setupMigrationFreezeWorkspace(t *testing.T) (bd, dir string) { +// setupMigrationFreezeWorkspaceIn builds bd and initializes a fresh sqlite- +// backed database in dir. The workspace needs nothing but itself: the gate +// keys on the freeze marker file, not on any orchestrator structure around it. +func setupMigrationFreezeWorkspaceIn(t *testing.T, dir string) (bd string) { t.Helper() bd = buildBDForInitTests(t) - dir = t.TempDir() runGitForBootstrapTest(t, dir, "init", "-q") runGitForBootstrapTest(t, dir, "config", "core.hooksPath", ".git/hooks") - if err := os.MkdirAll(filepath.Join(dir, "mayor"), 0755); err != nil { - t.Fatalf("creating mayor dir: %v", err) - } - if err := os.WriteFile(filepath.Join(dir, "mayor", "town.json"), []byte("{}"), 0644); err != nil { - t.Fatalf("writing mayor/town.json: %v", err) - } - stdout, stderr, code := runBDMigrationFreeze(t, bd, dir, "init", "--prefix", "test", "--quiet", "--non-interactive", "--skip-hooks", "--skip-agents") if code != 0 { t.Fatalf("bd init failed (exit %d):\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) } - return bd, dir + return bd } -// freezeTown writes a MIGRATION-FREEZE sentinel at dir (the fake town root). -func freezeTown(t *testing.T, dir, operator, reason string) { +func setupMigrationFreezeWorkspace(t *testing.T) (bd, dir string) { t.Helper() + dir = t.TempDir() + return setupMigrationFreezeWorkspaceIn(t, dir), dir +} + +// writeFreezeMarker writes a MIGRATION-FREEZE marker in dir and returns its path. +func writeFreezeMarker(t *testing.T, dir, operator, reason string) string { + t.Helper() + path := filepath.Join(dir, migration.FileName) content := operator + "\t2026-08-16T12:00:00Z\t" + reason + "\n" - if err := os.WriteFile(filepath.Join(dir, "MIGRATION-FREEZE"), []byte(content), 0644); err != nil { - t.Fatalf("writing MIGRATION-FREEZE: %v", err) + if err := os.WriteFile(path, []byte(content), 0644); err != nil { + t.Fatalf("writing %s: %v", path, err) } + return path } func TestCreateBlockedDuringMigrationFreeze(t *testing.T) { bd, dir := setupMigrationFreezeWorkspace(t) - freezeTown(t, dir, "mayor", "dolt v2 migration") + writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") - stdout, stderr, code := runBDMigrationFreeze(t, bd, dir, "create", "should not be created", "-p", "2") + stdout, stderr, code := runBDFrozen(t, bd, dir, "create", "should not be created", "-p", "2") - if code != 1 { - t.Fatalf("exit code = %d, want 1\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d\nstdout:\n%s\nstderr:\n%s", code, ExitMigrationFrozen, stdout, stderr) } - if !strings.Contains(stderr, "frozen for migration") { - t.Errorf("stderr missing 'frozen for migration':\n%s", stderr) - } - if !strings.Contains(stderr, "mayor") { - t.Errorf("stderr missing operator 'mayor':\n%s", stderr) - } - if !strings.Contains(stderr, "dolt v2 migration") { - t.Errorf("stderr missing reason 'dolt v2 migration':\n%s", stderr) - } - if !strings.Contains(stderr, "gt migrate thaw") { - t.Errorf("stderr missing recovery hint 'gt migrate thaw':\n%s", stderr) + for _, want := range []string{ + "workspace is frozen for migration", + "migrator", + "dolt v2 migration", + // The marker's real path, not just its name: that is what makes + // "remove that file" actionable. Matched from the workspace + // directory's own name down, so a symlinked temp root (macOS + // /var → /private/var) doesn't fail the assertion. + filepath.Join(filepath.Base(dir), migration.FileName), + "To resume writes, remove that file", + } { + if !strings.Contains(stderr, want) { + t.Errorf("stderr missing %q:\n%s", want, stderr) + } } + assertVendorNeutral(t, stderr) if strings.TrimSpace(stdout) != "" { t.Errorf("stdout should be empty when blocked, got:\n%s", stdout) } @@ -146,26 +194,222 @@ func TestUpdateBlockedDuringMigrationFreeze(t *testing.T) { t.Fatalf("parsing create --json output: %v\n%s", err, stdout) } - freezeTown(t, dir, "athos", "server migration in progress") + writeFreezeMarker(t, dir, "athos", "server migration in progress") - stdout, stderr, code = runBDMigrationFreeze(t, bd, dir, "update", issue.ID, "-p", "1") - if code != 1 { - t.Fatalf("exit code = %d, want 1\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) + stdout, stderr, code = runBDFrozen(t, bd, dir, "update", issue.ID, "-p", "1") + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d\nstdout:\n%s\nstderr:\n%s", code, ExitMigrationFrozen, stdout, stderr) } - if !strings.Contains(stderr, "frozen for migration") { - t.Errorf("stderr missing 'frozen for migration':\n%s", stderr) + if !strings.Contains(stderr, "workspace is frozen for migration") { + t.Errorf("stderr missing 'workspace is frozen for migration':\n%s", stderr) + } +} + +// TestWriteBlockedByAncestorFreezeMarker is the vendor-neutrality change made +// observable: the marker sits in the workspace's PARENT, with no orchestrator +// structure anywhere, and still freezes writes. That is exactly the shape of a +// marker written above a set of sibling repos. +func TestWriteBlockedByAncestorFreezeMarker(t *testing.T) { + root := t.TempDir() + work := filepath.Join(root, "repo") + if err := os.MkdirAll(work, 0755); err != nil { + t.Fatalf("creating %s: %v", work, err) + } + bd := setupMigrationFreezeWorkspaceIn(t, work) + writeFreezeMarker(t, root, "migrator", "tree-wide migration") + + stdout, stderr, code := runBDFrozen(t, bd, work, "create", "should not be created", "-p", "2") + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d (marker one level above the workspace)\nstdout:\n%s\nstderr:\n%s", + code, ExitMigrationFrozen, stdout, stderr) + } + if !strings.Contains(stderr, "workspace is frozen for migration") { + t.Errorf("stderr missing 'workspace is frozen for migration':\n%s", stderr) + } + assertVendorNeutral(t, stderr) +} + +// TestMigrationFreezeFileEnvOverride pins both directions of +// BD_MIGRATION_FREEZE_FILE: set to an existing file it freezes a workspace +// with no marker anywhere above it, and set to a missing path it does NOT +// freeze even with a marker right there — that second half is what makes the +// variable a usable opt-out. +func TestMigrationFreezeFileEnvOverride(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + elsewhere := t.TempDir() + override := filepath.Join(elsewhere, "freeze-marker") + if err := os.WriteFile(override, []byte("migrator\t2026-08-16T12:00:00Z\tout-of-tree freeze\n"), 0644); err != nil { + t.Fatalf("writing override marker: %v", err) + } + + t.Run("existing override file blocks with no marker in the tree", func(t *testing.T) { + stdout, stderr, code := runBDMigrationFreezeWithEnv(t, bd, dir, + []string{migration.EnvFreezeFile + "=" + override}, + "create", "should not be created", "-p", "2") + + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d\nstdout:\n%s\nstderr:\n%s", code, ExitMigrationFrozen, stdout, stderr) + } + for _, want := range []string{ + "workspace is frozen for migration", + "out-of-tree freeze", + override, + "or unset " + migration.EnvFreezeFile, + } { + if !strings.Contains(stderr, want) { + t.Errorf("stderr missing %q:\n%s", want, stderr) + } + } + assertVendorNeutral(t, stderr) + }) + + t.Run("missing override file wins over a marker in the workspace", func(t *testing.T) { + writeFreezeMarker(t, dir, "migrator", "should be ignored") + t.Cleanup(func() { _ = os.Remove(filepath.Join(dir, migration.FileName)) }) + + stdout, stderr, code := runBDMigrationFreezeWithEnv(t, bd, dir, + []string{migration.EnvFreezeFile + "=" + filepath.Join(elsewhere, "no-such-marker")}, + "create", "normal issue", "-p", "2", "--json") + + if code != 0 { + t.Fatalf("exit code = %d, want 0 — the override must skip the ancestor walk entirely\nstdout:\n%s\nstderr:\n%s", + code, stdout, stderr) + } + }) +} + +// TestFreezeKeysOnTargetWorkspaceNotCwd is the core-contract test: the gate +// must follow the store being written, not the shell the caller happens to be +// sitting in. Both shapes here target a frozen workspace from an unrelated +// working directory, and neither one chdirs — `bd -C` only sets BEADS_DIR. +// Before this, both walked the caller's ancestry, found nothing, and wrote +// straight through the freeze. +func TestFreezeKeysOnTargetWorkspaceNotCwd(t *testing.T) { + frozenRoot := t.TempDir() + work := filepath.Join(frozenRoot, "repo") + if err := os.MkdirAll(work, 0755); err != nil { + t.Fatalf("creating %s: %v", work, err) + } + bd := setupMigrationFreezeWorkspaceIn(t, work) + writeFreezeMarker(t, frozenRoot, "migrator", "cross-tree migration") + + // The caller's cwd is nowhere near the frozen tree. + outside := t.TempDir() + + t.Run("BEADS_DIR", func(t *testing.T) { + stdout, stderr, code := runBDMigrationFreezeWithEnv(t, bd, outside, + append(freezeWalkEnv(), "BEADS_DIR="+filepath.Join(work, ".beads")), + "create", "should not be created", "-p", "2") + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d — BEADS_DIR named a frozen workspace\nstdout:\n%s\nstderr:\n%s", + code, ExitMigrationFrozen, stdout, stderr) + } + if !strings.Contains(stderr, "workspace is frozen for migration") { + t.Errorf("stderr missing the refusal:\n%s", stderr) + } + }) + + t.Run("-C", func(t *testing.T) { + stdout, stderr, code := runBDFrozen(t, bd, outside, + "-C", work, "create", "should not be created", "-p", "2") + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d — -C named a frozen workspace\nstdout:\n%s\nstderr:\n%s", + code, ExitMigrationFrozen, stdout, stderr) + } + if !strings.Contains(stderr, "workspace is frozen for migration") { + t.Errorf("stderr missing the refusal:\n%s", stderr) + } + }) +} + +// TestInitReinitBlockedDuringMigrationFreeze covers the skip-store bypass, the +// sharpest hole of the lot: `init` is in noDbCommands, so PersistentPreRunE +// returns before its freeze gate, and init.go calls neither CheckReadonly nor +// the gate. `bd init --reinit-local` therefore destroyed and recreated the +// very database the marker was protecting — permanently, exit 0, marker never +// consulted. +func TestInitReinitBlockedDuringMigrationFreeze(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + + stdout, stderr, code := runBDMigrationFreeze(t, bd, dir, "create", "issue that must survive", "-p", "2", "--json") + if code != 0 { + t.Fatalf("setup bd create failed (exit %d):\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) + } + var issue struct { + ID string `json:"id"` + } + if err := json.Unmarshal([]byte(stdout), &issue); err != nil || issue.ID == "" { + t.Fatalf("parsing create --json output: %v\n%s", err, stdout) + } + + writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") + + stdout, stderr, code = runBDFrozen(t, bd, dir, + "init", "--prefix", "test", "--reinit-local", "--non-interactive", "--quiet", "--skip-hooks", "--skip-agents") + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d — a destructive reinit must not run during a freeze\nstdout:\n%s\nstderr:\n%s", + code, ExitMigrationFrozen, stdout, stderr) + } + if !strings.Contains(stderr, "workspace is frozen for migration") { + t.Errorf("stderr missing the refusal:\n%s", stderr) + } + assertVendorNeutral(t, stderr) + + // The database must still be there, with its issue in it. + if err := os.Remove(filepath.Join(dir, migration.FileName)); err != nil { + t.Fatalf("removing freeze marker: %v", err) + } + stdout, stderr, code = runBDMigrationFreeze(t, bd, dir, "show", issue.ID, "--json") + if code != 0 { + t.Fatalf("bd show after the refused reinit failed (exit %d) — the data was destroyed anyway:\nstdout:\n%s\nstderr:\n%s", + code, stdout, stderr) + } +} + +// TestFreezeRefusalHasNoUsageDump: the refusal is returned as an error now, so +// cobra renders it — and on a command that sets neither SilenceErrors nor +// SilenceUsage (duplicate, supersede, dep relate/unrelate, backup *, ado sync, +// migrate-personal, batch) that means "Error: exit code 14" plus a full usage +// block after the clean refusal, making it read like a syntax error. Every +// other freeze test uses a silenced command, so nothing else catches this. +func TestFreezeRefusalHasNoUsageDump(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") + + for _, tc := range []struct { + name string + args []string + }{ + {name: "duplicate", args: []string{"duplicate", "test-aaaa", "--of", "test-bbbb"}}, + {name: "relate", args: []string{"dep", "relate", "test-aaaa", "test-bbbb"}}, + } { + t.Run(tc.name, func(t *testing.T) { + stdout, stderr, code := runBDFrozen(t, bd, dir, tc.args...) + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d\nstdout:\n%s\nstderr:\n%s", code, ExitMigrationFrozen, stdout, stderr) + } + if !strings.Contains(stderr, "workspace is frozen for migration") { + t.Fatalf("stderr missing the refusal:\n%s", stderr) + } + if strings.Contains(stderr, "exit code 14") { + t.Errorf("cobra printed the exitError placeholder after the refusal:\n%s", stderr) + } + if strings.Contains(stderr, "Usage:") || strings.Contains(stdout, "Usage:") { + t.Errorf("cobra dumped usage after a clean refusal — it reads as a syntax error:\nstdout:\n%s\nstderr:\n%s", stdout, stderr) + } + }) } } // TestCreateNotBlockedWithoutFreeze is the regression-safety check: normal bd -// usage (no MIGRATION-FREEZE sentinel present, the overwhelming common case) -// must be completely unaffected by this gate. +// usage (no freeze marker present, the overwhelming common case) must be +// completely unaffected by this gate. func TestCreateNotBlockedWithoutFreeze(t *testing.T) { bd, dir := setupMigrationFreezeWorkspace(t) stdout, stderr, code := runBDMigrationFreeze(t, bd, dir, "create", "normal issue", "-p", "2", "--json") if code != 0 { - t.Fatalf("bd create failed (exit %d) with no freeze sentinel present:\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) + t.Fatalf("bd create failed (exit %d) with no freeze marker present:\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) } var issue struct { ID string `json:"id"` @@ -178,6 +422,269 @@ func TestCreateNotBlockedWithoutFreeze(t *testing.T) { } } +// TestWorkspaceUsableAfterMigrationFreezeBlockedWrite is the end-to-end half of the +// defer-skip fix (see TestMigrationFreezeErrorReturnsInsteadOfExiting for the +// direct proof). The root PersistentPreRunE takes the workspace and +// physical-root gates and closes the store before releasing them in a defer; +// the freeze refusal used to os.Exit straight through that defer. A workspace +// must be immediately usable after a blocked write. +func TestWorkspaceUsableAfterMigrationFreezeBlockedWrite(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + marker := writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") + + stdout, stderr, code := runBDFrozen(t, bd, dir, "create", "should not be created", "-p", "2") + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d\nstdout:\n%s\nstderr:\n%s", code, ExitMigrationFrozen, stdout, stderr) + } + + if err := os.Remove(marker); err != nil { + t.Fatalf("removing freeze marker: %v", err) + } + + stdout, stderr, code = runBDMigrationFreeze(t, bd, dir, "create", "post-thaw issue", "-p", "2", "--json") + if code != 0 { + t.Fatalf("bd create after the freeze was lifted failed (exit %d) — the blocked run left the workspace wedged:\nstdout:\n%s\nstderr:\n%s", + code, stdout, stderr) + } +} + +// TestMigrationFreezeErrorReturnsInsteadOfExiting is the direct regression +// test for the defer-skip bug: migrationFreezeError must RETURN its refusal so +// callers that hold live cleanup (the root PersistentPreRunE closes the store +// and releases the workspace gates from a defer; runImport finalizes its +// metrics event) still run it. If the function ever goes back to os.Exit, this +// test binary dies mid-run and the whole package fails — which is the point. +func TestMigrationFreezeErrorReturnsInsteadOfExiting(t *testing.T) { + dir := t.TempDir() + if err := os.WriteFile(filepath.Join(dir, migration.FileName), + []byte("migrator\t2026-08-16T12:00:00Z\tschema move\n"), 0644); err != nil { + t.Fatalf("writing freeze marker: %v", err) + } + t.Chdir(dir) + t.Setenv(migration.EnvFreezeFile, "") // unset: exercise the ancestor walk + + // The shape of the PersistentPreRunE call site: a named return with a + // deferred cleanup that only fires on the error path. + cleanupRan := false + var gateErr error + stderr := captureStderr(t, func() { + gateErr = func() (retErr error) { + defer func() { + if retErr != nil { + cleanupRan = true + } + }() + return migrationFreezeError("create") + }() + }) + + if gateErr == nil { + t.Fatalf("migrationFreezeError returned nil with a freeze marker in the working directory") + } + if !cleanupRan { + t.Errorf("the caller's deferred cleanup did not run — the refusal must be returned, not exited") + } + code, ok := exitCodeFromError(gateErr) + if !ok || code != ExitMigrationFrozen { + t.Errorf("exitCodeFromError = (%d, %v), want (%d, true)", code, ok, ExitMigrationFrozen) + } + assertVendorNeutral(t, stderr) +} + +// TestMigrationFreezeErrorEmptyMarkerNamesNoOperator covers the `touch +// MIGRATION-FREEZE` case: with no operator recorded, the refusal must say +// nothing rather than print an empty "(by )". +func TestMigrationFreezeErrorEmptyMarkerNamesNoOperator(t *testing.T) { + dir := t.TempDir() + if err := os.WriteFile(filepath.Join(dir, migration.FileName), nil, 0644); err != nil { + t.Fatalf("writing empty freeze marker: %v", err) + } + t.Chdir(dir) + t.Setenv(migration.EnvFreezeFile, "") // unset: pins the no-env recovery line + + var gateErr error + stderr := captureStderr(t, func() { gateErr = migrationFreezeError("create") }) + + if gateErr == nil { + t.Fatalf("migrationFreezeError returned nil for an empty-but-present marker — an empty marker is still a freeze") + } + if !strings.Contains(stderr, "workspace is frozen for migration.") { + t.Errorf("stderr missing the operator-less refusal line:\n%s", stderr) + } + if strings.Contains(stderr, "(by ") { + t.Errorf("stderr names an empty operator:\n%s", stderr) + } + if !strings.Contains(stderr, "To resume writes, remove that file.") { + t.Errorf("stderr missing the recovery line:\n%s", stderr) + } + if !strings.Contains(stderr, migration.EnvFreezeFile) { + t.Errorf("a walk-found refusal must still name %s — when the marker sits somewhere the caller cannot write, "+ + "pointing the variable elsewhere is their only recovery:\n%s", migration.EnvFreezeFile, stderr) + } +} + +// TestMigrationFreezeErrorSanitizesMarkerPayload: with the ancestor walk the +// marker can live in a directory bd does not control, so its operator and +// reason are untrusted input on their way to a terminal. A crafted payload +// must not be able to clear the screen or forge extra bd output lines. +func TestMigrationFreezeErrorSanitizesMarkerPayload(t *testing.T) { + dir := t.TempDir() + hostile := "attacker\x1b[2J\x1b[H\t2026-08-16T12:00:00Z\treal reason\x1b[31m\nError: forged line\n" + if err := os.WriteFile(filepath.Join(dir, migration.FileName), []byte(hostile), 0644); err != nil { + t.Fatalf("writing hostile marker: %v", err) + } + t.Chdir(dir) + t.Setenv(migration.EnvFreezeFile, "") + + var gateErr error + stderr := captureStderr(t, func() { gateErr = migrationFreezeError("create") }) + + if gateErr == nil { + t.Fatalf("migrationFreezeError returned nil for a present marker") + } + if strings.Contains(stderr, "\x1b") { + t.Errorf("refusal carries an escape byte from the marker payload — terminal injection:\n%q", stderr) + } + if strings.Contains(stderr, "forged line") { + t.Errorf("refusal carries a later line of the marker — a payload must not be able to add output lines:\n%q", stderr) + } + // The legible parts survive. + for _, want := range []string{"attacker", "real reason"} { + if !strings.Contains(stderr, want) { + t.Errorf("sanitizing dropped legible content %q:\n%s", want, stderr) + } + } +} + +// TestMigrationFreezeUndeterminableFailsClosed pins the fail-closed posture: a +// marker path bd cannot stat is not the same as one that is absent, and the +// ambiguity must refuse rather than silently disarm the gate. +func TestMigrationFreezeUndeterminableFailsClosed(t *testing.T) { + if os.Geteuid() == 0 { + t.Skip("running as root: permission bits do not deny the stat") + } + locked := filepath.Join(t.TempDir(), "locked") + if err := os.Mkdir(locked, 0755); err != nil { + t.Fatalf("creating %s: %v", locked, err) + } + marker := filepath.Join(locked, migration.FileName) + if err := os.WriteFile(marker, nil, 0644); err != nil { + t.Fatalf("writing marker: %v", err) + } + if err := os.Chmod(locked, 0000); err != nil { + t.Fatalf("chmod: %v", err) + } + t.Cleanup(func() { _ = os.Chmod(locked, 0755) }) + t.Setenv(migration.EnvFreezeFile, marker) + + var gateErr error + stderr := captureStderr(t, func() { gateErr = migrationFreezeError("create") }) + + if gateErr == nil { + t.Fatalf("migrationFreezeError returned nil for an unstattable authoritative marker — that is a silent bypass") + } + code, ok := exitCodeFromError(gateErr) + if !ok || code != ExitMigrationFrozen { + t.Errorf("exitCodeFromError = (%d, %v), want (%d, true)", code, ok, ExitMigrationFrozen) + } + if !strings.Contains(stderr, "cannot determine") { + t.Errorf("the refusal must say bd could not tell, not claim a freeze it did not observe:\n%s", stderr) + } + assertVendorNeutral(t, stderr) +} + +// TestRecordTipShownSkippedDuringFreeze covers the PostRunE maintenance half of +// the freeze promise at its one immediate-write site: with dolt auto-commit +// off, recordTipShown writes tip_*_last_shown to the store the moment a tip is +// displayed rather than deferring to PersistentPostRunE, so the guard there +// does not cover it. Showing a tip must never write into a frozen workspace. +func TestRecordTipShownSkippedDuringFreeze(t *testing.T) { + // These are the same process globals PersistentPostRunE reads to decide + // whether to apply a deferred tip write, and a later test in this package + // invokes that hook with no store open. Restore all three or this test + // hands it a pending write and a nil store to dereference. + savedFreeze, savedFlag, savedIDs := commandFreeze, commandDidWriteTipMetadata, commandTipIDsShown + t.Cleanup(func() { + commandFreeze, commandDidWriteTipMetadata, commandTipIDsShown = savedFreeze, savedFlag, savedIDs + }) + + // recordTipShown has two branches: with dolt auto-commit on it records the + // write for PostRunE to apply, otherwise it writes immediately. A freeze + // has to stop both, so assert on both signals rather than on whichever + // branch this process's resolved config happens to select. + reset := func() *fakeTipMetadataWriter { + commandDidWriteTipMetadata = false + commandTipIDsShown = make(map[string]struct{}) + return &fakeTipMetadataWriter{} + } + recorded := func(w *fakeTipMetadataWriter) bool { + return w.calls > 0 || commandDidWriteTipMetadata || len(commandTipIDsShown) > 0 + } + + frozen := reset() + commandFreeze = migration.Result{Path: filepath.Join(t.TempDir(), migration.FileName)} + recordTipShown(frozen, "some-tip") + if recorded(frozen) { + t.Errorf("recordTipShown recorded a tip write during a freeze (calls=%d, pending=%v, ids=%d)", + frozen.calls, commandDidWriteTipMetadata, len(commandTipIDsShown)) + } + + thawed := reset() + commandFreeze = migration.Result{} + recordTipShown(thawed, "some-tip") + if !recorded(thawed) { + t.Errorf("recordTipShown recorded nothing with no freeze active — the guard must not be unconditional") + } +} + +// TestMigrationFreezeProbeAndTargetedGate pins the two entry points that exist +// for callers outside PersistentPreRunE: the silent probe used by diagnosis +// paths that must keep running while frozen but skip their own writes, and the +// targeted refusal for a command handed a workspace other than the one it was +// launched in (`bd doctor /frozen/repo`). Both must agree with the gate. +func TestMigrationFreezeProbeAndTargetedGate(t *testing.T) { + unrelated := t.TempDir() + frozenRoot := t.TempDir() + writeFreezeMarker(t, frozenRoot, "migrator", "cross-tree migration") + target := filepath.Join(frozenRoot, "repo") + if err := os.MkdirAll(target, 0755); err != nil { + t.Fatalf("creating %s: %v", target, err) + } + t.Chdir(unrelated) + t.Setenv(migration.EnvFreezeFile, "") + t.Setenv("BEADS_DIR", "") + + if migrationFreezeActive() { + t.Errorf("migrationFreezeActive() = true with an unrelated cwd and no marker above it") + } + + var gateErr error + stderr := captureStderr(t, func() { gateErr = migrationFreezeErrorFor("doctor --fix", target) }) + if gateErr == nil { + t.Fatalf("migrationFreezeErrorFor returned nil for a frozen target — a named workspace must be checked") + } + code, ok := exitCodeFromError(gateErr) + if !ok || code != ExitMigrationFrozen { + t.Errorf("exitCodeFromError = (%d, %v), want (%d, true)", code, ok, ExitMigrationFrozen) + } + if !strings.Contains(stderr, "doctor --fix") { + t.Errorf("refusal does not name the operation it was given:\n%s", stderr) + } + + // The probe agrees once the frozen tree is the one bd resolved. + t.Chdir(target) + if !migrationFreezeActive() { + t.Errorf("migrationFreezeActive() = false inside a frozen tree") + } +} + +type fakeTipMetadataWriter struct{ calls int } + +func (f *fakeTipMetadataWriter) SetLocalMetadata(_ context.Context, _, _ string) error { + f.calls++ + return nil +} + // TestQuickBlockedDuringMigrationFreeze regression-checks the sharpest gap // flagged in review of the original gate (dc-6jaq, PR #5826): the gate // hand-picked five commands (create, update, close, remember, import), but @@ -188,14 +695,14 @@ func TestCreateNotBlockedWithoutFreeze(t *testing.T) { // automatically, "q" included. func TestQuickBlockedDuringMigrationFreeze(t *testing.T) { bd, dir := setupMigrationFreezeWorkspace(t) - freezeTown(t, dir, "mayor", "dolt v2 migration") + writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") - stdout, stderr, code := runBDMigrationFreeze(t, bd, dir, "q", "should not be created") - if code != 1 { - t.Fatalf("exit code = %d, want 1\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) + stdout, stderr, code := runBDFrozen(t, bd, dir, "q", "should not be created") + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d\nstdout:\n%s\nstderr:\n%s", code, ExitMigrationFrozen, stdout, stderr) } - if !strings.Contains(stderr, "frozen for migration") { - t.Errorf("stderr missing 'frozen for migration':\n%s", stderr) + if !strings.Contains(stderr, "workspace is frozen for migration") { + t.Errorf("stderr missing 'workspace is frozen for migration':\n%s", stderr) } if strings.TrimSpace(stdout) != "" { t.Errorf("stdout should be empty when blocked, got:\n%s", stdout) @@ -220,14 +727,54 @@ func TestLabelAddBlockedDuringMigrationFreeze(t *testing.T) { t.Fatalf("parsing create --json output: %v\n%s", err, stdout) } - freezeTown(t, dir, "mayor", "dolt v2 migration") + writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") - stdout, stderr, code = runBDMigrationFreeze(t, bd, dir, "label", "add", issue.ID, "should-not-be-added") - if code != 1 { - t.Fatalf("exit code = %d, want 1\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) + stdout, stderr, code = runBDFrozen(t, bd, dir, "label", "add", issue.ID, "should-not-be-added") + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d\nstdout:\n%s\nstderr:\n%s", code, ExitMigrationFrozen, stdout, stderr) } - if !strings.Contains(stderr, "frozen for migration") { - t.Errorf("stderr missing 'frozen for migration':\n%s", stderr) + if !strings.Contains(stderr, "workspace is frozen for migration") { + t.Errorf("stderr missing 'workspace is frozen for migration':\n%s", stderr) + } +} + +// TestImportBlockedDuringMigrationFreeze covers bd import both ways round. +// +// Plain `bd import` is stopped by the early gate in PersistentPreRunE, like +// any other write. The `--dry-run` row is the one that pins runImport's OWN +// call: a preview sets useReadOnly, so it skips the early gate, and runImport +// never calls CheckReadonly — delete the check from import.go and only this +// row goes red. It also pins the claim the PreRunE comment makes about +// previews being re-blocked at the per-command chokepoint, which for import is +// exactly that call and nothing else. +func TestImportBlockedDuringMigrationFreeze(t *testing.T) { + for _, tc := range []struct { + name string + args []string + }{ + {name: "import", args: []string{"import"}}, + {name: "import --dry-run", args: []string{"import", "--dry-run"}}, + } { + t.Run(tc.name, func(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + jsonlPath := filepath.Join(dir, "incoming.jsonl") + if err := os.WriteFile(jsonlPath, + []byte(`{"id":"test-zzzz","title":"should not be imported","status":"open","priority":2,"issue_type":"task"}`+"\n"), + 0644); err != nil { + t.Fatalf("writing import fixture: %v", err) + } + writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") + + args := append(append([]string{}, tc.args...), jsonlPath) + stdout, stderr, code := runBDFrozen(t, bd, dir, args...) + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d\nstdout:\n%s\nstderr:\n%s", code, ExitMigrationFrozen, stdout, stderr) + } + if !strings.Contains(stderr, "workspace is frozen for migration") { + t.Errorf("stderr missing 'workspace is frozen for migration':\n%s", stderr) + } + assertVendorNeutral(t, stderr) + }) } } @@ -251,7 +798,7 @@ func TestLabelAddBlockedDuringMigrationFreeze(t *testing.T) { // freeze — exit 0, no refusal), but the same two maintenance side effects // must still be skipped, because they are this hook's own writes and run // independently of the command's classification. Reproduced pre-fix: -// freeze the town, seed .local_version with a stale version, run +// freeze the workspace, seed .local_version with a stale version, run // `BD_DEBUG=1 bd list` — exit 0, but the "auto-migrate:" line appeared and // .local_version was rewritten to the current version anyway. func TestAutoMigrateSkippedDuringMigrationFreeze(t *testing.T) { @@ -261,7 +808,7 @@ func TestAutoMigrateSkippedDuringMigrationFreeze(t *testing.T) { wantExit int wantBlocked bool }{ - {name: "create", args: []string{"create", "should not be created", "-p", "2"}, wantExit: 1, wantBlocked: true}, + {name: "create", args: []string{"create", "should not be created", "-p", "2"}, wantExit: ExitMigrationFrozen, wantBlocked: true}, {name: "list", args: []string{"list"}, wantExit: 0, wantBlocked: false}, } @@ -274,15 +821,15 @@ func TestAutoMigrateSkippedDuringMigrationFreeze(t *testing.T) { t.Fatalf("writing fake old %s: %v", localVersionFile, err) } - freezeTown(t, dir, "mayor", "dolt v2 migration") + writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") - stdout, stderr, code := runBDMigrationFreezeWithEnv(t, bd, dir, []string{"BD_DEBUG=1"}, tt.args...) + stdout, stderr, code := runBDMigrationFreezeWithEnv(t, bd, dir, append(freezeWalkEnv(), "BD_DEBUG=1"), tt.args...) if code != tt.wantExit { t.Fatalf("exit code = %d, want %d\nstdout:\n%s\nstderr:\n%s", code, tt.wantExit, stdout, stderr) } - if tt.wantBlocked && !strings.Contains(stderr, "frozen for migration") { - t.Errorf("stderr missing 'frozen for migration':\n%s", stderr) + if tt.wantBlocked && !strings.Contains(stderr, "workspace is frozen for migration") { + t.Errorf("stderr missing 'workspace is frozen for migration':\n%s", stderr) } if strings.Contains(stderr, "auto-migrate:") { t.Errorf("autoMigrateOnVersionBump ran its store-opening body during a freeze (found an "+ @@ -305,8 +852,284 @@ func TestAutoMigrateSkippedDuringMigrationFreeze(t *testing.T) { } } +// TestDoctorMutationBlockedDuringMigrationFreeze covers the freeze half of +// doctor's mutation gate (#6028). Doctor was the one write-capable command the +// dc-6jaq gate above never reached: it carries skipStoreAnnotation, so the root +// PersistentPreRunE returns before its freeze check ever runs, and doctor's own +// RunE never called CheckReadonly. Its fixers then opened stores directly — two +// of them by shelling out to a child bd — and mutated straight through an +// active freeze. +// +// One row per writing surface class. The gate fires before doctor's +// embedded-mode gate, so these refusals need no Dolt server, and the +// interactive row proves the refusal precedes any prompt (stdin is closed; a +// hang here is the failure). +func TestDoctorMutationBlockedDuringMigrationFreeze(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") + before := doctorWorkspaceFingerprint(t, dir) + + for _, tt := range doctorMutationSurfaces() { + t.Run(tt.name, func(t *testing.T) { + stdout, stderr, code := runBDFrozen(t, bd, dir, tt.args...) + + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d\nstdout:\n%s\nstderr:\n%s", code, ExitMigrationFrozen, stdout, stderr) + } + for _, want := range []string{ + "workspace is frozen for migration", + // The operation label and the marker path are asserted + // separately: the path is matched from the workspace + // directory's own name down, the same way + // TestCreateBlockedDuringMigrationFreeze does it, because the + // refusal reports the marker as the subprocess's cwd walk + // found it. On macOS that walk starts from an os.Getwd() the + // kernel has already resolved, so a /var/folders temp root + // arrives as /private/var/folders and a full-path expectation + // never matches. + "bd " + tt.op + " is blocked by the freeze marker at ", + filepath.Join(filepath.Base(dir), migration.FileName), + "To resume writes, remove that file.", + } { + if !strings.Contains(stderr, want) { + t.Errorf("stderr missing %q:\n%s", want, stderr) + } + } + assertVendorNeutral(t, stderr) + assertDoctorRefusalIsClean(t, stdout) + assertDoctorWorkspaceUnchanged(t, dir, before) + }) + } +} + +// TestFreezeRefusalPathMatchesUnderSymlinkedTempRoot builds, deliberately, the +// filesystem shape that made #6038 a macOS-only red lane: a temp root reached +// through a symlink. A subprocess's os.Getwd() is already symlink-resolved, so +// a marker found by the cwd walk is reported under its real path while the test +// still holds the unresolved one — on macOS every t.TempDir() is /var/folders, +// and /var is a symlink to /private/var, so full-path expectations never match +// there and always match on Linux, where temp roots are real directories. +// +// Constructing the symlink here is what makes that class reproducible on the +// Linux lane every contributor actually runs. +func TestFreezeRefusalPathMatchesUnderSymlinkedTempRoot(t *testing.T) { + if runtime.GOOS == windowsOS { + t.Skip("creating symlinks needs elevated privileges on Windows") + } + root := t.TempDir() + real := filepath.Join(root, "real") + if err := os.MkdirAll(real, 0755); err != nil { + t.Fatalf("creating %s: %v", real, err) + } + link := filepath.Join(root, "link") + if err := os.Symlink(real, link); err != nil { + t.Skipf("symlinks unavailable on this filesystem: %v", err) + } + + bd := setupMigrationFreezeWorkspaceIn(t, real) + writeFreezeMarker(t, real, "migrator", "dolt v2 migration") + + // cwd expressed through the symlink — the shape macOS hands every + // subprocess without anyone asking for it. + stdout, stderr, code := runBDFrozen(t, bd, link, "create", "should not be created", "-p", "2") + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d\nstdout:\n%s\nstderr:\n%s", code, ExitMigrationFrozen, stdout, stderr) + } + if want := filepath.Join(filepath.Base(real), migration.FileName); !strings.Contains(stderr, want) { + t.Errorf("refusal should name the marker by its resolved path, matched from %q down:\n%s", want, stderr) + } + // The other half, and the one that keeps this honest: the unresolved path + // must NOT appear. Without it, someone could satisfy the check above while + // reintroducing a full-path expectation elsewhere. + if unresolved := filepath.Join(link, migration.FileName); strings.Contains(stderr, unresolved) { + t.Errorf("refusal named the unresolved symlink path %q; assertions that pin it break on macOS:\n%s", + unresolved, stderr) + } + assertVendorNeutral(t, stderr) +} + +// TestDoctorPathArgBlockedByTargetFreeze covers the reason doctor's gate takes +// the resolved target path: doctor is the only write-capable command that +// operates on a directory named on the command line, so keying the lookup on +// the caller's cwd alone would let `bd doctor /frozen/repo --fix` walk an +// entirely unrelated tree and mutate straight through the marker. +func TestDoctorPathArgBlockedByTargetFreeze(t *testing.T) { + target := t.TempDir() + bd := setupMigrationFreezeWorkspaceIn(t, target) + writeFreezeMarker(t, target, "migrator", "dolt v2 migration") + before := doctorWorkspaceFingerprint(t, target) + + // cwd is an unrelated, unfrozen workspace; only the target is frozen. + outside := t.TempDir() + setupMigrationFreezeWorkspaceIn(t, outside) + + stdout, stderr, code := runBDFrozen(t, bd, outside, "doctor", target, "--fix", "--yes") + + if code != ExitMigrationFrozen { + t.Fatalf("exit code = %d, want %d\nstdout:\n%s\nstderr:\n%s", code, ExitMigrationFrozen, stdout, stderr) + } + // Same path-tail convention as the table test above. This assertion happens + // to survive the macOS symlink split today — the target arrives from argv, + // which nothing resolves — but it would break the moment discovery + // canonicalizes its roots, and target/outside are distinct temp + // subdirectories, so the tail still proves it named the target and not cwd. + wantMarker := filepath.Join(filepath.Base(target), migration.FileName) + if !strings.Contains(stderr, wantMarker) { + t.Errorf("refusal should name the target's own marker %q:\n%s", wantMarker, stderr) + } + assertVendorNeutral(t, stderr) + assertDoctorRefusalIsClean(t, stdout) + assertDoctorWorkspaceUnchanged(t, target, before) +} + +// TestDoctorPathArgMaintenanceSkippedByTargetFreeze is the diagnosis-side twin: +// plain `bd doctor ` writes .local_version into the *target*, so the skip +// probe has to key on the target too, not merely on where bd was launched. +func TestDoctorPathArgMaintenanceSkippedByTargetFreeze(t *testing.T) { + target := t.TempDir() + bd := setupMigrationFreezeWorkspaceIn(t, target) + seedStaleLocalVersion(t, target) + writeFreezeMarker(t, target, "migrator", "dolt v2 migration") + + outside := t.TempDir() + setupMigrationFreezeWorkspaceIn(t, outside) + + _, stderr, _ := runBDMigrationFreezeWithEnv(t, bd, outside, + append(freezeWalkEnv(), doctorMaintenanceEnv()...), "doctor", target) + + if got := readWorkspaceLocalVersion(t, target); got != staleLocalVersion { + t.Errorf("%s in the frozen target = %q, want unchanged %q — the maintenance probe keyed on cwd, not on the target", + localVersionFile, got, staleLocalVersion) + } + if strings.Contains(stderr, "auto-migrate:") { + t.Errorf("autoMigrateOnVersionBump ran against a frozen target:\n%s", stderr) + } +} + +// TestDoctorDiagnosisWorksDuringMigrationFreeze is the constraint that shapes +// the whole gate: a freeze is exactly when an operator needs to diagnose, so +// every non-mutating doctor mode must keep running. The gate keys on +// --fix/--clean and nothing else. +func TestDoctorDiagnosisWorksDuringMigrationFreeze(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") + + for _, args := range [][]string{ + {"doctor"}, + {"doctor", "--check=pollution"}, + {"doctor", "--check=artifacts"}, + {"doctor", "--check=conventions"}, + } { + t.Run(strings.Join(args, "_"), func(t *testing.T) { + stdout, stderr, code := runBDFrozen(t, bd, dir, args...) + if code == ExitMigrationFrozen || strings.Contains(stderr, "frozen for migration") { + t.Errorf("bd %v was refused during a freeze but mutates nothing (exit %d):\nstderr:\n%s\nstdout:\n%s", + args, code, stderr, stdout) + } + }) + } +} + +// TestDoctorDryRunWorksDuringMigrationFreeze pins the dry-run boundary: plain +// --dry-run only previews and stays available, while --fix --dry-run is +// refused (the gate reads the mutating flag, not the preview flag — the same +// posture the freeze gate takes on every other command's --dry-run). +func TestDoctorDryRunWorksDuringMigrationFreeze(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") + + stdout, stderr, code := runBDFrozen(t, bd, dir, "doctor", "--dry-run") + if code == ExitMigrationFrozen || strings.Contains(stderr, "frozen for migration") { + t.Errorf("'bd doctor --dry-run' previews only and must not be refused (exit %d):\nstderr:\n%s\nstdout:\n%s", code, stderr, stdout) + } + + stdout, stderr, code = runBDFrozen(t, bd, dir, "doctor", "--fix", "--dry-run") + if code != ExitMigrationFrozen || !strings.Contains(stderr, "workspace is frozen for migration") { + t.Errorf("'bd doctor --fix --dry-run' must be refused (exit %d, want %d):\nstderr:\n%s\nstdout:\n%s", + code, ExitMigrationFrozen, stderr, stdout) + } +} + +// staleLocalVersion is an implausibly old recorded version: it forces +// trackBdVersion to see a version "bump" so the maintenance work under test +// actually does something observable instead of short-circuiting. +const staleLocalVersion = "0.0.1" + +func seedStaleLocalVersion(t *testing.T, dir string) { + t.Helper() + path := filepath.Join(dir, ".beads", localVersionFile) + if err := os.WriteFile(path, []byte(staleLocalVersion+"\n"), 0644); err != nil { + t.Fatalf("writing stale %s: %v", localVersionFile, err) + } +} + +// readWorkspaceLocalVersion reads .beads/.local_version out of a test +// workspace (the production readLocalVersion takes the file path directly). +func readWorkspaceLocalVersion(t *testing.T, dir string) string { + t.Helper() + data, err := os.ReadFile(filepath.Join(dir, ".beads", localVersionFile)) + if err != nil { + t.Fatalf("reading %s: %v", localVersionFile, err) + } + return strings.TrimSpace(string(data)) +} + +// doctorMaintenanceEnv puts doctor on its full diagnosis path. runDiagnostics — +// where the maintenance calls under test live — sits behind doctor's +// embedded-mode gate, so the workspace has to look server-backed; +// BEADS_DOLT_SHARED_SERVER is enough, and no server needs to answer, because +// the maintenance block runs before doctor opens its shared store. BD_DEBUG +// surfaces autoMigrateOnVersionBump's own "auto-migrate:" logging, so the +// absence of that line is direct evidence the function was never entered. +func doctorMaintenanceEnv() []string { + return []string{"BEADS_DOLT_SHARED_SERVER=1", "BD_DEBUG=1"} +} + +// assertDoctorReportedStaleVersionWithoutHealing is the #6028 diagnosis +// contract in one place: doctor reports the version mismatch as a finding and +// leaves the store alone. +func assertDoctorReportedStaleVersionWithoutHealing(t *testing.T, dir, stdout, stderr string) { + t.Helper() + if got := readWorkspaceLocalVersion(t, dir); got != staleLocalVersion { + t.Errorf("%s = %q, want unchanged %q — doctor's diagnosis rewrote it through an active gate", + localVersionFile, got, staleLocalVersion) + } + if strings.Contains(stderr, "auto-migrate:") { + t.Errorf("autoMigrateOnVersionBump ran its store-opening body during a gated 'bd doctor' "+ + "(found an 'auto-migrate:' debug line) — diagnosis must not apply schema migrations:\n%s", stderr) + } + if !strings.Contains(stdout, "Version Tracking") || !strings.Contains(stdout, staleLocalVersion) { + t.Errorf("doctor should still REPORT the stale version %q as a finding, not silently skip it:\n%s", + staleLocalVersion, stdout) + } +} + +// TestDoctorMaintenanceSkippedDuringMigrationFreeze is the regression test for +// the sharpest half of #6028: plain `bd doctor` — no --fix, no --clean — wrote +// to a frozen store. runDiagnostics re-implements PersistentPreRunE's two +// maintenance side effects (trackBdVersion, autoMigrateOnVersionBump) because +// doctor skips that hook, but it inherited none of the hook's guards, so it +// rewrote .beads/.local_version and could auto-apply a schema migration +// mid-freeze — the exact torn-upgrade write the freeze exists to prevent. +// +// This is the doctor-side twin of TestAutoMigrateSkippedDuringMigrationFreeze +// above, which pins the same two calls on the PersistentPreRunE path. +func TestDoctorMaintenanceSkippedDuringMigrationFreeze(t *testing.T) { + bd, dir := setupMigrationFreezeWorkspace(t) + seedStaleLocalVersion(t, dir) + writeFreezeMarker(t, dir, "migrator", "dolt v2 migration") + + stdout, stderr, code := runBDMigrationFreezeWithEnv(t, bd, dir, + append(freezeWalkEnv(), doctorMaintenanceEnv()...), "doctor") + + assertDoctorReportedStaleVersionWithoutHealing(t, dir, stdout, stderr) + if code == ExitMigrationFrozen || strings.Contains(stderr, "frozen for migration") { + t.Errorf("plain 'bd doctor' must diagnose during a freeze, not refuse (exit %d):\nstderr:\n%s", code, stderr) + } +} + // TestAutoMigrateStillRunsWithoutFreeze is the companion regression-safety -// check for the ask-#2 fix: without a freeze sentinel, the new early gate in +// check for the ask-#2 fix: without a freeze marker, the new early gate in // PersistentPreRunE must not interfere with autoMigrateOnVersionBump's normal // version-bump reconciliation. func TestAutoMigrateStillRunsWithoutFreeze(t *testing.T) { @@ -321,7 +1144,7 @@ func TestAutoMigrateStillRunsWithoutFreeze(t *testing.T) { "create", "normal issue", "-p", "2", "--json") if code != 0 { - t.Fatalf("bd create failed (exit %d) with no freeze sentinel present:\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) + t.Fatalf("bd create failed (exit %d) with no freeze marker present:\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) } if !strings.Contains(stderr, "auto-migrate:") { t.Errorf("expected autoMigrateOnVersionBump to run (an 'auto-migrate:' debug log line) when not frozen, got none:\nstderr:\n%s", stderr) diff --git a/cmd/bd/notion_test.go b/cmd/bd/notion_test.go index e15abc277..b9dc2baab 100644 --- a/cmd/bd/notion_test.go +++ b/cmd/bd/notion_test.go @@ -160,7 +160,7 @@ func TestGetNotionConfigPrefersStoreOverEnv(t *testing.T) { func TestRunNotionStatusJSONWithMissingConfig(t *testing.T) { saveAndRestoreGlobals(t) - jsonOutput = true + pinJSONOutput(t, true) store = nil dbPath = "" t.Setenv("NOTION_TOKEN", "") @@ -383,7 +383,7 @@ func TestRunNotionStatusUsesHTTPClient(t *testing.T) { newNotionStatusClient = func(token string) *notion.Client { return notion.NewClient(token).WithBaseURL(server.URL) } - jsonOutput = true + pinJSONOutput(t, true) store = nil dbPath = "" t.Setenv("NOTION_TOKEN", "env-token") diff --git a/cmd/bd/protocol/corpus.go b/cmd/bd/protocol/corpus.go index 111d828a7..dce3b1ef7 100644 --- a/cmd/bd/protocol/corpus.go +++ b/cmd/bd/protocol/corpus.go @@ -280,9 +280,11 @@ func canonValue(v any) any { // Replace per-write-random token values (the guarded-write revision / // row_lock) with a placeholder: pin that bd show exposes a revision // field, not its nondeterministic value. Unlike the provenance keys - // above this is unconditional — the value is a JSON number, not a - // string — but it stays a bare-key match, so keep the scope caveat in - // mind (see volatileValueKeys). + // above this is unconditional — the value is replaced whatever its + // JSON type, so the placeholder held when the token was a number and + // still holds now that it is a decimal string — but it stays a + // bare-key match, so keep the scope caveat in mind (see + // volatileValueKeys). if ph, ok := volatileValueKeys[k]; ok { t[k] = ph continue diff --git a/cmd/bd/protocol/testdata/corpus/envelope/list.json b/cmd/bd/protocol/testdata/corpus/envelope/list.json index ada8736aa..1daaf428a 100644 --- a/cmd/bd/protocol/testdata/corpus/envelope/list.json +++ b/cmd/bd/protocol/testdata/corpus/envelope/list.json @@ -43,7 +43,7 @@ "corpus-label" ], "metadata": { - "phase": "2" + "phase": 2 }, "owner": "test@protocol.test", "priority": 0, diff --git a/cmd/bd/protocol/testdata/corpus/envelope/ready.json b/cmd/bd/protocol/testdata/corpus/envelope/ready.json index ada8736aa..1daaf428a 100644 --- a/cmd/bd/protocol/testdata/corpus/envelope/ready.json +++ b/cmd/bd/protocol/testdata/corpus/envelope/ready.json @@ -43,7 +43,7 @@ "corpus-label" ], "metadata": { - "phase": "2" + "phase": 2 }, "owner": "test@protocol.test", "priority": 0, diff --git a/cmd/bd/protocol/testdata/corpus/envelope/update.json b/cmd/bd/protocol/testdata/corpus/envelope/update.json index 3a04ab63b..cf5ac889e 100644 --- a/cmd/bd/protocol/testdata/corpus/envelope/update.json +++ b/cmd/bd/protocol/testdata/corpus/envelope/update.json @@ -10,7 +10,7 @@ "corpus-label" ], "metadata": { - "phase": "2" + "phase": 2 }, "owner": "test@protocol.test", "priority": 0, diff --git a/cmd/bd/protocol/testdata/corpus/flat/list.json b/cmd/bd/protocol/testdata/corpus/flat/list.json index bd36a5b03..1caed738d 100644 --- a/cmd/bd/protocol/testdata/corpus/flat/list.json +++ b/cmd/bd/protocol/testdata/corpus/flat/list.json @@ -42,7 +42,7 @@ "corpus-label" ], "metadata": { - "phase": "2" + "phase": 2 }, "owner": "test@protocol.test", "priority": 0, diff --git a/cmd/bd/protocol/testdata/corpus/flat/ready.json b/cmd/bd/protocol/testdata/corpus/flat/ready.json index bd36a5b03..1caed738d 100644 --- a/cmd/bd/protocol/testdata/corpus/flat/ready.json +++ b/cmd/bd/protocol/testdata/corpus/flat/ready.json @@ -42,7 +42,7 @@ "corpus-label" ], "metadata": { - "phase": "2" + "phase": 2 }, "owner": "test@protocol.test", "priority": 0, diff --git a/cmd/bd/protocol/testdata/corpus/flat/update.json b/cmd/bd/protocol/testdata/corpus/flat/update.json index 649e19293..6d60adce5 100644 --- a/cmd/bd/protocol/testdata/corpus/flat/update.json +++ b/cmd/bd/protocol/testdata/corpus/flat/update.json @@ -9,7 +9,7 @@ "corpus-label" ], "metadata": { - "phase": "2" + "phase": 2 }, "owner": "test@protocol.test", "priority": 0, diff --git a/cmd/bd/protocol/testdata/corpus/manifest.json b/cmd/bd/protocol/testdata/corpus/manifest.json index 26858a699..bb223bf27 100644 --- a/cmd/bd/protocol/testdata/corpus/manifest.json +++ b/cmd/bd/protocol/testdata/corpus/manifest.json @@ -49,11 +49,11 @@ }, "envelope/list": { "cmd": "bd list --all --json", - "sha256": "9a06f84b6522a6ecfeb9290c0f1af6a89ac1f6e8c4ccb4318cb167a384d5bb90" + "sha256": "7317a1b51728df55aa64075f5099e3bf1cb90c14a0bbd900fdcb47824ef50d91" }, "envelope/ready": { "cmd": "bd ready --json", - "sha256": "9a06f84b6522a6ecfeb9290c0f1af6a89ac1f6e8c4ccb4318cb167a384d5bb90" + "sha256": "7317a1b51728df55aa64075f5099e3bf1cb90c14a0bbd900fdcb47824ef50d91" }, "envelope/reopen": { "cmd": "bd reopen --json corpus-closed", @@ -65,7 +65,7 @@ }, "envelope/update": { "cmd": "bd update corpus-root --json --priority 0 --add-label corpus-label --set-metadata phase=2 --description \"updated corpus root\"", - "sha256": "4abf4bd265741b310781019f1e4f35384af8470ffd7e2bef2017e7caeead15b2" + "sha256": "8f7693350a4e122e2bf38c4aa5c0439b50281b2bae4f2b18b437735c67e6db1d" }, "envelope/version": { "cmd": "bd version --json", @@ -117,11 +117,11 @@ }, "flat/list": { "cmd": "bd list --all --json", - "sha256": "6d7b3535591a4e85385a96cb02e220853d7e81f4212d4032d4567aa991418dae" + "sha256": "6a10f8d91e925c58515997cb76a4bb94caf3444925102df0247587353742ac0d" }, "flat/ready": { "cmd": "bd ready --json", - "sha256": "6d7b3535591a4e85385a96cb02e220853d7e81f4212d4032d4567aa991418dae" + "sha256": "6a10f8d91e925c58515997cb76a4bb94caf3444925102df0247587353742ac0d" }, "flat/reopen": { "cmd": "bd reopen --json corpus-closed", @@ -133,7 +133,7 @@ }, "flat/update": { "cmd": "bd update corpus-root --json --priority 0 --add-label corpus-label --set-metadata phase=2 --description \"updated corpus root\"", - "sha256": "77612a528e1f8f7944ede6e9cac476a37fb9009411502eb1501687d42928d7e0" + "sha256": "1d1f8e21df93df7a1885430fd804d2435cd3d7289cfcfcd1f4f511e241a8d805" }, "flat/version": { "cmd": "bd version --json", diff --git a/cmd/bd/proxied_direct_only_refusal_frontdoor_test.go b/cmd/bd/proxied_direct_only_refusal_frontdoor_test.go new file mode 100644 index 000000000..b3702608b --- /dev/null +++ b/cmd/bd/proxied_direct_only_refusal_frontdoor_test.go @@ -0,0 +1,26 @@ +//go:build cgo && unix + +package main + +import ( + "strings" + "testing" + "time" +) + +func TestProxiedDirectOnlyRefusalsFrontDoor(t *testing.T) { + requireManagedLocalProxiedEnv(t) + bd := buildEmbeddedBD(t) + p := bdManagedLocalInit(t, bd, "directonly", 5*time.Minute) + for _, args := range [][]string{{"sync"}, {"dolt", "remote", "add", "origin", "https://example.com/repo"}, {"dolt", "remote", "list"}, {"dolt", "remote", "reset-data", "origin"}, {"dolt", "push"}, {"dolt", "pull"}, {"dolt", "commit"}} { + t.Run(strings.Join(args, "/"), func(t *testing.T) { + out, errOut, err := bdProxiedRunBuffers(t, bd, p.dir, append(args, "--json")...) + if err == nil { + t.Fatal("expected refusal") + } + if !strings.Contains(strings.ToLower(out+errOut), "unsupported") && !strings.Contains(strings.ToLower(out+errOut), "proxied") { + t.Fatalf("unexpected refusal: %s%s", out, errOut) + } + }) + } +} diff --git a/cmd/bd/proxied_outage_reconnect_integration_test.go b/cmd/bd/proxied_outage_reconnect_integration_test.go new file mode 100644 index 000000000..ae8d0b605 --- /dev/null +++ b/cmd/bd/proxied_outage_reconnect_integration_test.go @@ -0,0 +1,240 @@ +//go:build cgo && unix + +package main + +// Real front-door outage/reconnect acceptance matrix. Each case seeds a +// sentinel through bd, takes only the upstream out of service, and verifies a +// bounded failure without mutation before restoring the same endpoint. Proxy +// ownership is exercised separately by killing the proxy and letting bd adopt +// a replacement on the next invocation. + +import ( + "context" + "os" + "os/exec" + "path/filepath" + "strconv" + "strings" + "syscall" + "testing" + "time" + + "github.com/steveyegge/beads/internal/configfile" + "github.com/steveyegge/beads/internal/storage/dbproxy/proxy" + "github.com/steveyegge/beads/internal/testutil" + "github.com/steveyegge/beads/internal/types" + "github.com/stretchr/testify/require" +) + +func TestProxiedOutageReconnectAcceptanceMatrix(t *testing.T) { + requireProxiedServerEnv(t) + bd := buildEmbeddedBD(t) + for _, topology := range []struct { + name string + socket bool + }{ + {name: "external-tcp"}, + {name: "external-unix-socket", socket: true}, + } { + t.Run(topology.name, func(t *testing.T) { + upstream := testutil.StartIsolatedDoltContainerHandle(t) + if _, err := exec.LookPath("socat"); err != nil { + t.Skip("socat is required") + } + gatePort, err := proxy.PickFreePort() + require.NoError(t, err) + var endpoint string + if topology.socket { + endpoint = filepath.Join(t.TempDir(), "dolt.sock") + } else { + endpoint = strconv.Itoa(gatePort) + } + bridge := startOutageBridge(t, endpoint, upstream.Port, topology.socket) + + var p proxiedProject + if topology.socket { + p = bdProxiedInit(t, bd, "outage_socket", "--proxied-server-external-socket-path", endpoint) + } else { + p = bdProxiedInit(t, bd, "outage_tcp", "--proxied-server-external-host", "127.0.0.1", "--proxied-server-external-port", endpoint) + } + sentinel := bdProxiedCreate(t, bd, p.dir, "outage sentinel") + before := bdProxiedShow(t, bd, p.dir, sentinel.ID) + if _, err := os.Stat(filepath.Join(p.proxyRoot, "proxy-child.pid")); err == nil { + t.Fatal("external topology spawned a local Dolt sidecar") + } + + // Stop only the upstream. The proxy remains alive and must surface a + // bounded transport failure; no local fallback is permitted. + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + require.NoError(t, upstream.Stop(ctx)) + cancel() + _, stderr, err, timedOut := runProxiedDeadline(t, bd, p.dir, 3*time.Second, "show", sentinel.ID, "--json") + if timedOut { + t.Fatal("upstream outage command exceeded 3s bound") + } + if err == nil { + t.Fatal("show unexpectedly succeeded while upstream was stopped") + } + if !actionableTransportError(stderr) { + t.Fatalf("outage error is not actionable transport refusal: %q", stderr) + } + // Restore and verify the exact sentinel survives the outage. + ctx, cancel = context.WithTimeout(context.Background(), 10*time.Second) + require.NoError(t, upstream.Start(ctx)) + newPort, err := upstream.CurrentPort(ctx) + cancel() + require.NoError(t, err) + require.NoError(t, bridge.Process.Kill()) + bridge = startOutageBridge(t, endpoint, newPort, topology.socket) + var after *types.Issue + require.Eventually(t, func() bool { + stdout, _, runErr := bdProxiedRunBuffers(t, bd, p.dir, "show", sentinel.ID, "--json") + if runErr != nil { + return false + } + after = parseIssueJSON(t, []byte(stdout)) + return true + }, 10*time.Second, 100*time.Millisecond, "bd reconnect after upstream restart") + if after.ID != before.ID || after.Title != before.Title { + t.Fatalf("sentinel changed after reconnect: before=%q/%q after=%q/%q", before.ID, before.Title, after.ID, after.Title) + } + if _, err := os.Stat(filepath.Join(p.proxyRoot, "proxy-child.pid")); err == nil { + t.Fatal("external topology created a local Dolt sidecar during reconnect") + } + + // Killing the proxy itself must cause a fresh proxy to be adopted on + // the next command, still reaching the same upstream data. + if err := proxy.Shutdown(p.proxyRoot); err != nil { + t.Fatalf("shutdown proxy: %v", err) + } + afterProxy := bdProxiedShow(t, bd, p.dir, sentinel.ID) + if afterProxy.ID != sentinel.ID || afterProxy.Title != sentinel.Title { + t.Fatalf("sentinel lost after proxy restart: %+v", afterProxy) + } + + // Endpoint identity changes must refuse stale-proxy adoption. + info, err := configfile.LoadProxiedServerClientInfo(p.beadsDir) + if err != nil || info == nil || info.External == nil { + t.Fatalf("load endpoint identity: info=%+v err=%v", info, err) + } + original := *info.External + if topology.socket { + info.External.Socket = filepath.Join(t.TempDir(), "stale.sock") + } else { + info.External.Port++ + } + if err := configfile.SaveProxiedServerClientInfo(p.beadsDir, info); err != nil { + t.Fatalf("rewrite endpoint identity: %v", err) + } + stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "show", sentinel.ID, "--json") + if err == nil { + t.Fatalf("stale endpoint unexpectedly succeeded:\nstdout=%s\nstderr=%s", stdout, stderr) + } + if !strings.Contains(strings.ToLower(stdout+stderr), "endpoint") { + t.Fatalf("stale endpoint refusal lacks identity context: %s%s", stdout, stderr) + } + info.External = &original + require.NoError(t, configfile.SaveProxiedServerClientInfo(p.beadsDir, info)) + }) + } +} + +func TestManagedLocalProxiedOutageReconnectContract(t *testing.T) { + requireManagedLocalProxiedEnv(t) + bd := buildEmbeddedBD(t) + p := bdManagedLocalInit(t, bd, "outage_managed", 5*time.Minute) + sentinel := bdProxiedCreate(t, bd, p.dir, "managed outage sentinel") + proxyBefore := readManagedProxyPidFile(t, p) + if proxyBefore == nil || !processAlive(proxyBefore.Pid) { + t.Fatalf("managed-local proxy is not running: %+v", proxyBefore) + } + backend := readManagedBackendPidFile(t, p) + if backend == nil || !processAlive(backend.Pid) { + t.Fatal("managed-local backend is not running") + } + proc, err := os.FindProcess(backend.Pid) + require.NoError(t, err) + require.NoError(t, proc.Kill()) + require.Eventually(t, func() bool { return !processAlive(proxyBefore.Pid) }, 3*time.Second, 50*time.Millisecond, "managed proxy did not retire after child death") + // 1.3.0 contract: child death terminates the owned proxy; the next bd + // invocation starts a fresh proxy/backend rather than in-place restarting. + got := bdProxiedShow(t, bd, p.dir, sentinel.ID) + if got.ID != sentinel.ID || got.Title != "managed outage sentinel" { + t.Fatalf("managed-local sentinel lost after command-level restart: %+v", got) + } + proxyAfter := readManagedProxyPidFile(t, p) + backendAfter := readManagedBackendPidFile(t, p) + if proxyBefore == nil || processAlive(proxyBefore.Pid) || processAlive(backend.Pid) { + t.Fatalf("managed child death left old processes alive: proxy=%v backend=%v", processAlive(proxyBefore.Pid), processAlive(backend.Pid)) + } + if backendAfter == nil || !processAlive(backendAfter.Pid) { + t.Fatalf("managed restart backend not alive: %+v", backendAfter) + } + if proxyBefore == nil || proxyAfter == nil || proxyAfter.Pid == proxyBefore.Pid { + t.Fatalf("managed child death did not force a fresh proxy: before=%+v after=%+v", proxyBefore, proxyAfter) + } +} + +func runProxiedDeadline(t *testing.T, bd, dir string, timeout time.Duration, args ...string) (stdout, stderr string, err error, timedOut bool) { + t.Helper() + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + cmd := exec.CommandContext(ctx, bd, args...) + cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} + cmd.Dir, cmd.Env = dir, bdProxiedEnv(dir) + var out, errOut strings.Builder + cmd.Stdout, cmd.Stderr = &out, &errOut + done := make(chan struct{}) + go func() { + select { + case <-ctx.Done(): + if cmd.Process != nil { + _ = syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL) + } + case <-done: + } + }() + err = cmd.Run() + close(done) + return out.String(), errOut.String(), err, ctx.Err() != nil +} + +func actionableTransportError(s string) bool { + s = strings.ToLower(s) + for _, token := range []string{"connection refused", "connect:", "endpoint", "dial", "upstream", "unexpected eof", "invalid connection"} { + if strings.Contains(s, token) { + return true + } + } + return false +} + +func waitForSocket(t *testing.T, path string) { + t.Helper() + require.Eventually(t, func() bool { _, err := os.Stat(path); return err == nil }, 3*time.Second, 20*time.Millisecond, + "unix socket did not appear") +} + +func startOutageBridge(t *testing.T, endpoint, upstreamPort string, socket bool) *exec.Cmd { + t.Helper() + var listen string + if socket { + // socat refuses to bind over a stale pathname after an outage. + _ = os.Remove(endpoint) + listen = "UNIX-LISTEN:" + endpoint + ",fork" + } else { + listen = "TCP-LISTEN:" + endpoint + ",bind=127.0.0.1,reuseaddr,fork" + } + cmd := exec.Command("socat", listen, "TCP:127.0.0.1:"+upstreamPort) + require.NoError(t, cmd.Start()) + require.Eventually(t, func() bool { return processAlive(cmd.Process.Pid) }, time.Second, 20*time.Millisecond, "outage bridge process did not remain alive") + if socket { + waitForSocket(t, endpoint) + } + t.Cleanup(func() { + if cmd.Process != nil { + _ = cmd.Process.Kill() + } + }) + return cmd +} diff --git a/cmd/bd/proxied_workflow_refusal_frontdoor_test.go b/cmd/bd/proxied_workflow_refusal_frontdoor_test.go new file mode 100644 index 000000000..987007747 --- /dev/null +++ b/cmd/bd/proxied_workflow_refusal_frontdoor_test.go @@ -0,0 +1,118 @@ +//go:build cgo && unix + +package main + +import ( + "bytes" + "encoding/json" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" + "time" +) + +func TestDirectWorkflowRepresentativeBehavior(t *testing.T) { + bd := buildEmbeddedBD(t) + dir, _, _ := bdInit(t, bd, "--prefix", "directwf", "--skip-hooks", "--skip-agents") + cmd := exec.Command(bd, "ship", "refusal") + cmd.Dir = dir + cmd.Env = os.Environ() + var out bytes.Buffer + cmd.Stdout, cmd.Stderr = &out, &out + if err := cmd.Run(); err == nil { + t.Fatal("direct ship unexpectedly succeeded") + } + if strings.Contains(strings.ToLower(out.String()), "proxied-server mode") { + t.Fatalf("direct mode used proxy refusal: %s", out.String()) + } +} + +// TestProxiedWorkflowRefusalsFrontDoor executes the real bd binary for every +// workflow family rejected by the proxy capability contract. Refusals must +// happen before provider startup and leave the workspace untouched. +func TestProxiedWorkflowRefusalsFrontDoor(t *testing.T) { + requireManagedLocalProxiedEnv(t) + bd := buildEmbeddedBD(t) + p := bdManagedLocalInit(t, bd, "refusal", 5*time.Minute) + epic := bdProxiedCreate(t, bd, p.dir, "refusal epic", "--type", "epic") + formula := filepath.Join(t.TempDir(), "refusal.toml") + if err := os.WriteFile(formula, []byte("name = \"refusal\"\n"), 0o600); err != nil { + t.Fatal(err) + } + before, err := os.ReadFile(filepath.Join(p.proxyRoot, "config.yaml")) + if err != nil { + t.Fatalf("read config before refusal: %v", err) + } + issuesBefore := bdProxiedListJSON(t, bd, p, "--all") + artifactBefore := map[string][]byte{} + for _, name := range []string{".local_version", "events.jsonl", "metadata.json", "proxy.pid", "proxy-child.pid", "proxy.lock", "proxy-child.lock"} { + b, _ := os.ReadFile(filepath.Join(p.beadsDir, name)) + artifactBefore[name] = b + } + commands := [][]string{{"cook", formula, "--persist"}, {"ship", "refusal"}, {"swarm", "create", epic.ID}, {"swarm", "list"}, {"merge-slot", "create"}, {"merge-slot", "check"}, {"merge-slot", "acquire"}, {"merge-slot", "release"}} + expectedCode := func(args []string) string { + if args[0] == "swarm" { + return "proxy.swarm.unsupported" + } + if args[0] == "merge-slot" { + return "proxy.merge_slot.unsupported" + } + return "proxy.formula.unsupported" + } + expectedMessage := func(args []string) string { + name := args[0] + if (args[0] == "swarm" || args[0] == "merge-slot") && len(args) > 1 { + name += " " + args[1] + } + return name + " is not supported in proxied-server mode" + } + for _, args := range commands { + t.Run(strings.Join(args, "/"), func(t *testing.T) { + for _, jsonMode := range []bool{false, true} { + invoke := append([]string(nil), args...) + if jsonMode { + invoke = append(invoke, "--json") + } + stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, invoke...) + if err == nil { + t.Fatalf("%v unexpectedly succeeded: %s", invoke, stdout) + } + out := strings.ToLower(stdout + stderr) + if !jsonMode && !strings.Contains(stderr, expectedMessage(args)) { + t.Fatalf("%v refusal lacks stable proxy/unsupported shape: %s", invoke, out) + } + if jsonMode { + var payload struct { + Code string `json:"code"` + Mutates bool `json:"mutates"` + } + if err := json.Unmarshal([]byte(stdout), &payload); err != nil { + t.Fatalf("invalid refusal JSON: %v", err) + } + if payload.Code != expectedCode(args) || payload.Mutates { + t.Fatalf("typed refusal = %+v", payload) + } + } + } + }) + } + after, err := os.ReadFile(filepath.Join(p.proxyRoot, "config.yaml")) + if err != nil { + t.Fatalf("read config after refusal: %v", err) + } + if string(before) != string(after) { + t.Fatal("config changed during refused workflow commands") + } + issuesAfter := bdProxiedListJSON(t, bd, p, "--all") + if len(issuesBefore) != len(issuesAfter) { + t.Fatalf("issue rows changed during refusals: before=%d after=%d", len(issuesBefore), len(issuesAfter)) + } + for name, want := range artifactBefore { + got, _ := os.ReadFile(filepath.Join(p.beadsDir, name)) + if string(got) != string(want) { + t.Fatalf("artifact %s changed", name) + } + } +} diff --git a/cmd/bd/proxy_capability.go b/cmd/bd/proxy_capability.go new file mode 100644 index 000000000..8c188183e --- /dev/null +++ b/cmd/bd/proxy_capability.go @@ -0,0 +1,361 @@ +package main + +import ( + "fmt" + "strings" + + "github.com/spf13/cobra" +) + +// ProxyCapability identifies a command feature whose availability differs by +// storage topology. +type ProxyCapability string + +const ( + ProxyCapReadonly ProxyCapability = "readonly" + ProxyCapMaxRows ProxyCapability = "max-rows" + ProxyCapWatch ProxyCapability = "watch" + ProxyCapRepo ProxyCapability = "repo" +) + +// ProxyMode identifies the selected storage topology. +type ProxyMode string + +const ( + ProxyModeDirect ProxyMode = "direct" + ProxyModeProxied ProxyMode = "proxied-server" +) + +// ProxyTopology distinguishes the provider deployment shape. Capability +// policy is currently identical across proxied shapes, but retaining this +// dimension prevents an external TCP server from being conflated with a local +// managed one as more surfaces are added. +type ProxyTopology string + +const ( + ProxyTopologyAny ProxyTopology = "any" + ProxyTopologyManagedLocal ProxyTopology = "managed-local" + ProxyTopologyExternalTCP ProxyTopology = "external-tcp" + ProxyTopologyExternalUnix ProxyTopology = "external-unix" +) + +// ProxyCapabilityOutcome describes what the front door does with a feature. +type ProxyCapabilityOutcome string + +const ( + ProxyOutcomeHonored ProxyCapabilityOutcome = "honored" + ProxyOutcomeRefused ProxyCapabilityOutcome = "refused" + ProxyOutcomeDelegated ProxyCapabilityOutcome = "delegated" + ProxyOutcomeNA ProxyCapabilityOutcome = "N/A" +) + +// proxyCapabilityRule is the stable contract for one command/argument/topology +// capability. Mutates is false for all refusals; ExitCode is used by the CLI +// when rendering a typed refusal. +type proxyCapabilityRule struct { + Outcome ProxyCapabilityOutcome + Code string + Message string + ExitCode int + Mutates bool +} + +// ProxyCapabilityError is a machine-identifiable front-door refusal. +type ProxyCapabilityError struct { + Code string + Message string + ExitCode int + Mutates bool +} + +func (e *ProxyCapabilityError) Error() string { return e.Message } + +func refused(code, message string) proxyCapabilityRule { + return proxyCapabilityRule{Outcome: ProxyOutcomeRefused, Code: code, Message: message, ExitCode: 1} +} + +func honored() proxyCapabilityRule { + return proxyCapabilityRule{Outcome: ProxyOutcomeHonored, ExitCode: 0} +} + +func notApplicable() proxyCapabilityRule { return proxyCapabilityRule{Outcome: ProxyOutcomeNA} } + +// ProxyCapabilityKey identifies a command's flag/argument on a topology. +// Argument is intentionally explicit (for example, "--watch"), allowing +// callers and tests to distinguish a command that lacks a flag (N/A) from one +// that refuses it. +type ProxyCapabilityKey struct { + Command string + Argument string + Mode ProxyMode + Topology ProxyTopology +} + +// ProxyCapabilityRow is an inspectable command/argument/topology policy row. +type ProxyCapabilityRow struct { + ProxyCapabilityKey + Rule proxyCapabilityRule +} + +var proxyMaintenanceRefusals = map[string]proxyCapabilityRule{ + "doctor": refused("proxy.doctor.unsupported", "doctor is not supported in proxied-server mode"), + "backup": refused("proxy.backup.unsupported", "backup is not supported in proxied-server mode"), + "restore": refused("proxy.restore.unsupported", "restore is not supported in proxied-server mode"), + "diff": refused("proxy.diff.unsupported", "diff is not supported in proxied-server mode"), + "flatten": refused("proxy.flatten.unsupported", "flatten is not supported in proxied-server mode"), + "migrate": refused("proxy.migrate.unsupported", "migrate is not supported in proxied-server mode"), + "migrate-personal": refused("proxy.migrate.unsupported", "migrate-personal is not supported in proxied-server mode"), + "branch": refused("proxy.branch.unsupported", "branch is not supported in proxied-server mode"), + "conflicts": refused("proxy.conflicts.unsupported", "conflicts is not supported in proxied-server mode"), + "vc": refused("proxy.vc.unsupported", "vc is not supported in proxied-server mode"), + "federation": refused("proxy.federation.unsupported", "federation is not supported in proxied-server mode"), + "repo": refused("proxy.repo.unsupported", "repo is not supported in proxied-server mode"), + // Wording matches the long-standing compact.go refusal this pre-provider + // gate now short-circuits, so the user-facing message does not change. + "compact": refused("proxy.compact.unsupported", "only 'compact --dolt' is supported in proxied-server mode"), + "backup init": refused("proxy.backup.unsupported", "backup init is not supported in proxied-server mode"), + "backup sync": refused("proxy.backup.unsupported", "backup sync is not supported in proxied-server mode"), + "backup remove": refused("proxy.backup.unsupported", "backup remove is not supported in proxied-server mode"), + "backup status": refused("proxy.backup.unsupported", "backup status is not supported in proxied-server mode"), + "backup restore": refused("proxy.backup.unsupported", "backup restore is not supported in proxied-server mode"), + "migrate sync": refused("proxy.migrate.unsupported", "migrate sync is not supported in proxied-server mode"), + "migrate-issues": refused("proxy.migrate.unsupported", "migrate-issues is not supported in proxied-server mode"), + "gate discover": refused("proxy.gate.unsupported", "gate discover is not supported in proxied-server mode"), + "admin cleanup": refused("proxy.admin.unsupported", "admin cleanup is not supported in proxied-server mode"), + "admin reset": refused("proxy.admin.unsupported", "admin reset is not supported in proxied-server mode"), + "dolt push": refused("proxy.dolt_push.unsupported", "dolt push is not supported in proxied-server mode"), + "dolt pull": refused("proxy.dolt_pull.unsupported", "dolt pull is not supported in proxied-server mode"), + "dolt commit": refused("proxy.dolt_commit.unsupported", "dolt commit is not supported in proxied-server mode"), + "dolt remote": refused("proxy.dolt_remote.unsupported", "dolt remote is not supported in proxied-server mode"), + "dolt remote add": refused("proxy.dolt_remote.unsupported", "dolt remote add is not supported in proxied-server mode"), + "dolt remote list": refused("proxy.dolt_remote.unsupported", "dolt remote list is not supported in proxied-server mode"), + "cook": refused("proxy.formula.unsupported", "cook is not supported in proxied-server mode"), + "ship": refused("proxy.formula.unsupported", "ship is not supported in proxied-server mode"), + "swarm create": refused("proxy.swarm.unsupported", "swarm create is not supported in proxied-server mode"), + "swarm list": refused("proxy.swarm.unsupported", "swarm list is not supported in proxied-server mode"), + "merge-slot create": refused("proxy.merge_slot.unsupported", "merge-slot create is not supported in proxied-server mode"), + "merge-slot check": refused("proxy.merge_slot.unsupported", "merge-slot check is not supported in proxied-server mode"), + "merge-slot acquire": refused("proxy.merge_slot.unsupported", "merge-slot acquire is not supported in proxied-server mode"), + "merge-slot release": refused("proxy.merge_slot.unsupported", "merge-slot release is not supported in proxied-server mode"), + "dolt remote reset-data": refused("proxy.dolt_remote.unsupported", "dolt remote reset-data is not supported in proxied-server mode"), + "sync": refused("proxy.sync.unsupported", "sync is not supported in proxied-server mode"), +} + +func init() { + for parent, children := range map[string][]string{ + "vc": {"merge", "commit", "status"}, + "federation": {"sync", "status", "add-peer", "remove-peer", "list-peers"}, + "repo": {"add", "remove", "list", "sync"}, + "conflicts": {"list", "show", "resolve"}, + "migrate": {"hooks", "issues"}, + } { + rule := proxyMaintenanceRefusals[parent] + for _, child := range children { + path := parent + " " + child + proxyMaintenanceRefusals[path] = refused(rule.Code, path+" is not supported in proxied-server mode") + } + } +} + +// validateProxyMaintenanceBeforeProvider rejects known direct-only commands +// before migrations, auto-start, or provider construction. +func validateProxyMaintenanceBeforeProvider(cmd *cobra.Command) error { + if cmd == nil { + return nil + } + name := cmd.Name() + path := strings.TrimSpace(strings.TrimPrefix(cmd.CommandPath(), cmd.Root().Name())) + if name == "compact" { + if cmd.Flags().Lookup("dolt") == nil { + return nil // root `bd compact` is the Dolt history command + } + dolt, _ := cmd.Flags().GetBool("dolt") + if dolt { + return nil + } + rule := proxyMaintenanceRefusals["compact"] + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: rule.Code, Message: rule.Message, ExitCode: rule.ExitCode}) + } + if rule, ok := proxyMaintenanceRefusals[path]; ok { + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: rule.Code, Message: rule.Message, ExitCode: rule.ExitCode}) + } + if class, ok := LookupHistoryCapability(path); ok && class == HistoryDirectOnly { + rule := refused("proxy.history.unsupported", path+" is not supported in proxied-server mode") + if specific, found := proxyMaintenanceRefusals[path]; found { + rule = specific + } + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: rule.Code, Message: rule.Message, ExitCode: rule.ExitCode, Mutates: rule.Mutates}) + } + if strings.Contains(path, " ") { + return nil + } + if rule, ok := proxyMaintenanceRefusals[name]; ok { + return HandleProxyCapabilityError(&ProxyCapabilityError{Code: rule.Code, Message: rule.Message, ExitCode: rule.ExitCode}) + } + return nil +} + +// LookupProxyCapabilityFor returns the command/argument-specific rule. An +// absent command row falls back to the topology-wide default. +func LookupProxyCapabilityFor(command, argument string, mode ProxyMode) (proxyCapabilityRule, bool) { + capability := ProxyCapability(argument) + if len(argument) > 2 && argument[:2] == "--" { + capability = ProxyCapability(argument[2:]) + } + if commands, ok := proxyCommandCapabilities[command]; ok { + if modes, ok := commands[mode]; ok { + if rule, ok := modes[capability]; ok { + return rule, true + } + } + } + return LookupProxyCapability(mode, capability) +} + +var proxyCapabilityMatrix = map[ProxyMode]map[ProxyCapability]proxyCapabilityRule{ + ProxyModeDirect: { + ProxyCapReadonly: honored(), ProxyCapMaxRows: honored(), + ProxyCapWatch: honored(), ProxyCapRepo: honored(), + }, + ProxyModeProxied: { + ProxyCapReadonly: refused("proxy.readonly.unsupported", "strict readonly is unavailable for dolt proxied-server backend; refusing to open a store that cannot guarantee mutation-free access"), + ProxyCapMaxRows: refused("proxy.max_rows.unsupported", "--max-rows / BEADS_MAX_ROWS is not supported in proxied-server mode"), + ProxyCapWatch: refused("proxy.watch.unsupported", "watch mode not supported in proxied-server mode"), + ProxyCapRepo: refused("proxy.repo.unsupported", "--repo is not supported with --proxied-server"), + }, +} + +var proxyCommandCapabilities = map[string]map[ProxyMode]map[ProxyCapability]proxyCapabilityRule{ + "show": {ProxyModeProxied: {ProxyCapWatch: refused("proxy.watch.unsupported", "watch mode not supported in proxied-server mode")}}, + "list": {ProxyModeProxied: {ProxyCapWatch: honored(), ProxyCapMaxRows: honored(), ProxyCapRepo: notApplicable()}}, + "dep tree": {ProxyModeProxied: {ProxyCapMaxRows: honored()}}, + "ready": {ProxyModeProxied: {ProxyCapMaxRows: refused("proxy.max_rows.unsupported", "--max-rows / BEADS_MAX_ROWS is not supported in proxied-server mode")}}, + "graph": {ProxyModeProxied: {ProxyCapMaxRows: refused("proxy.max_rows.unsupported", "--max-rows / BEADS_MAX_ROWS is not supported in proxied-server mode")}}, + "find-duplicates": {ProxyModeProxied: {ProxyCapMaxRows: refused("proxy.max_rows.unsupported", "--max-rows / BEADS_MAX_ROWS is not supported in proxied-server mode")}}, +} + +// proxyCapabilityRows materializes the policy for every supported proxied +// topology. Keeping rows explicit makes matrix audits and front-door tests +// deterministic even though the current provider implementations share rules. +var proxyCapabilityRows = buildProxyCapabilityRows() + +func buildProxyCapabilityRows() []ProxyCapabilityRow { + topologies := []ProxyTopology{ProxyTopologyManagedLocal, ProxyTopologyExternalTCP, ProxyTopologyExternalUnix} + var rows []ProxyCapabilityRow + for _, topology := range topologies { + for _, capability := range []ProxyCapability{ProxyCapReadonly, ProxyCapMaxRows, ProxyCapWatch, ProxyCapRepo} { + rule, _ := LookupProxyCapability(ProxyModeProxied, capability) + rows = append(rows, ProxyCapabilityRow{ProxyCapabilityKey{"", string(capability), ProxyModeProxied, topology}, rule}) + } + for command, modes := range proxyCommandCapabilities { + for mode, capabilities := range modes { + for capability, rule := range capabilities { + rows = append(rows, ProxyCapabilityRow{ProxyCapabilityKey{command, string(capability), mode, topology}, rule}) + } + } + } + } + return rows +} + +// LookupProxyCapabilityAt returns a topology-keyed rule. Unknown topology is +// rejected; ProxyTopologyAny applies the topology-independent direct policy. +func LookupProxyCapabilityAt(command, argument string, mode ProxyMode, topology ProxyTopology) (proxyCapabilityRule, bool) { + if topology != ProxyTopologyAny && topology != ProxyTopologyManagedLocal && topology != ProxyTopologyExternalTCP && topology != ProxyTopologyExternalUnix { + return proxyCapabilityRule{}, false + } + if len(argument) > 2 && argument[:2] == "--" { + argument = argument[2:] + } + for _, row := range proxyCapabilityRows { + if row.Command == command && row.Argument == argument && row.Mode == mode && row.Topology == topology { + return row.Rule, true + } + } + if topology == ProxyTopologyAny { + return LookupProxyCapabilityFor(command, argument, mode) + } + return proxyCapabilityRule{}, false +} + +// LookupProxyCapability returns the typed rule for a mode/capability pair. +func LookupProxyCapability(mode ProxyMode, capability ProxyCapability) (proxyCapabilityRule, bool) { + rules, ok := proxyCapabilityMatrix[mode] + if !ok { + return proxyCapabilityRule{}, false + } + rule, ok := rules[capability] + return rule, ok +} + +// AssertProxyCapability rejects unsupported features before provider setup. +func AssertProxyCapability(mode ProxyMode, capability ProxyCapability) error { + return AssertProxyCommandCapability("", mode, capability) +} + +// AssertProxyCommandCapability checks a command-specific capability rule. +func AssertProxyCommandCapability(command string, mode ProxyMode, capability ProxyCapability) error { + if commands, ok := proxyCommandCapabilities[command]; ok { + if modes, ok := commands[mode]; ok { + if rule, ok := modes[capability]; ok { + // N/A means the command has no such flag, which is not a + // refusal. Without it, a future assert call site on an N/A row + // would return a non-nil error carrying an empty message. + if rule.Outcome == ProxyOutcomeHonored || rule.Outcome == ProxyOutcomeDelegated || rule.Outcome == ProxyOutcomeNA { + return nil + } + if rule.Code != "" { + return &ProxyCapabilityError{Code: rule.Code, Message: rule.Message, ExitCode: rule.ExitCode, Mutates: rule.Mutates} + } + return fmt.Errorf("%s", rule.Message) + } + } + } + rule, ok := LookupProxyCapability(mode, capability) + if !ok || (rule.Outcome != ProxyOutcomeHonored && rule.Outcome != ProxyOutcomeDelegated) { + if rule.Code != "" { + return &ProxyCapabilityError{Code: rule.Code, Message: rule.Message, ExitCode: rule.ExitCode, Mutates: rule.Mutates} + } + if rule.Message != "" { + return fmt.Errorf("%s", rule.Message) + } + return fmt.Errorf("%s is not supported in %s mode", capability, mode) + } + return nil +} + +// validateProxyCapabilitiesBeforeProvider runs refusals that can be decided +// from argv before the proxied provider is opened. +func validateProxyCapabilitiesBeforeProvider(cmd *cobra.Command) error { + if cmd == nil { + return nil + } + name := cmd.Name() + if name == "create" && cmd.Flags().Changed("repo") { + return HandleProxyCapabilityError(AssertProxyCapability(ProxyModeProxied, ProxyCapRepo)) + } + if name == "show" { + if watch, _ := cmd.Flags().GetBool("watch"); watch { + return HandleProxyCapabilityError(AssertProxyCommandCapability("show", ProxyModeProxied, ProxyCapWatch)) + } + } + if name == "ready" { + maxRows, _, err := resolveMaxRows(cmd) + if err != nil { + return err + } + if maxRows > 0 { + return HandleProxyCapabilityError(AssertProxyCommandCapability(name, ProxyModeProxied, ProxyCapMaxRows)) + } + } + if name == "graph" || name == "find-duplicates" { + maxRows, _, err := resolveMaxRows(cmd) + if err != nil { + return err + } + if maxRows > 0 { + return HandleProxyCapabilityError(AssertProxyCommandCapability(name, ProxyModeProxied, ProxyCapMaxRows)) + } + } + return nil +} diff --git a/cmd/bd/proxy_capability_test.go b/cmd/bd/proxy_capability_test.go new file mode 100644 index 000000000..80308e292 --- /dev/null +++ b/cmd/bd/proxy_capability_test.go @@ -0,0 +1,271 @@ +package main + +import ( + "bytes" + "encoding/json" + "errors" + "os" + "strings" + "testing" + + "github.com/spf13/cobra" +) + +func TestProxyCapabilityMatrix(t *testing.T) { + for _, cap := range []ProxyCapability{ProxyCapReadonly, ProxyCapMaxRows} { + err := AssertProxyCapability(ProxyModeProxied, cap) + if err == nil { + t.Errorf("%s unexpectedly honored", cap) + } + var typed *ProxyCapabilityError + if !errors.As(err, &typed) || typed.Code == "" || typed.ExitCode != 1 || typed.Mutates { + t.Errorf("%s error = %#v, want stable non-mutating refusal", cap, err) + } + } + for _, tc := range []struct { + cap ProxyCapability + want string + }{ + {ProxyCapWatch, "watch mode not supported in proxied-server mode"}, + {ProxyCapRepo, "--repo is not supported with --proxied-server"}, + } { + err := AssertProxyCapability(ProxyModeProxied, tc.cap) + if err == nil || err.Error() != tc.want { + t.Errorf("%s error = %v, want %q", tc.cap, err, tc.want) + } + } +} + +func TestProxyCapabilityRowsCoverTopologies(t *testing.T) { + for _, topology := range []ProxyTopology{ProxyTopologyManagedLocal, ProxyTopologyExternalTCP, ProxyTopologyExternalUnix} { + for _, arg := range []string{"--readonly", "--max-rows", "--watch", "--repo"} { + if _, ok := LookupProxyCapabilityAt("", arg, ProxyModeProxied, topology); !ok { + t.Errorf("missing proxied row topology=%s argument=%s", topology, arg) + } + } + } +} + +func TestProxyCapabilityCommandRows(t *testing.T) { + cases := []struct { + command, argument string + outcome ProxyCapabilityOutcome + }{ + {"list", "--max-rows", ProxyOutcomeHonored}, + {"dep tree", "--max-rows", ProxyOutcomeHonored}, + {"ready", "--max-rows", ProxyOutcomeRefused}, + {"graph", "--max-rows", ProxyOutcomeRefused}, + {"find-duplicates", "--max-rows", ProxyOutcomeRefused}, + {"show", "--watch", ProxyOutcomeRefused}, + {"list", "--watch", ProxyOutcomeHonored}, + } + for _, topology := range []ProxyTopology{ProxyTopologyManagedLocal, ProxyTopologyExternalTCP, ProxyTopologyExternalUnix} { + for _, tc := range cases { + rule, ok := LookupProxyCapabilityAt(tc.command, tc.argument, ProxyModeProxied, topology) + if !ok || rule.Outcome != tc.outcome { + t.Errorf("topology=%s %s %s outcome=%q ok=%v, want %q", topology, tc.command, tc.argument, rule.Outcome, ok, tc.outcome) + } + } + } +} + +func TestProxyMaintenanceNestedPathsRefuseBeforeProvider(t *testing.T) { + oldJSON := jsonOutput + jsonOutput = true + t.Cleanup(func() { jsonOutput = oldJSON }) + for _, path := range []string{"backup init", "backup status", "migrate sync", "gate discover"} { + parts := strings.Split(path, " ") + root := &cobra.Command{Use: "bd"} + parent := &cobra.Command{Use: parts[0]} + child := &cobra.Command{Use: parts[1]} + root.AddCommand(parent) + parent.AddCommand(child) + out := captureStdout(t, func() error { + _ = validateProxyMaintenanceBeforeProvider(child) + return nil + }) + if !strings.Contains(out, `"code":`) { + t.Errorf("%s produced no typed refusal: %s", path, out) + } + } +} + +func TestProxyFormulaSwarmMergeSlotRefusals(t *testing.T) { + for _, path := range []string{"cook", "ship", "swarm create", "swarm list", "merge-slot create", "merge-slot check", "merge-slot acquire", "merge-slot release"} { + parts := strings.Split(path, " ") + root := &cobra.Command{Use: "bd"} + cmd := &cobra.Command{Use: parts[0]} + root.AddCommand(cmd) + for _, childName := range parts[1:] { + child := &cobra.Command{Use: childName} + cmd.AddCommand(child) + cmd = child + } + err := validateProxyMaintenanceBeforeProvider(cmd) + if err == nil { + t.Fatalf("%s unexpectedly allowed", path) + } + if code, ok := exitCodeFromError(err); !ok || code != 1 { + t.Fatalf("%s exit=%v, want 1", path, err) + } + } +} + +func TestProxyWorkflowRefusalContractAndNoMutation(t *testing.T) { + cases := []struct { + path, code, message string + }{ + {"cook", "proxy.formula.unsupported", "cook is not supported in proxied-server mode"}, + {"ship", "proxy.formula.unsupported", "ship is not supported in proxied-server mode"}, + {"swarm create", "proxy.swarm.unsupported", "swarm create is not supported in proxied-server mode"}, + {"merge-slot acquire", "proxy.merge_slot.unsupported", "merge-slot acquire is not supported in proxied-server mode"}, + } + for _, tc := range cases { + t.Run(tc.path, func(t *testing.T) { + parts := strings.Split(tc.path, " ") + root := &cobra.Command{Use: "bd"} + cmd := &cobra.Command{Use: parts[0]} + root.AddCommand(cmd) + if tc.path == "cook" { + cmd.Flags().Bool("persist", false, "") + _ = cmd.Flags().Set("persist", "true") + } + for _, name := range parts[1:] { + child := &cobra.Command{Use: name} + cmd.AddCommand(child) + cmd = child + } + row, ok := lookupProxyMaintenanceRuleForTest(tc.path) + if !ok || row.Code != tc.code || row.Message != tc.message || row.ExitCode != 1 || row.Mutates { + t.Fatalf("row = %#v, ok=%v", row, ok) + } + var typed *ProxyCapabilityError = &ProxyCapabilityError{Code: row.Code, Message: row.Message, ExitCode: row.ExitCode, Mutates: row.Mutates} + if typed.Code != tc.code || typed.Message != tc.message || typed.ExitCode != 1 || typed.Mutates { + t.Fatalf("typed refusal = %#v", typed) + } + dir := t.TempDir() + before := []byte("unchanged\n") + for _, name := range []string{"issues.jsonl", "config.yaml", "events.jsonl"} { + if err := os.WriteFile(dir+"/"+name, before, 0o600); err != nil { + t.Fatal(err) + } + } + oldProvider := uowProvider + uowProvider = nil + t.Cleanup(func() { uowProvider = oldProvider }) + oldJSON := jsonOutput + jsonOutput = true + t.Cleanup(func() { jsonOutput = oldJSON }) + // commandDidWrite is a process-wide latch that any earlier test in + // this package may already have set, so it has to be baselined + // here or the assertion below reports another test's write. + oldDidWrite := commandDidWrite.Load() + commandDidWrite.Store(false) + t.Cleanup(func() { commandDidWrite.Store(oldDidWrite) }) + out := captureStdout(t, func() error { _ = validateProxyMaintenanceBeforeProvider(cmd); return nil }) + var got map[string]any + if err := json.Unmarshal([]byte(out), &got); err != nil || got["code"] != tc.code || got["error"] != tc.message { + t.Fatalf("JSON refusal = %q (%v)", out, err) + } + if uowProvider != nil || commandDidWrite.Load() { + t.Fatal("refusal initialized provider or marked a write") + } + for _, name := range []string{"issues.jsonl", "config.yaml", "events.jsonl"} { + gotBytes, err := os.ReadFile(dir + "/" + name) + if err != nil || !bytes.Equal(gotBytes, before) { + t.Fatalf("%s mutated: %v", name, err) + } + } + }) + } +} + +func lookupProxyMaintenanceRuleForTest(path string) (proxyCapabilityRule, bool) { + rule, ok := proxyMaintenanceRefusals[path] + return rule, ok +} + +func TestProxyMaintenanceRefusalLeavesFilesUntouched(t *testing.T) { + root := &cobra.Command{Use: "bd"} + migrate := &cobra.Command{Use: "migrate"} + hooks := &cobra.Command{Use: "hooks"} + root.AddCommand(migrate) + migrate.AddCommand(hooks) + before := []byte("hooks-state") + path := t.TempDir() + "/.local_version" + if err := os.WriteFile(path, before, 0600); err != nil { + t.Fatal(err) + } + oldProvider := uowProvider + uowProvider = nil + t.Cleanup(func() { uowProvider = oldProvider }) + err := validateProxyMaintenanceBeforeProvider(hooks) + if err == nil { + t.Fatal("expected typed maintenance refusal") + } + if code, ok := exitCodeFromError(err); !ok || code != 1 { + t.Fatalf("exit = %v, want 1", err) + } + after, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(after, before) { + t.Fatalf("refusal mutated %s", path) + } +} + +func TestProxyCapabilityRefusalFrontDoorTextBeforeProvider(t *testing.T) { + oldJSON := jsonOutput + jsonOutput = false + t.Cleanup(func() { jsonOutput = oldJSON }) + cmd := &cobra.Command{Use: "show"} + cmd.Flags().Bool("watch", false, "") + if err := cmd.Flags().Set("watch", "true"); err != nil { + t.Fatal(err) + } + got := captureStderr(t, func() { _ = validateProxyCapabilitiesBeforeProvider(cmd) }) + if !strings.Contains(got, "watch mode not supported in proxied-server mode") { + t.Fatalf("text refusal = %q", got) + } +} + +func TestProxyCapabilityRefusalFrontDoorJSONIncludesCode(t *testing.T) { + oldJSON := jsonOutput + jsonOutput = true + t.Cleanup(func() { jsonOutput = oldJSON }) + cmd := &cobra.Command{Use: "show"} + cmd.Flags().Bool("watch", false, "") + _ = cmd.Flags().Set("watch", "true") + out := captureStdout(t, func() error { + _ = validateProxyCapabilitiesBeforeProvider(cmd) + return nil + }) + if !strings.Contains(out, `"code": "proxy.watch.unsupported"`) { + t.Fatalf("JSON refusal = %q", out) + } +} + +func TestProxyCapabilityRefusalDoesNotNeedProvider(t *testing.T) { + oldProvider := uowProvider + uowProvider = nil + t.Cleanup(func() { uowProvider = oldProvider }) + oldJSON := jsonOutput + jsonOutput = true + t.Cleanup(func() { jsonOutput = oldJSON }) + out := captureStdout(t, func() error { + _ = runCreateProxiedServer(nil, t.Context(), createInput{repoOverrideSet: true}) + return nil + }) + if !strings.Contains(out, `"code": "proxy.repo.unsupported"`) { + t.Fatalf("refusal = %q", out) + } +} + +func TestProxyCapabilityDirectEscapeHatch(t *testing.T) { + for _, cap := range []ProxyCapability{ProxyCapReadonly, ProxyCapMaxRows, ProxyCapWatch, ProxyCapRepo} { + if err := AssertProxyCapability(ProxyModeDirect, cap); err != nil { + t.Errorf("direct %s refused: %v", cap, err) + } + } +} diff --git a/cmd/bd/ready.go b/cmd/bd/ready.go index 8cf480a82..5d01f97c7 100644 --- a/cmd/bd/ready.go +++ b/cmd/bd/ready.go @@ -59,25 +59,11 @@ This is useful for agents executing molecules to see which steps can run next.`, } if usesProxiedServer() { - // --claim consumes exactly one row, same reasoning as the - // direct-path fix in issueops/claim.go: a rig-wide cap sized - // for bulk list/ready reads must not block a single-row claim. - // Only the bulk (non-claim) proxied ready listing rejects an - // active cap. - if !claimReady { - if err := rejectMaxRowsUnderProxiedServer(cmd); err != nil { - return err - } - } else { - // Still validate --max-rows/BEADS_MAX_ROWS here even though - // the resolved cap is ignored below: resolveMaxRows is also - // where a malformed value (e.g. --max-rows -1) is rejected - // with exit 1, and skipping it entirely for the claim-exempt - // branch would silently accept a usage error that every - // other command (direct or proxied) rejects. - if _, _, err := resolveMaxRows(cmd); err != nil { - return err - } + // The proxied ready role cannot enforce a row cap, including on + // --claim. Refuse any positive cap rather than silently dropping + // this safety limit; malformed values remain usage errors. + if err := rejectMaxRowsUnderProxiedServer(cmd); err != nil { + return err } return runReadyProxiedServer(cmd, rootCtx) } diff --git a/cmd/bd/ready_max_rows_proxied_test.go b/cmd/bd/ready_max_rows_proxied_test.go new file mode 100644 index 000000000..30a2faa12 --- /dev/null +++ b/cmd/bd/ready_max_rows_proxied_test.go @@ -0,0 +1,110 @@ +package main + +import ( + "strings" + "testing" +) + +// pinProxiedServerMode routes usesProxiedServer() down the proxied branch for +// the duration of one test. resetCommandContext() is what makes the global +// authoritative: usesProxiedServer prefers cmdCtx whenever an earlier test left +// one behind, so setting the global alone is not enough to pin the route. +func pinProxiedServerMode(t *testing.T) { + t.Helper() + restore := proxiedServerMode + proxiedServerMode = true + resetCommandContext() + t.Cleanup(func() { + proxiedServerMode = restore + resetCommandContext() + }) +} + +// TestReadyRefusesMaxRowsUnderProxiedServerOnClaim pins the --max-rows refusal +// on `bd ready --claim` specifically. +// +// The refusal lives in readyCmd's RunE, above the dispatch into +// runReadyProxiedServer, and --claim is the one ready invocation that takes a +// mutating path on the far side of it. Nothing below that dispatch can enforce +// the cap: runReadyProxiedServer deliberately passes a nil resolver to +// gatherReadyInput, and the proxied claim role never threads MaxRows. So the +// only thing standing between an operator's explicit row cap and a silent +// unbounded claim is this one call, and it is reachable only through RunE -- +// the existing gatherReadyInput coverage sits entirely below it and cannot see +// it at all. +// +// Both cap sources are exercised: resolveMaxRows honors --max-rows and +// BEADS_MAX_ROWS, and a guard wired to only the flag would leave every rig that +// sets the env var running uncapped. +func TestReadyRefusesMaxRowsUnderProxiedServerOnClaim(t *testing.T) { + pinProxiedServerMode(t) + pinJSONOutput(t, false) + + // The regression safety net. If the refusal ever stops firing, RunE falls + // through to runReadyProxiedServer, which hits an uninitialized provider + // and returns its own error rather than dialing a real server -- so the + // stderr assertion below, not the exit code, is what fails. Both errors + // carry exit code 1. + if uowProvider != nil { + t.Fatal("precondition: uowProvider must be nil so a regression cannot open a real proxied connection") + } + + for _, tc := range []struct { + name string + args []string + env string + }{ + {name: "flag", args: []string{"--claim", "--max-rows", "5"}}, + {name: "env", args: []string{"--claim"}, env: "5"}, + } { + t.Run(tc.name, func(t *testing.T) { + t.Setenv(maxRowsEnvVar, tc.env) + + // A cloned flag set, not readyCmd's own: RunE reads its flags off + // the command it is handed, and mutating the shared readyCmd would + // leak --claim into every other test in the package. + cmd := newReadyFlagsCommand(t, tc.args...) + + var err error + stderr := captureStderr(t, func() { err = readyCmd.RunE(cmd, nil) }) + + assertExitCode(t, err, 1) + if !strings.Contains(stderr, "--max-rows / BEADS_MAX_ROWS is not supported in proxied-server mode") { + t.Fatalf("stderr = %q, want the proxied --max-rows refusal", stderr) + } + }) + } +} + +// TestReadyClaimWithoutLiveCapIsNotRefusedUnderProxiedServer is the other half: +// the refusal is conditioned on a live cap, not on --claim. Without it, a guard +// that rejected every proxied --claim would pass the test above. +// +// This one calls the helper directly rather than going through RunE. With +// nothing to refuse, RunE proceeds into the proxied query path, and the +// assertion would then be about whatever that path does next instead of about +// the guard. +func TestReadyClaimWithoutLiveCapIsNotRefusedUnderProxiedServer(t *testing.T) { + pinProxiedServerMode(t) + pinJSONOutput(t, false) + t.Setenv(maxRowsEnvVar, "") + + // --max-rows 0 is an explicit disable that outranks BEADS_MAX_ROWS, so it + // is not a live cap either even with the env var set. + for _, tc := range []struct { + name string + args []string + env string + }{ + {name: "no_cap", args: []string{"--claim"}}, + {name: "flag_zero", args: []string{"--claim", "--max-rows", "0"}}, + {name: "flag_zero_overrides_env", args: []string{"--claim", "--max-rows", "0"}, env: "5"}, + } { + t.Run(tc.name, func(t *testing.T) { + t.Setenv(maxRowsEnvVar, tc.env) + if err := rejectMaxRowsUnderProxiedServer(newReadyFlagsCommand(t, tc.args...)); err != nil { + t.Fatalf("proxied `bd ready %s` was refused with no live cap: %v", strings.Join(tc.args, " "), err) + } + }) + } +} diff --git a/cmd/bd/ready_proxied_integration_test.go b/cmd/bd/ready_proxied_integration_test.go index 2a05403b7..758a62a64 100644 --- a/cmd/bd/ready_proxied_integration_test.go +++ b/cmd/bd/ready_proxied_integration_test.go @@ -667,29 +667,18 @@ func TestProxiedServerReady2(t *testing.T) { t.Errorf("expected BEADS_MAX_ROWS proxied-server rejection for bulk ready, got: %s", out) } + before := bdProxiedReadyJSON(t, bd, p, "--label", "rcmr-claim") stdout, stderr, err = bdProxiedRunBuffersWithEnv(t, bd, p.dir, []string{"BEADS_MAX_ROWS=1"}, "ready", "--claim", "--json", "--label", "rcmr-claim") - if err != nil { - t.Fatalf("bd ready --claim --json under BEADS_MAX_ROWS=1 should succeed: %v\nstdout:\n%s\nstderr:\n%s", err, stdout, stderr) + if err == nil { + t.Fatalf("bd ready --claim --json under BEADS_MAX_ROWS=1 should refuse") } - var claimed []types.IssueWithCounts - s := strings.TrimSpace(stdout) - start := strings.Index(s, "[") - if start < 0 { - t.Fatalf("no JSON array in claim output:\n%s", stdout) + if out := stdout + stderr; !strings.Contains(out, "not supported in proxied-server mode") { + t.Fatalf("expected cap refusal, got:\n%s", out) } - if err := json.Unmarshal([]byte(s[start:]), &claimed); err != nil { - t.Fatalf("parse claim JSON: %v\n%s", err, s[start:]) - } - if len(claimed) != 1 { - t.Fatalf("expected exactly one claimed issue, got %d: %s", len(claimed), stdout) - } - if claimed[0].Status != types.StatusInProgress { - t.Errorf("Status = %s, want %s", claimed[0].Status, types.StatusInProgress) - } - persisted := bdProxiedShow(t, bd, p.dir, claimed[0].ID) - if persisted.Status != types.StatusInProgress || persisted.Assignee == "" { - t.Errorf("persisted claim = %+v, want in_progress with assignee", persisted) + after := bdProxiedReadyJSON(t, bd, p, "--label", "rcmr-claim") + if len(after) != len(before) { + t.Fatalf("claim refusal mutated ready set: before=%d after=%d", len(before), len(after)) } }) } diff --git a/cmd/bd/remote_migrate_gate.go b/cmd/bd/remote_migrate_gate.go index 8df32de44..76076512b 100644 --- a/cmd/bd/remote_migrate_gate.go +++ b/cmd/bd/remote_migrate_gate.go @@ -8,6 +8,16 @@ import ( "github.com/steveyegge/beads/internal/storage/schema" ) +const ( + // remoteBackedDocsURL covers the #4259 migrate-or-adopt decisions: the + // database syncs with a remote and the question is which clone migrates. + remoteBackedDocsURL = "https://github.com/gastownhall/beads/blob/main/docs/getting-started/upgrading.md#remote-backed-databases-and-multiple-clones" + // sharedServersDocsURL covers the #5920 shared-store decisions: one + // database, many clients of one server, and the question is whether they + // are all upgraded. + sharedServersDocsURL = "https://github.com/gastownhall/beads/blob/main/docs/getting-started/upgrading.md#shared-servers" +) + // handleRemoteMigrateGateJSON renders the #4259 remote-migrate gate error as a // structured JSON error block for agent consumption. // @@ -21,12 +31,43 @@ import ( func handleRemoteMigrateGateJSON(e *schema.RemoteMigrateGateError) { outer := buildJSONError(e.Error(), e.AgentDirective()) if m, ok := outer.(map[string]interface{}); ok { + // The shared-no-remote consent verb is the one command in this block + // that is target-scoped: under --global the refused open aimed at + // beads_global, so the project-scoped `bd migrate schema` would consent + // the WRONG database and leave the refusal in place. Mirror the + // human/text path (printGlobalDatabaseConsentHint, + // noticeSharedMigrateRefusal) and name the --global verb when this + // invocation targeted the global database. Only shared-no-remote is + // retargeted; the remote-backed arms coordinate through bd bootstrap / + // bd migrate --force, which --global does not rewrite. + sharedConsent := schema.SharedConsentCommand + if globalFlag { + sharedConsent = schema.SharedConsentCommandGlobal + } + retargetShared := globalFlag && e.Decision == "shared-no-remote" + opts := make([]map[string]interface{}, 0, len(e.Options())) for _, o := range e.Options() { + commands := o.Commands + if retargetShared { + // The runnable command deliberately lives inside the option, not + // in the top-level hint, so an agent that extracts it + // programmatically must get the --global verb too — fixing only + // "expected" would still hand it the wrong-target command. + retargeted := make([]string, len(commands)) + for i, c := range commands { + if c == schema.SharedConsentCommand { + retargeted[i] = schema.SharedConsentCommandGlobal + } else { + retargeted[i] = c + } + } + commands = retargeted + } opts = append(opts, map[string]interface{}{ "id": o.ID, "when": o.When, - "commands": o.Commands, + "commands": commands, "risk": o.Risk, }) } @@ -39,7 +80,7 @@ func handleRemoteMigrateGateJSON(e *schema.RemoteMigrateGateError) { "observed": fmt.Sprintf("%d pending schema migration(s) and a configured remote", e.Pending), "expected": "exactly one designated clone migrates and publishes; every other clone adopts the result", "options": opts, - "docs": "https://github.com/gastownhall/beads/blob/main/docs/getting-started/upgrading.md#remote-backed-databases-and-multiple-clones", + "docs": remoteBackedDocsURL, } // Smart gate (#4516): when a state-aware decision narrowed the stop, // tell the agent which case it is and (for a fork) which versions skewed. @@ -48,6 +89,26 @@ func handleRemoteMigrateGateJSON(e *schema.RemoteMigrateGateError) { gate["decision"] = "adopt" gate["observed"] = "the remote is already migrated; migrating here would fork it" gate["expected"] = "adopt the remote's migrated database (destructive re-clone — operator decision)" + case "shared-no-remote": + // #5920: no remote at all, so the migrate-or-adopt framing above + // does not apply — there is one shared copy and the only question + // is whether every client of it is upgraded. The base docs link + // goes with that framing, so it has to move too: an agent + // following it would brief the operator on designated-migrator + // and bd bootstrap coordination that does not exist here. + gate["decision"] = "shared-no-remote" + gate["observed"] = fmt.Sprintf("%d pending schema migration(s) on a shared server database, no consent", e.Pending) + gate["expected"] = "operator upgrades co-resident clients, then consents once via " + sharedConsent + gate["docs"] = sharedServersDocsURL + case "adopt-ff": + // A strict refinement of adopt, and on a shared store now a + // routine outcome rather than something auto-executed — so it + // needs its own tailoring instead of inheriting the default + // "exactly one designated clone migrates and publishes", which + // contradicts the adopt-only options this decision carries. + gate["decision"] = "adopt-ff" + gate["observed"] = "the remote is already migrated and this clone can fast-forward to it losslessly (no unpushed commits, clean working set)" + gate["expected"] = "adopt the remote's migrated database; nothing local is discarded" case "fork-skew": gate["decision"] = "fork-skew" gate["observed"] = fmt.Sprintf("this clone and the remote applied different content for migration(s) %s — already forked", schema.FormatMigrationVersions(e.SkewVersions)) diff --git a/cmd/bd/remote_migrate_gate_test.go b/cmd/bd/remote_migrate_gate_test.go index bd92b9865..369425fb2 100644 --- a/cmd/bd/remote_migrate_gate_test.go +++ b/cmd/bd/remote_migrate_gate_test.go @@ -3,8 +3,11 @@ package main import ( "bytes" "encoding/json" + "errors" + "fmt" "io" "os" + "strings" "testing" "github.com/steveyegge/beads/internal/storage/schema" @@ -166,3 +169,200 @@ func TestHandleRemoteMigrateGateJSON_FallbackReason(t *testing.T) { } }) } + +// TestHandleRemoteMigrateGateJSON_SharedNoRemote covers the shared-store +// refusal's agent-facing block (gastownhall/beads#5920). It is deliberately +// NOT the migrate-or-adopt shape: with no remote there is nothing to adopt +// from, so the only option is "migrate once the fleet is upgraded", and the +// runnable command stays inside that conditional option. +func TestHandleRemoteMigrateGateJSON_SharedNoRemote(t *testing.T) { + gate := &schema.RemoteMigrateGateError{ + CurrentVersion: 53, LatestVersion: 66, Pending: 13, + Decision: "shared-no-remote", + } + + origStderr := os.Stderr + r, w, pipeErr := os.Pipe() + if pipeErr != nil { + t.Fatal(pipeErr) + } + os.Stderr = w + defer func() { os.Stderr = origStderr }() + handleRemoteMigrateGateJSON(gate) + _ = w.Close() + + var buf bytes.Buffer + if _, err := io.Copy(&buf, r); err != nil { + t.Fatal(err) + } + _ = r.Close() + + var parsed map[string]interface{} + if err := json.Unmarshal(buf.Bytes(), &parsed); err != nil { + t.Fatalf("json.Unmarshal stderr: %v\nstderr was: %s", err, buf.String()) + } + if parsed["hint"] == gate.EscapeHint() { + t.Errorf("hint must not be the runnable escape command %q (agent footgun)", gate.EscapeHint()) + } + + obj, ok := parsed["remote_migrate_gate"].(map[string]interface{}) + if !ok { + t.Fatalf("remote_migrate_gate key missing or wrong type: %T", parsed["remote_migrate_gate"]) + } + if got, _ := obj["decision"].(string); got != "shared-no-remote" { + t.Errorf("decision = %v, want \"shared-no-remote\"", obj["decision"]) + } + if got, _ := obj["observed"].(string); !strings.Contains(got, "shared server database") { + t.Errorf("observed = %q, want the shared-server framing", got) + } + if got, _ := obj["expected"].(string); !strings.Contains(got, "bd migrate schema") { + t.Errorf("expected = %q, want the consent verb", got) + } + if _, ok := obj["fallback_reason"]; ok { + t.Errorf("a tailored decision must not carry fallback_reason, got %v", obj["fallback_reason"]) + } + + rawOpts, ok := obj["options"].([]interface{}) + if !ok || len(rawOpts) != 1 { + t.Fatalf("options = %v, want exactly one (no adopt path without a remote)", obj["options"]) + } + o, _ := rawOpts[0].(map[string]interface{}) + if id, _ := o["id"].(string); id != "migrate-shared" { + t.Errorf("option id = %v, want \"migrate-shared\"", o["id"]) + } + if o["when"] == nil || o["risk"] == nil { + t.Errorf("migrate-shared option missing when/risk: %v", o) + } + cmds, _ := o["commands"].([]interface{}) + if len(cmds) != 1 || cmds[0] != "bd migrate schema" { + t.Errorf("commands = %v, want [\"bd migrate schema\"]", cmds) + } +} + +// TestHandleRemoteMigrateGateJSON_SharedNoRemoteGlobal covers the shared-store +// refusal's agent-facing block when the refused open targeted the global +// database (--global). The consent verb is target-scoped: the project-scoped +// `bd migrate schema` would consent the WRONG database and leave the refusal in +// place, so both the top-level "expected" directive and the runnable +// migrate-shared option command must name `bd migrate schema --global` +// (gastownhall/beads#5920), at parity with the human/text path +// (TestPrintGlobalDatabaseConsentHint). The --json notice self-suppresses, so +// this block is the sole channel for a --json consumer. +func TestHandleRemoteMigrateGateJSON_SharedNoRemoteGlobal(t *testing.T) { + origGlobal := globalFlag + globalFlag = true + defer func() { globalFlag = origGlobal }() + + gate := &schema.RemoteMigrateGateError{ + CurrentVersion: 53, LatestVersion: 66, Pending: 13, + Decision: "shared-no-remote", + } + + origStderr := os.Stderr + r, w, pipeErr := os.Pipe() + if pipeErr != nil { + t.Fatal(pipeErr) + } + os.Stderr = w + defer func() { os.Stderr = origStderr }() + handleRemoteMigrateGateJSON(gate) + _ = w.Close() + + var buf bytes.Buffer + if _, err := io.Copy(&buf, r); err != nil { + t.Fatal(err) + } + _ = r.Close() + + var parsed map[string]interface{} + if err := json.Unmarshal(buf.Bytes(), &parsed); err != nil { + t.Fatalf("json.Unmarshal stderr: %v\nstderr was: %s", err, buf.String()) + } + + obj, ok := parsed["remote_migrate_gate"].(map[string]interface{}) + if !ok { + t.Fatalf("remote_migrate_gate key missing or wrong type: %T", parsed["remote_migrate_gate"]) + } + if got, _ := obj["decision"].(string); got != "shared-no-remote" { + t.Errorf("decision = %v, want \"shared-no-remote\"", obj["decision"]) + } + // Under --global the top-level directive must name the --global consent verb. + if got, _ := obj["expected"].(string); !strings.Contains(got, schema.SharedConsentCommandGlobal) { + t.Errorf("expected = %q, want the --global consent verb %q", got, schema.SharedConsentCommandGlobal) + } + + rawOpts, ok := obj["options"].([]interface{}) + if !ok || len(rawOpts) != 1 { + t.Fatalf("options = %v, want exactly one (no adopt path without a remote)", obj["options"]) + } + o, _ := rawOpts[0].(map[string]interface{}) + if id, _ := o["id"].(string); id != "migrate-shared" { + t.Errorf("option id = %v, want \"migrate-shared\"", o["id"]) + } + // The runnable command inside the option must be the --global verb too: an + // agent extracts the command from here, not from the prose directive. + cmds, _ := o["commands"].([]interface{}) + if len(cmds) != 1 || cmds[0] != schema.SharedConsentCommandGlobal { + t.Errorf("commands = %v, want [%q]", cmds, schema.SharedConsentCommandGlobal) + } +} + +// TestRenderTypedOpenError pins the rendering every store-open path depends +// on: the Dolt store open, the proxied unit-of-work provider open, and +// `bd serve`'s startup all call it, and all three must produce the whole +// actionable block rather than a one-line `%v`. A gate refusal at `bd serve` +// startup is the case with no operator watching, so the daemon's log is the +// only place the remediation can appear. +func TestRenderTypedOpenError(t *testing.T) { + capture := func(fn func() bool) (string, bool) { + origStderr := os.Stderr + r, w, pipeErr := os.Pipe() + if pipeErr != nil { + t.Fatal(pipeErr) + } + os.Stderr = w + handled := fn() + _ = w.Close() + os.Stderr = origStderr + + var buf bytes.Buffer + if _, err := io.Copy(&buf, r); err != nil { + t.Fatal(err) + } + _ = r.Close() + return buf.String(), handled + } + + t.Run("shared-store gate refusal renders the full block", func(t *testing.T) { + gate := &schema.RemoteMigrateGateError{ + CurrentVersion: 53, LatestVersion: 66, Pending: 13, + Decision: "shared-no-remote", + } + out, handled := capture(func() bool { + return renderTypedOpenError(fmt.Errorf("uow: init schema: %w", gate)) + }) + if !handled { + t.Fatal("renderTypedOpenError = false, want true for a wrapped gate refusal") + } + if out != gate.UserMessage() { + t.Errorf("rendered output is not the full UserMessage:\n%s", out) + } + for _, want := range []string{"co-resident", "bd migrate schema", "Read commands keep working"} { + if !strings.Contains(out, want) { + t.Errorf("output missing %q:\n%s", want, out) + } + } + }) + + t.Run("an ordinary error is left to the caller", func(t *testing.T) { + out, handled := capture(func() bool { + return renderTypedOpenError(errors.New("connection refused")) + }) + if handled { + t.Error("renderTypedOpenError = true, want false for an untyped error") + } + if out != "" { + t.Errorf("nothing should be printed for an untyped error, got:\n%s", out) + } + }) +} diff --git a/cmd/bd/removed_backend_heal_embedded_test.go b/cmd/bd/removed_backend_heal_embedded_test.go new file mode 100644 index 000000000..9f8eacbb5 --- /dev/null +++ b/cmd/bd/removed_backend_heal_embedded_test.go @@ -0,0 +1,282 @@ +//go:build cgo + +package main + +import ( + "bytes" + "encoding/json" + "fmt" + "os" + "os/exec" + "path/filepath" + "sort" + "strings" + "testing" + + "github.com/steveyegge/beads/internal/configfile" + "github.com/steveyegge/beads/internal/types" +) + +// setLegacyBackend rewrites metadata.json's "backend" field the way a stale +// pre-rollback workspace carries it, preserving every other field. +func setLegacyBackend(t *testing.T, beadsDir, backend string) { + t.Helper() + path := filepath.Join(beadsDir, configfile.ConfigFileName) + raw, err := os.ReadFile(path) // #nosec G304 -- test-controlled path + if err != nil { + t.Fatalf("read metadata.json: %v", err) + } + var fields map[string]any + if err := json.Unmarshal(raw, &fields); err != nil { + t.Fatalf("parse metadata.json: %v", err) + } + fields["backend"] = backend + updated, err := json.MarshalIndent(fields, "", " ") + if err != nil { + t.Fatalf("encode metadata.json: %v", err) + } + if err := os.WriteFile(path, updated, 0o600); err != nil { + t.Fatalf("write metadata.json: %v", err) + } +} + +// snapshotTree records the relative path and size of every file beneath root, so +// a test can prove a rejected command neither opened nor grew the Dolt database. +func snapshotTree(t *testing.T, root string) map[string]int64 { + t.Helper() + tree := map[string]int64{} + err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + rel, relErr := filepath.Rel(root, path) + if relErr != nil { + return relErr + } + if info.IsDir() { + tree[rel+"/"] = 0 + return nil + } + tree[rel] = info.Size() + return nil + }) + if err != nil { + t.Fatalf("walk %s: %v", root, err) + } + return tree +} + +// beadsDirEntries lists the names directly under .beads, skipping the advisory +// workspace-gate lock files bd creates before it reaches the backend check. +// Those are not storage, and they are the only entries a rejected run may add. +func beadsDirEntries(t *testing.T, beadsDir string) []string { + t.Helper() + entries, err := os.ReadDir(beadsDir) + if err != nil { + t.Fatalf("read %s: %v", beadsDir, err) + } + var names []string + for _, entry := range entries { + if strings.Contains(entry.Name(), ".gate.lock") { + continue + } + names = append(names, entry.Name()) + } + sort.Strings(names) + return names +} + +// runBDExpectingRejection runs bd in dir and requires it to exit 1 (the +// documented removed-backend exit code), returning the combined output. +func runBDExpectingRejection(t *testing.T, bd, dir string, args ...string) string { + t.Helper() + cmd := exec.Command(bd, args...) + cmd.Dir = dir + cmd.Env = bdEnv(dir) + out, err := cmd.CombinedOutput() + if err == nil { + t.Fatalf("bd %s unexpectedly succeeded:\n%s", strings.Join(args, " "), out) + } + exitErr, ok := err.(*exec.ExitError) + if !ok { + t.Fatalf("bd %s failed without an exit status: %v\n%s", strings.Join(args, " "), err, out) + } + if code := exitErr.ExitCode(); code != 1 { + t.Fatalf("bd %s exit code = %d, want 1\n%s", strings.Join(args, " "), code, out) + } + return string(out) +} + +// TestRemovedBackendHealRoundTrip is the headline D-8 test: a workspace whose +// metadata.json picked up a stale legacy "backend" value still holds its Dolt +// database, so the rejection must name the exact edit that heals it — and +// following that edit verbatim must make the workspace open again with its +// issues intact. Before D-8 the message sent this user to export the data with +// an old bd release and reinitialize, destroying a live database. +func TestRemovedBackendHealRoundTrip(t *testing.T) { + if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" { + t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests") + } + + bd := buildEmbeddedBD(t) + dir, beadsDir, _ := bdInit(t, bd, "--prefix", "heal") + created := bdCreate(t, bd, dir, "issue that must survive the rejection", "--type", "task") + + doltDir := filepath.Join(beadsDir, "embeddeddolt") + setLegacyBackend(t, beadsDir, configfile.BackendSQLite) + + metadataPath := filepath.Join(beadsDir, configfile.ConfigFileName) + metadataBefore, err := os.ReadFile(metadataPath) // #nosec G304 -- test-controlled path + if err != nil { + t.Fatalf("read metadata.json: %v", err) + } + doltBefore := snapshotTree(t, doltDir) + entriesBefore := beadsDirEntries(t, beadsDir) + + out := runBDExpectingRejection(t, bd, dir, "list", "--json") + for _, want := range []string{ + "no longer supported", + metadataPath, + `"backend": "sqlite"`, + `"backend": "dolt"`, + doltDir, + configfile.BackendNotOpenedGuarantee, + } { + if !strings.Contains(out, want) { + t.Errorf("rejection missing %q:\n%s", want, out) + } + } + if strings.Contains(strings.ToLower(out), "export") { + t.Errorf("rejection offered the destructive export path for a workspace with live Dolt data:\n%s", out) + } + + // Fail-closed means exactly that: the refusal read the workspace and wrote + // nothing — not the metadata that named the wrong backend, not the database. + metadataAfter, err := os.ReadFile(metadataPath) // #nosec G304 -- test-controlled path + if err != nil { + t.Fatalf("read metadata.json after rejection: %v", err) + } + if !bytes.Equal(metadataAfter, metadataBefore) { + t.Errorf("rejection rewrote metadata.json:\nbefore:\n%s\nafter:\n%s", metadataBefore, metadataAfter) + } + if diff := treeDiff(doltBefore, snapshotTree(t, doltDir)); diff != "" { + t.Errorf("rejection touched the Dolt database:\n%s", diff) + } + if got := beadsDirEntries(t, beadsDir); !equalStrings(got, entriesBefore) { + t.Errorf("rejection added workspace entries: before %v, after %v", entriesBefore, got) + } + if _, statErr := os.Stat(filepath.Join(beadsDir, "beads.db")); !os.IsNotExist(statErr) { + t.Errorf("rejection provisioned a SQLite database (stat error: %v)", statErr) + } + + // Now apply exactly the edit the message prescribes. + setLegacyBackend(t, beadsDir, configfile.BackendDolt) + issues := bdListJSON(t, bd, dir) + if !containsIssue(issues, created.ID) { + t.Fatalf("after the prescribed heal, bd list does not show %s: %+v", created.ID, issues) + } + + // The message's stated alternative — dropping the field entirely — must work + // just as well, since Dolt is the default. + removeBackendField(t, beadsDir) + issues = bdListJSON(t, bd, dir) + if !containsIssue(issues, created.ID) { + t.Fatalf("after deleting the backend field, bd list does not show %s: %+v", created.ID, issues) + } +} + +// TestRemovedBackendHealRejectionPerBackend proves every removed-backend +// tombstone — not just sqlite — reaches the heal message when Dolt data is +// present. Only sqlite runs the full round-trip above; here we pin the rejection. +func TestRemovedBackendHealRejectionPerBackend(t *testing.T) { + if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" { + t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests") + } + + bd := buildEmbeddedBD(t) + for _, backend := range []string{configfile.BackendPostgres, configfile.BackendMySQL} { + t.Run(backend, func(t *testing.T) { + dir, beadsDir, _ := bdInit(t, bd, "--prefix", "hl"+backend[:2]) + setLegacyBackend(t, beadsDir, backend) + + out := runBDExpectingRejection(t, bd, dir, "list", "--json") + for _, want := range []string{ + "no longer supported", + filepath.Join(beadsDir, configfile.ConfigFileName), + fmt.Sprintf(`"backend": %q`, backend), + `"backend": "dolt"`, + configfile.BackendNotOpenedGuarantee, + } { + if !strings.Contains(out, want) { + t.Errorf("%s rejection missing %q:\n%s", backend, want, out) + } + } + if strings.Contains(strings.ToLower(out), "export") { + t.Errorf("%s rejection offered the destructive export path despite live Dolt data:\n%s", backend, out) + } + }) + } +} + +// removeBackendField deletes the "backend" key from metadata.json, the +// alternative the heal message offers. +func removeBackendField(t *testing.T, beadsDir string) { + t.Helper() + path := filepath.Join(beadsDir, configfile.ConfigFileName) + raw, err := os.ReadFile(path) // #nosec G304 -- test-controlled path + if err != nil { + t.Fatalf("read metadata.json: %v", err) + } + var fields map[string]any + if err := json.Unmarshal(raw, &fields); err != nil { + t.Fatalf("parse metadata.json: %v", err) + } + delete(fields, "backend") + updated, err := json.MarshalIndent(fields, "", " ") + if err != nil { + t.Fatalf("encode metadata.json: %v", err) + } + if err := os.WriteFile(path, updated, 0o600); err != nil { + t.Fatalf("write metadata.json: %v", err) + } +} + +func containsIssue(issues []*types.IssueWithCounts, id string) bool { + for _, issue := range issues { + if issue != nil && issue.Issue != nil && issue.Issue.ID == id { + return true + } + } + return false +} + +func equalStrings(a, b []string) bool { + if len(a) != len(b) { + return false + } + for i := range a { + if a[i] != b[i] { + return false + } + } + return true +} + +// treeDiff describes how two snapshots differ, or "" when they match. +func treeDiff(before, after map[string]int64) string { + var lines []string + for path, size := range after { + if prev, ok := before[path]; !ok { + lines = append(lines, "added: "+path) + } else if prev != size { + lines = append(lines, fmt.Sprintf("resized: %s (%d -> %d)", path, prev, size)) + } + } + for path := range before { + if _, ok := after[path]; !ok { + lines = append(lines, "removed: "+path) + } + } + sort.Strings(lines) + return strings.Join(lines, "\n") +} diff --git a/cmd/bd/serve.go b/cmd/bd/serve.go index 008e5f26f..ab5bcc88c 100644 --- a/cmd/bd/serve.go +++ b/cmd/bd/serve.go @@ -376,6 +376,14 @@ func runServe() error { info.Database = topology.database p, err := newSQLServerUOWProvider(rootCtx, info.BeadsDir, topology) if err != nil { + // A daemon has no operator watching a prompt, so a migration-gate + // refusal here must fail startup loudly and completely: the whole + // block, in the service log, naming the one-time `bd migrate + // schema` that unblocks it. No prompt, no auto-consent, no + // half-started daemon serving a schema it refused to reconcile. + if rendered := renderTypedOpenError(err); rendered { + return SilentExit() + } return HandleError("bd serve: %v", err) } defer func() { diff --git a/cmd/bd/serve_close_proxied_integration_test.go b/cmd/bd/serve_close_proxied_integration_test.go index d393b3dd2..9bb2d3249 100644 --- a/cmd/bd/serve_close_proxied_integration_test.go +++ b/cmd/bd/serve_close_proxied_integration_test.go @@ -7,7 +7,6 @@ import ( "fmt" "io" "net/http" - "strconv" "strings" "testing" ) @@ -376,12 +375,12 @@ func TestProxiedServerServeClose(t *testing.T) { } second := revisionOf(t, raw) if second == first { - t.Fatalf("revision = %d after a second write; a write that does not move the token makes every guard vacuous", second) + t.Fatalf("revision = %q after a second write; a write that does not move the token makes every guard vacuous", second) } // The stale close. Nothing is written, and the 409 names the member. status, problem := sp.closeIssue(t, issue.ID, - `{"actor":"http-agent","reason":"never","expected_version":`+strconv.FormatInt(first, 10)+`}`) + `{"actor":"http-agent","reason":"never","expected_version":`+revisionGuard(first)+`}`) if status != http.StatusConflict { t.Fatalf("stale close: status = %d, want 409: %v", status, problem) } @@ -396,7 +395,7 @@ func TestProxiedServerServeClose(t *testing.T) { // about whether this is still the row the caller read, which force says // nothing about. status, problem = sp.closeIssue(t, issue.ID, - `{"actor":"http-agent","force":true,"expected_version":`+strconv.FormatInt(first, 10)+`}`) + `{"actor":"http-agent","force":true,"expected_version":`+revisionGuard(first)+`}`) if status != http.StatusConflict { t.Fatalf("forced stale close: status = %d, want 409 — force bypasses policy, never a precondition: %v", status, problem) } @@ -406,13 +405,13 @@ func TestProxiedServerServeClose(t *testing.T) { // The fresh guard lands, and answers with the token the close minted. status, raw = sp.closeIssueRaw(t, issue.ID, - `{"actor":"http-agent","reason":"shipped","expected_version":`+strconv.FormatInt(second, 10)+`}`) + `{"actor":"http-agent","reason":"shipped","expected_version":`+revisionGuard(second)+`}`) if status != http.StatusOK { t.Fatalf("guarded close: status = %d, want 200: %s", status, raw) } closed := revisionOf(t, raw) if closed == second { - t.Errorf("revision = %d after a close that wrote; the token did not move", closed) + t.Errorf("revision = %q after a close that wrote; the token did not move", closed) } if shown := bdProxiedShow(t, bd, p.dir, issue.ID); string(shown.Status) != "closed" { t.Fatalf("the guarded close did not land: status %q", shown.Status) @@ -424,7 +423,7 @@ func TestProxiedServerServeClose(t *testing.T) { // itself has already invalidated — which is what lets a client read // `already_closed` as "and nothing has happened here since". status, problem = sp.closeIssue(t, issue.ID, - `{"actor":"http-agent","expected_version":`+strconv.FormatInt(second, 10)+`}`) + `{"actor":"http-agent","expected_version":`+revisionGuard(second)+`}`) if status != http.StatusConflict { t.Fatalf("guarded re-close with a pre-close token: status = %d, want 409: %v", status, problem) } @@ -440,13 +439,13 @@ func TestProxiedServerServeClose(t *testing.T) { } afterReplay := revisionOf(t, raw) if afterReplay != closed { - t.Errorf("revision = %d after an idempotent re-close, want the unchanged %d: a replay that writes nothing must not move the token", + t.Errorf("revision = %q after an idempotent re-close, want the unchanged %q: a replay that writes nothing must not move the token", afterReplay, closed) } // The reopen's own guard, on the mirror. Stale first. status, problem = sp.reopenIssue(t, issue.ID, - `{"actor":"http-agent","expected_version":`+strconv.FormatInt(second, 10)+`}`) + `{"actor":"http-agent","expected_version":`+revisionGuard(second)+`}`) if status != http.StatusConflict { t.Fatalf("stale reopen: status = %d, want 409: %v", status, problem) } @@ -460,12 +459,12 @@ func TestProxiedServerServeClose(t *testing.T) { // And the loop closes: the token the last successful write answered // with is the one that lands. status, raw = sp.reopenIssueRaw(t, issue.ID, - `{"actor":"http-agent","expected_version":`+strconv.FormatInt(afterReplay, 10)+`}`) + `{"actor":"http-agent","expected_version":`+revisionGuard(afterReplay)+`}`) if status != http.StatusOK { t.Fatalf("guarded reopen: status = %d, want 200: %s", status, raw) } if reopened := revisionOf(t, raw); reopened == afterReplay { - t.Errorf("revision = %d after a reopen that wrote; the token did not move", reopened) + t.Errorf("revision = %q after a reopen that wrote; the token did not move", reopened) } if shown := bdProxiedShow(t, bd, p.dir, issue.ID); string(shown.Status) != "open" || shown.CloseReason != "" { t.Errorf("the guarded reopen did not land: status %q reason %q", shown.Status, shown.CloseReason) diff --git a/cmd/bd/serve_delete_proxied_integration_test.go b/cmd/bd/serve_delete_proxied_integration_test.go index 6755c88cc..4118fe756 100644 --- a/cmd/bd/serve_delete_proxied_integration_test.go +++ b/cmd/bd/serve_delete_proxied_integration_test.go @@ -6,7 +6,6 @@ import ( "encoding/json" "io" "net/http" - "strconv" "strings" "testing" ) @@ -90,10 +89,10 @@ func TestProxiedServerServeDelete(t *testing.T) { } second := revisionOf(t, raw) if second == first { - t.Fatalf("revision = %d after a second write; a token that does not move makes the guard vacuous", second) + t.Fatalf("revision = %q after a second write; a token that does not move makes the guard vacuous", second) } - status, raw = sp.deleteIssues(t, `{"ids":["`+issue.ID+`"],"actor":"http-agent","expected_version":`+strconv.FormatInt(first, 10)+`}`) + status, raw = sp.deleteIssues(t, `{"ids":["`+issue.ID+`"],"actor":"http-agent","expected_version":`+revisionGuard(first)+`}`) if status != http.StatusConflict { t.Fatalf("stale delete: status = %d, want 409: %s", status, raw) } @@ -108,7 +107,7 @@ func TestProxiedServerServeDelete(t *testing.T) { // to do about OTHER beads; neither says the bead named is still the one // the caller read. for _, flags := range []string{`"force":true`, `"cascade":true`, `"force":true,"cascade":true`} { - status, raw = sp.deleteIssues(t, `{"ids":["`+issue.ID+`"],`+flags+`,"expected_version":`+strconv.FormatInt(first, 10)+`}`) + status, raw = sp.deleteIssues(t, `{"ids":["`+issue.ID+`"],`+flags+`,"expected_version":`+revisionGuard(first)+`}`) if status != http.StatusConflict { t.Fatalf("stale delete with %s: status = %d, want 409: %s", flags, status, raw) } @@ -118,14 +117,14 @@ func TestProxiedServerServeDelete(t *testing.T) { // A DRY RUN REFUSES WHERE THE REAL RUN WOULD, which is the whole value // of previewing a guarded delete: a clean preview means the real request // will not stop half-explained. - status, raw = sp.deleteIssues(t, `{"ids":["`+issue.ID+`"],"dry_run":true,"expected_version":`+strconv.FormatInt(first, 10)+`}`) + status, raw = sp.deleteIssues(t, `{"ids":["`+issue.ID+`"],"dry_run":true,"expected_version":`+revisionGuard(first)+`}`) if status != http.StatusConflict { t.Fatalf("stale dry run: status = %d, want 409: %s", status, raw) } stillThere(t, bd, p.dir, issue.ID) // And the fresh token lands. - status, raw = sp.deleteIssues(t, `{"ids":["`+issue.ID+`"],"actor":"http-agent","expected_version":`+strconv.FormatInt(second, 10)+`}`) + status, raw = sp.deleteIssues(t, `{"ids":["`+issue.ID+`"],"actor":"http-agent","expected_version":`+revisionGuard(second)+`}`) if status != http.StatusOK { t.Fatalf("guarded delete: status = %d, want 200: %s", status, raw) } @@ -149,7 +148,7 @@ func TestProxiedServerServeDelete(t *testing.T) { a := bdProxiedCreate(t, bd, p.dir, "arity a", "-p", "2") b := bdProxiedCreate(t, bd, p.dir, "arity b", "-p", "2") - status, raw := sp.deleteIssues(t, `{"ids":["`+a.ID+`","`+b.ID+`"],"expected_version":41}`) + status, raw := sp.deleteIssues(t, `{"ids":["`+a.ID+`","`+b.ID+`"],"expected_version":"41"}`) if status != http.StatusBadRequest { t.Fatalf("status = %d, want 400: %s", status, raw) } @@ -183,7 +182,7 @@ func TestProxiedServerServeDelete(t *testing.T) { token := revisionOf(t, raw) status, raw = sp.deleteIssues(t, - `{"ids":["`+issue.ID+`","`+issue.ID+`"],"actor":"http-agent","expected_version":`+strconv.FormatInt(token, 10)+`}`) + `{"ids":["`+issue.ID+`","`+issue.ID+`"],"actor":"http-agent","expected_version":`+revisionGuard(token)+`}`) if status != http.StatusOK { t.Fatalf("status = %d, want 200 — duplicates collapse to one bead: %s", status, raw) } @@ -194,7 +193,7 @@ func TestProxiedServerServeDelete(t *testing.T) { // be stale about, so the caller is told about the typo rather than about a // version it cannot check. t.Run("an absent id outranks the guard", func(t *testing.T) { - status, raw := sp.deleteIssues(t, `{"ids":["bd-nosuchbead"],"expected_version":41}`) + status, raw := sp.deleteIssues(t, `{"ids":["bd-nosuchbead"],"expected_version":"41"}`) if status != http.StatusNotFound { t.Fatalf("status = %d, want 404: %s", status, raw) } diff --git a/cmd/bd/serve_read_revision_proxied_integration_test.go b/cmd/bd/serve_read_revision_proxied_integration_test.go index 18d864c23..c1d96a487 100644 --- a/cmd/bd/serve_read_revision_proxied_integration_test.go +++ b/cmd/bd/serve_read_revision_proxied_integration_test.go @@ -6,7 +6,6 @@ import ( "encoding/json" "io" "net/http" - "strconv" "testing" ) @@ -74,13 +73,13 @@ func TestProxiedServerServeReadRevision(t *testing.T) { // mean the handler published a field it never filled in rather than // the row's value — the one failure that a legacy-zero row makes // otherwise indistinguishable from success. - if read == 0 { - t.Fatalf("revision = 0 on a row this test just created; the token was not read off the row: %s", raw) + if read == "0" { + t.Fatalf("revision = \"0\" on a row this test just created; the token was not read off the row: %s", raw) } // The guard the read sourced. It lands, which is half the claim. writeStatus, written := sp.updateIssueRaw(t, issue.ID, - `{"actor":"http-agent","expected_version":`+strconv.FormatInt(read, 10)+`,"patch":{"title":"guarded by a read"}}`) + `{"actor":"http-agent","expected_version":`+revisionGuard(read)+`,"patch":{"title":"guarded by a read"}}`) if writeStatus != http.StatusOK { t.Fatalf("guarded write: status = %d, want 200: %s", writeStatus, written) } @@ -95,14 +94,14 @@ func TestProxiedServerServeReadRevision(t *testing.T) { // diverged from here on. wrote := revisionOf(t, written) if wrote == read { - t.Fatalf("revision = %d after a write; a write that does not move the token makes every guard vacuous", wrote) + t.Fatalf("revision = %q after a write; a write that does not move the token makes every guard vacuous", wrote) } reStatus, reRaw := sp.getIssueRaw(t, issue.ID) if reStatus != http.StatusOK { t.Fatalf("re-read: status = %d, want 200: %s", reStatus, reRaw) } if reRead := revisionOf(t, reRaw); reRead != wrote { - t.Errorf("the read answers %d and the write answered %d; the two must be one token", reRead, wrote) + t.Errorf("the read answers %q and the write answered %q; the two must be one token", reRead, wrote) } // THE OTHER HALF: a concurrent actor moves the row, and the token the @@ -117,7 +116,7 @@ func TestProxiedServerServeReadRevision(t *testing.T) { } conflictStatus, problem := sp.updateIssue(t, issue.ID, - `{"actor":"http-agent","expected_version":`+strconv.FormatInt(wrote, 10)+`,"patch":{"title":"never"}}`) + `{"actor":"http-agent","expected_version":`+revisionGuard(wrote)+`,"patch":{"title":"never"}}`) if conflictStatus != http.StatusConflict { t.Fatalf("stale guard: status = %d, want 409: %v", conflictStatus, problem) } @@ -139,7 +138,7 @@ func TestProxiedServerServeReadRevision(t *testing.T) { } fresh := revisionOf(t, freshRaw) retryStatus, retry := sp.updateIssue(t, issue.ID, - `{"actor":"http-agent","expected_version":`+strconv.FormatInt(fresh, 10)+`,"patch":{"title":"retried"}}`) + `{"actor":"http-agent","expected_version":`+revisionGuard(fresh)+`,"patch":{"title":"retried"}}`) if retryStatus != http.StatusOK { t.Fatalf("the retry: status = %d, want 200: %v", retryStatus, retry) } @@ -164,7 +163,7 @@ func TestProxiedServerServeReadRevision(t *testing.T) { read := revisionOf(t, raw) closeStatus, closed := sp.closeIssueRaw(t, issue.ID, - `{"actor":"http-agent","expected_version":`+strconv.FormatInt(read, 10)+`}`) + `{"actor":"http-agent","expected_version":`+revisionGuard(read)+`}`) if closeStatus != http.StatusOK { t.Fatalf("guarded close: status = %d, want 200: %s", closeStatus, closed) } @@ -180,7 +179,7 @@ func TestProxiedServerServeReadRevision(t *testing.T) { t.Fatalf("read after close: status = %d, want 200: %s", afterStatus, afterRaw) } if got, want := revisionOf(t, afterRaw), revisionOf(t, closed); got != want { - t.Errorf("the read answers %d and the close answered %d; the two must be one token", got, want) + t.Errorf("the read answers %q and the close answered %q; the two must be one token", got, want) } }) @@ -199,9 +198,9 @@ func TestProxiedServerServeReadRevision(t *testing.T) { t.Fatalf("GET wisp: status = %d, want 200: %s", status, raw) } var body struct { - ID string `json:"id"` - Ephemeral bool `json:"ephemeral"` - Revision *int64 `json:"revision"` + ID string `json:"id"` + Ephemeral bool `json:"ephemeral"` + Revision *string `json:"revision"` } if err := json.Unmarshal(raw, &body); err != nil { t.Fatalf("decode wisp detail %q: %v", raw, err) @@ -212,8 +211,9 @@ func TestProxiedServerServeReadRevision(t *testing.T) { if body.Revision == nil { t.Fatalf("the wisp detail carries no `revision`: %s", raw) } - if *body.Revision == 0 { - t.Errorf("revision = 0 on a wisp this test just created; the fallback read the wrong plane's token: %s", raw) + if *body.Revision == "0" { + t.Errorf("revision = %q on a wisp this test just created; the fallback read the wrong plane's token: %s", + *body.Revision, raw) } }) } diff --git a/cmd/bd/serve_update_proxied_integration_test.go b/cmd/bd/serve_update_proxied_integration_test.go index fc17ae02c..bb59a0553 100644 --- a/cmd/bd/serve_update_proxied_integration_test.go +++ b/cmd/bd/serve_update_proxied_integration_test.go @@ -54,22 +54,25 @@ func (sp *serveProcess) updateIssue(t *testing.T, id, body string) (int, map[str return status, m } -// revisionOf decodes the `revision` token as the 64-BIT INTEGER the document -// declares it to be, which is the whole reason this reads the raw bytes. +// revisionOf decodes the `revision` token as the decimal STRING the document +// declares it to be, and hands it back unparsed — which is exactly what a +// client is supposed to do with it. // -// Decoding it into an `any` yields a float64, and live tokens run past 5e17 -// where a float64's ulp is already 64 — so the value that comes back is NEAR -// the token and is not it, and a guard composed from it is refused against a -// row nothing else touched. That is not hypothetical: it is how the first -// version of the case below failed. +// It reads the raw bytes rather than going through an `any`, and that is still +// the point: `any` would hand back the string's text now, but it handed back a +// float64 when the member was a number, and live tokens run past 5e17 where a +// float64's ulp is already 64 — so the value that came back was NEAR the token +// and was not it, and a guard composed from it was refused against a row +// nothing else touched. That is not hypothetical: it is how the first version +// of the case below failed, and it is why the member is a string. // // NEVER ORDER IT AND NEVER COMPUTE ONE. The token is opaque and compared for // EQUALITY alone, so "the previous revision" is not `revision - 1`; it is the // value an earlier write answered with, which is what the case below uses. -func revisionOf(t *testing.T, raw []byte) int64 { +func revisionOf(t *testing.T, raw []byte) string { t.Helper() var body struct { - Revision *int64 `json:"revision"` + Revision *string `json:"revision"` } if err := json.Unmarshal(raw, &body); err != nil { t.Fatalf("decode revision from %q: %v", raw, err) @@ -80,6 +83,11 @@ func revisionOf(t *testing.T, raw []byte) int64 { return *body.Revision } +// revisionGuard spells a token as the JSON member a request carries, quotes and +// all, so a case composes its guard by splicing the response's own value in +// rather than by re-rendering a parsed one. +func revisionGuard(token string) string { return strconv.Quote(token) } + func TestProxiedServerServeUpdate(t *testing.T) { requireSharedProxiedServer(t) t.Parallel() @@ -393,11 +401,11 @@ func TestProxiedServerServeUpdate(t *testing.T) { } second := revisionOf(t, concurrent) if second == first { - t.Fatalf("revision = %d after a second write; a write that does not move the token makes every guard vacuous", second) + t.Fatalf("revision = %q after a second write; a write that does not move the token makes every guard vacuous", second) } conflictStatus, problem := sp.updateIssue(t, issue.ID, - `{"actor":"http-agent","expected_version":`+strconv.FormatInt(first, 10)+`,"patch":{"title":"never"}}`) + `{"actor":"http-agent","expected_version":`+revisionGuard(first)+`,"patch":{"title":"never"}}`) if conflictStatus != http.StatusConflict { t.Fatalf("stale guard: status = %d, want 409: %v", conflictStatus, problem) } @@ -414,7 +422,7 @@ func TestProxiedServerServeUpdate(t *testing.T) { // The loop closes: re-read the token the last write answered with and // the guarded write lands. freshStatus, fresh := sp.updateIssue(t, issue.ID, - `{"actor":"http-agent","expected_version":`+strconv.FormatInt(second, 10)+`,"patch":{"title":"guarded"}}`) + `{"actor":"http-agent","expected_version":`+revisionGuard(second)+`,"patch":{"title":"guarded"}}`) if freshStatus != http.StatusOK { t.Fatalf("guarded update: status = %d, want 200: %v", freshStatus, fresh) } diff --git a/cmd/bd/shared_migrate_consent_test.go b/cmd/bd/shared_migrate_consent_test.go new file mode 100644 index 000000000..ada15c28a --- /dev/null +++ b/cmd/bd/shared_migrate_consent_test.go @@ -0,0 +1,205 @@ +package main + +import ( + "bytes" + "io" + "os" + "strings" + "testing" + + "github.com/spf13/cobra" + "github.com/steveyegge/beads/internal/storage/schema" +) + +// captureNoticeStderr runs fn with os.Stderr redirected and returns what it +// wrote. +func captureNoticeStderr(t *testing.T, fn func()) string { + t.Helper() + orig := os.Stderr + r, w, err := os.Pipe() + if err != nil { + t.Fatal(err) + } + os.Stderr = w + fn() + _ = w.Close() + os.Stderr = orig + + var buf bytes.Buffer + if _, err := io.Copy(&buf, r); err != nil { + t.Fatal(err) + } + _ = r.Close() + return buf.String() +} + +// TestIsSchemaMigrateVerbScope pins which invocations count as consent to +// migrate a shared database (gastownhall/beads#5920). Only `bd migrate schema` +// does. Bare `bd migrate` reconciles version/repo-id metadata and never +// applies a schema migration itself, and its flag modes are further still from +// schema work — `bd migrate --update-repo-id` is repo-fingerprint surgery, and +// treating it as consent would let a repo-ID update promote the schema for +// every co-resident client as a side effect. +func TestIsSchemaMigrateVerbScope(t *testing.T) { + for _, tt := range []struct { + name string + cmd *cobra.Command + want bool + }{ + {name: "migrate schema consents", cmd: migrateSchemaCmd, want: true}, + {name: "bare migrate does not", cmd: migrateCmd, want: false}, + {name: "migrate sync does not", cmd: migrateSyncCmd, want: false}, + {name: "an unrelated command does not", cmd: rootCmd, want: false}, + } { + t.Run(tt.name, func(t *testing.T) { + if got := isSchemaMigrateVerb(tt.cmd); got != tt.want { + t.Fatalf("isSchemaMigrateVerb(%q) = %t, want %t", tt.cmd.Name(), got, tt.want) + } + }) + } +} + +// TestNoticeSharedMigrateRefusalPerDecision covers the one-shot version-bump +// notice. It fires once per upgrade (.local_version is consumed in the same +// pre-run), so the remedy it names has to be right for THIS refusal — the gate +// returns one error type for several decisions whose correct actions differ, +// and the migrate verb does not unlock the remote-backed ones at all. +func TestNoticeSharedMigrateRefusalPerDecision(t *testing.T) { + // The notice self-suppresses under --json, so if jsonOutput arrives here + // already true, every case below reads as "the notice printed nothing" — + // which is exactly how a leak from an earlier test in the package + // presents, and is how this test failed in full-package runs while passing + // under a narrow -run. Pin it, so a failure here can only ever be about + // this code. + pinJSONOutput(t, false) + + for _, tt := range []struct { + decision string + want string + absent string + }{ + {decision: "shared-no-remote", want: "bd migrate schema"}, + {decision: "adopt", want: "bd bootstrap", absent: "bd migrate schema"}, + {decision: "adopt-ff", want: "bd bootstrap", absent: "bd migrate schema"}, + {decision: "fork-skew", want: "bd doctor", absent: "bd migrate schema"}, + {decision: "", want: "bd migrate", absent: "bd migrate schema"}, + } { + name := tt.decision + if name == "" { + name = "blunt stop" + } + t.Run(name, func(t *testing.T) { + out := captureNoticeStderr(t, func() { + noticeSharedMigrateRefusal(&schema.RemoteMigrateGateError{ + CurrentVersion: 65, LatestVersion: 66, Pending: 1, + Decision: tt.decision, + }) + }) + if !strings.Contains(out, tt.want) { + t.Errorf("notice for %q missing %q:\n%s", tt.decision, tt.want, out) + } + if tt.absent != "" && strings.Contains(out, tt.absent) { + t.Errorf("notice for %q must not prescribe %q (the verb does not unlock this arm):\n%s", + tt.decision, tt.absent, out) + } + }) + } + + // --json puts a machine-readable gate block on this same stream a moment + // later; prose prepended to it makes the documented contract unparseable. + t.Run("suppressed in json mode", func(t *testing.T) { + pinJSONOutput(t, true) + out := captureNoticeStderr(t, func() { + noticeSharedMigrateRefusal(&schema.RemoteMigrateGateError{ + CurrentVersion: 65, LatestVersion: 66, Pending: 1, + Decision: "shared-no-remote", + }) + }) + if out != "" { + t.Errorf("notice must be silent in --json mode, got:\n%s", out) + } + }) + + t.Run("global flag names the global remedy", func(t *testing.T) { + orig := globalFlag + globalFlag = true + defer func() { globalFlag = orig }() + out := captureNoticeStderr(t, func() { + noticeSharedMigrateRefusal(&schema.RemoteMigrateGateError{ + CurrentVersion: 65, LatestVersion: 66, Pending: 1, + Decision: "shared-no-remote", + }) + }) + if !strings.Contains(out, schema.SharedConsentCommandGlobal) { + t.Errorf("notice under --global must name %q:\n%s", schema.SharedConsentCommandGlobal, out) + } + }) + + t.Run("an untyped error prints nothing", func(t *testing.T) { + out := captureNoticeStderr(t, func() { noticeSharedMigrateRefusal(io.EOF) }) + if out != "" { + t.Errorf("only a gate refusal should produce a notice, got:\n%s", out) + } + }) +} + +// TestSharedRefusalPrescribesAWorkingVerb closes the loop the review flagged: +// the shared-store refusal names a command, and that command must actually run +// wherever the refusal can appear. In proxied-server mode `bd migrate schema` +// used to hard-refuse, so the only remedy the gate offered there was a dead +// end — worse, the root pre-run would have consumed the consent on the open +// before RunE ever printed "not supported". +// +// The pairing is checked structurally rather than by driving a proxied +// workspace: the command the gate prescribes IS SharedConsentCommand, and the +// verb that grants consent for it is migrateSchemaCmd. +func TestSharedRefusalPrescribesAWorkingVerb(t *testing.T) { + refusal := &schema.RemoteMigrateGateError{ + CurrentVersion: 65, LatestVersion: 66, Pending: 1, + Decision: "shared-no-remote", Shared: true, + } + + if got := refusal.EscapeHint(); got != schema.SharedConsentCommand { + t.Fatalf("EscapeHint = %q, want %q", got, schema.SharedConsentCommand) + } + opts := refusal.Options() + if len(opts) != 1 || len(opts[0].Commands) != 1 || opts[0].Commands[0] != schema.SharedConsentCommand { + t.Fatalf("Options = %+v, want the single %q remedy", opts, schema.SharedConsentCommand) + } + if !strings.Contains(refusal.UserMessage(), schema.SharedConsentCommand) { + t.Errorf("UserMessage must name the remedy:\n%s", refusal.UserMessage()) + } + + // The prescribed command is `bd `, and that is + // exactly the command isSchemaMigrateVerb grants consent for. + wantPath := "bd " + strings.TrimPrefix(migrateSchemaCmd.CommandPath(), rootCmd.Name()+" ") + if wantPath != schema.SharedConsentCommand { + t.Fatalf("the gate prescribes %q but the consenting verb is %q", schema.SharedConsentCommand, wantPath) + } + if !isSchemaMigrateVerb(migrateSchemaCmd) { + t.Fatal("the command the gate prescribes must be the one that grants consent") + } +} + +// TestPrintGlobalDatabaseConsentHint pins the one fact the gate's own block +// cannot know: which database the invocation targeted. Under --global the open +// hits `beads_global`, so the block's unflagged `bd migrate schema` would +// migrate the project database and leave the refusal in place. +func TestPrintGlobalDatabaseConsentHint(t *testing.T) { + orig := globalFlag + defer func() { globalFlag = orig }() + + globalFlag = false + var off bytes.Buffer + printGlobalDatabaseConsentHint(&off) + if off.Len() != 0 { + t.Errorf("no hint without --global, got:\n%s", off.String()) + } + + globalFlag = true + var on bytes.Buffer + printGlobalDatabaseConsentHint(&on) + if !strings.Contains(on.String(), schema.SharedConsentCommandGlobal) { + t.Errorf("hint must name %q:\n%s", schema.SharedConsentCommandGlobal, on.String()) + } +} diff --git a/cmd/bd/shared_store_migrate_gate_test.go b/cmd/bd/shared_store_migrate_gate_test.go new file mode 100644 index 000000000..6d3f6cde4 --- /dev/null +++ b/cmd/bd/shared_store_migrate_gate_test.go @@ -0,0 +1,202 @@ +//go:build cgo + +package main + +import ( + "context" + "database/sql" + "errors" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/steveyegge/beads/internal/configfile" + "github.com/steveyegge/beads/internal/storage/dolt" + "github.com/steveyegge/beads/internal/storage/doltutil" + "github.com/steveyegge/beads/internal/storage/schema" + "github.com/steveyegge/beads/internal/types" +) + +// TestSharedServerVersionBumpDoesNotPromoteCursor reproduces +// gastownhall/beads#5920 end to end, through the real CLI. +// +// The incident: a shared dolt sql-server with no remote, a team of co-resident +// bd clients, one of them upgraded. That client's first command was a plain +// `bd list` — a read — but the root pre-run's version-bump reconciliation +// (autoMigrateOnVersionBump) opens its OWN writable store, which migrated the +// database and promoted schema_migrations for everyone. Every co-resident +// client still on the old binary then refused the database until it was +// upgraded too, for ~14 minutes, with nothing in the output saying what had +// happened. +// +// The assertion that matters is MAX(version): the read must succeed and the +// cursor must not move. +func TestSharedServerVersionBumpDoesNotPromoteCursor(t *testing.T) { + if testDoltServerPort == 0 { + t.Skip("Dolt test server not available, skipping") + } + + repo := t.TempDir() + beadsDir := filepath.Join(repo, ".beads") + if err := os.MkdirAll(beadsDir, 0o755); err != nil { + t.Fatalf("create .beads: %v", err) + } + database := uniqueTestDBName(t) + if err := (&configfile.Config{ + Backend: configfile.BackendDolt, + DoltMode: configfile.DoltModeServer, + DoltServerHost: "127.0.0.1", + DoltServerPort: testDoltServerPort, + DoltDatabase: database, + }).Save(beadsDir); err != nil { + t.Fatalf("save metadata: %v", err) + } + + ctx := context.Background() + // SetForceAllowRemoteMigrate is deliberately NOT set: this fixture creates + // the database from scratch, so the gate sees version 0 and allows it — + // creating a database is consent for its schema. + store, err := dolt.New(ctx, &dolt.Config{ + Path: filepath.Join(beadsDir, "dolt"), + BeadsDir: beadsDir, + ServerHost: "127.0.0.1", + ServerPort: testDoltServerPort, + Database: database, + CreateIfMissing: true, + }) + if err != nil { + t.Fatalf("create test store: %v", err) + } + if err := store.SetConfig(ctx, "issue_prefix", "shr"); err != nil { + t.Fatalf("set issue_prefix: %v", err) + } + now := time.Now() + if err := store.CreateIssue(ctx, &types.Issue{ + ID: "shr-1", + Title: "Readable through the upgrade window", + Status: types.StatusOpen, + Priority: 1, + IssueType: types.TypeTask, + CreatedAt: now, + UpdatedAt: now, + }, "test-user"); err != nil { + t.Fatalf("create issue: %v", err) + } + if err := store.Close(); err != nil { + t.Fatalf("close setup store: %v", err) + } + // The version-bump reconciliation only runs when the workspace has a local + // Dolt data dir (it stats cfg.DatabasePath before opening anything) — the + // shape of the auto-started localhost server the incident was reported on. + // The bytes live in the test container, but the directory is what arms the + // code path under test. + if err := os.MkdirAll(filepath.Join(beadsDir, "dolt"), 0o755); err != nil { + t.Fatalf("create local dolt data dir: %v", err) + } + t.Cleanup(func() { dropTestDatabase(database, testDoltServerPort) }) + + admin, err := sql.Open("mysql", doltutil.ServerDSN{ + Host: "127.0.0.1", Port: testDoltServerPort, User: "root", Database: database, + }.String()) + if err != nil { + t.Fatalf("connect to test dolt server: %v", err) + } + t.Cleanup(func() { admin.Close() }) + + // Put the database one migration behind the candidate binary by regressing + // only the recorded cursor — the schema change itself stays applied, so + // reads keep working, exactly as they did throughout the incident. + if _, err := admin.ExecContext(ctx, + "DELETE FROM schema_migrations WHERE version = ?", schema.LatestVersion()); err != nil { + t.Fatalf("regress schema_migrations: %v", err) + } + cursor := func() int { + var v int + if err := admin.QueryRowContext(ctx, + "SELECT COALESCE(MAX(version), 0) FROM schema_migrations").Scan(&v); err != nil { + t.Fatalf("read schema cursor: %v", err) + } + return v + } + behind := cursor() + if behind != schema.LatestVersion()-1 { + t.Fatalf("precondition failed: cursor = %d, want %d", behind, schema.LatestVersion()-1) + } + + // The one-shot upgrade signal: a stale .local_version makes trackBdVersion + // report a version bump, which is what arms autoMigrateOnVersionBump. The + // value has to be strictly below the candidate binary's Version and still + // in the 1.x era — a pre-1.0 witness is refused outright by the cross-era + // legacy guard long before any of this runs. + if err := os.WriteFile(filepath.Join(beadsDir, localVersionFile), []byte("1.0.0\n"), 0o600); err != nil { + t.Fatalf("write stale %s: %v", localVersionFile, err) + } + + bd := buildBDForInitTests(t) + run := func(args ...string) (string, string, int) { + t.Helper() + cmd := exec.Command(bd, args...) + cmd.Dir = repo + cmd.Env = append(filteredEnvForContextBinding("BEADS_DIR", "BEADS_DB", "BD_DB", + "BEADS_DOLT_SERVER_PORT", "BEADS_DOLT_SERVER_DATABASE", schema.AllowRemoteMigrateEnv), + "HOME="+t.TempDir(), + "XDG_CONFIG_HOME="+t.TempDir(), + "BEADS_TEST_MODE=1", + "BEADS_TEST_SERVER=1", + "BEADS_DIR="+beadsDir, + schema.AllowRemoteMigrateEnv+"=0", + ) + var stdout, stderr strings.Builder + cmd.Stdout = &stdout + cmd.Stderr = &stderr + code := 0 + if err := cmd.Run(); err != nil { + var exitErr *exec.ExitError + if !errors.As(err, &exitErr) { + t.Fatalf("running bd %v: %v", args, err) + } + code = exitErr.ExitCode() + } + return stdout.String(), stderr.String(), code + } + + stdout, stderr, code := run("list") + if code != 0 { + t.Fatalf("bd list exit = %d, want 0\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) + } + if !strings.Contains(stdout, "shr-1") { + t.Errorf("bd list did not render the issue; reads must keep working on the old schema:\n%s", stdout) + } + if got := cursor(); got != behind { + t.Fatalf("bd list promoted the schema cursor from %d to %d — this IS gastownhall/beads#5920", behind, got) + } + // The #5920 UX gap, inverted: nothing advanced, and the one-shot line says so. + if !strings.Contains(stderr, "not auto-applying") || !strings.Contains(stderr, "bd migrate schema") { + t.Errorf("expected the one-shot shared-store notice on stderr, got:\n%s", stderr) + } + + // A write is refused outright, with the full guidance block rather than a + // bare error. + stdout, stderr, code = run("create", "Should be refused", "-p", "2") + if code == 0 { + t.Fatalf("bd create succeeded on a behind shared database\nstdout:\n%s\nstderr:\n%s", stdout, stderr) + } + if !strings.Contains(stderr, "co-resident") { + t.Errorf("bd create refusal missing the shared-store guidance:\n%s", stderr) + } + if got := cursor(); got != behind { + t.Fatalf("the refused write promoted the schema cursor from %d to %d", behind, got) + } + + // Consent completes the upgrade. + stdout, stderr, code = run("migrate", "schema") + if code != 0 { + t.Fatalf("bd migrate schema exit = %d, want 0\nstdout:\n%s\nstderr:\n%s", code, stdout, stderr) + } + if got := cursor(); got != schema.LatestVersion() { + t.Fatalf("cursor = %d after bd migrate schema, want %d", got, schema.LatestVersion()) + } +} diff --git a/cmd/bd/show_details_json_test.go b/cmd/bd/show_details_json_test.go index 5992a23e3..0b47649bc 100644 --- a/cmd/bd/show_details_json_test.go +++ b/cmd/bd/show_details_json_test.go @@ -67,11 +67,16 @@ func TestShowJSONDetailsCarryTheRevisionToken(t *testing.T) { token int64 want string }{ - {"a mutated row", 123456789, `"revision":123456789`}, + {"a mutated row", 123456789, `"revision":"123456789"`}, // 0 is the migration-0054 backfill token, a legitimate CAS value a // guarded client must be able to read. No omitempty, so it is emitted - // rather than standing in for "this producer has no token". - {"a legacy un-mutated row", 0, `"revision":0`}, + // rather than standing in for "this producer has no token", and it is + // the STRING "0" rather than the number. + {"a legacy un-mutated row", 0, `"revision":"0"`}, + // The token this spelling exists for: 2^53+1 is the smallest int64 a + // double-based `jq`/JavaScript consumer of `bd show --json` cannot + // hold. + {"a token past 2^53", 9007199254740993, `"revision":"9007199254740993"`}, } { t.Run(tc.name, func(t *testing.T) { details := types.NewIssueDetails(types.Issue{ diff --git a/cmd/bd/show_embedded_test.go b/cmd/bd/show_embedded_test.go index e1ce16fad..87df8f99d 100644 --- a/cmd/bd/show_embedded_test.go +++ b/cmd/bd/show_embedded_test.go @@ -10,6 +10,8 @@ import ( "strings" "sync" "testing" + + "github.com/steveyegge/beads/internal/types" ) // bdShowRaw runs "bd show" with the given args and returns raw stdout. @@ -59,6 +61,41 @@ func bdShowDetails(t *testing.T, bd, dir, id string) map[string]interface{} { return m } +// assertLiveRevisionToken holds a `revision` read off a `bd show --json` detail +// view to the wire contract the token carries: a decimal STRING, never a JSON +// number. +// +// THE TYPE IS ASSERTED BEFORE THE VALUE, and that ordering is the point. The +// token spans the full int64 range, and a JSON number past 2^53 is rounded by +// every double-based consumer — jq, JavaScript, Go's own `any` — so a guard +// composed from one is refused against a row nothing else touched. Decoding a +// detail view into `map[string]any` is exactly the shape that hides it, which is +// why both callers here go through this helper instead of a local cast. +// +// "LIVE" IS THE SECOND HALF. A row the caller just created carries a freshly +// minted token, so "0" — the migration-0054 backfill value — means the producer +// published a member it never filled in: the one failure a legacy-zero row makes +// otherwise indistinguishable from success. +func assertLiveRevisionToken(t *testing.T, value any) { + t.Helper() + token, ok := value.(string) + if !ok { + t.Errorf("revision = %#v (%T), want the decimal string the wire contract declares", value, value) + return + } + parsed, err := types.ParseRevisionToken(token) + if err != nil { + t.Errorf("revision = %q, which is not a decimal token: %v", token, err) + return + } + if got := types.RevisionToken(parsed); got != token { + t.Errorf("revision = %q does not round-trip through the token codec (got %q back)", token, got) + } + if parsed == 0 { + t.Errorf("revision = %q on a row this test just created; the token was not read off the row", token) + } +} + // bdShowFail2 runs "bd show" expecting failure. func bdShowFail2(t *testing.T, bd, dir string, args ...string) string { t.Helper() @@ -129,9 +166,7 @@ func TestEmbeddedShow(t *testing.T) { if m["description"] != "A description" { t.Errorf("expected description, got %v", m["description"]) } - if revision, ok := m["revision"].(float64); !ok || revision == 0 { - t.Errorf("expected non-zero revision, got %v", m["revision"]) - } + assertLiveRevisionToken(t, m["revision"]) }) t.Run("show_json_includes_labels", func(t *testing.T) { diff --git a/cmd/bd/show_proxied_integration_test.go b/cmd/bd/show_proxied_integration_test.go index caa7219be..b31bc6dad 100644 --- a/cmd/bd/show_proxied_integration_test.go +++ b/cmd/bd/show_proxied_integration_test.go @@ -122,9 +122,7 @@ func TestProxiedServerShow(t *testing.T) { if m["priority"] != float64(1) { t.Errorf("priority: got %v, want 1", m["priority"]) } - if revision, ok := m["revision"].(float64); !ok || revision == 0 { - t.Errorf("revision: got %v, want a non-zero opaque token", m["revision"]) - } + assertLiveRevisionToken(t, m["revision"]) if _, ok := m["created_at"]; !ok { t.Errorf("missing created_at") } diff --git a/cmd/bd/show_proxied_server.go b/cmd/bd/show_proxied_server.go index 080ac6ead..26a9d3826 100644 --- a/cmd/bd/show_proxied_server.go +++ b/cmd/bd/show_proxied_server.go @@ -95,7 +95,7 @@ func runShowProxiedServer(cmd *cobra.Command, ctx context.Context, args []string in := gatherShowProxiedInput(cmd, args) if in.watchMode { - return HandleErrorRespectJSON("watch mode not supported in proxied-server mode") + return HandleProxyCapabilityError(AssertProxyCommandCapability("show", ProxyModeProxied, ProxyCapWatch)) } uw, err := proxiedOpenReadUOW(ctx) diff --git a/cmd/bd/storage_class_embedded_test.go b/cmd/bd/storage_class_embedded_test.go index 13c838e47..656f0ee8e 100644 --- a/cmd/bd/storage_class_embedded_test.go +++ b/cmd/bd/storage_class_embedded_test.go @@ -4,6 +4,7 @@ package main import ( "database/sql" + "errors" "os" "path/filepath" "strings" @@ -41,6 +42,28 @@ func TestEmbeddedCreateStorageClass(t *testing.T) { return got } + // The batch doors mint their own ids, so the DB assertions look rows up by + // the title the markdown file gave them. An absent row is "" rather than a + // failure: which PLANE a row landed on is the thing under test. + issueIDByTitle := func(t *testing.T, beadsDir, prefix, table, title string) string { + t.Helper() + db, cleanup, err := embeddeddolt.OpenSQL(t.Context(), filepath.Join(beadsDir, "embeddeddolt"), prefix, "main") + if err != nil { + t.Fatalf("OpenSQL: %v", err) + } + defer cleanup() + var id string + //nolint:gosec // G202: table is a test-local literal, never caller input + err = db.QueryRowContext(t.Context(), "SELECT id FROM "+table+" WHERE title = ?", title).Scan(&id) + if errors.Is(err, sql.ErrNoRows) { + return "" + } + if err != nil { + t.Fatalf("query %s by title: %v", table, err) + } + return id + } + t.Run("explicit_unversioned", func(t *testing.T) { dir, beadsDir, _ := bdInit(t, bd, "--prefix", "su") issue := bdCreate(t, bd, dir, "Unversioned bead", "--storage-class", "unversioned") @@ -186,6 +209,118 @@ func TestEmbeddedCreateStorageClass(t *testing.T) { } }) + // `bd create --file` used to accept --storage-class and the per-type config + // default and honor neither. buildMarkdownBatchRequest is the ONE projection + // both transports use, so these subtests cover the direct half of that fix + // and TestStorageClassProxiedServer covers the other. + t.Run("markdown_batch", func(t *testing.T) { + batch := `## Batch one + +### Description +First. + +## Batch two + +### Description +Second. +` + t.Run("explicit_unversioned_on_every_row", func(t *testing.T) { + dir, beadsDir, _ := bdInit(t, bd, "--prefix", "sm") + plan := writeMarkdownPlan(t, dir, "batch.md", batch) + if out, err := bdRunWithFlockRetry(t, bd, dir, "create", "--file", plan, "--storage-class", "unversioned"); err != nil { + t.Fatalf("create --file: %v\n%s", err, out) + } + for _, title := range []string{"Batch one", "Batch two"} { + id := issueIDByTitle(t, beadsDir, "sm", "issues", title) + if cell := storageClassCell(t, beadsDir, "sm", id); !cell.Valid || cell.String != "unversioned" { + t.Errorf("%s (%s): DB cell = %+v, want 'unversioned'", title, id, cell) + } + } + }) + + // The per-type default resolves per TEMPLATE, because that is where the + // type lives — a file-wide resolution would key on nothing. + t.Run("per_type_config_default", func(t *testing.T) { + dir, beadsDir, _ := bdInit(t, bd, "--prefix", "sn") + if out, err := bdRunWithFlockRetry(t, bd, dir, "config", "set", "storage-class.task", "unversioned"); err != nil { + t.Fatalf("config set: %v\n%s", err, out) + } + // Templates default to type task; the bug template must be untouched. + plan := writeMarkdownPlan(t, dir, "batch.md", batch+` +## Batch bug + +### Type +bug + +### Description +Third. +`) + if out, err := bdRunWithFlockRetry(t, bd, dir, "create", "--file", plan); err != nil { + t.Fatalf("create --file: %v\n%s", err, out) + } + for _, title := range []string{"Batch one", "Batch two"} { + id := issueIDByTitle(t, beadsDir, "sn", "issues", title) + if cell := storageClassCell(t, beadsDir, "sn", id); !cell.Valid || cell.String != "unversioned" { + t.Errorf("%s (%s): DB cell = %+v, want the storage-class.task default", title, id, cell) + } + } + bugID := issueIDByTitle(t, beadsDir, "sn", "issues", "Batch bug") + if cell := storageClassCell(t, beadsDir, "sn", bugID); cell.Valid { + t.Errorf("Batch bug (%s): DB cell = %q, want NULL (the task default must not spill)", bugID, cell.String) + } + }) + + // C1.4 through the batch door: the spelled-out class moves every row to + // the wisp plane, exactly as --ephemeral does. + t.Run("ephemeral_spelling_routes_to_wisp_plane", func(t *testing.T) { + dir, beadsDir, _ := bdInit(t, bd, "--prefix", "sp") + plan := writeMarkdownPlan(t, dir, "batch.md", batch) + if out, err := bdRunWithFlockRetry(t, bd, dir, "create", "--file", plan, "--storage-class", "ephemeral"); err != nil { + t.Fatalf("create --file: %v\n%s", err, out) + } + for _, title := range []string{"Batch one", "Batch two"} { + id := issueIDByTitle(t, beadsDir, "sp", "wisps", title) + if id == "" { + t.Errorf("%s should live in wisps", title) + } + } + }) + + t.Run("durable_class_with_ephemeral_is_rejected", func(t *testing.T) { + dir, beadsDir, _ := bdInit(t, bd, "--prefix", "sq") + plan := writeMarkdownPlan(t, dir, "batch.md", batch) + out, err := bdRunWithFlockRetry(t, bd, dir, "create", "--file", plan, "--ephemeral", "--storage-class", "versioned") + if err == nil { + t.Fatalf("durable class with --ephemeral should be refused, got:\n%s", out) + } + if !strings.Contains(string(out), "conflicts with --ephemeral/--no-history") { + t.Errorf("expected the wisp-plane conflict error, got:\n%s", out) + } + // The whole file is refused before the transaction opens. + if id := issueIDByTitle(t, beadsDir, "sq", "issues", "Batch one"); id != "" { + t.Errorf("a refused --file left %s behind", id) + } + }) + }) + + // A plan-wide --storage-class has no meaning next to the per-node + // storage_class field that already works, so --graph refuses it the way it + // refuses --mol-type rather than accepting and ignoring it. + t.Run("graph_rejects_plan_wide_storage_class", func(t *testing.T) { + dir, _, _ := bdInit(t, bd, "--prefix", "sh") + planPath := filepath.Join(dir, "plan.json") + if err := os.WriteFile(planPath, []byte(`{"nodes":[{"key":"a","title":"Graph node","description":"n"}]}`), 0o600); err != nil { + t.Fatalf("write graph plan: %v", err) + } + out, err := bdRunWithFlockRetry(t, bd, dir, "create", "--graph", planPath, "--storage-class", "unversioned") + if err == nil { + t.Fatalf("--graph with a plan-wide --storage-class should be refused, got:\n%s", out) + } + if !strings.Contains(string(out), "set storage_class per node in the plan instead") { + t.Errorf("error should point at the per-node field, got:\n%s", out) + } + }) + t.Run("config_set_validates_value", func(t *testing.T) { dir, _, _ := bdInit(t, bd, "--prefix", "sx") out, err := bdRunWithFlockRetry(t, bd, dir, "config", "set", "storage-class.task", "permanent") diff --git a/cmd/bd/storage_class_proxied_integration_test.go b/cmd/bd/storage_class_proxied_integration_test.go new file mode 100644 index 000000000..7bc2dfdab --- /dev/null +++ b/cmd/bd/storage_class_proxied_integration_test.go @@ -0,0 +1,341 @@ +//go:build cgo + +package main + +import ( + "context" + "database/sql" + "errors" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/steveyegge/beads/internal/types" +) + +// The proxied-server mirror of TestEmbeddedCreateStorageClass. This is the +// transport the field report was filed against and the one Enterprise builds +// run: every `--storage-class` value was accepted and dropped, so an +// `ephemeral` request minted a DURABLE row and the durable-class-on-wisp-plane +// conflict the direct door rejects was silently collapsed. +// +// Every assertion reads the raw cell out of the server's own tables, because +// the JSON the command prints is the request's own struct on some routes and +// would agree with itself either way. +// +// CI note: this shard is gated on BEADS_TEST_PROXIED_SERVER=1 and runs mostly +// only on push-to-main, so it is meant to be run locally alongside any change +// to the create input path. +func TestStorageClassProxiedServer(t *testing.T) { + requireSharedProxiedServer(t) + t.Parallel() + + bd := buildEmbeddedBD(t) + + // storageClassCell pins the at-rest form (NULL vs literal) on whichever + // plane the row was supposed to land on. + storageClassCell := func(t *testing.T, db *sql.DB, table, id string) sql.NullString { + t.Helper() + var got sql.NullString + //nolint:gosec // G202: table is a test-local literal, never caller input + if err := db.QueryRowContext(context.Background(), "SELECT storage_class FROM "+table+" WHERE id = ?", id).Scan(&got); err != nil { + t.Fatalf("query %s.storage_class for %s: %v", table, id, err) + } + return got + } + + // Batch doors mint their own ids, so their rows are found by title. An + // absent row is "" rather than a failure: the PLANE is what is under test. + idByTitle := func(t *testing.T, db *sql.DB, table, title string) string { + t.Helper() + var id string + //nolint:gosec // G202: table is a test-local literal, never caller input + err := db.QueryRowContext(context.Background(), "SELECT id FROM "+table+" WHERE title = ?", title).Scan(&id) + if errors.Is(err, sql.ErrNoRows) { + return "" + } + if err != nil { + t.Fatalf("query %s by title %q: %v", table, title, err) + } + return id + } + + setStorageClassConfig := func(t *testing.T, p proxiedProject, key, value string) { + t.Helper() + if out, err := bdProxiedRun(t, bd, p.dir, "config", "set", key, value); err != nil { + t.Fatalf("config set %s: %v\n%s", key, err, out) + } + } + + // THE FIELD REPORT: `--storage-class unversioned` on this door left the cell + // NULL, so the class could never be read back — and `bd update` has no + // storage-class surface, which makes a create-time drop unrepairable. + t.Run("explicit_unversioned_persists", func(t *testing.T) { + t.Parallel() + p := newSharedProxiedProject(t, bd, "pu") + issue := bdProxiedCreate(t, bd, p.dir, "Unversioned bead", "-d", "x", "--storage-class", "unversioned") + if issue.StorageClass != types.StorageClassUnversioned { + t.Errorf("JSON storage_class = %q, want unversioned", issue.StorageClass) + } + db := openProxiedDB(t, p) + if cell := storageClassCell(t, db, "issues", issue.ID); !cell.Valid || cell.String != "unversioned" { + t.Errorf("DB cell = %+v, want 'unversioned'", cell) + } + }) + + t.Run("default_and_explicit_versioned_stay_null", func(t *testing.T) { + t.Parallel() + p := newSharedProxiedProject(t, bd, "pv") + db := openProxiedDB(t, p) + + plain := bdProxiedCreate(t, bd, p.dir, "Plain bead", "-d", "x") + if cell := storageClassCell(t, db, "issues", plain.ID); cell.Valid { + t.Errorf("plain create: DB cell = %q, want NULL", cell.String) + } + // C2.4: the explicit versioned spelling normalizes to the same NULL, so + // a NULL cell here is correct rather than the bug. + explicit := bdProxiedCreate(t, bd, p.dir, "Versioned bead", "-d", "x", "--storage-class", "versioned") + if cell := storageClassCell(t, db, "issues", explicit.ID); cell.Valid { + t.Errorf("explicit versioned: DB cell = %q, want NULL", cell.String) + } + }) + + // WORSE THAN A NO-OP before the fix: this minted a durable versioned row for + // a request that asked for ephemeral. + t.Run("ephemeral_spelling_routes_to_wisp_plane", func(t *testing.T) { + t.Parallel() + p := newSharedProxiedProject(t, bd, "pe") + issue := bdProxiedCreate(t, bd, p.dir, "Ephemeral bead", "-d", "x", "--storage-class", "ephemeral") + if !issue.Ephemeral { + t.Errorf("--storage-class ephemeral should set the ephemeral flag") + } + db := openProxiedDB(t, p) + var count int + if err := db.QueryRowContext(context.Background(), "SELECT COUNT(*) FROM issues WHERE id = ?", issue.ID).Scan(&count); err != nil { + t.Fatalf("query issues: %v", err) + } + if count != 0 { + t.Errorf("an ephemeral request minted a DURABLE row %s", issue.ID) + } + var ephemeral int + if err := db.QueryRowContext(context.Background(), "SELECT ephemeral FROM wisps WHERE id = ?", issue.ID).Scan(&ephemeral); err != nil { + t.Fatalf("query wisps: %v", err) + } + if ephemeral != 1 { + t.Errorf("wisps.ephemeral = %d, want 1", ephemeral) + } + if cell := storageClassCell(t, db, "wisps", issue.ID); cell.Valid { + t.Errorf("wisp row cell = %q, want NULL (wisp-plane rows derive their class)", cell.String) + } + }) + + // Finding A of #5164, unfixed on this route until now: the direct door + // rejects the contradiction, this one silently made the row a wisp. + t.Run("durable_class_with_wisp_plane_is_rejected", func(t *testing.T) { + t.Parallel() + p := newSharedProxiedProject(t, bd, "pf") + db := openProxiedDB(t, p) + for _, planeFlag := range []string{"--ephemeral", "--no-history"} { + out := bdProxiedCreateFail(t, bd, p.dir, "Conflicting "+planeFlag, "-d", "x", planeFlag, "--storage-class", "versioned") + // Byte-identical to the direct door's message. + if !strings.Contains(out, "conflicts with --ephemeral/--no-history") { + t.Errorf("%s: expected the wisp-plane conflict error, got:\n%s", planeFlag, out) + } + if id := idByTitle(t, db, "wisps", "Conflicting "+planeFlag); id != "" { + t.Errorf("%s: a refused create left wisp %s behind", planeFlag, id) + } + if id := idByTitle(t, db, "issues", "Conflicting "+planeFlag); id != "" { + t.Errorf("%s: a refused create left issue %s behind", planeFlag, id) + } + } + out := bdProxiedCreateFail(t, bd, p.dir, "Doubly ephemeral", "-d", "x", "--no-history", "--storage-class", "ephemeral") + if !strings.Contains(out, "--storage-class ephemeral and --no-history are mutually exclusive") { + t.Errorf("expected the ephemeral/no-history exclusion, got:\n%s", out) + } + }) + + // Release-audit finding #48: the per-type default was resolved only by the + // direct door, so the same config.yaml produced different rows depending on + // which transport the workspace was initialized with. + t.Run("per_type_config_default", func(t *testing.T) { + t.Parallel() + p := newSharedProxiedProject(t, bd, "pc") + setStorageClassConfig(t, p, "storage-class.task", "unversioned") + db := openProxiedDB(t, p) + + byDefault := bdProxiedCreate(t, bd, p.dir, "Defaulted bead", "-d", "x", "-t", "task") + if cell := storageClassCell(t, db, "issues", byDefault.ID); !cell.Valid || cell.String != "unversioned" { + t.Errorf("config default: DB cell = %+v, want 'unversioned'", cell) + } + // Flag over config (C1.3), and versioned normalizes back to NULL. + forced := bdProxiedCreate(t, bd, p.dir, "Forced versioned", "-d", "x", "-t", "task", "--storage-class", "versioned") + if cell := storageClassCell(t, db, "issues", forced.ID); cell.Valid { + t.Errorf("explicit versioned over config default: DB cell = %q, want NULL", cell.String) + } + // Other types are untouched by the task default. + bug := bdProxiedCreate(t, bd, p.dir, "A bug", "-d", "x", "-t", "bug") + if cell := storageClassCell(t, db, "issues", bug.ID); cell.Valid { + t.Errorf("other type: DB cell = %q, want NULL", cell.String) + } + // A config-derived durable class is not a caller contradiction, so it + // YIELDS to the explicit plane instead of blocking the create. + yielded := bdProxiedCreate(t, bd, p.dir, "Ephemeral over config", "-d", "x", "-t", "task", "--ephemeral") + if !yielded.Ephemeral { + t.Errorf("--ephemeral over config default should set the ephemeral flag") + } + if cell := storageClassCell(t, db, "wisps", yielded.ID); cell.Valid { + t.Errorf("config-derived unversioned leaked to the wisp row: %q", cell.String) + } + }) + + // buildMarkdownBatchRequest is ONE projection shared by both transports, so + // this is the proxied half of the same fix the embedded suite covers. + t.Run("markdown_batch", func(t *testing.T) { + t.Parallel() + p := newSharedProxiedProject(t, bd, "pm") + db := openProxiedDB(t, p) + writeBatch := func(t *testing.T, name, body string) string { + t.Helper() + path := filepath.Join(p.dir, name) + if err := os.WriteFile(path, []byte(body), 0o600); err != nil { + t.Fatalf("write markdown plan: %v", err) + } + return path + } + + unversioned := writeBatch(t, "unversioned.md", `## Proxied batch one + +### Description +First. + +## Proxied batch two + +### Description +Second. +`) + if out, err := bdProxiedRun(t, bd, p.dir, "create", "--file", unversioned, "--storage-class", "unversioned"); err != nil { + t.Fatalf("create --file: %v\n%s", err, out) + } + for _, title := range []string{"Proxied batch one", "Proxied batch two"} { + id := idByTitle(t, db, "issues", title) + if id == "" { + t.Fatalf("%s was not created", title) + } + if cell := storageClassCell(t, db, "issues", id); !cell.Valid || cell.String != "unversioned" { + t.Errorf("%s (%s): DB cell = %+v, want 'unversioned'", title, id, cell) + } + } + + ephemeral := writeBatch(t, "ephemeral.md", `## Proxied batch wisp + +### Description +Third. +`) + if out, err := bdProxiedRun(t, bd, p.dir, "create", "--file", ephemeral, "--storage-class", "ephemeral"); err != nil { + t.Fatalf("create --file --storage-class ephemeral: %v\n%s", err, out) + } + if id := idByTitle(t, db, "wisps", "Proxied batch wisp"); id == "" { + t.Error("--file --storage-class ephemeral should land its rows in wisps") + } + + conflicting := writeBatch(t, "conflict.md", `## Proxied batch refused + +### Description +Fourth. +`) + out, err := bdProxiedRun(t, bd, p.dir, "create", "--file", conflicting, "--ephemeral", "--storage-class", "versioned") + if err == nil { + t.Fatalf("durable class with --ephemeral should be refused, got:\n%s", out) + } + if !strings.Contains(string(out), "conflicts with --ephemeral/--no-history") { + t.Errorf("expected the wisp-plane conflict error, got:\n%s", out) + } + if id := idByTitle(t, db, "issues", "Proxied batch refused"); id != "" { + t.Errorf("a refused --file left %s behind", id) + } + }) + + t.Run("markdown_batch_per_type_config_default", func(t *testing.T) { + t.Parallel() + p := newSharedProxiedProject(t, bd, "pb") + setStorageClassConfig(t, p, "storage-class.task", "unversioned") + db := openProxiedDB(t, p) + + path := filepath.Join(p.dir, "defaults.md") + if err := os.WriteFile(path, []byte(`## Proxied default task + +### Description +Task body. + +## Proxied default bug + +### Type +bug + +### Description +Bug body. +`), 0o600); err != nil { + t.Fatalf("write markdown plan: %v", err) + } + if out, err := bdProxiedRun(t, bd, p.dir, "create", "--file", path); err != nil { + t.Fatalf("create --file: %v\n%s", err, out) + } + taskID := idByTitle(t, db, "issues", "Proxied default task") + if cell := storageClassCell(t, db, "issues", taskID); !cell.Valid || cell.String != "unversioned" { + t.Errorf("task template: DB cell = %+v, want the storage-class.task default", cell) + } + bugID := idByTitle(t, db, "issues", "Proxied default bug") + if cell := storageClassCell(t, db, "issues", bugID); cell.Valid { + t.Errorf("bug template: DB cell = %q, want NULL (the task default must not spill)", cell.String) + } + }) + + t.Run("graph_rejects_plan_wide_storage_class", func(t *testing.T) { + t.Parallel() + p := newSharedProxiedProject(t, bd, "pg") + path := filepath.Join(p.dir, "plan.json") + if err := os.WriteFile(path, []byte(`{"nodes":[{"key":"a","title":"Proxied graph node","description":"n"}]}`), 0o600); err != nil { + t.Fatalf("write graph plan: %v", err) + } + out := bdProxiedCreateFail(t, bd, p.dir, "--graph", path, "--storage-class", "unversioned") + if !strings.Contains(out, "set storage_class per node in the plan instead") { + t.Errorf("error should point at the per-node field, got:\n%s", out) + } + // The per-node field is the mechanism that works, on this transport too. + perNode := filepath.Join(p.dir, "per-node.json") + if err := os.WriteFile(perNode, []byte(`{"nodes":[{"key":"a","title":"Proxied per-node","description":"n","storage_class":"unversioned"}]}`), 0o600); err != nil { + t.Fatalf("write graph plan: %v", err) + } + if out, err := bdProxiedRun(t, bd, p.dir, "create", "--graph", perNode); err != nil { + t.Fatalf("create --graph with a per-node class: %v\n%s", err, out) + } + db := openProxiedDB(t, p) + id := idByTitle(t, db, "issues", "Proxied per-node") + if cell := storageClassCell(t, db, "issues", id); !cell.Valid || cell.String != "unversioned" { + t.Errorf("per-node class: DB cell = %+v, want 'unversioned'", cell) + } + }) + + // The dry-run preview builds the same issue the real create does, so it + // inherits the fix — and a preview that showed a class the create would not + // write would be worse than none. + t.Run("dry_run_preview_shows_the_resolved_class", func(t *testing.T) { + t.Parallel() + p := newSharedProxiedProject(t, bd, "pd") + setStorageClassConfig(t, p, "storage-class.bug", "unversioned") + + preview := bdProxiedCreate(t, bd, p.dir, "Previewed bead", "-d", "x", "--dry-run", "--storage-class", "unversioned") + if preview.StorageClass != types.StorageClassUnversioned { + t.Errorf("dry-run preview storage_class = %q, want unversioned", preview.StorageClass) + } + fromConfig := bdProxiedCreate(t, bd, p.dir, "Previewed default", "-d", "x", "-t", "bug", "--dry-run") + if fromConfig.StorageClass != types.StorageClassUnversioned { + t.Errorf("dry-run preview of the config default = %q, want unversioned", fromConfig.StorageClass) + } + wisp := bdProxiedCreate(t, bd, p.dir, "Previewed wisp", "-d", "x", "--dry-run", "--storage-class", "ephemeral") + if !wisp.Ephemeral || wisp.StorageClass != "" { + t.Errorf("dry-run preview of the ephemeral spelling: ephemeral=%v class=%q", wisp.Ephemeral, wisp.StorageClass) + } + }) +} diff --git a/cmd/bd/storage_class_pure_test.go b/cmd/bd/storage_class_pure_test.go index db43a440f..162ba7692 100644 --- a/cmd/bd/storage_class_pure_test.go +++ b/cmd/bd/storage_class_pure_test.go @@ -4,6 +4,7 @@ import ( "strings" "testing" + "github.com/steveyegge/beads/internal/config" "github.com/steveyegge/beads/internal/types" ) @@ -97,3 +98,157 @@ func TestReconcileStorageClassPlane(t *testing.T) { }) } } + +// resolveCreateStorageClass is the ONE create-time decision every CLI door +// makes, so its table is the contract the direct, proxied and --file routes all +// answer from. Each case names the class the caller asked for, the plane flags +// it asked for, and what the record must end up as. +func TestResolveCreateStorageClass(t *testing.T) { + tests := []struct { + name string + flag string + issueType types.IssueType + wisp bool + noHistory bool + wantClass types.StorageClass + wantWisp bool + wantErr string + }{ + {name: "no flag is unset", issueType: types.TypeTask}, + {name: "explicit unversioned persists", flag: "unversioned", issueType: types.TypeTask, wantClass: types.StorageClassUnversioned}, + // C2.4: versioned is the default and serializes as the unset marker, so + // the durable row carries no cell. + {name: "explicit versioned normalizes to unset", flag: "versioned", issueType: types.TypeTask}, + // C1.4: the spelled-out ephemeral class IS --ephemeral, and a wisp-plane + // row derives its class (C1.2) rather than carrying a marker. + {name: "explicit ephemeral routes to the wisp plane", flag: "ephemeral", issueType: types.TypeTask, wantWisp: true}, + {name: "ephemeral flag alone leaves the class unset", issueType: types.TypeTask, wisp: true, wantWisp: true}, + {name: "no-history alone leaves the class unset", issueType: types.TypeTask, noHistory: true}, + // An explicit durable class on a wisp plane is a contradiction the caller + // spelled out, so it is refused rather than silently collapsed. + {name: "explicit versioned with --ephemeral conflicts", flag: "versioned", issueType: types.TypeTask, wisp: true, wantWisp: true, wantErr: "conflicts with --ephemeral/--no-history"}, + {name: "explicit unversioned with --ephemeral conflicts", flag: "unversioned", issueType: types.TypeTask, wisp: true, wantWisp: true, wantErr: "conflicts with --ephemeral/--no-history"}, + {name: "explicit unversioned with --no-history conflicts", flag: "unversioned", issueType: types.TypeTask, noHistory: true, wantErr: "conflicts with --ephemeral/--no-history"}, + {name: "explicit ephemeral with --no-history conflicts", flag: "ephemeral", issueType: types.TypeTask, noHistory: true, wantErr: "--storage-class ephemeral and --no-history are mutually exclusive"}, + {name: "unparseable flag is a usage error", flag: "permanent", issueType: types.TypeTask, wantErr: "versioned, unversioned, or ephemeral"}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + gotClass, gotWisp, err := resolveCreateStorageClass(tt.flag, tt.issueType, tt.wisp, tt.noHistory) + if tt.wantErr != "" { + if err == nil || !strings.Contains(err.Error(), tt.wantErr) { + t.Fatalf("resolveCreateStorageClass(%q, wisp=%v, noHistory=%v) error = %v, want one containing %q", + tt.flag, tt.wisp, tt.noHistory, err, tt.wantErr) + } + return + } + if err != nil { + t.Fatalf("resolveCreateStorageClass(%q, wisp=%v, noHistory=%v): %v", tt.flag, tt.wisp, tt.noHistory, err) + } + if gotClass != tt.wantClass || gotWisp != tt.wantWisp { + t.Errorf("resolveCreateStorageClass(%q, wisp=%v, noHistory=%v) = (%q, %v), want (%q, %v)", + tt.flag, tt.wisp, tt.noHistory, gotClass, gotWisp, tt.wantClass, tt.wantWisp) + } + }) + } +} + +// The per-type storage-class. default is the half of the contract the +// proxied and --file doors used to skip entirely, and it is keyed on the +// NORMALIZED type, so an alias must find the canonical key. +func TestResolveCreateStorageClassConfigDefault(t *testing.T) { + initConfigForTest(t) + config.Set("storage-class.task", "unversioned") + config.Set("storage-class.feature", "unversioned") + + class, wisp, err := resolveCreateStorageClass("", types.TypeTask, false, false) + if err != nil || class != types.StorageClassUnversioned || wisp { + t.Errorf("config default: got (%q, %v, %v), want (unversioned, false, nil)", class, wisp, err) + } + // Aliases normalize before the lookup, so --type feat finds + // storage-class.feature (the only spelling `bd config set` accepts). + class, _, err = resolveCreateStorageClass("", types.IssueType("feat"), false, false) + if err != nil || class != types.StorageClassUnversioned { + t.Errorf("alias type: got (%q, %v), want unversioned", class, err) + } + // Another type is untouched. + class, _, err = resolveCreateStorageClass("", types.TypeBug, false, false) + if err != nil || class != "" { + t.Errorf("unconfigured type: got (%q, %v), want unset", class, err) + } + // Flag over config (C1.3). + class, _, err = resolveCreateStorageClass("versioned", types.TypeTask, false, false) + if err != nil || class != "" { + t.Errorf("explicit versioned over config default: got (%q, %v), want unset", class, err) + } + // A config-derived durable class is not a caller contradiction, so it YIELDS + // to the explicit plane rather than blocking the create. + class, wisp, err = resolveCreateStorageClass("", types.TypeTask, true, false) + if err != nil || class != "" || !wisp { + t.Errorf("config default under --ephemeral: got (%q, %v, %v), want ('', true, nil)", class, wisp, err) + } +} + +// The proxied single create's whole bug was that the class never reached +// createInput, so the two links in that chain get their own pins. +func TestGatherCreateInputCarriesStorageClass(t *testing.T) { + initConfigForTest(t) + + in, err := gatherCreateInput(newCreateFlagsCommand(t, "--storage-class", "unversioned"), []string{"Unversioned"}) + if err != nil { + t.Fatalf("gatherCreateInput: %v", err) + } + if in.storageClass != types.StorageClassUnversioned || in.storageClassFlag != "unversioned" || in.ephemeral { + t.Errorf("unversioned: storageClass=%q flag=%q ephemeral=%v", in.storageClass, in.storageClassFlag, in.ephemeral) + } + if issue := buildCreateIssueFromInput(in); issue.StorageClass != types.StorageClassUnversioned { + t.Errorf("buildCreateIssueFromInput dropped the class: got %q", issue.StorageClass) + } + + // C1.4 on the proxied door: the spelled-out class flips the input to the + // wisp plane, which is what routes the create away from the durable table. + in, err = gatherCreateInput(newCreateFlagsCommand(t, "--storage-class", "ephemeral"), []string{"Ephemeral"}) + if err != nil { + t.Fatalf("gatherCreateInput ephemeral: %v", err) + } + if !in.ephemeral || in.storageClass != "" { + t.Errorf("ephemeral spelling: ephemeral=%v storageClass=%q, want true/unset", in.ephemeral, in.storageClass) + } + if issue := buildCreateIssueFromInput(in); !issue.Ephemeral || issue.StorageClass != "" { + t.Errorf("buildCreateIssueFromInput: ephemeral=%v class=%q", issue.Ephemeral, issue.StorageClass) + } + + if _, err := gatherCreateInput(newCreateFlagsCommand(t, "--ephemeral", "--storage-class", "versioned"), []string{"Conflict"}); err == nil { + t.Error("--ephemeral with an explicit durable class should be refused before any transaction") + } + + // --file keeps the RAW flag for per-template resolution and resolves nothing + // here: the per-type default needs a type, and only a template has one. + in, err = gatherCreateInput(newCreateFlagsCommand(t, "--file", "plan.md", "--storage-class", "unversioned"), nil) + if err != nil { + t.Fatalf("gatherCreateInput --file: %v", err) + } + if in.storageClassFlag != "unversioned" || in.storageClass != "" { + t.Errorf("--file: flag=%q resolved=%q, want the raw flag and no premature resolution", in.storageClassFlag, in.storageClass) + } +} + +// --graph refuses a plan-wide --storage-class the way it already refuses +// --mol-type: the per-node storage_class field (plus its per-type config +// default) is the mechanism that works, and a second plan-wide one would only +// raise precedence questions. Both transports route through this check. +// (HandleError writes the text to stderr and returns a bare exit code, so the +// wording is pinned by the subprocess suites that capture it.) +func TestRejectSingleIssueFlagsForGraphRefusesStorageClass(t *testing.T) { + if err := rejectSingleIssueFlagsForGraph(newCreateFlagsCommand(t, "--graph", "plan.json", "--storage-class", "unversioned")); err == nil { + t.Fatal("--graph with a plan-wide --storage-class should be refused") + } + if err := rejectSingleIssueFlagsForGraph(newCreateFlagsCommand(t, "--graph", "plan.json")); err != nil { + t.Errorf("--graph without the flag should pass: %v", err) + } + // --file still HONORS the flag, so it must not be caught by the graph + // rejection's shared single-issue list. + if err := rejectSingleIssueFlagsForMarkdown(newCreateFlagsCommand(t, "--file", "plan.md", "--storage-class", "unversioned")); err != nil { + t.Errorf("--file with --storage-class should be accepted: %v", err) + } +} diff --git a/cmd/bd/store_factory.go b/cmd/bd/store_factory.go index 86a30af50..c6cedd9bd 100644 --- a/cmd/bd/store_factory.go +++ b/cmd/bd/store_factory.go @@ -104,7 +104,9 @@ func newDoltStore(ctx context.Context, cfg *dolt.Config) (s storage.DoltStorage, // Working-set-reconcile commands (bd dolt commit, bd vc commit) must // not be bricked by a pending-migration dirty-table refusal: that // refusal's documented recovery is exactly the commit these commands - // run, so failing the open here would deadlock (#4566). + // run, so failing the open here would deadlock (#4566). The server + // arm above honors the same cfg.LenientOpen inside dolt.New; this + // branch is the embedded half of one policy, not the whole of it. return embeddeddolt.OpenForWorkingSetReconcile(ctx, cfg.BeadsDir, cfg.Database, "main") } return embeddeddolt.Open(ctx, cfg.BeadsDir, cfg.Database, "main") @@ -152,7 +154,7 @@ func newDoltStoreFromConfig(ctx context.Context, beadsDir string) (s storage.Dol // metadata.json (cfg == nil, err == nil) keeps the embedded default. return nil, fmt.Errorf("load %s: %w (refusing to fall back to the embedded store)", configfile.ConfigPath(beadsDir), err) } - if err := validateConfiguredBackend(cfg); err != nil { + if err := validateConfiguredBackend(cfg, beadsDir); err != nil { return nil, err } cfg = normalizeLoadedConfig(cfg) @@ -260,7 +262,7 @@ func openNonMutatingStoreFromConfig(ctx context.Context, beadsDir string, previe // "database not found" the embedded open would produce. return nil, fmt.Errorf("load %s: %w (refusing to fall back to the embedded store)", configfile.ConfigPath(beadsDir), err) } - if err := validateConfiguredBackend(cfg); err != nil { + if err := validateConfiguredBackend(cfg, beadsDir); err != nil { return nil, err } cfg = normalizeLoadedConfig(cfg) diff --git a/cmd/bd/store_factory_nocgo.go b/cmd/bd/store_factory_nocgo.go index f0599fdca..3266e1aa9 100644 --- a/cmd/bd/store_factory_nocgo.go +++ b/cmd/bd/store_factory_nocgo.go @@ -75,7 +75,7 @@ func newDoltStoreFromConfig(ctx context.Context, beadsDir string) (s storage.Dol // message below. return nil, fmt.Errorf("load %s: %w", configfile.ConfigPath(beadsDir), err) } - if err := validateConfiguredBackend(cfg); err != nil { + if err := validateConfiguredBackend(cfg, beadsDir); err != nil { return nil, err } cfg = normalizeLoadedConfig(cfg) @@ -106,7 +106,7 @@ func newReadOnlyStoreFromConfig(ctx context.Context, beadsDir string) (storage.D if err != nil { return nil, fmt.Errorf("load %s: %w", configfile.ConfigPath(beadsDir), err) } - if err := validateConfiguredBackend(cfg); err != nil { + if err := validateConfiguredBackend(cfg, beadsDir); err != nil { return nil, err } cfg = normalizeLoadedConfig(cfg) diff --git a/cmd/bd/store_selection_removed_backend_test.go b/cmd/bd/store_selection_removed_backend_test.go index 8933cdd4b..0e16bf9d2 100644 --- a/cmd/bd/store_selection_removed_backend_test.go +++ b/cmd/bd/store_selection_removed_backend_test.go @@ -378,6 +378,12 @@ func TestStoreFactoriesRemovedBackendsFailLoud(t *testing.T) { if !strings.Contains(guidance, "export") || !strings.Contains(guidance, "dolt") { t.Fatalf("error should provide safe migration guidance: %v", err) } + // With no Dolt data on disk the configured database really is + // the only copy, so the export path is right and the D-8 heal + // must not be offered — that edit would open an empty store. + if strings.Contains(guidance, "to heal") { + t.Fatalf("error offered a metadata heal for a workspace with no Dolt data: %v", err) + } for _, name := range []string{"embeddeddolt", "dolt", "beads.db"} { path := filepath.Join(beadsDir, name) if _, statErr := os.Stat(path); !os.IsNotExist(statErr) { @@ -391,14 +397,15 @@ func TestStoreFactoriesRemovedBackendsFailLoud(t *testing.T) { } func TestRequireDoltBackend(t *testing.T) { + beadsDir := t.TempDir() for _, cfg := range []*configfile.Config{nil, {}, {Backend: configfile.BackendDolt}} { - if err := requireDoltBackend(cfg); err != nil { + if err := requireDoltBackend(cfg, beadsDir); err != nil { t.Fatalf("Dolt config %#v rejected: %v", cfg, err) } } for _, backend := range []string{configfile.BackendPostgres, configfile.BackendMySQL, configfile.BackendSQLite} { - err := requireDoltBackend(&configfile.Config{Backend: backend}) + err := requireDoltBackend(&configfile.Config{Backend: backend}, beadsDir) if err == nil || !strings.Contains(err.Error(), "no longer supported") || !strings.Contains(err.Error(), "export") { t.Fatalf("removed backend %q guard error = %v, want rollback and migration guidance", backend, err) } diff --git a/cmd/bd/sync_git.go b/cmd/bd/sync_git.go index 84ae162fd..ee42fe8b4 100644 --- a/cmd/bd/sync_git.go +++ b/cmd/bd/sync_git.go @@ -2,6 +2,7 @@ package main import ( "context" + "errors" "fmt" "os" "os/exec" @@ -112,18 +113,60 @@ func gitOriginHasDoltDataRefStatus() (bool, error) { } // A non-nil error means UNKNOWN, not "no data" — the bool is meaningless. +// +// The error names the failure, not the remote: every caller already names the +// remote it probed, and wrapping here too produced messages that said the URL +// and the ref twice ("...on sync.remote \"X\": probe refs/dolt/data on X: exit +// status 128"). func gitRemoteHasDoltDataRefStatus(remote string) (bool, error) { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), gitDoltDataProbeTimeout) defer cancel() cmd := exec.CommandContext(ctx, "git", "ls-remote", gitRemoteURLForLsRemote(remote), "refs/dolt/data") cmd.Env = append(os.Environ(), "GIT_TERMINAL_PROMPT=0") output, err := cmd.Output() if err != nil { - return false, fmt.Errorf("probe refs/dolt/data on %s: %w", remote, err) + return false, gitLsRemoteProbeError(ctx, err) } return strings.TrimSpace(string(output)) != "", nil } +const gitDoltDataProbeTimeout = 10 * time.Second + +// gitLsRemoteProbeError turns a failed `git ls-remote` into something a user +// can act on. exec.ExitError.Error() is only "exit status 128" — git's actual +// complaint (auth vs. DNS vs. deleted repo) sits unread in ExitError.Stderr +// because cmd.Output() captures it there, and a context timeout surfaces as +// the equally opaque "signal: killed". +func gitLsRemoteProbeError(ctx context.Context, err error) error { + if ctx.Err() == context.DeadlineExceeded { + return fmt.Errorf("git ls-remote did not answer within %s (network, or an SSH key that wants a passphrase)", gitDoltDataProbeTimeout) + } + var exitErr *exec.ExitError + if errors.As(err, &exitErr) { + // git can echo the remote it failed to reach — including a CI token in + // https://x-access-token:@host form — so scrub credentials before + // this detail reaches plan.Reason, which flows to both stderr and + // `bd bootstrap --json`. exitErr itself is only "exit status 128". + if detail := scrubURLCredentials(firstNonEmptyLine(string(exitErr.Stderr))); detail != "" { + return fmt.Errorf("git ls-remote: %v: %s", exitErr, detail) + } + } + return fmt.Errorf("git ls-remote: %w", err) +} + +// firstNonEmptyLine returns the first meaningful line of git's stderr. git +// prefixes most failures with a "remote:"/"fatal:" line that already says +// everything; the rest is usually a hint block we do not want inside a +// single-line Reason. +func firstNonEmptyLine(s string) string { + for _, line := range strings.Split(s, "\n") { + if trimmed := strings.TrimSpace(line); trimmed != "" { + return trimmed + } + } + return "" +} + func gitRemoteURLForLsRemote(remote string) string { return strings.TrimPrefix(remote, "git+") } diff --git a/cmd/bd/sync_git_test.go b/cmd/bd/sync_git_test.go index feb7e8d42..4294beb78 100644 --- a/cmd/bd/sync_git_test.go +++ b/cmd/bd/sync_git_test.go @@ -4,6 +4,7 @@ import ( "os" "os/exec" "path/filepath" + "strings" "testing" ) @@ -195,3 +196,29 @@ func runGitForSyncTest(t *testing.T, dir string, args ...string) { t.Fatalf("git %v failed: %v\n%s", args, err, string(output)) } } + +// TestGitRemoteHasDoltDataRefStatusSurfacesGitStderr proves the probe failure a +// user actually sees carries git's own diagnosis. exec.ExitError.Error() is +// only "exit status 128"; git's complaint sits unread in ExitError.Stderr, and +// bootstrap's blocked message is built from this error (#5743). +func TestGitRemoteHasDoltDataRefStatusSurfacesGitStderr(t *testing.T) { + missing := filepath.Join(t.TempDir(), "not-a-repo") + + hasData, err := gitRemoteHasDoltDataRefStatus(missing) + + if err == nil { + t.Fatalf("probe of %q returned hasData=%v and no error; want a failure", missing, hasData) + } + msg := err.Error() + if !strings.Contains(msg, "ls-remote") { + t.Errorf("error %q does not name the command that failed", msg) + } + // Whatever git's exact wording, the message must be more than the bare + // exit status — that is the whole point of reading ExitError.Stderr. + if msg == "git ls-remote: exit status 128" { + t.Errorf("error %q carries no stderr detail; the ExitError.Stderr thread-through regressed", msg) + } + if !strings.Contains(msg, "repository") && !strings.Contains(msg, "fatal") { + t.Errorf("error %q does not look like it carries git's stderr", msg) + } +} diff --git a/cmd/bd/sync_push_pull.go b/cmd/bd/sync_push_pull.go index b28eb8824..cb99b53d7 100644 --- a/cmd/bd/sync_push_pull.go +++ b/cmd/bd/sync_push_pull.go @@ -355,23 +355,24 @@ func runJiraPush(cmd *cobra.Command, args []string) error { CheckReadonly("jira push") } - if err := ensureStoreActive(); err != nil { + trackerStore, err := trackerStoreForCommand(rootCtx) + if err != nil { return HandleError("database not available: %v", err) } - if err := validateJiraConfig(); err != nil { + if err := validateJiraConfigForStore(trackerStore); err != nil { return HandleError("%v", err) } ctx := rootCtx jt := &jira.Tracker{} - if err := jt.Init(ctx, store); err != nil { + if err := jt.Init(ctx, trackerStore); err != nil { return HandleError("initializing Jira tracker: %v", err) } - engine := tracker.NewEngine(jt, store, actor) + engine := tracker.NewEngine(jt, trackerStore, actor) engine.OnMessage = func(msg string) { fmt.Println(" " + msg) } engine.OnWarning = func(msg string) { fmt.Fprintf(os.Stderr, "Warning: %s\n", msg) } - engine.PushHooks = buildJiraPushHooks(ctx) + engine.PushHooks = buildJiraPushHooksForStore(ctx, trackerStore) result, err := engine.Sync(ctx, tracker.SyncOptions{ Push: true, @@ -402,20 +403,21 @@ func runJiraPull(cmd *cobra.Command, args []string) error { CheckReadonly("jira pull") } - if err := ensureStoreActive(); err != nil { + trackerStore, err := trackerStoreForCommand(rootCtx) + if err != nil { return HandleError("database not available: %v", err) } - if err := validateJiraConfig(); err != nil { + if err := validateJiraConfigForStore(trackerStore); err != nil { return HandleError("%v", err) } ctx := rootCtx jt := &jira.Tracker{} - if err := jt.Init(ctx, store); err != nil { + if err := jt.Init(ctx, trackerStore); err != nil { return HandleError("initializing Jira tracker: %v", err) } - engine := tracker.NewEngine(jt, store, actor) + engine := tracker.NewEngine(jt, trackerStore, actor) engine.OnMessage = func(msg string) { fmt.Println(" " + msg) } engine.OnWarning = func(msg string) { fmt.Fprintf(os.Stderr, "Warning: %s\n", msg) } @@ -462,32 +464,33 @@ func runLinearPush(cmd *cobra.Command, args []string) error { }() } - if err := ensureStoreActive(); err != nil { + trackerStore, err := trackerStoreForCommand(rootCtx) + if err != nil { return HandleError("database not available: %v", err) } - if err := validateLinearConfig(nil); err != nil { + if err := validateLinearConfigForStore(trackerStore, nil); err != nil { return HandleError("%v", err) } ctx := rootCtx - teamIDs := getLinearTeamIDs(ctx, nil) + teamIDs := getLinearTeamIDsForStore(ctx, trackerStore, nil) if len(teamIDs) > 1 { return HandleError("linear push does not support multiple configured teams\nUse: bd linear sync --push --team ") } lt := &linear.Tracker{} lt.SetTeamIDs(teamIDs) - if err := lt.Init(ctx, store); err != nil { + if err := lt.Init(ctx, trackerStore); err != nil { return HandleError("initializing Linear tracker: %v", err) } if err := lt.ValidatePushStateMappings(ctx); err != nil { return HandleError("%v", err) } - engine := tracker.NewEngine(lt, store, actor) + engine := tracker.NewEngine(lt, trackerStore, actor) engine.OnMessage = func(msg string) { fmt.Println(" " + msg) } engine.OnWarning = func(msg string) { fmt.Fprintf(os.Stderr, "Warning: %s\n", msg) } - engine.PushHooks = buildLinearPushHooks(ctx, lt, len(args) > 0) + engine.PushHooks = buildLinearPushHooksForStore(ctx, trackerStore, lt, len(args) > 0) result, err := engine.Sync(ctx, tracker.SyncOptions{ Push: true, @@ -532,26 +535,27 @@ func runLinearPull(cmd *cobra.Command, args []string) error { }() } - if err := ensureStoreActive(); err != nil { + trackerStore, err := trackerStoreForCommand(rootCtx) + if err != nil { return HandleError("database not available: %v", err) } - if err := validateLinearConfig(nil); err != nil { + if err := validateLinearConfigForStore(trackerStore, nil); err != nil { return HandleError("%v", err) } ctx := rootCtx - teamIDs := getLinearTeamIDs(ctx, nil) + teamIDs := getLinearTeamIDsForStore(ctx, trackerStore, nil) lt := &linear.Tracker{} lt.SetTeamIDs(teamIDs) - if err := lt.Init(ctx, store); err != nil { + if err := lt.Init(ctx, trackerStore); err != nil { return HandleError("initializing Linear tracker: %v", err) } - engine := tracker.NewEngine(lt, store, actor) + engine := tracker.NewEngine(lt, trackerStore, actor) engine.OnMessage = func(msg string) { fmt.Println(" " + msg) } engine.OnWarning = func(msg string) { fmt.Fprintf(os.Stderr, "Warning: %s\n", msg) } - engine.PullHooks = buildLinearPullHooks(ctx, linearPullHookOptions{ + engine.PullHooks = buildLinearPullHooksForStore(ctx, trackerStore, linearPullHookOptions{ DryRun: dryRun, Actor: actor, }) diff --git a/cmd/bd/sync_remote.go b/cmd/bd/sync_remote.go index 6efdec3ab..4c8a1f86f 100644 --- a/cmd/bd/sync_remote.go +++ b/cmd/bd/sync_remote.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "os" + "regexp" "strings" "github.com/steveyegge/beads/internal/beads" @@ -66,3 +67,80 @@ func commitBeadsConfigForActiveRepo(ctx context.Context, msg string) { func normalizeRemoteURL(url string) string { return doltremote.Normalize(url) } + +// doltRemoteURL returns the form of remote that bd hands to Dolt — for +// DOLT_CLONE, for DOLT_REMOTE('add', ...), and therefore for DOLT_PUSH. +// +// A git-forge URL must reach Dolt in its git+ form. Dolt's dbfactory routes by +// scheme: raw http(s):// goes to the remotesapi client, which speaks Dolt's +// wire protocol at github.com and retries indefinitely (#4421), while +// git+https/git+ssh goes to the git remote factory, which shells out to git +// and fails cleanly. +// +// Everything else is returned byte-identical. That preserves GH#3339: a +// user-configured Dolt remotesapi endpoint (http://myserver:7007/mydb) must +// never be rewritten to git+http://, and it never classifies as a forge URL. +// +// This is the single owner of that routing rule. bd init and bd bootstrap must +// both call it: if they disagree about the URL derived from one committed +// sync.remote, that is the #5743 class of skew all over again. +func doltRemoteURL(remote string) string { + if isGitCodeRepoURL(remote) { + return normalizeRemoteURL(remote) + } + return remote +} + +// redactRemoteURL strips credentials from a remote URL so it is safe to echo +// into errors, hints, logs and JSON. CI commonly configures sync.remote as +// https://x-access-token:@github.com/org/repo.git, and the clone funnel +// already scrubs userinfo before reporting (versioncontrolops.sanitizeURL); +// diagnostics must not be the hole in that convention. +// +// HTTP(S) userinfo is transport credentials and is dropped whole. SSH userinfo +// selects the remote account (git@host is not a secret and is needed for the +// hint to be runnable), so only a password component is dropped. +func redactRemoteURL(raw string) string { + sep := strings.Index(raw, "://") + if sep < 0 { + // scp-style (git@host:path) or a bare path: no place for a password. + return raw + } + scheme, rest := raw[:sep], raw[sep+3:] + authority, tail := rest, "" + if slash := strings.Index(rest, "/"); slash >= 0 { + authority, tail = rest[:slash], rest[slash:] + } + at := strings.LastIndex(authority, "@") + if at < 0 { + return raw + } + userinfo, host := authority[:at], authority[at+1:] + if isDoltSSHScheme(scheme) { + if colon := strings.Index(userinfo, ":"); colon >= 0 { + userinfo = userinfo[:colon] + } + return scheme + "://" + userinfo + "@" + host + tail + } + return scheme + "://" + host + tail +} + +func isDoltSSHScheme(scheme string) bool { + return scheme == "ssh" || scheme == "git+ssh" +} + +// urlWithUserinfoRe matches the "scheme://userinfo@host" span of a URL embedded +// anywhere in free-form text — for example the git stderr line bootstrap folds +// into a probe error, which can echo the very remote (credentials and all) that +// git failed to reach. The userinfo run stops at the first "@" and the host run +// at the first "/" so a trailing path is left for redactRemoteURL to keep. +var urlWithUserinfoRe = regexp.MustCompile(`[a-zA-Z][a-zA-Z0-9+.-]*://[^@\s'"]*@[^/\s'"]*`) + +// scrubURLCredentials redacts credential-bearing URLs embedded anywhere in s by +// running each match through redactRemoteURL, so the same rule applied to the +// plan's own URL fields (http(s) drops userinfo, ssh drops only a password) also +// covers URLs that arrive inside arbitrary text. Text with no "userinfo@" URL is +// returned unchanged, so credential-free git diagnostics keep their full detail. +func scrubURLCredentials(s string) string { + return urlWithUserinfoRe.ReplaceAllStringFunc(s, redactRemoteURL) +} diff --git a/cmd/bd/sync_remote_test.go b/cmd/bd/sync_remote_test.go index bbbece6e9..5f9aeda02 100644 --- a/cmd/bd/sync_remote_test.go +++ b/cmd/bd/sync_remote_test.go @@ -131,3 +131,109 @@ func runGitForCommitConfigTest(t *testing.T, dir string, args ...string) string func shellQuoteForTest(s string) string { return "'" + strings.ReplaceAll(s, "'", "'\\''") + "'" } + +// TestRedactRemoteURL pins the credential scrubbing applied to every remote URL +// bd echoes into an error, a hint, a log line or JSON. CI commonly configures +// sync.remote as https://x-access-token:@github.com/org/repo.git. +func TestRedactRemoteURL(t *testing.T) { + tests := []struct { + name string + in string + want string + }{ + { + name: "https token is dropped whole", + in: "https://x-access-token:ghp_secret@github.com/org/repo.git", + want: "https://github.com/org/repo.git", + }, + { + name: "git+https token is dropped whole", + in: "git+https://user:pass@github.com/org/repo.git", + want: "git+https://github.com/org/repo.git", + }, + { + name: "http basic auth is dropped whole", + in: "http://user:pass@myserver:7007/mydb", + want: "http://myserver:7007/mydb", + }, + { + // The conventional SSH account selector is not a secret, and the + // ls-remote hint is useless without it. + name: "ssh user is kept", + in: "git+ssh://git@github.com/org/repo.git", + want: "git+ssh://git@github.com/org/repo.git", + }, + { + name: "ssh password is dropped, user kept", + in: "ssh://alice:hunter2@my-dolt.example.com/org/db", + want: "ssh://alice@my-dolt.example.com/org/db", + }, + { + name: "scp style is untouched", + in: "git@github.com:org/repo.git", + want: "git@github.com:org/repo.git", + }, + {name: "no userinfo", in: "https://github.com/org/repo.git", want: "https://github.com/org/repo.git"}, + {name: "dolt native", in: "dolthub://myorg/mydb", want: "dolthub://myorg/mydb"}, + {name: "empty", in: "", want: ""}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := redactRemoteURL(tt.in); got != tt.want { + t.Errorf("redactRemoteURL(%q) = %q, want %q", tt.in, got, tt.want) + } + }) + } +} + +// TestScrubURLCredentials covers the redaction of credential-bearing URLs that +// arrive embedded in free-form text — most importantly a `git ls-remote` stderr +// line that echoes the tokenized remote. Credential-free diagnostics must pass +// through untouched so the probe error keeps git's actual complaint (#5743). +func TestScrubURLCredentials(t *testing.T) { + tests := []struct { + name string + in string + want string + }{ + { + // The contingent leak Finding 2 guards: a git build that echoes the + // full tokenized URL. The token must go; host and path must stay. + name: "tokenized git stderr is scrubbed, host and path kept", + in: "fatal: unable to access 'https://x-access-token:ghp_TESTTOKEN@github.com/org/repo.git/': The requested URL returned error: 403", + want: "fatal: unable to access 'https://github.com/org/repo.git/': The requested URL returned error: 403", + }, + { + name: "ssh password embedded in text is dropped, user kept", + in: "note: not cloning ssh://alice:hunter2@dolt.example.com/org/db right now", + want: "note: not cloning ssh://alice@dolt.example.com/org/db right now", + }, + { + name: "two credential URLs in one line are both scrubbed", + in: "https://u:p@a.example.com/x and https://v:q@b.example.com/y", + want: "https://a.example.com/x and https://b.example.com/y", + }, + { + // The common case: modern git already prints host-only, and DNS/repo + // errors carry no userinfo. Nothing must be altered. + name: "credential-free git stderr is unchanged", + in: "fatal: repository 'https://github.com/org/repo.git/' not found", + want: "fatal: repository 'https://github.com/org/repo.git/' not found", + }, + { + name: "plain diagnostic without a URL is unchanged", + in: "fatal: Could not read from remote repository.", + want: "fatal: Could not read from remote repository.", + }, + {name: "empty", in: "", want: ""}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := scrubURLCredentials(tt.in); got != tt.want { + t.Errorf("scrubURLCredentials(%q) = %q, want %q", tt.in, got, tt.want) + } + }) + } +} diff --git a/cmd/bd/test_repo_beads_guard_test.go b/cmd/bd/test_repo_beads_guard_test.go index 35c5193eb..5149084b8 100644 --- a/cmd/bd/test_repo_beads_guard_test.go +++ b/cmd/bd/test_repo_beads_guard_test.go @@ -11,6 +11,7 @@ import ( "github.com/steveyegge/beads/internal/config" "github.com/steveyegge/beads/internal/doltserver" "github.com/steveyegge/beads/internal/metrics" + "github.com/steveyegge/beads/internal/migration" "github.com/steveyegge/beads/internal/testutil" ) @@ -139,6 +140,15 @@ func testMainInner(m *testing.M) int { _ = os.Setenv(metrics.EnvDisableMetrics, "1") _ = os.Setenv(metrics.EnvDisableEventFlush, "1") + // Pin the migration-freeze override to a path that cannot exist (dc-6jaq). + // The freeze gate walks every ancestor of the workspace and of the cwd up + // to the filesystem root, so a stray MIGRATION-FREEZE above TMPDIR — or in + // a developer's home, or exported by their shell — would refuse every + // write in every subprocess suite in this package with exit 14. The + // override is authoritative, so pinning it here holds the walk off + // globally; the freeze tests that need the walk clear it per-run. + _ = os.Setenv(migration.EnvFreezeFile, filepath.Join(tmp, "no-such-freeze-marker")) + // Also reset viper state that was loaded by main.go's init(). config.ResetForTesting() diff --git a/cmd/bd/testdata/events_journal_records.jsonl b/cmd/bd/testdata/events_journal_records.jsonl index 81a6ee83a..cdc63bec7 100644 --- a/cmd/bd/testdata/events_journal_records.jsonl +++ b/cmd/bd/testdata/events_journal_records.jsonl @@ -8,4 +8,6 @@ {"seq":8,"ts":"2026-01-02T03:04:05Z","op":"comment","issue_id":"bd-102","actor":"worker-1","issue":{"id":"bd-102","title":"leased work","status":"in_progress","priority":1,"issue_type":"task","assignee":"worker-1","created_at":"2026-01-02T03:00:00Z","updated_at":"2026-01-02T03:04:05Z","lease_expires_at":"2026-01-02T04:04:00Z","heartbeat_at":"2026-01-02T03:04:00Z"},"comment":{"id":"cmt-2","author":"worker-1","text":"status note","created_at":"2026-01-02T03:04:05Z","source":"audit"}} {"seq":9,"ts":"2026-01-02T03:04:05Z","op":"close","issue_id":"bd-101","actor":"worker-1","issue":{"id":"bd-101","title":"durable journal","status":"closed","priority":0,"issue_type":"feature","created_at":"2026-01-02T03:00:00Z","updated_at":"2026-01-02T03:30:00Z","closed_at":"2026-01-02T03:30:00Z","close_reason":"shipped"}} {"seq":10,"ts":"2026-01-02T03:04:05Z","op":"create","issue_id":"bd-wisp-1","actor":"author","issue":{"id":"bd-wisp-1","title":"convoy member","status":"open","priority":2,"issue_type":"task","created_at":"2026-01-02T03:00:00Z","updated_at":"2026-01-02T03:04:05Z","ephemeral":true,"wisp_type":"convoy"}} -{"seq":11,"ts":"2026-01-02T03:04:05Z","op":"delete","issue_id":"bd-100","issue":null} +{"seq":11,"ts":"2026-01-02T03:04:05Z","op":"dep_remove","issue_id":"bd-101","actor":"deleter-1","issue":{"id":"bd-101","title":"durable journal","description":"append-only record","acceptance_criteria":"replayable","status":"in_progress","priority":0,"issue_type":"feature","assignee":"worker-1","owner":"dev@example.com","estimated_minutes":90,"created_at":"2026-01-02T03:00:00Z","created_by":"author","updated_at":"2026-01-02T03:04:05Z","external_ref":"gh-9","source_system":"github","metadata":{"k":"v"},"labels":["infra","urgent"]},"dep":{"kind":"blocks","target":"bd-100","metadata":""}} +{"seq":12,"ts":"2026-01-02T03:04:05Z","op":"delete","issue_id":"bd-100","actor":"deleter-1","issue":null} +{"seq":13,"ts":"2026-01-02T03:04:05Z","op":"delete","issue_id":"bd-wisp-1","issue":null} diff --git a/cmd/bd/tips.go b/cmd/bd/tips.go index cd7866591..70a7e7512 100644 --- a/cmd/bd/tips.go +++ b/cmd/bd/tips.go @@ -167,6 +167,14 @@ func recordTipShown(store tipMetadataWriter, tipID string) { return } + // dc-6jaq: with dolt auto-commit off this writes to the store immediately + // rather than deferring to PersistentPostRunE, so the freeze guard there + // does not cover it. Showing a tip is never worth a write into a workspace + // someone is migrating, and the tip itself still prints. + if commandFreeze.Frozen() { + return + } + // If dolt auto-commit is enabled, defer the metadata write so it can be // committed as a separate Dolt commit in PostRun. // This avoids tip metadata getting bundled into the main command commit. diff --git a/cmd/bd/tracker_frontdoor_proxy_test.go b/cmd/bd/tracker_frontdoor_proxy_test.go new file mode 100644 index 000000000..db5fe3830 --- /dev/null +++ b/cmd/bd/tracker_frontdoor_proxy_test.go @@ -0,0 +1,202 @@ +package main + +import ( + "context" + "fmt" + "io" + "net/http" + "strings" + "testing" + + "github.com/steveyegge/beads/internal/linear" + "github.com/steveyegge/beads/internal/tracker" + "github.com/steveyegge/beads/internal/types" +) + +// configOnlyTrackerStore exercises front-door validation without constructing +// a local Dolt store. The embedded interface is intentionally unused by these +// tests; any accidental persistence call will panic, making the boundary +// regression visible. +type configOnlyTrackerStore struct { + tracker.Store + config map[string]string +} + +func (s *configOnlyTrackerStore) GetConfig(_ context.Context, key string) (string, error) { + return s.config[key], nil +} + +func TestValidateLinearConfigForStoreUsesProxiedStore(t *testing.T) { + old := rootCtx + rootCtx = context.Background() + t.Cleanup(func() { rootCtx = old }) + t.Setenv("LINEAR_OAUTH_CLIENT_ID", "client") + t.Setenv("LINEAR_OAUTH_CLIENT_SECRET", "secret") + t.Setenv("LINEAR_TEAM_ID", "12345678-1234-1234-1234-123456789abc") + + st := &configOnlyTrackerStore{config: map[string]string{}} + if err := validateLinearConfigForStore(st, nil); err != nil { + t.Fatalf("proxied Linear validation failed: %v", err) + } + got := getLinearTeamIDsForStore(context.Background(), st, nil) + if len(got) != 1 || got[0] != "12345678-1234-1234-1234-123456789abc" { + t.Fatalf("team IDs = %#v", got) + } +} + +func TestValidateJiraConfigForStoreUsesProxiedStore(t *testing.T) { + old := rootCtx + rootCtx = context.Background() + t.Cleanup(func() { rootCtx = old }) + + st := &configOnlyTrackerStore{config: map[string]string{ + "jira.url": "https://example.atlassian.net", + "jira.project": "GC", + "jira.api_token": "token", + }} + if err := validateJiraConfigForStore(st); err != nil { + t.Fatalf("proxied Jira validation failed: %v", err) + } +} + +func TestValidateJiraConfigForStoreRejectsMissingStore(t *testing.T) { + if err := validateJiraConfigForStore(nil); err == nil { + t.Fatal("expected missing-store error") + } +} + +type parentLinkStore struct { + configOnlyTrackerStore + issues []*types.Issue + deps map[string][]*types.IssueWithDependencyMetadata +} + +func (s *parentLinkStore) SearchIssues(context.Context, string, types.IssueFilter) ([]*types.Issue, error) { + return s.issues, nil +} + +func (s *parentLinkStore) GetDependenciesWithMetadata(_ context.Context, id string) ([]*types.IssueWithDependencyMetadata, error) { + return s.deps[id], nil +} + +func TestBuildLinearParentLinksForStoreUsesProxiedStore(t *testing.T) { + parentRef := "https://linear.app/team/issue/ENG-1/parent" + childRef := "https://linear.app/team/issue/ENG-2/child" + parent := &types.Issue{ID: "bd-parent", ExternalRef: &parentRef} + child := &types.Issue{ID: "bd-child", ExternalRef: &childRef} + st := &parentLinkStore{ + issues: []*types.Issue{parent, child}, + deps: map[string][]*types.IssueWithDependencyMetadata{ + "bd-child": {{Issue: *parent, DependencyType: types.DepParentChild}}, + }, + } + links, err := buildLinearParentLinksForStore(context.Background(), st, &linear.Tracker{}) + if err != nil { + t.Fatalf("build links: %v", err) + } + if len(links) != 1 || links[0].ChildIdentifier != "ENG-2" || links[0].ParentIdentifier != "ENG-1" { + t.Fatalf("links = %#v", links) + } +} + +func TestBuildLinearClientAPIOnlyDoesNotProbeLocalStore(t *testing.T) { + oldPath, oldStore := dbPath, store + dbPath, store = "/definitely/missing/local/beads.db", nil + t.Cleanup(func() { dbPath, store = oldPath, oldStore }) + t.Setenv("LINEAR_API_KEY", "api-key") + client, err := buildLinearClientAPIOnly(context.Background(), "", nil) + if err != nil || client == nil { + t.Fatalf("API-only client: client=%v err=%v", client, err) + } +} + +type teamsRoundTripper struct{ called bool } + +func (rt *teamsRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + rt.called = true + if req.Method != http.MethodPost || req.URL.String() != "https://api.linear.app/graphql" { + return nil, fmt.Errorf("unexpected request %s %s", req.Method, req.URL) + } + body := `{"data":{"teams":{"nodes":[{"id":"team-1","name":"Engineering","key":"ENG"}]}}}` + return &http.Response{StatusCode: 200, Body: io.NopCloser(strings.NewReader(body)), Header: make(http.Header), Request: req}, nil +} + +func TestRunLinearTeamsAPIOnlyDoesNotOpenLocalStore(t *testing.T) { + oldPath, oldStore, oldJSON, oldCtx := dbPath, store, jsonOutput, rootCtx + oldTransport := http.DefaultTransport + t.Cleanup(func() { + dbPath, store, jsonOutput, rootCtx, http.DefaultTransport = oldPath, oldStore, oldJSON, oldCtx, oldTransport + }) + dbPath, store, jsonOutput, rootCtx = "/definitely/missing/local/beads.db", nil, true, context.Background() + t.Setenv("LINEAR_API_KEY", "api-key") + rt := &teamsRoundTripper{} + http.DefaultTransport = rt + if err := runLinearTeams(nil, nil); err != nil { + t.Fatalf("runLinearTeams: %v", err) + } + if !rt.called { + t.Fatal("expected Linear teams API request") + } +} + +func TestBuildLinearClientAPIOnlyUsesProxiedEndpointConfig(t *testing.T) { + t.Setenv("LINEAR_API_KEY", "api-key") + st := &configOnlyTrackerStore{config: map[string]string{"linear.api_endpoint": "https://proxy.example/graphql"}} + oldTransport := http.DefaultTransport + t.Cleanup(func() { http.DefaultTransport = oldTransport }) + http.DefaultTransport = roundTripperFunc(func(req *http.Request) (*http.Response, error) { + if req.URL.String() != "https://proxy.example/graphql" { + return nil, fmt.Errorf("unexpected endpoint %s", req.URL) + } + return &http.Response{StatusCode: 200, Body: io.NopCloser(strings.NewReader(`{"data":{"teams":{"nodes":[]}}}`)), Header: make(http.Header), Request: req}, nil + }) + client, err := buildLinearClientAPIOnly(context.Background(), "", st) + if err != nil { + t.Fatalf("build client: %v", err) + } + if _, err := client.FetchTeams(context.Background()); err != nil { + t.Fatalf("fetch teams: %v", err) + } +} + +// TestBuildLinearClientAPIOnlyUsesProxiedEndpointConfigOnOAuth is the OAuth +// mirror of the test above. The helper must apply linear.api_endpoint on BOTH +// auth branches, as Tracker.Init does; an early return on the OAuth branch +// silently ignores a configured custom endpoint whenever OAuth credentials are +// present, which is the whole set of CI environments. +func TestBuildLinearClientAPIOnlyUsesProxiedEndpointConfigOnOAuth(t *testing.T) { + t.Setenv("LINEAR_OAUTH_CLIENT_ID", "client") + t.Setenv("LINEAR_OAUTH_CLIENT_SECRET", "secret") + st := &configOnlyTrackerStore{config: map[string]string{"linear.api_endpoint": "https://proxy.example/graphql"}} + oldTransport := http.DefaultTransport + t.Cleanup(func() { http.DefaultTransport = oldTransport }) + + // The OAuth branch makes two requests, and only the second is the one under + // test: the token exchange goes to the OAuth token endpoint, which + // linear.api_endpoint does not and should not redirect. Serve that one a + // token and record where the GraphQL call actually lands. + var graphQLURL string + http.DefaultTransport = roundTripperFunc(func(req *http.Request) (*http.Response, error) { + if req.URL.String() == linear.DefaultOAuthTokenURL { + body := `{"access_token":"tok","token_type":"Bearer","expires_in":3600}` + return &http.Response{StatusCode: 200, Body: io.NopCloser(strings.NewReader(body)), Header: make(http.Header), Request: req}, nil + } + graphQLURL = req.URL.String() + return &http.Response{StatusCode: 200, Body: io.NopCloser(strings.NewReader(`{"data":{"teams":{"nodes":[]}}}`)), Header: make(http.Header), Request: req}, nil + }) + + client, err := buildLinearClientAPIOnly(context.Background(), "", st) + if err != nil { + t.Fatalf("build client: %v", err) + } + if _, err := client.FetchTeams(context.Background()); err != nil { + t.Fatalf("fetch teams: %v", err) + } + if graphQLURL != "https://proxy.example/graphql" { + t.Fatalf("OAuth branch sent GraphQL to %q, want the configured linear.api_endpoint", graphQLURL) + } +} + +type roundTripperFunc func(*http.Request) (*http.Response, error) + +func (f roundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) { return f(r) } diff --git a/cmd/bd/tracker_store.go b/cmd/bd/tracker_store.go new file mode 100644 index 000000000..bf9b3e0fd --- /dev/null +++ b/cmd/bd/tracker_store.go @@ -0,0 +1,27 @@ +package main + +import ( + "context" + "fmt" + + "github.com/steveyegge/beads/internal/tracker" +) + +// trackerStoreForCommand selects the tracker synchronization seam without +// opening a second direct store in proxied mode. +func trackerStoreForCommand(ctx context.Context) (tracker.Store, error) { + if usesProxiedServer() { + if uowProvider == nil { + return nil, fmt.Errorf("proxied-server provider not initialized") + } + store := tracker.NewUOWStore(uowProvider) + if store == nil { + return nil, fmt.Errorf("proxied-server provider is invalid") + } + return store, nil + } + if err := ensureStoreActiveWithContext(ctx); err != nil { + return nil, err + } + return tracker.NewStore(store), nil +} diff --git a/cmd/bd/transform_capability.go b/cmd/bd/transform_capability.go new file mode 100644 index 000000000..2265a1b78 --- /dev/null +++ b/cmd/bd/transform_capability.go @@ -0,0 +1,90 @@ +package main + +import ( + "sort" + "strings" + + "github.com/spf13/cobra" + "github.com/spf13/pflag" +) + +type TransformCapability struct { + Path string + Argument string + Outcome ProxyCapabilityOutcome + Code string + Message string + ExitCode int + Mutates bool +} + +var transformCapabilityRows = []TransformCapability{ + transformRefused("rename"), + transformRefused("rename-prefix"), + transformRefusedWithArgs("rename-prefix", "--dry-run"), + transformRefusedWithArgs("rename-prefix", "--repair"), + transformRefusedWithArgs("rename-prefix", "--dry-run --repair"), + transformRefused("duplicate"), + transformRefusedWithArgs("duplicate", "--of"), + transformRefused("supersede"), + transformRefusedWithArgs("supersede", "--with"), + {Path: "duplicates", Outcome: ProxyOutcomeHonored}, + transformRefusedWithArgs("duplicates", "--auto-merge"), + {Path: "duplicates", Argument: "--auto-merge --dry-run", Outcome: ProxyOutcomeHonored}, +} + +func transformRefused(path string) TransformCapability { + return transformRefusedWithArgs(path, "") +} + +func transformRefusedWithArgs(path, argument string) TransformCapability { + displayPath := path + if argument != "" { + displayPath += " " + argument + } + return TransformCapability{ + Path: path, Argument: argument, Outcome: ProxyOutcomeRefused, + Code: "proxy.transform.unsupported", Message: displayPath + " is not supported in proxied-server mode", ExitCode: 1, + } +} + +func transformCapabilityError(row TransformCapability) *ProxyCapabilityError { + return &ProxyCapabilityError{Code: row.Code, Message: row.Message, ExitCode: row.ExitCode, Mutates: row.Mutates} +} + +func lookupTransformCapability(cmd *cobra.Command) (TransformCapability, bool) { + path := cmd.CommandPath() + path = strings.TrimSpace(strings.TrimPrefix(path, cmd.Root().Name())) + var args []string + cmd.Flags().Visit(func(f *pflag.Flag) { + if transformPolicyFlags[f.Name] { + args = append(args, "--"+f.Name) + } + }) + sort.Strings(args) + arg := strings.Join(args, " ") + for _, row := range transformCapabilityRows { + if row.Path == path && row.Argument == arg { + return row, true + } + } + return TransformCapability{}, false +} + +// Only flags that alter a transform's execution belong in the capability key. +// Output, tracing, and other inherited root flags must not bypass a refusal. +var transformPolicyFlags = map[string]bool{ + "auto-merge": true, "dry-run": true, "repair": true, "of": true, "with": true, +} + +func validateProxyTransformBeforeProvider(cmd *cobra.Command) error { + if cmd == nil { + return nil + } + if row, ok := lookupTransformCapability(cmd); ok { + if row.Outcome == ProxyOutcomeRefused { + return HandleProxyCapabilityError(transformCapabilityError(row)) + } + } + return nil +} diff --git a/cmd/bd/transform_capability_test.go b/cmd/bd/transform_capability_test.go new file mode 100644 index 000000000..913b4d39f --- /dev/null +++ b/cmd/bd/transform_capability_test.go @@ -0,0 +1,187 @@ +package main + +import ( + "bytes" + "encoding/json" + "errors" + "os" + "strings" + "testing" + + "github.com/spf13/cobra" +) + +func transformTestCommand(path string, flags ...string) *cobra.Command { + root := &cobra.Command{Use: "bd"} + cmd := &cobra.Command{Use: path} + for _, flag := range flags { + if flag == "of" || flag == "with" { + cmd.Flags().String(flag, "", "") + } else { + cmd.Flags().Bool(flag, false, "") + } + } + root.AddCommand(cmd) + return cmd +} + +func TestProxyTransformCapabilityRows(t *testing.T) { + cases := []struct { + name, path, argument string + flags []string + outcome ProxyCapabilityOutcome + code, message string + exit int + mutates bool + }{ + {name: "rename", path: "rename", outcome: ProxyOutcomeRefused, code: "proxy.transform.unsupported", message: "rename is not supported in proxied-server mode", exit: 1}, + {name: "rename-prefix", path: "rename-prefix", outcome: ProxyOutcomeRefused, code: "proxy.transform.unsupported", message: "rename-prefix is not supported in proxied-server mode", exit: 1}, + {name: "rename-prefix dry-run", path: "rename-prefix", argument: "--dry-run", flags: []string{"dry-run"}, outcome: ProxyOutcomeRefused, code: "proxy.transform.unsupported", message: "rename-prefix --dry-run is not supported in proxied-server mode", exit: 1}, + {name: "rename-prefix repair", path: "rename-prefix", argument: "--repair", flags: []string{"repair"}, outcome: ProxyOutcomeRefused, code: "proxy.transform.unsupported", message: "rename-prefix --repair is not supported in proxied-server mode", exit: 1}, + {name: "rename-prefix repair dry-run", path: "rename-prefix", argument: "--dry-run --repair", flags: []string{"dry-run", "repair"}, outcome: ProxyOutcomeRefused, code: "proxy.transform.unsupported", message: "rename-prefix --dry-run --repair is not supported in proxied-server mode", exit: 1}, + {name: "duplicate", path: "duplicate", outcome: ProxyOutcomeRefused, code: "proxy.transform.unsupported", message: "duplicate is not supported in proxied-server mode", exit: 1}, + {name: "duplicate of", path: "duplicate", argument: "--of", flags: []string{"of"}, outcome: ProxyOutcomeRefused, code: "proxy.transform.unsupported", message: "duplicate --of is not supported in proxied-server mode", exit: 1}, + {name: "supersede", path: "supersede", outcome: ProxyOutcomeRefused, code: "proxy.transform.unsupported", message: "supersede is not supported in proxied-server mode", exit: 1}, + {name: "supersede with", path: "supersede", argument: "--with", flags: []string{"with"}, outcome: ProxyOutcomeRefused, code: "proxy.transform.unsupported", message: "supersede --with is not supported in proxied-server mode", exit: 1}, + {name: "duplicates", path: "duplicates", flags: []string{"auto-merge", "dry-run"}, outcome: ProxyOutcomeHonored}, + {name: "duplicates auto-merge", path: "duplicates", argument: "--auto-merge", flags: []string{"auto-merge", "dry-run"}, outcome: ProxyOutcomeRefused, code: "proxy.transform.unsupported", message: "duplicates --auto-merge is not supported in proxied-server mode", exit: 1}, + {name: "duplicates auto-merge dry-run", path: "duplicates", argument: "--auto-merge --dry-run", flags: []string{"auto-merge", "dry-run"}, outcome: ProxyOutcomeHonored}, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + cmd := transformTestCommand(tc.path, tc.flags...) + if tc.argument != "" { + for _, flag := range strings.Fields(tc.argument) { + if err := cmd.Flags().Set(strings.TrimPrefix(flag, "--"), "true"); err != nil { + t.Fatal(err) + } + } + } + row, ok := lookupTransformCapability(cmd) + if !ok { + t.Fatalf("lookup(%q, %q) missing row", tc.path, tc.argument) + } + if row.Path != tc.path || row.Argument != tc.argument || row.Outcome != tc.outcome { + t.Fatalf("row = %#v, want path=%q argument=%q outcome=%q", row, tc.path, tc.argument, tc.outcome) + } + if tc.outcome == ProxyOutcomeRefused { + if row.Code != tc.code || row.Message != tc.message || row.ExitCode != tc.exit || row.Mutates != tc.mutates { + t.Fatalf("refusal fields = code=%q message=%q exit=%d mutates=%t", row.Code, row.Message, row.ExitCode, row.Mutates) + } + typed := transformCapabilityError(row) + var got *ProxyCapabilityError + if !errors.As(typed, &got) || got.Code != tc.code || got.ExitCode != 1 || got.Mutates { + t.Fatalf("typed refusal = %#v", typed) + } + } + if err := validateProxyTransformBeforeProvider(cmd); tc.outcome == ProxyOutcomeHonored && err != nil { + t.Fatalf("honored transform refused: %v", err) + } + }) + } +} + +func TestProxyDuplicatesAutoMergeDryRunMatrix(t *testing.T) { + cmd := transformTestCommand("duplicates", "auto-merge", "dry-run") + _ = cmd.Flags().Set("auto-merge", "true") + if err := validateProxyTransformBeforeProvider(cmd); err == nil { + t.Fatalf("non-dry auto-merge error = %v", err) + } + _ = cmd.Flags().Set("dry-run", "true") + if err := validateProxyTransformBeforeProvider(cmd); err != nil { + t.Fatalf("dry-run auto-merge refused: %v", err) + } +} + +func TestProxyTransformRefusalRendering(t *testing.T) { + t.Setenv("BD_JSON_ENVELOPE", "") + cmd := transformTestCommand("rename") + oldJSON := jsonOutput + t.Cleanup(func() { jsonOutput = oldJSON }) + + jsonOutput = false + var textErr string + stderr := captureStderr(t, func() { + err := validateProxyTransformBeforeProvider(cmd) + if code, ok := exitCodeFromError(err); !ok || code != 1 { + t.Fatalf("exit = %v, want 1", err) + } + textErr = err.Error() + }) + if textErr != "exit code 1" || stderr != "Error: rename is not supported in proxied-server mode\n" { + t.Fatalf("text refusal = %q (err %q)", stderr, textErr) + } + + jsonOutput = true + stdout := captureStdout(t, func() error { + _ = validateProxyTransformBeforeProvider(cmd) + return nil + }) + var envelope map[string]any + if err := json.Unmarshal([]byte(stdout), &envelope); err != nil { + t.Fatalf("JSON refusal: %v (%q)", err, stdout) + } + if envelope["code"] != "proxy.transform.unsupported" || envelope["error"] != "rename is not supported in proxied-server mode" { + t.Fatalf("JSON refusal = %#v", envelope) + } +} + +func TestProxyTransformMatcherIgnoresInheritedOutputFlags(t *testing.T) { + root := &cobra.Command{Use: "bd"} + root.PersistentFlags().Bool("json", false, "output JSON") + cmd := &cobra.Command{Use: "duplicates"} + cmd.Flags().Bool("auto-merge", false, "") + cmd.Flags().Bool("dry-run", false, "") + root.AddCommand(cmd) + if err := cmd.Flags().Set("auto-merge", "true"); err != nil { + t.Fatal(err) + } + if err := root.PersistentFlags().Set("json", "true"); err != nil { + t.Fatal(err) + } + row, ok := lookupTransformCapability(cmd) + if !ok || row.Argument != "--auto-merge" || row.Outcome != ProxyOutcomeRefused { + t.Fatalf("row with inherited --json = %#v, ok=%v", row, ok) + } +} + +func TestProxyTransformRefusalHasNoProviderOrFileMutation(t *testing.T) { + dir := t.TempDir() + version := []byte("version-before\n") + issues := []byte(`{"id":"before","title":"untouched"}` + "\n") + versionPath := dir + "/.local_version" + issuesPath := dir + "/issues.jsonl" + if err := os.WriteFile(versionPath, version, 0o600); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(issuesPath, issues, 0o600); err != nil { + t.Fatal(err) + } + oldProvider := uowProvider + uowProvider = nil + t.Cleanup(func() { uowProvider = oldProvider }) + + cmd := transformTestCommand("supersede") + err := validateProxyTransformBeforeProvider(cmd) + if err == nil { + t.Fatal("expected transform refusal") + } + if code, ok := exitCodeFromError(err); !ok || code != 1 { + t.Fatalf("exit = %v, want 1", err) + } + if uowProvider != nil { + t.Fatal("transform refusal initialized a provider") + } + gotVersion, err := os.ReadFile(versionPath) + if err != nil { + t.Fatal(err) + } + gotIssues, err := os.ReadFile(issuesPath) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(gotVersion, version) || !bytes.Equal(gotIssues, issues) { + t.Fatal("transform refusal mutated workspace files") + } +} diff --git a/cmd/bd/uow_factory.go b/cmd/bd/uow_factory.go index 29df7df4b..a6bdac741 100644 --- a/cmd/bd/uow_factory.go +++ b/cmd/bd/uow_factory.go @@ -137,17 +137,25 @@ type sqlServerUOWTopology struct { rootPassword string } -// previewProviderOptions is the CLI-side half of the preview policy: it turns -// the root pre-run's previewMode bool into the uow.ProviderOption slice the -// proxied-server provider is opened with. Extracted (rather than inlined at -// the call site) so the wiring — preview=true must produce uow.WithPreview(), -// preview=false must produce nothing — has something to unit test; the +// rootProviderOptions is the CLI-side half of the open-posture policy: it +// turns the root pre-run's two classifications into the uow.ProviderOption +// slice the proxied-server provider is opened with. Extracted (rather than +// inlined at the call site) so the wiring has something to unit test; the // previous inline form had no test that would fail if a refactor dropped it. -func previewProviderOptions(preview bool) []uow.ProviderOption { - if !preview { +// +// The two are not exclusive but preview is stronger, and passing both would +// say two different things about an open that can only have one posture: +// preview neither creates nor migrates, while readOnly opens normally and only +// changes how a refused migration is handled. Preview wins. +func rootProviderOptions(preview, readOnly bool) []uow.ProviderOption { + switch { + case preview: + return []uow.ProviderOption{uow.WithPreview()} + case readOnly: + return []uow.ProviderOption{uow.WithReadOnly()} + default: return nil } - return []uow.ProviderOption{uow.WithPreview()} } // newProxiedServerUOWProvider opens the proxied-server provider and, in diff --git a/cmd/bd/uow_factory_test.go b/cmd/bd/uow_factory_test.go index d1c4d4abf..6eabc3e8b 100644 --- a/cmd/bd/uow_factory_test.go +++ b/cmd/bd/uow_factory_test.go @@ -11,26 +11,39 @@ import ( "github.com/stretchr/testify/require" ) -// TestPreviewProviderOptions pins the CLI-side wiring the reviewer flagged as -// untested: the root pre-run turns previewMode into providerOpts by calling -// this function, and a refactor that dropped or inverted that could not fail -// any existing test. uow.providerOptions is unexported, so this cannot poke -// inside the returned uow.ProviderOption values (see -// internal/storage/uow/preview_provider_test.go's TestApplyProviderOptions for -// the same-package introspection); it instead pins the one thing an external -// caller can observe — that preview=true yields exactly one option and -// preview=false yields none — which is what the CLI wiring is responsible for. -func TestPreviewProviderOptions(t *testing.T) { - if got := previewProviderOptions(false); got != nil { - t.Fatalf("previewProviderOptions(false) = %#v, want nil", got) - } - - opts := previewProviderOptions(true) - if len(opts) != 1 { - t.Fatalf("previewProviderOptions(true) len = %d, want 1", len(opts)) - } - if opts[0] == nil { - t.Fatal("previewProviderOptions(true)[0] is nil, want uow.WithPreview()") +// TestRootProviderOptions pins the CLI-side wiring the reviewer flagged as +// untested: the root pre-run turns its previewMode/useReadOnly classification +// into providerOpts by calling this function, and a refactor that dropped or +// inverted that could not fail any existing test. uow.providerOptions is +// unexported, so this cannot poke inside the returned uow.ProviderOption +// values (see internal/storage/uow/preview_provider_test.go's +// TestApplyProviderOptions for the same-package introspection); it instead +// pins what an external caller can observe — how many options each posture +// yields — which is what the CLI wiring is responsible for. +func TestRootProviderOptions(t *testing.T) { + for _, tt := range []struct { + name string + preview, readOnly bool + want int + }{ + {name: "ordinary write open", want: 0}, + {name: "preview", preview: true, want: 1}, + {name: "read-only", readOnly: true, want: 1}, + // Preview is the stronger posture and must win: it neither creates nor + // migrates, while read-only opens normally. + {name: "preview wins over read-only", preview: true, readOnly: true, want: 1}, + } { + t.Run(tt.name, func(t *testing.T) { + opts := rootProviderOptions(tt.preview, tt.readOnly) + if len(opts) != tt.want { + t.Fatalf("rootProviderOptions(%t, %t) len = %d, want %d", tt.preview, tt.readOnly, len(opts), tt.want) + } + for i, o := range opts { + if o == nil { + t.Fatalf("rootProviderOptions(%t, %t)[%d] is nil", tt.preview, tt.readOnly, i) + } + } + }) } } diff --git a/cmd/bd/update.go b/cmd/bd/update.go index 9c0d0be84..8fb3ffc04 100644 --- a/cmd/bd/update.go +++ b/cmd/bd/update.go @@ -99,7 +99,7 @@ pointless).`, SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) error { - CheckReadonly("update") // also covers CheckMigrationFreeze (dc-6jaq) + CheckReadonly("update") // also covers the migration freeze check (dc-6jaq) evt := metrics.NewCommandEvent("update") defer func() { @@ -790,7 +790,8 @@ func optionalTimeField(value any) (issueops.Field[*time.Time], bool) { // parseSetMetadataFlags splits --set-metadata key=value pairs, matching // storage.ApplyMetadataEdits' parsing so the CLI contract is unchanged. Values -// are always stored as JSON strings (GH#4146). +// are typed by storage.MetadataEditValue, which infers null/bool/number from +// the spelling and falls back to a string. func parseSetMetadataFlags(flags []string) (map[string]json.RawMessage, error) { set := make(map[string]json.RawMessage, len(flags)) for _, flag := range flags { @@ -917,9 +918,10 @@ func applyMetadataEdits(existing json.RawMessage, setFlags, unsetFlags []string) return storage.ApplyMetadataEdits(existing, setFlags, unsetFlags) } -// toJSONValue stores a CLI metadata value as a JSON string. -// Previous behavior inferred types (numbers, booleans) from content, -// which silently broke map[string]string round-trips (GH#4146). +// toJSONValue converts a CLI metadata value to its most appropriate JSON +// representation: numbers, booleans and null keep their type, everything else +// becomes a JSON string. +// Thin alias over the shared storage helper (also used in-transaction by issueops). func toJSONValue(s string) json.RawMessage { return storage.MetadataEditValue(s) } diff --git a/cmd/bd/update_embedded_test.go b/cmd/bd/update_embedded_test.go index 688cb40a2..0ce5ee9d2 100644 --- a/cmd/bd/update_embedded_test.go +++ b/cmd/bd/update_embedded_test.go @@ -259,6 +259,7 @@ func TestEmbeddedUpdate(t *testing.T) { "--await-id", "run-123", "--due", "2099-01-15", "--set-metadata", "team=platform", + "--set-metadata", "score=99", "--unset-metadata", "remove", "--no-history", ) @@ -310,6 +311,11 @@ func TestEmbeddedUpdate(t *testing.T) { if metadata["team"] != "platform" { t.Errorf("metadata team = %v, want platform", metadata["team"]) } + // --set-metadata infers scalar types (the v1.2.2 contract): 99 lands as a + // JSON number, not the string "99". + if metadata["score"] != float64(99) { + t.Errorf("metadata score = %#v, want the JSON number 99", metadata["score"]) + } if _, ok := metadata["remove"]; ok { t.Errorf("metadata still contains removed key: %v", metadata) } diff --git a/cmd/bd/update_lifecycle_test.go b/cmd/bd/update_lifecycle_test.go index 2811665da..7418e752e 100644 --- a/cmd/bd/update_lifecycle_test.go +++ b/cmd/bd/update_lifecycle_test.go @@ -269,7 +269,7 @@ func TestBuildUpdatePatchMapsSupportedFields(t *testing.T) { updates: map[string]any{storageissueops.OpSetMetadata: []string{"one=value", "two=42"}}, want: issueops.IssuePatch{Metadata: issueops.MetadataPatch{Set: map[string]json.RawMessage{ "one": json.RawMessage(`"value"`), - "two": json.RawMessage(`"42"`), + "two": json.RawMessage(`42`), }}}, }, { diff --git a/cmd/bd/update_proxied_integration_test.go b/cmd/bd/update_proxied_integration_test.go index 298f1bc82..da954fd18 100644 --- a/cmd/bd/update_proxied_integration_test.go +++ b/cmd/bd/update_proxied_integration_test.go @@ -706,8 +706,8 @@ func TestProxiedServerUpdate2(t *testing.T) { if got["tier"] != "gold" { t.Errorf("metadata[tier]: got %v, want %q", got["tier"], "gold") } - if got["score"] != "99" { - t.Errorf("metadata[score]: got %v, want %q (--set-metadata always stores string values)", got["score"], "99") + if got["score"] != float64(99) { + t.Errorf("metadata[score]: got %#v, want the JSON number 99 (--set-metadata infers scalar types)", got["score"]) } }) diff --git a/cmd/bd/upgrade.go b/cmd/bd/upgrade.go index a5d37756b..3db584df1 100644 --- a/cmd/bd/upgrade.go +++ b/cmd/bd/upgrade.go @@ -58,7 +58,7 @@ Examples: } if versionUpgradeDetected { - fmt.Printf("✨ bd upgraded from v%s to v%s\n", previousVersion, Version) + fmt.Printf("✨ bd upgraded from %s to %s\n", displayVersion(previousVersion), displayVersion(Version)) newVersions := getVersionsSince(previousVersion) if len(newVersions) > 0 { fmt.Printf(" %d version%s with changes available\n", @@ -68,9 +68,9 @@ Examples: fmt.Println("Run 'bd upgrade review' to see what changed") } } else if previousVersion == "" { - fmt.Printf("bd version: v%s (first run or version tracking just enabled)\n", Version) + fmt.Printf("bd version: %s (first run or version tracking just enabled)\n", displayVersion(Version)) } else { - fmt.Printf("bd version: v%s (no upgrade detected)\n", Version) + fmt.Printf("bd version: %s (no upgrade detected)\n", displayVersion(Version)) } return nil }, @@ -109,7 +109,7 @@ Examples: } if !versionUpgradeDetected { - fmt.Printf("You're already on v%s (no upgrade detected)\n", Version) + fmt.Printf("You're already on %s (no upgrade detected)\n", displayVersion(Version)) fmt.Println("Run 'bd info --whats-new' to see recent changes") return nil } @@ -124,12 +124,12 @@ Examples: }) } - fmt.Printf("\n🔄 Upgraded from v%s to v%s\n", lastVersion, Version) + fmt.Printf("\n🔄 Upgraded from %s to %s\n", displayVersion(lastVersion), displayVersion(Version)) fmt.Println(strings.Repeat("=", 60)) fmt.Println() if len(newVersions) == 0 { - fmt.Printf("v%s is newer than v%s but not in changelog\n", Version, lastVersion) + fmt.Printf("%s is newer than %s but not in changelog\n", displayVersion(Version), displayVersion(lastVersion)) fmt.Println("Run 'bd info --whats-new' to see recent documented changes") return nil } @@ -211,11 +211,11 @@ Examples: } if lastSeenVersion == Version { - fmt.Printf("✓ Already on v%s\n", Version) + fmt.Printf("✓ Already on %s\n", displayVersion(Version)) } else if lastSeenVersion == "" { - fmt.Printf("✓ Acknowledged bd v%s\n", Version) + fmt.Printf("✓ Acknowledged bd %s\n", displayVersion(Version)) } else { - fmt.Printf("✓ Acknowledged upgrade from v%s to v%s\n", lastSeenVersion, Version) + fmt.Printf("✓ Acknowledged upgrade from %s to %s\n", displayVersion(lastSeenVersion), displayVersion(Version)) } return nil }, diff --git a/cmd/bd/version.go b/cmd/bd/version.go index b1542ea6e..3bf32c13f 100644 --- a/cmd/bd/version.go +++ b/cmd/bd/version.go @@ -16,7 +16,7 @@ import ( var ( // Version is the current version of bd (overridden by ldflags at build time) - Version = "1.2.2" + Version = "1.3.0" // Build can be set via ldflags at compile time Build = "dev" // Commit and branch the git revision the binary was built from (optional ldflag) diff --git a/cmd/bd/version_test.go b/cmd/bd/version_test.go index 808d6a253..d6b676289 100644 --- a/cmd/bd/version_test.go +++ b/cmd/bd/version_test.go @@ -51,7 +51,7 @@ func TestVersionCommand(t *testing.T) { t.Fatalf("Failed to create pipe: %v", err) } os.Stdout = w - jsonOutput = true + pinJSONOutput(t, true) // Run version command if err := versionCmd.RunE(versionCmd, []string{}); err != nil { @@ -83,8 +83,6 @@ func TestVersionCommand(t *testing.T) { } }) - // Restore default - jsonOutput = false } func TestResolveCommitHash(t *testing.T) { @@ -158,7 +156,7 @@ func TestVersionOutputWithCommitAndBranch(t *testing.T) { t.Fatalf("Failed to create pipe: %v", err) } os.Stdout = w - jsonOutput = false + pinJSONOutput(t, false) if err := versionCmd.RunE(versionCmd, []string{}); err != nil { t.Fatalf("versionCmd.RunE: %v", err) @@ -187,7 +185,7 @@ func TestVersionOutputWithCommitAndBranch(t *testing.T) { t.Fatalf("Failed to create pipe: %v", err) } os.Stdout = w - jsonOutput = true + pinJSONOutput(t, true) if err := versionCmd.RunE(versionCmd, []string{}); err != nil { t.Fatalf("versionCmd.RunE: %v", err) diff --git a/cmd/bd/version_tracking.go b/cmd/bd/version_tracking.go index fd8b3c230..c3f343e9d 100644 --- a/cmd/bd/version_tracking.go +++ b/cmd/bd/version_tracking.go @@ -2,6 +2,7 @@ package main import ( "context" + "errors" "fmt" "os" "path/filepath" @@ -14,6 +15,7 @@ import ( "github.com/steveyegge/beads/internal/doltserver" "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/storage/dolt" + "github.com/steveyegge/beads/internal/storage/schema" "github.com/steveyegge/beads/issueops" ) @@ -59,9 +61,21 @@ func trackBdVersionFile(persist bool) { localVersionPath := filepath.Join(beadsDir, localVersionFile) lastVersion := readLocalVersion(localVersionPath) - // Check if version changed (only flag actual upgrades, not downgrades) + // Check if version changed (only flag actual upgrades, not downgrades). + // + // Homebrew --HEAD stamps (HEAD-) carry no ordering, so CompareVersions + // reads them as 0.0.0: a reinstall onto a newer HEAD registers as no change + // at all, and moving a release workspace onto HEAD registers as a + // downgrade. Treat a changed stamp with a HEAD build on either side as an + // upgrade, so the one-shot post-upgrade reconciliation actually runs; brew + // reinstalls only move forward. If that assumption is ever wrong the + // misfire is bounded — recoverPreV56IfNeeded refuses a non-semver + // predecessor, and the workspace's own version markers still refuse a + // genuine downgrade. (Those markers cannot arbitrate direction here: they + // compare with the same dotted scan and read HEAD stamps as 0.0.0 too.) if lastVersion != "" && lastVersion != Version { - if doctor.CompareVersions(Version, lastVersion) > 0 { + if doctor.CompareVersions(Version, lastVersion) > 0 || + doctor.IsBrewHeadVersion(Version) || doctor.IsBrewHeadVersion(lastVersion) { // Version upgrade detected! versionUpgradeDetected = true previousVersion = lastVersion @@ -107,6 +121,13 @@ func getVersionsSince(sinceVersion string) []VersionChange { return versionChanges } + // A brew --HEAD stamp names no changelog entry; without this the + // unknown-version fallback below would report the entire release history + // as new after every --HEAD reinstall. + if doctor.IsBrewHeadVersion(sinceVersion) { + return []VersionChange{} + } + // Find the index of sinceVersion // versionChanges is ordered newest-first: [0.23.0, 0.22.1, 0.22.0, 0.21.0] startIdx := -1 @@ -141,6 +162,16 @@ func getVersionsSince(sinceVersion string) []VersionChange { return result } +// displayVersion formats a version stamp for user-facing messages: semver +// stamps get the conventional "v" prefix, while a brew --HEAD stamp is shown +// verbatim ("vHEAD-f925f3f" reads as a typo). +func displayVersion(version string) string { + if doctor.IsBrewHeadVersion(version) { + return version + } + return "v" + version +} + // maybeShowUpgradeNotification displays a one-time upgrade notification if version changed. // This is called by commands like 'bd ready' and 'bd list' to inform users of upgrades. func maybeShowUpgradeNotification() { @@ -153,7 +184,7 @@ func maybeShowUpgradeNotification() { upgradeAcknowledged = true // Display notification - fmt.Printf("🔄 bd upgraded from v%s to v%s since last use\n", previousVersion, Version) + fmt.Printf("🔄 bd upgraded from %s to %s since last use\n", displayVersion(previousVersion), displayVersion(Version)) fmt.Println("💡 Run 'bd upgrade review' to see what changed") if usesSQLServer() { fmt.Println("💊 Run 'bd doctor' to verify upgrade completed cleanly") @@ -208,17 +239,7 @@ func autoMigrateOnVersionBump(beadsDir string) { return } - // GH#2137: If upgrading from pre-0.56, the dolt database may have been - // created by the old embedded Dolt mode. Recover by reinitializing. - if previousVersion != "" && doctor.CompareVersions(previousVersion, "0.56.0") < 0 { - recovered, recErr := doltserver.RecoverPreV56DoltDir(dbPath) - if recErr != nil { - debug.Logf("auto-migrate: pre-v56 recovery failed: %v", recErr) - } - if recovered { - debug.Logf("auto-migrate: rebuilt pre-v56 dolt database at %s", dbPath) - } - } + recoverPreV56IfNeeded(previousVersion, dbPath) // Open database using factory (respects backend config from metadata.json) // Use rootCtx if available and not canceled, otherwise use Background @@ -250,6 +271,7 @@ func autoMigrateOnVersionBump(beadsDir string) { if err != nil { // Failed to open database - skip migration debug.Logf("auto-migrate: failed to open database: %v", err) + noticeSharedMigrateRefusal(err) return } defer func() { @@ -285,6 +307,95 @@ func autoMigrateOnVersionBump(beadsDir string) { } } +// recoverPreV56IfNeeded rebuilds a Dolt database left behind by the pre-0.56 +// embedded mode (GH#2137) — which means deleting .dolt — but only when the +// recorded predecessor is an actual semantic version older than 0.56.0. +// +// The validity check is not redundant with the comparison. CompareVersions +// scans every dot-separated part with %d and leaves whatever it cannot read at +// 0, so any non-semver string writeLocalVersion has recorded compares as +// pre-0.56 and routes a current workspace into this destructive path: +// Homebrew's "HEAD-" from a --HEAD install (#5603), and the +// v-prefixed Go pseudo-version a `go install`-built bd stamps (#5650). Neither +// is a pre-0.56 workspace; both would lose their database. +// +// IsValidSemver rejects exactly the shapes CompareVersions misreads, so this +// gate can only remove predecessors from the recovery set, never add one: a +// stamp that reaches RecoverPreV56DoltDir today and still parses keeps its +// recovery unchanged. +func recoverPreV56IfNeeded(previousVersion, dbPath string) { + if !doctor.IsValidSemver(previousVersion) { + return + } + if doctor.CompareVersions(previousVersion, "0.56.0") >= 0 { + return + } + + recovered, recErr := doltserver.RecoverPreV56DoltDir(dbPath) + if recErr != nil { + debug.Logf("auto-migrate: pre-v56 recovery failed: %v", recErr) + } + if recovered { + debug.Logf("auto-migrate: rebuilt pre-v56 dolt database at %s", dbPath) + } +} + +// noticeSharedMigrateRefusal turns the one failure autoMigrateOnVersionBump +// must not swallow into a one-line stderr notice. +// +// Every other failure here is genuinely best-effort — the command's own store +// open will report anything that matters. A gate refusal is different: it is +// the whole point of the version bump (there ARE pending migrations), it will +// not be reported by a read command's own open (read-only opens never touch +// the schema), and it is the moment gastownhall/beads#5920 used to silently +// promote the cursor for every co-resident client. Now nothing is promoted, so +// say what happened and what to do about it. +// +// It fires once per version bump, because .local_version is consumed in the +// same pre-run — which is exactly why the remedy it names has to be right for +// THIS refusal. The gate returns one error type for several very different +// decisions, and the remote-backed ones are not unlocked by the migrate verb +// at all (a clone whose remote is already migrated must adopt, not migrate), +// so the line is chosen per decision rather than printed unconditionally. +func noticeSharedMigrateRefusal(err error) { + var gateErr *schema.RemoteMigrateGateError + if !errors.As(err, &gateErr) { + return + } + // --json puts a machine-readable gate block on this same stream when the + // command's own open is refused a moment later; prose prepended to it + // makes the documented contract unparseable. The human-output sibling + // maybeShowUpgradeNotification takes the same care. + if jsonOutput { + return + } + + consent := schema.SharedConsentCommand + if globalFlag { + consent = schema.SharedConsentCommandGlobal + } + var remedy string + switch gateErr.Decision { + case "shared-no-remote": + remedy = fmt.Sprintf("Run '%s' once every client of this server is upgraded; reads keep working meanwhile.", consent) + case "adopt", "adopt-ff": + // The remote is already migrated: migrating here would fork it, and + // the verb consent deliberately does not unlock this arm. + remedy = "Another clone has already migrated this database — adopt it with 'bd bootstrap' rather than migrating here; reads keep working meanwhile." + case "fork-skew": + remedy = "This database and its remote already applied different content for the same migration (#4259) — run 'bd doctor' and follow its migration-content-skew guidance; do not migrate." + default: + // The blunt remote-backed stop, including the shared-store + // first-mover suppression. Its full block names the designated- + // migrator and adopt paths with their preconditions, and picking one + // here would be guessing. + remedy = "This database has a remote — run 'bd migrate' to see the migrate-or-adopt options before choosing; reads keep working meanwhile." + } + fmt.Fprintf(os.Stderr, + "bd upgraded to %s: %d schema migration(s) pending on this database — not auto-applying (#5920).\n%s\n", + displayVersion(Version), gateErr.Pending, remedy) +} + // recordedWorkspaceVersion reads the marker through the role's accessor on a // store the caller owns and closes. It takes the storage interface rather than // the concrete store so the probe above cannot drift into using a seam the role diff --git a/cmd/bd/version_tracking_test.go b/cmd/bd/version_tracking_test.go index fa46d271b..e3af15f56 100644 --- a/cmd/bd/version_tracking_test.go +++ b/cmd/bd/version_tracking_test.go @@ -46,6 +46,18 @@ func TestGetVersionsSince(t *testing.T) { expectedCount: 0, description: "Should return empty slice when already on latest in changelog", }, + { + name: "brew HEAD stamp returns empty", + sinceVersion: "HEAD-f925f3f", + expectedCount: 0, + description: "A --HEAD stamp names no changelog entry and must not dump the full history", + }, + { + name: "bare brew HEAD stamp returns empty", + sinceVersion: "HEAD", + expectedCount: 0, + description: "A bare HEAD stamp names no changelog entry and must not dump the full history", + }, } for _, tt := range tests { @@ -59,6 +71,28 @@ func TestGetVersionsSince(t *testing.T) { } } +func TestDisplayVersion(t *testing.T) { + tests := []struct { + name string + version string + want string + }{ + {name: "release", version: "1.3.0", want: "v1.3.0"}, + {name: "pre-release", version: "1.3.0-rc.1", want: "v1.3.0-rc.1"}, + {name: "brew HEAD stamp", version: "HEAD-f925f3f", want: "HEAD-f925f3f"}, + {name: "bare brew HEAD stamp", version: "HEAD", want: "HEAD"}, + {name: "brew HEAD stamp with revision", version: "HEAD-f925f3f_1", want: "HEAD-f925f3f_1"}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := displayVersion(tt.version); got != tt.want { + t.Fatalf("displayVersion(%q) = %q, want %q", tt.version, got, tt.want) + } + }) + } +} + func TestGetVersionsSinceOrder(t *testing.T) { // Test that versions are returned in chronological order (oldest first) // versionChanges array is newest-first, but getVersionsSince returns oldest-first @@ -304,6 +338,107 @@ func TestTrackBdVersion_DowngradeIgnored(t *testing.T) { } } +// newTrackingWorkspace prepares the minimal .beads a trackBdVersion call needs +// and pins the globals it mutates, returning the .local_version path. +func newTrackingWorkspace(t *testing.T, lastVersion, binVersion string) string { + t.Helper() + ensureCleanGlobalState(t) + + tmpDir := t.TempDir() + beadsDir := filepath.Join(tmpDir, ".beads") + if err := os.MkdirAll(beadsDir, 0755); err != nil { + t.Fatalf("Failed to create .beads: %v", err) + } + t.Setenv("BEADS_DIR", beadsDir) + t.Chdir(tmpDir) + + metadataPath := filepath.Join(beadsDir, "metadata.json") + if err := os.WriteFile(metadataPath, []byte(`{"database":"beads.db"}`), 0600); err != nil { + t.Fatalf("Failed to create metadata.json: %v", err) + } + + localVersionPath := filepath.Join(beadsDir, localVersionFile) + if err := writeLocalVersion(localVersionPath, lastVersion); err != nil { + t.Fatalf("Failed to write local version: %v", err) + } + + origVersion, origDetected, origPrevious := Version, versionUpgradeDetected, previousVersion + t.Cleanup(func() { + Version, versionUpgradeDetected, previousVersion = origVersion, origDetected, origPrevious + }) + Version = binVersion + versionUpgradeDetected = false + previousVersion = "" + + return localVersionPath +} + +// TestTrackBdVersion_HeadStampChangeDetectedAsUpgrade covers the stamp changes +// CompareVersions cannot see: it reads every HEAD stamp as 0.0.0, so a HEAD +// reinstall looked like no change and a release-to-HEAD move looked like a +// downgrade. Both skipped the one-shot post-upgrade reconciliation entirely. +func TestTrackBdVersion_HeadStampChangeDetectedAsUpgrade(t *testing.T) { + tests := []struct { + name string + lastVersion string + binVersion string + wantDetected bool + }{ + {name: "HEAD stamp to different HEAD stamp", lastVersion: "HEAD-423afdc", binVersion: "HEAD-f925f3f", wantDetected: true}, + {name: "release to HEAD stamp", lastVersion: "1.1.2", binVersion: "HEAD-f925f3f", wantDetected: true}, + {name: "HEAD stamp to release", lastVersion: "HEAD-423afdc", binVersion: "1.3.0", wantDetected: true}, + {name: "same HEAD stamp", lastVersion: "HEAD-f925f3f", binVersion: "HEAD-f925f3f", wantDetected: false}, + {name: "non-HEAD garbage change stays undetected", lastVersion: "not-a-version", binVersion: "also-not-one", wantDetected: false}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + localVersionPath := newTrackingWorkspace(t, tt.lastVersion, tt.binVersion) + + trackBdVersion() + + if versionUpgradeDetected != tt.wantDetected { + t.Errorf("versionUpgradeDetected = %v, want %v", versionUpgradeDetected, tt.wantDetected) + } + wantPrevious := "" + if tt.wantDetected { + wantPrevious = tt.lastVersion + } + if previousVersion != wantPrevious { + t.Errorf("previousVersion = %q, want %q", previousVersion, wantPrevious) + } + if got := readLocalVersion(localVersionPath); got != tt.binVersion { + t.Errorf(".local_version = %q, want %q", got, tt.binVersion) + } + }) + } +} + +// TestTrackBdVersion_HeadStampNeverReachesPreV56Recovery walks the whole +// #5603 shape end to end: a workspace last touched by a Homebrew --HEAD build, +// a .dolt with no .bd-dolt-ok marker, and a release install on top. Detection +// and the recovery gate have to compose — widening detection is what puts a +// HEAD stamp into previousVersion in the first place. +func TestTrackBdVersion_HeadStampNeverReachesPreV56Recovery(t *testing.T) { + newTrackingWorkspace(t, "HEAD-f925f3f", "1.3.0") + doltDir, sentinel := writePreV56DoltFixture(t) + + trackBdVersion() + + if !versionUpgradeDetected { + t.Fatal("installing a release over a --HEAD build should register as an upgrade") + } + if previousVersion != "HEAD-f925f3f" { + t.Fatalf("previousVersion = %q, want the HEAD stamp", previousVersion) + } + + recoverPreV56IfNeeded(previousVersion, doltDir) + + if _, err := os.Stat(sentinel); err != nil { + t.Fatalf("a --HEAD predecessor routed a live workspace into the pre-v56 recovery: %v", err) + } +} + func TestTrackBdVersion_SameVersion(t *testing.T) { // Create temp .beads directory tmpDir := t.TempDir() @@ -395,6 +530,69 @@ func TestMaybeShowUpgradeNotification(t *testing.T) { } } +// writePreV56DoltFixture builds the workspace shape RecoverPreV56DoltDir +// destroys: a .dolt/ directory with no .bd-dolt-ok compatibility marker. It +// returns a path inside .dolt/ whose survival tells the caller whether the +// recovery ran. +func writePreV56DoltFixture(t *testing.T) (doltDir, sentinel string) { + t.Helper() + doltDir = t.TempDir() + sentinel = filepath.Join(doltDir, ".dolt", "sentinel.txt") + if err := os.MkdirAll(filepath.Dir(sentinel), 0o750); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(sentinel, []byte("live workspace data"), 0o600); err != nil { + t.Fatal(err) + } + return doltDir, sentinel +} + +// TestRecoverPreV56IfNeeded_OnlySemverPredecessorsAreRecovered pins the +// destructive edge from #5603/#5625: CompareVersions reads any unparsable +// version part as 0, so a non-semver predecessor compares as pre-0.56 and +// hands a live workspace to a path that deletes .dolt. The Homebrew --HEAD +// stamp and the v-prefixed Go pseudo-version from #5650 are both such +// predecessors and both reach this call today. +func TestRecoverPreV56IfNeeded_OnlySemverPredecessorsAreRecovered(t *testing.T) { + tests := []struct { + name string + previous string + wantRecovery bool + }{ + {name: "brew HEAD stamp", previous: "HEAD-f925f3f"}, + {name: "bare brew HEAD stamp", previous: "HEAD"}, + {name: "brew HEAD stamp with revision", previous: "HEAD-f925f3f_1"}, + {name: "go pseudo-version", previous: "v1.1.1-0.20260805093327-bf97b73749ac"}, + {name: "unreadable witness", previous: "not-a-version"}, + {name: "no predecessor", previous: ""}, + {name: "current release", previous: "1.1.2"}, + {name: "0.56.0 itself", previous: "0.56.0"}, + {name: "pre-0.56 release", previous: "0.55.4", wantRecovery: true}, + {name: "pre-0.56 pre-release", previous: "0.55.4-rc.1", wantRecovery: true}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + doltDir, sentinel := writePreV56DoltFixture(t) + + recoverPreV56IfNeeded(tt.previous, doltDir) + + _, err := os.Stat(sentinel) + if tt.wantRecovery { + // The reinitializing `dolt init` may fail in a bare + // environment; the removal that precedes it is the assertion. + if !os.IsNotExist(err) { + t.Fatalf("predecessor %q: expected pre-v56 recovery to rebuild .dolt, but %s survived", tt.previous, sentinel) + } + return + } + if err != nil { + t.Fatalf("predecessor %q: pre-v56 recovery deleted a live .dolt: %v", tt.previous, err) + } + }) + } +} + func TestAutoMigrateOnVersionBump_NoUpgrade(t *testing.T) { // Save original state origUpgradeDetected := versionUpgradeDetected diff --git a/cmd/bd/winres/manifest.xml b/cmd/bd/winres/manifest.xml index e9fb28697..5623c89ce 100644 --- a/cmd/bd/winres/manifest.xml +++ b/cmd/bd/winres/manifest.xml @@ -3,7 +3,7 @@ beads - AI-supervised issue tracker diff --git a/cmd/bd/winres/winres.json b/cmd/bd/winres/winres.json index e2c515a26..b3c9a8137 100644 --- a/cmd/bd/winres/winres.json +++ b/cmd/bd/winres/winres.json @@ -9,8 +9,8 @@ "#1": { "0000": { "fixed": { - "file_version": "1.2.2", - "product_version": "1.2.2", + "file_version": "1.3.0", + "product_version": "1.3.0", "type": "App" }, "info": { @@ -18,12 +18,12 @@ "Comments": "AI-supervised issue tracker for coding workflows", "CompanyName": "Steve Yegge", "FileDescription": "beads - AI-supervised issue tracker", - "FileVersion": "1.2.2", + "FileVersion": "1.3.0", "InternalName": "bd", "LegalCopyright": "Copyright (c) 2024-2026 Steve Yegge. MIT License.", "OriginalFilename": "bd.exe", "ProductName": "beads", - "ProductVersion": "1.2.2" + "ProductVersion": "1.3.0" } } } diff --git a/default.nix b/default.nix index f7a78c90e..395cefae9 100644 --- a/default.nix +++ b/default.nix @@ -7,7 +7,7 @@ }: buildGoModule { pname = "beads"; - version = "1.2.2"; + version = "1.3.0"; src = self; diff --git a/docs/architecture/dolt.md b/docs/architecture/dolt.md index 9e16ea6ea..53ed451d0 100644 --- a/docs/architecture/dolt.md +++ b/docs/architecture/dolt.md @@ -253,6 +253,25 @@ stop at that step, and an abandoned merge is left without its rollback. See [Which Dolt version to install](#which-dolt-version-to-install) for the check and the fix. +### Why a garbage collection can reclaim nothing + +Dolt's garbage collector is **generational**. Every pass moves the data +reachable at that moment into an *old generation*, and a default pass only +examines the *new generation* — data written since the last collection. So the +second collection on a store never revisits what the first one kept, however +much of it has since become unreachable. Squashing history and then running a +default `dolt gc` is the case where this bites: the orphaned commit chain +usually sits in the old generation, and the pass frees almost nothing. + +`dolt gc --full` collects both generations. It frees everything a default pass +frees, plus the old generation, so it is never worth running a default pass +first to save time. If a full collection frees nothing, the remaining bytes are +still referenced — by a branch, a tag, or a cached remote-tracking ref — and +the fix is to remove the reference, not to collect again. The +[History Bloat runbook](/recovery/history-squash) walks through that diagnosis; +[`bd flatten`](/cli-reference/flatten), [`bd compact`](/cli-reference/compact), +and [`bd gc`](/cli-reference/gc) document the collection each one runs. + ## Migrating Between Backends You can migrate data between embedded mode and server mode using `bd backup`. diff --git a/docs/getting-started/upgrading.md b/docs/getting-started/upgrading.md index a7989aa83..0a58320c2 100644 --- a/docs/getting-started/upgrading.md +++ b/docs/getting-started/upgrading.md @@ -11,9 +11,12 @@ How to upgrade bd and keep your projects in sync. # Current version bd version -# What's new in recent versions +# What changed since the version you were running — the delta, not the archive +bd upgrade review +bd upgrade review --json # Machine-readable + +# The full release history (large; every version bd knows about) bd info --whats-new -bd info --whats-new --json # Machine-readable ``` ## Short Version @@ -22,11 +25,11 @@ bd info --whats-new --json # Machine-readable new binary: `bd dolt push` `bd dolt pull` -2. Back up before migration: +2. Back up **with that same current binary**, before installing: `bd export --all -o .beads/backup/pre-migrate-$(date +%Y%m%d).jsonl` 3. Upgrade using the command that matches your install method. 4. After upgrading: - `bd info --whats-new` + `bd upgrade review` `bd hooks install` `bd version` 5. If crossing a schema migration on a remote-backed database, only the @@ -139,6 +142,83 @@ bd migrate bd migrate --yes ``` +### Upgrading to 1.3.0 + +A 1.2.2 or 1.1.x database sits at schema v53, and 1.3.0 knows v66. That is more +than a routine upgrade: 1.2.2 was a recovery release that shipped the 1.1 code +under a higher version number, so there is a release line's worth of schema +between the two. + +#### Back up first, with the binary you have now + +Do this **before** you install 1.3.0. Under the new binary, `bd export` triggers +the migration before it exports, so a snapshot taken afterwards is a +post-migration snapshot and cannot protect you against the migration going +wrong. The same ordering rule as the section below applies: do all syncing with +your **current** binary, since once 1.3.0 is installed the pending-migration +gate refuses `bd dolt push` and `bd dolt pull` too. + +```bash +# with your CURRENT bd: +bd dolt push # remote-backed stores only +bd export --all -o .beads/backup/pre-1.3.0-$(date +%Y%m%d).jsonl +``` + +For a Dolt-native snapshot that keeps history and config, configure a +destination and sync it. Bare `bd backup` takes no backup — it is a command +group that prints help and exits 0: + +```bash +bd backup init # once, to configure a destination +bd backup sync # take the snapshot +``` + +#### What the migration looks like + +On an embedded or local store, the first command you run after installing +applies the whole set, in place. (A shared `dolt sql-server` is never +auto-migrated — see [Shared servers](#shared-servers) below.) The main series +runs 0054 → 0066 (13 migrations), and then the clone-local series runs through +the same printer with its own numbering, 0012 → 0026 — so it is about +**28 migrations**, and the counter visibly restarts partway through: + +``` +Applying migration 0065: widen_wisp_comments_text… +Applying migration 0066: add_events_journal_actor… +Applying migration 0012: create_leases… ← clone-local series, not a restart +``` + +A counter jumping backwards looks exactly like a loop. It is not one — let it +finish. Expect the run to take noticeably longer than the commands after it +(two passes rewrite rows rather than reshaping tables). It is crash-resumable +and picks up where it left off. + +Those lines go to stderr, and only when stderr is a terminal, so a piped or CI +upgrade prints nothing at all. Silence there is not a stall either. + +#### Upgrade every client that shares a store, together + +A bd binary refuses a database migrated past the schema it knows, rather than +proceeding blind. One machine upgrading takes the shared store forward and every +client still on 1.2.2 stops working. Check for a second binary earlier in your +`PATH` with `which -a bd`, and restart any long-running `bd serve` — noting that +`bd --readonly serve` is now refused outright, so a server scripted with that +flag will not come back up until you drop it. + +If the store is a shared `dolt sql-server` rather than a local one, follow +[Shared servers](#shared-servers) below: 1.3.0 will not migrate it without +explicit consent, precisely so the fleet upgrade can come first. + +If you need to go back, the rollback is a schema-cursor rollback rather than a +downgrade of the data — see +[Accidental v1.2.1 Release](/recovery/accidental-1-2-1-release), whose +procedure is the same for any cursor rollback even though its worked example is +that release. + +Once you are on the new binary, `bd upgrade review` prints exactly the changes +between the version you were running and this one. Several commands changed +defaults, so read it before your first session. + ### Remote-backed databases and multiple clones `bd` refuses to silently apply pending schema migrations to a database that has @@ -160,7 +240,9 @@ The gate is **state-aware by default** - **auto-migrates** when the remote is at the same schema version as this clone — no one has migrated yet, so this clone is a safe first-mover (concurrent first-movers converge to identical tables). It reminds you to - `bd dolt push` afterwards. + `bd dolt push` afterwards. This applies to embedded mode only: a shared + server always stops for consent, because migrating it changes the schema + every connected client sees (see [Shared servers](#shared-servers) below). - **stops and directs you to adopt** (`bd bootstrap`) when the remote has already been migrated by another clone. - **stops for a human decision** when this clone and the remote applied @@ -204,11 +286,10 @@ migrating here as the designated migrator, adopting the remote's already-migrate database, or recovering a fork — and asks for an explicit operator decision. Follow the guidance it prints. -For scripted or CI upgrades where nobody reads the prompt, -`BD_ALLOW_REMOTE_MIGRATE=1 bd migrate` (any boolean true value works) declares -this clone the designated migrator and bypasses the gate entirely — including -its already-forked checks — so wire it into exactly one clone's upgrade job, -never all of them. +For scripted or CI upgrades where nobody reads the output, run `bd migrate` as +an explicit step in exactly one job, never in all of them. If the gate blocks a +run it prints both the available options and the scripted override that fits +the situation. **Multiple clones sharing one remote:** @@ -243,6 +324,67 @@ schema against the cached remote ref — a useful post-upgrade verification. It runs in both server and embedded modes. +### Shared servers + +A server-mode database is served to every `bd` client connected to that +`dolt sql-server`, so a schema migration is not a local event: it promotes the +schema version for **all** of them at once, and clients still running an older +`bd` refuse the database until they are upgraded too. `bd` therefore never +auto-migrates a shared database on a version bump — with or without a remote +configured, though the two cases consent differently +([#5920](https://github.com/gastownhall/beads/issues/5920)). + +Upgrade one server's clients like this: + +```bash +# 1. Upgrade bd on every client of the server. Reads keep working throughout — +# an upgraded client reads the old schema, it just cannot write to it. +bd version # on each client, confirm the new version + +# 2. Once, from a workspace already set up against this server: consent. +bd migrate schema # add --global for the shared global database + +# 3. Confirm. +bd doctor +``` + +Between steps 1 and 2, an upgraded client reads normally and its writes are +refused with the gate's guidance. Nothing is silently promoted, so there is no +deadline — but the window is a degraded one, so keep it short. + +**If the shared server also has a Dolt remote**, step 2 is not enough. Two +hazards now apply at once — the co-resident lockout above and the cross-clone +fork of [Remote-backed databases](#remote-backed-databases-and-multiple-clones) +— so `bd` requires the stronger designated-migrator consent it describes: +`bd migrate --force`, from exactly one machine, followed by `bd dolt push`. If +another clone has already migrated and pushed, adopt its database with +`bd bootstrap` instead of migrating. On a shared server, adopting also promotes +the schema for every client of that server, so step 1 still comes first either +way. + + +Migrating is one-way for the fleet: after step 2, a client still on the older +`bd` refuses the database until it is upgraded. Do step 1 first, and confirm it +— the gate cannot see the other clients' versions and will take your word for +it. + + +A new client **joining** a server whose schema is behind is refused before its +workspace is written, so there is nothing to run `bd migrate schema` from +there: do step 2 from a client that is already set up, or join and migrate in +one step with `BD_ALLOW_REMOTE_MIGRATE=1 bd init …`. + +The same rules apply in **proxied-server mode**, which is a shared server +reached through a local proxy. Two differences worth knowing: + +- read commands print a warning and keep serving the current schema, rather + than the read simply not touching it; +- `bd serve` refuses to start against a database with pending migrations, + because a daemon has no operator to consent for it. Reconcile the schema + first with step 2, then start the daemon — or, for an unattended service, + put `BD_ALLOW_REMOTE_MIGRATE=1` in its environment as an explicit, auditable + standing consent. + ## Cross-era Upgrades If you're upgrading from a much older version of bd, inspect the storage layout diff --git a/docs/index.md b/docs/index.md index 562585852..bc3073d76 100644 --- a/docs/index.md +++ b/docs/index.md @@ -5,7 +5,7 @@ description: Dependency-aware, Dolt-backed issue tracker built for AI coding age **Beads** (`bd`) is a Dolt-powered issue tracker designed for AI-supervised coding workflows. -These docs are for the 1.1.0 release of beads — see the [v1.1.0 release notes](https://github.com/gastownhall/beads/releases/tag/v1.1.0). +These docs are for the 1.3.0 release of beads — see the [v1.3.0 release notes](https://github.com/gastownhall/beads/releases/tag/v1.3.0). Upgrading from 1.2.2 or earlier crosses a schema migration; read [Upgrading](/getting-started/upgrading) first. ## Why Beads? diff --git a/docs/recovery/history-squash.md b/docs/recovery/history-squash.md index ff37ed241..c96e96760 100644 --- a/docs/recovery/history-squash.md +++ b/docs/recovery/history-squash.md @@ -157,4 +157,6 @@ routine agent traffic does not mint history — claim leases and so bloat at this scale usually means something is writing versioned tables in a tight loop. Find and fix that writer, watch data-directory growth over time, and run `dolt gc` periodically so unreachable garbage never accumulates on top -of reachable history. +of reachable history — with an occasional `dolt gc --full`, since a default +pass is generational and never revisits data an earlier pass moved to the old +generation. diff --git a/docs/recovery/index.md b/docs/recovery/index.md index f7eb170f7..647d6ff0d 100644 --- a/docs/recovery/index.md +++ b/docs/recovery/index.md @@ -9,6 +9,7 @@ This section provides step-by-step recovery procedures for common Beads issues. | Issue | Symptoms | Runbook | |-------|----------|---------| +| Schema Version Mismatch | `bd` refuses with `schema version mismatch: database is at vNN, binary knows up to vNN` | [Accidental v1.2.1 Release](/recovery/accidental-1-2-1-release) | | Init Safety Refusals | `bd init` or `bd dolt` refuses with a pattern code like `pk-fork-refused` | [Recovery Playbooks](/recovery/init-safety) | | Database Corruption | Database errors, missing data | [Database Corruption](/recovery/database-corruption) | | Merge Conflicts | Dolt conflicts during sync | [Merge Conflicts](/recovery/merge-conflicts) | diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index 4d30c71fc..8bd8e7ac4 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -5,7 +5,7 @@ description: Complete reference for bd configuration across config.yaml and data Complete configuration reference for beads. -Last reviewed: 2026-07-10 +Last reviewed: 2026-08-28 Freshness source: `cmd/bd/main.go`, `cmd/bd/config.go`, and `internal/configfile/`. @@ -457,6 +457,7 @@ Selected commonly-used variables: | `BD_NO_PAGER`, `BD_PAGER` | Pager behavior | | `BD_NON_INTERACTIVE` | Disable prompts | | `BD_DEBUG` | Enable debug logging | +| `BD_MIGRATION_FREEZE_FILE` | Check this exact path for the freeze marker instead of walking ancestor directories; authoritative when set (see [Migration Freeze](#migration-freeze)) | | `BEADS_DIR` | Force the active beads workspace directory | | `BEADS_ACTOR` | Actor identity (preferred over `BD_ACTOR`, which is a deprecated alias) | | `BEADS_IDENTITY` | Sender identity for `bd mail` | @@ -468,6 +469,44 @@ Integration secrets follow tracker-specific conventions: `LINEAR_API_KEY`, `GITH `bd config show` will display the source of every effective key, making overrides explicit. +## Migration Freeze + +Maintenance that runs outside `bd` — moving a database to a new host, rewriting schema by hand — needs a way to stop writes for its duration without uninstalling the tool. Create a file named `MIGRATION-FREEZE` and every write command refuses to run until you delete it. + +bd looks for the marker in the workspace directory and in the working directory, plus every ancestor of each, so one file above a tree of repositories freezes all of them at once — and targeting a frozen workspace from elsewhere (`BEADS_DIR=…`, `bd -C …`) is refused the same way. + +Markers found in a world-writable sticky directory such as `/tmp` are ignored: anyone on a shared machine could plant one there, and the sticky bit would stop you removing it. Put the marker at the root of the tree you are freezing. + +A freeze marker must be a regular file. A directory or a symlink named `MIGRATION-FREEZE` that the ancestor walk finds is ignored — the symlink with a one-line warning on stderr, so a stray link never disarms the gate in silence. To drive the freeze through an indirection on purpose, name that link with `BD_MIGRATION_FREEZE_FILE` (below), which bd follows. + +```bash +touch MIGRATION-FREEZE # the file's existence is the whole signal + +# Optional payload: operator, RFC3339 timestamp, and reason, tab-separated +# on one line. bd echoes it back in the refusal. +printf 'alice\t2026-08-16T12:00:00Z\tmoving to the new server\n' > MIGRATION-FREEZE + +bd create "new work" +# ⛔ ERROR: workspace is frozen for migration (by alice). +# Reason: moving to the new server +# bd create is blocked by the freeze marker at /work/MIGRATION-FREEZE. +# To resume writes, remove that file. + +rm MIGRATION-FREEZE # thaw +``` + +Blocked commands exit **14** — a stable code scripts branch on to tell "someone is migrating this workspace, come back later" from a generic failure worth an immediate retry. That includes the destructive ones: `bd init --reinit-local` and `bd bootstrap` are refused too. + +Reads (`bd list`, `bd show`, `bd ready`, …) keep working during a freeze, and bd's own background maintenance stands down with them — version-bump migration, JSONL auto-import, Dolt auto-commit, auto-backup, auto-export and auto-push are all skipped, so running a read does not leave a commit in the store you are migrating. + + +A `bd serve` process started before the marker appeared keeps accepting HTTP writes: the freeze is a CLI-invocation gate, and a running server never re-reads it. Stop the server before you freeze. + + +If bd cannot tell whether a marker is present — a permission error on the marker or on a directory above it — it refuses the write and says so, rather than assuming the workspace is open. + +`BD_MIGRATION_FREEZE_FILE` names one explicit path to consult instead of walking ancestors, for markers that live outside the tree. It is authoritative: when it is set, nothing else is checked. Because you name that path deliberately, it may be a symlink — bd follows it and freezes when the link resolves to a regular marker file — so an indirection such as `current -> releases/42/MIGRATION-FREEZE` works as the authoritative signal. + ## Security: Where Secrets Live - Tokens and API keys are never stored in the Dolt database — database config is pushed to remotes, which would expose secrets and trip GitHub secret scanning. `bd config set` routes secret keys to the local `config.yaml` instead. diff --git a/docs/reference/events-journal.md b/docs/reference/events-journal.md index 763eccc94..3512fd6a2 100644 --- a/docs/reference/events-journal.md +++ b/docs/reference/events-journal.md @@ -41,6 +41,17 @@ backfill what happened before, so a consumer starting today baselines from the workspace's current state (an [export](/cli-reference/export), or a full read) and follows the journal from there. + +Turn it on wherever beads **writes**, not just where your consumer reads. The +journal records the mutations made by the clone that made them, so a workspace +whose writers never enabled it stays permanently empty — and an empty journal +is indistinguishable from a caught-up one. Every writer of a workspace you +intend to replay needs `events-journal: true` (or `BD_EVENTS_JOURNAL=1` in its +environment), including agents, CI jobs, and a `bd serve` process. `bd events +export` and `bd events tail` say so on stderr when the workspace they read is +disabled; over HTTP the same condition is a `409`. + + | Key | Default | Effect | |---|---|---| | `events-journal` | `false` | Master switch. Off costs nothing; on costs one snapshot write per mutation. | @@ -234,7 +245,7 @@ build, and says nothing about whether this workspace has a journal. | `ts` | string | UTC insert time, stamped inside the committing transaction. | | `op` | string | One of the seven operations below. | | `issue_id` | string | The mutated issue. | -| `actor` | string | The acting identity that performed the mutation, as resolved for the audit-events table; on a `comment` row, the comment's author. Absent when the path has no actor — derived maintenance (`is_blocked` recomputes), deletes (other than a rename's synthetic `delete` row), and rows written before the journal recorded actors. An absent `actor` is never user attribution: read it as "system/unknown", not as a conflicting writer. | +| `actor` | string | The acting identity that performed the mutation, as resolved for the audit-events table; on a `comment` row, the comment's author. A `delete` and the `dep_remove` records a cascading delete produces carry the identity that *requested* the delete, not the beads the cascade reached. Absent when the path genuinely has no actor — derived maintenance (`is_blocked` recomputes), system cleanup with no request behind it, and rows written before the journal recorded actors. An absent `actor` is never user attribution: read it as "system/unknown", not as a conflicting writer. | | `issue` | object or null | The issue's full state *after* the mutation; `null` on a delete. | | `dep` | object | `{"kind","target","metadata"}` on `dep_add` and `dep_remove`; absent otherwise. | | `comment` | object | `{"id","author","text","created_at","source"}` on `comment`; absent otherwise. | diff --git a/docs/reference/json-schema.md b/docs/reference/json-schema.md index 90550e510..c21170240 100644 --- a/docs/reference/json-schema.md +++ b/docs/reference/json-schema.md @@ -197,8 +197,9 @@ change here is a breaking wire change). Same required fields as list items, plus: - `description` (string) - `acceptance_criteria` (string) -- `revision` (number): guarded-write optimistic-concurrency token; always - present, including a legacy `0` +- `revision` (string): guarded-write optimistic-concurrency token, an opaque + decimal string compared by equality and echoed back verbatim; always present, + including a legacy `"0"` - `dependencies` (object[]): Full dependency records - `comments` (object[]): Comment thread — present only with `--include-comments`; the default response returns `comment_count` only (count-only, be-ijck6q) diff --git a/docs/reference/troubleshooting.md b/docs/reference/troubleshooting.md index 1c426840e..9308471fb 100644 --- a/docs/reference/troubleshooting.md +++ b/docs/reference/troubleshooting.md @@ -423,6 +423,39 @@ don't know", not "this is definitely broken". A genuinely missing or broken `dolt` binary (not found, not executable, or the probe itself fails/times out) is a hard error, not a warning. +### Proxied-server mode: closing a bead gate fails with "no local store available" + +``` +gate condition not satisfied: bead gate "bd-a1b2": no local store available (use --force to override) +``` + +`bd close` on a bead gate refuses this way in proxied-server mode even when +the awaited bead is closed. Proxied-server commands run against a shared +`dolt sql-server` and never open a local store, so the close path has +nothing to read the awaited bead's status from. + +`bd gate check` does evaluate bead gates in proxied-server mode, and closes +the ones whose target has closed: + +```bash +bd gate check --type=bead # closes bead gates whose awaited bead is closed +bd close --force # or close without verifying the condition +``` + +Tracked in [#5861](https://github.com/gastownhall/beads/issues/5861). + +### Prefix routing: "proxy server store needs to be uow provider" + +A lookup routed through the orchestrator's `routes.jsonl` prefix routes +fails with this error when the rig that owns the prefix is itself running in +proxied-server mode — routed reads cannot open a proxied-server rig. In an +all-proxied shared-server topology that applies to every routed target, so +cross-rig bead gates and a plain `bd show ` both dead-end here. + +Run the command from the owning rig's own workspace instead, where the ID +resolves locally rather than through a route. Tracked in +[#5861](https://github.com/gastownhall/beads/issues/5861). + ## Sync Issues ### Changes not syncing diff --git a/docs/workflows/gates.md b/docs/workflows/gates.md index 6fd9d73fc..a2c7cd2f1 100644 --- a/docs/workflows/gates.md +++ b/docs/workflows/gates.md @@ -17,8 +17,8 @@ closes. Gates close in one of two ways: - **Manually** — `bd gate resolve ` (human gates always close this way). -- **Via `bd gate check`** — evaluates open timer and GitHub gates against - the real world and closes the ones whose condition is met. +- **Via `bd gate check`** — evaluates open timer, GitHub, and bead gates + against the real world and closes the ones whose condition is met. ```bash bd gate list # open gates @@ -37,7 +37,7 @@ bd gate resolve # close a gate manually | `timer` | a duration after gate creation | `bd gate check` once the timeout elapses | | `gh:run` | a GitHub Actions workflow to complete successfully | `bd gate check` (uses `gh run view`) | | `gh:pr` | a pull request to merge | `bd gate check` (uses `gh pr view`) | -| `bead` | a bead in another rig to close | cannot be checked because multi-rig routing was removed; resolve these gates manually | +| `bead` | a bead to close — a plain ID names a bead in this rig, the cross-rig form is `:` | `bd gate check` for plain local IDs; cross-rig values cannot be checked — resolve those manually | Timeouts use Go duration syntax: `30m`, `1h`, `24h` (there is no `d` unit — write `24h`, not `1d`). @@ -51,6 +51,26 @@ unrelated, ordinary metadata for those types. `bd gate check` rejects malformed repository values instead of falling back to the current repository. +### Known limitations: multi-rig and proxied-server topologies + +Bead gates and prefix routing (`routes.jsonl`) do not work in every +topology. Three limitations to expect, all tracked in +[#5861](https://github.com/gastownhall/beads/issues/5861): + +- **Cross-rig bead gates never resolve on their own.** A `:` + await value reports `cannot be checked (multi-rig routing removed)` and + stays pending regardless of the awaited bead's status. Close it with + `bd gate resolve`. +- **`bd close` cannot verify a bead gate in the experimental proxied-server + mode.** Proxied-server commands never open a local store, so closing the + gate refuses with `no local store available` even when the awaited bead is + closed. Run `bd gate check`, which evaluates bead gates in proxied-server + mode and closes the satisfied ones, or `bd close --force`. +- **Prefix routing cannot open a proxied-server target rig.** A routed + lookup into a rig that is itself in proxied-server mode fails with + `proxy server store needs to be uow provider`, so an all-proxied + shared-server topology cannot resolve routed targets at all. + ## Gates in formulas A formula step declares a gate with a `[steps.gate]` block. When the formula diff --git a/engdocs/design/ownership-handoff-contract.md b/engdocs/design/ownership-handoff-contract.md new file mode 100644 index 000000000..ae955556a --- /dev/null +++ b/engdocs/design/ownership-handoff-contract.md @@ -0,0 +1,45 @@ +# Direct-local ownership handoff contract + +This contract defines the Beads-side boundary required before Gas City can +retire a legacy GC-managed direct-local Dolt server. It is intentionally an +explicit operation; normal `bd` or `gc` startup never invokes it. + +## Request identity + +The handoff request must name the canonical, real-path Dolt data root, Dolt +database, Beads project/workspace identity, endpoint (host/port or socket), +and current owner (`legacy-gc`). The provider rejects missing, symlinked, +non-canonical, or conflicting identity. It must never create a replacement +root or database when identity cannot be proved. + +## Journaled phases + +The operation persists an atomic journal beside the Beads metadata. Every +retry resumes from the last durable phase and a committed retry is a no-op. + +1. `prepared`: snapshot metadata, config, endpoint, ownership, and sentinel. +2. `target_configured`: validate that bd can open the exact root/database. +3. `old_owner_stopped`: stop only the positively identified GC owner through + its existing lifecycle interface; a live or unknown process fails closed. +4. `verified`: start through bd and verify endpoint, database identity, and + sentinel rows. +5. `committed`: atomically record owner `bd` and retire only GC artifacts whose + ownership matches the snapshot. + +Any failure before `committed` leaves `legacy-gc` authoritative. Rollback +restores the byte/row/config snapshot and never kills an unverified process. +The journal records the error and phase so operators can retry or inspect it. + +## Front-door shape + +The eventual CLI/API must expose dry-run, execute, and resume behavior with a +typed result containing `phase`, `owner`, `root`, `database`, `endpoint`, +`mutates`, and `error_code`. Text and JSON responses share the same values; +non-zero exits are required for every refusal. Dry-run and all refusals have +`mutates=false` and must not open a provider. + +External TCP/Unix endpoints, embedded stores, wrong-root/database requests, +missing or stale runtime state, concurrent starts, and duplicate-owner +conditions are refusal boundaries. Existing rows, event history, metadata, +locks, PID records, and unrelated files are no-mutation artifacts in those +cases. diff --git a/examples/bd-example-extension-go/go.mod b/examples/bd-example-extension-go/go.mod index 9703b1f6a..4b03044be 100644 --- a/examples/bd-example-extension-go/go.mod +++ b/examples/bd-example-extension-go/go.mod @@ -100,7 +100,7 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/juju/gnuflag v1.0.0 // indirect github.com/kch42/buzhash v0.0.0-20160816060738-9bdec3dec7c6 // indirect - github.com/klauspost/compress v1.18.5 // indirect + github.com/klauspost/compress v1.18.7 // indirect github.com/klauspost/cpuid/v2 v2.2.6 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/lestrrat-go/strftime v1.2.0 // indirect @@ -153,18 +153,18 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/crypto v0.54.0 // indirect + golang.org/x/crypto v0.55.0 // indirect golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect - golang.org/x/mod v0.37.0 // indirect - golang.org/x/net v0.57.0 // indirect + golang.org/x/mod v0.40.0 // indirect + golang.org/x/net v0.58.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect - golang.org/x/telemetry v0.0.0-20260625142307-59b4966ccb57 // indirect + golang.org/x/telemetry v0.0.0-20260811182544-a038080d80e5 // indirect golang.org/x/term v0.45.0 // indirect - golang.org/x/text v0.40.0 // indirect + golang.org/x/text v0.41.0 // indirect golang.org/x/time v0.14.0 // indirect - golang.org/x/tools v0.47.0 // indirect + golang.org/x/tools v0.49.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.264.0 // indirect google.golang.org/genproto v0.0.0-20260128011058-8636f8732409 // indirect diff --git a/examples/bd-example-extension-go/go.sum b/examples/bd-example-extension-go/go.sum index 8a7851b3e..4965e2543 100644 --- a/examples/bd-example-extension-go/go.sum +++ b/examples/bd-example-extension-go/go.sum @@ -693,8 +693,8 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE= -github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= +github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= +github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.1.0/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= @@ -755,18 +755,18 @@ github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= -github.com/moby/go-archive v0.2.0 h1:zg5QDUM2mi0JIM9fdQZWC7U8+2ZfixfTYoHL7rWUcP8= -github.com/moby/go-archive v0.2.0/go.mod h1:mNeivT14o8xU+5q1YnNrkQVpK+dnNe/K6fHqnTg4qPU= +github.com/moby/go-archive v0.3.3 h1:OxxR9paxsluYi+zDUEXTTaIxtkK3viymW+Ka7vRhhME= +github.com/moby/go-archive v0.3.3/go.mod h1:Npdv43fFqlhZW7Xo8fbm3ZMYFvAGNviUPqX21VERbcE= github.com/moby/moby/api v1.54.2 h1:wiat9QAhnDQjA7wk1kh/TqHz2I1uUA7M7t9SAl/JNXg= github.com/moby/moby/api v1.54.2/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs= github.com/moby/moby/client v0.4.0 h1:S+2XegzHQrrvTCvF6s5HFzcrywWQmuVnhOXe2kiWjIw= github.com/moby/moby/client v0.4.0/go.mod h1:QWPbvWchQbxBNdaLSpoKpCdf5E+WxFAgNHogCWDoa7g= github.com/moby/patternmatcher v0.6.1 h1:qlhtafmr6kgMIJjKJMDmMWq7WLkKIo23hsrpR3x084U= github.com/moby/patternmatcher v0.6.1/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= -github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= -github.com/moby/sys/user v0.4.0 h1:jhcMKit7SA80hivmFJcbB1vqmw//wU61Zdui2eQXuMs= -github.com/moby/sys/user v0.4.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= +github.com/moby/sys/sequential v0.7.0 h1:ASQNGNROJSuOO6LL6bPHbKvuZu6NU8P4ldPWk31zj/8= +github.com/moby/sys/sequential v0.7.0/go.mod h1:NfSTAp6V3fw4tmkD62PEcOKeZKquXT8VKCkf7aVR79o= +github.com/moby/sys/user v0.4.1 h1:RgjRlaDKi/Xmyrz4t8lyzXT6v2ooFeO/7xtchmhVWE0= +github.com/moby/sys/user v0.4.1/go.mod h1:E9QsW5WRe1kUAf7kW8hXKwu1uhsZEAdPLYHYSDudF4Y= github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/moby/term v0.5.2 h1:6qk3FJAFDs6i/q3W/pQ97SX192qKfZgGjCQqfCJkgzQ= @@ -1027,8 +1027,8 @@ golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= -golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= +golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= +golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1082,8 +1082,8 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ= -golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0= +golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs= +golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1137,8 +1137,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= -golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1259,8 +1259,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/telemetry v0.0.0-20260625142307-59b4966ccb57 h1:nwGZBCt+FnXUrGsj5vjzAsEmkcaFvd82BbOjECiFYZc= -golang.org/x/telemetry v0.0.0-20260625142307-59b4966ccb57/go.mod h1:3AWMyWHS+caVoiEXpiq6+tzKA40J4vQT3MYr80ZtQpc= +golang.org/x/telemetry v0.0.0-20260811182544-a038080d80e5 h1:ZUSxONxc981v7AW7QUg+I9WwZzSTTJ019ENBYr5pV/Q= +golang.org/x/telemetry v0.0.0-20260811182544-a038080d80e5/go.mod h1:LVehoXe41cL5SCVQilsV7Gg6BNG+Js6P9PhSbYTIUkQ= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1281,8 +1281,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= -golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= +golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= +golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1355,8 +1355,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q= -golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA= +golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= +golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/examples/library-usage/go.mod b/examples/library-usage/go.mod index 704957403..a0e739ff4 100644 --- a/examples/library-usage/go.mod +++ b/examples/library-usage/go.mod @@ -100,7 +100,7 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/juju/gnuflag v1.0.0 // indirect github.com/kch42/buzhash v0.0.0-20160816060738-9bdec3dec7c6 // indirect - github.com/klauspost/compress v1.18.5 // indirect + github.com/klauspost/compress v1.18.7 // indirect github.com/klauspost/cpuid/v2 v2.2.6 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/lestrrat-go/strftime v1.2.0 // indirect @@ -153,18 +153,18 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/crypto v0.54.0 // indirect + golang.org/x/crypto v0.55.0 // indirect golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect - golang.org/x/mod v0.37.0 // indirect - golang.org/x/net v0.57.0 // indirect + golang.org/x/mod v0.40.0 // indirect + golang.org/x/net v0.58.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect - golang.org/x/telemetry v0.0.0-20260625142307-59b4966ccb57 // indirect + golang.org/x/telemetry v0.0.0-20260811182544-a038080d80e5 // indirect golang.org/x/term v0.45.0 // indirect - golang.org/x/text v0.40.0 // indirect + golang.org/x/text v0.41.0 // indirect golang.org/x/time v0.14.0 // indirect - golang.org/x/tools v0.47.0 // indirect + golang.org/x/tools v0.49.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.264.0 // indirect google.golang.org/genproto v0.0.0-20260128011058-8636f8732409 // indirect diff --git a/examples/library-usage/go.sum b/examples/library-usage/go.sum index 8a7851b3e..4965e2543 100644 --- a/examples/library-usage/go.sum +++ b/examples/library-usage/go.sum @@ -693,8 +693,8 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE= -github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= +github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= +github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.1.0/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= @@ -755,18 +755,18 @@ github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= -github.com/moby/go-archive v0.2.0 h1:zg5QDUM2mi0JIM9fdQZWC7U8+2ZfixfTYoHL7rWUcP8= -github.com/moby/go-archive v0.2.0/go.mod h1:mNeivT14o8xU+5q1YnNrkQVpK+dnNe/K6fHqnTg4qPU= +github.com/moby/go-archive v0.3.3 h1:OxxR9paxsluYi+zDUEXTTaIxtkK3viymW+Ka7vRhhME= +github.com/moby/go-archive v0.3.3/go.mod h1:Npdv43fFqlhZW7Xo8fbm3ZMYFvAGNviUPqX21VERbcE= github.com/moby/moby/api v1.54.2 h1:wiat9QAhnDQjA7wk1kh/TqHz2I1uUA7M7t9SAl/JNXg= github.com/moby/moby/api v1.54.2/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs= github.com/moby/moby/client v0.4.0 h1:S+2XegzHQrrvTCvF6s5HFzcrywWQmuVnhOXe2kiWjIw= github.com/moby/moby/client v0.4.0/go.mod h1:QWPbvWchQbxBNdaLSpoKpCdf5E+WxFAgNHogCWDoa7g= github.com/moby/patternmatcher v0.6.1 h1:qlhtafmr6kgMIJjKJMDmMWq7WLkKIo23hsrpR3x084U= github.com/moby/patternmatcher v0.6.1/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= -github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= -github.com/moby/sys/user v0.4.0 h1:jhcMKit7SA80hivmFJcbB1vqmw//wU61Zdui2eQXuMs= -github.com/moby/sys/user v0.4.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= +github.com/moby/sys/sequential v0.7.0 h1:ASQNGNROJSuOO6LL6bPHbKvuZu6NU8P4ldPWk31zj/8= +github.com/moby/sys/sequential v0.7.0/go.mod h1:NfSTAp6V3fw4tmkD62PEcOKeZKquXT8VKCkf7aVR79o= +github.com/moby/sys/user v0.4.1 h1:RgjRlaDKi/Xmyrz4t8lyzXT6v2ooFeO/7xtchmhVWE0= +github.com/moby/sys/user v0.4.1/go.mod h1:E9QsW5WRe1kUAf7kW8hXKwu1uhsZEAdPLYHYSDudF4Y= github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/moby/term v0.5.2 h1:6qk3FJAFDs6i/q3W/pQ97SX192qKfZgGjCQqfCJkgzQ= @@ -1027,8 +1027,8 @@ golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= -golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= +golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= +golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1082,8 +1082,8 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ= -golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0= +golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs= +golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1137,8 +1137,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= -golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1259,8 +1259,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/telemetry v0.0.0-20260625142307-59b4966ccb57 h1:nwGZBCt+FnXUrGsj5vjzAsEmkcaFvd82BbOjECiFYZc= -golang.org/x/telemetry v0.0.0-20260625142307-59b4966ccb57/go.mod h1:3AWMyWHS+caVoiEXpiq6+tzKA40J4vQT3MYr80ZtQpc= +golang.org/x/telemetry v0.0.0-20260811182544-a038080d80e5 h1:ZUSxONxc981v7AW7QUg+I9WwZzSTTJ019ENBYr5pV/Q= +golang.org/x/telemetry v0.0.0-20260811182544-a038080d80e5/go.mod h1:LVehoXe41cL5SCVQilsV7Gg6BNG+Js6P9PhSbYTIUkQ= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1281,8 +1281,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= -golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= +golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= +golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1355,8 +1355,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q= -golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA= +golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= +golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/go.mod b/go.mod index 21f6d7a1b..85f9a81ad 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module github.com/steveyegge/beads go 1.26.5 +toolchain go1.26.7 + require ( charm.land/glamour/v2 v2.0.1 charm.land/huh/v2 v2.0.3 @@ -45,25 +47,21 @@ require ( github.com/cockroachdb/apd/v3 v3.2.3 // indirect github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect - github.com/getkin/kin-openapi v0.133.0 // indirect - github.com/go-openapi/jsonpointer v0.21.0 // indirect - github.com/go-openapi/swag v0.23.0 // indirect - github.com/josharian/intern v1.0.0 // indirect - github.com/mailru/easyjson v0.7.7 // indirect + github.com/getkin/kin-openapi v0.144.0 // indirect + github.com/go-openapi/jsonpointer v0.22.5 // indirect + github.com/go-openapi/swag/jsonname v0.25.5 // indirect github.com/moby/moby/api v1.54.2 // indirect github.com/moby/moby/client v0.4.0 // indirect - github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect - github.com/oapi-codegen/oapi-codegen/v2 v2.6.0 // indirect - github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect - github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect + github.com/oapi-codegen/oapi-codegen/v2 v2.7.1 // indirect + github.com/oasdiff/yaml v0.1.1 // indirect + github.com/oasdiff/yaml3 v0.0.14 // indirect github.com/pb33f/ordered-map/v2 v2.3.1 // indirect - github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/prometheus/procfs v0.16.1 // indirect - github.com/speakeasy-api/jsonpath v0.6.0 // indirect - github.com/speakeasy-api/openapi-overlay v0.10.2 // indirect + github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect + github.com/speakeasy-api/jsonpath v0.6.3 // indirect + github.com/speakeasy-api/openapi v1.19.2 // indirect github.com/standard-webhooks/standard-webhooks/libraries v0.0.1 // indirect github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect - github.com/woodsbury/decimal128 v1.3.0 // indirect go.yaml.in/yaml/v4 v4.0.0-rc.2 // indirect ) @@ -192,7 +190,7 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/juju/gnuflag v1.0.0 // indirect github.com/kch42/buzhash v0.0.0-20160816060738-9bdec3dec7c6 // indirect - github.com/klauspost/compress v1.18.5 // indirect + github.com/klauspost/compress v1.18.7 // indirect github.com/klauspost/cpuid/v2 v2.2.6 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/lestrrat-go/strftime v1.2.0 // indirect @@ -205,10 +203,10 @@ require ( github.com/microcosm-cc/bluemonday v1.0.27 github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect - github.com/moby/go-archive v0.2.0 // indirect + github.com/moby/go-archive v0.3.3 // indirect github.com/moby/patternmatcher v0.6.1 // indirect - github.com/moby/sys/sequential v0.6.0 // indirect - github.com/moby/sys/user v0.4.0 // indirect + github.com/moby/sys/sequential v0.7.0 // indirect + github.com/moby/sys/user v0.4.1 // indirect github.com/moby/sys/userns v0.1.0 // indirect github.com/moby/term v0.5.2 // indirect github.com/mohae/uvarint v0.0.0-20160208145430-c3f9e62bf2b0 // indirect @@ -261,15 +259,15 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/crypto v0.54.0 // indirect + golang.org/x/crypto v0.55.0 // indirect golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 // indirect - golang.org/x/mod v0.37.0 - golang.org/x/net v0.57.0 + golang.org/x/mod v0.40.0 + golang.org/x/net v0.58.0 golang.org/x/oauth2 v0.36.0 // indirect - golang.org/x/telemetry v0.0.0-20260625142307-59b4966ccb57 // indirect - golang.org/x/text v0.40.0 // indirect + golang.org/x/telemetry v0.0.0-20260811182544-a038080d80e5 // indirect + golang.org/x/text v0.41.0 // indirect golang.org/x/time v0.14.0 // indirect - golang.org/x/tools v0.47.0 // indirect + golang.org/x/tools v0.49.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.264.0 // indirect google.golang.org/genproto v0.0.0-20260128011058-8636f8732409 // indirect diff --git a/go.sum b/go.sum index e32c4a0b8..9196fa792 100644 --- a/go.sum +++ b/go.sum @@ -506,8 +506,8 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4 github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/getkin/kin-openapi v0.133.0 h1:pJdmNohVIJ97r4AUFtEXRXwESr8b0bD721u/Tz6k8PQ= -github.com/getkin/kin-openapi v0.133.0/go.mod h1:boAciF6cXk5FhPqe/NQeBTeenbjqU4LhWBf09ILVvWE= +github.com/getkin/kin-openapi v0.144.0 h1:hIRcTH+KjLfkLpYU6bSSfdFpi0fZi1fp+hSPi4aQu9Y= +github.com/getkin/kin-openapi v0.144.0/go.mod h1:3BH9M9XDe/y9M5DSvEocVYAYq1w0qrhJHjC/vZi0AaY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= @@ -536,10 +536,12 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= -github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= -github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= -github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-openapi/jsonpointer v0.22.5 h1:8on/0Yp4uTb9f4XvTrM2+1CPrV05QPZXu+rvu2o9jcA= +github.com/go-openapi/jsonpointer v0.22.5/go.mod h1:gyUR3sCvGSWchA2sUBJGluYMbe1zazrYWIkWPjjMUY0= +github.com/go-openapi/swag/jsonname v0.25.5 h1:8p150i44rv/Drip4vWI3kGi9+4W9TdI3US3uUYSFhSo= +github.com/go-openapi/swag/jsonname v0.25.5/go.mod h1:jNqqikyiAK56uS7n8sLkdaNY/uq6+D2m2LANat09pKU= +github.com/go-openapi/testify/v2 v2.4.0 h1:8nsPrHVCWkQ4p8h1EsRVymA2XABB4OT40gcvAu+voFM= +github.com/go-openapi/testify/v2 v2.4.0/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54= github.com/go-pdf/fpdf v0.6.0 h1:MlgtGIfsdMEEQJr2le6b/HNr1ZlQwxyWr77r2aj2U/8= github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= @@ -553,8 +555,6 @@ github.com/go-sql-driver/mysql v1.10.0 h1:Q+1LV8DkHJvSYAdR83XzuhDaTykuDx0l6fkXxo github.com/go-sql-driver/mysql v1.10.0/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= -github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= @@ -774,8 +774,6 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC github.com/jmoiron/sqlx v1.3.4 h1:wv+0IJZfL5z0uZoUjlpKgHkgaFSYD+r9CfrXjEXsO7w= github.com/jmoiron/sqlx v1.3.4/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= @@ -795,8 +793,8 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE= -github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= +github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= +github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.1.0/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= @@ -834,8 +832,6 @@ github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mark3labs/mcp-go v0.34.0 h1:eWy7WBGvhk6EyAAyVzivTCprE52iXJwNtvHV6Cv3bR0= github.com/mark3labs/mcp-go v0.34.0/go.mod h1:rXqOudj/djTORU/ThxYx8fqEVj/5pvTuuebQ2RC7uk4= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= @@ -865,18 +861,22 @@ github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= -github.com/moby/go-archive v0.2.0 h1:zg5QDUM2mi0JIM9fdQZWC7U8+2ZfixfTYoHL7rWUcP8= -github.com/moby/go-archive v0.2.0/go.mod h1:mNeivT14o8xU+5q1YnNrkQVpK+dnNe/K6fHqnTg4qPU= +github.com/moby/go-archive v0.3.3 h1:OxxR9paxsluYi+zDUEXTTaIxtkK3viymW+Ka7vRhhME= +github.com/moby/go-archive v0.3.3/go.mod h1:Npdv43fFqlhZW7Xo8fbm3ZMYFvAGNviUPqX21VERbcE= github.com/moby/moby/api v1.54.2 h1:wiat9QAhnDQjA7wk1kh/TqHz2I1uUA7M7t9SAl/JNXg= github.com/moby/moby/api v1.54.2/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs= github.com/moby/moby/client v0.4.0 h1:S+2XegzHQrrvTCvF6s5HFzcrywWQmuVnhOXe2kiWjIw= github.com/moby/moby/client v0.4.0/go.mod h1:QWPbvWchQbxBNdaLSpoKpCdf5E+WxFAgNHogCWDoa7g= github.com/moby/patternmatcher v0.6.1 h1:qlhtafmr6kgMIJjKJMDmMWq7WLkKIo23hsrpR3x084U= github.com/moby/patternmatcher v0.6.1/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= -github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= -github.com/moby/sys/user v0.4.0 h1:jhcMKit7SA80hivmFJcbB1vqmw//wU61Zdui2eQXuMs= -github.com/moby/sys/user v0.4.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= +github.com/moby/sys/mount v0.3.5 h1:eS3fsZTjHaBihwjp4/+5Z3jxqLXYsbwxqpVSfFv3M00= +github.com/moby/sys/mount v0.3.5/go.mod h1:WUQDO+/uCiCIkIztx8SrwIDVn2dtMFRBebRhpDFT71M= +github.com/moby/sys/mountinfo v0.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg= +github.com/moby/sys/mountinfo v0.7.2/go.mod h1:1YOa8w8Ih7uW0wALDUgT1dTTSBrZ+HiBLGws92L2RU4= +github.com/moby/sys/sequential v0.7.0 h1:ASQNGNROJSuOO6LL6bPHbKvuZu6NU8P4ldPWk31zj/8= +github.com/moby/sys/sequential v0.7.0/go.mod h1:NfSTAp6V3fw4tmkD62PEcOKeZKquXT8VKCkf7aVR79o= +github.com/moby/sys/user v0.4.1 h1:RgjRlaDKi/Xmyrz4t8lyzXT6v2ooFeO/7xtchmhVWE0= +github.com/moby/sys/user v0.4.1/go.mod h1:E9QsW5WRe1kUAf7kW8hXKwu1uhsZEAdPLYHYSDudF4Y= github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/moby/term v0.5.2 h1:6qk3FJAFDs6i/q3W/pQ97SX192qKfZgGjCQqfCJkgzQ= @@ -886,8 +886,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/mohae/uvarint v0.0.0-20160208145430-c3f9e62bf2b0 h1:fXRYk7YXVIBMGAHT+GmAcbiXrudXMPtqdLfbkVfUhkI= github.com/mohae/uvarint v0.0.0-20160208145430-c3f9e62bf2b0/go.mod h1:+6ZKJfAk1B0oKLOwdzYuRVJn3upG1c7uOm5Ih7Rrkvc= github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= @@ -901,12 +899,12 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oapi-codegen/oapi-codegen/v2 v2.6.0 h1:4i+F2cvwBFZeplxCssNdLy3MhNzUD87mI3HnayHZkAU= -github.com/oapi-codegen/oapi-codegen/v2 v2.6.0/go.mod h1:eWHeJSohQJIINJZzzQriVynfGsnlQVh0UkN2UYYcw4Q= -github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 h1:G7ERwszslrBzRxj//JalHPu/3yz+De2J+4aLtSRlHiY= -github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037/go.mod h1:2bpvgLBZEtENV5scfDFEtB/5+1M4hkQhDQrccEJ/qGw= -github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 h1:bQx3WeLcUWy+RletIKwUIt4x3t8n2SxavmoclizMb8c= -github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o= +github.com/oapi-codegen/oapi-codegen/v2 v2.7.1 h1:a7Ab7YlpqkVG5HKrTaeFstm32Z5QOnyjnbsCO0jiMYM= +github.com/oapi-codegen/oapi-codegen/v2 v2.7.1/go.mod h1:qzFy6iuobJw/hD1aRILee4G87/ShmhR0xYCwcUtZMCw= +github.com/oasdiff/yaml v0.1.1 h1:6nHx+pn9gBRM6YpBlFZFQGCCd1nuvqOBtTD3KKTgGxY= +github.com/oasdiff/yaml v0.1.1/go.mod h1:EYJNoyktvWMJ0Hmhx+6qTaqMOsalUaRGT8Sj1hNcegU= +github.com/oasdiff/yaml3 v0.0.14 h1:aLJee3hxBK2H5wdXd9iPcIXb93Nty1Ge0pT171eHtkw= +github.com/oasdiff/yaml3 v0.0.14/go.mod h1:csto2xfDjYccdUn/yw/bPjj/cYTdp6HtFA0J4TWG+gg= github.com/olebedev/when v1.1.0 h1:dlpoRa7huImhNtEx4yl0WYfTHVEWmJmIWd7fEkTHayc= github.com/olebedev/when v1.1.0/go.mod h1:T0THb4kP9D3NNqlvCwIG4GyUioTAzEhB4RNVzig/43E= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -932,8 +930,6 @@ github.com/pb33f/ordered-map/v2 v2.3.1/go.mod h1:qxFQgd0PkVUtOMCkTapqotNgzRhMPL7 github.com/pborman/getopt v0.0.0-20180729010549-6fdd0a2c7117/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= -github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= -github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= github.com/pierrec/lz4/v4 v4.1.8/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= @@ -982,6 +978,8 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc= github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEVZGK7IN2kJkjTuQ= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sebdah/goldie/v2 v2.8.0 h1:dZb9wR8q5++oplmEiJT+U/5KyotVD+HNGCAc5gNr8rc= github.com/sebdah/goldie/v2 v2.8.0/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvKI/NNtssI= @@ -1004,10 +1002,10 @@ github.com/sony/gobreaker v0.5.0/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJ github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/speakeasy-api/jsonpath v0.6.0 h1:IhtFOV9EbXplhyRqsVhHoBmmYjblIRh5D1/g8DHMXJ8= -github.com/speakeasy-api/jsonpath v0.6.0/go.mod h1:ymb2iSkyOycmzKwbEAYPJV/yi2rSmvBCLZJcyD+VVWw= -github.com/speakeasy-api/openapi-overlay v0.10.2 h1:VOdQ03eGKeiHnpb1boZCGm7x8Haj6gST0P3SGTX95GU= -github.com/speakeasy-api/openapi-overlay v0.10.2/go.mod h1:n0iOU7AqKpNFfEt6tq7qYITC4f0yzVVdFw0S7hukemg= +github.com/speakeasy-api/jsonpath v0.6.3 h1:c+QPwzAOdrWvzycuc9HFsIZcxKIaWcNpC+xhOW9rJxU= +github.com/speakeasy-api/jsonpath v0.6.3/go.mod h1:2cXloNuQ+RSXi5HTRaeBh7JEmjRXTiaKpFTdZiL7URI= +github.com/speakeasy-api/openapi v1.19.2 h1:md90tE71/M8jS3cuRlsuWP5Aed4xoG5PSRvXeZgCv/M= +github.com/speakeasy-api/openapi v1.19.2/go.mod h1:UfKa7FqE4jgexJZuj51MmdHAFGmDv0Zaw3+yOd81YKU= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= @@ -1065,17 +1063,12 @@ github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYI github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI= github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9RXw= github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= -github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/vbauerster/mpb/v8 v8.7.2 h1:SMJtxhNho1MV3OuFgS1DAzhANN1Ejc5Ct+0iSaIkB14= github.com/vbauerster/mpb/v8 v8.7.2/go.mod h1:ZFnrjzspgDHoxYLGvxIruiNk73GNTPG4YHgVNpR10VY= github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk= github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN1BWz5V+51Ewf8k+rQ= -github.com/woodsbury/decimal128 v1.3.0 h1:8pffMNWIlC0O5vbyHWFZAt5yWvWcrHA+3ovIIjVWss0= -github.com/woodsbury/decimal128 v1.3.0/go.mod h1:C5UTmyTjW3JftjUFzOVhC20BEQa2a4ZKOB5I6Zjb+ds= github.com/xitongsys/parquet-go v1.5.1/go.mod h1:xUxwM8ELydxh4edHGegYq1pA8NnMKDx0K/GyB0o2bww= github.com/xitongsys/parquet-go v1.6.2 h1:MhCaXii4eqceKPu9BwrjLqyK10oX9WF+xGhwvwbw7xM= github.com/xitongsys/parquet-go v1.6.2/go.mod h1:IulAQyalCm0rPiZVNnCgm/PCL64X2tdSVGMQ/UeKqWA= @@ -1195,8 +1188,8 @@ golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= -golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= +golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= +golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1250,8 +1243,8 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ= -golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0= +golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs= +golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1308,8 +1301,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= -golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1437,8 +1430,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/telemetry v0.0.0-20260625142307-59b4966ccb57 h1:nwGZBCt+FnXUrGsj5vjzAsEmkcaFvd82BbOjECiFYZc= -golang.org/x/telemetry v0.0.0-20260625142307-59b4966ccb57/go.mod h1:3AWMyWHS+caVoiEXpiq6+tzKA40J4vQT3MYr80ZtQpc= +golang.org/x/telemetry v0.0.0-20260811182544-a038080d80e5 h1:ZUSxONxc981v7AW7QUg+I9WwZzSTTJ019ENBYr5pV/Q= +golang.org/x/telemetry v0.0.0-20260811182544-a038080d80e5/go.mod h1:LVehoXe41cL5SCVQilsV7Gg6BNG+Js6P9PhSbYTIUkQ= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1459,8 +1452,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= -golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= +golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= +golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1534,8 +1527,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q= -golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA= +golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= +golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/integrations/beads-mcp/pyproject.toml b/integrations/beads-mcp/pyproject.toml index 97e59c9bc..079c1a64e 100644 --- a/integrations/beads-mcp/pyproject.toml +++ b/integrations/beads-mcp/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "beads-mcp" -version = "1.2.2" +version = "1.3.0" description = "MCP server for beads issue tracker." readme = "README.md" requires-python = ">=3.10" diff --git a/integrations/beads-mcp/src/beads_mcp/__init__.py b/integrations/beads-mcp/src/beads_mcp/__init__.py index 4a1373fef..2c222f1f7 100644 --- a/integrations/beads-mcp/src/beads_mcp/__init__.py +++ b/integrations/beads-mcp/src/beads_mcp/__init__.py @@ -4,4 +4,4 @@ This package provides an MCP (Model Context Protocol) server that exposes beads (bd) issue tracker functionality to MCP Clients. """ -__version__ = "1.2.2" +__version__ = "1.3.0" diff --git a/integrations/beads-mcp/uv.lock b/integrations/beads-mcp/uv.lock index c6bbcd113..e85770ccc 100644 --- a/integrations/beads-mcp/uv.lock +++ b/integrations/beads-mcp/uv.lock @@ -3,15 +3,24 @@ revision = 3 requires-python = ">=3.10" resolution-markers = [ "python_full_version >= '3.15'", - "python_full_version < '3.15'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform != 'win32'", + "python_full_version >= '3.11' and python_full_version < '3.14' and sys_platform == 'win32'", + "python_full_version < '3.11' and sys_platform == 'win32'", + "python_full_version >= '3.11' and python_full_version < '3.14' and sys_platform != 'win32'", + "python_full_version < '3.11' and sys_platform != 'win32'", ] [[package]] name = "aiofile" version = "3.9.0" source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.11' and sys_platform == 'win32'", + "python_full_version < '3.11' and sys_platform != 'win32'", +] dependencies = [ - { name = "caio" }, + { name = "caio", version = "0.9.25", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/67/e2/d7cb819de8df6b5c1968a2756c3cb4122d4fa2b8fc768b53b7c9e5edb646/aiofile-3.9.0.tar.gz", hash = "sha256:e5ad718bb148b265b6df1b3752c4d1d83024b93da9bd599df74b9d9ffcf7919b", size = 17943, upload-time = "2024-10-08T10:39:35.846Z" } wheels = [ @@ -19,77 +28,118 @@ wheels = [ ] [[package]] -name = "annotated-types" -version = "0.7.0" +name = "aiofile" +version = "3.12.3" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081, upload-time = "2024-05-20T21:33:25.928Z" } +resolution-markers = [ + "python_full_version >= '3.15'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform != 'win32'", + "python_full_version >= '3.11' and python_full_version < '3.14' and sys_platform == 'win32'", + "python_full_version >= '3.11' and python_full_version < '3.14' and sys_platform != 'win32'", +] +dependencies = [ + { name = "caio", version = "0.12.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/14/31/edb06aabd8f8f0b56d659f30800795f40b93cba96be946ce179f6931e3a5/aiofile-3.12.3.tar.gz", hash = "sha256:caa6aa746b5e47e2165f7abd741b6415e49cf4d44fddc0f61844612cc3924d41", size = 21600, upload-time = "2026-08-04T22:59:27.171Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" }, + { url = "https://files.pythonhosted.org/packages/4e/79/6e45e778c4c3cab39e0937b007b720c15f76c50c6453d153282d0fcc3588/aiofile-3.12.3-py3-none-any.whl", hash = "sha256:5c1bcc9e929c50834608e8cc1a4cc1d7503eb60c15a535b779fd39e2f372c017", size = 22122, upload-time = "2026-08-04T22:59:25.838Z" }, +] + +[[package]] +name = "annotated-types" +version = "0.8.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5f/56/a8120250d128bed162cd73c76d45f6ef9991f3e068f62a8ee060afa3104a/annotated_types-0.8.0.tar.gz", hash = "sha256:13b2beaad985e05e2d6407ee4c4f35590b11f8d693a258a561055cac8f64cab7", size = 15893, upload-time = "2026-07-23T20:16:13.995Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/99/91/8acff4f5e50511b911bbccb72b8628a49c68ce14148cd9f6431094859a90/annotated_types-0.8.0-py3-none-any.whl", hash = "sha256:f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0", size = 13427, upload-time = "2026-07-23T20:16:12.938Z" }, ] [[package]] name = "anyio" -version = "4.11.0" +version = "4.14.2" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "exceptiongroup", marker = "python_full_version < '3.11'" }, { name = "idna" }, - { name = "sniffio" }, { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/c6/78/7d432127c41b50bccba979505f272c16cbcadcc33645d5fa3a738110ae75/anyio-4.11.0.tar.gz", hash = "sha256:82a8d0b81e318cc5ce71a5f1f8b5c4e63619620b63141ef8c995fa0db95a57c4", size = 219094, upload-time = "2025-09-23T09:19:12.58Z" } +sdist = { url = "https://files.pythonhosted.org/packages/61/cc/a381afa6efea9f496eff839d4a6a1aed3bfafc7b3ab4b0d1b243a12573dd/anyio-4.14.2.tar.gz", hash = "sha256:cfa139f3ed1a23ee8f88a145ddb5ac7605b8bbfd8592baacd7ce3d8bb4313c7f", size = 260176, upload-time = "2026-07-12T20:29:07.082Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/15/b3/9b1a8074496371342ec1e796a96f99c82c945a339cd81a8e73de28b4cf9e/anyio-4.11.0-py3-none-any.whl", hash = "sha256:0287e96f4d26d4149305414d4e3bc32f0dcd0862365a4bddea19d7a1ec38c4fc", size = 109097, upload-time = "2025-09-23T09:19:10.601Z" }, + { url = "https://files.pythonhosted.org/packages/da/35/f2287558c17e29fafc8ef3daf819bb9834061cfa43bff8014f7df7f63bdc/anyio-4.14.2-py3-none-any.whl", hash = "sha256:9f505dda5ac9f0c8309b5e8bd445a8c2bf7246f3ce950121e45ea15bc41d1494", size = 125813, upload-time = "2026-07-12T20:29:05.763Z" }, ] [[package]] name = "ast-serialize" -version = "0.6.0" +version = "0.8.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/58/ad/0d70a3a2d6e01968d985415259e8ec7ad3f777903f9b1c1f3c8c44642c60/ast_serialize-0.6.0.tar.gz", hash = "sha256:aadd3ffcf4858c9726bf3515f7b199c7eadbe504f96028e4a87172c0da65a8fe", size = 61489, upload-time = "2026-06-30T20:02:55.555Z" } +sdist = { url = "https://files.pythonhosted.org/packages/e1/a9/11851c3e02a3fea2ddc9932d1fdc7d2edaeecc0d2e11bc5f2a7fde2b0934/ast_serialize-0.8.0.tar.gz", hash = "sha256:6c37c43e4004dfb42d321ddedc569dc17ff4259296f3af577c9ea46a809bc010", size = 845638, upload-time = "2026-08-07T11:29:02.152Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/3f/12/3e5f575f156555547c250a8b0d1347517a3a20fc7f4492e9703a69d4f45e/ast_serialize-0.6.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:a7520b672827885bafeae7501f684d14d47d17e5f45256f9df547686cca52264", size = 1177640, upload-time = "2026-06-30T20:02:06.708Z" }, - { url = "https://files.pythonhosted.org/packages/a2/a4/921a9e27951627983b0f368859ea00f8330a551dc0bf4c2fdcb11855a98b/ast_serialize-0.6.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:a14191beec7e0c078d2fc1f6edc0aee88bcd4db9f18e1bc9f8052b559c22dddc", size = 1168111, upload-time = "2026-06-30T20:02:08.366Z" }, - { url = "https://files.pythonhosted.org/packages/00/69/950cf404de7b8782cf95e5c1237e25e2aa46177b287f39f9eeddf481fd6f/ast_serialize-0.6.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:32ef62ec34cf6be20ad77d4799556638fbdf187f3ae10698dfb20ef9f2c89516", size = 1227656, upload-time = "2026-06-30T20:02:09.843Z" }, - { url = "https://files.pythonhosted.org/packages/4c/a8/46f8f6a6479d9d2273980957bb091a506c55f5b95d3c029ee58518a78407/ast_serialize-0.6.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:13b7769970a39983b0adf2f38917b1cd3b8946f76df045756c3d741bc689f089", size = 1227706, upload-time = "2026-06-30T20:02:11.367Z" }, - { url = "https://files.pythonhosted.org/packages/b7/b9/9ac415bda0a40e49eab8fea3b2741c19c98bb84d57d62c4cfc6230eb67be/ast_serialize-0.6.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6f7a408601bb3edaefb3bc67a4c01f5235e3253653b6a5729a2ee2382b35341c", size = 1431705, upload-time = "2026-06-30T20:02:12.737Z" }, - { url = "https://files.pythonhosted.org/packages/e5/06/8807115d441444879f7561b5eede5ac18fc80392f11826d61ccf31f503b1/ast_serialize-0.6.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8670bfa51208a2c0c8d138928e40e998fab158f9200d53bb80c088b5b8eda7b8", size = 1249533, upload-time = "2026-06-30T20:02:14.571Z" }, - { url = "https://files.pythonhosted.org/packages/3e/c0/c2ba82ef9618650357d9421a1fdb27ffec862a7f57e8e2de82a3ccd11e12/ast_serialize-0.6.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a4826809eb8597a8cd59fd924b6d7c285b8969a1e0007e2cb652cab62376270f", size = 1252619, upload-time = "2026-06-30T20:02:16.219Z" }, - { url = "https://files.pythonhosted.org/packages/0f/a7/fa31d52dd4102cede29fb9634e98d214129b2783b4f95528c6dc6a8f6587/ast_serialize-0.6.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:577a6c189068686869f5f1ddc38363f3ae1808a4753b577266f9202071a7bb66", size = 1242983, upload-time = "2026-06-30T20:02:17.813Z" }, - { url = "https://files.pythonhosted.org/packages/b1/20/ddf742b5ad3c4bafd3466f2265037cfd99bc1b9a5ee46a5d58c90d523242/ast_serialize-0.6.0-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:085de7f62dc9cc247eb01e965a362707d1d90b1d89a82c5bf78301a60a3c417b", size = 1296148, upload-time = "2026-06-30T20:02:19.146Z" }, - { url = "https://files.pythonhosted.org/packages/24/cb/9f6f217cce8b3b632c5568b478d195a35e79dce4dbe309438cb89ba6ea4f/ast_serialize-0.6.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:9f8a8b78b13173de6a9ec22111d9be674874cd5bdccda04f14ae5ebc2bef403a", size = 1403826, upload-time = "2026-06-30T20:02:20.696Z" }, - { url = "https://files.pythonhosted.org/packages/2d/f8/9d16d4f0107a183924425cc0e7618d8bf76f96b45afa9ff19f924ed1ad57/ast_serialize-0.6.0-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:f2ff3baffc3a29c1f15bc9098aa0c09763410262d5e6cef42116f7356c184554", size = 1502943, upload-time = "2026-06-30T20:02:22.034Z" }, - { url = "https://files.pythonhosted.org/packages/80/dd/bbc1c38756350dddf7e24acae1c9482ef42051c267417e019aecc1ed4075/ast_serialize-0.6.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:0067b25fce104eaae5b88383de9ab803faeb671831e14ca698b771b356e2600f", size = 1497632, upload-time = "2026-06-30T20:02:23.517Z" }, - { url = "https://files.pythonhosted.org/packages/42/7e/9daffefcf5b97e6bb4c3e0b3c024c1aee9722f23d3cf7cd2ff80d6fb4a40/ast_serialize-0.6.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:c617417f9cbb0cb144f6283c3cbe0d2e0f01beaf9f608f662b21191058a626ec", size = 1448858, upload-time = "2026-06-30T20:02:24.889Z" }, - { url = "https://files.pythonhosted.org/packages/e5/1f/f9baaab81a677ea0af7d2458cac2f94ebcc85958f8a3c15ba9d9e5dab653/ast_serialize-0.6.0-cp314-cp314t-win32.whl", hash = "sha256:5337cb256dcea3df9288205213d1601581536526b8f4da44b6974f1180f3252a", size = 1052600, upload-time = "2026-06-30T20:02:26.263Z" }, - { url = "https://files.pythonhosted.org/packages/9e/1f/41b535866519512d8cf6669cb2cff7823b7672bb6279c0333b4ff89d7d9f/ast_serialize-0.6.0-cp314-cp314t-win_amd64.whl", hash = "sha256:2d947e45cafc4b09bd7528917fa84c517654a43de173c79785574b7b3068ac24", size = 1095570, upload-time = "2026-06-30T20:02:27.639Z" }, - { url = "https://files.pythonhosted.org/packages/50/64/e472fe3e3a2d33d874b987e8518aedf24562919e3b6161a4fa1797e89c0f/ast_serialize-0.6.0-cp314-cp314t-win_arm64.whl", hash = "sha256:6e15ec740436e1a0d62de848641abe5f3a2f89a7f94907d534795ac91bbacf14", size = 1067267, upload-time = "2026-06-30T20:02:28.949Z" }, - { url = "https://files.pythonhosted.org/packages/52/19/ac8348ae8711c9b5ae834634f635780cab62a0f5e6f988882e048b89c2ae/ast_serialize-0.6.0-cp39-abi3-macosx_10_12_x86_64.whl", hash = "sha256:093cb8bb91b720d8523580498d031791bb1bbaa048599c3d21085d380e11a596", size = 1185367, upload-time = "2026-06-30T20:02:30.427Z" }, - { url = "https://files.pythonhosted.org/packages/c1/f6/ec7ec652c51db77c2f61d8573338e13e4704303265ccc658cb4031d9f354/ast_serialize-0.6.0-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:e61580a69faf47e3689795367ed211f2a10fd741478cc0f36a0f128793360aad", size = 1178657, upload-time = "2026-06-30T20:02:31.964Z" }, - { url = "https://files.pythonhosted.org/packages/6f/02/613a7534a41d0122f37d1e0c64aa8ac78bfb831f8c92f6db057a311abb3c/ast_serialize-0.6.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:305802f2ce2a7c4e87835078ea85c58b586ddda8095b92fe2ead9364ae19c80a", size = 1238620, upload-time = "2026-06-30T20:02:33.664Z" }, - { url = "https://files.pythonhosted.org/packages/4d/21/087957bba486242afc52f49b2d9e21c9dad00289356cf9efe67084015a9d/ast_serialize-0.6.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c7b8b8f0c42f752ea00b2b7d7c090b3f80d9c1c5c75cadf16423790a0cc74081", size = 1236075, upload-time = "2026-06-30T20:02:34.936Z" }, - { url = "https://files.pythonhosted.org/packages/82/04/78128bbb170071c2c72a210a181f1c00e11cc1cec60a8beef747b07f9201/ast_serialize-0.6.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cd5b91b9e6f2356ace3a556963b0cd783b395fbbb0bb17b4defc283415466e77", size = 1441348, upload-time = "2026-06-30T20:02:36.245Z" }, - { url = "https://files.pythonhosted.org/packages/64/64/62fb99d6faf199b4c3e5b08a07136e9a0d7664bb249c6de3670e5b63e9b6/ast_serialize-0.6.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4d6ef91590258ada18909b9caea344dac4de2013906b035473cd674a43f4b790", size = 1258580, upload-time = "2026-06-30T20:02:37.53Z" }, - { url = "https://files.pythonhosted.org/packages/ca/87/b4d6c38e0ccd5e85dc54cecdf933a152c60b28fe5d993a6d8a72fa6d5896/ast_serialize-0.6.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dcbed41e9386059fc0261d602445ede0976c2ecec2939688bcbcb9ed0b6f28b7", size = 1261693, upload-time = "2026-06-30T20:02:39.123Z" }, - { url = "https://files.pythonhosted.org/packages/0e/4b/3676ca2191f39bafb75f93f99b2f429ec464586158fece2165f3572805dc/ast_serialize-0.6.0-cp39-abi3-manylinux_2_31_riscv64.whl", hash = "sha256:cdc4e6f930b9090c2f92c9036ad12ffb8e6e44d4a5ba06f1458a05d60f203f7b", size = 1252517, upload-time = "2026-06-30T20:02:40.511Z" }, - { url = "https://files.pythonhosted.org/packages/f3/58/494ef8c4b4acb2f4a265ac934caf45f792a08fe27d6b853de35ad991941a/ast_serialize-0.6.0-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:897ac47b5637be41c0c07061c8a912fafa967ef1dc73fa115e4bfa70882a093b", size = 1304843, upload-time = "2026-06-30T20:02:41.961Z" }, - { url = "https://files.pythonhosted.org/packages/b1/f2/13736d920ab3d49bbee80ef1a277dd7b7aaf3b3545efd9d2a8114fe05525/ast_serialize-0.6.0-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:c4af9a1386166e40ed01464991806f89038a2d89782576c7774876fa77034e32", size = 1413698, upload-time = "2026-06-30T20:02:44.179Z" }, - { url = "https://files.pythonhosted.org/packages/a8/5a/e046f3899e2acba4677d7427b76431443a1aa1a0e583dfb05b55b69d55cf/ast_serialize-0.6.0-cp39-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:c901adbd750029b9ac4ad3d6aa56853e0ad4875119fbf52b7b8298afc223828b", size = 1512209, upload-time = "2026-06-30T20:02:45.584Z" }, - { url = "https://files.pythonhosted.org/packages/cc/c7/e42aaca7bb2d22a7c06d5a8c7930086c5a334e93d716e6fa5e6647a4515f/ast_serialize-0.6.0-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:3ae22a366b752ab4496191525b78b097b5b72d531752e3c1dd7e383a8f2c8a1a", size = 1508464, upload-time = "2026-06-30T20:02:46.942Z" }, - { url = "https://files.pythonhosted.org/packages/95/93/5524a3dc6c3f593de3228ed9cbef73afa047625b7000ec21b7f58e6eb4d4/ast_serialize-0.6.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:4ed29121da8b3fdc291002801a1de0f76248fa07dce89157a5f277842cf6126e", size = 1457164, upload-time = "2026-06-30T20:02:48.294Z" }, - { url = "https://files.pythonhosted.org/packages/4f/c0/36a6ffb4d653cf621427b4c4928671f53ad800c453474de2b82564a44ad9/ast_serialize-0.6.0-cp39-abi3-pyemscripten_2026_0_wasm32.whl", hash = "sha256:b1dac4e09d341c1300ba69cdcbe62867b32a8c75d90db9bf4d083bec3b039f0b", size = 863014, upload-time = "2026-06-30T20:02:49.742Z" }, - { url = "https://files.pythonhosted.org/packages/09/c7/7d5ad8b49e1278e1c2a1e0274bd7850560b3f09313aa00c13bc8d5544792/ast_serialize-0.6.0-cp39-abi3-win32.whl", hash = "sha256:82c312a7844d2fdeb4d5c48bd3d215bf940dafd4704e1a9bcf252a99010a99b1", size = 1063165, upload-time = "2026-06-30T20:02:50.98Z" }, - { url = "https://files.pythonhosted.org/packages/47/ae/6710c14ecb276031cf10249f6adf5a59e2d3fdb3b5183bd59f70524067ee/ast_serialize-0.6.0-cp39-abi3-win_amd64.whl", hash = "sha256:113b58346f9ceb664352032770caca817d4a3c86f611c6088e6ef65ddaa70f0e", size = 1101444, upload-time = "2026-06-30T20:02:52.554Z" }, - { url = "https://files.pythonhosted.org/packages/66/40/c53deb2cd0c9b0fb636d24d9f40924cf2e65028e6b20b10cd5c1eeb2c730/ast_serialize-0.6.0-cp39-abi3-win_arm64.whl", hash = "sha256:ccd132fe8db56f61fe743b1f644d01b8d65b83248a8da506f3132bda86d6ed5e", size = 1072965, upload-time = "2026-06-30T20:02:54.097Z" }, + { url = "https://files.pythonhosted.org/packages/34/16/6e520b57cd8c75914b38c670ad4593d13c22911e4306cc7165dab8b0789b/ast_serialize-0.8.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:3d822605fa7bb326ef868d25fafced7fc660fa46d9b90c02ea86d5e2f5d325f7", size = 863924, upload-time = "2026-08-07T11:27:34.579Z" }, + { url = "https://files.pythonhosted.org/packages/03/e1/48802de9b22a2bcad42ec80601a17e3f69172fe4f590e6311bcc2b323aeb/ast_serialize-0.8.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:2efa40b068197d5efb62655b43baadb842ed71c4958cccd3e8b86a35726f0119", size = 1177662, upload-time = "2026-08-07T11:27:36.196Z" }, + { url = "https://files.pythonhosted.org/packages/38/d4/323438db76bded3a1f3523a3167b8325916b2ddceb2107a330c6ec9fcf4d/ast_serialize-0.8.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:db1b957291bca08c7e72f43a12357b2948e20775d970e3fc3dac0aa3160ab725", size = 1167072, upload-time = "2026-08-07T11:27:37.646Z" }, + { url = "https://files.pythonhosted.org/packages/77/82/53c5400b54144b56de8ed7f957fd1ccd97e42482009292ab46121d15f8dd/ast_serialize-0.8.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fdc0d5b18ff8fb364e87923e47c0a91d0d69dbcaeaa274591f7fd26892cc3a3a", size = 1225497, upload-time = "2026-08-07T11:27:39.225Z" }, + { url = "https://files.pythonhosted.org/packages/44/5f/36c07327a8b91303fbf1382c7c3e8a2902072dbe1b9546138a5288e75ff0/ast_serialize-0.8.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9da7330f3e235bf7da89b8d39205c6350fc0c08a85379743f2df9fff87d6d980", size = 1227101, upload-time = "2026-08-07T11:27:40.799Z" }, + { url = "https://files.pythonhosted.org/packages/9d/48/5adf5c67addc7ddb328122208c6d375a84cf154984f412b4087330a157bd/ast_serialize-0.8.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f3186969ee66a9863b00acc6523ace44c56974eecb348a7ea4b228d9f0b80e19", size = 1424001, upload-time = "2026-08-07T11:27:42.708Z" }, + { url = "https://files.pythonhosted.org/packages/38/a1/70074dd3869d2b0e934f91891d8d6b734361cd3b80f85ca7ece2e668ecdd/ast_serialize-0.8.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:40a57b73731be45da4fa41430c4d5dc94a24b3a4faba7b9e069978c0402064ea", size = 1245545, upload-time = "2026-08-07T11:27:44.4Z" }, + { url = "https://files.pythonhosted.org/packages/e3/be/53b9c0a8a6399950c2e3546bdfab96d2b299d5b114b47eb94fd3c49c4054/ast_serialize-0.8.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5075b9da3ef807eda752502446dfecea3b381c4900b7e27a5d5f4f899eb39951", size = 1248961, upload-time = "2026-08-07T11:27:45.781Z" }, + { url = "https://files.pythonhosted.org/packages/eb/13/3651d3812548a2bda15e26e5dd51aadb48cf682d0865370255fcf0e367dd/ast_serialize-0.8.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:293cc1c5bfa741f8e3fbe8175b9c07beee487c9a6fdbb25a5acad9f1df2d30a9", size = 1243877, upload-time = "2026-08-07T11:27:47.325Z" }, + { url = "https://files.pythonhosted.org/packages/21/a0/521f0bf000f675e9312a4aae2c8ba7a992405d072a85c485e08fd59433b9/ast_serialize-0.8.0-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e0910c3442a75216dde0f102d854ba2aaa71d2482e0ee213630b9bf29584fba3", size = 1293903, upload-time = "2026-08-07T11:27:49.264Z" }, + { url = "https://files.pythonhosted.org/packages/b1/7e/402fc902568aa2ee65865a3e151f000db0153da8ce6b1be4c9c349025f8d/ast_serialize-0.8.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:43dd6d596879bb1cb8a12cc9dae7bb10090a39a35883026c24f82488a195619a", size = 1401070, upload-time = "2026-08-07T11:27:50.947Z" }, + { url = "https://files.pythonhosted.org/packages/ff/7c/97d4b66c057f1706fc8be6dd532cc77c988794357c8f4ffdb6adabb39562/ast_serialize-0.8.0-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:8c9d537f59e936392cfd3597789d1390304dd659efc3c486ce7f40fb6b8a9f53", size = 1502602, upload-time = "2026-08-07T11:27:52.364Z" }, + { url = "https://files.pythonhosted.org/packages/89/6f/72cc3b71562001bba46e898ccfbf1844f7939b3e28912736206102f2e5a8/ast_serialize-0.8.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:f0190a33d7f97c65e9069f7a7f40499eea6b5cbe260c558378109caf20ce934b", size = 1495848, upload-time = "2026-08-07T11:27:53.803Z" }, + { url = "https://files.pythonhosted.org/packages/a0/53/d6f629d1e49308b2f363dae028baa213ec222c9106fa1f7f0d1f7b41499a/ast_serialize-0.8.0-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:77308ae6c5cf5264cc0f01a7c556ec77a9e68eb1f61b093534d698139fdc3b14", size = 1556556, upload-time = "2026-08-07T11:27:55.342Z" }, + { url = "https://files.pythonhosted.org/packages/ee/22/340f35dd8dfc6d412d53dc20699ca014b8d228db923e8ed4759c512b162c/ast_serialize-0.8.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:8d53a23f27e1ed3a36b2d26fd2a1a6228c8e85a1ed62ff7cdb44bd610769f20a", size = 1417822, upload-time = "2026-08-07T11:27:56.712Z" }, + { url = "https://files.pythonhosted.org/packages/11/29/6dde5c13fbebc051d3a6df4ec0a6fd1d5359333cc1193f7f609f3410b4d8/ast_serialize-0.8.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:ffa5e7cb08f96fed9121f77b224151e41caf88feab9d652bb46c78202b6fbeda", size = 1445153, upload-time = "2026-08-07T11:27:58.275Z" }, + { url = "https://files.pythonhosted.org/packages/62/c5/f473a8ed030f7a0ca24b9849cca184677a50c053867a7b808c2e1289bbd3/ast_serialize-0.8.0-cp314-cp314t-win32.whl", hash = "sha256:fa70ed4dea0bb18b30a1789c77baa701d0ef30c474f2ccabdea61e25623a8827", size = 1063711, upload-time = "2026-08-07T11:27:59.793Z" }, + { url = "https://files.pythonhosted.org/packages/23/63/39e171fcd38ca057c2e1979d5ee81ac7a3502784abe3d83df7454f7a0978/ast_serialize-0.8.0-cp314-cp314t-win_amd64.whl", hash = "sha256:d8b3c8eee4c1baef9d4e84d2a59a805501617127be42615cb48970b15b0892b6", size = 1103740, upload-time = "2026-08-07T11:28:01.405Z" }, + { url = "https://files.pythonhosted.org/packages/21/1c/d00762b399e7726d68d0a088cc946e3a4c60f1c6176f557608f672f627f3/ast_serialize-0.8.0-cp314-cp314t-win_arm64.whl", hash = "sha256:ac4f0a83c55a9b782f79ad55a5247b7db123c1db405959791c2ef886e9710c9f", size = 1076021, upload-time = "2026-08-07T11:28:02.947Z" }, + { url = "https://files.pythonhosted.org/packages/4c/11/911210c3c78923273a9211a2b6cfc4c8aa723b30dab3e1c8d19afb983b40/ast_serialize-0.8.0-cp315-abi3.abi3t-macosx_10_12_x86_64.whl", hash = "sha256:86b8a1e6d90467345356098b040150e82fbc26d24a7a202224b13dc1f6264ca0", size = 1177715, upload-time = "2026-08-07T11:28:04.654Z" }, + { url = "https://files.pythonhosted.org/packages/77/89/6282881c8587606638db153cbe21e1e0c4d1f3970dee1aa0610a1c62a026/ast_serialize-0.8.0-cp315-abi3.abi3t-macosx_11_0_arm64.whl", hash = "sha256:39e92ff8e8cb45947fe9007174b2950e1fb098e6abd00266a13cd3bcf6675068", size = 1169347, upload-time = "2026-08-07T11:28:06.1Z" }, + { url = "https://files.pythonhosted.org/packages/97/78/a9f846a03a340ff3728c915f23338ca742742f3292700559cdb3ad999b1e/ast_serialize-0.8.0-cp315-abi3.abi3t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c85d8d18db5b2dfcb3b7e38a4d600ca35504c0ed8a6f75cd1c811e4ffe248a15", size = 1225916, upload-time = "2026-08-07T11:28:07.654Z" }, + { url = "https://files.pythonhosted.org/packages/c0/15/aba6ef8a988a6eceb6f0359589aac509e29ae2dba67fd9bfd5af0c3f13e7/ast_serialize-0.8.0-cp315-abi3.abi3t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9830ff7e764f74d9eefb01170c61a9f0fd2c027dac5fcb72e064decd57d56371", size = 1227135, upload-time = "2026-08-07T11:28:09.504Z" }, + { url = "https://files.pythonhosted.org/packages/94/29/3f63d696ea7c5b8abadcecc3505be51bd900daaccc522ed8322fa5b05a93/ast_serialize-0.8.0-cp315-abi3.abi3t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6479d9722a4cd21b578f5478074c41e6169f04811996ec881655560f703a5bba", size = 1425040, upload-time = "2026-08-07T11:28:11.044Z" }, + { url = "https://files.pythonhosted.org/packages/e2/5d/0aac338604ff59df5774d4304307898982252f325ff7cafe31d52fedcb65/ast_serialize-0.8.0-cp315-abi3.abi3t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a63bed264e818cd83eec11feed0f50aa162542b91132ef58afebc857182763a5", size = 1246278, upload-time = "2026-08-07T11:28:12.519Z" }, + { url = "https://files.pythonhosted.org/packages/23/ca/9f1ef795bb724719532bd86dbec11e5b66857d3fbe9b6772baec0191a6ed/ast_serialize-0.8.0-cp315-abi3.abi3t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d187197d234aa45d6cfa2b096be5f666e8cc2e7eb3722d0ab8926293cf5720c", size = 1250029, upload-time = "2026-08-07T11:28:13.896Z" }, + { url = "https://files.pythonhosted.org/packages/dc/25/5e061372d2ed953b9ba3b9c4f73de3b8e9234cda3f6c088db4686801d0e1/ast_serialize-0.8.0-cp315-abi3.abi3t-manylinux_2_31_riscv64.whl", hash = "sha256:2d39a56282cfcc0d8eeea37267c754be59c98d48505c23b1dae5c6011f3813dd", size = 1243575, upload-time = "2026-08-07T11:28:15.37Z" }, + { url = "https://files.pythonhosted.org/packages/a8/c1/ae7da218053120635a4ca802366c69f707203641af95372eeb83f70dfd52/ast_serialize-0.8.0-cp315-abi3.abi3t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f7cc5f10386994c0f4844f1e6d6a97127e9b478660eb6dec2b257644f0acab64", size = 1294396, upload-time = "2026-08-07T11:28:16.813Z" }, + { url = "https://files.pythonhosted.org/packages/2e/89/271d1f49c5269fcddcc789ea3f25be401f6723fc1138aeda539f4d05516d/ast_serialize-0.8.0-cp315-abi3.abi3t-musllinux_1_2_aarch64.whl", hash = "sha256:6102f2f985c2e542be85cd857678ec9356fefa792b93cadfadd31139f5696f27", size = 1401987, upload-time = "2026-08-07T11:28:18.333Z" }, + { url = "https://files.pythonhosted.org/packages/55/be/4e7d77fcf571ac7cb5cf7115a20c36642bd7d29473b45dfaaefeb9618f90/ast_serialize-0.8.0-cp315-abi3.abi3t-musllinux_1_2_armv7l.whl", hash = "sha256:3a8660fe66667b76a6e9dccd1d33e66b229fde3b308db991c041609226c005b6", size = 1502904, upload-time = "2026-08-07T11:28:20.039Z" }, + { url = "https://files.pythonhosted.org/packages/8b/ae/ed1de2db7e019d4236fbc164ffa5ef9a6022a300a342bbf142d21b7c141e/ast_serialize-0.8.0-cp315-abi3.abi3t-musllinux_1_2_i686.whl", hash = "sha256:e7266307e5fba39836edb79def8608887af48820508bff3c5f2941e1e04d1534", size = 1496967, upload-time = "2026-08-07T11:28:21.734Z" }, + { url = "https://files.pythonhosted.org/packages/92/89/5fea507fae5c5f18b7dc7f95e5c00956574b8c717b8fd2049c504fab0b18/ast_serialize-0.8.0-cp315-abi3.abi3t-musllinux_1_2_ppc64le.whl", hash = "sha256:4ca7e6fd1ad845d1cc649dc2ecd499db2f8f46af5bf8da7b70dd858774cc038b", size = 1559041, upload-time = "2026-08-07T11:28:23.194Z" }, + { url = "https://files.pythonhosted.org/packages/42/71/478d69df21b64e064554a68134c94be304270316ca676a94e63c389a636a/ast_serialize-0.8.0-cp315-abi3.abi3t-musllinux_1_2_riscv64.whl", hash = "sha256:2880350b13d3eae69a0d70bc1fb6c9bfaca4dbd0e20ba8cd1aa483080b56ff06", size = 1417367, upload-time = "2026-08-07T11:28:24.601Z" }, + { url = "https://files.pythonhosted.org/packages/5e/2d/8962dc8d5b3a9dc27b36f9db199afa25264c741505469d9ec10ffbfd2ba7/ast_serialize-0.8.0-cp315-abi3.abi3t-musllinux_1_2_x86_64.whl", hash = "sha256:ab0f9a59f7d63d0d441b56b9a818b273705264352d5115cfee12e940e816d958", size = 1446178, upload-time = "2026-08-07T11:28:26.152Z" }, + { url = "https://files.pythonhosted.org/packages/4f/22/14d2ad4fd1d1bcd0dc687ca268e0630069f45162496260c0efb70ee0ea72/ast_serialize-0.8.0-cp315-abi3.abi3t-win32.whl", hash = "sha256:0485a25ef519c62e749ee3c1ad8070e591b380d67226349eb5a70b228dc1ac4a", size = 1063811, upload-time = "2026-08-07T11:28:27.864Z" }, + { url = "https://files.pythonhosted.org/packages/18/1d/84a327c0202a41aa5fdba3ade33904d6d8f3b9e6806fa83568d835395850/ast_serialize-0.8.0-cp315-abi3.abi3t-win_amd64.whl", hash = "sha256:bd84d60bca7079e741be4ac5dbe237751a59d7f6f9f0126b11880d63822cbe16", size = 1105518, upload-time = "2026-08-07T11:28:29.691Z" }, + { url = "https://files.pythonhosted.org/packages/8c/92/74556dec52fde85a2ad84ed159991b916241043788609c15d8b77e14570b/ast_serialize-0.8.0-cp315-abi3.abi3t-win_arm64.whl", hash = "sha256:057769b5921336eb2d9124f2a731b42ed05ffdac559b840dbdf6f3937cf153dc", size = 1076319, upload-time = "2026-08-07T11:28:31.282Z" }, + { url = "https://files.pythonhosted.org/packages/d1/5d/c650b1f2cc1e75193358da95a080261422e8cd10b66d7370b1688c9915c5/ast_serialize-0.8.0-cp315-cp315-pyemscripten_2026_5_wasm32.whl", hash = "sha256:a02cbed7d8bfdcdee88edaac12bd50d53d9953aaa2e1852ef078625be5f1c0b5", size = 852914, upload-time = "2026-08-07T11:28:32.929Z" }, + { url = "https://files.pythonhosted.org/packages/d9/e3/6142e920fec6ef7bccabd8c24ed8ed99f8bdc6cb8b065e1df7c6a3b2d667/ast_serialize-0.8.0-cp39-abi3-macosx_10_12_x86_64.whl", hash = "sha256:e1bd223df0f6c96b396975fa604cb33bce53d9b4a0185490be4c4a289f7c9c87", size = 1184007, upload-time = "2026-08-07T11:28:34.654Z" }, + { url = "https://files.pythonhosted.org/packages/a6/e9/6e8be8df02b35d85e2b8809f7f1cfa290bdf5882b55127a539d049482db0/ast_serialize-0.8.0-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:ddd3b61f45c132da66c5476b281891e08c1fd87fbdabe8a6973e1622efc85f06", size = 1177588, upload-time = "2026-08-07T11:28:36.318Z" }, + { url = "https://files.pythonhosted.org/packages/8c/80/7e0fd2e2e2aba257820db4a8657c4c356844d36b914b20a4af294bcfb902/ast_serialize-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f9caa63fad8241257ae401b5ff0a64026c6adb36b8e86cbe8782d9ea505daf6", size = 1234575, upload-time = "2026-08-07T11:28:37.772Z" }, + { url = "https://files.pythonhosted.org/packages/b0/6a/3bae0af06f9b1bae3001c44d64215f5b567877e7aae9ffd45db11c3a7647/ast_serialize-0.8.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3926fa117b5e65019853a2969966d11c7175af377a3425991f3fe73784412405", size = 1236015, upload-time = "2026-08-07T11:28:39.14Z" }, + { url = "https://files.pythonhosted.org/packages/6f/c4/ce2d41a1bc22508e82618901f7e10f2a5e2f9556553fea90624daf9875e2/ast_serialize-0.8.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:485f1113af805e9e170b95ef993ca3fbd4f89c04bab25c58b4fc632d854801ab", size = 1432808, upload-time = "2026-08-07T11:28:40.664Z" }, + { url = "https://files.pythonhosted.org/packages/1a/90/f5058f209756dd70e958b7538aaa82d25d24944baf9ec8ae6f27b06fcacc/ast_serialize-0.8.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3ccebbed24f1281062d5852353c72c47502955926cfcb8345ffb3a44d87ff3d3", size = 1256251, upload-time = "2026-08-07T11:28:42.223Z" }, + { url = "https://files.pythonhosted.org/packages/bf/32/7f77ea87fa0836daab706ed5cb7f903bb25fa26a77439011aee626af11d8/ast_serialize-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:252f883290d1cdb728eb7fe1d9a7221b88af5a329aae0bc91ddee4dafb820331", size = 1258574, upload-time = "2026-08-07T11:28:43.751Z" }, + { url = "https://files.pythonhosted.org/packages/eb/5a/75b82ad2725b5e8e8c742732f9e76c6738a292d0709e1f60d10a973730b4/ast_serialize-0.8.0-cp39-abi3-manylinux_2_31_riscv64.whl", hash = "sha256:96abc072ad29db8d02194afd47d68987322622787daceae82398d7b69f3ba2e6", size = 1254075, upload-time = "2026-08-07T11:28:45.28Z" }, + { url = "https://files.pythonhosted.org/packages/4e/54/8c20ed4eea805516a3fd23dd4a721ce28c64f50f0e4b359969f60a8c97a6/ast_serialize-0.8.0-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9118ad3e369727060b2696fc4078f250ecffca4248ba87f537f55cea9f9dce06", size = 1301018, upload-time = "2026-08-07T11:28:46.851Z" }, + { url = "https://files.pythonhosted.org/packages/cb/5b/9f14430f12fe830b656fb38f8e2e05ee13b02a88967660bef46af0ab22a8/ast_serialize-0.8.0-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:f359df4bd921918af8bebd142a376c77511d7151cc8ba852760b587b5a4a54f3", size = 1409951, upload-time = "2026-08-07T11:28:48.312Z" }, + { url = "https://files.pythonhosted.org/packages/2d/3d/084882eca93c842bd4262591a071ec7f825340644035e51501208cc5a8d4/ast_serialize-0.8.0-cp39-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:e94f9121d13fa36cbf21314783c77d05ae3a0868decd18cf5233fdcc6de49ac8", size = 1509544, upload-time = "2026-08-07T11:28:49.847Z" }, + { url = "https://files.pythonhosted.org/packages/ce/73/ea84852096c2036c61cc0b2f97b90242207419f534dc671060ee1c8e05cb/ast_serialize-0.8.0-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:54f95b486018d262bcb387a9afd96f0da74508b442762b80c769454a6fbb3ee3", size = 1505671, upload-time = "2026-08-07T11:28:51.239Z" }, + { url = "https://files.pythonhosted.org/packages/cb/88/287b9a5300c1f2f651d259f670931b63110adc265b7613c885b44c5bc53d/ast_serialize-0.8.0-cp39-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:4c38b915511e32bc718c49dbce98ff9af36bac0ad6a604f58000cd5e3aecdba7", size = 1563685, upload-time = "2026-08-07T11:28:53.112Z" }, + { url = "https://files.pythonhosted.org/packages/ee/f3/1bc3a79afcf0c2a8d2c37182d0d659d1545a9d7f7f6dc9cf3e63d6c17135/ast_serialize-0.8.0-cp39-abi3-musllinux_1_2_riscv64.whl", hash = "sha256:9a2ef9cf12f2de4f1028c42c1dd7d775255e0fb3e5bb48896c97e35ef52366fe", size = 1427977, upload-time = "2026-08-07T11:28:54.418Z" }, + { url = "https://files.pythonhosted.org/packages/5c/cd/440c798957e14e31776bfeb024d8fafe0bb1d5b89c51c2f067e69938f7b0/ast_serialize-0.8.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:6f18048fe9f6dd266bd577cdec48bdcecb74faaa01fe941324435483b013ed2a", size = 1454335, upload-time = "2026-08-07T11:28:55.968Z" }, + { url = "https://files.pythonhosted.org/packages/4f/4a/587eb36dcc240a54c8660f599464516b469ecad96f0dbdb6bccbedb50745/ast_serialize-0.8.0-cp39-abi3-win32.whl", hash = "sha256:31883542dd6c94d178f5db3d32fbd69c5eb88b3a7c018e7ac8cc0c45195ddbed", size = 1068858, upload-time = "2026-08-07T11:28:57.541Z" }, + { url = "https://files.pythonhosted.org/packages/5f/a4/3e887bbd92164e183cb6e412c6a3e9198ddd446d7fe405958293ef5ef49c/ast_serialize-0.8.0-cp39-abi3-win_amd64.whl", hash = "sha256:861794565b06337005c1447ef23103a3d5a627d08bdc827870d00d0b28ef5f51", size = 1111839, upload-time = "2026-08-07T11:28:59Z" }, + { url = "https://files.pythonhosted.org/packages/25/6c/b400476d3ceba681ab929787edc9554f6d88fcc69435eb681b00fc0457a5/ast_serialize-0.8.0-cp39-abi3-win_arm64.whl", hash = "sha256:b2a5978662fd4db463dfb4b974d2b10ac6430b98f5333aabc7051909df3561d0", size = 1083655, upload-time = "2026-08-07T11:29:00.349Z" }, ] [[package]] name = "attrs" -version = "25.4.0" +version = "26.1.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/6b/5c/685e6633917e101e5dcb62b9dd76946cbb57c26e133bae9e0cd36033c0a9/attrs-25.4.0.tar.gz", hash = "sha256:16d5969b87f0859ef33a48b35d55ac1be6e42ae49d5e853b597db70c35c57e11", size = 934251, upload-time = "2025-10-06T13:54:44.725Z" } +sdist = { url = "https://files.pythonhosted.org/packages/9a/8e/82a0fe20a541c03148528be8cac2408564a6c9a0cc7e9171802bc1d26985/attrs-26.1.0.tar.gz", hash = "sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32", size = 952055, upload-time = "2026-03-19T14:22:25.026Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/3a/2a/7cc015f5b9f5db42b7d48157e23356022889fc354a2813c15934b7cb5c0e/attrs-25.4.0-py3-none-any.whl", hash = "sha256:adcf7e2a1fb3b36ac48d97835bb6d8ade15b8dcce26aba8bf1d14847b57a3373", size = 67615, upload-time = "2025-10-06T13:54:43.17Z" }, + { url = "https://files.pythonhosted.org/packages/64/b4/17d4b0b2a2dc85a6df63d1157e028ed19f90d4cd97c36717afef2bc2f395/attrs-26.1.0-py3-none-any.whl", hash = "sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309", size = 67548, upload-time = "2026-03-19T14:22:23.645Z" }, ] [[package]] @@ -125,7 +175,7 @@ wheels = [ [[package]] name = "beads-mcp" -version = "1.2.2" +version = "1.3.0" source = { editable = "." } dependencies = [ { name = "fastmcp" }, @@ -164,16 +214,16 @@ dev = [ [[package]] name = "beartype" -version = "0.22.5" +version = "0.22.9" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/a6/09/9003e5662691056e0e8b2e6f57c799e71875fac0be0e785d8cb11557cd2a/beartype-0.22.5.tar.gz", hash = "sha256:516a9096cc77103c96153474fa35c3ebcd9d36bd2ec8d0e3a43307ced0fa6341", size = 1586256, upload-time = "2025-11-01T05:49:20.771Z" } +sdist = { url = "https://files.pythonhosted.org/packages/c7/94/1009e248bbfbab11397abca7193bea6626806be9a327d399810d523a07cb/beartype-0.22.9.tar.gz", hash = "sha256:8f82b54aa723a2848a56008d18875f91c1db02c32ef6a62319a002e3e25a975f", size = 1608866, upload-time = "2025-12-13T06:50:30.72Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/f7/f6/073d19f7b571c08327fbba3f8e011578da67ab62a11f98911274ff80653f/beartype-0.22.5-py3-none-any.whl", hash = "sha256:d9743dd7cd6d193696eaa1e025f8a70fb09761c154675679ff236e61952dfba0", size = 1321700, upload-time = "2025-11-01T05:49:18.436Z" }, + { url = "https://files.pythonhosted.org/packages/71/cc/18245721fa7747065ab478316c7fea7c74777d07f37ae60db2e84f8172e8/beartype-0.22.9-py3-none-any.whl", hash = "sha256:d16c9bbc61ea14637596c5f6fbff2ee99cbe3573e46a716401734ef50c3060c2", size = 1333658, upload-time = "2025-12-13T06:50:28.266Z" }, ] [[package]] name = "build" -version = "1.5.1" +version = "1.6.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "colorama", marker = "os_name == 'nt'" }, @@ -182,24 +232,28 @@ dependencies = [ { name = "pyproject-hooks" }, { name = "tomli", marker = "python_full_version < '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/2d/21/6ec54248b4d0d51f12f3ca4aa77a128077d747a5db86cb5a2fcd9aedecbd/build-1.5.1.tar.gz", hash = "sha256:94e17f1db803ab22f46049376c44c8437c52090f0dfdf1adc43df56542d644fb", size = 112439, upload-time = "2026-07-09T06:21:59.632Z" } +sdist = { url = "https://files.pythonhosted.org/packages/4d/b7/1db48a9ce2984842c8c886432ec8a2719613322e868a966ba82a28862f25/build-1.6.0.tar.gz", hash = "sha256:bd2c8afc603e7a2e0ce70e2ea85f0a6d02043bafbd307f5bada0f98669eca5af", size = 113825, upload-time = "2026-08-27T21:01:16.458Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/c7/f7/2c3f99ff9282f1c1ec9f6298f2c03034658a0901eeacb3b3501cb488574c/build-1.5.1-py3-none-any.whl", hash = "sha256:f1a58fe2e5af5b0238a07b9e70207492c79ddebbdb1ad954fc86d62a56be3e0d", size = 31195, upload-time = "2026-07-09T06:21:58.551Z" }, + { url = "https://files.pythonhosted.org/packages/ab/e5/aa1e81b21aea0ce0ba435311837a37d4cb936e7461f9fecac08580073ba9/build-1.6.0-py3-none-any.whl", hash = "sha256:f7aaf1ebbb79178a02ba248bb524f2176b256017e17e8e4bd4289c7b38cc2bad", size = 31187, upload-time = "2026-08-27T21:01:14.957Z" }, ] [[package]] name = "cachetools" -version = "6.2.1" +version = "7.1.7" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/cc/7e/b975b5814bd36faf009faebe22c1072a1fa1168db34d285ef0ba071ad78c/cachetools-6.2.1.tar.gz", hash = "sha256:3f391e4bd8f8bf0931169baf7456cc822705f4e2a31f840d218f445b9a854201", size = 31325, upload-time = "2025-10-12T14:55:30.139Z" } +sdist = { url = "https://files.pythonhosted.org/packages/70/d2/47e8bc06fe2a06d3f5bdf20f1126ab66c4e99dc48d940e7ba873f7ac7131/cachetools-7.1.7.tar.gz", hash = "sha256:a3e2a00b14d8f8a6b70c1dae7b4685e7ad3bc965c5b42124a2d6ce895da6cf50", size = 40680, upload-time = "2026-08-01T21:20:40.434Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/96/c5/1e741d26306c42e2bf6ab740b2202872727e0f606033c9dd713f8b93f5a8/cachetools-6.2.1-py3-none-any.whl", hash = "sha256:09868944b6dde876dfd44e1d47e18484541eaf12f26f29b7af91b26cc892d701", size = 11280, upload-time = "2025-10-12T14:55:28.382Z" }, + { url = "https://files.pythonhosted.org/packages/e4/d8/767faeda872075724b95dd675466a645f1b92aadcdcf2d1429dcfd76c176/cachetools-7.1.7-py3-none-any.whl", hash = "sha256:ef98ef375ad188819ef2f9b3645e3987f4b8c5b7550e436ad998c2de78296df0", size = 16830, upload-time = "2026-08-01T21:20:38.977Z" }, ] [[package]] name = "caio" version = "0.9.25" source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.11' and sys_platform == 'win32'", + "python_full_version < '3.11' and sys_platform != 'win32'", +] sdist = { url = "https://files.pythonhosted.org/packages/92/88/b8527e1b00c1811db339a1df8bd1ae49d146fcea9d6a5c40e3a80aaeb38d/caio-0.9.25.tar.gz", hash = "sha256:16498e7f81d1d0f5a4c0ad3f2540e65fe25691376e0a5bd367f558067113ed10", size = 26781, upload-time = "2025-12-26T15:21:36.501Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/6a/80/ea4ead0c5d52a9828692e7df20f0eafe8d26e671ce4883a0a146bb91049e/caio-0.9.25-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ca6c8ecda611478b6016cb94d23fd3eb7124852b985bdec7ecaad9f3116b9619", size = 36836, upload-time = "2025-12-26T15:22:04.662Z" }, @@ -226,195 +280,178 @@ wheels = [ ] [[package]] -name = "certifi" -version = "2025.10.5" +name = "caio" +version = "0.12.2" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/4c/5b/b6ce21586237c77ce67d01dc5507039d444b630dd76611bbca2d8e5dcd91/certifi-2025.10.5.tar.gz", hash = "sha256:47c09d31ccf2acf0be3f701ea53595ee7e0b8fa08801c6624be771df09ae7b43", size = 164519, upload-time = "2025-10-05T04:12:15.808Z" } +resolution-markers = [ + "python_full_version >= '3.15'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform != 'win32'", + "python_full_version >= '3.11' and python_full_version < '3.14' and sys_platform == 'win32'", + "python_full_version >= '3.11' and python_full_version < '3.14' and sys_platform != 'win32'", +] +sdist = { url = "https://files.pythonhosted.org/packages/75/c8/82b3c760141a1076408164b03e8789b51809add6aecd48aa9d7651cf6b59/caio-0.12.2.tar.gz", hash = "sha256:87a67c0dccc60e432888bd532ec504b66e124a5d8b391aab894583b55abd39ea", size = 80927, upload-time = "2026-08-04T14:43:33.726Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/e4/37/af0d2ef3967ac0d6113837b44a4f0bfe1328c2b9763bd5b1744520e5cfed/certifi-2025.10.5-py3-none-any.whl", hash = "sha256:0f212c2744a9bb6de0c56639a6f68afe01ecd92d91f14ae897c4fe7bbeeef0de", size = 163286, upload-time = "2025-10-05T04:12:14.03Z" }, + { url = "https://files.pythonhosted.org/packages/4c/db/2b780a0c859a0bc873683beb60d94215af5c082c76e11e632b4f122905a3/caio-0.12.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a294091062831970b702f10a7fb119c1b55a49db7b843deeb8939550531189ea", size = 77836, upload-time = "2026-08-04T14:42:49.581Z" }, + { url = "https://files.pythonhosted.org/packages/72/cc/bc8c1f81dc00d4232a2f842eca38df6c86281f012026416873ebaea2f592/caio-0.12.2-cp310-cp310-manylinux_2_34_aarch64.whl", hash = "sha256:af0c75b43f0cde52c758c000b797188e6d62579c4914173ca7afca382a47993d", size = 193718, upload-time = "2026-08-04T14:42:51.158Z" }, + { url = "https://files.pythonhosted.org/packages/9c/ce/a7429564d74c7ed1cd7ed8c490e8ae9211d38786ac113a8e8eecba97f7c6/caio-0.12.2-cp310-cp310-manylinux_2_34_x86_64.whl", hash = "sha256:c3922302878d17d6860ebe6b5e4dcc6821f7a9d162474a774b8534fedea80236", size = 190539, upload-time = "2026-08-04T14:42:52.521Z" }, + { url = "https://files.pythonhosted.org/packages/e0/43/43dc1bd7c961679267c2ca2c73fd5b732528bf719ba16d39cc1be0346a3c/caio-0.12.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:e97f960ab7c84aaa7520367bf597222db4229054bc7aae70344cb7da7b19b6f1", size = 191334, upload-time = "2026-08-04T14:42:54.067Z" }, + { url = "https://files.pythonhosted.org/packages/64/b2/0ea4998968112f1211b1c057f1bd606f40f3efdab640f5e49529d2438707/caio-0.12.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:a682783aef6eff8bc47cd5dd262081d7f746b8d3db1957c70a04017598a048d9", size = 190232, upload-time = "2026-08-04T14:42:55.551Z" }, + { url = "https://files.pythonhosted.org/packages/ba/e9/c346d656b2f3626ef726aaac1c5ea58a981757cbed62087a9e81eaa4b09f/caio-0.12.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:a2a7f0fa3b49f219f09705717c73a618eecbb3d697701e20abb4771d17e2bbcf", size = 84555, upload-time = "2026-08-04T14:42:56.84Z" }, + { url = "https://files.pythonhosted.org/packages/84/60/0b99da0d1345c0c1f9bde58ae96527b54b4aae32c2b6e74dcef514f7fa9c/caio-0.12.2-cp311-cp311-manylinux_2_34_aarch64.whl", hash = "sha256:1b04358ef65bd03d9c34d7b028efb422593b07485da82d6c5439f8c5dea35668", size = 196508, upload-time = "2026-08-04T14:42:58.074Z" }, + { url = "https://files.pythonhosted.org/packages/92/7e/7eb5a9ab97cfa5500a2cff8444e16e183aab6473912ac37d8bf9de283337/caio-0.12.2-cp311-cp311-manylinux_2_34_x86_64.whl", hash = "sha256:e1253743841b0864bfd6827e496fea4591bb3999ec1c003e57de65370e2d9031", size = 192985, upload-time = "2026-08-04T14:42:59.404Z" }, + { url = "https://files.pythonhosted.org/packages/92/13/308773ae27f33bc141720ded63216c9a115f5838c1e341d2d37c2b051281/caio-0.12.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:bd94522714af3fd806093bdd10f3175f1c42c5ee72dda975b8b35b55c3400147", size = 194087, upload-time = "2026-08-04T14:43:00.645Z" }, + { url = "https://files.pythonhosted.org/packages/d5/8b/08814adc89f2c7612da9c2f17d962626bf59eb3b4dd715ea8198ccecb66c/caio-0.12.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:a857d06308dc4428b760f9430350b3847f4c62ad0e79e635215f7cc97f7adcc9", size = 192586, upload-time = "2026-08-04T14:43:02.388Z" }, + { url = "https://files.pythonhosted.org/packages/60/bc/b62bf048a6e11870291a24319ed027bdf658df9ba77d1ad762aa138e066b/caio-0.12.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:2097cc0d19fa95e8d55aad770597bb0f76e4f70ed48278c965aa7c5b0b8c3bf5", size = 84702, upload-time = "2026-08-04T14:43:03.946Z" }, + { url = "https://files.pythonhosted.org/packages/f7/be/b40d55d793afcfa5bcdb32ade9289d9588e14e3026c2c87522e303cc6e8c/caio-0.12.2-cp312-cp312-manylinux_2_34_aarch64.whl", hash = "sha256:2122dccbd1959b922543fc9f8a9d2af47bd5b59190d1ece2445d3d1b4d1be45f", size = 198292, upload-time = "2026-08-04T14:43:05.238Z" }, + { url = "https://files.pythonhosted.org/packages/f8/02/9bd2bca72bfa478337618eae88942c43c891ae225e11baeae275e5e5c6ab/caio-0.12.2-cp312-cp312-manylinux_2_34_x86_64.whl", hash = "sha256:107e56554c179749de9440e1b5e5a19813572eebf3166e9dc3e5228b16966beb", size = 196207, upload-time = "2026-08-04T14:43:06.494Z" }, + { url = "https://files.pythonhosted.org/packages/48/9b/65f95efdd68b50b7a9f2555c93d9edc7da7aa5ae5e153163c41cf6fd5cd9/caio-0.12.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:adc7785e61ff7cf372318f67ec65617eaa06975e20da177522665dca8be6ea5d", size = 195748, upload-time = "2026-08-04T14:43:07.893Z" }, + { url = "https://files.pythonhosted.org/packages/3c/16/6a5c010ca435a5184d11ca350874694ac19db249560126dc8df0f25791ce/caio-0.12.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:07942d3b5999127ecb96256c38d5dbf49ed2864c087ed2a80b783901d0aa3ba1", size = 195835, upload-time = "2026-08-04T14:43:09.19Z" }, + { url = "https://files.pythonhosted.org/packages/4f/9b/31f0b49a2542ffa2f9d6140267e2b568e722a1feeb05cfbffea97666c62b/caio-0.12.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:40ebea9ebe3a3a66ae85fa00d4112d163654a33c82dcf9b26a99f7d30de13317", size = 84656, upload-time = "2026-08-04T14:43:10.513Z" }, + { url = "https://files.pythonhosted.org/packages/99/bc/62568d688af9712a34fe3f958d7a98c53bb2017e263260cd5deae67a90e9/caio-0.12.2-cp313-cp313-manylinux_2_34_aarch64.whl", hash = "sha256:6003ec389a68d5ec8f089df82b2dc8915293dd630a4d11322d7e3455045981fd", size = 198443, upload-time = "2026-08-04T14:43:11.767Z" }, + { url = "https://files.pythonhosted.org/packages/a3/e4/5ed627860285612e5307f06c109913c5918c947fbc223b55599e484c64b0/caio-0.12.2-cp313-cp313-manylinux_2_34_x86_64.whl", hash = "sha256:eee9376d0e2af25b6defc5bce39f6efa90521c803aaf12eba931bd898a397cfc", size = 196356, upload-time = "2026-08-04T14:43:13.206Z" }, + { url = "https://files.pythonhosted.org/packages/81/e2/2a8cfc6ba3ef3f19e7c778e9fb6f98600f0971cca78bbdfc23a413a66349/caio-0.12.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:78e3ccafc98e009fcb00a97ad441585551e52c0ae7ecc50427a3ccd9b11502fd", size = 195893, upload-time = "2026-08-04T14:43:14.649Z" }, + { url = "https://files.pythonhosted.org/packages/d1/87/77c40fb2301d0b5bb27c2e79ae42fce718ed75396d5fe3e1c09d8e1400b1/caio-0.12.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f2355db8917f5a0f3638bf332fe0d87549c80e978fca01db84a8a14b9df56a05", size = 195969, upload-time = "2026-08-04T14:43:15.946Z" }, + { url = "https://files.pythonhosted.org/packages/5e/b5/0ceca97eb546fe6bbace3399c8b11dfc503efcc7509d708a7a3f09ab50e9/caio-0.12.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:8054cba5e7ee623bea34946e2b59eb7c7c2be8872d0a5d12215d6ff564938d5f", size = 78621, upload-time = "2026-08-04T14:43:17.316Z" }, + { url = "https://files.pythonhosted.org/packages/9f/43/54d01cf9b643ffd6678aedee5ad5d6e7a1063bd169a203bfb6fb471e6887/caio-0.12.2-cp314-cp314-macosx_26_0_arm64.whl", hash = "sha256:5d658212d585b8814b9caf766d8090acac05f01abfa2875d57fdc4a7e2af032e", size = 77834, upload-time = "2026-08-04T14:43:18.492Z" }, + { url = "https://files.pythonhosted.org/packages/90/00/a0ca7394a0c3a234811b0c38b39aa0db9373663981c1cf446e26e7a7c198/caio-0.12.2-cp314-cp314-manylinux_2_34_aarch64.whl", hash = "sha256:391a7cc1dbfc5885d7d54406c9a7a4ec19d514d526e67d240d32734eebde378e", size = 198993, upload-time = "2026-08-04T14:43:19.992Z" }, + { url = "https://files.pythonhosted.org/packages/f6/b2/f8f1a5e57c16c86825f1f0648e76f7760f84452a41efee0d04fa53ef3e2d/caio-0.12.2-cp314-cp314-manylinux_2_34_x86_64.whl", hash = "sha256:121f4de82e2a875aff468ef2af7491fbecfffe9e71b507f5073fe2a156bb78df", size = 196408, upload-time = "2026-08-04T14:43:21.3Z" }, + { url = "https://files.pythonhosted.org/packages/01/db/5d94d1d58ef6f0acb39ab1a802793413a8b1e17108c05cf98cb4dc9e4b22/caio-0.12.2-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:e0ba5f8c0dc7035c05817ca1399dd7d6121ea55c363a079c334a151a75094322", size = 196480, upload-time = "2026-08-04T14:43:22.812Z" }, + { url = "https://files.pythonhosted.org/packages/8c/2a/366adf468d7654b895e232eeaa80d147df2ba293f708bd9cef78b95f92d0/caio-0.12.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:0ad8d8f9f5ea47aee81aead563fe3aca5bb54c3fc21b62bd830eaf369eb04060", size = 196071, upload-time = "2026-08-04T14:43:24.187Z" }, + { url = "https://files.pythonhosted.org/packages/0b/b1/4c0c989d2a24b8f3ba2e13b9115a107d9413b36aab8b299674b66da21c75/caio-0.12.2-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:0b85f94819058a8f21c3dca26c5f006a0f003b8700483a326ec86d569d2bd1a3", size = 78627, upload-time = "2026-08-04T14:43:25.522Z" }, + { url = "https://files.pythonhosted.org/packages/0f/da/107cfe84199b9fb5a7317e1230d808944205fd91c7869641ac4e2ef5d603/caio-0.12.2-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:a60459e42c680068a2a5286f15f54ccd887af34ad9ed1be1f0a7747ad6bd8820", size = 220217, upload-time = "2026-08-04T14:43:26.823Z" }, + { url = "https://files.pythonhosted.org/packages/9f/1c/d6f03d3226519cd8f362081370326846348c442078e005753c57522a4190/caio-0.12.2-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:51bb86c0abce55d0b3467ba6671e95cd96356044e5abd58651ad0645cf37084b", size = 216293, upload-time = "2026-08-04T14:43:28.177Z" }, + { url = "https://files.pythonhosted.org/packages/43/a4/d53ed7e639b778b6f41a5e7c664b37f75830e38afa62dad62ec913674548/caio-0.12.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e33295963f5a4787355b8bfd754b4f0e7ac5d535138860748c1eb833ca10d620", size = 218220, upload-time = "2026-08-04T14:43:29.656Z" }, + { url = "https://files.pythonhosted.org/packages/f8/d6/c353fd1dda371262995bba1b2f9aa42cc6cf7fc82c0853238510aa655bb9/caio-0.12.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:15af6eb10d7705a92ee8143d8a4d89c2886ecb6b65ce1161d3dad1adb9b3cbec", size = 216106, upload-time = "2026-08-04T14:43:31.011Z" }, + { url = "https://files.pythonhosted.org/packages/61/8a/71b0144f783468ba9f1bbf8a2f8e45c7d85ae31ec192f10650aa46f31702/caio-0.12.2-py3-none-any.whl", hash = "sha256:5233e797c9fe2b541914b1bc2e2df82677e2206b537e44e252188f3c2cbb0ea9", size = 62548, upload-time = "2026-08-04T14:43:32.394Z" }, +] + +[[package]] +name = "certifi" +version = "2026.7.22" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a3/c2/24167ea9858356b47a87a50d39908bfdb72ceeefe0041586e704e5376b3a/certifi-2026.7.22.tar.gz", hash = "sha256:741e2c3b351ddf169a738da9f2c048608ff7f2c5cc02f1ebc6b118bb090d5d55", size = 138112, upload-time = "2026-07-22T03:35:12.644Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0b/a7/71ac2cff56fec219ed242bb11b8efb69fcc4bec75db06fb7bfe35de520e6/certifi-2026.7.22-py3-none-any.whl", hash = "sha256:62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775", size = 136983, upload-time = "2026-07-22T03:35:11.276Z" }, ] [[package]] name = "cffi" -version = "2.0.0" +version = "2.1.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "pycparser", marker = "implementation_name != 'PyPy'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/eb/56/b1ba7935a17738ae8453301356628e8147c79dbb825bcbc73dc7401f9846/cffi-2.0.0.tar.gz", hash = "sha256:44d1b5909021139fe36001ae048dbdde8214afa20200eda0f64c068cac5d5529", size = 523588, upload-time = "2025-09-08T23:24:04.541Z" } +sdist = { url = "https://files.pythonhosted.org/packages/9e/ef/008a1939e372c06329a3fce4279c02f328488f3526744906eeec3da7ad5f/cffi-2.1.1.tar.gz", hash = "sha256:dd31f52ea1086513bb9df30f8fcee9b8918323ae067a3d5b78bc826a000712be", size = 530807, upload-time = "2026-08-03T21:21:18.939Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/93/d7/516d984057745a6cd96575eea814fe1edd6646ee6efd552fb7b0921dec83/cffi-2.0.0-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:0cf2d91ecc3fcc0625c2c530fe004f82c110405f101548512cce44322fa8ac44", size = 184283, upload-time = "2025-09-08T23:22:08.01Z" }, - { url = "https://files.pythonhosted.org/packages/9e/84/ad6a0b408daa859246f57c03efd28e5dd1b33c21737c2db84cae8c237aa5/cffi-2.0.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f73b96c41e3b2adedc34a7356e64c8eb96e03a3782b535e043a986276ce12a49", size = 180504, upload-time = "2025-09-08T23:22:10.637Z" }, - { url = "https://files.pythonhosted.org/packages/50/bd/b1a6362b80628111e6653c961f987faa55262b4002fcec42308cad1db680/cffi-2.0.0-cp310-cp310-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:53f77cbe57044e88bbd5ed26ac1d0514d2acf0591dd6bb02a3ae37f76811b80c", size = 208811, upload-time = "2025-09-08T23:22:12.267Z" }, - { url = "https://files.pythonhosted.org/packages/4f/27/6933a8b2562d7bd1fb595074cf99cc81fc3789f6a6c05cdabb46284a3188/cffi-2.0.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:3e837e369566884707ddaf85fc1744b47575005c0a229de3327f8f9a20f4efeb", size = 216402, upload-time = "2025-09-08T23:22:13.455Z" }, - { url = "https://files.pythonhosted.org/packages/05/eb/b86f2a2645b62adcfff53b0dd97e8dfafb5c8aa864bd0d9a2c2049a0d551/cffi-2.0.0-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:5eda85d6d1879e692d546a078b44251cdd08dd1cfb98dfb77b670c97cee49ea0", size = 203217, upload-time = "2025-09-08T23:22:14.596Z" }, - { url = "https://files.pythonhosted.org/packages/9f/e0/6cbe77a53acf5acc7c08cc186c9928864bd7c005f9efd0d126884858a5fe/cffi-2.0.0-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:9332088d75dc3241c702d852d4671613136d90fa6881da7d770a483fd05248b4", size = 203079, upload-time = "2025-09-08T23:22:15.769Z" }, - { url = "https://files.pythonhosted.org/packages/98/29/9b366e70e243eb3d14a5cb488dfd3a0b6b2f1fb001a203f653b93ccfac88/cffi-2.0.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:fc7de24befaeae77ba923797c7c87834c73648a05a4bde34b3b7e5588973a453", size = 216475, upload-time = "2025-09-08T23:22:17.427Z" }, - { url = "https://files.pythonhosted.org/packages/21/7a/13b24e70d2f90a322f2900c5d8e1f14fa7e2a6b3332b7309ba7b2ba51a5a/cffi-2.0.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:cf364028c016c03078a23b503f02058f1814320a56ad535686f90565636a9495", size = 218829, upload-time = "2025-09-08T23:22:19.069Z" }, - { url = "https://files.pythonhosted.org/packages/60/99/c9dc110974c59cc981b1f5b66e1d8af8af764e00f0293266824d9c4254bc/cffi-2.0.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e11e82b744887154b182fd3e7e8512418446501191994dbf9c9fc1f32cc8efd5", size = 211211, upload-time = "2025-09-08T23:22:20.588Z" }, - { url = "https://files.pythonhosted.org/packages/49/72/ff2d12dbf21aca1b32a40ed792ee6b40f6dc3a9cf1644bd7ef6e95e0ac5e/cffi-2.0.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:8ea985900c5c95ce9db1745f7933eeef5d314f0565b27625d9a10ec9881e1bfb", size = 218036, upload-time = "2025-09-08T23:22:22.143Z" }, - { url = "https://files.pythonhosted.org/packages/e2/cc/027d7fb82e58c48ea717149b03bcadcbdc293553edb283af792bd4bcbb3f/cffi-2.0.0-cp310-cp310-win32.whl", hash = "sha256:1f72fb8906754ac8a2cc3f9f5aaa298070652a0ffae577e0ea9bd480dc3c931a", size = 172184, upload-time = "2025-09-08T23:22:23.328Z" }, - { url = "https://files.pythonhosted.org/packages/33/fa/072dd15ae27fbb4e06b437eb6e944e75b068deb09e2a2826039e49ee2045/cffi-2.0.0-cp310-cp310-win_amd64.whl", hash = "sha256:b18a3ed7d5b3bd8d9ef7a8cb226502c6bf8308df1525e1cc676c3680e7176739", size = 182790, upload-time = "2025-09-08T23:22:24.752Z" }, - { url = "https://files.pythonhosted.org/packages/12/4a/3dfd5f7850cbf0d06dc84ba9aa00db766b52ca38d8b86e3a38314d52498c/cffi-2.0.0-cp311-cp311-macosx_10_13_x86_64.whl", hash = "sha256:b4c854ef3adc177950a8dfc81a86f5115d2abd545751a304c5bcf2c2c7283cfe", size = 184344, upload-time = "2025-09-08T23:22:26.456Z" }, - { url = "https://files.pythonhosted.org/packages/4f/8b/f0e4c441227ba756aafbe78f117485b25bb26b1c059d01f137fa6d14896b/cffi-2.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2de9a304e27f7596cd03d16f1b7c72219bd944e99cc52b84d0145aefb07cbd3c", size = 180560, upload-time = "2025-09-08T23:22:28.197Z" }, - { url = "https://files.pythonhosted.org/packages/b1/b7/1200d354378ef52ec227395d95c2576330fd22a869f7a70e88e1447eb234/cffi-2.0.0-cp311-cp311-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:baf5215e0ab74c16e2dd324e8ec067ef59e41125d3eade2b863d294fd5035c92", size = 209613, upload-time = "2025-09-08T23:22:29.475Z" }, - { url = "https://files.pythonhosted.org/packages/b8/56/6033f5e86e8cc9bb629f0077ba71679508bdf54a9a5e112a3c0b91870332/cffi-2.0.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:730cacb21e1bdff3ce90babf007d0a0917cc3e6492f336c2f0134101e0944f93", size = 216476, upload-time = "2025-09-08T23:22:31.063Z" }, - { url = "https://files.pythonhosted.org/packages/dc/7f/55fecd70f7ece178db2f26128ec41430d8720f2d12ca97bf8f0a628207d5/cffi-2.0.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:6824f87845e3396029f3820c206e459ccc91760e8fa24422f8b0c3d1731cbec5", size = 203374, upload-time = "2025-09-08T23:22:32.507Z" }, - { url = "https://files.pythonhosted.org/packages/84/ef/a7b77c8bdc0f77adc3b46888f1ad54be8f3b7821697a7b89126e829e676a/cffi-2.0.0-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:9de40a7b0323d889cf8d23d1ef214f565ab154443c42737dfe52ff82cf857664", size = 202597, upload-time = "2025-09-08T23:22:34.132Z" }, - { url = "https://files.pythonhosted.org/packages/d7/91/500d892b2bf36529a75b77958edfcd5ad8e2ce4064ce2ecfeab2125d72d1/cffi-2.0.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:8941aaadaf67246224cee8c3803777eed332a19d909b47e29c9842ef1e79ac26", size = 215574, upload-time = "2025-09-08T23:22:35.443Z" }, - { url = "https://files.pythonhosted.org/packages/44/64/58f6255b62b101093d5df22dcb752596066c7e89dd725e0afaed242a61be/cffi-2.0.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:a05d0c237b3349096d3981b727493e22147f934b20f6f125a3eba8f994bec4a9", size = 218971, upload-time = "2025-09-08T23:22:36.805Z" }, - { url = "https://files.pythonhosted.org/packages/ab/49/fa72cebe2fd8a55fbe14956f9970fe8eb1ac59e5df042f603ef7c8ba0adc/cffi-2.0.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:94698a9c5f91f9d138526b48fe26a199609544591f859c870d477351dc7b2414", size = 211972, upload-time = "2025-09-08T23:22:38.436Z" }, - { url = "https://files.pythonhosted.org/packages/0b/28/dd0967a76aab36731b6ebfe64dec4e981aff7e0608f60c2d46b46982607d/cffi-2.0.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:5fed36fccc0612a53f1d4d9a816b50a36702c28a2aa880cb8a122b3466638743", size = 217078, upload-time = "2025-09-08T23:22:39.776Z" }, - { url = "https://files.pythonhosted.org/packages/2b/c0/015b25184413d7ab0a410775fdb4a50fca20f5589b5dab1dbbfa3baad8ce/cffi-2.0.0-cp311-cp311-win32.whl", hash = "sha256:c649e3a33450ec82378822b3dad03cc228b8f5963c0c12fc3b1e0ab940f768a5", size = 172076, upload-time = "2025-09-08T23:22:40.95Z" }, - { url = "https://files.pythonhosted.org/packages/ae/8f/dc5531155e7070361eb1b7e4c1a9d896d0cb21c49f807a6c03fd63fc877e/cffi-2.0.0-cp311-cp311-win_amd64.whl", hash = "sha256:66f011380d0e49ed280c789fbd08ff0d40968ee7b665575489afa95c98196ab5", size = 182820, upload-time = "2025-09-08T23:22:42.463Z" }, - { url = "https://files.pythonhosted.org/packages/95/5c/1b493356429f9aecfd56bc171285a4c4ac8697f76e9bbbbb105e537853a1/cffi-2.0.0-cp311-cp311-win_arm64.whl", hash = "sha256:c6638687455baf640e37344fe26d37c404db8b80d037c3d29f58fe8d1c3b194d", size = 177635, upload-time = "2025-09-08T23:22:43.623Z" }, - { url = "https://files.pythonhosted.org/packages/ea/47/4f61023ea636104d4f16ab488e268b93008c3d0bb76893b1b31db1f96802/cffi-2.0.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:6d02d6655b0e54f54c4ef0b94eb6be0607b70853c45ce98bd278dc7de718be5d", size = 185271, upload-time = "2025-09-08T23:22:44.795Z" }, - { url = "https://files.pythonhosted.org/packages/df/a2/781b623f57358e360d62cdd7a8c681f074a71d445418a776eef0aadb4ab4/cffi-2.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8eca2a813c1cb7ad4fb74d368c2ffbbb4789d377ee5bb8df98373c2cc0dee76c", size = 181048, upload-time = "2025-09-08T23:22:45.938Z" }, - { url = "https://files.pythonhosted.org/packages/ff/df/a4f0fbd47331ceeba3d37c2e51e9dfc9722498becbeec2bd8bc856c9538a/cffi-2.0.0-cp312-cp312-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:21d1152871b019407d8ac3985f6775c079416c282e431a4da6afe7aefd2bccbe", size = 212529, upload-time = "2025-09-08T23:22:47.349Z" }, - { url = "https://files.pythonhosted.org/packages/d5/72/12b5f8d3865bf0f87cf1404d8c374e7487dcf097a1c91c436e72e6badd83/cffi-2.0.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:b21e08af67b8a103c71a250401c78d5e0893beff75e28c53c98f4de42f774062", size = 220097, upload-time = "2025-09-08T23:22:48.677Z" }, - { url = "https://files.pythonhosted.org/packages/c2/95/7a135d52a50dfa7c882ab0ac17e8dc11cec9d55d2c18dda414c051c5e69e/cffi-2.0.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:1e3a615586f05fc4065a8b22b8152f0c1b00cdbc60596d187c2a74f9e3036e4e", size = 207983, upload-time = "2025-09-08T23:22:50.06Z" }, - { url = "https://files.pythonhosted.org/packages/3a/c8/15cb9ada8895957ea171c62dc78ff3e99159ee7adb13c0123c001a2546c1/cffi-2.0.0-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:81afed14892743bbe14dacb9e36d9e0e504cd204e0b165062c488942b9718037", size = 206519, upload-time = "2025-09-08T23:22:51.364Z" }, - { url = "https://files.pythonhosted.org/packages/78/2d/7fa73dfa841b5ac06c7b8855cfc18622132e365f5b81d02230333ff26e9e/cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:3e17ed538242334bf70832644a32a7aae3d83b57567f9fd60a26257e992b79ba", size = 219572, upload-time = "2025-09-08T23:22:52.902Z" }, - { url = "https://files.pythonhosted.org/packages/07/e0/267e57e387b4ca276b90f0434ff88b2c2241ad72b16d31836adddfd6031b/cffi-2.0.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3925dd22fa2b7699ed2617149842d2e6adde22b262fcbfada50e3d195e4b3a94", size = 222963, upload-time = "2025-09-08T23:22:54.518Z" }, - { url = "https://files.pythonhosted.org/packages/b6/75/1f2747525e06f53efbd878f4d03bac5b859cbc11c633d0fb81432d98a795/cffi-2.0.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:2c8f814d84194c9ea681642fd164267891702542f028a15fc97d4674b6206187", size = 221361, upload-time = "2025-09-08T23:22:55.867Z" }, - { url = "https://files.pythonhosted.org/packages/7b/2b/2b6435f76bfeb6bbf055596976da087377ede68df465419d192acf00c437/cffi-2.0.0-cp312-cp312-win32.whl", hash = "sha256:da902562c3e9c550df360bfa53c035b2f241fed6d9aef119048073680ace4a18", size = 172932, upload-time = "2025-09-08T23:22:57.188Z" }, - { url = "https://files.pythonhosted.org/packages/f8/ed/13bd4418627013bec4ed6e54283b1959cf6db888048c7cf4b4c3b5b36002/cffi-2.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:da68248800ad6320861f129cd9c1bf96ca849a2771a59e0344e88681905916f5", size = 183557, upload-time = "2025-09-08T23:22:58.351Z" }, - { url = "https://files.pythonhosted.org/packages/95/31/9f7f93ad2f8eff1dbc1c3656d7ca5bfd8fb52c9d786b4dcf19b2d02217fa/cffi-2.0.0-cp312-cp312-win_arm64.whl", hash = "sha256:4671d9dd5ec934cb9a73e7ee9676f9362aba54f7f34910956b84d727b0d73fb6", size = 177762, upload-time = "2025-09-08T23:22:59.668Z" }, - { url = "https://files.pythonhosted.org/packages/4b/8d/a0a47a0c9e413a658623d014e91e74a50cdd2c423f7ccfd44086ef767f90/cffi-2.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:00bdf7acc5f795150faa6957054fbbca2439db2f775ce831222b66f192f03beb", size = 185230, upload-time = "2025-09-08T23:23:00.879Z" }, - { url = "https://files.pythonhosted.org/packages/4a/d2/a6c0296814556c68ee32009d9c2ad4f85f2707cdecfd7727951ec228005d/cffi-2.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:45d5e886156860dc35862657e1494b9bae8dfa63bf56796f2fb56e1679fc0bca", size = 181043, upload-time = "2025-09-08T23:23:02.231Z" }, - { url = "https://files.pythonhosted.org/packages/b0/1e/d22cc63332bd59b06481ceaac49d6c507598642e2230f201649058a7e704/cffi-2.0.0-cp313-cp313-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:07b271772c100085dd28b74fa0cd81c8fb1a3ba18b21e03d7c27f3436a10606b", size = 212446, upload-time = "2025-09-08T23:23:03.472Z" }, - { url = "https://files.pythonhosted.org/packages/a9/f5/a2c23eb03b61a0b8747f211eb716446c826ad66818ddc7810cc2cc19b3f2/cffi-2.0.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d48a880098c96020b02d5a1f7d9251308510ce8858940e6fa99ece33f610838b", size = 220101, upload-time = "2025-09-08T23:23:04.792Z" }, - { url = "https://files.pythonhosted.org/packages/f2/7f/e6647792fc5850d634695bc0e6ab4111ae88e89981d35ac269956605feba/cffi-2.0.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:f93fd8e5c8c0a4aa1f424d6173f14a892044054871c771f8566e4008eaa359d2", size = 207948, upload-time = "2025-09-08T23:23:06.127Z" }, - { url = "https://files.pythonhosted.org/packages/cb/1e/a5a1bd6f1fb30f22573f76533de12a00bf274abcdc55c8edab639078abb6/cffi-2.0.0-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:dd4f05f54a52fb558f1ba9f528228066954fee3ebe629fc1660d874d040ae5a3", size = 206422, upload-time = "2025-09-08T23:23:07.753Z" }, - { url = "https://files.pythonhosted.org/packages/98/df/0a1755e750013a2081e863e7cd37e0cdd02664372c754e5560099eb7aa44/cffi-2.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c8d3b5532fc71b7a77c09192b4a5a200ea992702734a2e9279a37f2478236f26", size = 219499, upload-time = "2025-09-08T23:23:09.648Z" }, - { url = "https://files.pythonhosted.org/packages/50/e1/a969e687fcf9ea58e6e2a928ad5e2dd88cc12f6f0ab477e9971f2309b57c/cffi-2.0.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:d9b29c1f0ae438d5ee9acb31cadee00a58c46cc9c0b2f9038c6b0b3470877a8c", size = 222928, upload-time = "2025-09-08T23:23:10.928Z" }, - { url = "https://files.pythonhosted.org/packages/36/54/0362578dd2c9e557a28ac77698ed67323ed5b9775ca9d3fe73fe191bb5d8/cffi-2.0.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6d50360be4546678fc1b79ffe7a66265e28667840010348dd69a314145807a1b", size = 221302, upload-time = "2025-09-08T23:23:12.42Z" }, - { url = "https://files.pythonhosted.org/packages/eb/6d/bf9bda840d5f1dfdbf0feca87fbdb64a918a69bca42cfa0ba7b137c48cb8/cffi-2.0.0-cp313-cp313-win32.whl", hash = "sha256:74a03b9698e198d47562765773b4a8309919089150a0bb17d829ad7b44b60d27", size = 172909, upload-time = "2025-09-08T23:23:14.32Z" }, - { url = "https://files.pythonhosted.org/packages/37/18/6519e1ee6f5a1e579e04b9ddb6f1676c17368a7aba48299c3759bbc3c8b3/cffi-2.0.0-cp313-cp313-win_amd64.whl", hash = "sha256:19f705ada2530c1167abacb171925dd886168931e0a7b78f5bffcae5c6b5be75", size = 183402, upload-time = "2025-09-08T23:23:15.535Z" }, - { url = "https://files.pythonhosted.org/packages/cb/0e/02ceeec9a7d6ee63bb596121c2c8e9b3a9e150936f4fbef6ca1943e6137c/cffi-2.0.0-cp313-cp313-win_arm64.whl", hash = "sha256:256f80b80ca3853f90c21b23ee78cd008713787b1b1e93eae9f3d6a7134abd91", size = 177780, upload-time = "2025-09-08T23:23:16.761Z" }, - { url = "https://files.pythonhosted.org/packages/92/c4/3ce07396253a83250ee98564f8d7e9789fab8e58858f35d07a9a2c78de9f/cffi-2.0.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:fc33c5141b55ed366cfaad382df24fe7dcbc686de5be719b207bb248e3053dc5", size = 185320, upload-time = "2025-09-08T23:23:18.087Z" }, - { url = "https://files.pythonhosted.org/packages/59/dd/27e9fa567a23931c838c6b02d0764611c62290062a6d4e8ff7863daf9730/cffi-2.0.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c654de545946e0db659b3400168c9ad31b5d29593291482c43e3564effbcee13", size = 181487, upload-time = "2025-09-08T23:23:19.622Z" }, - { url = "https://files.pythonhosted.org/packages/d6/43/0e822876f87ea8a4ef95442c3d766a06a51fc5298823f884ef87aaad168c/cffi-2.0.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:24b6f81f1983e6df8db3adc38562c83f7d4a0c36162885ec7f7b77c7dcbec97b", size = 220049, upload-time = "2025-09-08T23:23:20.853Z" }, - { url = "https://files.pythonhosted.org/packages/b4/89/76799151d9c2d2d1ead63c2429da9ea9d7aac304603de0c6e8764e6e8e70/cffi-2.0.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:12873ca6cb9b0f0d3a0da705d6086fe911591737a59f28b7936bdfed27c0d47c", size = 207793, upload-time = "2025-09-08T23:23:22.08Z" }, - { url = "https://files.pythonhosted.org/packages/bb/dd/3465b14bb9e24ee24cb88c9e3730f6de63111fffe513492bf8c808a3547e/cffi-2.0.0-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:d9b97165e8aed9272a6bb17c01e3cc5871a594a446ebedc996e2397a1c1ea8ef", size = 206300, upload-time = "2025-09-08T23:23:23.314Z" }, - { url = "https://files.pythonhosted.org/packages/47/d9/d83e293854571c877a92da46fdec39158f8d7e68da75bf73581225d28e90/cffi-2.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:afb8db5439b81cf9c9d0c80404b60c3cc9c3add93e114dcae767f1477cb53775", size = 219244, upload-time = "2025-09-08T23:23:24.541Z" }, - { url = "https://files.pythonhosted.org/packages/2b/0f/1f177e3683aead2bb00f7679a16451d302c436b5cbf2505f0ea8146ef59e/cffi-2.0.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:737fe7d37e1a1bffe70bd5754ea763a62a066dc5913ca57e957824b72a85e205", size = 222828, upload-time = "2025-09-08T23:23:26.143Z" }, - { url = "https://files.pythonhosted.org/packages/c6/0f/cafacebd4b040e3119dcb32fed8bdef8dfe94da653155f9d0b9dc660166e/cffi-2.0.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:38100abb9d1b1435bc4cc340bb4489635dc2f0da7456590877030c9b3d40b0c1", size = 220926, upload-time = "2025-09-08T23:23:27.873Z" }, - { url = "https://files.pythonhosted.org/packages/3e/aa/df335faa45b395396fcbc03de2dfcab242cd61a9900e914fe682a59170b1/cffi-2.0.0-cp314-cp314-win32.whl", hash = "sha256:087067fa8953339c723661eda6b54bc98c5625757ea62e95eb4898ad5e776e9f", size = 175328, upload-time = "2025-09-08T23:23:44.61Z" }, - { url = "https://files.pythonhosted.org/packages/bb/92/882c2d30831744296ce713f0feb4c1cd30f346ef747b530b5318715cc367/cffi-2.0.0-cp314-cp314-win_amd64.whl", hash = "sha256:203a48d1fb583fc7d78a4c6655692963b860a417c0528492a6bc21f1aaefab25", size = 185650, upload-time = "2025-09-08T23:23:45.848Z" }, - { url = "https://files.pythonhosted.org/packages/9f/2c/98ece204b9d35a7366b5b2c6539c350313ca13932143e79dc133ba757104/cffi-2.0.0-cp314-cp314-win_arm64.whl", hash = "sha256:dbd5c7a25a7cb98f5ca55d258b103a2054f859a46ae11aaf23134f9cc0d356ad", size = 180687, upload-time = "2025-09-08T23:23:47.105Z" }, - { url = "https://files.pythonhosted.org/packages/3e/61/c768e4d548bfa607abcda77423448df8c471f25dbe64fb2ef6d555eae006/cffi-2.0.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:9a67fc9e8eb39039280526379fb3a70023d77caec1852002b4da7e8b270c4dd9", size = 188773, upload-time = "2025-09-08T23:23:29.347Z" }, - { url = "https://files.pythonhosted.org/packages/2c/ea/5f76bce7cf6fcd0ab1a1058b5af899bfbef198bea4d5686da88471ea0336/cffi-2.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:7a66c7204d8869299919db4d5069a82f1561581af12b11b3c9f48c584eb8743d", size = 185013, upload-time = "2025-09-08T23:23:30.63Z" }, - { url = "https://files.pythonhosted.org/packages/be/b4/c56878d0d1755cf9caa54ba71e5d049479c52f9e4afc230f06822162ab2f/cffi-2.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:7cc09976e8b56f8cebd752f7113ad07752461f48a58cbba644139015ac24954c", size = 221593, upload-time = "2025-09-08T23:23:31.91Z" }, - { url = "https://files.pythonhosted.org/packages/e0/0d/eb704606dfe8033e7128df5e90fee946bbcb64a04fcdaa97321309004000/cffi-2.0.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:92b68146a71df78564e4ef48af17551a5ddd142e5190cdf2c5624d0c3ff5b2e8", size = 209354, upload-time = "2025-09-08T23:23:33.214Z" }, - { url = "https://files.pythonhosted.org/packages/d8/19/3c435d727b368ca475fb8742ab97c9cb13a0de600ce86f62eab7fa3eea60/cffi-2.0.0-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:b1e74d11748e7e98e2f426ab176d4ed720a64412b6a15054378afdb71e0f37dc", size = 208480, upload-time = "2025-09-08T23:23:34.495Z" }, - { url = "https://files.pythonhosted.org/packages/d0/44/681604464ed9541673e486521497406fadcc15b5217c3e326b061696899a/cffi-2.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:28a3a209b96630bca57cce802da70c266eb08c6e97e5afd61a75611ee6c64592", size = 221584, upload-time = "2025-09-08T23:23:36.096Z" }, - { url = "https://files.pythonhosted.org/packages/25/8e/342a504ff018a2825d395d44d63a767dd8ebc927ebda557fecdaca3ac33a/cffi-2.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:7553fb2090d71822f02c629afe6042c299edf91ba1bf94951165613553984512", size = 224443, upload-time = "2025-09-08T23:23:37.328Z" }, - { url = "https://files.pythonhosted.org/packages/e1/5e/b666bacbbc60fbf415ba9988324a132c9a7a0448a9a8f125074671c0f2c3/cffi-2.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:6c6c373cfc5c83a975506110d17457138c8c63016b563cc9ed6e056a82f13ce4", size = 223437, upload-time = "2025-09-08T23:23:38.945Z" }, - { url = "https://files.pythonhosted.org/packages/a0/1d/ec1a60bd1a10daa292d3cd6bb0b359a81607154fb8165f3ec95fe003b85c/cffi-2.0.0-cp314-cp314t-win32.whl", hash = "sha256:1fc9ea04857caf665289b7a75923f2c6ed559b8298a1b8c49e59f7dd95c8481e", size = 180487, upload-time = "2025-09-08T23:23:40.423Z" }, - { url = "https://files.pythonhosted.org/packages/bf/41/4c1168c74fac325c0c8156f04b6749c8b6a8f405bbf91413ba088359f60d/cffi-2.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:d68b6cef7827e8641e8ef16f4494edda8b36104d79773a334beaa1e3521430f6", size = 191726, upload-time = "2025-09-08T23:23:41.742Z" }, - { url = "https://files.pythonhosted.org/packages/ae/3a/dbeec9d1ee0844c679f6bb5d6ad4e9f198b1224f4e7a32825f47f6192b0c/cffi-2.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0a1527a803f0a659de1af2e1fd700213caba79377e27e4693648c2923da066f9", size = 184195, upload-time = "2025-09-08T23:23:43.004Z" }, -] - -[[package]] -name = "charset-normalizer" -version = "3.4.4" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/13/69/33ddede1939fdd074bce5434295f38fae7136463422fe4fd3e0e89b98062/charset_normalizer-3.4.4.tar.gz", hash = "sha256:94537985111c35f28720e43603b8e7b43a6ecfb2ce1d3058bbe955b73404e21a", size = 129418, upload-time = "2025-10-14T04:42:32.879Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/1f/b8/6d51fc1d52cbd52cd4ccedd5b5b2f0f6a11bbf6765c782298b0f3e808541/charset_normalizer-3.4.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e824f1492727fa856dd6eda4f7cee25f8518a12f3c4a56a74e8095695089cf6d", size = 209709, upload-time = "2025-10-14T04:40:11.385Z" }, - { url = "https://files.pythonhosted.org/packages/5c/af/1f9d7f7faafe2ddfb6f72a2e07a548a629c61ad510fe60f9630309908fef/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4bd5d4137d500351a30687c2d3971758aac9a19208fc110ccb9d7188fbe709e8", size = 148814, upload-time = "2025-10-14T04:40:13.135Z" }, - { url = "https://files.pythonhosted.org/packages/79/3d/f2e3ac2bbc056ca0c204298ea4e3d9db9b4afe437812638759db2c976b5f/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:027f6de494925c0ab2a55eab46ae5129951638a49a34d87f4c3eda90f696b4ad", size = 144467, upload-time = "2025-10-14T04:40:14.728Z" }, - { url = "https://files.pythonhosted.org/packages/ec/85/1bf997003815e60d57de7bd972c57dc6950446a3e4ccac43bc3070721856/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f820802628d2694cb7e56db99213f930856014862f3fd943d290ea8438d07ca8", size = 162280, upload-time = "2025-10-14T04:40:16.14Z" }, - { url = "https://files.pythonhosted.org/packages/3e/8e/6aa1952f56b192f54921c436b87f2aaf7c7a7c3d0d1a765547d64fd83c13/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:798d75d81754988d2565bff1b97ba5a44411867c0cf32b77a7e8f8d84796b10d", size = 159454, upload-time = "2025-10-14T04:40:17.567Z" }, - { url = "https://files.pythonhosted.org/packages/36/3b/60cbd1f8e93aa25d1c669c649b7a655b0b5fb4c571858910ea9332678558/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9d1bb833febdff5c8927f922386db610b49db6e0d4f4ee29601d71e7c2694313", size = 153609, upload-time = "2025-10-14T04:40:19.08Z" }, - { url = "https://files.pythonhosted.org/packages/64/91/6a13396948b8fd3c4b4fd5bc74d045f5637d78c9675585e8e9fbe5636554/charset_normalizer-3.4.4-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9cd98cdc06614a2f768d2b7286d66805f94c48cde050acdbbb7db2600ab3197e", size = 151849, upload-time = "2025-10-14T04:40:20.607Z" }, - { url = "https://files.pythonhosted.org/packages/b7/7a/59482e28b9981d105691e968c544cc0df3b7d6133152fb3dcdc8f135da7a/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:077fbb858e903c73f6c9db43374fd213b0b6a778106bc7032446a8e8b5b38b93", size = 151586, upload-time = "2025-10-14T04:40:21.719Z" }, - { url = "https://files.pythonhosted.org/packages/92/59/f64ef6a1c4bdd2baf892b04cd78792ed8684fbc48d4c2afe467d96b4df57/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:244bfb999c71b35de57821b8ea746b24e863398194a4014e4c76adc2bbdfeff0", size = 145290, upload-time = "2025-10-14T04:40:23.069Z" }, - { url = "https://files.pythonhosted.org/packages/6b/63/3bf9f279ddfa641ffa1962b0db6a57a9c294361cc2f5fcac997049a00e9c/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:64b55f9dce520635f018f907ff1b0df1fdc31f2795a922fb49dd14fbcdf48c84", size = 163663, upload-time = "2025-10-14T04:40:24.17Z" }, - { url = "https://files.pythonhosted.org/packages/ed/09/c9e38fc8fa9e0849b172b581fd9803bdf6e694041127933934184e19f8c3/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:faa3a41b2b66b6e50f84ae4a68c64fcd0c44355741c6374813a800cd6695db9e", size = 151964, upload-time = "2025-10-14T04:40:25.368Z" }, - { url = "https://files.pythonhosted.org/packages/d2/d1/d28b747e512d0da79d8b6a1ac18b7ab2ecfd81b2944c4c710e166d8dd09c/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:6515f3182dbe4ea06ced2d9e8666d97b46ef4c75e326b79bb624110f122551db", size = 161064, upload-time = "2025-10-14T04:40:26.806Z" }, - { url = "https://files.pythonhosted.org/packages/bb/9a/31d62b611d901c3b9e5500c36aab0ff5eb442043fb3a1c254200d3d397d9/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:cc00f04ed596e9dc0da42ed17ac5e596c6ccba999ba6bd92b0e0aef2f170f2d6", size = 155015, upload-time = "2025-10-14T04:40:28.284Z" }, - { url = "https://files.pythonhosted.org/packages/1f/f3/107e008fa2bff0c8b9319584174418e5e5285fef32f79d8ee6a430d0039c/charset_normalizer-3.4.4-cp310-cp310-win32.whl", hash = "sha256:f34be2938726fc13801220747472850852fe6b1ea75869a048d6f896838c896f", size = 99792, upload-time = "2025-10-14T04:40:29.613Z" }, - { url = "https://files.pythonhosted.org/packages/eb/66/e396e8a408843337d7315bab30dbf106c38966f1819f123257f5520f8a96/charset_normalizer-3.4.4-cp310-cp310-win_amd64.whl", hash = "sha256:a61900df84c667873b292c3de315a786dd8dac506704dea57bc957bd31e22c7d", size = 107198, upload-time = "2025-10-14T04:40:30.644Z" }, - { url = "https://files.pythonhosted.org/packages/b5/58/01b4f815bf0312704c267f2ccb6e5d42bcc7752340cd487bc9f8c3710597/charset_normalizer-3.4.4-cp310-cp310-win_arm64.whl", hash = "sha256:cead0978fc57397645f12578bfd2d5ea9138ea0fac82b2f63f7f7c6877986a69", size = 100262, upload-time = "2025-10-14T04:40:32.108Z" }, - { url = "https://files.pythonhosted.org/packages/ed/27/c6491ff4954e58a10f69ad90aca8a1b6fe9c5d3c6f380907af3c37435b59/charset_normalizer-3.4.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6e1fcf0720908f200cd21aa4e6750a48ff6ce4afe7ff5a79a90d5ed8a08296f8", size = 206988, upload-time = "2025-10-14T04:40:33.79Z" }, - { url = "https://files.pythonhosted.org/packages/94/59/2e87300fe67ab820b5428580a53cad894272dbb97f38a7a814a2a1ac1011/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5f819d5fe9234f9f82d75bdfa9aef3a3d72c4d24a6e57aeaebba32a704553aa0", size = 147324, upload-time = "2025-10-14T04:40:34.961Z" }, - { url = "https://files.pythonhosted.org/packages/07/fb/0cf61dc84b2b088391830f6274cb57c82e4da8bbc2efeac8c025edb88772/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a59cb51917aa591b1c4e6a43c132f0cdc3c76dbad6155df4e28ee626cc77a0a3", size = 142742, upload-time = "2025-10-14T04:40:36.105Z" }, - { url = "https://files.pythonhosted.org/packages/62/8b/171935adf2312cd745d290ed93cf16cf0dfe320863ab7cbeeae1dcd6535f/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8ef3c867360f88ac904fd3f5e1f902f13307af9052646963ee08ff4f131adafc", size = 160863, upload-time = "2025-10-14T04:40:37.188Z" }, - { url = "https://files.pythonhosted.org/packages/09/73/ad875b192bda14f2173bfc1bc9a55e009808484a4b256748d931b6948442/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d9e45d7faa48ee908174d8fe84854479ef838fc6a705c9315372eacbc2f02897", size = 157837, upload-time = "2025-10-14T04:40:38.435Z" }, - { url = "https://files.pythonhosted.org/packages/6d/fc/de9cce525b2c5b94b47c70a4b4fb19f871b24995c728e957ee68ab1671ea/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:840c25fb618a231545cbab0564a799f101b63b9901f2569faecd6b222ac72381", size = 151550, upload-time = "2025-10-14T04:40:40.053Z" }, - { url = "https://files.pythonhosted.org/packages/55/c2/43edd615fdfba8c6f2dfbd459b25a6b3b551f24ea21981e23fb768503ce1/charset_normalizer-3.4.4-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ca5862d5b3928c4940729dacc329aa9102900382fea192fc5e52eb69d6093815", size = 149162, upload-time = "2025-10-14T04:40:41.163Z" }, - { url = "https://files.pythonhosted.org/packages/03/86/bde4ad8b4d0e9429a4e82c1e8f5c659993a9a863ad62c7df05cf7b678d75/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d9c7f57c3d666a53421049053eaacdd14bbd0a528e2186fcb2e672effd053bb0", size = 150019, upload-time = "2025-10-14T04:40:42.276Z" }, - { url = "https://files.pythonhosted.org/packages/1f/86/a151eb2af293a7e7bac3a739b81072585ce36ccfb4493039f49f1d3cae8c/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:277e970e750505ed74c832b4bf75dac7476262ee2a013f5574dd49075879e161", size = 143310, upload-time = "2025-10-14T04:40:43.439Z" }, - { url = "https://files.pythonhosted.org/packages/b5/fe/43dae6144a7e07b87478fdfc4dbe9efd5defb0e7ec29f5f58a55aeef7bf7/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:31fd66405eaf47bb62e8cd575dc621c56c668f27d46a61d975a249930dd5e2a4", size = 162022, upload-time = "2025-10-14T04:40:44.547Z" }, - { url = "https://files.pythonhosted.org/packages/80/e6/7aab83774f5d2bca81f42ac58d04caf44f0cc2b65fc6db2b3b2e8a05f3b3/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:0d3d8f15c07f86e9ff82319b3d9ef6f4bf907608f53fe9d92b28ea9ae3d1fd89", size = 149383, upload-time = "2025-10-14T04:40:46.018Z" }, - { url = "https://files.pythonhosted.org/packages/4f/e8/b289173b4edae05c0dde07f69f8db476a0b511eac556dfe0d6bda3c43384/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:9f7fcd74d410a36883701fafa2482a6af2ff5ba96b9a620e9e0721e28ead5569", size = 159098, upload-time = "2025-10-14T04:40:47.081Z" }, - { url = "https://files.pythonhosted.org/packages/d8/df/fe699727754cae3f8478493c7f45f777b17c3ef0600e28abfec8619eb49c/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ebf3e58c7ec8a8bed6d66a75d7fb37b55e5015b03ceae72a8e7c74495551e224", size = 152991, upload-time = "2025-10-14T04:40:48.246Z" }, - { url = "https://files.pythonhosted.org/packages/1a/86/584869fe4ddb6ffa3bd9f491b87a01568797fb9bd8933f557dba9771beaf/charset_normalizer-3.4.4-cp311-cp311-win32.whl", hash = "sha256:eecbc200c7fd5ddb9a7f16c7decb07b566c29fa2161a16cf67b8d068bd21690a", size = 99456, upload-time = "2025-10-14T04:40:49.376Z" }, - { url = "https://files.pythonhosted.org/packages/65/f6/62fdd5feb60530f50f7e38b4f6a1d5203f4d16ff4f9f0952962c044e919a/charset_normalizer-3.4.4-cp311-cp311-win_amd64.whl", hash = "sha256:5ae497466c7901d54b639cf42d5b8c1b6a4fead55215500d2f486d34db48d016", size = 106978, upload-time = "2025-10-14T04:40:50.844Z" }, - { url = "https://files.pythonhosted.org/packages/7a/9d/0710916e6c82948b3be62d9d398cb4fcf4e97b56d6a6aeccd66c4b2f2bd5/charset_normalizer-3.4.4-cp311-cp311-win_arm64.whl", hash = "sha256:65e2befcd84bc6f37095f5961e68a6f077bf44946771354a28ad434c2cce0ae1", size = 99969, upload-time = "2025-10-14T04:40:52.272Z" }, - { url = "https://files.pythonhosted.org/packages/f3/85/1637cd4af66fa687396e757dec650f28025f2a2f5a5531a3208dc0ec43f2/charset_normalizer-3.4.4-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0a98e6759f854bd25a58a73fa88833fba3b7c491169f86ce1180c948ab3fd394", size = 208425, upload-time = "2025-10-14T04:40:53.353Z" }, - { url = "https://files.pythonhosted.org/packages/9d/6a/04130023fef2a0d9c62d0bae2649b69f7b7d8d24ea5536feef50551029df/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b5b290ccc2a263e8d185130284f8501e3e36c5e02750fc6b6bdeb2e9e96f1e25", size = 148162, upload-time = "2025-10-14T04:40:54.558Z" }, - { url = "https://files.pythonhosted.org/packages/78/29/62328d79aa60da22c9e0b9a66539feae06ca0f5a4171ac4f7dc285b83688/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:74bb723680f9f7a6234dcf67aea57e708ec1fbdf5699fb91dfd6f511b0a320ef", size = 144558, upload-time = "2025-10-14T04:40:55.677Z" }, - { url = "https://files.pythonhosted.org/packages/86/bb/b32194a4bf15b88403537c2e120b817c61cd4ecffa9b6876e941c3ee38fe/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f1e34719c6ed0b92f418c7c780480b26b5d9c50349e9a9af7d76bf757530350d", size = 161497, upload-time = "2025-10-14T04:40:57.217Z" }, - { url = "https://files.pythonhosted.org/packages/19/89/a54c82b253d5b9b111dc74aca196ba5ccfcca8242d0fb64146d4d3183ff1/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2437418e20515acec67d86e12bf70056a33abdacb5cb1655042f6538d6b085a8", size = 159240, upload-time = "2025-10-14T04:40:58.358Z" }, - { url = "https://files.pythonhosted.org/packages/c0/10/d20b513afe03acc89ec33948320a5544d31f21b05368436d580dec4e234d/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:11d694519d7f29d6cd09f6ac70028dba10f92f6cdd059096db198c283794ac86", size = 153471, upload-time = "2025-10-14T04:40:59.468Z" }, - { url = "https://files.pythonhosted.org/packages/61/fa/fbf177b55bdd727010f9c0a3c49eefa1d10f960e5f09d1d887bf93c2e698/charset_normalizer-3.4.4-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ac1c4a689edcc530fc9d9aa11f5774b9e2f33f9a0c6a57864e90908f5208d30a", size = 150864, upload-time = "2025-10-14T04:41:00.623Z" }, - { url = "https://files.pythonhosted.org/packages/05/12/9fbc6a4d39c0198adeebbde20b619790e9236557ca59fc40e0e3cebe6f40/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:21d142cc6c0ec30d2efee5068ca36c128a30b0f2c53c1c07bd78cb6bc1d3be5f", size = 150647, upload-time = "2025-10-14T04:41:01.754Z" }, - { url = "https://files.pythonhosted.org/packages/ad/1f/6a9a593d52e3e8c5d2b167daf8c6b968808efb57ef4c210acb907c365bc4/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:5dbe56a36425d26d6cfb40ce79c314a2e4dd6211d51d6d2191c00bed34f354cc", size = 145110, upload-time = "2025-10-14T04:41:03.231Z" }, - { url = "https://files.pythonhosted.org/packages/30/42/9a52c609e72471b0fc54386dc63c3781a387bb4fe61c20231a4ebcd58bdd/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:5bfbb1b9acf3334612667b61bd3002196fe2a1eb4dd74d247e0f2a4d50ec9bbf", size = 162839, upload-time = "2025-10-14T04:41:04.715Z" }, - { url = "https://files.pythonhosted.org/packages/c4/5b/c0682bbf9f11597073052628ddd38344a3d673fda35a36773f7d19344b23/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:d055ec1e26e441f6187acf818b73564e6e6282709e9bcb5b63f5b23068356a15", size = 150667, upload-time = "2025-10-14T04:41:05.827Z" }, - { url = "https://files.pythonhosted.org/packages/e4/24/a41afeab6f990cf2daf6cb8c67419b63b48cf518e4f56022230840c9bfb2/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:af2d8c67d8e573d6de5bc30cdb27e9b95e49115cd9baad5ddbd1a6207aaa82a9", size = 160535, upload-time = "2025-10-14T04:41:06.938Z" }, - { url = "https://files.pythonhosted.org/packages/2a/e5/6a4ce77ed243c4a50a1fecca6aaaab419628c818a49434be428fe24c9957/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:780236ac706e66881f3b7f2f32dfe90507a09e67d1d454c762cf642e6e1586e0", size = 154816, upload-time = "2025-10-14T04:41:08.101Z" }, - { url = "https://files.pythonhosted.org/packages/a8/ef/89297262b8092b312d29cdb2517cb1237e51db8ecef2e9af5edbe7b683b1/charset_normalizer-3.4.4-cp312-cp312-win32.whl", hash = "sha256:5833d2c39d8896e4e19b689ffc198f08ea58116bee26dea51e362ecc7cd3ed26", size = 99694, upload-time = "2025-10-14T04:41:09.23Z" }, - { url = "https://files.pythonhosted.org/packages/3d/2d/1e5ed9dd3b3803994c155cd9aacb60c82c331bad84daf75bcb9c91b3295e/charset_normalizer-3.4.4-cp312-cp312-win_amd64.whl", hash = "sha256:a79cfe37875f822425b89a82333404539ae63dbdddf97f84dcbc3d339aae9525", size = 107131, upload-time = "2025-10-14T04:41:10.467Z" }, - { url = "https://files.pythonhosted.org/packages/d0/d9/0ed4c7098a861482a7b6a95603edce4c0d9db2311af23da1fb2b75ec26fc/charset_normalizer-3.4.4-cp312-cp312-win_arm64.whl", hash = "sha256:376bec83a63b8021bb5c8ea75e21c4ccb86e7e45ca4eb81146091b56599b80c3", size = 100390, upload-time = "2025-10-14T04:41:11.915Z" }, - { url = "https://files.pythonhosted.org/packages/97/45/4b3a1239bbacd321068ea6e7ac28875b03ab8bc0aa0966452db17cd36714/charset_normalizer-3.4.4-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:e1f185f86a6f3403aa2420e815904c67b2f9ebc443f045edd0de921108345794", size = 208091, upload-time = "2025-10-14T04:41:13.346Z" }, - { url = "https://files.pythonhosted.org/packages/7d/62/73a6d7450829655a35bb88a88fca7d736f9882a27eacdca2c6d505b57e2e/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6b39f987ae8ccdf0d2642338faf2abb1862340facc796048b604ef14919e55ed", size = 147936, upload-time = "2025-10-14T04:41:14.461Z" }, - { url = "https://files.pythonhosted.org/packages/89/c5/adb8c8b3d6625bef6d88b251bbb0d95f8205831b987631ab0c8bb5d937c2/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:3162d5d8ce1bb98dd51af660f2121c55d0fa541b46dff7bb9b9f86ea1d87de72", size = 144180, upload-time = "2025-10-14T04:41:15.588Z" }, - { url = "https://files.pythonhosted.org/packages/91/ed/9706e4070682d1cc219050b6048bfd293ccf67b3d4f5a4f39207453d4b99/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:81d5eb2a312700f4ecaa977a8235b634ce853200e828fbadf3a9c50bab278328", size = 161346, upload-time = "2025-10-14T04:41:16.738Z" }, - { url = "https://files.pythonhosted.org/packages/d5/0d/031f0d95e4972901a2f6f09ef055751805ff541511dc1252ba3ca1f80cf5/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5bd2293095d766545ec1a8f612559f6b40abc0eb18bb2f5d1171872d34036ede", size = 158874, upload-time = "2025-10-14T04:41:17.923Z" }, - { url = "https://files.pythonhosted.org/packages/f5/83/6ab5883f57c9c801ce5e5677242328aa45592be8a00644310a008d04f922/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a8a8b89589086a25749f471e6a900d3f662d1d3b6e2e59dcecf787b1cc3a1894", size = 153076, upload-time = "2025-10-14T04:41:19.106Z" }, - { url = "https://files.pythonhosted.org/packages/75/1e/5ff781ddf5260e387d6419959ee89ef13878229732732ee73cdae01800f2/charset_normalizer-3.4.4-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bc7637e2f80d8530ee4a78e878bce464f70087ce73cf7c1caf142416923b98f1", size = 150601, upload-time = "2025-10-14T04:41:20.245Z" }, - { url = "https://files.pythonhosted.org/packages/d7/57/71be810965493d3510a6ca79b90c19e48696fb1ff964da319334b12677f0/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:f8bf04158c6b607d747e93949aa60618b61312fe647a6369f88ce2ff16043490", size = 150376, upload-time = "2025-10-14T04:41:21.398Z" }, - { url = "https://files.pythonhosted.org/packages/e5/d5/c3d057a78c181d007014feb7e9f2e65905a6c4ef182c0ddf0de2924edd65/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:554af85e960429cf30784dd47447d5125aaa3b99a6f0683589dbd27e2f45da44", size = 144825, upload-time = "2025-10-14T04:41:22.583Z" }, - { url = "https://files.pythonhosted.org/packages/e6/8c/d0406294828d4976f275ffbe66f00266c4b3136b7506941d87c00cab5272/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:74018750915ee7ad843a774364e13a3db91682f26142baddf775342c3f5b1133", size = 162583, upload-time = "2025-10-14T04:41:23.754Z" }, - { url = "https://files.pythonhosted.org/packages/d7/24/e2aa1f18c8f15c4c0e932d9287b8609dd30ad56dbe41d926bd846e22fb8d/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:c0463276121fdee9c49b98908b3a89c39be45d86d1dbaa22957e38f6321d4ce3", size = 150366, upload-time = "2025-10-14T04:41:25.27Z" }, - { url = "https://files.pythonhosted.org/packages/e4/5b/1e6160c7739aad1e2df054300cc618b06bf784a7a164b0f238360721ab86/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:362d61fd13843997c1c446760ef36f240cf81d3ebf74ac62652aebaf7838561e", size = 160300, upload-time = "2025-10-14T04:41:26.725Z" }, - { url = "https://files.pythonhosted.org/packages/7a/10/f882167cd207fbdd743e55534d5d9620e095089d176d55cb22d5322f2afd/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:9a26f18905b8dd5d685d6d07b0cdf98a79f3c7a918906af7cc143ea2e164c8bc", size = 154465, upload-time = "2025-10-14T04:41:28.322Z" }, - { url = "https://files.pythonhosted.org/packages/89/66/c7a9e1b7429be72123441bfdbaf2bc13faab3f90b933f664db506dea5915/charset_normalizer-3.4.4-cp313-cp313-win32.whl", hash = "sha256:9b35f4c90079ff2e2edc5b26c0c77925e5d2d255c42c74fdb70fb49b172726ac", size = 99404, upload-time = "2025-10-14T04:41:29.95Z" }, - { url = "https://files.pythonhosted.org/packages/c4/26/b9924fa27db384bdcd97ab83b4f0a8058d96ad9626ead570674d5e737d90/charset_normalizer-3.4.4-cp313-cp313-win_amd64.whl", hash = "sha256:b435cba5f4f750aa6c0a0d92c541fb79f69a387c91e61f1795227e4ed9cece14", size = 107092, upload-time = "2025-10-14T04:41:31.188Z" }, - { url = "https://files.pythonhosted.org/packages/af/8f/3ed4bfa0c0c72a7ca17f0380cd9e4dd842b09f664e780c13cff1dcf2ef1b/charset_normalizer-3.4.4-cp313-cp313-win_arm64.whl", hash = "sha256:542d2cee80be6f80247095cc36c418f7bddd14f4a6de45af91dfad36d817bba2", size = 100408, upload-time = "2025-10-14T04:41:32.624Z" }, - { url = "https://files.pythonhosted.org/packages/2a/35/7051599bd493e62411d6ede36fd5af83a38f37c4767b92884df7301db25d/charset_normalizer-3.4.4-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:da3326d9e65ef63a817ecbcc0df6e94463713b754fe293eaa03da99befb9a5bd", size = 207746, upload-time = "2025-10-14T04:41:33.773Z" }, - { url = "https://files.pythonhosted.org/packages/10/9a/97c8d48ef10d6cd4fcead2415523221624bf58bcf68a802721a6bc807c8f/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8af65f14dc14a79b924524b1e7fffe304517b2bff5a58bf64f30b98bbc5079eb", size = 147889, upload-time = "2025-10-14T04:41:34.897Z" }, - { url = "https://files.pythonhosted.org/packages/10/bf/979224a919a1b606c82bd2c5fa49b5c6d5727aa47b4312bb27b1734f53cd/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:74664978bb272435107de04e36db5a9735e78232b85b77d45cfb38f758efd33e", size = 143641, upload-time = "2025-10-14T04:41:36.116Z" }, - { url = "https://files.pythonhosted.org/packages/ba/33/0ad65587441fc730dc7bd90e9716b30b4702dc7b617e6ba4997dc8651495/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:752944c7ffbfdd10c074dc58ec2d5a8a4cd9493b314d367c14d24c17684ddd14", size = 160779, upload-time = "2025-10-14T04:41:37.229Z" }, - { url = "https://files.pythonhosted.org/packages/67/ed/331d6b249259ee71ddea93f6f2f0a56cfebd46938bde6fcc6f7b9a3d0e09/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d1f13550535ad8cff21b8d757a3257963e951d96e20ec82ab44bc64aeb62a191", size = 159035, upload-time = "2025-10-14T04:41:38.368Z" }, - { url = "https://files.pythonhosted.org/packages/67/ff/f6b948ca32e4f2a4576aa129d8bed61f2e0543bf9f5f2b7fc3758ed005c9/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ecaae4149d99b1c9e7b88bb03e3221956f68fd6d50be2ef061b2381b61d20838", size = 152542, upload-time = "2025-10-14T04:41:39.862Z" }, - { url = "https://files.pythonhosted.org/packages/16/85/276033dcbcc369eb176594de22728541a925b2632f9716428c851b149e83/charset_normalizer-3.4.4-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:cb6254dc36b47a990e59e1068afacdcd02958bdcce30bb50cc1700a8b9d624a6", size = 149524, upload-time = "2025-10-14T04:41:41.319Z" }, - { url = "https://files.pythonhosted.org/packages/9e/f2/6a2a1f722b6aba37050e626530a46a68f74e63683947a8acff92569f979a/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c8ae8a0f02f57a6e61203a31428fa1d677cbe50c93622b4149d5c0f319c1d19e", size = 150395, upload-time = "2025-10-14T04:41:42.539Z" }, - { url = "https://files.pythonhosted.org/packages/60/bb/2186cb2f2bbaea6338cad15ce23a67f9b0672929744381e28b0592676824/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:47cc91b2f4dd2833fddaedd2893006b0106129d4b94fdb6af1f4ce5a9965577c", size = 143680, upload-time = "2025-10-14T04:41:43.661Z" }, - { url = "https://files.pythonhosted.org/packages/7d/a5/bf6f13b772fbb2a90360eb620d52ed8f796f3c5caee8398c3b2eb7b1c60d/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:82004af6c302b5d3ab2cfc4cc5f29db16123b1a8417f2e25f9066f91d4411090", size = 162045, upload-time = "2025-10-14T04:41:44.821Z" }, - { url = "https://files.pythonhosted.org/packages/df/c5/d1be898bf0dc3ef9030c3825e5d3b83f2c528d207d246cbabe245966808d/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:2b7d8f6c26245217bd2ad053761201e9f9680f8ce52f0fcd8d0755aeae5b2152", size = 149687, upload-time = "2025-10-14T04:41:46.442Z" }, - { url = "https://files.pythonhosted.org/packages/a5/42/90c1f7b9341eef50c8a1cb3f098ac43b0508413f33affd762855f67a410e/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:799a7a5e4fb2d5898c60b640fd4981d6a25f1c11790935a44ce38c54e985f828", size = 160014, upload-time = "2025-10-14T04:41:47.631Z" }, - { url = "https://files.pythonhosted.org/packages/76/be/4d3ee471e8145d12795ab655ece37baed0929462a86e72372fd25859047c/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:99ae2cffebb06e6c22bdc25801d7b30f503cc87dbd283479e7b606f70aff57ec", size = 154044, upload-time = "2025-10-14T04:41:48.81Z" }, - { url = "https://files.pythonhosted.org/packages/b0/6f/8f7af07237c34a1defe7defc565a9bc1807762f672c0fde711a4b22bf9c0/charset_normalizer-3.4.4-cp314-cp314-win32.whl", hash = "sha256:f9d332f8c2a2fcbffe1378594431458ddbef721c1769d78e2cbc06280d8155f9", size = 99940, upload-time = "2025-10-14T04:41:49.946Z" }, - { url = "https://files.pythonhosted.org/packages/4b/51/8ade005e5ca5b0d80fb4aff72a3775b325bdc3d27408c8113811a7cbe640/charset_normalizer-3.4.4-cp314-cp314-win_amd64.whl", hash = "sha256:8a6562c3700cce886c5be75ade4a5db4214fda19fede41d9792d100288d8f94c", size = 107104, upload-time = "2025-10-14T04:41:51.051Z" }, - { url = "https://files.pythonhosted.org/packages/da/5f/6b8f83a55bb8278772c5ae54a577f3099025f9ade59d0136ac24a0df4bde/charset_normalizer-3.4.4-cp314-cp314-win_arm64.whl", hash = "sha256:de00632ca48df9daf77a2c65a484531649261ec9f25489917f09e455cb09ddb2", size = 100743, upload-time = "2025-10-14T04:41:52.122Z" }, - { url = "https://files.pythonhosted.org/packages/0a/4c/925909008ed5a988ccbb72dcc897407e5d6d3bd72410d69e051fc0c14647/charset_normalizer-3.4.4-py3-none-any.whl", hash = "sha256:7a32c560861a02ff789ad905a2fe94e3f840803362c84fecf1851cb4cf3dc37f", size = 53402, upload-time = "2025-10-14T04:42:31.76Z" }, + { url = "https://files.pythonhosted.org/packages/b6/d2/2cde336b375f55c76ca670f0be3978cc048e31e24f3b4d7ce8473150a388/cffi-2.1.1-cp310-cp310-macosx_10_15_x86_64.whl", hash = "sha256:baed1e86cc735622097354b9d1281406caf42ff42a886d29faa8e8d1630333be", size = 183779, upload-time = "2026-08-03T21:19:15.602Z" }, + { url = "https://files.pythonhosted.org/packages/94/1a/4b2f7c92293ba05cbd4a9a1b28faaf0326272d9488e6354657571c48a7aa/cffi-2.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ca82be1a1d406ecfe1d25dc16cb33488e5a16bf4438c9fb590484ea29d92478b", size = 184178, upload-time = "2026-08-03T21:19:16.67Z" }, + { url = "https://files.pythonhosted.org/packages/17/0b/ba385d8ccedf926c3cd06e8e2f327027da5afe5f0eb30f1f7bc43ac55125/cffi-2.1.1-cp310-cp310-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:42e2f76b9455f5a9a844f770bf3e200ed3da0e15f5df3db9c31fe80b04b3d004", size = 211037, upload-time = "2026-08-03T21:19:17.705Z" }, + { url = "https://files.pythonhosted.org/packages/a3/b9/0f2e58b2cefa33255bff36935d42b13180fe559bba82596540eb404bde7d/cffi-2.1.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:5a59cc1c4442bc3d5c703bf720b51138d0bfc173618807c9ee2490a7541dd3d9", size = 218652, upload-time = "2026-08-03T21:19:18.735Z" }, + { url = "https://files.pythonhosted.org/packages/37/15/180e0dab27b9312c7479003d14c9e547634b7dcb934e2cc4650e1b131a7a/cffi-2.1.1-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:9f8d177621de5cb38ee3e731eda45d421db093ec0739f46a5594babda7987a98", size = 205422, upload-time = "2026-08-03T21:19:19.96Z" }, + { url = "https://files.pythonhosted.org/packages/18/d4/03026f0c850cbbaa9030750490225b4a7f4d524ea4df72c3cc740a90f4ef/cffi-2.1.1-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:75f80557d1389eddbd0de2681f6a390a0c5338c31ddaa821381c203fc3fd50d9", size = 205444, upload-time = "2026-08-03T21:19:21.246Z" }, + { url = "https://files.pythonhosted.org/packages/75/77/60bebf6f818bec84210ac5b6979ce4eeadce6fbbaabc9c7ab23e506d1ce5/cffi-2.1.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:194cffa889098ced9976c3fc6340305e43f6303657d298da55366907c05c22d6", size = 218742, upload-time = "2026-08-03T21:19:22.523Z" }, + { url = "https://files.pythonhosted.org/packages/b0/ae/679bf47e73fd77b352171727f07de559a003f14de5d02b904a6ec1fa73ca/cffi-2.1.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:5bb4e7ea95dcd6a014a6fef62e62467d67d8e582326443f3d68e71d6320a9fcf", size = 221054, upload-time = "2026-08-03T21:19:23.694Z" }, + { url = "https://files.pythonhosted.org/packages/09/b8/eefc0e06913b70aa153bf74c946094a18f58fd4aff11b7f372bfdfdca050/cffi-2.1.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:3d22a20b1fb1632cc72c22f95f7b0d2961c3e1c235f245ba4c606c4771035659", size = 213489, upload-time = "2026-08-03T21:19:24.922Z" }, + { url = "https://files.pythonhosted.org/packages/6f/13/4e56852824a03cdf68523a35686f1c28eacd4bd30a7b0a78e682e6e6e1d3/cffi-2.1.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:1dea0e4d7d4f11f619fe8c1d76caf49e24405b4b5743c0e3be16a500ecd930c9", size = 220241, upload-time = "2026-08-03T21:19:26.214Z" }, + { url = "https://files.pythonhosted.org/packages/99/7f/040f9e163e4acac3ee3d85b02d00b2576e7ca980d8785f0a3a5f1a9bf7f5/cffi-2.1.1-cp310-cp310-win32.whl", hash = "sha256:7ce713ace7c0e4520535b42b77eaa742c16dab813978064913e5a3cf82973b41", size = 174578, upload-time = "2026-08-03T21:19:27.338Z" }, + { url = "https://files.pythonhosted.org/packages/ba/0b/644a2ec1a4eaba49c2939410bb1eb1d25b09d6d0582f5d2f95c537043725/cffi-2.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:a48d62ab9d6f4f98c983223a547af44be6ca3691074c31cecced6facd3ba2dc1", size = 185082, upload-time = "2026-08-03T21:19:28.409Z" }, + { url = "https://files.pythonhosted.org/packages/70/d2/16d99a0c4948febc0ebd133a13b2f688ff7f8cb04da971e1128872ce0c03/cffi-2.1.1-cp311-cp311-macosx_10_15_x86_64.whl", hash = "sha256:c8d2c9fd1f2d16f780d15127abb050d13d1a76c03a4bd87d7e4980e45e511e12", size = 183838, upload-time = "2026-08-03T21:19:29.637Z" }, + { url = "https://files.pythonhosted.org/packages/cd/95/31b535a9f0220ae9f357de4a08d57ce89cb417653c2fd9f075f50822a388/cffi-2.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:398aff33cee2767e3e781d2554c54bd0dff386bb437581e0d8011fde1a942ec1", size = 184168, upload-time = "2026-08-03T21:19:30.764Z" }, + { url = "https://files.pythonhosted.org/packages/ad/5a/4707a0dc1f203f5dde5a907b0d4e3c25d71120241048bd5bc6f1bb9d4e71/cffi-2.1.1-cp311-cp311-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:154852545011f779917b11c78db2358d095da62a9a172b78ad0a583ee5adc0d0", size = 211805, upload-time = "2026-08-03T21:19:31.867Z" }, + { url = "https://files.pythonhosted.org/packages/ad/66/c19feabb28485b6e0bbaaafa90837a1ef5d302e90f2178bd33f17a49879b/cffi-2.1.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:3311ed60d36f83378794e1009ac6258bafbf81f7888b4caa7b35a521e3f95813", size = 218716, upload-time = "2026-08-03T21:19:32.896Z" }, + { url = "https://files.pythonhosted.org/packages/a7/92/500760486c8baab49a7a8a58ba7fc3355ec3974b454b8a09e528efde9e1d/cffi-2.1.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:6e192623c49c94421616a5778fba35cf0d5a8d000650c1967ef4448ee5cdd990", size = 205569, upload-time = "2026-08-03T21:19:34.142Z" }, + { url = "https://files.pythonhosted.org/packages/a5/a7/a67c733254d6e7373f7822f8082d8d6beade791e0cf12a7611f376fa61c7/cffi-2.1.1-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:a6e721d4b0e45d5b65e87534470e67b18dcd092c83f68fba09f152b9cbc061af", size = 204907, upload-time = "2026-08-03T21:19:35.174Z" }, + { url = "https://files.pythonhosted.org/packages/f7/a4/4399daaf8f7dfee9d7c3327fdb0426ee041cc63edc358b93911ceb2bfc7a/cffi-2.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:34e261f78cb6ceaaa36f42f2613f4380d94d9c759a9c73c769ee6e0247364632", size = 217807, upload-time = "2026-08-03T21:19:36.286Z" }, + { url = "https://files.pythonhosted.org/packages/28/f7/dabe6da2466ecbd82dc62e7342dc6b1065dad990c06f00f0ede9ebf2a0ed/cffi-2.1.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:7225e4514edb64eb6740324353e0da0711954fd8d7da4576755b1c6e09b697cd", size = 221252, upload-time = "2026-08-03T21:19:37.416Z" }, + { url = "https://files.pythonhosted.org/packages/ce/87/616202d8e51342c07d2534c510111c4cc37201775ce8f60802c9335d1edd/cffi-2.1.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:df913725b79db7bcf03448f36b7bf8815363417d5b58deecf9305e3e30f0f21a", size = 214214, upload-time = "2026-08-03T21:19:38.507Z" }, + { url = "https://files.pythonhosted.org/packages/b4/c6/ab025d75d2c26c19b087c0124e75ee31cb65032f4fe345d356d8c507ab97/cffi-2.1.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:f5cfbc5fe74540d335175b656c725d74d90e3730c626d92575eea35029d9afaa", size = 219408, upload-time = "2026-08-03T21:19:39.809Z" }, + { url = "https://files.pythonhosted.org/packages/db/e2/7e8109f65445bdc673a7b54f02c677de462db75674220fd1335efc8eb598/cffi-2.1.1-cp311-cp311-win32.whl", hash = "sha256:f8ec5e643a9a937f64e1999eb9f75d072263751912dc5cd06d3c85f8f44be7c3", size = 174470, upload-time = "2026-08-03T21:19:41.246Z" }, + { url = "https://files.pythonhosted.org/packages/73/c0/77ba02423c2f7d7091143c45cd49e0e6575c4c1967394bb542bd923a9b74/cffi-2.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:42f6930c31dc7f50732c9ae793c2786c7b6b044195967bbdde40bb9be81c4cc0", size = 185096, upload-time = "2026-08-03T21:19:42.615Z" }, + { url = "https://files.pythonhosted.org/packages/7c/47/9f1f85f9672ceda4984dc6c4f8824e8558992a2972c3d3c81fb8eb28d4ba/cffi-2.1.1-cp311-cp311-win_arm64.whl", hash = "sha256:c7659f22557c5a0bc4855cd635f55edec690cc008a40768527762cb9fb263455", size = 179941, upload-time = "2026-08-03T21:19:43.747Z" }, + { url = "https://files.pythonhosted.org/packages/10/69/43965eccfdead3b9220015fd1320e117be8c6ed01a62ffab76eeb752f5d5/cffi-2.1.1-cp312-cp312-macosx_10_15_x86_64.whl", hash = "sha256:c8c69575568085ba0b1b10c0249d779a214aea6f6522e949a0fc9fb0fcb449d0", size = 184821, upload-time = "2026-08-03T21:19:44.887Z" }, + { url = "https://files.pythonhosted.org/packages/54/7d/16e5a096677b5e313ca80cd5e5170efa3ea44624a82bb111925522da64b1/cffi-2.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f81b3b8f3d4e343550fa4baa0e479bba9f2d29ce9c2e9b51d1ce1718d7442fcf", size = 184719, upload-time = "2026-08-03T21:19:46.129Z" }, + { url = "https://files.pythonhosted.org/packages/56/e6/8941622732edec876dd17d0453dce07317ae96db34f2ec1436c9d3785986/cffi-2.1.1-cp312-cp312-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:811bd1e21d32de12efca32393a0ab3f5133b54fce9bd44b8bd77ab07da14bf6a", size = 214799, upload-time = "2026-08-03T21:19:47.218Z" }, + { url = "https://files.pythonhosted.org/packages/44/de/f98430906df1545ffde0d543dd124a7a439bc2cd32b36b9c53f805df7333/cffi-2.1.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:68e62fe11f30d5ca8289242866f0a5291402d8529ca2178ab8afc5c9694ae890", size = 222389, upload-time = "2026-08-03T21:19:48.331Z" }, + { url = "https://files.pythonhosted.org/packages/6a/5b/717f1526b9957b34456313c31645c5b82b8fb5c3fe9e4752999be7128bfc/cffi-2.1.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:4a7c934f7360e8cd64fe9efadcbd10c7c6364f531e432b9a4bf5ccbc9e0e8b50", size = 210249, upload-time = "2026-08-03T21:19:49.543Z" }, + { url = "https://files.pythonhosted.org/packages/64/b3/f8aa4f3e34986c7e4ec45072d1b1b9dd295b6b18007b45518d79726dd725/cffi-2.1.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:3143d81e29e1e20a9ce10901ec369012947876596f75a222235965f2b7ae832e", size = 208775, upload-time = "2026-08-03T21:19:50.918Z" }, + { url = "https://files.pythonhosted.org/packages/b1/db/dceb9dd5b231e1da801793f8acc9f3c52a7e1afe40bb1aae37e02b0faad5/cffi-2.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c1453022f490d2459a11819d83ad1d586e9ff65a12ac3e705ffebd46d3685dcf", size = 221822, upload-time = "2026-08-03T21:19:52.054Z" }, + { url = "https://files.pythonhosted.org/packages/a0/d2/6cd24ae3be000a634109c247d1475d62e5616d0dc78c82770942ec384248/cffi-2.1.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:208f941bb9d18e768138677f0a6d2ce01f590df56043dda1df1535ac57c88517", size = 225232, upload-time = "2026-08-03T21:19:53.109Z" }, + { url = "https://files.pythonhosted.org/packages/cb/52/3fa190537004dd7f0ab860a6dc7c0175b8667f68d1e618a46f5498d30250/cffi-2.1.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:210019b6c7cf07f081b4c54635c8cf744377001350e29cc0f81c4377b4797735", size = 223597, upload-time = "2026-08-03T21:19:54.515Z" }, + { url = "https://files.pythonhosted.org/packages/80/fb/0bb75b7039588c074b37ae99f40d9bfddf990ecb2fbc346ebccd2e56b9be/cffi-2.1.1-cp312-cp312-win32.whl", hash = "sha256:046bfc24911b37851ee1b51aab8bffe713d89c68c6a057b09484ce9fd5f69b4e", size = 175292, upload-time = "2026-08-03T21:19:55.566Z" }, + { url = "https://files.pythonhosted.org/packages/d9/79/615cc094e2fb508cade7de88d3b4f6c4ec2bab695c97bce9153dc65aadf5/cffi-2.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:f53e442b08449d42821fa4a4fba000095af9f62742a500f978a9f557ec44339a", size = 185919, upload-time = "2026-08-03T21:19:56.89Z" }, + { url = "https://files.pythonhosted.org/packages/70/c6/d0ea84713fe46b243a436a18fcd47d639732747e21635c8a27191b06dc30/cffi-2.1.1-cp312-cp312-win_arm64.whl", hash = "sha256:7bde5e4cc5c10140859842b9d383af292b22639a4dffb725314baf45968cef80", size = 180093, upload-time = "2026-08-03T21:19:58.155Z" }, + { url = "https://files.pythonhosted.org/packages/9d/f4/035513d4117049066b4779dc3b7c0c0fdad175fa13731c9f4003f1cd1478/cffi-2.1.1-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:b5bdfd1c873d4e093aabc0ca84c4ca6dbc4f752afb5c86f146d9742580c9da2e", size = 194248, upload-time = "2026-08-03T21:19:59.399Z" }, + { url = "https://files.pythonhosted.org/packages/76/af/2aeb4dbb5fc41a04161ae9ff1518de7cec08e164f44a8ce6a4cf7fd2cd1d/cffi-2.1.1-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:31348097ff5bbe827ccc41795d4dd099d9f0625e7def00ee653c137a490c2a6c", size = 196908, upload-time = "2026-08-03T21:20:00.746Z" }, + { url = "https://files.pythonhosted.org/packages/a7/46/2e5fdde8555706dd98139a910ca11be02809f3f605ce956f655d0214e100/cffi-2.1.1-cp313-cp313-macosx_10_15_x86_64.whl", hash = "sha256:9d2055050ea716bd38b7f7f1579c275386646b4894c155a3e2f3cd62ed41b7c6", size = 184805, upload-time = "2026-08-03T21:20:02.02Z" }, + { url = "https://files.pythonhosted.org/packages/55/41/4c7042f317b9217502988f0873af87e16ad606dc20f84e546e3e6ce9764c/cffi-2.1.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:19ee6127ee34de7d83ce3d371ebc5ed91addbdcc39f9ab15ce4eb35a4e534971", size = 184764, upload-time = "2026-08-03T21:20:03.141Z" }, + { url = "https://files.pythonhosted.org/packages/43/1f/1c3d90d91811c8f86ced9ed637956c54bfe5b79ca98fe976d7f8c8979f6b/cffi-2.1.1-cp313-cp313-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:6a8dddef476fab96d066d578fc88526767b836ab5ab21754e1d5bf3879c31c7c", size = 214722, upload-time = "2026-08-03T21:20:04.377Z" }, + { url = "https://files.pythonhosted.org/packages/37/6f/3b5ce4c3b2192d250f04908f2bfd91ef34552ec8f7716a5d4abdb8d67bb2/cffi-2.1.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:f16c709686a78c727bbbf059f92b0bf41c6fc60deec706d2dc19f529175a6125", size = 222369, upload-time = "2026-08-03T21:20:05.544Z" }, + { url = "https://files.pythonhosted.org/packages/02/10/4b3c75dde3d9663c9e02ba05c2668b954f671d4bbe346413ca8c696b295a/cffi-2.1.1-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:fcd22650c908d7b7da162bbfaab594a1227a15d1643a98c68b122ac642fa2264", size = 210175, upload-time = "2026-08-03T21:20:06.75Z" }, + { url = "https://files.pythonhosted.org/packages/df/62/14f74b9543e605d17701dc797b815958b8bb70b7624ce1b832ddad48ed6c/cffi-2.1.1-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:aa9511c62d14da7aacc9b4bf51f3f697a621e83b2d6919008243c3aad168eea3", size = 208670, upload-time = "2026-08-03T21:20:08.04Z" }, + { url = "https://files.pythonhosted.org/packages/95/95/86342356ff5953b3fb06f7ef7c5bee212d45e770abc7218d451b9148313c/cffi-2.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:a931079504ecc49efed7744c476a5c343a92fabf66dec2db95edb1b2fdc770e2", size = 221824, upload-time = "2026-08-03T21:20:09.274Z" }, + { url = "https://files.pythonhosted.org/packages/eb/ff/7b3429ff53aafe931ed8a5fc69f481bbef7ba6de87ddcbb63d08f483f613/cffi-2.1.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a2d7755bef5a12ed488f4ef1f1b69ee9191d7396083b755a5d2295f6edb4768b", size = 225148, upload-time = "2026-08-03T21:20:10.7Z" }, + { url = "https://files.pythonhosted.org/packages/34/34/a95870b9221e09cf4f2ce3178b1a210abdfe63a1bd357da940418d7b8d15/cffi-2.1.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e0bcb7e0f677f543555d2adff3bf19c05f66cdb4796e5ff602442ab2fe3c4ef7", size = 223564, upload-time = "2026-08-03T21:20:12.165Z" }, + { url = "https://files.pythonhosted.org/packages/70/ea/839b50531021a647fb5e929f72cf97bc1ff702b5472166164b5b6e76b851/cffi-2.1.1-cp313-cp313-win32.whl", hash = "sha256:334644fbac4eff73d985a17a91226df55d0f394160c4cfb880e084c8f7161cac", size = 175263, upload-time = "2026-08-03T21:20:13.559Z" }, + { url = "https://files.pythonhosted.org/packages/60/a6/8b149b2c3f2e11aaa1618ef64500b45f50f22c57a977a4dff1aff1f91042/cffi-2.1.1-cp313-cp313-win_amd64.whl", hash = "sha256:1aa5645c30469b09530c4ebca77ebf8f17618293c58f8549cb1a543a50236e7d", size = 185688, upload-time = "2026-08-03T21:20:14.69Z" }, + { url = "https://files.pythonhosted.org/packages/01/9a/11f687cb39d6a3504060d5242f04f48c735afb4d3d533958a20594890cb2/cffi-2.1.1-cp313-cp313-win_arm64.whl", hash = "sha256:63bbfd5ded17c4840ac07cd8f1c21ba9d9708141f840b324f422f41b207e3973", size = 180078, upload-time = "2026-08-03T21:20:15.917Z" }, + { url = "https://files.pythonhosted.org/packages/d3/7b/d6bbf82b8b96e7391438898c42f5bd96dd02030fd5b64937d248220003e2/cffi-2.1.1-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:7dbb61fe3a7699468030f71bbe5f8a0e326a151daa91beb11a6fc1f980c55e1c", size = 194064, upload-time = "2026-08-03T21:20:17.148Z" }, + { url = "https://files.pythonhosted.org/packages/94/e6/bcc91b283be94735e268487a054004f0aa19947b6348fa367db53230abc8/cffi-2.1.1-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:f24fb43132a4c6b4cb4eb029492919b2db645be6808d738f244fd146c03c32cb", size = 196720, upload-time = "2026-08-03T21:20:18.268Z" }, + { url = "https://files.pythonhosted.org/packages/d9/99/c4b0c17cacdc9c3b8f280026286a9826d6a208c0f047591a3c3ce99b91fd/cffi-2.1.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:d28630f5854ab07ab1fd4aba756de52326c82e6be15d414b12793f1975048b54", size = 184964, upload-time = "2026-08-03T21:20:19.708Z" }, + { url = "https://files.pythonhosted.org/packages/b3/a9/9db617d05d7367c1ad0ab00b3aa6e6f9281edd689b4ee9ea0e5a84e89c97/cffi-2.1.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:661c298b4821edebead0c91edd2b00374d67ad7c5a1f7a91d4442633b79d6a72", size = 184962, upload-time = "2026-08-03T21:20:20.833Z" }, + { url = "https://files.pythonhosted.org/packages/67/b8/b42132ca113dc567d37684437b46ca1dafc885902b02a110a02d5b511857/cffi-2.1.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:58acb8ab8e295e6c5ea12f888cbb13cf21511ef2a3303a23f4325c29d17fe5c1", size = 222328, upload-time = "2026-08-03T21:20:22.118Z" }, + { url = "https://files.pythonhosted.org/packages/80/10/c5c0cbf0a657aecf59ef511409734230bf556f05a0d6c9eed7aa5c0a0166/cffi-2.1.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:456a61fa52d579ebf9df2e9552ead5129855dbaff6c1e5a9b1bc408809bdc062", size = 209985, upload-time = "2026-08-03T21:20:23.401Z" }, + { url = "https://files.pythonhosted.org/packages/d5/6c/bfa0b87b03b9238148beca990292843c9396ba069b54496596594173de7b/cffi-2.1.1-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:a4f00aa42f75d6e4595e8866e748cc1705adc0cddfeb2ca86d0d03993d63ba03", size = 208530, upload-time = "2026-08-03T21:20:24.628Z" }, + { url = "https://files.pythonhosted.org/packages/e9/02/4e7d553a7ac4b4238b38b3c1b80d486e9d4436f8d2acbf87a0997fe3f402/cffi-2.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:b0431303acaea1089ad4b3e9ce4e6518193def1118d4073ca848635ee4ea2e96", size = 221525, upload-time = "2026-08-03T21:20:25.758Z" }, + { url = "https://files.pythonhosted.org/packages/82/1d/a4aaf9babd75acb4d5f223bff71533bee748dd770a382619a798960ee9ba/cffi-2.1.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:64faea20f4e2613363a1a9b9c7dd73058f3ecd00133a511e72ad7c511658f527", size = 225053, upload-time = "2026-08-03T21:20:26.985Z" }, + { url = "https://files.pythonhosted.org/packages/81/10/5dc0e7bdd18e22107054288283380fc97a06ae3f1656a106908d666a3c88/cffi-2.1.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:5c58fe613dc5e5336357eff555824a314d8e43282600435c8d1cb6a7a2fedd13", size = 223213, upload-time = "2026-08-03T21:20:28.277Z" }, + { url = "https://files.pythonhosted.org/packages/0b/e9/d0061c364cde06ee43168a0d076ac1da512cbc380d44767b844ba34fe2b6/cffi-2.1.1-cp314-cp314-win32.whl", hash = "sha256:1a18a57b58cfb21fc28d72e876acf10eaed67a1ed96226f92af4df681d571c4c", size = 177682, upload-time = "2026-08-03T21:20:44.288Z" }, + { url = "https://files.pythonhosted.org/packages/a7/06/1c3e01e3ba14c39f6d10bfbac52753b7e22259e38088e5cfe1d704918690/cffi-2.1.1-cp314-cp314-win_amd64.whl", hash = "sha256:3222ba5d678f80a030e6afbcc33dc1ae5cb45facabb61cee2c7016b8432fde48", size = 187949, upload-time = "2026-08-03T21:20:45.623Z" }, + { url = "https://files.pythonhosted.org/packages/87/5b/da4e39efe18eeb89cf580ea9cfc66b6a7c3eadb808fc0cc1d3a295cb5a5d/cffi-2.1.1-cp314-cp314-win_arm64.whl", hash = "sha256:ab36d55f9ed2d067327667c2fea18dda018eb628dd6347aa01dda6cf1f5d3836", size = 182947, upload-time = "2026-08-03T21:20:46.955Z" }, + { url = "https://files.pythonhosted.org/packages/23/59/40338bf421c5accea1d45158170c87006ef1cd371b05c077e76476949728/cffi-2.1.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:7750c6449dff7864bb9bb27ddfb0267756189201a3afc911d82b3caacd70dfc3", size = 188504, upload-time = "2026-08-03T21:20:29.495Z" }, + { url = "https://files.pythonhosted.org/packages/7d/47/5ecf1023850036e674c77ec4de86182d309ae344e39e7cba984b7df5d647/cffi-2.1.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:0beceaabe56af686895136a2de78db54ecd8e4046b236b8fd6d6cb61389e9bf2", size = 188259, upload-time = "2026-08-03T21:20:31.291Z" }, + { url = "https://files.pythonhosted.org/packages/2a/9c/92934c3bea9f785b23eba304538c0b4d37a2a96d2431eb3a1bc87a11aa19/cffi-2.1.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:49cbc70e6542d4ccccb936558d1064a8012541e78f821f955cff24e357776c94", size = 223864, upload-time = "2026-08-03T21:20:32.571Z" }, + { url = "https://files.pythonhosted.org/packages/4d/45/ba4c93527bc38616a8bd36488acb69a2212d60486794f0c1f318949bbb76/cffi-2.1.1-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:e2d65b31f36619cda3999b78b2aa9632e76b78448e7a56fc4240824200e7c4fc", size = 211538, upload-time = "2026-08-03T21:20:33.808Z" }, + { url = "https://files.pythonhosted.org/packages/80/e9/b6ef565e452acb932fb0cb5443f44a78efbd1233e566f02b5a83855e9115/cffi-2.1.1-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:28907ab9bfb6aa13184cfc17c6b8e1023c5ab6fd7076d8c20a35e59fe04f8f29", size = 210688, upload-time = "2026-08-03T21:20:34.974Z" }, + { url = "https://files.pythonhosted.org/packages/9a/95/eff5f0cee78d2eabc7eebffec40d3fc1876b5f3c95582e018bb4b99601f2/cffi-2.1.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:51b31d1c98274844cfd7838ce00bfc27c7423a4dc00fc0772fc3331c2cc90676", size = 223803, upload-time = "2026-08-03T21:20:36.564Z" }, + { url = "https://files.pythonhosted.org/packages/fa/01/579d39fb8bef00a335a23d83757b44feb24cd6345a2c451b64cb67b9c362/cffi-2.1.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5e7cecbaadb83884793e05828cee59b210b24583b9c7425d0ba6a754fe22eb4e", size = 226763, upload-time = "2026-08-03T21:20:37.816Z" }, + { url = "https://files.pythonhosted.org/packages/8d/b0/0b44f47c60b01b57b6e2bbd92343f13a85a1d93bc46ccf6e47e244acd99c/cffi-2.1.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:25792eac27877609e7bb06d42ff88278a6624fff2ba9bbb523c09616b117e80f", size = 225688, upload-time = "2026-08-03T21:20:38.959Z" }, + { url = "https://files.pythonhosted.org/packages/eb/d2/3b7176cb570a1d3e27faf67b72f591af508036e0d8b2be2ef9af9e8c84bb/cffi-2.1.1-cp314-cp314t-win32.whl", hash = "sha256:8ef53b2de9bcb9197d31854256575d59dbac0cba72ac627bb291ef5eceb74be4", size = 182868, upload-time = "2026-08-03T21:20:40.388Z" }, + { url = "https://files.pythonhosted.org/packages/56/78/31f00c1bcd97c9bbf55f1bfdf5bc809a5de8887473e90bb9960dca825e80/cffi-2.1.1-cp314-cp314t-win_amd64.whl", hash = "sha256:616f097f2fe415bc92a247f02e11f634e1f9e9a83d327e3c915c15089c87869e", size = 194104, upload-time = "2026-08-03T21:20:41.725Z" }, + { url = "https://files.pythonhosted.org/packages/7b/1b/58496f2ed0a35de575250c02a43ab3cc2c04d494a88fed31c1cabc0fd176/cffi-2.1.1-cp314-cp314t-win_arm64.whl", hash = "sha256:ad2c86c495b899d862ea0f4b42891b8713a3bd45dd4105c7fd51c2a72f39f3a5", size = 186402, upload-time = "2026-08-03T21:20:43.042Z" }, + { url = "https://files.pythonhosted.org/packages/c1/8f/9ebe220eab48a093d1a5a5e339ab0dc7316eef3bb04d63c42f0251b61f50/cffi-2.1.1-cp315-cp315-ios_13_0_arm64_iphoneos.whl", hash = "sha256:dddad92b554513a31f272570678ba307fb9f618f05e3d4a5eacafff9eae03e1d", size = 194043, upload-time = "2026-08-03T21:20:48.179Z" }, + { url = "https://files.pythonhosted.org/packages/ff/69/844bad3ece306c4782c2ecb93597035b6690d48704b803914c199da1e8b3/cffi-2.1.1-cp315-cp315-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:da0e573f9f97159390c89d9f1a9e41908b66d408cc5b58d08cf3847d844c531b", size = 196737, upload-time = "2026-08-03T21:20:49.457Z" }, + { url = "https://files.pythonhosted.org/packages/1b/8a/af668013284634733f02d683458a0728739c7d6ddb5e14cb0c20832266fe/cffi-2.1.1-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:fb92203a88b3d3053034db775110081c49d28be6551923805e039924093761e4", size = 184933, upload-time = "2026-08-03T21:20:50.639Z" }, + { url = "https://files.pythonhosted.org/packages/0c/75/2f5207ff6d1a613133b23a5203cc0c2a628313b5eb3974d7956ae3c57950/cffi-2.1.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:2ae64be792b8966f2c69538199728b290e34726562896df1e5dc8ffd8d8188e8", size = 185002, upload-time = "2026-08-03T21:20:52.173Z" }, + { url = "https://files.pythonhosted.org/packages/e2/31/9e1313b0a6e30e91b3b3d3fff51ae99c857c07738e3afcce1f7334e1b7ab/cffi-2.1.1-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:507a24c282e0f42f8ed737cf048572cbf580468da5555764a8331735e9c736b6", size = 222271, upload-time = "2026-08-03T21:20:53.462Z" }, + { url = "https://files.pythonhosted.org/packages/50/e3/f6234a833e6e08c7007003074723c406559eecf9b48dfc97471e5a8eb7a0/cffi-2.1.1-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:246fa40ce8645a614ff682e0b70f37134e460eaf93a775e0cbe3cca585a67a80", size = 209919, upload-time = "2026-08-03T21:20:54.783Z" }, + { url = "https://files.pythonhosted.org/packages/0d/fc/5f74e293fced6edb51af3a46c4ccf6c23c9943774ecb375ddbd522c76add/cffi-2.1.1-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:471cee653ae88de62096552e6d24ccb4a5adb8c8c9f10b5054d0122c15bf2779", size = 208529, upload-time = "2026-08-03T21:20:56.066Z" }, + { url = "https://files.pythonhosted.org/packages/44/16/29e6d01b388bef055ecd6ca8244b3f4d336bd09e92d5d892187b9601084e/cffi-2.1.1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:aeae0e330c9f6acd681f647d46cefd30c29f93e3392882e792e82080c9691399", size = 221630, upload-time = "2026-08-03T21:20:57.336Z" }, + { url = "https://files.pythonhosted.org/packages/a4/18/fa7f1f6857d5eb88a4ca99ffcbfb7c387a287ccc154c64a73e86314745d7/cffi-2.1.1-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:42a494cee34437f05546455144f2b5d9ac09b1face62bcfce597d2e521066688", size = 225134, upload-time = "2026-08-03T21:20:58.675Z" }, + { url = "https://files.pythonhosted.org/packages/e0/9f/e8e3dfa04a1b4c241f8c91faacad872b4d4efd051d49764ad4e2fd4b9fea/cffi-2.1.1-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:cc572dace3f60ef98d7b12ff411d20f5362feb31a0439eab0085bbfd349982d7", size = 223197, upload-time = "2026-08-03T21:20:59.968Z" }, + { url = "https://files.pythonhosted.org/packages/f8/7e/8debeb04f1ab9fe2a6963964cd6f1aaf7192627b83926586a6a4e089c9fa/cffi-2.1.1-cp315-cp315-win32.whl", hash = "sha256:4f42141fc14250de6dde5ee7ea4432be017252d91f19c5ad043c084cea629cac", size = 177683, upload-time = "2026-08-03T21:21:14.901Z" }, + { url = "https://files.pythonhosted.org/packages/e0/31/5158704cc474ab65c1647932e88be78dc0873f47130e253be38bcaf13d01/cffi-2.1.1-cp315-cp315-win_amd64.whl", hash = "sha256:e6e8cff14d6fb0be70a09c0bdc58096f501952d04624ebf867e0e56da2df8960", size = 187897, upload-time = "2026-08-03T21:21:16.108Z" }, + { url = "https://files.pythonhosted.org/packages/cc/4b/b3a2da8570c704ffc0f9762cdc3ec0f02c8573798e0b5cf7f11c82bbb70f/cffi-2.1.1-cp315-cp315-win_arm64.whl", hash = "sha256:27350daa11d4f10c540e6e89dada4c54feb7256ad03e9a4dc075ebad7ba360d1", size = 182935, upload-time = "2026-08-03T21:21:17.271Z" }, + { url = "https://files.pythonhosted.org/packages/d0/ef/5443574510a1207e6f6bc38ba6e1f1de36cb48fef07b2728bb896a21f430/cffi-2.1.1-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:c26608d2222fb1e94487e4a387d85f13eb55d5ed725cb25a0c589ac4ee60e7bc", size = 188464, upload-time = "2026-08-03T21:21:01.163Z" }, + { url = "https://files.pythonhosted.org/packages/7e/ae/a56fa8c4686ad50e148fcbc8d3ae0d03915ff5c30d795058988c24118cef/cffi-2.1.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:4be96343e422f2dfcd12ab5c9f5aebe03f82f737c6bffeca6830b3875cb44aab", size = 188262, upload-time = "2026-08-03T21:21:02.382Z" }, + { url = "https://files.pythonhosted.org/packages/53/b2/6187f46f2912276a3ae284076109cc5c8680482f11f766ccf26db4a86427/cffi-2.1.1-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:937c0052c05a31ca1daf18de3158eed4dbfcb9cc107adbea227728d647be701e", size = 223779, upload-time = "2026-08-03T21:21:03.553Z" }, + { url = "https://files.pythonhosted.org/packages/8a/f6/c3ad28bd19f77047a03084424fbd4cbe997303267c14423737324be0385d/cffi-2.1.1-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:df423d40ee8654634421812bc3b196da3f9bd7d32929da813f8394c4348a5358", size = 211520, upload-time = "2026-08-03T21:21:04.863Z" }, + { url = "https://files.pythonhosted.org/packages/a0/cd/ccac9013a5bd9fd764de118674ab9c805b5ca10c19270d90ee273f8b2240/cffi-2.1.1-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:a730a083190634c65cca36ba5f489531576ebd79bcd5c8e172130f6453127231", size = 210673, upload-time = "2026-08-03T21:21:06.223Z" }, + { url = "https://files.pythonhosted.org/packages/52/86/2976131c639aead931c5bee5aba67e4b09fbeb8018b6f282f70803f923a7/cffi-2.1.1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:363e05fa78e15116c3c32c210ee36884fd6b9afa6d440e47112c3bd511d64cb6", size = 223835, upload-time = "2026-08-03T21:21:07.539Z" }, + { url = "https://files.pythonhosted.org/packages/ac/0c/33a7aeab2f9c76918c52e084beb39c570db3588133412929e8ec06fab90b/cffi-2.1.1-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:770de9db11e84213beec501cfcaa013b019820ca881e03344dea5844f7876d94", size = 226705, upload-time = "2026-08-03T21:21:08.774Z" }, + { url = "https://files.pythonhosted.org/packages/e3/26/2cde30fdde421130bfc18f70395731a6e6b2053c6a1978a5258ff04e72fa/cffi-2.1.1-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:7da0c5eff80f0197f3b3d1232ec5a682a9325f4ae9016a78f5f5ca35f9ced1f5", size = 225539, upload-time = "2026-08-03T21:21:09.911Z" }, + { url = "https://files.pythonhosted.org/packages/6d/cd/a361394c94b2129d604bb846f624a8e88255a3ee33129c434a00d715e64f/cffi-2.1.1-cp315-cp315t-win32.whl", hash = "sha256:06c72bb76605a4b0cd0aad6930b69d4baf7dd5d806cfc409b824191099700e66", size = 182707, upload-time = "2026-08-03T21:21:11.226Z" }, + { url = "https://files.pythonhosted.org/packages/9b/b5/ba2b299993c26577d529b6ae29841f9e15b9fcf004d65f423f4fcf94ade9/cffi-2.1.1-cp315-cp315t-win_amd64.whl", hash = "sha256:d9c275eaacd24aa73f94ffd6de08fc3f932424d8b6c376f4bed7cde376fe7bc3", size = 193772, upload-time = "2026-08-03T21:21:12.39Z" }, + { url = "https://files.pythonhosted.org/packages/aa/29/35e016098c814cd93de9cd320c66b5bfba14dc6ecedd3cb518fa7c408c69/cffi-2.1.1-cp315-cp315t-win_arm64.whl", hash = "sha256:d18e5ac0f2f03f4f518d3e23db0f0cad7faa1da8620e9c09461d443bbf6e6692", size = 186360, upload-time = "2026-08-03T21:21:13.636Z" }, ] [[package]] name = "click" -version = "8.3.0" +version = "8.5.0" source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "colorama", marker = "sys_platform == 'win32'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/46/61/de6cd827efad202d7057d93e0fed9294b96952e188f7384832791c7b2254/click-8.3.0.tar.gz", hash = "sha256:e7b8232224eba16f4ebe410c25ced9f7875cb5f3263ffc93cc3e8da705e229c4", size = 276943, upload-time = "2025-09-18T17:32:23.696Z" } +sdist = { url = "https://files.pythonhosted.org/packages/c7/0e/7fa0ef50764b67090eca4114772a2abf8b6148198475e54c660b97caeee6/click-8.5.0.tar.gz", hash = "sha256:ba0d2089de75ea0310e2dde03160e6ca10009947fb95a182f9b54021bb272e34", size = 382235, upload-time = "2026-08-26T13:33:14.56Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/db/d3/9dcc0f5797f070ec8edf30fbadfb200e71d9db6b84d211e3b2085a7589a0/click-8.3.0-py3-none-any.whl", hash = "sha256:9b9f285302c6e3064f4330c05f05b81945b2a39544279343e6e7c5f27a9baddc", size = 107295, upload-time = "2025-09-18T17:32:22.42Z" }, + { url = "https://files.pythonhosted.org/packages/58/50/6c0d534c5f134586a8e1ba4e330569e32f057e33372ae556463212fb4cd3/click-8.5.0-py3-none-any.whl", hash = "sha256:255bc9599cf7748b4b1a446ccc735421bd08a2ae529a8b88597d3de5664ee360", size = 125251, upload-time = "2026-08-26T13:33:12.928Z" }, ] [[package]] @@ -428,101 +465,130 @@ wheels = [ [[package]] name = "coverage" -version = "7.11.0" +version = "7.15.4" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/1c/38/ee22495420457259d2f3390309505ea98f98a5eed40901cf62196abad006/coverage-7.11.0.tar.gz", hash = "sha256:167bd504ac1ca2af7ff3b81d245dfea0292c5032ebef9d66cc08a7d28c1b8050", size = 811905, upload-time = "2025-10-15T15:15:08.542Z" } +sdist = { url = "https://files.pythonhosted.org/packages/be/c3/4f2195f512fb172aa425a8803a874b2baa9ba7f80ff7b6080998761fc701/coverage-7.15.4.tar.gz", hash = "sha256:0548198fff07ccf4faf469520bce1c2eceb1ce3e62891921138dec10907f9d00", size = 936952, upload-time = "2026-08-06T13:50:24.442Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/12/95/c49df0aceb5507a80b9fe5172d3d39bf23f05be40c23c8d77d556df96cec/coverage-7.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:eb53f1e8adeeb2e78962bade0c08bfdc461853c7969706ed901821e009b35e31", size = 215800, upload-time = "2025-10-15T15:12:19.824Z" }, - { url = "https://files.pythonhosted.org/packages/dc/c6/7bb46ce01ed634fff1d7bb53a54049f539971862cc388b304ff3c51b4f66/coverage-7.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d9a03ec6cb9f40a5c360f138b88266fd8f58408d71e89f536b4f91d85721d075", size = 216198, upload-time = "2025-10-15T15:12:22.549Z" }, - { url = "https://files.pythonhosted.org/packages/94/b2/75d9d8fbf2900268aca5de29cd0a0fe671b0f69ef88be16767cc3c828b85/coverage-7.11.0-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:0d7f0616c557cbc3d1c2090334eddcbb70e1ae3a40b07222d62b3aa47f608fab", size = 242953, upload-time = "2025-10-15T15:12:24.139Z" }, - { url = "https://files.pythonhosted.org/packages/65/ac/acaa984c18f440170525a8743eb4b6c960ace2dbad80dc22056a437fc3c6/coverage-7.11.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:e44a86a47bbdf83b0a3ea4d7df5410d6b1a0de984fbd805fa5101f3624b9abe0", size = 244766, upload-time = "2025-10-15T15:12:25.974Z" }, - { url = "https://files.pythonhosted.org/packages/d8/0d/938d0bff76dfa4a6b228c3fc4b3e1c0e2ad4aa6200c141fcda2bd1170227/coverage-7.11.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:596763d2f9a0ee7eec6e643e29660def2eef297e1de0d334c78c08706f1cb785", size = 246625, upload-time = "2025-10-15T15:12:27.387Z" }, - { url = "https://files.pythonhosted.org/packages/38/54/8f5f5e84bfa268df98f46b2cb396b1009734cfb1e5d6adb663d284893b32/coverage-7.11.0-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ef55537ff511b5e0a43edb4c50a7bf7ba1c3eea20b4f49b1490f1e8e0e42c591", size = 243568, upload-time = "2025-10-15T15:12:28.799Z" }, - { url = "https://files.pythonhosted.org/packages/68/30/8ba337c2877fe3f2e1af0ed7ff4be0c0c4aca44d6f4007040f3ca2255e99/coverage-7.11.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:9cbabd8f4d0d3dc571d77ae5bdbfa6afe5061e679a9d74b6797c48d143307088", size = 244665, upload-time = "2025-10-15T15:12:30.297Z" }, - { url = "https://files.pythonhosted.org/packages/cc/fb/c6f1d6d9a665536b7dde2333346f0cc41dc6a60bd1ffc10cd5c33e7eb000/coverage-7.11.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e24045453384e0ae2a587d562df2a04d852672eb63051d16096d3f08aa4c7c2f", size = 242681, upload-time = "2025-10-15T15:12:32.326Z" }, - { url = "https://files.pythonhosted.org/packages/be/38/1b532319af5f991fa153c20373291dc65c2bf532af7dbcffdeef745c8f79/coverage-7.11.0-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:7161edd3426c8d19bdccde7d49e6f27f748f3c31cc350c5de7c633fea445d866", size = 242912, upload-time = "2025-10-15T15:12:34.079Z" }, - { url = "https://files.pythonhosted.org/packages/67/3d/f39331c60ef6050d2a861dc1b514fa78f85f792820b68e8c04196ad733d6/coverage-7.11.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:3d4ed4de17e692ba6415b0587bc7f12bc80915031fc9db46a23ce70fc88c9841", size = 243559, upload-time = "2025-10-15T15:12:35.809Z" }, - { url = "https://files.pythonhosted.org/packages/4b/55/cb7c9df9d0495036ce582a8a2958d50c23cd73f84a23284bc23bd4711a6f/coverage-7.11.0-cp310-cp310-win32.whl", hash = "sha256:765c0bc8fe46f48e341ef737c91c715bd2a53a12792592296a095f0c237e09cf", size = 218266, upload-time = "2025-10-15T15:12:37.429Z" }, - { url = "https://files.pythonhosted.org/packages/68/a8/b79cb275fa7bd0208767f89d57a1b5f6ba830813875738599741b97c2e04/coverage-7.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:24d6f3128f1b2d20d84b24f4074475457faedc3d4613a7e66b5e769939c7d969", size = 219169, upload-time = "2025-10-15T15:12:39.25Z" }, - { url = "https://files.pythonhosted.org/packages/49/3a/ee1074c15c408ddddddb1db7dd904f6b81bc524e01f5a1c5920e13dbde23/coverage-7.11.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3d58ecaa865c5b9fa56e35efc51d1014d4c0d22838815b9fce57a27dd9576847", size = 215912, upload-time = "2025-10-15T15:12:40.665Z" }, - { url = "https://files.pythonhosted.org/packages/70/c4/9f44bebe5cb15f31608597b037d78799cc5f450044465bcd1ae8cb222fe1/coverage-7.11.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b679e171f1c104a5668550ada700e3c4937110dbdd153b7ef9055c4f1a1ee3cc", size = 216310, upload-time = "2025-10-15T15:12:42.461Z" }, - { url = "https://files.pythonhosted.org/packages/42/01/5e06077cfef92d8af926bdd86b84fb28bf9bc6ad27343d68be9b501d89f2/coverage-7.11.0-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:ca61691ba8c5b6797deb221a0d09d7470364733ea9c69425a640f1f01b7c5bf0", size = 246706, upload-time = "2025-10-15T15:12:44.001Z" }, - { url = "https://files.pythonhosted.org/packages/40/b8/7a3f1f33b35cc4a6c37e759137533119560d06c0cc14753d1a803be0cd4a/coverage-7.11.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:aef1747ede4bd8ca9cfc04cc3011516500c6891f1b33a94add3253f6f876b7b7", size = 248634, upload-time = "2025-10-15T15:12:45.768Z" }, - { url = "https://files.pythonhosted.org/packages/7a/41/7f987eb33de386bc4c665ab0bf98d15fcf203369d6aacae74f5dd8ec489a/coverage-7.11.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a1839d08406e4cba2953dcc0ffb312252f14d7c4c96919f70167611f4dee2623", size = 250741, upload-time = "2025-10-15T15:12:47.222Z" }, - { url = "https://files.pythonhosted.org/packages/23/c1/a4e0ca6a4e83069fb8216b49b30a7352061ca0cb38654bd2dc96b7b3b7da/coverage-7.11.0-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e0eb0a2dcc62478eb5b4cbb80b97bdee852d7e280b90e81f11b407d0b81c4287", size = 246837, upload-time = "2025-10-15T15:12:48.904Z" }, - { url = "https://files.pythonhosted.org/packages/5d/03/ced062a17f7c38b4728ff76c3acb40d8465634b20b4833cdb3cc3a74e115/coverage-7.11.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:bc1fbea96343b53f65d5351d8fd3b34fd415a2670d7c300b06d3e14a5af4f552", size = 248429, upload-time = "2025-10-15T15:12:50.73Z" }, - { url = "https://files.pythonhosted.org/packages/97/af/a7c6f194bb8c5a2705ae019036b8fe7f49ea818d638eedb15fdb7bed227c/coverage-7.11.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:214b622259dd0cf435f10241f1333d32caa64dbc27f8790ab693428a141723de", size = 246490, upload-time = "2025-10-15T15:12:52.646Z" }, - { url = "https://files.pythonhosted.org/packages/ab/c3/aab4df02b04a8fde79068c3c41ad7a622b0ef2b12e1ed154da986a727c3f/coverage-7.11.0-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:258d9967520cca899695d4eb7ea38be03f06951d6ca2f21fb48b1235f791e601", size = 246208, upload-time = "2025-10-15T15:12:54.586Z" }, - { url = "https://files.pythonhosted.org/packages/30/d8/e282ec19cd658238d60ed404f99ef2e45eed52e81b866ab1518c0d4163cf/coverage-7.11.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:cf9e6ff4ca908ca15c157c409d608da77a56a09877b97c889b98fb2c32b6465e", size = 247126, upload-time = "2025-10-15T15:12:56.485Z" }, - { url = "https://files.pythonhosted.org/packages/d1/17/a635fa07fac23adb1a5451ec756216768c2767efaed2e4331710342a3399/coverage-7.11.0-cp311-cp311-win32.whl", hash = "sha256:fcc15fc462707b0680cff6242c48625da7f9a16a28a41bb8fd7a4280920e676c", size = 218314, upload-time = "2025-10-15T15:12:58.365Z" }, - { url = "https://files.pythonhosted.org/packages/2a/29/2ac1dfcdd4ab9a70026edc8d715ece9b4be9a1653075c658ee6f271f394d/coverage-7.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:865965bf955d92790f1facd64fe7ff73551bd2c1e7e6b26443934e9701ba30b9", size = 219203, upload-time = "2025-10-15T15:12:59.902Z" }, - { url = "https://files.pythonhosted.org/packages/03/21/5ce8b3a0133179115af4c041abf2ee652395837cb896614beb8ce8ddcfd9/coverage-7.11.0-cp311-cp311-win_arm64.whl", hash = "sha256:5693e57a065760dcbeb292d60cc4d0231a6d4b6b6f6a3191561e1d5e8820b745", size = 217879, upload-time = "2025-10-15T15:13:01.35Z" }, - { url = "https://files.pythonhosted.org/packages/c4/db/86f6906a7c7edc1a52b2c6682d6dd9be775d73c0dfe2b84f8923dfea5784/coverage-7.11.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:9c49e77811cf9d024b95faf86c3f059b11c0c9be0b0d61bc598f453703bd6fd1", size = 216098, upload-time = "2025-10-15T15:13:02.916Z" }, - { url = "https://files.pythonhosted.org/packages/21/54/e7b26157048c7ba555596aad8569ff903d6cd67867d41b75287323678ede/coverage-7.11.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a61e37a403a778e2cda2a6a39abcc895f1d984071942a41074b5c7ee31642007", size = 216331, upload-time = "2025-10-15T15:13:04.403Z" }, - { url = "https://files.pythonhosted.org/packages/b9/19/1ce6bf444f858b83a733171306134a0544eaddf1ca8851ede6540a55b2ad/coverage-7.11.0-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:c79cae102bb3b1801e2ef1511fb50e91ec83a1ce466b2c7c25010d884336de46", size = 247825, upload-time = "2025-10-15T15:13:05.92Z" }, - { url = "https://files.pythonhosted.org/packages/71/0b/d3bcbbc259fcced5fb67c5d78f6e7ee965f49760c14afd931e9e663a83b2/coverage-7.11.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:16ce17ceb5d211f320b62df002fa7016b7442ea0fd260c11cec8ce7730954893", size = 250573, upload-time = "2025-10-15T15:13:07.471Z" }, - { url = "https://files.pythonhosted.org/packages/58/8d/b0ff3641a320abb047258d36ed1c21d16be33beed4152628331a1baf3365/coverage-7.11.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:80027673e9d0bd6aef86134b0771845e2da85755cf686e7c7c59566cf5a89115", size = 251706, upload-time = "2025-10-15T15:13:09.4Z" }, - { url = "https://files.pythonhosted.org/packages/59/c8/5a586fe8c7b0458053d9c687f5cff515a74b66c85931f7fe17a1c958b4ac/coverage-7.11.0-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:4d3ffa07a08657306cd2215b0da53761c4d73cb54d9143b9303a6481ec0cd415", size = 248221, upload-time = "2025-10-15T15:13:10.964Z" }, - { url = "https://files.pythonhosted.org/packages/d0/ff/3a25e3132804ba44cfa9a778cdf2b73dbbe63ef4b0945e39602fc896ba52/coverage-7.11.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a3b6a5f8b2524fd6c1066bc85bfd97e78709bb5e37b5b94911a6506b65f47186", size = 249624, upload-time = "2025-10-15T15:13:12.5Z" }, - { url = "https://files.pythonhosted.org/packages/c5/12/ff10c8ce3895e1b17a73485ea79ebc1896a9e466a9d0f4aef63e0d17b718/coverage-7.11.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:fcc0a4aa589de34bc56e1a80a740ee0f8c47611bdfb28cd1849de60660f3799d", size = 247744, upload-time = "2025-10-15T15:13:14.554Z" }, - { url = "https://files.pythonhosted.org/packages/16/02/d500b91f5471b2975947e0629b8980e5e90786fe316b6d7299852c1d793d/coverage-7.11.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:dba82204769d78c3fd31b35c3d5f46e06511936c5019c39f98320e05b08f794d", size = 247325, upload-time = "2025-10-15T15:13:16.438Z" }, - { url = "https://files.pythonhosted.org/packages/77/11/dee0284fbbd9cd64cfce806b827452c6df3f100d9e66188e82dfe771d4af/coverage-7.11.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:81b335f03ba67309a95210caf3eb43bd6fe75a4e22ba653ef97b4696c56c7ec2", size = 249180, upload-time = "2025-10-15T15:13:17.959Z" }, - { url = "https://files.pythonhosted.org/packages/59/1b/cdf1def928f0a150a057cab03286774e73e29c2395f0d30ce3d9e9f8e697/coverage-7.11.0-cp312-cp312-win32.whl", hash = "sha256:037b2d064c2f8cc8716fe4d39cb705779af3fbf1ba318dc96a1af858888c7bb5", size = 218479, upload-time = "2025-10-15T15:13:19.608Z" }, - { url = "https://files.pythonhosted.org/packages/ff/55/e5884d55e031da9c15b94b90a23beccc9d6beee65e9835cd6da0a79e4f3a/coverage-7.11.0-cp312-cp312-win_amd64.whl", hash = "sha256:d66c0104aec3b75e5fd897e7940188ea1892ca1d0235316bf89286d6a22568c0", size = 219290, upload-time = "2025-10-15T15:13:21.593Z" }, - { url = "https://files.pythonhosted.org/packages/23/a8/faa930cfc71c1d16bc78f9a19bb73700464f9c331d9e547bfbc1dbd3a108/coverage-7.11.0-cp312-cp312-win_arm64.whl", hash = "sha256:d91ebeac603812a09cf6a886ba6e464f3bbb367411904ae3790dfe28311b15ad", size = 217924, upload-time = "2025-10-15T15:13:23.39Z" }, - { url = "https://files.pythonhosted.org/packages/60/7f/85e4dfe65e400645464b25c036a26ac226cf3a69d4a50c3934c532491cdd/coverage-7.11.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:cc3f49e65ea6e0d5d9bd60368684fe52a704d46f9e7fc413918f18d046ec40e1", size = 216129, upload-time = "2025-10-15T15:13:25.371Z" }, - { url = "https://files.pythonhosted.org/packages/96/5d/dc5fa98fea3c175caf9d360649cb1aa3715e391ab00dc78c4c66fabd7356/coverage-7.11.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f39ae2f63f37472c17b4990f794035c9890418b1b8cca75c01193f3c8d3e01be", size = 216380, upload-time = "2025-10-15T15:13:26.976Z" }, - { url = "https://files.pythonhosted.org/packages/b2/f5/3da9cc9596708273385189289c0e4d8197d37a386bdf17619013554b3447/coverage-7.11.0-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:7db53b5cdd2917b6eaadd0b1251cf4e7d96f4a8d24e174bdbdf2f65b5ea7994d", size = 247375, upload-time = "2025-10-15T15:13:28.923Z" }, - { url = "https://files.pythonhosted.org/packages/65/6c/f7f59c342359a235559d2bc76b0c73cfc4bac7d61bb0df210965cb1ecffd/coverage-7.11.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:10ad04ac3a122048688387828b4537bc9cf60c0bf4869c1e9989c46e45690b82", size = 249978, upload-time = "2025-10-15T15:13:30.525Z" }, - { url = "https://files.pythonhosted.org/packages/e7/8c/042dede2e23525e863bf1ccd2b92689692a148d8b5fd37c37899ba882645/coverage-7.11.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4036cc9c7983a2b1f2556d574d2eb2154ac6ed55114761685657e38782b23f52", size = 251253, upload-time = "2025-10-15T15:13:32.174Z" }, - { url = "https://files.pythonhosted.org/packages/7b/a9/3c58df67bfa809a7bddd786356d9c5283e45d693edb5f3f55d0986dd905a/coverage-7.11.0-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:7ab934dd13b1c5e94b692b1e01bd87e4488cb746e3a50f798cb9464fd128374b", size = 247591, upload-time = "2025-10-15T15:13:34.147Z" }, - { url = "https://files.pythonhosted.org/packages/26/5b/c7f32efd862ee0477a18c41e4761305de6ddd2d49cdeda0c1116227570fd/coverage-7.11.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:59a6e5a265f7cfc05f76e3bb53eca2e0dfe90f05e07e849930fecd6abb8f40b4", size = 249411, upload-time = "2025-10-15T15:13:38.425Z" }, - { url = "https://files.pythonhosted.org/packages/76/b5/78cb4f1e86c1611431c990423ec0768122905b03837e1b4c6a6f388a858b/coverage-7.11.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:df01d6c4c81e15a7c88337b795bb7595a8596e92310266b5072c7e301168efbd", size = 247303, upload-time = "2025-10-15T15:13:40.464Z" }, - { url = "https://files.pythonhosted.org/packages/87/c9/23c753a8641a330f45f221286e707c427e46d0ffd1719b080cedc984ec40/coverage-7.11.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:8c934bd088eed6174210942761e38ee81d28c46de0132ebb1801dbe36a390dcc", size = 247157, upload-time = "2025-10-15T15:13:42.087Z" }, - { url = "https://files.pythonhosted.org/packages/c5/42/6e0cc71dc8a464486e944a4fa0d85bdec031cc2969e98ed41532a98336b9/coverage-7.11.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5a03eaf7ec24078ad64a07f02e30060aaf22b91dedf31a6b24d0d98d2bba7f48", size = 248921, upload-time = "2025-10-15T15:13:43.715Z" }, - { url = "https://files.pythonhosted.org/packages/e8/1c/743c2ef665e6858cccb0f84377dfe3a4c25add51e8c7ef19249be92465b6/coverage-7.11.0-cp313-cp313-win32.whl", hash = "sha256:695340f698a5f56f795b2836abe6fb576e7c53d48cd155ad2f80fd24bc63a040", size = 218526, upload-time = "2025-10-15T15:13:45.336Z" }, - { url = "https://files.pythonhosted.org/packages/ff/d5/226daadfd1bf8ddbccefbd3aa3547d7b960fb48e1bdac124e2dd13a2b71a/coverage-7.11.0-cp313-cp313-win_amd64.whl", hash = "sha256:2727d47fce3ee2bac648528e41455d1b0c46395a087a229deac75e9f88ba5a05", size = 219317, upload-time = "2025-10-15T15:13:47.401Z" }, - { url = "https://files.pythonhosted.org/packages/97/54/47db81dcbe571a48a298f206183ba8a7ba79200a37cd0d9f4788fcd2af4a/coverage-7.11.0-cp313-cp313-win_arm64.whl", hash = "sha256:0efa742f431529699712b92ecdf22de8ff198df41e43aeaaadf69973eb93f17a", size = 217948, upload-time = "2025-10-15T15:13:49.096Z" }, - { url = "https://files.pythonhosted.org/packages/e5/8b/cb68425420154e7e2a82fd779a8cc01549b6fa83c2ad3679cd6c088ebd07/coverage-7.11.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:587c38849b853b157706407e9ebdca8fd12f45869edb56defbef2daa5fb0812b", size = 216837, upload-time = "2025-10-15T15:13:51.09Z" }, - { url = "https://files.pythonhosted.org/packages/33/55/9d61b5765a025685e14659c8d07037247de6383c0385757544ffe4606475/coverage-7.11.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:b971bdefdd75096163dd4261c74be813c4508477e39ff7b92191dea19f24cd37", size = 217061, upload-time = "2025-10-15T15:13:52.747Z" }, - { url = "https://files.pythonhosted.org/packages/52/85/292459c9186d70dcec6538f06ea251bc968046922497377bf4a1dc9a71de/coverage-7.11.0-cp313-cp313t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:269bfe913b7d5be12ab13a95f3a76da23cf147be7fa043933320ba5625f0a8de", size = 258398, upload-time = "2025-10-15T15:13:54.45Z" }, - { url = "https://files.pythonhosted.org/packages/1f/e2/46edd73fb8bf51446c41148d81944c54ed224854812b6ca549be25113ee0/coverage-7.11.0-cp313-cp313t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:dadbcce51a10c07b7c72b0ce4a25e4b6dcb0c0372846afb8e5b6307a121eb99f", size = 260574, upload-time = "2025-10-15T15:13:56.145Z" }, - { url = "https://files.pythonhosted.org/packages/07/5e/1df469a19007ff82e2ca8fe509822820a31e251f80ee7344c34f6cd2ec43/coverage-7.11.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9ed43fa22c6436f7957df036331f8fe4efa7af132054e1844918866cd228af6c", size = 262797, upload-time = "2025-10-15T15:13:58.635Z" }, - { url = "https://files.pythonhosted.org/packages/f9/50/de216b31a1434b94d9b34a964c09943c6be45069ec704bfc379d8d89a649/coverage-7.11.0-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9516add7256b6713ec08359b7b05aeff8850c98d357784c7205b2e60aa2513fa", size = 257361, upload-time = "2025-10-15T15:14:00.409Z" }, - { url = "https://files.pythonhosted.org/packages/82/1e/3f9f8344a48111e152e0fd495b6fff13cc743e771a6050abf1627a7ba918/coverage-7.11.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:eb92e47c92fcbcdc692f428da67db33337fa213756f7adb6a011f7b5a7a20740", size = 260349, upload-time = "2025-10-15T15:14:02.188Z" }, - { url = "https://files.pythonhosted.org/packages/65/9b/3f52741f9e7d82124272f3070bbe316006a7de1bad1093f88d59bfc6c548/coverage-7.11.0-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:d06f4fc7acf3cabd6d74941d53329e06bab00a8fe10e4df2714f0b134bfc64ef", size = 258114, upload-time = "2025-10-15T15:14:03.907Z" }, - { url = "https://files.pythonhosted.org/packages/0b/8b/918f0e15f0365d50d3986bbd3338ca01178717ac5678301f3f547b6619e6/coverage-7.11.0-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:6fbcee1a8f056af07ecd344482f711f563a9eb1c2cad192e87df00338ec3cdb0", size = 256723, upload-time = "2025-10-15T15:14:06.324Z" }, - { url = "https://files.pythonhosted.org/packages/44/9e/7776829f82d3cf630878a7965a7d70cc6ca94f22c7d20ec4944f7148cb46/coverage-7.11.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:dbbf012be5f32533a490709ad597ad8a8ff80c582a95adc8d62af664e532f9ca", size = 259238, upload-time = "2025-10-15T15:14:08.002Z" }, - { url = "https://files.pythonhosted.org/packages/9a/b8/49cf253e1e7a3bedb85199b201862dd7ca4859f75b6cf25ffa7298aa0760/coverage-7.11.0-cp313-cp313t-win32.whl", hash = "sha256:cee6291bb4fed184f1c2b663606a115c743df98a537c969c3c64b49989da96c2", size = 219180, upload-time = "2025-10-15T15:14:09.786Z" }, - { url = "https://files.pythonhosted.org/packages/ac/e1/1a541703826be7ae2125a0fb7f821af5729d56bb71e946e7b933cc7a89a4/coverage-7.11.0-cp313-cp313t-win_amd64.whl", hash = "sha256:a386c1061bf98e7ea4758e4313c0ab5ecf57af341ef0f43a0bf26c2477b5c268", size = 220241, upload-time = "2025-10-15T15:14:11.471Z" }, - { url = "https://files.pythonhosted.org/packages/d5/d1/5ee0e0a08621140fd418ec4020f595b4d52d7eb429ae6a0c6542b4ba6f14/coverage-7.11.0-cp313-cp313t-win_arm64.whl", hash = "sha256:f9ea02ef40bb83823b2b04964459d281688fe173e20643870bb5d2edf68bc836", size = 218510, upload-time = "2025-10-15T15:14:13.46Z" }, - { url = "https://files.pythonhosted.org/packages/f4/06/e923830c1985ce808e40a3fa3eb46c13350b3224b7da59757d37b6ce12b8/coverage-7.11.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:c770885b28fb399aaf2a65bbd1c12bf6f307ffd112d6a76c5231a94276f0c497", size = 216110, upload-time = "2025-10-15T15:14:15.157Z" }, - { url = "https://files.pythonhosted.org/packages/42/82/cdeed03bfead45203fb651ed756dfb5266028f5f939e7f06efac4041dad5/coverage-7.11.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:a3d0e2087dba64c86a6b254f43e12d264b636a39e88c5cc0a01a7c71bcfdab7e", size = 216395, upload-time = "2025-10-15T15:14:16.863Z" }, - { url = "https://files.pythonhosted.org/packages/fc/ba/e1c80caffc3199aa699813f73ff097bc2df7b31642bdbc7493600a8f1de5/coverage-7.11.0-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:73feb83bb41c32811973b8565f3705caf01d928d972b72042b44e97c71fd70d1", size = 247433, upload-time = "2025-10-15T15:14:18.589Z" }, - { url = "https://files.pythonhosted.org/packages/80/c0/5b259b029694ce0a5bbc1548834c7ba3db41d3efd3474489d7efce4ceb18/coverage-7.11.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:c6f31f281012235ad08f9a560976cc2fc9c95c17604ff3ab20120fe480169bca", size = 249970, upload-time = "2025-10-15T15:14:20.307Z" }, - { url = "https://files.pythonhosted.org/packages/8c/86/171b2b5e1aac7e2fd9b43f7158b987dbeb95f06d1fbecad54ad8163ae3e8/coverage-7.11.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e9570ad567f880ef675673992222746a124b9595506826b210fbe0ce3f0499cd", size = 251324, upload-time = "2025-10-15T15:14:22.419Z" }, - { url = "https://files.pythonhosted.org/packages/1a/7e/7e10414d343385b92024af3932a27a1caf75c6e27ee88ba211221ff1a145/coverage-7.11.0-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8badf70446042553a773547a61fecaa734b55dc738cacf20c56ab04b77425e43", size = 247445, upload-time = "2025-10-15T15:14:24.205Z" }, - { url = "https://files.pythonhosted.org/packages/c4/3b/e4f966b21f5be8c4bf86ad75ae94efa0de4c99c7bbb8114476323102e345/coverage-7.11.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:a09c1211959903a479e389685b7feb8a17f59ec5a4ef9afde7650bd5eabc2777", size = 249324, upload-time = "2025-10-15T15:14:26.234Z" }, - { url = "https://files.pythonhosted.org/packages/00/a2/8479325576dfcd909244d0df215f077f47437ab852ab778cfa2f8bf4d954/coverage-7.11.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:5ef83b107f50db3f9ae40f69e34b3bd9337456c5a7fe3461c7abf8b75dd666a2", size = 247261, upload-time = "2025-10-15T15:14:28.42Z" }, - { url = "https://files.pythonhosted.org/packages/7b/d8/3a9e2db19d94d65771d0f2e21a9ea587d11b831332a73622f901157cc24b/coverage-7.11.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:f91f927a3215b8907e214af77200250bb6aae36eca3f760f89780d13e495388d", size = 247092, upload-time = "2025-10-15T15:14:30.784Z" }, - { url = "https://files.pythonhosted.org/packages/b3/b1/bbca3c472544f9e2ad2d5116b2379732957048be4b93a9c543fcd0207e5f/coverage-7.11.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:cdbcd376716d6b7fbfeedd687a6c4be019c5a5671b35f804ba76a4c0a778cba4", size = 248755, upload-time = "2025-10-15T15:14:32.585Z" }, - { url = "https://files.pythonhosted.org/packages/89/49/638d5a45a6a0f00af53d6b637c87007eb2297042186334e9923a61aa8854/coverage-7.11.0-cp314-cp314-win32.whl", hash = "sha256:bab7ec4bb501743edc63609320aaec8cd9188b396354f482f4de4d40a9d10721", size = 218793, upload-time = "2025-10-15T15:14:34.972Z" }, - { url = "https://files.pythonhosted.org/packages/30/cc/b675a51f2d068adb3cdf3799212c662239b0ca27f4691d1fff81b92ea850/coverage-7.11.0-cp314-cp314-win_amd64.whl", hash = "sha256:3d4ba9a449e9364a936a27322b20d32d8b166553bfe63059bd21527e681e2fad", size = 219587, upload-time = "2025-10-15T15:14:37.047Z" }, - { url = "https://files.pythonhosted.org/packages/93/98/5ac886876026de04f00820e5094fe22166b98dcb8b426bf6827aaf67048c/coverage-7.11.0-cp314-cp314-win_arm64.whl", hash = "sha256:ce37f215223af94ef0f75ac68ea096f9f8e8c8ec7d6e8c346ee45c0d363f0479", size = 218168, upload-time = "2025-10-15T15:14:38.861Z" }, - { url = "https://files.pythonhosted.org/packages/14/d1/b4145d35b3e3ecf4d917e97fc8895bcf027d854879ba401d9ff0f533f997/coverage-7.11.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:f413ce6e07e0d0dc9c433228727b619871532674b45165abafe201f200cc215f", size = 216850, upload-time = "2025-10-15T15:14:40.651Z" }, - { url = "https://files.pythonhosted.org/packages/ca/d1/7f645fc2eccd318369a8a9948acc447bb7c1ade2911e31d3c5620544c22b/coverage-7.11.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:05791e528a18f7072bf5998ba772fe29db4da1234c45c2087866b5ba4dea710e", size = 217071, upload-time = "2025-10-15T15:14:42.755Z" }, - { url = "https://files.pythonhosted.org/packages/54/7d/64d124649db2737ceced1dfcbdcb79898d5868d311730f622f8ecae84250/coverage-7.11.0-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:cacb29f420cfeb9283b803263c3b9a068924474ff19ca126ba9103e1278dfa44", size = 258570, upload-time = "2025-10-15T15:14:44.542Z" }, - { url = "https://files.pythonhosted.org/packages/6c/3f/6f5922f80dc6f2d8b2c6f974835c43f53eb4257a7797727e6ca5b7b2ec1f/coverage-7.11.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:314c24e700d7027ae3ab0d95fbf8d53544fca1f20345fd30cd219b737c6e58d3", size = 260738, upload-time = "2025-10-15T15:14:46.436Z" }, - { url = "https://files.pythonhosted.org/packages/0e/5f/9e883523c4647c860b3812b417a2017e361eca5b635ee658387dc11b13c1/coverage-7.11.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:630d0bd7a293ad2fc8b4b94e5758c8b2536fdf36c05f1681270203e463cbfa9b", size = 262994, upload-time = "2025-10-15T15:14:48.3Z" }, - { url = "https://files.pythonhosted.org/packages/07/bb/43b5a8e94c09c8bf51743ffc65c4c841a4ca5d3ed191d0a6919c379a1b83/coverage-7.11.0-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e89641f5175d65e2dbb44db15fe4ea48fade5d5bbb9868fdc2b4fce22f4a469d", size = 257282, upload-time = "2025-10-15T15:14:50.236Z" }, - { url = "https://files.pythonhosted.org/packages/aa/e5/0ead8af411411330b928733e1d201384b39251a5f043c1612970310e8283/coverage-7.11.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:c9f08ea03114a637dab06cedb2e914da9dc67fa52c6015c018ff43fdde25b9c2", size = 260430, upload-time = "2025-10-15T15:14:52.413Z" }, - { url = "https://files.pythonhosted.org/packages/ae/66/03dd8bb0ba5b971620dcaac145461950f6d8204953e535d2b20c6b65d729/coverage-7.11.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:ce9f3bde4e9b031eaf1eb61df95c1401427029ea1bfddb8621c1161dcb0fa02e", size = 258190, upload-time = "2025-10-15T15:14:54.268Z" }, - { url = "https://files.pythonhosted.org/packages/45/ae/28a9cce40bf3174426cb2f7e71ee172d98e7f6446dff936a7ccecee34b14/coverage-7.11.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:e4dc07e95495923d6fd4d6c27bf70769425b71c89053083843fd78f378558996", size = 256658, upload-time = "2025-10-15T15:14:56.436Z" }, - { url = "https://files.pythonhosted.org/packages/5c/7c/3a44234a8599513684bfc8684878fd7b126c2760f79712bb78c56f19efc4/coverage-7.11.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:424538266794db2861db4922b05d729ade0940ee69dcf0591ce8f69784db0e11", size = 259342, upload-time = "2025-10-15T15:14:58.538Z" }, - { url = "https://files.pythonhosted.org/packages/e1/e6/0108519cba871af0351725ebdb8660fd7a0fe2ba3850d56d32490c7d9b4b/coverage-7.11.0-cp314-cp314t-win32.whl", hash = "sha256:4c1eeb3fb8eb9e0190bebafd0462936f75717687117339f708f395fe455acc73", size = 219568, upload-time = "2025-10-15T15:15:00.382Z" }, - { url = "https://files.pythonhosted.org/packages/c9/76/44ba876e0942b4e62fdde23ccb029ddb16d19ba1bef081edd00857ba0b16/coverage-7.11.0-cp314-cp314t-win_amd64.whl", hash = "sha256:b56efee146c98dbf2cf5cffc61b9829d1e94442df4d7398b26892a53992d3547", size = 220687, upload-time = "2025-10-15T15:15:02.322Z" }, - { url = "https://files.pythonhosted.org/packages/b9/0c/0df55ecb20d0d0ed5c322e10a441775e1a3a5d78c60f0c4e1abfe6fcf949/coverage-7.11.0-cp314-cp314t-win_arm64.whl", hash = "sha256:b5c2705afa83f49bd91962a4094b6b082f94aef7626365ab3f8f4bd159c5acf3", size = 218711, upload-time = "2025-10-15T15:15:04.575Z" }, - { url = "https://files.pythonhosted.org/packages/5f/04/642c1d8a448ae5ea1369eac8495740a79eb4e581a9fb0cbdce56bbf56da1/coverage-7.11.0-py3-none-any.whl", hash = "sha256:4b7589765348d78fb4e5fb6ea35d07564e387da2fc5efff62e0222971f155f68", size = 207761, upload-time = "2025-10-15T15:15:06.439Z" }, + { url = "https://files.pythonhosted.org/packages/30/70/b052a519a584663a7bd052841a2debe11c8309ec49a7786340003f9c0a02/coverage-7.15.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d0be6daac4cce6b8c8dc65886bae1b082ddbca4da8e5cbb5e15166acf253e264", size = 222245, upload-time = "2026-08-06T13:46:55.253Z" }, + { url = "https://files.pythonhosted.org/packages/67/39/892fa511aba3d1c3c8f49509a0ff5c71eab9f9f88d08e1a38da395821660/coverage-7.15.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b24e078eabcd6a9caa8b0713f9bc1eeb310bcc960a29d45a3b4fcd4b16d5b11d", size = 222762, upload-time = "2026-08-06T13:46:57.848Z" }, + { url = "https://files.pythonhosted.org/packages/9f/95/b2c724ce1e64bc23cb5b1d7eeffa9548dc3d811f7a6297b2d01607f4e062/coverage-7.15.4-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:cfe20cc8cf8821d4fe54f89106cbf06aa27f37b5bbe3535568065a81539b4150", size = 249498, upload-time = "2026-08-06T13:46:59.012Z" }, + { url = "https://files.pythonhosted.org/packages/0b/4f/b1973f67a1382af65b572a31ed692f8e490a6ad707191eab59148376832a/coverage-7.15.4-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:83cf06cdd687677742caff1a9134833b7a8b75f111519d2cb0e0ba1b9a851e15", size = 251328, upload-time = "2026-08-06T13:47:00.764Z" }, + { url = "https://files.pythonhosted.org/packages/a2/09/03efa6722a132abcac91b32a60b64b240dd707c189c64eee697e48992c96/coverage-7.15.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8fa4de68e2a752468ff14b4e15db7def689a71be759e826a31ccecbef69c5fd0", size = 253194, upload-time = "2026-08-06T13:47:01.976Z" }, + { url = "https://files.pythonhosted.org/packages/45/63/8299201d9c80fb65551ce99c966cab83d706ec4066ac999bef08201346de/coverage-7.15.4-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4dff9daa47d83120c3ec38ce921214242944a832aa04e903e50b5b7ebac8972d", size = 255106, upload-time = "2026-08-06T13:47:03.281Z" }, + { url = "https://files.pythonhosted.org/packages/ee/16/26fd8a691eb8d9a230128685f6d23309d7402cb030aa553001788c8c50fc/coverage-7.15.4-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a093fd37229918976f602aa07aa59e0973cde82186f220c8e197f721f5be0ce4", size = 250177, upload-time = "2026-08-06T13:47:04.713Z" }, + { url = "https://files.pythonhosted.org/packages/ad/ef/3c7556f33783a0a566e01443ca62bd8eb2cdfe22d271efdc02e08beb5654/coverage-7.15.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:317db01a2cb02552fd67e2b1cca77a4b528a2a277176c5e0bf2cecbb639d3f54", size = 251234, upload-time = "2026-08-06T13:47:06.104Z" }, + { url = "https://files.pythonhosted.org/packages/29/49/640a34043edac950738f36a3567832db5731d4cb2ed84b59cdb89c6bccbf/coverage-7.15.4-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:8ee3838dcb656602c3b51e16aed9bfb0822f8d8d6d1c5966d32ec8c104be8e20", size = 249237, upload-time = "2026-08-06T13:47:07.467Z" }, + { url = "https://files.pythonhosted.org/packages/48/f5/e80f212669dd1be954ff844f883ef11a437ef4fd0089c6e0effc7b66b15d/coverage-7.15.4-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:425920379052ff1fe465268f3361d35804a241bbdd5a1b592c8cb60df4c52325", size = 253050, upload-time = "2026-08-06T13:47:08.748Z" }, + { url = "https://files.pythonhosted.org/packages/c7/e9/e5da0fe39f7fde1bca9edc09c60921bb5fdba4cec7db5bbad41ddfd8c230/coverage-7.15.4-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:69bb2400abef928e365ea7d4d9925169ada78ed2295546780002d4b65de3df88", size = 249508, upload-time = "2026-08-06T13:47:10.072Z" }, + { url = "https://files.pythonhosted.org/packages/7d/38/41bf25774a0c8bba6b467f917cb1c9a0a2605e02dc93aad489fc7050ed59/coverage-7.15.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:81661f82d302484e3119e7c80c519c02fa9bcc2a6b339baf67d67bc89c580f04", size = 250110, upload-time = "2026-08-06T13:47:11.35Z" }, + { url = "https://files.pythonhosted.org/packages/89/6e/26f2e54b79acc29d179ee4272922625aedb69198c4eb61f7ff4f098f3c78/coverage-7.15.4-cp310-cp310-win32.whl", hash = "sha256:cb476b2e828ecb71cb6b6a928d23fd20a7ddb501188022dae1c37499149cc338", size = 224294, upload-time = "2026-08-06T13:47:12.753Z" }, + { url = "https://files.pythonhosted.org/packages/7b/06/9a318fc3ae040d4d6cb2d86101c6aa963fab20899a5c58666adf52cde0ca/coverage-7.15.4-cp310-cp310-win_amd64.whl", hash = "sha256:3fc2130bf37df31852a8384f12601563a45a0024bccc6624f38355cba7a8d360", size = 224919, upload-time = "2026-08-06T13:47:14.17Z" }, + { url = "https://files.pythonhosted.org/packages/2a/66/edcec7d7a0b524aa8923e22925fde6fe50ce005a113dca13ae1581455c4c/coverage-7.15.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:bbac5abad70df71019988f83f26ac7092ff2642975def4429e98dc7585ef3490", size = 222367, upload-time = "2026-08-06T13:47:15.578Z" }, + { url = "https://files.pythonhosted.org/packages/e6/c6/ab8de429e2e8548faf58ec7e1674a4ce00414b4113942d3fe87109cf0f68/coverage-7.15.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:357a173465c7ce028d07a95cc2b63b5bf59f50ecdd5ad75c5cbb78ada984048e", size = 222874, upload-time = "2026-08-06T13:47:16.961Z" }, + { url = "https://files.pythonhosted.org/packages/be/c4/3b7b49587e8a6b9af79b3eb468d443d6042b6d65b47aa26586846a0d6566/coverage-7.15.4-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:21b803935e2efc3acebe9697197a294fccf5dc4e5382bd6369542ff7a7d2a1d7", size = 253287, upload-time = "2026-08-06T13:47:18.291Z" }, + { url = "https://files.pythonhosted.org/packages/fb/65/ec03b743a2a229c72cc1eff3e57be9d3564e9c6b4d5aba2d70744a3fc0d8/coverage-7.15.4-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:7a2b580774a4786c1053157c0165e04476e03ff293993d7c148eee784a94bae6", size = 255199, upload-time = "2026-08-06T13:47:19.765Z" }, + { url = "https://files.pythonhosted.org/packages/41/4b/5163729e4b6582d61975cfd3ccab45b4ec53e21cf156d9941cb025188468/coverage-7.15.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a9464451c4efffe8d47ace5a540b10b0dc10e879066290f8600872b7f54a419d", size = 257308, upload-time = "2026-08-06T13:47:21.206Z" }, + { url = "https://files.pythonhosted.org/packages/86/08/2167a0f08fb87d702fa423a48578a32865464b7c9e1db3911ad7812ab414/coverage-7.15.4-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:de602f34123c2f4af1c1869c6dbbbd60da6d5983bf01937367295d135cccbfce", size = 259268, upload-time = "2026-08-06T13:47:22.503Z" }, + { url = "https://files.pythonhosted.org/packages/1e/e5/68eebae3053dbd48508edea559c21b23fbdf3460784f91370c83a86a6acd/coverage-7.15.4-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6879ded16a27f3eeca19b900c147e81616e7054db451471a611b2755ee5249f7", size = 253392, upload-time = "2026-08-06T13:47:23.88Z" }, + { url = "https://files.pythonhosted.org/packages/1a/46/fd4ced40a2b691c774e515c9b69500bfa64c7960b67fcee4b2f6fad97fc3/coverage-7.15.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:986be58c3ab54aae8d3496a6225eea74f760fdbe739b38bd442c7e8d133aa53b", size = 255001, upload-time = "2026-08-06T13:47:25.469Z" }, + { url = "https://files.pythonhosted.org/packages/53/25/ae2e5fa710bb6957a9aadeb9e3598d3b3e4af6587ce857ad42e8639a3f30/coverage-7.15.4-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:c6103639613fe6c1e989082948419bc77a2d26b6c825c99d7fad25f7d3d87afc", size = 253061, upload-time = "2026-08-06T13:47:26.845Z" }, + { url = "https://files.pythonhosted.org/packages/d7/31/67ddc0365db2c6e93ac8580bc4bbc50f65273262f973f63ebcdbc15c0495/coverage-7.15.4-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:d3af93dddb5659276c63bc16ac6466ac2033a70ca816097bbc06345b8ccdf571", size = 256831, upload-time = "2026-08-06T13:47:28.217Z" }, + { url = "https://files.pythonhosted.org/packages/f6/78/82b8fd18f57fb13f12d98fe874995bb2c4f9f17be8aff762c426323fdb96/coverage-7.15.4-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:b10075e5421d04265766a6d1dac809bbeb8a946fbb23c8f82c227409b2190719", size = 252781, upload-time = "2026-08-06T13:47:29.712Z" }, + { url = "https://files.pythonhosted.org/packages/0a/eb/6c74ef4dd12b252e573c49bdef9e2ac265bf3dbb79b8d7feb3266e084e9e/coverage-7.15.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:a67a9f78b2942d87ba8ce3059c642164d2aedd65337377fb52fe9803656bc5c7", size = 253692, upload-time = "2026-08-06T13:47:31.192Z" }, + { url = "https://files.pythonhosted.org/packages/5a/66/eb9aed1c3fd2d36ee00eb173f434b14fa607fc056739c9a89ff4244010ea/coverage-7.15.4-cp311-cp311-win32.whl", hash = "sha256:69484d1aca26e322e1c3ce03f09341e84524ababad2d7202161738d83cc9f82e", size = 224461, upload-time = "2026-08-06T13:47:32.572Z" }, + { url = "https://files.pythonhosted.org/packages/e2/6d/81fa4161dfb3ed9d74e40d58647eff83a56b7612e78352581280fce2f477/coverage-7.15.4-cp311-cp311-win_amd64.whl", hash = "sha256:63fd6fcd1dd6e158f7eb78606e72933b3f6d01e7b747f99c6c12d764307a0fdc", size = 224937, upload-time = "2026-08-06T13:47:34.205Z" }, + { url = "https://files.pythonhosted.org/packages/5b/c1/d8dacf683c6cad3cf85ce68fd3774a6774ec402128822fdfaed920f11e6a/coverage-7.15.4-cp311-cp311-win_arm64.whl", hash = "sha256:ea82116c9893fa89e929b7f197ee5a1950a76e91cc5c85ba503fc02379d04890", size = 224479, upload-time = "2026-08-06T13:47:36.118Z" }, + { url = "https://files.pythonhosted.org/packages/1d/48/bc8d4ba7b37551a767bd863f15b3f80182b271c2f55975356f5f7dbe94c2/coverage-7.15.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d4fedd1f7f428f9fe83b1ead5e7cc87a43427be31aadafbac3ac0636dc7abb22", size = 222543, upload-time = "2026-08-06T13:47:37.562Z" }, + { url = "https://files.pythonhosted.org/packages/20/dd/88d6f83f1fffc974a3691a34a97951c5b12df7512a6782c5963883cbc058/coverage-7.15.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:37e2f0cdf58e2e1fed4e4d5a8f8786ae2f7eb80b478016876667dc4a01d60a97", size = 222905, upload-time = "2026-08-06T13:47:38.927Z" }, + { url = "https://files.pythonhosted.org/packages/bd/5c/54ee0d4748585bb0acab9891cd8d92f2d3593165b4e59fc9de113bfb3140/coverage-7.15.4-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:fb55d0e70bb15f2e81477613627286581414693d74ac7963c93a790dd453ca9d", size = 254407, upload-time = "2026-08-06T13:47:40.488Z" }, + { url = "https://files.pythonhosted.org/packages/8c/3f/f0642a372f494bd0d7dad3b497083b910194a5f1c88be2c94fef707c3b59/coverage-7.15.4-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:899b9da30f3c6c336566e3707495bb23e8302d39d862f01fa78c48b99b9437e2", size = 257145, upload-time = "2026-08-06T13:47:41.931Z" }, + { url = "https://files.pythonhosted.org/packages/71/17/8b46d0ed68251016002ec972c8fc0119961a765d0984cafb8bf317c43758/coverage-7.15.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d15715e8c46552827e5e4f30a35575a2dbcad14454cf3284c54483946bd16931", size = 258257, upload-time = "2026-08-06T13:47:43.527Z" }, + { url = "https://files.pythonhosted.org/packages/30/b8/8498a0e72d0adbe15477dd07463d2b3bb2c9f6a4815e8589e50939e2c3ae/coverage-7.15.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:002a438859f7b430bc99afeaf01a6d187dad1d0dc907b64cdeffc632a5db8fd8", size = 260517, upload-time = "2026-08-06T13:47:45.121Z" }, + { url = "https://files.pythonhosted.org/packages/41/e1/7dce19c3bdb1e3dd63e769508216500edad81bd5f69a26d724e32aceaf78/coverage-7.15.4-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e4193a04b518f7968f3099755f5509ee7cccc6dc2b92a6b14841934d22e222c9", size = 254785, upload-time = "2026-08-06T13:47:46.541Z" }, + { url = "https://files.pythonhosted.org/packages/dd/b1/e1494703c675a2561723cd9b89f45c9168782c31280c611b1f767851e57c/coverage-7.15.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e98dcc55d572b38e69d117da7e8e8efb8500f1f5eaf81ecd460a63220790b839", size = 256176, upload-time = "2026-08-06T13:47:48.155Z" }, + { url = "https://files.pythonhosted.org/packages/73/76/a5629d270fb638a43a4b10466f51e2f49d532c1aa4da2913cbbb150bbe0a/coverage-7.15.4-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:af6c538498ce66c10d3fd541c2a8d5b03da5850355add34e6cba564210cb9e72", size = 254321, upload-time = "2026-08-06T13:47:49.757Z" }, + { url = "https://files.pythonhosted.org/packages/ff/4f/9c44447218435d5766b911534f9d798144a5560f85e9a54ebe5f3f5d19f9/coverage-7.15.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:1d10025d96ea89fc2f73714dbc4cbd433fe012c1ac9e23f895d7728b238b6e52", size = 258390, upload-time = "2026-08-06T13:47:51.248Z" }, + { url = "https://files.pythonhosted.org/packages/de/36/c1e127616fb3fa18a9ff71e76c417f2fd7424332a4870015ac224ef4c039/coverage-7.15.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:d802e1947603162ded419bff83ac7489820355d2b856dfb09206574e3a37ac0c", size = 253894, upload-time = "2026-08-06T13:47:52.816Z" }, + { url = "https://files.pythonhosted.org/packages/e9/b9/fdb92c8ae7a8bb9b850cc253b7b3b9c8526f68130002048b5671cd510d09/coverage-7.15.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c2de40895718f91951b86712b4c5b694acaf9a0a49be13874896f599a1eed3f4", size = 255763, upload-time = "2026-08-06T13:47:54.296Z" }, + { url = "https://files.pythonhosted.org/packages/6f/c0/a7d51b2587c7bdb76e71b0896d2565bf7d60436b5122fc83e511adb1f7cd/coverage-7.15.4-cp312-cp312-win32.whl", hash = "sha256:5c3431b2161279b7db5c2a1aa58ae02e5cb8c3c42d93a5094be3f5537bd5b11b", size = 224597, upload-time = "2026-08-06T13:47:56.074Z" }, + { url = "https://files.pythonhosted.org/packages/49/b9/5c5f80cc55f5acaaca6dee677626bfcec8c87204a7809b438b08e84f4571/coverage-7.15.4-cp312-cp312-win_amd64.whl", hash = "sha256:6befeab5fb2b51c958ca4ac6c5d141a1e8240f4f76e46350f1911963deda49cd", size = 225135, upload-time = "2026-08-06T13:47:57.52Z" }, + { url = "https://files.pythonhosted.org/packages/47/e4/2a4561f89ff6bf7c925c287d0f2cce8bdf139c3a33735c87e3203401cf94/coverage-7.15.4-cp312-cp312-win_arm64.whl", hash = "sha256:67bc345491ab55b837277d76f5775d057e8c7f1ac44d890d8c2c82adde258c6f", size = 224515, upload-time = "2026-08-06T13:47:58.977Z" }, + { url = "https://files.pythonhosted.org/packages/f1/84/651a9310859673aaa3b3203f1aa1641ca60fcf2494683e1c9474c7172780/coverage-7.15.4-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:c705b28feb2775dc82a25f1d473a370bc37ff93f5177f4e29ce2425f560f6921", size = 222565, upload-time = "2026-08-06T13:48:00.796Z" }, + { url = "https://files.pythonhosted.org/packages/82/f9/4dcf700137e8af550670f4d74d1b63828ce93e1e2b05e5f10710eb2ea987/coverage-7.15.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:3ff205ab5e3ecc670f6a4dd19d9cbf12ede53dd41cfc1e15716ec961ea6d314e", size = 222936, upload-time = "2026-08-06T13:48:02.391Z" }, + { url = "https://files.pythonhosted.org/packages/07/4a/612ff1e780b3fbfd637486f542f84adc5503873d8b5d279dec1ffeef9414/coverage-7.15.4-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:5172326e861a38b48b48befca15e0f477a26b283337a33a739c8fed229934e36", size = 253926, upload-time = "2026-08-06T13:48:04.382Z" }, + { url = "https://files.pythonhosted.org/packages/b0/04/d1cff1c2ead4708a6a79c01d3736b6a25bd38a36678398f72a8dd33dfad9/coverage-7.15.4-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:12b59c90084e3234fb11184886bf4a40f4f16a8c8f867be2e087b81f8e8868d4", size = 256523, upload-time = "2026-08-06T13:48:05.996Z" }, + { url = "https://files.pythonhosted.org/packages/b9/80/d34e13fb4b293cbdb9665838cf5522077b8ad14ef947550631a4bced36a5/coverage-7.15.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:349062d66f00b40fa2c1c222438bad25fabf755631b5d82937fe985c8008615c", size = 257759, upload-time = "2026-08-06T13:48:08.036Z" }, + { url = "https://files.pythonhosted.org/packages/0f/e7/2c5fe7636fdb0732fe0f09f308a5b066864078b7fc61f6678e8478554f2e/coverage-7.15.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4256ced708e598e05209bc1a8ab4074e04a51dba4c62fb45926a229af675ace7", size = 259890, upload-time = "2026-08-06T13:48:09.834Z" }, + { url = "https://files.pythonhosted.org/packages/92/28/9689f0858dfff59c2ea688938ab9fa2925631235df67126a42b6c5c70ae1/coverage-7.15.4-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:d80f974b20782d9612c8b4c9beeca867074c7cf4079d1419843fa25a26428b25", size = 254121, upload-time = "2026-08-06T13:48:11.459Z" }, + { url = "https://files.pythonhosted.org/packages/f9/e2/785077c230c157243eb5aa9a26c3be260ecd02001bead54a3cada3df8e03/coverage-7.15.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:2e179f19bfe1d31f8eeeaa12990194d761c4f62f0759661000bca6cd8729f40b", size = 255891, upload-time = "2026-08-06T13:48:13.209Z" }, + { url = "https://files.pythonhosted.org/packages/d4/90/e20371b17b40f912f21305c2db2f30efa3de306f7320fc916804872c85a4/coverage-7.15.4-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:8bc16bb47b7679670eceff71d78bfb7d6e5b143f6c2cd117487ec7c75e0d4b78", size = 253859, upload-time = "2026-08-06T13:48:14.736Z" }, + { url = "https://files.pythonhosted.org/packages/05/49/25371987ee459a5f67c0427fb75c74f9358e65f2c71fe75bf41c1b6c5fcb/coverage-7.15.4-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:1cd685005cd2c4200adfc14cf39a603b9320efab3f18a8f7f156d20c9cc3345f", size = 258011, upload-time = "2026-08-06T13:48:16.464Z" }, + { url = "https://files.pythonhosted.org/packages/30/6e/32e67467f6154bf4f1c4f63b05acc5097cba4237d45bbeeea446b52e8ac1/coverage-7.15.4-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:337399ad2c93b3acd2a937627dae8b3e86b66707cd3d3e856347999aadf1ef8d", size = 253676, upload-time = "2026-08-06T13:48:18.493Z" }, + { url = "https://files.pythonhosted.org/packages/03/c1/8b24192e89286399765155251f99ee9f070a9d637109018ac23d99b99f6f/coverage-7.15.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:96e257121228ec5cd2bb919276e94ac11074471bc37d68dbae0e8308cce15fff", size = 255453, upload-time = "2026-08-06T13:48:20.057Z" }, + { url = "https://files.pythonhosted.org/packages/16/6f/8b41ebdf67c87854e17c035336a90f1cfbad0c14c2a584301be6ff148718/coverage-7.15.4-cp313-cp313-win32.whl", hash = "sha256:c65a9e0dfc6143491879da4e13b5e30f8be192055de508d737fb14601edbd22c", size = 224605, upload-time = "2026-08-06T13:48:21.655Z" }, + { url = "https://files.pythonhosted.org/packages/e0/e2/2946c7f0b42b152ecb21ff1bdad72e3d301e790c0c487e4a86e8c9f69347/coverage-7.15.4-cp313-cp313-win_amd64.whl", hash = "sha256:2ff8f5e9b8f7a94f0c11c45631eee103dbcb7d63274edd12c56efe1be690b3b4", size = 225148, upload-time = "2026-08-06T13:48:23.376Z" }, + { url = "https://files.pythonhosted.org/packages/9e/83/3f4a69957f48ae7a0aba76c34743f88963d607b19e03f3f8e66f91cae0f9/coverage-7.15.4-cp313-cp313-win_arm64.whl", hash = "sha256:6e0a8a5083b096487d6cfced94cdd514d8f5db6f113610fb36c0620edb1028cf", size = 224536, upload-time = "2026-08-06T13:48:25.117Z" }, + { url = "https://files.pythonhosted.org/packages/ea/ac/748cf29eeb2d6be34a3176ce26a4f49e38085ee08e8935f05f6f26ed7e0f/coverage-7.15.4-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:770e9325ab5ea6d56f77e59b29ecfe0ac20b57a82a601876f90494a4dda0386f", size = 222608, upload-time = "2026-08-06T13:48:26.806Z" }, + { url = "https://files.pythonhosted.org/packages/0b/02/1abbf5c984677b0aa439cdacaccbf38d248939d8ef8fe1cc7a50d73edb77/coverage-7.15.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:d12b33a3a50a1676b7784dc8d00a0c6d66a9f2add4b85a041c19b6a7e53ef23c", size = 222940, upload-time = "2026-08-06T13:48:28.432Z" }, + { url = "https://files.pythonhosted.org/packages/eb/e1/ff8f9f53d9fcf586125b55d0b1f04ec1c14955fee41e83d5814bee141bb5/coverage-7.15.4-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:5669c8378ebde86f5def7a25d29586631b58acc27ffde04399f678f3dfc6e082", size = 253985, upload-time = "2026-08-06T13:48:29.995Z" }, + { url = "https://files.pythonhosted.org/packages/a1/26/595759762e514e81be1d7d01ed03444303bcd152226a6529998d253f9201/coverage-7.15.4-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:ff97a14362eef486483ed44042ca2027ea257df6ff768e62358ee0c9776925ac", size = 256492, upload-time = "2026-08-06T13:48:31.634Z" }, + { url = "https://files.pythonhosted.org/packages/24/68/b79aabac54d482be23b5fcdd4f4662bff24a78edc4ee29201726929936d5/coverage-7.15.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5a325e815318638aed1655d9c06e6d7c2d3d46c09231ce988070428a8762d734", size = 257837, upload-time = "2026-08-06T13:48:33.186Z" }, + { url = "https://files.pythonhosted.org/packages/09/0f/bf7f297885a5bf6fd71e5782404e0ff059ca09e8711ceb3a08544abde45a/coverage-7.15.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:474223409d88eb20d2d6a0d37ea60e8647a65a90cc008dc1f0410af5f64f1e0d", size = 260152, upload-time = "2026-08-06T13:48:34.75Z" }, + { url = "https://files.pythonhosted.org/packages/fd/f1/296744e854ff8368542343457414380465e9ceefb9192342feb9d3bc461d/coverage-7.15.4-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:7f2f62ae3cd189dd2e13aece758c57b3eecbd27be070dbd4cbd10936049e5dbf", size = 253978, upload-time = "2026-08-06T13:48:36.434Z" }, + { url = "https://files.pythonhosted.org/packages/55/b0/bbdb2e9057493e66220a2e149ca2d301ba0e3a58a83bd6b90de9826d16f3/coverage-7.15.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:39ece820e29e0a2ba34b3ecb3be83c27e997eed8926f2ba6fe7ce7a0bda5843b", size = 255846, upload-time = "2026-08-06T13:48:38.317Z" }, + { url = "https://files.pythonhosted.org/packages/96/e4/38015b2b6d21258713bd17e76b59d033b191efb5703589cffd037dfbca20/coverage-7.15.4-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:f21b56dcace11dfe013014201f577dcd592b2a9b72182d930361b47cf6f73f25", size = 253808, upload-time = "2026-08-06T13:48:39.993Z" }, + { url = "https://files.pythonhosted.org/packages/0b/64/0d515c1e60ee6fbfd1a0e79c07cd87d388a233b7adc37758735677203808/coverage-7.15.4-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:93a3a0b662abcc10c73a47cbc72cd60f63618d6989fb2d1286e50eacd974f303", size = 258081, upload-time = "2026-08-06T13:48:41.971Z" }, + { url = "https://files.pythonhosted.org/packages/91/71/04d9e7a3642146c6351338aef4ef85ab11dbbb54744c13245caba1aad1c0/coverage-7.15.4-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:141fae2cabf5569b782c10afc4c850ce10f618c13f8db54765cba99cc839da1f", size = 253624, upload-time = "2026-08-06T13:48:43.731Z" }, + { url = "https://files.pythonhosted.org/packages/b4/a7/6c28b74c81ebff66987b0e2522ba5cffa3e90b0c33cb6a2eb264d4ee8cf1/coverage-7.15.4-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:81294c7e6ab30c5f74c0353b11b2fd6320e72d9bee6ac73b357caa8b916323a5", size = 255280, upload-time = "2026-08-06T13:48:45.58Z" }, + { url = "https://files.pythonhosted.org/packages/52/af/bc19996a7014b98d7bbb0f0939453c67074af65784a3aa16a789a07381fa/coverage-7.15.4-cp314-cp314-win32.whl", hash = "sha256:7bbd7d6418e0dab31a206af5203bd43ae36edb8e7fba1940b055d3e9249290d7", size = 224768, upload-time = "2026-08-06T13:48:47.525Z" }, + { url = "https://files.pythonhosted.org/packages/ee/90/219484e476d6e101ba0a444852579e05f5b75c37c611a42ed1190f73ef62/coverage-7.15.4-cp314-cp314-win_amd64.whl", hash = "sha256:f0204ed122758782970526057093f448051a39db9d810d4e344bb87a3546f425", size = 225259, upload-time = "2026-08-06T13:48:49.513Z" }, + { url = "https://files.pythonhosted.org/packages/b7/66/fa77daf4e383e5f776dac62c2409b6af81910ae6fe326bd5170dba74cc63/coverage-7.15.4-cp314-cp314-win_arm64.whl", hash = "sha256:9e71e7bc71c686a123347ae47a0de33a175e797a85bb57b791492adf4eec8ed8", size = 224684, upload-time = "2026-08-06T13:48:51.235Z" }, + { url = "https://files.pythonhosted.org/packages/58/5b/f03bf0ce362bbf3f785fa5219620d00778d4ac6fc9e407734828e9c672f6/coverage-7.15.4-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:7c922735321eef3f87c280a3d39afff6b646723a2880b862cda4ac7a093b8aa8", size = 223338, upload-time = "2026-08-06T13:48:52.896Z" }, + { url = "https://files.pythonhosted.org/packages/0f/76/e77d0ae22501831cc9f92193e8a957a5caa1dd177f90a6d1d9b106242d92/coverage-7.15.4-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f41c17c4668a655ce96d090d8d5ffdc24ef64b5a02f9753884d08483e8a4a41a", size = 223609, upload-time = "2026-08-06T13:48:54.688Z" }, + { url = "https://files.pythonhosted.org/packages/82/1a/b1f089da8d38ac612fa2dd6dc7f4a1a7657d12f3e261d2996edd3a838d0b/coverage-7.15.4-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:46822e9b6ff1c6a72b518c162c44a8f45a61a1d609c51084bf5b16c023c5037b", size = 264970, upload-time = "2026-08-06T13:48:56.403Z" }, + { url = "https://files.pythonhosted.org/packages/bf/31/e66d98d6e9c7fcc88470f1e234eaf6b1950dc0dfbf797f7282c1c861da24/coverage-7.15.4-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:3d6f4955b73b5445271379a59e3792b0d978f42d4a01e0cf7a67d9c33a3bb0a5", size = 267088, upload-time = "2026-08-06T13:48:58.41Z" }, + { url = "https://files.pythonhosted.org/packages/59/a1/ae94eb2c541add426378408379f233591e069040b1e2cdb33df9498a0682/coverage-7.15.4-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3fc9e047706fb4a9abb54f719d3aa643e80e5bb3818182c40aee01ac0f0247ba", size = 269508, upload-time = "2026-08-06T13:49:00.42Z" }, + { url = "https://files.pythonhosted.org/packages/9c/c7/88a10694a1c6a213569766aba9f25847b28155d4ac731b13226db216356d/coverage-7.15.4-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:05e491d4f3165d62d4f5c8fd48dfeabf2ae8f42cbbd484319af33ea851b78982", size = 270629, upload-time = "2026-08-06T13:49:02.234Z" }, + { url = "https://files.pythonhosted.org/packages/b3/34/d8b8232e5e55169933b59aabcef2fedfa4b9d8897361bb80fcbda146505f/coverage-7.15.4-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:226c66e80ec0598d3b9b4874123df167ccca342aca8714f77cac6829688ee09c", size = 264043, upload-time = "2026-08-06T13:49:04.102Z" }, + { url = "https://files.pythonhosted.org/packages/7e/35/58b009dbf8c471c7224716478b9fed4a7e1af15320e1ed41660978504663/coverage-7.15.4-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:ac41cc14bebda0dbfb0628036b7f75706935c95bcc07fefe9a0f93614aa60a57", size = 266963, upload-time = "2026-08-06T13:49:05.821Z" }, + { url = "https://files.pythonhosted.org/packages/62/aa/57fbda1b42c892968273c56b6ee9dc0f1310850859230a507bc7873b1f65/coverage-7.15.4-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:8af623e5cd92080acddd02b38f2f406a2c3a0893c38950b211890361448fbf26", size = 264569, upload-time = "2026-08-06T13:49:07.706Z" }, + { url = "https://files.pythonhosted.org/packages/98/8a/360e6e7f24d477b7e889703af0afa878d15b6d4d8d2a822b2835c169a879/coverage-7.15.4-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:07545711d4f0f32852a18f18ad11f76f0109909d09e78b9008b4cfc67e829429", size = 268299, upload-time = "2026-08-06T13:49:09.587Z" }, + { url = "https://files.pythonhosted.org/packages/4e/89/6f701261aee21b6b5fa8f7872229406dc917e125069448292223bf213606/coverage-7.15.4-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:a0865421cfdc53654b342d515e5a233187590882d20b95752150e53f65460017", size = 263413, upload-time = "2026-08-06T13:49:11.604Z" }, + { url = "https://files.pythonhosted.org/packages/3f/0f/6f04036edc260ed425af83e834f627fad48941ce97b50bfe6edd8b6fa623/coverage-7.15.4-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:460115e32ee40566476db5048f9bec1e842c127ad8e6f8be745aad3ac9cbc839", size = 265725, upload-time = "2026-08-06T13:49:13.38Z" }, + { url = "https://files.pythonhosted.org/packages/c4/ce/d19b5d4d5c49a7bfb925fd74310fee7d28bc99520ac3367ccbc54e662518/coverage-7.15.4-cp314-cp314t-win32.whl", hash = "sha256:cbde877ef9dd7baf272b9bfef2b8a25edd45d9170fc326951dd20eb480335e85", size = 225079, upload-time = "2026-08-06T13:49:15.265Z" }, + { url = "https://files.pythonhosted.org/packages/26/bb/7aa1b3b173faee0679037ca950bbbe1247273656697994d8d13f80f8d4b4/coverage-7.15.4-cp314-cp314t-win_amd64.whl", hash = "sha256:3da9e92d1c551fd7563833e9ade686efb0c4b7363ab7681a94283958c950bf5e", size = 225911, upload-time = "2026-08-06T13:49:17.279Z" }, + { url = "https://files.pythonhosted.org/packages/81/1c/4ea9e47426d80038d9222db3c4534cb6021a74b237d3ff97ffd33b6600dd/coverage-7.15.4-cp314-cp314t-win_arm64.whl", hash = "sha256:3a54f5a0d85050c73a38f6793090ee83974531e67fe5e57a1da9bee11398aa5e", size = 225219, upload-time = "2026-08-06T13:49:19.293Z" }, + { url = "https://files.pythonhosted.org/packages/2b/c4/dc5d2ac8f9142e7ec7de66e7bf0591db29d78955a040bd915870d9c0e657/coverage-7.15.4-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:2c9872e4d9dc5d3cf616bf4b382f5a00359305a5be666a3dd0b5cdb4e49597f9", size = 222604, upload-time = "2026-08-06T13:49:21.279Z" }, + { url = "https://files.pythonhosted.org/packages/70/39/33e63df81fe2ee100897451841c821467635923e58e37c6bd4b46dd8106c/coverage-7.15.4-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:e101dbb4b9b72f0cddd8cdc8c9c5b47f456766f5e0ac82dbfb75e5c55409b78a", size = 222944, upload-time = "2026-08-06T13:49:23.187Z" }, + { url = "https://files.pythonhosted.org/packages/99/1f/ef3ffb5557febc75a0d97aa459d0266d7d741110265121cc6d8539343d44/coverage-7.15.4-cp315-cp315-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:7d1abebdb047729e852b9c77a00497dfbeb11eb3a117e037d7dbc3ac8e5f5c54", size = 254050, upload-time = "2026-08-06T13:49:25.008Z" }, + { url = "https://files.pythonhosted.org/packages/6f/f5/1f0f6f77698c3601ca0ae7431e34b24c62ca2f06fecb23b73ed1f651d2be/coverage-7.15.4-cp315-cp315-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:d28a4a899354d0ea6214cc59b4fa19eefbce1b9ff1688ab579acf49e894bd3fb", size = 256967, upload-time = "2026-08-06T13:49:26.896Z" }, + { url = "https://files.pythonhosted.org/packages/03/7a/2ed9bed79925f4367c83c77f66a89e5ca7229c288d2d19ad5f36d1ca0070/coverage-7.15.4-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ffb3c2aacea411cc7e1d27712490c11108e2de1d39019ae32915493a59a8b9ed", size = 258587, upload-time = "2026-08-06T13:49:28.692Z" }, + { url = "https://files.pythonhosted.org/packages/45/8c/fa34044f71b7cc4ecb6da9c2408770959b0591fa9b5fb6fb6bca38f94298/coverage-7.15.4-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a9447978a92f405d301123cfd39ff49895490efb769a758fe2734c7f631bf8ce", size = 260785, upload-time = "2026-08-06T13:49:30.472Z" }, + { url = "https://files.pythonhosted.org/packages/4f/54/d5727ce36b4524a7394ab9f5f1df378e1f23affcdab01037dc8655185cc7/coverage-7.15.4-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:050467a7983b8e2fe7dd41a78bb30c3e7f8c0b8cafda14b1c46f8b5e3cf2dd3c", size = 254545, upload-time = "2026-08-06T13:49:32.271Z" }, + { url = "https://files.pythonhosted.org/packages/dc/e6/6e3783e576719590194bdffb6dd6d85490801785b7c331e35a245d8cb8b5/coverage-7.15.4-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:d003b7a5708ddad5c206c79607a6b92abb6fc13c57d99d8a4468cc03a2941ced", size = 256682, upload-time = "2026-08-06T13:49:34.089Z" }, + { url = "https://files.pythonhosted.org/packages/dc/f2/bacdbde18b69ed2de424fcf64d9fb0a4913753d4f0eca8bae9daad69f4bd/coverage-7.15.4-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:c38efe30fd74e5c19e9433f11fb1f5dc9c6522770971b7c6145bbaa413dc8800", size = 254560, upload-time = "2026-08-06T13:49:36.052Z" }, + { url = "https://files.pythonhosted.org/packages/6c/a3/1fb927196e3477c1b48831169ab58ba08f451ba87ae311ff1de68b26a616/coverage-7.15.4-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:1f4f826d70f772ab8b0c052329580d7fe8b8abd191e4ce0c8f81aec6614665d3", size = 258792, upload-time = "2026-08-06T13:49:38.01Z" }, + { url = "https://files.pythonhosted.org/packages/41/58/30d4c149c69053de0edfe325614c1d28d508f62b1783e0e4a234d2e49136/coverage-7.15.4-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:4a4bf917c9953f57c957be31c1cd504e3bd2f34d4a352b9d391a3025336f6768", size = 253968, upload-time = "2026-08-06T13:49:39.934Z" }, + { url = "https://files.pythonhosted.org/packages/89/e4/77f639371b918aad30dda4051f95404b43578f7f2e2f87ba73e02ed1ff37/coverage-7.15.4-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:1c9bf40ebef178a45192c75c4964760bb261b0e6ad725da5fc4c93f674f19753", size = 255893, upload-time = "2026-08-06T13:49:41.825Z" }, + { url = "https://files.pythonhosted.org/packages/5c/62/13be29b3ddab35f14c87967a4820a05106d2a3eccb4fa4ff550bf30b75e0/coverage-7.15.4-cp315-cp315-win32.whl", hash = "sha256:43619d04c3671792d2c4706ae8bf45e265dc87bbd4078189ef8b847ea1e74be2", size = 224768, upload-time = "2026-08-06T13:49:44.08Z" }, + { url = "https://files.pythonhosted.org/packages/a1/70/af0c6be0f964af6954f6b74bc109b0dbca02824696d2520fb17fe1ab06e3/coverage-7.15.4-cp315-cp315-win_amd64.whl", hash = "sha256:be619439dbcd31a2eab10b32de9fff62c26ed4bab69dc32b8363fdaaa0882809", size = 225242, upload-time = "2026-08-06T13:49:45.899Z" }, + { url = "https://files.pythonhosted.org/packages/4f/2d/f3bd3aab899fc9efc18b53133ee68f5f98574ef480649b23e12962226387/coverage-7.15.4-cp315-cp315-win_arm64.whl", hash = "sha256:def597967dafc2e8d97c9097ea453c464e0bb8ed38f193a43070f10dc623bb6d", size = 224674, upload-time = "2026-08-06T13:49:48.322Z" }, + { url = "https://files.pythonhosted.org/packages/f5/ca/f69251cd63eabc6438321aea22148754cce758a26bde07dd490e3fe7cfc5/coverage-7.15.4-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:c7dbc748ac8a1e3e59a2b28bea47675e6e778081dbbf081bde0d75def2fcbe1d", size = 223333, upload-time = "2026-08-06T13:49:50.293Z" }, + { url = "https://files.pythonhosted.org/packages/a7/a7/037b53b2885b0d8447064432491a4d5a1014cd9f97a594d53acd0c04541a/coverage-7.15.4-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:2413074a5ecbb61a01a7888fc72db0ca324d13588c5b38bc0dd8564cdcdfea26", size = 223630, upload-time = "2026-08-06T13:49:52.637Z" }, + { url = "https://files.pythonhosted.org/packages/80/4f/152b8a4779ae90da11bb24f7467df8a59f0be48a5c52acb856325ca48289/coverage-7.15.4-cp315-cp315t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:4e6f6f632b7b2f714bf7a1346e8f97b650ee71f3c298aaad42a2ab60f0f07645", size = 264489, upload-time = "2026-08-06T13:49:54.52Z" }, + { url = "https://files.pythonhosted.org/packages/10/2d/84b4b9e0e1dd6528a51920ff7031f35b789382e467a28ec6a5a578cb8812/coverage-7.15.4-cp315-cp315t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:8df457da2249d3c75ca2e5e835d59c725abfe92d27fdff6cd99eed85b51d5e9a", size = 267567, upload-time = "2026-08-06T13:49:56.721Z" }, + { url = "https://files.pythonhosted.org/packages/53/fc/ba01cc25299f9f8a2c8b02d3b28c53f3543d9fbfbe4e74fa2760b48f163e/coverage-7.15.4-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:050f66a08805acb5b8a23c6d4a517b1ecf82c08e81ed0e4bd727df065e5c6624", size = 270123, upload-time = "2026-08-06T13:49:58.736Z" }, + { url = "https://files.pythonhosted.org/packages/cf/d0/db2647cbf40b14f8c308f94ff7bf89c06d564e59f396906edf50086ec788/coverage-7.15.4-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:1587fb771d1ccceef708fdde1e5af8c7ed24b486b61d13a321acb7d8145390aa", size = 271107, upload-time = "2026-08-06T13:50:00.811Z" }, + { url = "https://files.pythonhosted.org/packages/70/ff/4d2d17924552c458bb4f77dd631f0e3bc92fbbdf2d2d916cd4b33bbfd5b1/coverage-7.15.4-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8b4f1c3a69ca580f3fbd6b2046915f536d7f586874f25c1bb23add2a3c88d50f", size = 264955, upload-time = "2026-08-06T13:50:03.023Z" }, + { url = "https://files.pythonhosted.org/packages/ee/de/dc010c7a3691f396d93bbc26bfcafa1c2a3a351cd520470f15faf5795bd5/coverage-7.15.4-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:ffb58d7eff5b7f6ecc6fa21d6288ab7f968a212cb67d682c269c09b9eba3b66f", size = 267949, upload-time = "2026-08-06T13:50:05.557Z" }, + { url = "https://files.pythonhosted.org/packages/78/ea/dc96a11375e83c045c2f7c61fb6918277cfe9401db7c0f7b1d111a84b2e5/coverage-7.15.4-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:d9df165544774574ee004b953023d1bebada1894a80b1052a43d798b0f676e67", size = 264421, upload-time = "2026-08-06T13:50:07.612Z" }, + { url = "https://files.pythonhosted.org/packages/c8/86/b77131a0f9503ce461cd577076147d7a9040f0c5dda772686f729e2cc9cb/coverage-7.15.4-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:f9de0a24a4079b53e523b5c5e2c5945ec251ab486652659955187cf255a259bc", size = 269121, upload-time = "2026-08-06T13:50:09.58Z" }, + { url = "https://files.pythonhosted.org/packages/24/24/944bc35007862955e7ebf05754e645419dcf5d7526c52735cfa2715e8ebf/coverage-7.15.4-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:150089274bdc9f940628552cb92844e0223c987f1902ab8efe9f45a2ec758d88", size = 264565, upload-time = "2026-08-06T13:50:11.722Z" }, + { url = "https://files.pythonhosted.org/packages/c7/cc/a3bb9f93e7e740659163e2ea584f8196ddcd2c456a5dbe15f6c50105fec1/coverage-7.15.4-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:a58a94fed5da6997d258e8f7668c1e195fbd04a691d781b7558f1e468f9e68bc", size = 266522, upload-time = "2026-08-06T13:50:13.786Z" }, + { url = "https://files.pythonhosted.org/packages/49/dd/e0e40f3560d878d888c580698ff5ad1179f5e1c3ac949684ef66b41a3817/coverage-7.15.4-cp315-cp315t-win32.whl", hash = "sha256:ebd5a6d8466ff30836572f3ba2cae8a5e8f85029b1c6d5e2ed338dc472a5166a", size = 225068, upload-time = "2026-08-06T13:50:15.825Z" }, + { url = "https://files.pythonhosted.org/packages/c6/7e/37732ea80eebc30e976e4cdab15c190bc42d96959a42e38ddf6f8c60468f/coverage-7.15.4-cp315-cp315t-win_amd64.whl", hash = "sha256:288bde2a2d7ab6b6c2d7252fcde8b524387f2d970bdba9658fc6f8bbcaef0f9b", size = 225895, upload-time = "2026-08-06T13:50:17.928Z" }, + { url = "https://files.pythonhosted.org/packages/c6/08/1e00f7923eaaba45fb3d51dd794125fc766304b1df264f3a9c6557bfb30e/coverage-7.15.4-cp315-cp315t-win_arm64.whl", hash = "sha256:68be5e1de60ff13c9095bbec0e5a7fa45b33b101752215b91345ea1f61c4a278", size = 225213, upload-time = "2026-08-06T13:50:19.981Z" }, + { url = "https://files.pythonhosted.org/packages/b4/d9/e70c286c979378f061d8266e279b686ab0b0b688e1fe0af864684f23a77d/coverage-7.15.4-py3-none-any.whl", hash = "sha256:964730a1e9de9c0cf11be6a1a3c79ce419c34882842abd256086ba4698705e84", size = 214332, upload-time = "2026-08-06T13:50:22.192Z" }, ] [package.optional-dependencies] @@ -532,67 +598,64 @@ toml = [ [[package]] name = "cryptography" -version = "48.0.0" +version = "50.0.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "cffi", marker = "platform_python_implementation != 'PyPy'" }, { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/9f/a9/db8f313fdcd85d767d4973515e1db101f9c71f95fced83233de224673757/cryptography-48.0.0.tar.gz", hash = "sha256:5c3932f4436d1cccb036cb0eaef46e6e2db91035166f1ad6505c3c9d5a635920", size = 832984, upload-time = "2026-05-04T22:59:38.133Z" } +sdist = { url = "https://files.pythonhosted.org/packages/bb/ad/5d6702db60b1e40b41ef513b6967ff5848f307d50f8449baf1634f5908f1/cryptography-50.0.1.tar.gz", hash = "sha256:5dd9bda1c12b4162f6ff568eeb5e0ff956c28d14406e875cfe8a63a2d414ff20", size = 880381, upload-time = "2026-08-25T19:45:45.499Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/df/3d/01f6dd9190170a5a241e0e98c2d04be3664a9e6f5b9b872cde63aff1c3dd/cryptography-48.0.0-cp311-abi3-macosx_10_9_universal2.whl", hash = "sha256:0c558d2cdffd8f4bbb30fc7134c74d2ca9a476f830bb053074498fbc86f41ed6", size = 8001587, upload-time = "2026-05-04T22:57:36.803Z" }, - { url = "https://files.pythonhosted.org/packages/b2/6e/e90527eef33f309beb811cf7c982c3aeffcce8e3edb178baa4ca3ae4a6fa/cryptography-48.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:f5333311663ea94f75dd408665686aaf426563556bb5283554a3539177e03b8c", size = 4690433, upload-time = "2026-05-04T22:57:40.373Z" }, - { url = "https://files.pythonhosted.org/packages/90/04/673510ed51ddff56575f306cf1617d80411ee76831ccd3097599140efdfe/cryptography-48.0.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7995ef305d7165c3f11ae07f2517e5a4f1d5c18da1376a0a9ed496336b69e5f3", size = 4710620, upload-time = "2026-05-04T22:57:42.935Z" }, - { url = "https://files.pythonhosted.org/packages/14/d5/e9c4ef932c8d800490c34d8bd589d64a31d5890e27ec9e9ad532be893294/cryptography-48.0.0-cp311-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:40ba1f85eaa6959837b1d51c9767e230e14612eea4ef110ee8854ada22da1bf5", size = 4696283, upload-time = "2026-05-04T22:57:45.294Z" }, - { url = "https://files.pythonhosted.org/packages/0c/29/174b9dfb60b12d59ecfc6cfa04bc88c21b42a54f01b8aae09bb6e51e4c7f/cryptography-48.0.0-cp311-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:369a6348999f94bbd53435c894377b20ab95f25a9065c283570e70150d8abc3c", size = 5296573, upload-time = "2026-05-04T22:57:47.933Z" }, - { url = "https://files.pythonhosted.org/packages/95/38/0d29a6fd7d0d1373f0c0c88a04ba20e359b257753ac497564cd660fc1d55/cryptography-48.0.0-cp311-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:a0e692c683f4df67815a2d258b324e66f4738bd7a96a218c826dce4f4bd05d8f", size = 4743677, upload-time = "2026-05-04T22:57:50.067Z" }, - { url = "https://files.pythonhosted.org/packages/30/be/eef653013d5c63b6a490529e0316f9ac14a37602965d4903efed1399f32b/cryptography-48.0.0-cp311-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:18349bbc56f4743c8b12dc32e2bccb2cf83ee8b69a3bba74ef8ae857e26b3d25", size = 4330808, upload-time = "2026-05-04T22:57:52.301Z" }, - { url = "https://files.pythonhosted.org/packages/84/9e/500463e87abb7a0a0f9f256ec21123ecde0a7b5541a15e840ea54551fd81/cryptography-48.0.0-cp311-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:7e8eac43dfca5c4cccc6dad9a80504436fca53bb9bc3100a2386d730fbe6b602", size = 4695941, upload-time = "2026-05-04T22:57:54.603Z" }, - { url = "https://files.pythonhosted.org/packages/e3/dc/7303087450c2ec9e7fbb750e17c2abfbc658f23cbd0e54009509b7cc4091/cryptography-48.0.0-cp311-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:9ccdac7d40688ecb5a3b4a604b8a88c8002e3442d6c60aead1db2a89a041560c", size = 5252579, upload-time = "2026-05-04T22:57:57.207Z" }, - { url = "https://files.pythonhosted.org/packages/d0/c0/7101d3b7215edcdc90c45da544961fd8ed2d6448f77577460fa75a8443f7/cryptography-48.0.0-cp311-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:bd72e68b06bb1e96913f97dd4901119bc17f39d4586a5adf2d3e47bc2b9d58b5", size = 4743326, upload-time = "2026-05-04T22:57:59.535Z" }, - { url = "https://files.pythonhosted.org/packages/ac/d8/5b833bad13016f562ab9d063d68199a4bd121d18458e439515601d3357ec/cryptography-48.0.0-cp311-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:59baa2cb386c4f0b9905bd6eb4c2a79a69a128408fd31d32ca4d7102d4156321", size = 4826672, upload-time = "2026-05-04T22:58:01.996Z" }, - { url = "https://files.pythonhosted.org/packages/98/e1/7074eb8bf3c135558c73fc2bcf0f5633f912e6fb87e868a55c454080ef09/cryptography-48.0.0-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:9249e3cd978541d665967ac2cb2787fd6a62bddf1e75b3e347a594d7dacf4f74", size = 4972574, upload-time = "2026-05-04T22:58:03.968Z" }, - { url = "https://files.pythonhosted.org/packages/04/70/e5a1b41d325f797f39427aa44ef8baf0be500065ab6d8e10369d850d4a4f/cryptography-48.0.0-cp311-abi3-win32.whl", hash = "sha256:9c459db21422be75e2809370b829a87eb37f74cd785fc4aa9ea1e5f43b47cda4", size = 3294868, upload-time = "2026-05-04T22:58:06.467Z" }, - { url = "https://files.pythonhosted.org/packages/f4/ac/8ac51b4a5fc5932eb7ee5c517ba7dc8cd834f0048962b6b352f00f41ebf9/cryptography-48.0.0-cp311-abi3-win_amd64.whl", hash = "sha256:5b012212e08b8dd5edc78ef54da83dd9892fd9105323b3993eff6bea65dc21d7", size = 3817107, upload-time = "2026-05-04T22:58:08.845Z" }, - { url = "https://files.pythonhosted.org/packages/6b/84/70e3feea9feea87fd7cbe77efb2712ae1e3e6edf10749dc6e95f4e60e455/cryptography-48.0.0-cp314-cp314t-macosx_10_9_universal2.whl", hash = "sha256:3cb07a3ed6431663cd321ea8a000a1314c74211f823e4177fefa2255e057d1ec", size = 7986556, upload-time = "2026-05-04T22:58:11.172Z" }, - { url = "https://files.pythonhosted.org/packages/89/6e/18e07a618bb5442ba10cf4df16e99c071365528aa570dfcb8c02e25a303b/cryptography-48.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:8c7378637d7d88016fa6791c159f698b3d3eed28ebf844ac36b9dc04a14dae18", size = 4684776, upload-time = "2026-05-04T22:58:13.712Z" }, - { url = "https://files.pythonhosted.org/packages/be/6a/4ea3b4c6c6759794d5ee2103c304a5076dc4b19ae1f9fe47dba439e159e9/cryptography-48.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:cc90c0b39b2e3c65ef52c804b72e3c58f8a04ab2a1871272798e5f9572c17d20", size = 4698121, upload-time = "2026-05-04T22:58:16.448Z" }, - { url = "https://files.pythonhosted.org/packages/2f/59/6ff6ad6cae03bb887da2a5860b2c9805f8dac969ef01ce563336c49bd1d1/cryptography-48.0.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:76341972e1eff8b4bea859f09c0d3e64b96ce931b084f9b9b7db8ef364c30eff", size = 4690042, upload-time = "2026-05-04T22:58:18.544Z" }, - { url = "https://files.pythonhosted.org/packages/ca/b4/fc334ed8cfd705aca282fe4d8f5ae64a8e0f74932e9feecb344610cf6e4d/cryptography-48.0.0-cp314-cp314t-manylinux_2_28_ppc64le.whl", hash = "sha256:55b7718303bf06a5753dcdccf2f3945cf18ad7bffde41b61226e4db31ab89a9c", size = 5282526, upload-time = "2026-05-04T22:58:20.75Z" }, - { url = "https://files.pythonhosted.org/packages/11/08/9f8c5386cc4cd90d8255c7cdd0f5baf459a08502a09de30dc51f553d38dc/cryptography-48.0.0-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:a64697c641c7b1b2178e573cbc31c7c6684cd56883a478d75143dbb7118036db", size = 4733116, upload-time = "2026-05-04T22:58:23.627Z" }, - { url = "https://files.pythonhosted.org/packages/b8/77/99307d7574045699f8805aa500fa0fb83422d115b5400a064ddd306d7750/cryptography-48.0.0-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:561215ea3879cb1cbbf272867e2efda62476f240fb58c64de6b393ae19246741", size = 4316030, upload-time = "2026-05-04T22:58:25.581Z" }, - { url = "https://files.pythonhosted.org/packages/fd/36/a608b98337af3cb2aff4818e406649d30572b7031918b04c87d979495348/cryptography-48.0.0-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:ad64688338ed4bc1a6618076ba75fd7194a5f1797ac60b47afe926285adb3166", size = 4689640, upload-time = "2026-05-04T22:58:27.747Z" }, - { url = "https://files.pythonhosted.org/packages/dd/a6/825010a291b4438aecc1f568bc428189fc1175515223632477c07dc0a6df/cryptography-48.0.0-cp314-cp314t-manylinux_2_34_ppc64le.whl", hash = "sha256:906cbf0670286c6e0044156bc7d4af9cbb0ef6db9f73e52c3ec56ba6bdde5336", size = 5237657, upload-time = "2026-05-04T22:58:29.848Z" }, - { url = "https://files.pythonhosted.org/packages/b9/09/4e76a09b4caa29aad535ddc806f5d4c5d01885bd978bd984fbc6ca032cae/cryptography-48.0.0-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:ea8990436d914540a40ab24b6a77c0969695ed52f4a4874c5137ccf7045a7057", size = 4732362, upload-time = "2026-05-04T22:58:32.009Z" }, - { url = "https://files.pythonhosted.org/packages/18/78/444fa04a77d0cb95f417dda20d450e13c56ba8e5220fc892a1658f44f882/cryptography-48.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:c18684a7f0cc9a3cb60328f496b8e3372def7c5d2df39ac267878b05565aaaae", size = 4819580, upload-time = "2026-05-04T22:58:34.254Z" }, - { url = "https://files.pythonhosted.org/packages/38/85/ea67067c70a1fd4be2c63d35eeed82658023021affccc7b17705f8527dd2/cryptography-48.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:9be5aafa5736574f8f15f262adc81b2a9869e2cfe9014d52a44633905b40d52c", size = 4963283, upload-time = "2026-05-04T22:58:36.376Z" }, - { url = "https://files.pythonhosted.org/packages/75/54/cc6d0f3deac3e81c7f847e8a189a12b6cdd65059b43dad25d4316abd849a/cryptography-48.0.0-cp314-cp314t-win32.whl", hash = "sha256:c17dfe85494deaeddc5ce251aebd1d60bbe6afc8b62071bb0b469431a000124f", size = 3270954, upload-time = "2026-05-04T22:58:38.791Z" }, - { url = "https://files.pythonhosted.org/packages/49/67/cc947e288c0758a4e5473d1dcb743037ab7785541265a969240b8885441a/cryptography-48.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:27241b1dc9962e056062a8eef1991d02c3a24569c95975bd2322a8a52c6e5e12", size = 3797313, upload-time = "2026-05-04T22:58:40.746Z" }, - { url = "https://files.pythonhosted.org/packages/f2/63/61d4a4e1c6b6bab6ce1e213cd36a24c415d90e76d78c5eb8577c5541d2e8/cryptography-48.0.0-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:58d00498e8933e4a194f3076aee1b4a97dfec1a6da444535755822fe5d8b0b86", size = 7983482, upload-time = "2026-05-04T22:58:43.769Z" }, - { url = "https://files.pythonhosted.org/packages/d5/ac/f5b5995b87770c693e2596559ffafe195b4033a57f14a82268a2842953f3/cryptography-48.0.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:614d0949f4790582d2cc25553abd09dd723025f0c0e7c67376a1d77196743d6e", size = 4683266, upload-time = "2026-05-04T22:58:46.064Z" }, - { url = "https://files.pythonhosted.org/packages/ec/c6/8b14f67e18338fbc4adb76f66c001f5c3610b3e2d1837f268f47a347dbbb/cryptography-48.0.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7ce4bfae76319a532a2dc68f82cc32f5676ee792a983187dac07183690e5c66f", size = 4696228, upload-time = "2026-05-04T22:58:48.22Z" }, - { url = "https://files.pythonhosted.org/packages/ea/73/f808fbae9514bd91b47875b003f13e284c8c6bdfd904b7944e803937eec1/cryptography-48.0.0-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:2eb992bbd4661238c5a397594c83f5b4dc2bc5b848c365c8f991b6780efcc5c7", size = 4689097, upload-time = "2026-05-04T22:58:50.9Z" }, - { url = "https://files.pythonhosted.org/packages/93/01/d86632d7d28db8ae83221995752eeb6639ffb374c2d22955648cf8d52797/cryptography-48.0.0-cp39-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:22a5cb272895dce158b2cacdfdc3debd299019659f42947dbdac6f32d68fe832", size = 5283582, upload-time = "2026-05-04T22:58:53.017Z" }, - { url = "https://files.pythonhosted.org/packages/02/e1/50edc7a50334807cc4791fc4a0ce7468b4a1416d9138eab358bfc9a3d70b/cryptography-48.0.0-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:2b4d59804e8408e2fea7d1fbaf218e5ec984325221db76e6a241a9abd6cdd95c", size = 4730479, upload-time = "2026-05-04T22:58:55.611Z" }, - { url = "https://files.pythonhosted.org/packages/6f/af/99a582b1b1641ff5911ac559beb45097cf79efd4ead4657f578ef1af2d47/cryptography-48.0.0-cp39-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:984a20b0f62a26f48a3396c72e4bc34c66e356d356bf370053066b3b6d54634a", size = 4326481, upload-time = "2026-05-04T22:58:57.607Z" }, - { url = "https://files.pythonhosted.org/packages/90/ee/89aa26a06ef0a7d7611788ffd571a7c50e368cc6a4d5eef8b4884e866edb/cryptography-48.0.0-cp39-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:5a5ed8fde7a1d09376ca0b40e68cd59c69fe23b1f9768bd5824f54681626032a", size = 4688713, upload-time = "2026-05-04T22:59:00.077Z" }, - { url = "https://files.pythonhosted.org/packages/70/ba/bcb1b0bb7a33d4c7c0c4d4c7874b4a62ae4f56113a5f4baefa362dfb1f0f/cryptography-48.0.0-cp39-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:8cd666227ef7af430aa5914a9910e0ddd703e75f039cef0825cd0da71b6b711a", size = 5238165, upload-time = "2026-05-04T22:59:02.317Z" }, - { url = "https://files.pythonhosted.org/packages/c9/70/ca4003b1ce5ca3dc3186ada51908c8a9b9ff7d5cab83cc0d43ee14ec144f/cryptography-48.0.0-cp39-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:9071196d81abc88b3516ac8cdfad32e2b66dd4a5393a8e68a961e9161ddc6239", size = 4729947, upload-time = "2026-05-04T22:59:05.255Z" }, - { url = "https://files.pythonhosted.org/packages/44/a0/4ec7cf774207905aef1a8d11c3750d5a1db805eb380ee4e16df317870128/cryptography-48.0.0-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:1e2d54c8be6152856a36f0882ab231e70f8ec7f14e93cf87db8a2ed056bf160c", size = 4822059, upload-time = "2026-05-04T22:59:07.802Z" }, - { url = "https://files.pythonhosted.org/packages/1e/75/a2e55f99c16fcac7b5d6c1eb19ad8e00799854d6be5ca845f9259eae1681/cryptography-48.0.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a5da777e32ffed6f85a7b2b3f7c5cbc88c146bfcd0a1d7baf5fcc6c52ee35dd4", size = 4960575, upload-time = "2026-05-04T22:59:09.851Z" }, - { url = "https://files.pythonhosted.org/packages/b8/23/6e6f32143ab5d8b36ca848a502c4bcd477ae75b9e1677e3530d669062578/cryptography-48.0.0-cp39-abi3-win32.whl", hash = "sha256:77a2ccbbe917f6710e05ba9adaa25fb5075620bf3ea6fb751997875aff4ae4bd", size = 3279117, upload-time = "2026-05-04T22:59:12.019Z" }, - { url = "https://files.pythonhosted.org/packages/9d/9a/0fea98a70cf1749d41d738836f6349d97945f7c89433a259a6c2642eefeb/cryptography-48.0.0-cp39-abi3-win_amd64.whl", hash = "sha256:16cd65b9330583e4619939b3a3843eec1e6e789744bb01e7c7e2e62e33c239c8", size = 3792100, upload-time = "2026-05-04T22:59:14.884Z" }, - { url = "https://files.pythonhosted.org/packages/be/d2/024b5e06be9d44cb021fb0e1a03d34d63989cf56a0fe62f3dfbab695b9b4/cryptography-48.0.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:84cf79f0dc8b36ac5da873481716e87aef31fcfa0444f9e1d8b4b2cece142855", size = 3950391, upload-time = "2026-05-04T22:59:17.415Z" }, - { url = "https://files.pythonhosted.org/packages/bc/17/3861e17c56fa0fd37491a14a8673fdb77c57fc5693cafe745ea8b06dba75/cryptography-48.0.0-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:fdfef35d751d510fcef5252703621574364fec16418c4a1e5e1055248401054b", size = 4637126, upload-time = "2026-05-04T22:59:20.197Z" }, - { url = "https://files.pythonhosted.org/packages/f0/0a/7e226dbff530f21480727eb764973a7bff2b912f8e15cd4f129e71b56d1d/cryptography-48.0.0-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:0890f502ddf7d9c6426129c3f49f5c0a39278ed7cd6322c8755ffca6ee675a13", size = 4667270, upload-time = "2026-05-04T22:59:22.647Z" }, - { url = "https://files.pythonhosted.org/packages/3b/f2/5a72274ca9f1b2a8b44a662ee0bf1b435909deb473d6f97bcd035bcdbc71/cryptography-48.0.0-pp311-pypy311_pp73-manylinux_2_34_aarch64.whl", hash = "sha256:ecde28a596bead48b0cfd2a1b4416c3d43074c2d785e3a398d7ec1fc4d0f7fbb", size = 4636797, upload-time = "2026-05-04T22:59:24.912Z" }, - { url = "https://files.pythonhosted.org/packages/b4/e1/48cedb2fe63626e91ded1edad159e2a4fb8b6906c4425eb7749673077ce7/cryptography-48.0.0-pp311-pypy311_pp73-manylinux_2_34_x86_64.whl", hash = "sha256:4defde8685ae324a9eb9d818717e93b4638ef67070ac9bc15b8ca85f63048355", size = 4666800, upload-time = "2026-05-04T22:59:27.474Z" }, - { url = "https://files.pythonhosted.org/packages/a2/ca/7e8365deec19afb2b2c7be7c1c0aa8f99633b54e90c570999acda93260fc/cryptography-48.0.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:db63bf618e5dea46c07de12e900fe1cdd2541e6dc9dbae772a70b7d4d4765f6a", size = 3739536, upload-time = "2026-05-04T22:59:29.61Z" }, + { url = "https://files.pythonhosted.org/packages/ba/19/797e2aaac9df6a66f1550f49979dc1b1e39ecd2077501c30efa81e8d5d67/cryptography-50.0.1-cp311-abi3-macosx_11_0_arm64.whl", hash = "sha256:b8f852c65863251b9e3a1b8c150ce21e59b522dbb6a7d4bc80e680d38388e986", size = 4010153, upload-time = "2026-08-25T19:44:03.155Z" }, + { url = "https://files.pythonhosted.org/packages/90/34/9ce9a62ed9dc82ca9fd6a34445b6904af56e5f38b3eae2ed32e49c36053d/cryptography-50.0.1-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:53e279950892dc102c6b4e52af03ae5ea92fac572a1ddab78ca73a997f62b69f", size = 4723133, upload-time = "2026-08-25T19:44:05.461Z" }, + { url = "https://files.pythonhosted.org/packages/57/26/e6d4fc8512a51a5f9ee7bfdbfb853bce1197087df40c9ad993ad370b846f/cryptography-50.0.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ff838d62ec1bfce4f9ba7fa16f4a7b554cd8d0c299e6be37502161a660c84eef", size = 4712478, upload-time = "2026-08-25T19:44:07.375Z" }, + { url = "https://files.pythonhosted.org/packages/e6/de/d3cdc2815697aae84126cbd6a030ca7b6b452e28a88b501b836bd3aa7a86/cryptography-50.0.1-cp311-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:e74591e283fe6eb956416c929eb58262a719fe0311fd9054c62c3350ed8760d8", size = 4730726, upload-time = "2026-08-25T19:44:09.294Z" }, + { url = "https://files.pythonhosted.org/packages/55/32/38c0d344b98c06d34b5df8946565a9c0d6dbf32c8e0730a7f05f0a3c6cab/cryptography-50.0.1-cp311-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:5fe002589592ed749ce77fe0695fcbd3500dd61d7d6db5858a7544c612fa8e45", size = 5353524, upload-time = "2026-08-25T19:44:11.96Z" }, + { url = "https://files.pythonhosted.org/packages/e1/1b/82f0f0d8858d4432be1af790477edf62aef90324041aa07c57e57bef1af7/cryptography-50.0.1-cp311-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:51593d180cf6d179bde5c5d065bed81386b1f381656ae7d042b7ffc87a9895ad", size = 4746720, upload-time = "2026-08-25T19:44:14.051Z" }, + { url = "https://files.pythonhosted.org/packages/29/ba/042ca458b8c64348c768284b5d23e69b92ed53d057ab779fee628564676d/cryptography-50.0.1-cp311-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:359e62deae718bce96170e223fdcb6357e4fbd3bb7a3a75f4430763532560e49", size = 4361866, upload-time = "2026-08-25T19:44:16.167Z" }, + { url = "https://files.pythonhosted.org/packages/39/3b/e96c1ef71edef71057c7e3c3d982ce8fda554e0c52d0cc19c18845cde3eb/cryptography-50.0.1-cp311-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:e2ca8fd1b6b4b82a1c4cb02841d0837e3c12336c2e24b520ab8ab3b969733d8f", size = 4730028, upload-time = "2026-08-25T19:44:18.085Z" }, + { url = "https://files.pythonhosted.org/packages/e3/38/45abd72ef63f2e7d0754a6cacf97bd8b69512ace7f6130d24c39ece65da2/cryptography-50.0.1-cp311-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:76de83fbd91ac49c0feaaa983d0748fd7a53176afac5fb3bf7478d244f0eb527", size = 5308405, upload-time = "2026-08-25T19:44:20.197Z" }, + { url = "https://files.pythonhosted.org/packages/85/66/6ccca4722987ddedaa7fc9c3f4708af7431f5535666c174350830888c6b7/cryptography-50.0.1-cp311-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:51afcfceb15597cf2635068e4ac9a56b2abde622edde17f37d85fd7b5306497a", size = 4746230, upload-time = "2026-08-25T19:44:22.376Z" }, + { url = "https://files.pythonhosted.org/packages/13/0e/b1f92e013228111413f2e6743948b80bc24dfd3c1b87ba98ceea16f5df89/cryptography-50.0.1-cp311-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:be224a65493ec5b74a158ff22a5522ce4a5ca1e543c647a3a4730d4a09e5f959", size = 4862596, upload-time = "2026-08-25T19:44:24.472Z" }, + { url = "https://files.pythonhosted.org/packages/7e/22/c3654cccc856e9d682817b04ac3ee79731cb09ca6f95996a95c904de2883/cryptography-50.0.1-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:9ebcdd5519be9b652a46f507817a74591774fc3d6923ac364e4dfa64e36b291b", size = 5014082, upload-time = "2026-08-25T19:44:26.709Z" }, + { url = "https://files.pythonhosted.org/packages/42/8b/cb12b1b60c91b074ca6bf0fdd59aa8f10d8bc5f73af8faece86ef0421b37/cryptography-50.0.1-cp311-abi3-win_amd64.whl", hash = "sha256:aed8db4f6d71c51efb89530e12d9464e7bf2923d46c3205dc794a2a93f8c0648", size = 3842826, upload-time = "2026-08-25T19:44:28.784Z" }, + { url = "https://files.pythonhosted.org/packages/5b/f0/424cb557d99aa86ac55da5e2add02e2882e44047b6264f93ade1b975a993/cryptography-50.0.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:30a125032e5642a21ff816e021152bd4e7e94f03eff3f4b7fca41cd22bc3110f", size = 3973525, upload-time = "2026-08-25T19:44:30.7Z" }, + { url = "https://files.pythonhosted.org/packages/4d/72/3a2711d967977ab5fc80b782837c7e8d1ac7445e764c20c381a265c57ef3/cryptography-50.0.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:a0b1a59e3a089064a0ec309e9428c8e3ae4e161419d20ac33600767e83fc658a", size = 4708817, upload-time = "2026-08-25T19:44:32.773Z" }, + { url = "https://files.pythonhosted.org/packages/b4/f2/bb1f56e10815b789df0b409a69fa4992ff3d3fef9c72747f4a6b26fed38e/cryptography-50.0.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:8921d58f426793c5f1b47f0b59575780de9a095214958d0eb37d909593db8367", size = 4697300, upload-time = "2026-08-25T19:44:35.144Z" }, + { url = "https://files.pythonhosted.org/packages/08/bd/ed5396be499ffcf8807a585bfe38b71a1fbdd1c342b4f9b6d0ef5162a946/cryptography-50.0.1-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:a8f40ea47330e71b594a7e246898f93177c259490c63183dbaf9e571d71ed9a5", size = 4716039, upload-time = "2026-08-25T19:44:37.192Z" }, + { url = "https://files.pythonhosted.org/packages/f6/6e/1cf405c5c8e8df7545378048e954792f00b7f2367af8863ce8b8f3e10607/cryptography-50.0.1-cp314-cp314t-manylinux_2_28_ppc64le.whl", hash = "sha256:a255449073358275b64b67d3f595f268bbef70e72b6edb65e0c70c735bf739c9", size = 5332388, upload-time = "2026-08-25T19:44:39.16Z" }, + { url = "https://files.pythonhosted.org/packages/47/92/b4317e8c32c4f47b062f5398bd79106b220a124546f42be83bf32b761e2a/cryptography-50.0.1-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:8df2de9102026855887e4587084f6eabd80ed0f345b8ad8a7ac27ab9bf4723e0", size = 4730293, upload-time = "2026-08-25T19:44:41.298Z" }, + { url = "https://files.pythonhosted.org/packages/39/0d/a1e7633e2c744d0f2983320a27e924ef2264c79c56e1a58d5fb0a1cfd413/cryptography-50.0.1-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:ac02b07824d4d1001bd4367599f839c19cb171924c796e52c23508ac14c2c0cc", size = 4346031, upload-time = "2026-08-25T19:44:43.245Z" }, + { url = "https://files.pythonhosted.org/packages/88/dd/b215616f9bab3fc18510c78a4e5c9f362d77838503c363dc747c7d4f5c6f/cryptography-50.0.1-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:cbf74a81765ee67413503ca6e26dcc4f6f5a519822436cc0a1b97aab6c1b8a17", size = 4715344, upload-time = "2026-08-25T19:44:45.291Z" }, + { url = "https://files.pythonhosted.org/packages/b1/1b/ec3ebd31741d0e963612c4fe43caa39341b9b1e031e469820e42e4c83918/cryptography-50.0.1-cp314-cp314t-manylinux_2_34_ppc64le.whl", hash = "sha256:16c5ecd954b3330ebfb6605eca4fd952da8bef376551d5cc264534e3770a9ee6", size = 5287201, upload-time = "2026-08-25T19:44:47.297Z" }, + { url = "https://files.pythonhosted.org/packages/1a/01/0127d11a762b31a9ee0221894f540318761783f3fdc4bc5d057698caebd5/cryptography-50.0.1-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:79bf008d1f9af6071c797ad133e39915dfee7614f18f18f4db9072eb715064a3", size = 4730023, upload-time = "2026-08-25T19:44:49.435Z" }, + { url = "https://files.pythonhosted.org/packages/9e/b9/e7425ebfb599241a0c1d7000f1b466c3062da66c19d9525031315dff7213/cryptography-50.0.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:330fbb252391c596f1ae42c5754449dc924e6ad012dca8efe0d703f9f2d12ec6", size = 4847362, upload-time = "2026-08-25T19:44:51.94Z" }, + { url = "https://files.pythonhosted.org/packages/2d/fd/60d0ddf4defa12e482c9d5e0f554384d6e8ab25341fd15f060028fd92e6a/cryptography-50.0.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:42be3bb70596b3abe4ac097b75be223e8b3ab614a0e5de068e3dcc54d71d6149", size = 4999247, upload-time = "2026-08-25T19:44:53.876Z" }, + { url = "https://files.pythonhosted.org/packages/4d/56/bc4f2b209e766c93372cfcd59b781a0b2b59700f62a969580415b699c2b2/cryptography-50.0.1-cp314-cp314t-win_amd64.whl", hash = "sha256:f74455bb086a85d5e81246412602aaa97ed095e504cd40dd261ef50be42205bf", size = 3825806, upload-time = "2026-08-25T19:44:56.209Z" }, + { url = "https://files.pythonhosted.org/packages/84/a9/ee16a903f13755e914d1eecc482fe64d1f10761c3960e5d8fa6837377aff/cryptography-50.0.1-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:ca83d00d9e69cd5eb63f2e69c3a5a59e0cecae5ae14c6ae0b35830fe3b37bad0", size = 4035307, upload-time = "2026-08-25T19:44:58.305Z" }, + { url = "https://files.pythonhosted.org/packages/5e/a5/9ec7e81e8526c0d7a387d73386b2daed3f39e10d81a85930bd1b6bfba65c/cryptography-50.0.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:05ba322c4da95b262a212c345af888ef2c37c88c0509756ea00a0e6d68850f23", size = 4751900, upload-time = "2026-08-25T19:45:00.401Z" }, + { url = "https://files.pythonhosted.org/packages/7e/3c/0e77bd5ffcf078e9dd27d3074aad6c030d9b10d0bf69329d573c927a188c/cryptography-50.0.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:e22dfed744bd4002e909464cb23d2f0b05c6f3113a79ef2e9864a53db737c733", size = 4738357, upload-time = "2026-08-25T19:45:02.786Z" }, + { url = "https://files.pythonhosted.org/packages/27/3a/3c5f80daa4dcd47323c7af8a2fcb90de27a33564d4fcac69846c0972691a/cryptography-50.0.1-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:4c4188f7c0cf655be5c06342b817ed0f9595b69ffa2b12026e5353eed29dea88", size = 4758474, upload-time = "2026-08-25T19:45:04.889Z" }, + { url = "https://files.pythonhosted.org/packages/6e/2b/214cf0cf93db9628c3c20c896b229f327f6fb1b20e4b3743d8ad3f00af8b/cryptography-50.0.1-cp39-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:2ebbfb0f1fed745e91796e3e1080a1440423fdae8ece1b995a1d80883a409054", size = 5375862, upload-time = "2026-08-25T19:45:07.163Z" }, + { url = "https://files.pythonhosted.org/packages/d6/51/3f9701867a46b6c1740c9b52fc4d3bed6cbdcfedcc9b6e64305c07f39cff/cryptography-50.0.1-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:407fe2b6db00939c05c0e945e9914238f2f0a430974839429dafc82b1ee6bee5", size = 4772942, upload-time = "2026-08-25T19:45:09.396Z" }, + { url = "https://files.pythonhosted.org/packages/0d/5c/13ea642e08e2544d0f5396122055f4820cfacb3203562197b5967125ea97/cryptography-50.0.1-cp39-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:2b34d76a652ea2b6faf777c35df230c5637842cd904e04f16230c3f9f03e4361", size = 4383347, upload-time = "2026-08-25T19:45:11.659Z" }, + { url = "https://files.pythonhosted.org/packages/84/d5/7d1fe1cb93f91c428093ff234e128c89ba8ea61a6f26aab406081f9b996e/cryptography-50.0.1-cp39-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:01f41478cf33fc605a6a089cd56d28b45c6c0b45a1928b61797f2621a04bac71", size = 4758050, upload-time = "2026-08-25T19:45:13.745Z" }, + { url = "https://files.pythonhosted.org/packages/dd/04/557fc5ead96a829e0bc812a3b9dc4a52a2f27e4f7f5950da7ff27653a805/cryptography-50.0.1-cp39-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:fc3ed7ebd2a8c96f5b166de0ab9b624996bef3b07bbeb19364dfb78222c22c80", size = 5332955, upload-time = "2026-08-25T19:45:16.193Z" }, + { url = "https://files.pythonhosted.org/packages/8c/eb/5d7124083e8d8cda8f5b348f544b71ad6f707ad63193758ef4d8e569da02/cryptography-50.0.1-cp39-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:9dde0a357190eb3b1da1bb9ab750e9c85cba82ca5977aa0836cbb94e92611239", size = 4772694, upload-time = "2026-08-25T19:45:18.315Z" }, + { url = "https://files.pythonhosted.org/packages/63/8e/f1f955e0921dd2b6d22eae7e8d24a4c4b638d10735ffbf6a71f99eb0fcb8/cryptography-50.0.1-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:fd3718b960d0b5dd213cdf03f3bcb7000e69dda0de8b956061947ff6bcff5558", size = 4888413, upload-time = "2026-08-25T19:45:20.4Z" }, + { url = "https://files.pythonhosted.org/packages/1f/ab/89e2b798d2c3925f82e2bb72d5979f3d2f6da2dd22ef4a8cd8b70d920039/cryptography-50.0.1-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:2a93d05e34d5f67fba6f891fe85d929999baa7195e853923ea6d7576c9e68c5e", size = 5044355, upload-time = "2026-08-25T19:45:22.353Z" }, + { url = "https://files.pythonhosted.org/packages/99/89/87ef49ffe383ef4e147d27b7bf2088fb0b54ea409dd87b5a89442e5828a5/cryptography-50.0.1-cp39-abi3-win_amd64.whl", hash = "sha256:55d16b1ef3ee0958d893a977b19777887e546c9954ea81b200c3301a864013f2", size = 3875429, upload-time = "2026-08-25T19:45:24.418Z" }, + { url = "https://files.pythonhosted.org/packages/c7/27/8d207af749c453ee17ea087340b3f2b4adef75aadd1d277b1b129bdda84e/cryptography-50.0.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:9cb3cb952cf5a8abd50c782a98a89d71699715e802fe349704b47f2425b42a94", size = 3974350, upload-time = "2026-08-25T19:45:26.551Z" }, + { url = "https://files.pythonhosted.org/packages/14/9a/6d3a4d7852e22d657438b7bf51f66102c7d71c0e1fafeec652281d0403e5/cryptography-50.0.1-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:5fe939deeb161024a6be98229c953b6591fef1f41214497a78fe793a244c017f", size = 4698675, upload-time = "2026-08-25T19:45:28.658Z" }, + { url = "https://files.pythonhosted.org/packages/73/35/5c3717edf9e68a0550ce04e28eab493fe545eccd81742af03f6a75fe260b/cryptography-50.0.1-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:fb4b9672d389c738b175c4166e78310f8a70358886aacd9173ee03a85ffdc671", size = 4707410, upload-time = "2026-08-25T19:45:30.816Z" }, + { url = "https://files.pythonhosted.org/packages/1d/e0/e786934472e3ac4ecdecc7b129a0ca1a2a40dffdafcf2c3ea9d4397f8def/cryptography-50.0.1-pp311-pypy311_pp73-manylinux_2_34_aarch64.whl", hash = "sha256:d63ae8f6481fec907ac0f588eee8a90aefde112c633131fe540e5711ddbb5a4e", size = 4698378, upload-time = "2026-08-25T19:45:33.043Z" }, + { url = "https://files.pythonhosted.org/packages/51/cf/5b3f53a0b74d122f023476ede40ba5d3e70d5cf475f73b899740d26a4fb2/cryptography-50.0.1-pp311-pypy311_pp73-manylinux_2_34_x86_64.whl", hash = "sha256:804728ce710890870f3aaa344b2e161172d258d768ac139d02cfd9092d0d94e6", size = 4706889, upload-time = "2026-08-25T19:45:35.086Z" }, + { url = "https://files.pythonhosted.org/packages/71/44/711e61f7d014be825ef79b285b047292d1bf893732ac1bc030a351fb517f/cryptography-50.0.1-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:693c99b49bd37d0d096e4334c10232c77248c415b98d35236094cdf96d57258b", size = 3824006, upload-time = "2026-08-25T19:45:37.281Z" }, ] [[package]] name = "cyclopts" -version = "4.0.0" +version = "4.23.3" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "attrs" }, @@ -602,9 +665,9 @@ dependencies = [ { name = "tomli", marker = "python_full_version < '3.11'" }, { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/9a/d1/2f2b99ec5ea54ac18baadfc4a011e2a1743c1eaae1e39838ca520dcf4811/cyclopts-4.0.0.tar.gz", hash = "sha256:0dae712085e91d32cc099ea3d78f305b0100a3998b1dec693be9feb0b1be101f", size = 143546, upload-time = "2025-10-20T18:33:01.456Z" } +sdist = { url = "https://files.pythonhosted.org/packages/ca/4e/4afd08d7dd836c436bbc5999f2743eda0ad4eac8946a8eb4b72241e3c555/cyclopts-4.23.3.tar.gz", hash = "sha256:4299ec47f5be853f9a114fcc534c84d42bbf19fefa303994597ecb7e5fd3082b", size = 197067, upload-time = "2026-08-26T18:16:35.688Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/44/0e/0a22e076944600aeb06f40b7e03bbd762a42d56d43a2f5f4ab954aed9005/cyclopts-4.0.0-py3-none-any.whl", hash = "sha256:e64801a2c86b681f08323fd50110444ee961236a0bae402a66d2cc3feda33da7", size = 178837, upload-time = "2025-10-20T18:33:00.191Z" }, + { url = "https://files.pythonhosted.org/packages/00/d0/247938ef46dd81ab293efcac06ac2fee922db5bede9039d059912081db51/cyclopts-4.23.3-py3-none-any.whl", hash = "sha256:b3a65872942afb08f3ab5ca3d65b0b3ecfc872c9ccbea9d6a74ec11aa8a0215e", size = 237180, upload-time = "2026-08-26T18:16:34.128Z" }, ] [[package]] @@ -618,20 +681,11 @@ wheels = [ [[package]] name = "docstring-parser" -version = "0.17.0" +version = "0.18.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/b2/9d/c3b43da9515bd270df0f80548d9944e389870713cc1fe2b8fb35fe2bcefd/docstring_parser-0.17.0.tar.gz", hash = "sha256:583de4a309722b3315439bb31d64ba3eebada841f2e2cee23b99df001434c912", size = 27442, upload-time = "2025-07-21T07:35:01.868Z" } +sdist = { url = "https://files.pythonhosted.org/packages/e0/4d/f332313098c1de1b2d2ff91cf2674415cc7cddab2ca1b01ae29774bd5fdf/docstring_parser-0.18.0.tar.gz", hash = "sha256:292510982205c12b1248696f44959db3cdd1740237a968ea1e2e7a900eeb2015", size = 29341, upload-time = "2026-04-14T04:09:19.867Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/55/e2/2537ebcff11c1ee1ff17d8d0b6f4db75873e3b0fb32c2d4a2ee31ecb310a/docstring_parser-0.17.0-py3-none-any.whl", hash = "sha256:cf2569abd23dce8099b300f9b4fa8191e9582dda731fd533daf54c4551658708", size = 36896, upload-time = "2025-07-21T07:35:00.684Z" }, -] - -[[package]] -name = "docutils" -version = "0.22.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/4a/c0/89fe6215b443b919cb98a5002e107cb5026854ed1ccb6b5833e0768419d1/docutils-0.22.2.tar.gz", hash = "sha256:9fdb771707c8784c8f2728b67cb2c691305933d68137ef95a75db5f4dfbc213d", size = 2289092, upload-time = "2025-09-20T17:55:47.994Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/66/dd/f95350e853a4468ec37478414fc04ae2d61dad7a947b3015c3dcc51a09b9/docutils-0.22.2-py3-none-any.whl", hash = "sha256:b0e98d679283fc3bb0ead8a5da7f501baa632654e7056e9c5846842213d674d8", size = 632667, upload-time = "2025-09-20T17:55:43.052Z" }, + { url = "https://files.pythonhosted.org/packages/a7/5f/ed01f9a3cdffbd5a008556fc7b2a08ddb1cc6ace7effa7340604b1d16699/docstring_parser-0.18.0-py3-none-any.whl", hash = "sha256:b3fcbed555c47d8479be0796ef7e19c2670d428d72e96da63f3a40122860374b", size = 22484, upload-time = "2026-04-14T04:09:18.638Z" }, ] [[package]] @@ -649,14 +703,14 @@ wheels = [ [[package]] name = "exceptiongroup" -version = "1.3.0" +version = "1.3.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/0b/9f/a65090624ecf468cdca03533906e7c69ed7588582240cfe7cc9e770b50eb/exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88", size = 29749, upload-time = "2025-05-10T17:42:51.123Z" } +sdist = { url = "https://files.pythonhosted.org/packages/50/79/66800aadf48771f6b62f7eb014e352e5d06856655206165d775e675a02c9/exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219", size = 30371, upload-time = "2025-11-21T23:01:54.787Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/36/f4/c6e662dade71f56cd2f3735141b265c3c79293c109549c1e6933b0651ffc/exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10", size = 16674, upload-time = "2025-05-10T17:42:49.33Z" }, + { url = "https://files.pythonhosted.org/packages/8a/0e/97c33bf5009bdbac74fd2beace167cab3f978feb69cc36f1ef79360d6c4e/exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598", size = 16740, upload-time = "2025-11-21T23:01:53.443Z" }, ] [[package]] @@ -719,16 +773,17 @@ server = [ { name = "uncalled-for" }, { name = "uvicorn" }, { name = "watchfiles" }, - { name = "websockets" }, + { name = "websockets", version = "16.1.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "websockets", version = "17.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, ] [[package]] name = "griffelib" -version = "2.0.2" +version = "2.2.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/9d/82/74f4a3310cdabfbb10da554c3a672847f1ed33c6f61dd472681ce7f1fe67/griffelib-2.0.2.tar.gz", hash = "sha256:3cf20b3bc470e83763ffbf236e0076b1211bac1bc67de13daf494640f2de707e", size = 166461, upload-time = "2026-03-27T11:34:51.091Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f0/b4/a767e91c606deefc447a96eaf59edd77397960b1d677dffd833ee8449831/griffelib-2.2.0.tar.gz", hash = "sha256:e1bc36fe9cd21d4b6b659b456346755e4cfdc5676c0a5214083126ee12612b3c", size = 227048, upload-time = "2026-08-16T14:04:58.383Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/11/8c/c9138d881c79aa0ea9ed83cbd58d5ca75624378b38cee225dcf5c42cc91f/griffelib-2.0.2-py3-none-any.whl", hash = "sha256:925c857658fb1ba40c0772c37acbc2ab650bd794d9c1b9726922e36ea4117ea1", size = 142357, upload-time = "2026-03-27T11:34:46.275Z" }, + { url = "https://files.pythonhosted.org/packages/f6/b6/f65ac785d4ac90dcf7c831ac6256f5dd4a19780f4e1575b2c0d6eeebe319/griffelib-2.2.0-py3-none-any.whl", hash = "sha256:d71c3bc2bbed9f958488634fe788b843a9f705d6d2838ca32cd6c25eeb64dfc4", size = 166779, upload-time = "2026-08-16T14:04:54.365Z" }, ] [[package]] @@ -779,23 +834,23 @@ wheels = [ [[package]] name = "idna" -version = "3.11" +version = "3.19" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902", size = 194582, upload-time = "2025-10-12T14:55:20.501Z" } +sdist = { url = "https://files.pythonhosted.org/packages/5f/f7/abb373e5757eaec4b922b92f97ec8d6d7e057cf06778247604fbc4e7c3f3/idna-3.19.tar.gz", hash = "sha256:5e0811a4383b21dc5838069f801c4fb62113b7447663d2530d2bd6e77b49bf15", size = 215237, upload-time = "2026-08-18T05:14:24.27Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea", size = 71008, upload-time = "2025-10-12T14:55:18.883Z" }, + { url = "https://files.pythonhosted.org/packages/57/b0/0e52c878c53f245edd3a11020f20979b3f490f245af532c7cae3027754b5/idna-3.19-py3-none-any.whl", hash = "sha256:815e7be7a7806d54abb586dc943addc79e8b2ee16915059658cbeff4b1b43bf4", size = 68550, upload-time = "2026-08-18T05:14:22.343Z" }, ] [[package]] name = "importlib-metadata" -version = "8.7.0" +version = "9.0.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "zipp" }, + { name = "zipp", marker = "python_full_version < '3.14'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/76/66/650a33bd90f786193e4de4b3ad86ea60b53c89b669a5c7be931fac31cdb0/importlib_metadata-8.7.0.tar.gz", hash = "sha256:d13b81ad223b890aa16c5471f2ac3056cf76c5f10f82d6f9292f0b415f389000", size = 56641, upload-time = "2025-04-27T15:29:01.736Z" } +sdist = { url = "https://files.pythonhosted.org/packages/6f/7e/1e7e8dc30634b93ebb3d58a3dea569ad146e656218d3960ab04f62047b29/importlib_metadata-9.0.1.tar.gz", hash = "sha256:ab830580bc0ef3db61ce8fae716389e5462b67e033018bab6d8f80ef17172f99", size = 59124, upload-time = "2026-08-28T15:30:34.646Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/20/b0/36bd937216ec521246249be3bf9855081de4c5e06a0c9b4219dbeda50373/importlib_metadata-8.7.0-py3-none-any.whl", hash = "sha256:e5dd1551894c77868a30651cef00984d50e1002d06942a7101d34870c5f02afd", size = 27656, upload-time = "2025-04-27T15:29:00.214Z" }, + { url = "https://files.pythonhosted.org/packages/b3/55/ecca97ae19075f1fac62def77731e7f535e6c1fb8f92ff08160c5e6dade8/importlib_metadata-9.0.1-py3-none-any.whl", hash = "sha256:bba5600596a7e21f3eef53281cf28d6a5195634d2f2b78ff9501a3272c6eaab0", size = 27920, upload-time = "2026-08-28T15:30:33.433Z" }, ] [[package]] @@ -821,26 +876,26 @@ wheels = [ [[package]] name = "jaraco-context" -version = "6.0.1" +version = "6.1.2" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "backports-tarfile", marker = "python_full_version < '3.12'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/df/ad/f3777b81bf0b6e7bc7514a1656d3e637b2e8e15fab2ce3235730b3e7a4e6/jaraco_context-6.0.1.tar.gz", hash = "sha256:9bae4ea555cf0b14938dc0aee7c9f32ed303aa20a3b73e7dc80111628792d1b3", size = 13912, upload-time = "2024-08-20T03:39:27.358Z" } +sdist = { url = "https://files.pythonhosted.org/packages/af/50/4763cd07e722bb6285316d390a164bc7e479db9d90daa769f22578f698b4/jaraco_context-6.1.2.tar.gz", hash = "sha256:f1a6c9d391e661cc5b8d39861ff077a7dc24dc23833ccee564b234b81c82dfe3", size = 16801, upload-time = "2026-03-20T22:13:33.922Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/ff/db/0c52c4cf5e4bd9f5d7135ec7669a3a767af21b3a308e1ed3674881e52b62/jaraco.context-6.0.1-py3-none-any.whl", hash = "sha256:f797fc481b490edb305122c9181830a3a5b76d84ef6d1aef2fb9b47ab956f9e4", size = 6825, upload-time = "2024-08-20T03:39:25.966Z" }, + { url = "https://files.pythonhosted.org/packages/f2/58/bc8954bda5fcda97bd7c19be11b85f91973d67a706ed4a3aec33e7de22db/jaraco_context-6.1.2-py3-none-any.whl", hash = "sha256:bf8150b79a2d5d91ae48629d8b427a8f7ba0e1097dd6202a9059f29a36379535", size = 7871, upload-time = "2026-03-20T22:13:32.808Z" }, ] [[package]] name = "jaraco-functools" -version = "4.3.0" +version = "4.6.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "more-itertools" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/f7/ed/1aa2d585304ec07262e1a83a9889880701079dde796ac7b1d1826f40c63d/jaraco_functools-4.3.0.tar.gz", hash = "sha256:cfd13ad0dd2c47a3600b439ef72d8615d482cedcff1632930d6f28924d92f294", size = 19755, upload-time = "2025-08-18T20:05:09.91Z" } +sdist = { url = "https://files.pythonhosted.org/packages/6c/1f/c23395957d41ccf27c4e535c3d334c4051e5395b3752057ba4cbaec35c56/jaraco_functools-4.6.0.tar.gz", hash = "sha256:880c577ec9720b3a052d5bc611fb9f2269b3d87902ef42440df443b88e443280", size = 20837, upload-time = "2026-07-14T01:28:02.544Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/b4/09/726f168acad366b11e420df31bf1c702a54d373a83f968d94141a8c3fde0/jaraco_functools-4.3.0-py3-none-any.whl", hash = "sha256:227ff8ed6f7b8f62c56deff101545fa7543cf2c8e7b82a7c2116e672f29c26e8", size = 10408, upload-time = "2025-08-18T20:05:08.69Z" }, + { url = "https://files.pythonhosted.org/packages/02/36/ecc85bc96c273dc8a11273ed4782272975e6338d4a3e9228621175edf0e3/jaraco_functools-4.6.0-py3-none-any.whl", hash = "sha256:99e3dc0060c5cbe8fcd1cdb36258e2a65ca40f1566b2033b12abb1bb44dd3c30", size = 11677, upload-time = "2026-07-14T01:28:01.59Z" }, ] [[package]] @@ -854,14 +909,14 @@ wheels = [ [[package]] name = "joserfc" -version = "1.6.5" +version = "1.7.4" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "cryptography" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/3b/dc/5f768c2e391e9afabe5d18e3221346deb5fb6338565f1ccc9e7c6d7befdd/joserfc-1.6.5.tar.gz", hash = "sha256:1482a7db78fb4602e44ed89e51b599d052e091288c7c532c5b694e20149dec48", size = 231881, upload-time = "2026-05-06T04:58:13.408Z" } +sdist = { url = "https://files.pythonhosted.org/packages/c7/e0/27a6a081ae25420eda6768ceae05d7022a7f2447f420588843f2a44e4298/joserfc-1.7.4.tar.gz", hash = "sha256:b3bc561672ae541b17a9237053b48a03dacddd92d68047b3ecdfb4b5714a88ed", size = 234027, upload-time = "2026-07-19T15:43:02.739Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/54/3b/ad1cb22e75c963b1f07c8a2329bf47227ce7e4361df5eb2fb101b2ce33ef/joserfc-1.6.5-py3-none-any.whl", hash = "sha256:e9878a0f8243fe7b95e11fdda81374ca9f7a689e302751579d3dfdeec559675e", size = 70464, upload-time = "2026-05-06T04:58:11.668Z" }, + { url = "https://files.pythonhosted.org/packages/f9/bf/249dcd99b3376375910b7fa922383b57792975c8758f50d44612e749226c/joserfc-1.7.4-py3-none-any.whl", hash = "sha256:32d46c2cd5e3203c13e87a6c61333cab310b1ba80cd54b4c4f386a848a122463", size = 71000, upload-time = "2026-07-19T15:43:01.299Z" }, ] [[package]] @@ -875,32 +930,33 @@ wheels = [ [[package]] name = "jsonschema" -version = "4.25.1" +version = "4.26.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "attrs" }, { name = "jsonschema-specifications" }, { name = "referencing" }, - { name = "rpds-py" }, + { name = "rpds-py", version = "0.30.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "rpds-py", version = "2026.6.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/74/69/f7185de793a29082a9f3c7728268ffb31cb5095131a9c139a74078e27336/jsonschema-4.25.1.tar.gz", hash = "sha256:e4a9655ce0da0c0b67a085847e00a3a51449e1157f4f75e9fb5aa545e122eb85", size = 357342, upload-time = "2025-08-18T17:03:50.038Z" } +sdist = { url = "https://files.pythonhosted.org/packages/b3/fc/e067678238fa451312d4c62bf6e6cf5ec56375422aee02f9cb5f909b3047/jsonschema-4.26.0.tar.gz", hash = "sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326", size = 366583, upload-time = "2026-01-07T13:41:07.246Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/bf/9c/8c95d856233c1f82500c2450b8c68576b4cf1c871db3afac5c34ff84e6fd/jsonschema-4.25.1-py3-none-any.whl", hash = "sha256:3fba0169e345c7175110351d456342c364814cfcf3b964ba4587f22915230a63", size = 90040, upload-time = "2025-08-18T17:03:48.373Z" }, + { url = "https://files.pythonhosted.org/packages/69/90/f63fb5873511e014207a475e2bb4e8b2e570d655b00ac19a9a0ca0a385ee/jsonschema-4.26.0-py3-none-any.whl", hash = "sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce", size = 90630, upload-time = "2026-01-07T13:41:05.306Z" }, ] [[package]] name = "jsonschema-path" -version = "0.3.4" +version = "0.5.0" source = { registry = "https://pypi.org/simple" } dependencies = [ + { name = "attrs" }, { name = "pathable" }, { name = "pyyaml" }, { name = "referencing" }, - { name = "requests" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/6e/45/41ebc679c2a4fced6a722f624c18d658dee42612b83ea24c1caf7c0eb3a8/jsonschema_path-0.3.4.tar.gz", hash = "sha256:8365356039f16cc65fddffafda5f58766e34bebab7d6d105616ab52bc4297001", size = 11159, upload-time = "2025-01-24T14:33:16.547Z" } +sdist = { url = "https://files.pythonhosted.org/packages/39/79/cd02a4df6d9270efdc7d3feefe6edd730b0820c39eeaa107a2faee8322d5/jsonschema_path-0.5.0.tar.gz", hash = "sha256:493b156ba895c97602655b620a8456caa2ce08c1aa389f5a7addec065e6e855c", size = 19597, upload-time = "2026-05-19T20:45:00.971Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/cb/58/3485da8cb93d2f393bce453adeef16896751f14ba3e2024bc21dc9597646/jsonschema_path-0.3.4-py3-none-any.whl", hash = "sha256:f502191fdc2b22050f9a81c9237be9d27145b9001c55842bece5e94e382e52f8", size = 14810, upload-time = "2025-01-24T14:33:14.652Z" }, + { url = "https://files.pythonhosted.org/packages/04/2c/9e69d73c4297508be9e3b64a970ea3971b3eb8db64ffc5802d40bd25981f/jsonschema_path-0.5.0-py3-none-any.whl", hash = "sha256:2790a070bc7abb08ea3dbe4d340ece4efadf639223001f020c7503229ba068e2", size = 24077, upload-time = "2026-05-19T20:44:59.225Z" }, ] [[package]] @@ -917,7 +973,7 @@ wheels = [ [[package]] name = "keyring" -version = "25.6.0" +version = "25.7.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "importlib-metadata", marker = "python_full_version < '3.12'" }, @@ -928,113 +984,156 @@ dependencies = [ { name = "pywin32-ctypes", marker = "sys_platform == 'win32'" }, { name = "secretstorage", marker = "sys_platform == 'linux'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/70/09/d904a6e96f76ff214be59e7aa6ef7190008f52a0ab6689760a98de0bf37d/keyring-25.6.0.tar.gz", hash = "sha256:0b39998aa941431eb3d9b0d4b2460bc773b9df6fed7621c2dfb291a7e0187a66", size = 62750, upload-time = "2024-12-25T15:26:45.782Z" } +sdist = { url = "https://files.pythonhosted.org/packages/43/4b/674af6ef2f97d56f0ab5153bf0bfa28ccb6c3ed4d1babf4305449668807b/keyring-25.7.0.tar.gz", hash = "sha256:fe01bd85eb3f8fb3dd0405defdeac9a5b4f6f0439edbb3149577f244a2e8245b", size = 63516, upload-time = "2025-11-16T16:26:09.482Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/d3/32/da7f44bcb1105d3e88a0b74ebdca50c59121d2ddf71c9e34ba47df7f3a56/keyring-25.6.0-py3-none-any.whl", hash = "sha256:552a3f7af126ece7ed5c89753650eec89c7eaae8617d0aa4d9ad2b75111266bd", size = 39085, upload-time = "2024-12-25T15:26:44.377Z" }, + { url = "https://files.pythonhosted.org/packages/81/db/e655086b7f3a705df045bf0933bdd9c2f79bb3c97bfef1384598bb79a217/keyring-25.7.0-py3-none-any.whl", hash = "sha256:be4a0b195f149690c166e850609a477c532ddbfbaed96a404d4e43f8d5e2689f", size = 39160, upload-time = "2025-11-16T16:26:08.402Z" }, ] [[package]] name = "librt" -version = "0.13.0" +version = "0.15.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/dc/2f/3908645ddddab7120b46295e541ead308109fa48dbec7d67d7a778870d60/librt-0.13.0.tar.gz", hash = "sha256:1d2a610c14ac0d0750ee0a3ab8548e83155258387891caaca04def4bf7289781", size = 211402, upload-time = "2026-07-08T12:26:29.834Z" } +sdist = { url = "https://files.pythonhosted.org/packages/36/9b/356320fbae2ac8467e21c5e73e1389c80468e4998c62cc7d3536cc51b614/librt-0.15.0.tar.gz", hash = "sha256:4e66cbe84437497d951b799d3e1551291b6fb3d643820a7014b3655d57a59162", size = 214338, upload-time = "2026-08-07T10:49:42.663Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/89/2f/ec5241c38e7fa0fe6c26bfc450e78b9489a6c3c08b394b85d2c10e506975/librt-0.13.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:34e47058fcc69a313293d6dee94216a4f30c929ae6f2476e58c5ba635aa639d5", size = 148654, upload-time = "2026-07-08T12:24:30.622Z" }, - { url = "https://files.pythonhosted.org/packages/a5/1a/d651e18d3ee7aa2879322368c4f278bb7ecaa6b90caadfdec4ebfa8389f3/librt-0.13.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:dbdd5b6509d0c2a8fe72cf494c299a61dbd58142a90a4190664ae159e4a7b547", size = 153537, upload-time = "2026-07-08T12:24:31.773Z" }, - { url = "https://files.pythonhosted.org/packages/45/18/10bff2122577246009d9619b6569596daf69b7648812f997ca9ca0426f60/librt-0.13.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2e56ea4ee4df77585a6b5c138f6538680886024fa559f5b55bd14b12e98e67b2", size = 494336, upload-time = "2026-07-08T12:24:33.079Z" }, - { url = "https://files.pythonhosted.org/packages/67/69/87dfee871b852970f137fdeae8e2ca356c5ab38e6f21d2a3299535fc3159/librt-0.13.0-cp310-cp310-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:f1f9cc4d09a46d9cb3c2063ae100629d3f52a6517c3c08c2f4c9828261883929", size = 485393, upload-time = "2026-07-08T12:24:34.324Z" }, - { url = "https://files.pythonhosted.org/packages/e9/d5/625447a8c0441ff5f15f4ac5e1d323fb9d4d256ebfde7a3c8e003f646057/librt-0.13.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f125f5d46b20f89dc5587a55cc416b4ba2a5b2ffda36d048ee120e17598a653a", size = 515382, upload-time = "2026-07-08T12:24:35.575Z" }, - { url = "https://files.pythonhosted.org/packages/8d/d8/1c8c49ea04235960426444deece9092a6b3a9587a850a81bae2335317411/librt-0.13.0-cp310-cp310-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:2608d3b39f9e0b4a66a130d9150c615cba40a5090d25eeeaa225e0e46de8c0ac", size = 509483, upload-time = "2026-07-08T12:24:36.923Z" }, - { url = "https://files.pythonhosted.org/packages/6f/65/f1760fc48050e215201a03506c32b7270159088d01f64557b53e39e74a45/librt-0.13.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:9fd35e95ab5e45c3901d37110263c7db85a961110f5460588fe37f8c131f88a7", size = 532503, upload-time = "2026-07-08T12:24:38.203Z" }, - { url = "https://files.pythonhosted.org/packages/18/1b/793e281dcf494879eff99f642b63ebc9c7c58694a1c2d1e93362a22c7041/librt-0.13.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:5f31b0aa13c9b04370d4da6be1ab7779776b3a075cceb6747a39a4be85fe1e40", size = 537027, upload-time = "2026-07-08T12:24:39.34Z" }, - { url = "https://files.pythonhosted.org/packages/69/45/0801bbb40c9eea795d3dd3ce91c4c5f3fe7d42d23ec4be3e8cb283bcc754/librt-0.13.0-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:0b795f5fc70fbbb787ceaf79bb3a0d627bcc33c53de51741755263ec406b775a", size = 517100, upload-time = "2026-07-08T12:24:40.907Z" }, - { url = "https://files.pythonhosted.org/packages/a1/6c/eb5f514f8e29d4924bc0ff4601dd7b4175557e182e7c0721e84cffa39b8a/librt-0.13.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:36b306a623aaad96fe4b378692b54f9c0789fccd833b9851753d5fbf6138cfde", size = 558653, upload-time = "2026-07-08T12:24:42.359Z" }, - { url = "https://files.pythonhosted.org/packages/b4/bf/f140100d1b59fe87ff40b5ecbb4e27924335b189a784e230ee465452f6c2/librt-0.13.0-cp310-cp310-win32.whl", hash = "sha256:a3762e75fcac8c9e4dacaaf438bffd9003e2ca2c531b756f3c0035deefa674c8", size = 104402, upload-time = "2026-07-08T12:24:43.668Z" }, - { url = "https://files.pythonhosted.org/packages/22/7c/57e40fef7cfb61869341cb28bdcefe8a950bebcbecca74a397bae14dce4a/librt-0.13.0-cp310-cp310-win_amd64.whl", hash = "sha256:d63bae12a8aeb51380be3438e4dc4bd27354d0f8e19166b2f44e3e94d6f552dc", size = 125002, upload-time = "2026-07-08T12:24:44.793Z" }, - { url = "https://files.pythonhosted.org/packages/89/25/a6498964cfeec270c468cffdc118f69c29b412593610d55fa1327ca51ff4/librt-0.13.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1b5a7bbff495baedbd9b916c367d66854008f8f3b575908ded477c499dc60082", size = 148029, upload-time = "2026-07-08T12:24:45.961Z" }, - { url = "https://files.pythonhosted.org/packages/78/59/dc86d1bffd8e0c2818bace29d9f7783cfbb8e0673bf3673b5bbd5bbe0420/librt-0.13.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:34bc7938b9fdf14fe32a406c19c71faf894c5cee7e7474bd0be2f17200b82d14", size = 153036, upload-time = "2026-07-08T12:24:47.257Z" }, - { url = "https://files.pythonhosted.org/packages/29/3f/b923826660f02f286186cd9303d52bb05ced0a13708edc104dc8480920e3/librt-0.13.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f40e56b61b41be5f7dec938cfeffd660668cf4b5e72c78e7bd671d66b7bc2c79", size = 493062, upload-time = "2026-07-08T12:24:48.483Z" }, - { url = "https://files.pythonhosted.org/packages/88/87/6c0980a9c9b1302cb68d108906697b89eceb55889bb1dcf77c109aa56ca5/librt-0.13.0-cp311-cp311-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:9c5d02b89de5acd0379a51ec44a89476fb03df6145442e1c8ecd6bee2f91b176", size = 485510, upload-time = "2026-07-08T12:24:49.727Z" }, - { url = "https://files.pythonhosted.org/packages/32/81/795ae3b9df5dd94079fb807e38191855e023e8c6249014ae6bc3f0d9a490/librt-0.13.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7db9a3ff32ef5f7d1703d93831a3316cdf0b537de6a1cc03cc8fdd09b9194e89", size = 515909, upload-time = "2026-07-08T12:24:51.135Z" }, - { url = "https://files.pythonhosted.org/packages/20/e5/182de15abce8907108a6fdb41487de65beb5099b74dc5841b19b099168db/librt-0.13.0-cp311-cp311-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:3dbb2a31882456cadc7053378e81ad7ed7693db4ac9f98ab5f81ef034aa8ec9f", size = 508620, upload-time = "2026-07-08T12:24:52.358Z" }, - { url = "https://files.pythonhosted.org/packages/32/03/33978d32db76e1f66377e8f78e42a2ca3c162143331677d1f50bbad36cfb/librt-0.13.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c6014e3c80f9c1fe268ef8b0e0ef113bac672cc032f2f93866e7ddad4f3e663d", size = 530363, upload-time = "2026-07-08T12:24:53.503Z" }, - { url = "https://files.pythonhosted.org/packages/e6/f5/b291fbd2d00f7d8287bcbf67b5aa0c6afed4bc26cef23e079629c47a2c04/librt-0.13.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:091b60a4d2174fc1ec5c34cdc0b72efb6224753d76b7da61ebeab7a191aec8bd", size = 534209, upload-time = "2026-07-08T12:24:55.138Z" }, - { url = "https://files.pythonhosted.org/packages/3e/03/6f41f17939d191bc21609f220da8509316bc62797f078545fe83be522e78/librt-0.13.0-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:66cb1138f384a191a6d75f986064841fcfdc0cea98f7bd9c9ab9b38049917588", size = 514254, upload-time = "2026-07-08T12:24:56.276Z" }, - { url = "https://files.pythonhosted.org/packages/af/c2/2e4befa5410a7443019c14abccc94ff619797171f6b72013635fb87f31d7/librt-0.13.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:17221a7569f8f292aa0014226e48aa25b8c2b08da18088cd230953d0ea0f9cd1", size = 557611, upload-time = "2026-07-08T12:24:57.561Z" }, - { url = "https://files.pythonhosted.org/packages/ab/54/8b69f81448417adbc040a2185f4e2eece1e1994b7dcfaeed4662b30f98a5/librt-0.13.0-cp311-cp311-win32.whl", hash = "sha256:fc67741da44c6eaa90e01eafb586bbba9b51eb5b6ed381ee6f5ae72eb3316d21", size = 104906, upload-time = "2026-07-08T12:24:58.806Z" }, - { url = "https://files.pythonhosted.org/packages/76/5a/f4aaf37b50f2fde12c8c663b83fdd499cdc24f957f19543d7414bfcc9e25/librt-0.13.0-cp311-cp311-win_amd64.whl", hash = "sha256:cc99dfb62b23c9207c33d0be8a2e2af7a42e21e6ea388b380a0c948c7b88953b", size = 125852, upload-time = "2026-07-08T12:25:00.065Z" }, - { url = "https://files.pythonhosted.org/packages/f2/99/bf1820e6feeabc2f218c24450ec0c995d6a91e8ba0fd3caf042c9e8adb2a/librt-0.13.0-cp311-cp311-win_arm64.whl", hash = "sha256:40ccd13c252d3fe473ffc8a57be7565abc8b64cf1b108344c859d5164f7f3e0c", size = 111832, upload-time = "2026-07-08T12:25:01.148Z" }, - { url = "https://files.pythonhosted.org/packages/f0/f4/b2933ddae222dac338476abb872641169a5cfed2c2bb5444a5b07b32b0c3/librt-0.13.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:30536798f4504c0fad0885b1d371b0539abb081e4570c9d7c641cb51141b49f0", size = 150990, upload-time = "2026-07-08T12:25:02.42Z" }, - { url = "https://files.pythonhosted.org/packages/90/ef/db98f744ca50e6efc9c95c70ee49b77aefac31f6a3fc7c83754a42d6a74f/librt-0.13.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:93d24ebb82aa4420b1409c389e7857bc35bd0b668007ac8172427d5c73cc8cc5", size = 155238, upload-time = "2026-07-08T12:25:03.681Z" }, - { url = "https://files.pythonhosted.org/packages/03/e7/a197e7bc72baf2c61ce7fdc6906a5054dc05bd8da0819aa894e4857bf87e/librt-0.13.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:cb8a1adce42d8b75485a5d56a9623a50bcab995b6079f1dac59fc44034dd93d9", size = 503073, upload-time = "2026-07-08T12:25:05.049Z" }, - { url = "https://files.pythonhosted.org/packages/f8/e7/7887712e27da7c1ab80fcabb1de6eb24243964f6557cae530d4b70706dbd/librt-0.13.0-cp312-cp312-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:0763ca2ab66058174f9dee426dc64f5e0a89c24a7df8d3fe3f1836c04e25de4b", size = 496528, upload-time = "2026-07-08T12:25:06.26Z" }, - { url = "https://files.pythonhosted.org/packages/94/f0/f2283385bb6b950b26a1410f4ce51ec27231e0b3a4b925c46366d218b198/librt-0.13.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b222493da6e7b6199db9bd79502436cf5a27da3c1f7fa83c7e285444fc93fd03", size = 531786, upload-time = "2026-07-08T12:25:07.658Z" }, - { url = "https://files.pythonhosted.org/packages/36/11/69ac3b54766ffba5fd7e5acebfb048d66dbe1f9f2d14516c2b3edc59cf87/librt-0.13.0-cp312-cp312-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:fadc63331f4388c3dc90090448f682a7e9feafc11481391c1e94f2f907a3976e", size = 524393, upload-time = "2026-07-08T12:25:09.121Z" }, - { url = "https://files.pythonhosted.org/packages/61/5f/d72f95fd444a926a3c14b4e24979474116988dd57a45be242077c45d3c22/librt-0.13.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:70d9c62a4cffd9f23396cd5ef93fc5d11b31596b9b7d6306074abe3d5fcf09bd", size = 543026, upload-time = "2026-07-08T12:25:10.459Z" }, - { url = "https://files.pythonhosted.org/packages/c4/08/dcd9993ad192737a004ba263d549f8ea605b326b952e7d6205c7d4170b76/librt-0.13.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:66c0e7e6b02a155576df2c77ec933a70b72da726e248c494abf690923e624348", size = 546829, upload-time = "2026-07-08T12:25:11.716Z" }, - { url = "https://files.pythonhosted.org/packages/96/d5/6d9bb2f54e4109a956b7128836529653eb9d740f784bc47ed10a02c1000e/librt-0.13.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:ac04bcd3328eb91d99dfedf6a60d9c1f15d3434e6f6daf922f0420f7d90b85c7", size = 535700, upload-time = "2026-07-08T12:25:13.144Z" }, - { url = "https://files.pythonhosted.org/packages/8c/f2/10946922503858a359492fa27f13e86228bde702116a740ac7b3cd185f24/librt-0.13.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:db327e7271e653c32040b85ae6188059c924b57d7e1e29f935523fa017cd4e82", size = 573566, upload-time = "2026-07-08T12:25:14.336Z" }, - { url = "https://files.pythonhosted.org/packages/48/a8/94f00e3c99479a18088af3685ea016c42f3c7d5d1964d8dbb40c08d7f1aa/librt-0.13.0-cp312-cp312-win32.whl", hash = "sha256:860bd1d8ba48456ce08feaf8d343a8aaeb2fa086f2bcaa2a923fa3f7a3ff9aa3", size = 106099, upload-time = "2026-07-08T12:25:16.159Z" }, - { url = "https://files.pythonhosted.org/packages/c9/7b/2da9c74c1ed25a89cc4e1c8e007ea2eb4a0f1fafa3e70d757fe3242c5c5c/librt-0.13.0-cp312-cp312-win_amd64.whl", hash = "sha256:e54a315caf843c8d77e388cadc56ea9ded569935ee2d2347d7ea94992e5aa6fa", size = 126934, upload-time = "2026-07-08T12:25:17.275Z" }, - { url = "https://files.pythonhosted.org/packages/d0/65/aead61bbf3b5358593f9d4779d2a0e88eaf6ec191a6342dde36dd1df6371/librt-0.13.0-cp312-cp312-win_arm64.whl", hash = "sha256:c718e99a0992127af84385378460db624103b559ab260435abcfe77a4e4ed1c1", size = 112236, upload-time = "2026-07-08T12:25:18.425Z" }, - { url = "https://files.pythonhosted.org/packages/67/3b/18e7b63255297a2bdc9c25c8d6d4ca8eca9f63aceb1252c0f7427ac7099e/librt-0.13.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a468951af16155824e88bdd8326ebe5bdb371f3ec0ac04642994b98201d914f3", size = 151027, upload-time = "2026-07-08T12:25:19.638Z" }, - { url = "https://files.pythonhosted.org/packages/4d/68/e2248452c00d1a03b45fee1752cdc8f790a476efd2402b75181da88a9e61/librt-0.13.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:ae01d8512cc17079e53425635327dbf3f7ff57a42c00dec348bf79791c56444c", size = 155152, upload-time = "2026-07-08T12:25:20.851Z" }, - { url = "https://files.pythonhosted.org/packages/0e/16/52b1c99bf19057a062aac39c900cbb81499f6f75d6c537c14463d247ba78/librt-0.13.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:32c26893cd085c1efe83219e78d866da23fb20a066101b8f68210004361d224c", size = 502499, upload-time = "2026-07-08T12:25:22.055Z" }, - { url = "https://files.pythonhosted.org/packages/9f/54/b811151805c795f55e0dedee6ec687b75f9982a8105d240ea3910737a77b/librt-0.13.0-cp313-cp313-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:5929da1981a46bcf4b28b1b9499905f0ff58e2419da402a048234e9783acbc4b", size = 496108, upload-time = "2026-07-08T12:25:23.296Z" }, - { url = "https://files.pythonhosted.org/packages/8f/f8/094d6b2bd93f3fdaa54db54cc788c4a365333bddad65ab02e04da0b1d004/librt-0.13.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:94b85d664d777bab6c0d709416cb42938251fda9e221b79e3a2215d85df5f4f9", size = 531576, upload-time = "2026-07-08T12:25:24.648Z" }, - { url = "https://files.pythonhosted.org/packages/2e/40/541733d5755824f968f7ec39d78ffbd75d145964157ae5e69a09ec6d7326/librt-0.13.0-cp313-cp313-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:531b2df3e9fe96b1fcf73a6d165921e4656be5f58d631d384ebce344298368db", size = 524390, upload-time = "2026-07-08T12:25:25.898Z" }, - { url = "https://files.pythonhosted.org/packages/c6/b5/255673cfdbf5ba663339d36cd863c897289ab4337577e19f9405ce059f36/librt-0.13.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:109b84a9edf69ad89dc1f66358659e14a031baca95e3e5b0060bd903ede8efd6", size = 543053, upload-time = "2026-07-08T12:25:27.436Z" }, - { url = "https://files.pythonhosted.org/packages/9e/11/ab5005e9c9850710f21e354201bf090646349d3fabf5f951eaf70235729e/librt-0.13.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:1304368a3e7ffc3e9db986796cc5326fdb5943a3567ecc137cff318e4240c0e7", size = 546387, upload-time = "2026-07-08T12:25:28.65Z" }, - { url = "https://files.pythonhosted.org/packages/a2/04/a5d7ce1d1df1afd15ca283dcdf7530ac073e12d69ae8c40879dda96f7868/librt-0.13.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:e4f9b472e7d308d94b62c801982065661158c6ed02790d6c7ddb4337cea0f9c1", size = 535970, upload-time = "2026-07-08T12:25:30.171Z" }, - { url = "https://files.pythonhosted.org/packages/5a/76/927e267a6daa290174ac281b23c9804c8829b042ade9c6f24a065f540958/librt-0.13.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:9f836c37478f167a81200d8c8b2c920a22224564bed2c23d7aeec760965c367a", size = 573582, upload-time = "2026-07-08T12:25:31.507Z" }, - { url = "https://files.pythonhosted.org/packages/10/24/b6c5213efe39c19f9e13605644d0cf063b4ddaa33ac2e45b088e23a70e2e/librt-0.13.0-cp313-cp313-pyemscripten_2025_0_wasm32.whl", hash = "sha256:4000d961ff9598ac6ea603c6c836a5ed49bc205ade5fc378b998dfe1e2c36628", size = 82189, upload-time = "2026-07-08T12:25:32.675Z" }, - { url = "https://files.pythonhosted.org/packages/4c/00/d29736be177a906ac0b84a5b04b4fbfa22c776dc2f366de4172b0f968c08/librt-0.13.0-cp313-cp313-win32.whl", hash = "sha256:79e44cff71750d299d61a678e49995b0d5935a9cda238c2574daeca3ba536927", size = 106193, upload-time = "2026-07-08T12:25:33.692Z" }, - { url = "https://files.pythonhosted.org/packages/c8/ac/aff6fb45393cb8912f39dfb156ef6b2d1cadb207ff465fc8f66141054be8/librt-0.13.0-cp313-cp313-win_amd64.whl", hash = "sha256:54dab44a847d5ad1acd05c8a83fe518ae685516ecf4d3f7cc6e3df2a66767650", size = 126962, upload-time = "2026-07-08T12:25:34.769Z" }, - { url = "https://files.pythonhosted.org/packages/d9/3a/d68cb2b334d53fd30fac81d3a489ce4ba0d9506f4df43fcf676b68352b19/librt-0.13.0-cp313-cp313-win_arm64.whl", hash = "sha256:d4cb6fbfdf874340ab5e51450753c0f817b6958a3621125ee695bbc3de866566", size = 112127, upload-time = "2026-07-08T12:25:35.981Z" }, - { url = "https://files.pythonhosted.org/packages/7b/66/f49ae0d592bd45b6941e9a8bafcb6a87cddcd501ee7874707e767f01b585/librt-0.13.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:25218d94b1d2cbc0ba1d8a3f9dc9af578d9646e5ed16443a70cde1dfdcce6d71", size = 149818, upload-time = "2026-07-08T12:25:37.203Z" }, - { url = "https://files.pythonhosted.org/packages/3d/50/51c76d74014d04fb95b6506d286808984b78a2f7a41039094e6b2194ac48/librt-0.13.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:f26629539d4893c2957a16c41bb058e1e135c1f150f6a2e25ed047f64cf3f5c6", size = 154071, upload-time = "2026-07-08T12:25:39.399Z" }, - { url = "https://files.pythonhosted.org/packages/b8/fe/f19b0f5f82d5a1f2da736586bc840abd00ce07d6388136ae80b7333883fc/librt-0.13.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a4517d47b2b8af26975a406fba7d314de9696d864252e0257c6ea90238cfe27f", size = 494168, upload-time = "2026-07-08T12:25:40.641Z" }, - { url = "https://files.pythonhosted.org/packages/94/bc/b8550c75775127fd31a5f20e8775997f7b527ad661fc8ddccd7497c064f7/librt-0.13.0-cp314-cp314-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:f19e181de5b3a1148bb3420b8c4b0b0ea0fce6950099724ad151d6cea5acc180", size = 491054, upload-time = "2026-07-08T12:25:41.905Z" }, - { url = "https://files.pythonhosted.org/packages/30/14/4d0204867623df3f33f86efd3d3692ba5e01321443f4d6eab35a22697618/librt-0.13.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:22034924f5b42d5a56371cf271771bfeaabf235a7a8b6264bef2d20013f786c6", size = 523006, upload-time = "2026-07-08T12:25:43.327Z" }, - { url = "https://files.pythonhosted.org/packages/19/0a/c45fc9a260934696bace1ac5df1e148ac92bd71767aee3bf7cd7a4534f4c/librt-0.13.0-cp314-cp314-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c7897db4e95e22468bdda33d8e012ceacd0182abf001e6389d763f0def6286b9", size = 515058, upload-time = "2026-07-08T12:25:44.541Z" }, - { url = "https://files.pythonhosted.org/packages/13/0a/50c5ce45b326854ef8fa6ae4c36cf5142e5c55315eaf9e51d0ae73ac4da3/librt-0.13.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:1ce61b3746545029d4f5c17d6bd74b676254ad98433086c846ffb5e8fa73f007", size = 534025, upload-time = "2026-07-08T12:25:45.825Z" }, - { url = "https://files.pythonhosted.org/packages/89/2d/08c413c8f93fc13b8103624fce38e5caa86cd08cbbc8465870ab287af54b/librt-0.13.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:46c330e82565962c761dbce7941be2cff7db674ee807455a8d0cadc5f9b759b0", size = 540557, upload-time = "2026-07-08T12:25:47.059Z" }, - { url = "https://files.pythonhosted.org/packages/b3/c1/93af71fb4a364952210051811dd4e40174e79656b050c89cacac18af3330/librt-0.13.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:375f5af8f99cbaa99dd293af986e3d57caabc9ba81a5d3f021603764854197a1", size = 523201, upload-time = "2026-07-08T12:25:48.392Z" }, - { url = "https://files.pythonhosted.org/packages/c1/6e/9766f07b676a4889d9f8bc2864e9ba5fff165653143ef4dda7df6aa34d16/librt-0.13.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:9320d34c3376ae204b2cd176e8d4883a013934e0aef822f1aed9c536490c275d", size = 565740, upload-time = "2026-07-08T12:25:49.678Z" }, - { url = "https://files.pythonhosted.org/packages/a2/1e/664e3472ce2b6e10e9b83f29d4a36eb982ff6b5a169ae7567bba3a4c4ff5/librt-0.13.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:9af313c66157a69dc69ea0059a66961692250e0dc95af9c385a48ffb770a0d16", size = 81611, upload-time = "2026-07-08T12:25:50.857Z" }, - { url = "https://files.pythonhosted.org/packages/2f/d4/8582a4d65e2234673685e07309d02c230b28a85724eb0acbf13f019b7f6e/librt-0.13.0-cp314-cp314-win32.whl", hash = "sha256:f2a7253458e34f33543551394ae4fe104b497ec2a65ac266074de64c1df82e37", size = 100106, upload-time = "2026-07-08T12:25:52.03Z" }, - { url = "https://files.pythonhosted.org/packages/63/ce/0cb99efe6086b46cd985dc26672166fae312a239690e75871f7fafbd3fc5/librt-0.13.0-cp314-cp314-win_amd64.whl", hash = "sha256:a3dfe4edf10e8ed7e55b026a8bfc2c2a8704218b659cd4bffdf604fab966dc39", size = 121209, upload-time = "2026-07-08T12:25:53.166Z" }, - { url = "https://files.pythonhosted.org/packages/26/85/4f3ccb083a3c9b0d42e223acdb3c3f507953324a59cdcab4826e8e2e3b89/librt-0.13.0-cp314-cp314-win_arm64.whl", hash = "sha256:68a5faee4bba381cb93b5961f684a514cf0053cb92308ff9c792c2fea0b174c6", size = 106404, upload-time = "2026-07-08T12:25:54.253Z" }, - { url = "https://files.pythonhosted.org/packages/b2/77/333191499538c8e8189de7a4cba8e6f49ee949fd6d6e6324b21fd1522466/librt-0.13.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:a38fb81d8376dfa2f8963b265fec07637802b0d01e2a127c19c66cb070fb24f5", size = 159231, upload-time = "2026-07-08T12:25:55.432Z" }, - { url = "https://files.pythonhosted.org/packages/7a/9e/2aa83758f22c278b837a1d8025898434ce2b8bff36678d5330ecaef56dff/librt-0.13.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:d4c8d9bd5abce34b2e75edb3bf37ab0f34e49b1f915a40ae8468eb7c85bc5b46", size = 161300, upload-time = "2026-07-08T12:25:56.585Z" }, - { url = "https://files.pythonhosted.org/packages/bb/c0/86791e936553ca763d6b3c2fb4d31d596cd00e14fa631c283a40ba01559a/librt-0.13.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:387e2f1d27e89bffe0d3f520f0da0662c973fd607ca16c1808f8a5085419485e", size = 582056, upload-time = "2026-07-08T12:25:58.144Z" }, - { url = "https://files.pythonhosted.org/packages/a8/d3/a9ec15984a185e000c4d2a16ba28bd623124ad4c38a10974c7ff78e3a893/librt-0.13.0-cp314-cp314t-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:4f6db193d2e5e0ed60359b9a5a682cd67205d0d3b1e459a867dd4b5c4e7eaa7a", size = 562758, upload-time = "2026-07-08T12:25:59.544Z" }, - { url = "https://files.pythonhosted.org/packages/3c/af/dbe36b78b19c06a55097f99305e4ea9458e2273e6ae16a3cbecaad7ee978/librt-0.13.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0d38604854e8d22faadf683ec6c02bb0f886e2ba56ef981a1c36ee275f21ea22", size = 602095, upload-time = "2026-07-08T12:26:00.991Z" }, - { url = "https://files.pythonhosted.org/packages/2a/a8/2966891b4dd2830f5203fbee92ac2c4947653a2390ba73dfa44244fad025/librt-0.13.0-cp314-cp314t-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:371f7ce73026815dafd51c50ce38416e91428b28c4b2ec97cd39271164b0045c", size = 593452, upload-time = "2026-07-08T12:26:02.352Z" }, - { url = "https://files.pythonhosted.org/packages/61/f5/4df8bfc8405ecf8c0d525b4d69636f694bdd8620b313ec8b76e54a5926cc/librt-0.13.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:3aaedf52171bee90860704c560bc798fe83b76247df47568e0197e9b13c735a0", size = 623729, upload-time = "2026-07-08T12:26:04.294Z" }, - { url = "https://files.pythonhosted.org/packages/d6/13/9ac202dffc8db06f75d06c08c2f9f6ff054be67d21272dcc078fa1cc0c57/librt-0.13.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:96bad8725a4f196a798366c25ce075d1f7543a4ec045ffc13e6a7ec095cdab04", size = 617077, upload-time = "2026-07-08T12:26:05.845Z" }, - { url = "https://files.pythonhosted.org/packages/6e/f0/ebe38610716aee5cb28efd95089bb90192096179802779381e1c5dcf239c/librt-0.13.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:6bf6a559ffe4a93bbea6cf31ddf01a7fd9ba342ef51f27beb178e318b74acd61", size = 599561, upload-time = "2026-07-08T12:26:07.21Z" }, - { url = "https://files.pythonhosted.org/packages/4f/5c/c2e72e236fff7abc716d5b1753b8b8cd3ea85ac46fe17d2e7c51d4e1c723/librt-0.13.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:301067672387902c55f94b51d5022304b36c966ea9fe1f21caab99a9bef487c9", size = 645511, upload-time = "2026-07-08T12:26:08.562Z" }, - { url = "https://files.pythonhosted.org/packages/0c/99/6203ce619dee940d6bfbe099ec3fe4be00a68e9d60f70abf906cf124fe66/librt-0.13.0-cp314-cp314t-win32.whl", hash = "sha256:5fdcf34f86de8fb66d7dc7589f96ba91c4aa46671200d400e6fd6f109a483f18", size = 104357, upload-time = "2026-07-08T12:26:09.828Z" }, - { url = "https://files.pythonhosted.org/packages/52/dd/843b6314087c41657c7036d7914d8f294bdf9b580aa8513ea0588c8e9a3d/librt-0.13.0-cp314-cp314t-win_amd64.whl", hash = "sha256:260c33e92263fa629b4f6d3c51967a1c2158fe6c33237aaa3ebeac586b085259", size = 126998, upload-time = "2026-07-08T12:26:10.975Z" }, - { url = "https://files.pythonhosted.org/packages/5f/5d/3dcec2884ba1b0806d1408612555c38dd5d68e90156b59f75f6e36435c3a/librt-0.13.0-cp314-cp314t-win_arm64.whl", hash = "sha256:2f281549a4c52ac7bb97997f14353f8bd0e53a34ca0dad1c905cfd0b4a58ae99", size = 110771, upload-time = "2026-07-08T12:26:12.303Z" }, + { url = "https://files.pythonhosted.org/packages/48/12/e2e9ca532cf5a0e08c9489826c4a35c6958c92ba0313fda70e8c6c3912be/librt-0.15.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e1a49adf16a7c9d9646816c2946135527197b6fcf4347c7b8b761cf1bfbf4489", size = 148673, upload-time = "2026-08-07T10:46:22.569Z" }, + { url = "https://files.pythonhosted.org/packages/6d/7c/02005e23478bd5950618d9712e0fd2b4c511657857f3efd8ba6a5feabcdd/librt-0.15.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:81a398f45b45a59200e13cd5ad1ae1d3f44334de98b148331afe2cdfee701c52", size = 153547, upload-time = "2026-08-07T10:46:23.931Z" }, + { url = "https://files.pythonhosted.org/packages/a0/90/d8848a735f5642077fc4b3b4bebcdb08edf10178e3add45597f5201a368f/librt-0.15.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4eafbaff06b9563f8b1c850621ce51605de05208e09d4d71ce490bc972b7b9e8", size = 494355, upload-time = "2026-08-07T10:46:25.122Z" }, + { url = "https://files.pythonhosted.org/packages/e1/0b/8604f41ea02feace490e9e405a338a15f9905369f55b239a9ce31c946f24/librt-0.15.0-cp310-cp310-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:b0411b4066db926b80258c60dcb0e6db4c9cee312eab45b7e8866b17ddf9ada1", size = 485459, upload-time = "2026-08-07T10:46:26.447Z" }, + { url = "https://files.pythonhosted.org/packages/a0/ac/84153bda1ce0da609182527ab92b40d961809e544eefdc5a1c2422971416/librt-0.15.0-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:febb1ce6cac545a54e6b769982824e955a700fdd9fbf3a08a3d82c990968b57d", size = 498398, upload-time = "2026-08-07T10:46:27.701Z" }, + { url = "https://files.pythonhosted.org/packages/2c/3a/5ca6cd282b2c244bec8ec84102e09773264e9c02891d56ab3a8f0e4d7083/librt-0.15.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b230acc1c3bfe2d6f2627ba2b95dc92e58aa494600e9722d0e6ccbc931e59702", size = 515474, upload-time = "2026-08-07T10:46:28.9Z" }, + { url = "https://files.pythonhosted.org/packages/73/d3/bd34110234779eb843c6ed66aba7c9b2091d3dd85989f1fb9922f564cb7a/librt-0.15.0-cp310-cp310-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6da110e5f314c19ab8478464d02ae18808ae73d522c15260fa4918acdcd64da9", size = 509484, upload-time = "2026-08-07T10:46:30.124Z" }, + { url = "https://files.pythonhosted.org/packages/1b/6c/43c3f7f071d71631a7daa3b835ef2168ea39f20692d81464d4e47fbaa6d6/librt-0.15.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:eab9208b00ca55bf75983ec99f7bf13acc746a36102e98953addaad7f7ea1e1b", size = 532534, upload-time = "2026-08-07T10:46:31.511Z" }, + { url = "https://files.pythonhosted.org/packages/c5/1c/b854adf036ea817c40408873a5b794d65a91d9f0f39826f2ad2a2d5d7f48/librt-0.15.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:6c013cd3a1721e69e14380ada97eaa4b7b0cdf1c6b96fa765d4ea47c875088db", size = 537087, upload-time = "2026-08-07T10:46:32.734Z" }, + { url = "https://files.pythonhosted.org/packages/25/5c/c9a890e244e7dd725d3bd8b560e41f0aec787eaf343b46956a290ab7b841/librt-0.15.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:567b1c430f8bd560e689421468278ac5941bab4a05303b5d95b6ae10db03f451", size = 536575, upload-time = "2026-08-07T10:46:33.965Z" }, + { url = "https://files.pythonhosted.org/packages/5f/c5/c8e70b60b704299555f55db468eb46b1c81bfc60201ffbfe20407d89870c/librt-0.15.0-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:29c4cab9df457b19672c39be7f384ebb2bc925c4e2684b8780c222b43eb36389", size = 517142, upload-time = "2026-08-07T10:46:35.577Z" }, + { url = "https://files.pythonhosted.org/packages/56/d1/767a90c41f5d381b3195bc88ac0ec4afda35777c9c781e1f9848fedd965e/librt-0.15.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:bccbd8e5b0bffb7106cf18eb1baa3d7194b1cebb3b4b1cdbd4bdb19382a6ee6c", size = 558714, upload-time = "2026-08-07T10:46:36.829Z" }, + { url = "https://files.pythonhosted.org/packages/f9/b4/3c0624b8dc8301ab808f2b3a910995bcabe28df070fb9a0e5505ae997dae/librt-0.15.0-cp310-cp310-win32.whl", hash = "sha256:8ae493ed5f659a7761c43d42f183db514536073ded9bcf671d2d1df47e29a07e", size = 104426, upload-time = "2026-08-07T10:46:38.594Z" }, + { url = "https://files.pythonhosted.org/packages/31/98/e91c0382304bedb2db9c6801897319a9dcb68daac5e975819b562362f20d/librt-0.15.0-cp310-cp310-win_amd64.whl", hash = "sha256:bc25fb356d0c7810bb49ff3df908ad1fda6995d660ab099ded69244ed7ab6053", size = 125057, upload-time = "2026-08-07T10:46:40.052Z" }, + { url = "https://files.pythonhosted.org/packages/59/52/06790ced2ac7117f890c21bda43c39c958ec82aa665c0718e821d33ff939/librt-0.15.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:823b92cf3c18ecd08afc70c42473888b41b6e8ef5046f3b82c05c154a2fa3d22", size = 148039, upload-time = "2026-08-07T10:46:41.165Z" }, + { url = "https://files.pythonhosted.org/packages/e7/1d/8e150b7fc449a1f33c8a760965cc1f43b14fc1577d9d0b50ab2701420e74/librt-0.15.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c70bc1b602cf59917e8f0c7a2cbc8bcc6fbc14d5486136b00707a79619121d63", size = 153067, upload-time = "2026-08-07T10:46:42.418Z" }, + { url = "https://files.pythonhosted.org/packages/51/87/a162bc5a66a35599dc619ecb215145f4de7d68e886b479b6d12593139f7c/librt-0.15.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:814ff83a25b5fce8b9c80c4dd803153fb5c5599fc74db9e022466938368957ef", size = 493087, upload-time = "2026-08-07T10:46:43.657Z" }, + { url = "https://files.pythonhosted.org/packages/e5/3a/aeea1fc620cf48060d3065b37614edbf97043c099d0f50782bc8ca61d897/librt-0.15.0-cp311-cp311-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:57f5eeb6ad4c180de583b1038e61fe5fbd9796bb69a8a1c1a0c7ddbec4c8c60f", size = 485608, upload-time = "2026-08-07T10:46:45.038Z" }, + { url = "https://files.pythonhosted.org/packages/52/ff/fe571ad416f0856fd0d5578ffc2e6dc531891e586e36b647bcf50569cab8/librt-0.15.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:82909c8f7eb9952656b65d3147afde4cf8e6d5a991eebc86418b5e65843b0ab8", size = 498723, upload-time = "2026-08-07T10:46:46.35Z" }, + { url = "https://files.pythonhosted.org/packages/0f/e1/7a65eb5dedb1f00aebd948cdd8e17add48bf066cab3514e9daf84ab45a6c/librt-0.15.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f779070399f991400fc451719e0ea388eb7de313388bada2c127a35de05f798a", size = 516002, upload-time = "2026-08-07T10:46:47.599Z" }, + { url = "https://files.pythonhosted.org/packages/5f/45/59832b0ebfbd08c2742e6ece372ceb53f18bf1faef5d33c8daf3abebf749/librt-0.15.0-cp311-cp311-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bac89069bc496ebdf4f79ebb57bbd10d0b214c8454225deb672d91002bd17e18", size = 508607, upload-time = "2026-08-07T10:46:48.873Z" }, + { url = "https://files.pythonhosted.org/packages/ea/0d/37fa73f3b43ebd8259f91ae9102a15e5a54e65d581e48dea72df3e81d7a4/librt-0.15.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:e0d00c708fb2f5822b152429b1ac80a58dbbbc3f6c232c4d13a3f7fcf2ea5b4c", size = 530422, upload-time = "2026-08-07T10:46:50.45Z" }, + { url = "https://files.pythonhosted.org/packages/26/02/e046c6fe7a5881ac34623242192f484426ba8a75595fd18f22c53a3f530f/librt-0.15.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:6c6624fe268625869485553dd7cc1daf30d22558215bb2a4ff16f67a9801a31a", size = 534303, upload-time = "2026-08-07T10:46:51.693Z" }, + { url = "https://files.pythonhosted.org/packages/95/32/d5e6d861ab0366f3edf74f887ab0c9eb9f535aaf01d32b80b4f734daa179/librt-0.15.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:f56b397858a23dacf35ede366ed2212fdc03a6a57a1ad36468ad6e9dc5fac091", size = 536084, upload-time = "2026-08-07T10:46:52.951Z" }, + { url = "https://files.pythonhosted.org/packages/2a/de/d69d725513fe53fc90c6d7a1f86e4428939bad2fb905b17fe4c18d413dde/librt-0.15.0-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:4388184646efe2054911c5b00a1077d6d1ee86a95b7e8ba96dc7850a809f3f40", size = 514307, upload-time = "2026-08-07T10:46:54.194Z" }, + { url = "https://files.pythonhosted.org/packages/36/93/f8aded0d6682b4f25820fa86e0690f87f01df9fd7bd09ddb04d9167ad021/librt-0.15.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:97335f59082f9fe2ce6c2a9cc6433a0114bbb6cd4d5c09dd76c95c68b9f9a8b0", size = 557686, upload-time = "2026-08-07T10:46:55.443Z" }, + { url = "https://files.pythonhosted.org/packages/74/09/ffeb6bdeb6cd862b4272fddc8ad05f938dd25d020ed517e631813917d80a/librt-0.15.0-cp311-cp311-win32.whl", hash = "sha256:83380ffde38062a2e9bb55d83e74474f6614665528b98a6928720fc006dfffbb", size = 104917, upload-time = "2026-08-07T10:46:56.605Z" }, + { url = "https://files.pythonhosted.org/packages/96/28/7e2313a3ffbf0b4de7ba3da58a09e488507b4bd1ea2b5e69378354a23415/librt-0.15.0-cp311-cp311-win_amd64.whl", hash = "sha256:f75720477ee05d509a310e856cacc8d909adc182f7b91193c207bcc26d7ee6db", size = 125886, upload-time = "2026-08-07T10:46:57.729Z" }, + { url = "https://files.pythonhosted.org/packages/39/9e/04b8c3cde014ef255ee785730425268354543acc38902093a40afa0dc164/librt-0.15.0-cp311-cp311-win_arm64.whl", hash = "sha256:256237037a3ab001ae8d9803b2d43562a4c3aa38739843694349e4d5ebb0fd56", size = 111885, upload-time = "2026-08-07T10:46:58.787Z" }, + { url = "https://files.pythonhosted.org/packages/ba/39/99c25030e782bdfb7a21be8c05254806a2e4bbb05c8d50c2a2130acbfa05/librt-0.15.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:e87bc679f86a99aa3b26e3c78eeb821a247c9a28eae48eaafcc32c3bf4c3bb9e", size = 151021, upload-time = "2026-08-07T10:47:00.057Z" }, + { url = "https://files.pythonhosted.org/packages/14/43/f4b1bd1b2888798a1409808889a25ea1ba49eaabce7d681ed27734c2df9d/librt-0.15.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:71599e011ac880e8e45d46047d714871894c7d4ab6f25626f8d4f89da21f368d", size = 155267, upload-time = "2026-08-07T10:47:01.311Z" }, + { url = "https://files.pythonhosted.org/packages/0c/db/3ad9c965c72f1e1d6beeec44ec10a54e17be8ae042fbb4baade16cbadced/librt-0.15.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c802434092b769b1d613ed2e13fac15fbfce1934a74bd10283b03c0fae231cd1", size = 503136, upload-time = "2026-08-07T10:47:02.45Z" }, + { url = "https://files.pythonhosted.org/packages/4b/07/5888a6d76acd62ebce66c61b74d94e9370b9c32929f111e487bb6546f8ed/librt-0.15.0-cp312-cp312-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:5500eeae393a184d14e1f35645962c27129d20c81afa4069e6ef826ebc2b3aaa", size = 496670, upload-time = "2026-08-07T10:47:03.675Z" }, + { url = "https://files.pythonhosted.org/packages/29/39/ab57cc2f5b276156da02bb7f5a8921bada1cb1993ffec99acf811c602c23/librt-0.15.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:6ecfc32dfb46fb7b565bcd6abf9412acf978775a998273d22888a6d7953730dd", size = 513688, upload-time = "2026-08-07T10:47:04.981Z" }, + { url = "https://files.pythonhosted.org/packages/a7/b9/bdbb0b648b5c2befb031f4c6f3b1dd857415e8fb492a25a3c764a6681e6c/librt-0.15.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:89cc46cfd15022e35084355478c9ac809d90b1152222706ac9a7655ec21df6fa", size = 531904, upload-time = "2026-08-07T10:47:06.211Z" }, + { url = "https://files.pythonhosted.org/packages/93/26/473c2e4b6c104e9e58e27ce95fc8005c8bd4fc36cae4f254371125a92db8/librt-0.15.0-cp312-cp312-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:d5f51401d102c885b9ca509e62c79b1dbff286e1b9b047fde6f763780789356d", size = 524427, upload-time = "2026-08-07T10:47:07.592Z" }, + { url = "https://files.pythonhosted.org/packages/26/60/03b3abb82b41714671b907bf6989b228e31e6a8af52dec82b5b0728dc250/librt-0.15.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:cc30523e3f1a23fb7511cc659834a0d01a1042bb9de359bc1c131cc4ec6c9656", size = 543155, upload-time = "2026-08-07T10:47:08.866Z" }, + { url = "https://files.pythonhosted.org/packages/f2/0e/9bb1f0a4affbd0a1888f4f79dc03ed2a299d9a2c26c59ab2a97dcbf11903/librt-0.15.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:59fe030d8ae4a57e3fb7756bf35a858de74e04066fc8555c53d0af979132af81", size = 546890, upload-time = "2026-08-07T10:47:10.327Z" }, + { url = "https://files.pythonhosted.org/packages/dc/84/6937a280d461f7de6e031ffb02edc2b7c3c90d49d630565ce8ff27cbc5f2/librt-0.15.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:5a6526a2a956bbb1e4ae3568c82e650fc99119c66bb011ea60715744955a2b4d", size = 555163, upload-time = "2026-08-07T10:47:11.798Z" }, + { url = "https://files.pythonhosted.org/packages/bc/95/2a2853c1ee014bf102116e7f897a04beeaeb2461b45b79af98bdfb95f1ef/librt-0.15.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:85ea21ec6730194d67156b0e0b5430ccb1d61f8b8b907e39b37f9812b74a13f0", size = 535812, upload-time = "2026-08-07T10:47:13.279Z" }, + { url = "https://files.pythonhosted.org/packages/c9/4c/cf9601c1b4c5f09280acd5d83abdb2e68527a2be8257136eb42304218622/librt-0.15.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1e47b8ba865d7ede071a91a7163073bbaeb72541f1ef8a07d512c45c7b5007f2", size = 573688, upload-time = "2026-08-07T10:47:14.727Z" }, + { url = "https://files.pythonhosted.org/packages/47/6d/9ac7cbec46189a7625af4b5acbd25f10d827f4141b2002181848c8418923/librt-0.15.0-cp312-cp312-win32.whl", hash = "sha256:a5207ec414d1c4a2a7231b2086970dc036f94293cdf338190984958a013a42f1", size = 106138, upload-time = "2026-08-07T10:47:15.973Z" }, + { url = "https://files.pythonhosted.org/packages/38/d0/2ae99c83be86ce23f925ac1aeeedc777e97f427c4a8d190c70d0a16e9a87/librt-0.15.0-cp312-cp312-win_amd64.whl", hash = "sha256:73b30cfa976659b3917c8f6153bdb0591c6a9ec6583599fd24a689b690622022", size = 126974, upload-time = "2026-08-07T10:47:17.049Z" }, + { url = "https://files.pythonhosted.org/packages/5d/ef/dd24f9635c730b86b87587967dda7516b1845e8b17684603d31607fed598/librt-0.15.0-cp312-cp312-win_arm64.whl", hash = "sha256:a54cf9e0ef47b96af580849db5471142200568ce1e02cbf416addab551369570", size = 112292, upload-time = "2026-08-07T10:47:18.222Z" }, + { url = "https://files.pythonhosted.org/packages/e7/42/467b53a601b406ccd7b97c1fd54b59cb34f9185ad5ce7e9d5c3c4e8961c8/librt-0.15.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:db13ca398005abcbe538deda87b686d9bd08b7001cf40c4c06b444960ae10a26", size = 151029, upload-time = "2026-08-07T10:47:19.312Z" }, + { url = "https://files.pythonhosted.org/packages/3e/e6/36c2299b7a94b84fdd01220d8a777a71be5be0925bb0dbdf71c0a06a34d9/librt-0.15.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:aa1f1995789dca3698bc550aaceb09a51bd5df0a057ff84ff15296cd1975b801", size = 155194, upload-time = "2026-08-07T10:47:20.398Z" }, + { url = "https://files.pythonhosted.org/packages/c9/b6/ed5071f9325845e670bd36012757419767fbf56af77ed483077b9e4db541/librt-0.15.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:55456ea87d8df21808446d03817be2f65e20391c1c615d9187440dff28cd08dc", size = 502568, upload-time = "2026-08-07T10:47:21.652Z" }, + { url = "https://files.pythonhosted.org/packages/7f/81/6450c67c3615d87704bcbc21323fafc69c799b06a044c447529f725d4b01/librt-0.15.0-cp313-cp313-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:5a86a5a08c2235316bdb359d5dbb6ce0abfca7fac06363103e2c5af571d92f95", size = 496153, upload-time = "2026-08-07T10:47:22.925Z" }, + { url = "https://files.pythonhosted.org/packages/e1/d6/5f52b722bc75076954b3bfd49be15ea362df4d580c6fb315d0f617100d30/librt-0.15.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e56b6a368529bed262da40ce13f8fef590db0479819cca84f16a1f01ac356d0b", size = 513336, upload-time = "2026-08-07T10:47:24.213Z" }, + { url = "https://files.pythonhosted.org/packages/8d/e2/c08fd1d36ce63ea5a12b85c5d37f4550b5f86a692167e41e5a74222607ae/librt-0.15.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:234d8d394721fa0d786af15ebf1f3fb7f3ed82fd1cd0cde45c2f247b5d4281d2", size = 531661, upload-time = "2026-08-07T10:47:25.507Z" }, + { url = "https://files.pythonhosted.org/packages/3f/d8/d9482fcbeb177b9eb87bb3899eeb3b42be690313c652f9e146b1d0681fb2/librt-0.15.0-cp313-cp313-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:d8363d7accb0286ac3a0e633f396e93800dafb8150494505daf9515bbda591f3", size = 524487, upload-time = "2026-08-07T10:47:26.79Z" }, + { url = "https://files.pythonhosted.org/packages/10/cc/075171517b41f861753034fbb151b42cfc83bcc853849f24f5e66fd60ccf/librt-0.15.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0f0ee3644d951f31055ad07d77d92520e84505dd7a432cc4cd501dd70ee06785", size = 543201, upload-time = "2026-08-07T10:47:27.999Z" }, + { url = "https://files.pythonhosted.org/packages/b0/03/42c2330f37eeb475b6affeedd06518f60035f323af3a839335e3fc9fef2d/librt-0.15.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2cfd1a81a648806e6a7717be4cc4d1bb392fa229752bf8444ba365e381e984d6", size = 546467, upload-time = "2026-08-07T10:47:29.396Z" }, + { url = "https://files.pythonhosted.org/packages/57/1e/1ad4c5638f7e64d8560328bd25c54b409a661bdb6ff254b38ff90744288d/librt-0.15.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:a6cd22c9da0d866558e46a041f1cc0c2bbb26b61b137b2347fa834c332e1d101", size = 555139, upload-time = "2026-08-07T10:47:30.815Z" }, + { url = "https://files.pythonhosted.org/packages/49/41/39fa7d15db1204cd1cbe6514680fbdc243adf754a0885061308f43afc013/librt-0.15.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:6d5225ef8801e4ea5e482fa9b5dfb891dd9ef6f6d870f1f25d449ca2c70ac218", size = 536050, upload-time = "2026-08-07T10:47:32.222Z" }, + { url = "https://files.pythonhosted.org/packages/1e/88/c6dcf0dd8e26dc0c9a499a2abab8646c86dcaf9ecea9524cb46d3686331a/librt-0.15.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6d28a05796b99f749bf8794f17ba9ba1612d0076b802e9cfc62c554634e9ce3b", size = 573700, upload-time = "2026-08-07T10:47:33.527Z" }, + { url = "https://files.pythonhosted.org/packages/1b/9b/ab54c71a7918a7c34fa5327fb61390a77446a07a146fbfb1165250a61035/librt-0.15.0-cp313-cp313-pyemscripten_2025_0_wasm32.whl", hash = "sha256:2067ff438048cead9d223ca5675bae2a25e520a7c3e6c1498bf9c6892d22caab", size = 82194, upload-time = "2026-08-07T10:47:34.835Z" }, + { url = "https://files.pythonhosted.org/packages/8d/b2/4f9a243bb892395f3becb80789ade13771701091f9f07ab8230247953ba8/librt-0.15.0-cp313-cp313-win32.whl", hash = "sha256:1cd3b721f24c206398b9e26da3c3a9c011e6e89d06f318ba8ebefc30f1003890", size = 106231, upload-time = "2026-08-07T10:47:36.251Z" }, + { url = "https://files.pythonhosted.org/packages/bf/af/64aff4885a40b93132382f2c314647d722574605416504379184ef3045ea/librt-0.15.0-cp313-cp313-win_amd64.whl", hash = "sha256:f395a4a9a03ac062dbe9a9f82e0c720502e590a38feee6a757bc82e9c63afbd8", size = 126996, upload-time = "2026-08-07T10:47:37.453Z" }, + { url = "https://files.pythonhosted.org/packages/27/83/335bccf6c7cb9028cb0b54aead27d9ece3f01f83bc6baa2abace5da655c1/librt-0.15.0-cp313-cp313-win_arm64.whl", hash = "sha256:0a15cb554761247d84a3ec0cbdf4078d70725384f0e4662c0fa3b26266eb60ad", size = 112188, upload-time = "2026-08-07T10:47:38.729Z" }, + { url = "https://files.pythonhosted.org/packages/a8/93/949053fb462eecc4a9a5ee770a81f4b40be7b79538b245545d4aebc6b58b/librt-0.15.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:f5de7feedc56337a088eb15cd9fafa9938367362221d8cc62c642b7f94821993", size = 149833, upload-time = "2026-08-07T10:47:39.86Z" }, + { url = "https://files.pythonhosted.org/packages/61/ca/8281aa6cd560a3420e4497729f6b704b53be3eeaaef82d5aeadddaf7441f/librt-0.15.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:6c0eb900c0e91f4aebe680845242e614f1864edfd44106380d0752ac29522bf8", size = 154088, upload-time = "2026-08-07T10:47:41.065Z" }, + { url = "https://files.pythonhosted.org/packages/dd/02/1a1662dceaba6a086360891448d5ce9a7d3555976cae59a31a39d744b9c7/librt-0.15.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e8c9a650a188e38bac005048cbe6342e81407782944d01934540ab75e417df21", size = 494215, upload-time = "2026-08-07T10:47:42.388Z" }, + { url = "https://files.pythonhosted.org/packages/69/84/99211619dc656370a3740c33d2b0b6d5a3fb1e73689314f6ed477a397dc4/librt-0.15.0-cp314-cp314-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:92bfed8deec93df30286b9fe9e3b1dd17329cc076a192b4ee5ec223841d54953", size = 491173, upload-time = "2026-08-07T10:47:43.683Z" }, + { url = "https://files.pythonhosted.org/packages/d4/aa/5448d0b05f4579b635d3899176817ebf561af0e57bacd425b5b1887264c1/librt-0.15.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ec4b19788f835711a2072f9dbe6b03b3bf32ed1f0fb30cf399bdd59d9f0c33fa", size = 505512, upload-time = "2026-08-07T10:47:45.314Z" }, + { url = "https://files.pythonhosted.org/packages/95/82/01940e40b83c43a546c4a3c896cf34ca272a9690899d55914e4827b3dcce/librt-0.15.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d4c7bacb70930f3d0a56f4ecf1be474a1f0d941b01dd73b756f3c256d42cb879", size = 523073, upload-time = "2026-08-07T10:47:46.66Z" }, + { url = "https://files.pythonhosted.org/packages/88/fa/759c0030f3ee371439eb26de34fc745807caf0abb878af7af4b8b7c3dd3d/librt-0.15.0-cp314-cp314-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:3e79f05e4a08b4d880342673312bbc895b56df7765605796f15902eb5367d3ae", size = 515080, upload-time = "2026-08-07T10:47:48.319Z" }, + { url = "https://files.pythonhosted.org/packages/0b/27/894e072228fcb159703c655da69f8cd10dbed489c36e3df7dd032a2483be/librt-0.15.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:a417149c0cba4d50b61e992e5a15e69eaf96746609b461cc4ed168aeef6b79dd", size = 534164, upload-time = "2026-08-07T10:47:49.875Z" }, + { url = "https://files.pythonhosted.org/packages/98/a3/0078e91c1f36f8815db17827de15650b9a3fe56c55fbf998c854b34e40d3/librt-0.15.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:da7a94d6a3411f579d72aa3e3bc5fbca7ed4549f3dbd7e5de3aa567333374285", size = 540616, upload-time = "2026-08-07T10:47:51.408Z" }, + { url = "https://files.pythonhosted.org/packages/86/33/81a29b796dd52a45e9ef7974c7732926e8f10f15b8d2be505665979f896d/librt-0.15.0-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:856f743ae607f2c1380eccb566c0038a9fb3eabf0fc2be2704d76d9f73557239", size = 545890, upload-time = "2026-08-07T10:47:52.818Z" }, + { url = "https://files.pythonhosted.org/packages/05/82/8be1baa1350e5d30cfd70ae79d0a6f4dc5862ef47f7bb2808aabc9bb86e5/librt-0.15.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:779a6e7c894737e5983e7790a9c78c4000c30e23c9aada08081bdbea53b0fa60", size = 523287, upload-time = "2026-08-07T10:47:54.165Z" }, + { url = "https://files.pythonhosted.org/packages/c6/4f/d1be6a01a35c20ef734e0e44113f87d4af756a9354a89dcfbe3b4f8af5e1/librt-0.15.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:96bb17dbe8bab3c0954fbebfc69ed395599de75b6bbc35e3270a878e15d4dd65", size = 565868, upload-time = "2026-08-07T10:47:55.566Z" }, + { url = "https://files.pythonhosted.org/packages/67/88/649cfa33f5825927b160610f670bdab012a64d627eddb94fa795ea4292fd/librt-0.15.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:7220697efaa6e5348fc3d18ee7f8563d4bfecd9872b37ffb915bfc1d08840622", size = 81619, upload-time = "2026-08-07T10:47:56.886Z" }, + { url = "https://files.pythonhosted.org/packages/22/31/8e88a8d5e48fc8d1a817787fb6811dfff6499acd6c8683dd83934aa6ede0/librt-0.15.0-cp314-cp314-win32.whl", hash = "sha256:f54598964d357b1c5ab77cf5d92f21e598fe0e23cdbe9618480807f81b4eba15", size = 100138, upload-time = "2026-08-07T10:47:58.093Z" }, + { url = "https://files.pythonhosted.org/packages/80/92/20fd6c4b6a1b1a564b076d55cd3d427d8428217d7638dc25a654cc4791d4/librt-0.15.0-cp314-cp314-win_amd64.whl", hash = "sha256:3ff5893a2c23d886aa9ce786de5ac6ddc74aeeaf90743682b74d920e117d2e28", size = 121258, upload-time = "2026-08-07T10:47:59.564Z" }, + { url = "https://files.pythonhosted.org/packages/fc/28/6af430b44d9ebb897b865a3c363b6dcace51357be2347cc0f8f869656a86/librt-0.15.0-cp314-cp314-win_arm64.whl", hash = "sha256:3722a099730704c9a3d70c879fc0f51daec25fe5f1555672d97bc595abeafb95", size = 106467, upload-time = "2026-08-07T10:48:01.097Z" }, + { url = "https://files.pythonhosted.org/packages/7e/aa/b42bb798942ced219f6d63b27e07f91237887a8d0bd0921666db79a13790/librt-0.15.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:38c0c7d4b6fc06c3324b3f9162c8391bfc4fd9dde53afe1033ce7edb48d5a714", size = 159523, upload-time = "2026-08-07T10:48:02.442Z" }, + { url = "https://files.pythonhosted.org/packages/75/03/1b53cd4ef904e73b1d828a5f90143bf94a2967d7cfff0b9ccf93e12aa9b4/librt-0.15.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:8b2fdd7ead3c995c37940a790690660d0ca006c302db26cc51933f6766866fc3", size = 161638, upload-time = "2026-08-07T10:48:03.725Z" }, + { url = "https://files.pythonhosted.org/packages/ac/c4/9f9c9fba097d49e9e694c2b4dc331df31884645ecbc58a93b4b5fc69d2c5/librt-0.15.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2fde98cf1fc4bac144ce23c2c4c017b924ba714509ea9334977b0b27050c837d", size = 701795, upload-time = "2026-08-07T10:48:05.135Z" }, + { url = "https://files.pythonhosted.org/packages/4c/05/0966840bda0380c8ae167b9043c6230202941cc90ea29c48e096964c765e/librt-0.15.0-cp314-cp314t-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:e3b461183c5fa7681b48560f91515f53a953122fb30c71e07abc67d7ddf58c38", size = 682147, upload-time = "2026-08-07T10:48:06.555Z" }, + { url = "https://files.pythonhosted.org/packages/18/af/1c47ca573c30ea47d195aec26133af522fea1104afaace028d7b32247ea8/librt-0.15.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4bbcc257e3babea20a91715c361b24554ec4e8f51aa578568afc230799fe1a19", size = 696397, upload-time = "2026-08-07T10:48:08.03Z" }, + { url = "https://files.pythonhosted.org/packages/2e/0f/1aed6223d4f9f9d1171a8596ff100ea4c3f7699fea7a4ba657c3e60daa6c/librt-0.15.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b845b8d48088fad0cadc84be4b8fda63203be7e9237b71015b3925443c1f35ab", size = 722542, upload-time = "2026-08-07T10:48:09.569Z" }, + { url = "https://files.pythonhosted.org/packages/c6/22/9e3a929aea456c97d69e6ef3884efea56d4807f97399471cc946baebd8af/librt-0.15.0-cp314-cp314t-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:b30e600e8f337b9bd7f39b86d9fdfedc73cc46e3d0f745931a23a234220bb7e2", size = 729709, upload-time = "2026-08-07T10:48:11.129Z" }, + { url = "https://files.pythonhosted.org/packages/e9/1b/c327ef6018e3a9ca0b8e7c5eddeeb331ba8f9b76c24e126d37d0f6d62faf/librt-0.15.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:64b0c8c35aa4c4ed79896359f3e0b285cbe4e610042106500da4811c322cc108", size = 752891, upload-time = "2026-08-07T10:48:12.558Z" }, + { url = "https://files.pythonhosted.org/packages/d7/d1/d5f1ea02c56930087009e39db9b70660a663e76c730b27b925d786718457/librt-0.15.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:0da0d94cb802f32a0524653e7201f2cef72d5f700a5407678f5290483d4fcd08", size = 745301, upload-time = "2026-08-07T10:48:14.55Z" }, + { url = "https://files.pythonhosted.org/packages/d9/3c/5f7c585d15ebb2250c73e7c0ee4e9e47be72c65d520c07ddbcdc62037674/librt-0.15.0-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:4a6369168d371207339b1e50d4532b06a7121586141f82599505a3f315751d47", size = 747921, upload-time = "2026-08-07T10:48:16.453Z" }, + { url = "https://files.pythonhosted.org/packages/7f/52/1443a446486eba966bcbca1696b472e4f210320ec42f490a47f48fbf0fdc/librt-0.15.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:c434e072557ade9cbc642d052c89d031efe47d5c9614523619d0d74a02378e81", size = 727561, upload-time = "2026-08-07T10:48:18.089Z" }, + { url = "https://files.pythonhosted.org/packages/79/91/2270a9380f11725cf83ce1925a5e32dd1dde2be9bba597f25c10a38644e7/librt-0.15.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:c7eec6a42018bc1d45763b1c162d3d2bf7c3b9a1b0ed30d3e91dcba390efefcc", size = 774417, upload-time = "2026-08-07T10:48:19.611Z" }, + { url = "https://files.pythonhosted.org/packages/9e/3b/f4b1548d4f5b99186737fe27aec238e9823e8d5d23bf4df007c030689dc5/librt-0.15.0-cp314-cp314t-win32.whl", hash = "sha256:6912fa5e635d74529ac7cdb1bdf6ca3af4453da8d1edbe0110ee1cb4ad407ebf", size = 104381, upload-time = "2026-08-07T10:48:21.048Z" }, + { url = "https://files.pythonhosted.org/packages/80/b6/134afad262def1de04c0843c376d02135f1168af43f22e09a52bd8394727/librt-0.15.0-cp314-cp314t-win_amd64.whl", hash = "sha256:8e11699ed745931c395acd3621b07062e0f840efa6935aad87a64ed0995f0915", size = 127034, upload-time = "2026-08-07T10:48:22.561Z" }, + { url = "https://files.pythonhosted.org/packages/99/5f/1b6846b20572bd699c9e9ec321a5f781845bee477df2aa2a43b28bc40119/librt-0.15.0-cp314-cp314t-win_arm64.whl", hash = "sha256:5d2a91724463bfed4f573cd7a9fdc856d2e230d0c0e5a61416a93481dccd8605", size = 110827, upload-time = "2026-08-07T10:48:23.804Z" }, + { url = "https://files.pythonhosted.org/packages/c6/44/4de9f4ddadb009a55c7758eb5736d62534a7daaf27bd71bc50e64b606b06/librt-0.15.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:8443e38dcfcfdbcf5add5118c623efd788d65ac2e25756d6251a54a06a4d0aca", size = 149843, upload-time = "2026-08-07T10:48:25.148Z" }, + { url = "https://files.pythonhosted.org/packages/1f/eb/5d9ab71e30119c44094e0275f38b47dd327aea0f843a080396677029d508/librt-0.15.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:6d15a29033c57490cfe2069097c6fc4049e4e65ffbb749be7dc453b7c4c68965", size = 154510, upload-time = "2026-08-07T10:48:26.485Z" }, + { url = "https://files.pythonhosted.org/packages/d0/9c/8505d1b8f5e8c19587bd03f7429993b3e9ce5c06819d856bfb11d919374c/librt-0.15.0-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d2c05c729b589e734c09578bf5964be48a911765484840d017bbc84f49d4c4ad", size = 497543, upload-time = "2026-08-07T10:48:28.045Z" }, + { url = "https://files.pythonhosted.org/packages/1d/9a/3a8390775cb095765aded027ac9c63e7c8ea74e731498607544c6505de0e/librt-0.15.0-cp315-cp315-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:fa60887537e1d0cd2d9982269d33a709bf54b195cd2b9364fc0a758022af5bd9", size = 480452, upload-time = "2026-08-07T10:48:29.531Z" }, + { url = "https://files.pythonhosted.org/packages/e7/40/258a4a7117ee915d66de5cd9b8ade65a440993161107ce3a686f1859955c/librt-0.15.0-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:d8bc24219b24c0af375718942ab75e3544b2763085f40f965be4326734ae8328", size = 507768, upload-time = "2026-08-07T10:48:31.007Z" }, + { url = "https://files.pythonhosted.org/packages/6b/c6/2f4dd296c97a0b85b98894519b279408ec9dd602d4f692b1ea0e25dee670/librt-0.15.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:86a21a7bd3fe3a419512ef424cc1c020f6771d0b29cfddff36d1635a855e63f0", size = 525122, upload-time = "2026-08-07T10:48:32.7Z" }, + { url = "https://files.pythonhosted.org/packages/49/dd/29eab42be13b2bf0ea8cb227135a45d44693e30a7e8b92871981ff56b82b/librt-0.15.0-cp315-cp315-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:dbab647e88d90b3167b91efe7091e248653688ed4337e4f90907a722c7361bb9", size = 520371, upload-time = "2026-08-07T10:48:34.294Z" }, + { url = "https://files.pythonhosted.org/packages/91/ed/4bad71adeca8fe208b775c2a35417fa5a2584c8f4791daaf89a89450fea1/librt-0.15.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:d8edcf6f550e918dca779c069b9e156385c60b406f99fc7641f32c52f7193659", size = 537258, upload-time = "2026-08-07T10:48:35.88Z" }, + { url = "https://files.pythonhosted.org/packages/4c/63/59dba6143fdcc7240c54458b629f3250000a61b8945890fc9efd451b19c5/librt-0.15.0-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:8b62076030baa2d8b1501a46bf0e19c27a489aa90671c55665bff7887f7660b0", size = 527432, upload-time = "2026-08-07T10:48:37.466Z" }, + { url = "https://files.pythonhosted.org/packages/ec/21/21a24c6a2327d8362580efebe77286bf47b0f4062ec5ea41766e609d3c7d/librt-0.15.0-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:d00d20d1818e82a07a0ee0aa89a98b17ed7916b92441090b683719cb20a59b6d", size = 548108, upload-time = "2026-08-07T10:48:39.384Z" }, + { url = "https://files.pythonhosted.org/packages/5a/6d/fc68c89a7971418b41f9a873623ff935cb864097544c6a2f8ce491c8ef5d/librt-0.15.0-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:4e6ee93fc3cf848dcbf0cce2eca73d8e7dcd0cc2b6df3a529d57750b30a4c55c", size = 529681, upload-time = "2026-08-07T10:48:41.392Z" }, + { url = "https://files.pythonhosted.org/packages/65/7e/c2d98766124400d722063a630b0fde38a9fc768705d37eecca15c47dc192/librt-0.15.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:32896a0af72508ea979e0acb4e4c04cbeeae04938167950d535c83c45597167d", size = 567736, upload-time = "2026-08-07T10:48:43.124Z" }, + { url = "https://files.pythonhosted.org/packages/55/6c/f8c34a95e3a515c6e1c192b89511e7253c89a7760c6b500d57ffdb8d2dc8/librt-0.15.0-cp315-cp315-pyemscripten_2026_5_wasm32.whl", hash = "sha256:ec3ba415afaf951f6951b1dd16d3c8e4f540065fc382d7e70b823a79567ca374", size = 81673, upload-time = "2026-08-07T10:48:44.645Z" }, + { url = "https://files.pythonhosted.org/packages/c9/9e/e23fa8e78679ec45728188650b39e8ff476c83b691c96f749217df3b1b7c/librt-0.15.0-cp315-cp315-win32.whl", hash = "sha256:d2813ba2503764f0450680c533d13df7cff9b49df1411062eded5f67db4195b9", size = 100081, upload-time = "2026-08-07T10:48:46.171Z" }, + { url = "https://files.pythonhosted.org/packages/e1/dc/3eb4c5e297343f0620a55532cd7c8d764d3001fa2159212dadf480464827/librt-0.15.0-cp315-cp315-win_amd64.whl", hash = "sha256:b87d67e33afaf265262f2a66db578284b88ee2e6fcd224579cb5c15518677ad8", size = 121228, upload-time = "2026-08-07T10:48:47.631Z" }, + { url = "https://files.pythonhosted.org/packages/97/70/43abce19f04e49762f8ec834c8fafee13cc40fd6b94a72a24e534febfcd0/librt-0.15.0-cp315-cp315-win_arm64.whl", hash = "sha256:713bd7df21170b982e729e46870f31d6b437bd1a9b4648cffb529bd3c2ec5c4b", size = 106487, upload-time = "2026-08-07T10:48:49.095Z" }, + { url = "https://files.pythonhosted.org/packages/de/15/83f2deddb9368b8951ec8c9477269b5b9b8bd9bbf15e57402d0f38817dca/librt-0.15.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:3de789c82752730f94782a5ee518baf9c05edf85733aeaf73bb6e518755cdf54", size = 159448, upload-time = "2026-08-07T10:48:50.649Z" }, + { url = "https://files.pythonhosted.org/packages/06/bf/043097353f9b3c73b583d07f6b8e552795463f4bfc8caf85e42eee50c26a/librt-0.15.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:e0b5deec9a8664eb722c797241970fd4aa1894d25fda36a1ddac0f7407606bd6", size = 161686, upload-time = "2026-08-07T10:48:52.174Z" }, + { url = "https://files.pythonhosted.org/packages/f4/2a/8ae77f9719d42ce71cd708560a3557b38ac3c17a0383e57f87084de45bbe/librt-0.15.0-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5563302a8359bc2295bb7084d1a8ed1519df96afb30eb2aa4e0bff7b54228988", size = 710668, upload-time = "2026-08-07T10:48:53.782Z" }, + { url = "https://files.pythonhosted.org/packages/61/34/c0436ea134deb9a0d6da80a396a2739a81cb31e0418f7227239e23140898/librt-0.15.0-cp315-cp315t-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:22d6263b9d39d7bbb286fa791945646e3218f1be2d693e36fb630f1d0e59cd13", size = 679396, upload-time = "2026-08-07T10:48:55.645Z" }, + { url = "https://files.pythonhosted.org/packages/4a/9f/001e0d99aa9250d5cd5715a9081291a20656083459f9019cda15255329e1/librt-0.15.0-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:39ffd14646190c454f0d86e0d256b33f00a87a26ab410e619773b841d0e41416", size = 704313, upload-time = "2026-08-07T10:48:57.46Z" }, + { url = "https://files.pythonhosted.org/packages/2d/53/b34fa9d0ff00f136f4d58ebb4c411ff634baed1eb412bb602a2bc8dcafcb/librt-0.15.0-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c47318cd3a61401452de11282242937e3e057c4fd3dbaf601e269d0928a06c0a", size = 729847, upload-time = "2026-08-07T10:48:59.231Z" }, + { url = "https://files.pythonhosted.org/packages/86/ac/fa4d7a424665040e95baf480a6d523446057684b6758624c85338e8a23b2/librt-0.15.0-cp315-cp315t-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a56a1d4f859a82ca5b99fc4b82c9b027b15e3c455c5cd99e7d0719f27bb20b6c", size = 742736, upload-time = "2026-08-07T10:49:01.151Z" }, + { url = "https://files.pythonhosted.org/packages/8a/f1/e17a9bb5de6fb8c3186ed1a7d68d21618b027ac2d3633e03d3b6109c67ae/librt-0.15.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:077471b3182db4e17c36ae91555f36a4d2c00080b267f749bcad34a478a9a302", size = 763454, upload-time = "2026-08-07T10:49:03.039Z" }, + { url = "https://files.pythonhosted.org/packages/1d/ec/ecd02cd30935b931b9cdbfed6ab5a099c51b280b4e7baa274da80978ed27/librt-0.15.0-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:411ca4d1b905b860ceba7570dd6717a71dedaddcc4b0f77ece710aa41ee11f8d", size = 743296, upload-time = "2026-08-07T10:49:04.941Z" }, + { url = "https://files.pythonhosted.org/packages/e6/b5/b3c2b8353ce820a4854f78d19321344242f89fa71c975b71132ba9bf242a/librt-0.15.0-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:1256589e0b0adb31751d685a68bce29d73407ddf4ef05d4188f49d5dcf9566d9", size = 756217, upload-time = "2026-08-07T10:49:06.825Z" }, + { url = "https://files.pythonhosted.org/packages/3c/52/6cc22542ba59146b05cca2a656f9ff8bb67e38e63d12c3b0cc183d837bf1/librt-0.15.0-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:f42b74a53e5f26a0ba0007411a7455b66c67ce4022a39cc1f56fc4efd65bcbab", size = 741934, upload-time = "2026-08-07T10:49:08.839Z" }, + { url = "https://files.pythonhosted.org/packages/40/32/a04b72b1aa86e3be23b2ecff8c1aad2dcc955bd3956d6d26e7e34267e57a/librt-0.15.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:291bf73caf78b9e88d6fae9bfd693207ff7d832e2fdbe2cf8e746bc13f5f892b", size = 783763, upload-time = "2026-08-07T10:49:10.661Z" }, + { url = "https://files.pythonhosted.org/packages/6c/f0/89eb11dffbe9279ff37144dec786927314502ae0b114f1449dc78c458aab/librt-0.15.0-cp315-cp315t-win32.whl", hash = "sha256:c16d15ee371643ab48dc8248a3e680ebbeca573a13af2c3dd0c985b142d77162", size = 104313, upload-time = "2026-08-07T10:49:12.305Z" }, + { url = "https://files.pythonhosted.org/packages/6d/4a/1f1978c200f563beda63c36adff2d65bbecb81e365e8e69e572f5f70fbc6/librt-0.15.0-cp315-cp315t-win_amd64.whl", hash = "sha256:dbd605739f228912dc49027cb764456b9757750bdc2b6b7773164db7096c6fd1", size = 126889, upload-time = "2026-08-07T10:49:13.881Z" }, + { url = "https://files.pythonhosted.org/packages/38/a6/800800bfed7b1fb10fc3f3d557785c3854e80d3f7a9800d784b176a1fc2d/librt-0.15.0-cp315-cp315t-win_arm64.whl", hash = "sha256:84d244b00604d17df3fc7736c327892d6bba66181254aa4087be807b6c342bdc", size = 110700, upload-time = "2026-08-07T10:49:15.499Z" }, ] [[package]] name = "markdown-it-py" -version = "4.0.0" +version = "4.2.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "mdurl" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/5b/f5/4ec618ed16cc4f8fb3b701563655a69816155e79e24a17b651541804721d/markdown_it_py-4.0.0.tar.gz", hash = "sha256:cb0a2b4aa34f932c007117b194e945bd74e0ec24133ceb5bac59009cda1cb9f3", size = 73070, upload-time = "2025-08-11T12:57:52.854Z" } +sdist = { url = "https://files.pythonhosted.org/packages/06/ff/7841249c247aa650a76b9ee4bbaeae59370dc8bfd2f6c01f3630c35eb134/markdown_it_py-4.2.0.tar.gz", hash = "sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49", size = 82454, upload-time = "2026-05-07T12:08:28.36Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/94/54/e7d793b573f298e1c9013b8c4dade17d481164aa517d1d7148619c2cedbf/markdown_it_py-4.0.0-py3-none-any.whl", hash = "sha256:87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147", size = 87321, upload-time = "2025-08-11T12:57:51.923Z" }, + { url = "https://files.pythonhosted.org/packages/b3/81/4da04ced5a082363ecfa159c010d200ecbd959ae410c10c0264a38cac0f5/markdown_it_py-4.2.0-py3-none-any.whl", hash = "sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a", size = 91687, upload-time = "2026-05-07T12:08:27.182Z" }, ] [[package]] name = "mcp" -version = "1.25.0" +version = "1.29.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, @@ -1052,9 +1151,9 @@ dependencies = [ { name = "typing-inspection" }, { name = "uvicorn", marker = "sys_platform != 'emscripten'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/d5/2d/649d80a0ecf6a1f82632ca44bec21c0461a9d9fc8934d38cb5b319f2db5e/mcp-1.25.0.tar.gz", hash = "sha256:56310361ebf0364e2d438e5b45f7668cbb124e158bb358333cd06e49e83a6802", size = 605387, upload-time = "2025-12-19T10:19:56.985Z" } +sdist = { url = "https://files.pythonhosted.org/packages/b5/48/0bb26fdfe7ac16875f534a101ce2405eae192bdef37e7451f2f4507c13ec/mcp-1.29.1.tar.gz", hash = "sha256:1967ba4c315f7a375146209949f45950d18b0efd2f913d7cf3400bc723ee5f04", size = 646823, upload-time = "2026-08-24T18:30:41.161Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/e2/fc/6dc7659c2ae5ddf280477011f4213a74f806862856b796ef08f028e664bf/mcp-1.25.0-py3-none-any.whl", hash = "sha256:b37c38144a666add0862614cc79ec276e97d72aa8ca26d622818d4e278b9721a", size = 233076, upload-time = "2025-12-19T10:19:55.416Z" }, + { url = "https://files.pythonhosted.org/packages/0b/04/d6b4fb82eefe9e81807aabca1ac98f460ae0883974b83a997aaa20c52545/mcp-1.29.1-py3-none-any.whl", hash = "sha256:b6310eeb59153300c4ab8b9aec4c52f4819a2d6a8e429eb43d908bed7c783648", size = 224653, upload-time = "2026-08-24T18:30:39.573Z" }, ] [[package]] @@ -1068,11 +1167,11 @@ wheels = [ [[package]] name = "more-itertools" -version = "10.8.0" +version = "11.1.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/ea/5d/38b681d3fce7a266dd9ab73c66959406d565b3e85f21d5e66e1181d93721/more_itertools-10.8.0.tar.gz", hash = "sha256:f638ddf8a1a0d134181275fb5d58b086ead7c6a72429ad725c67503f13ba30bd", size = 137431, upload-time = "2025-09-02T15:23:11.018Z" } +sdist = { url = "https://files.pythonhosted.org/packages/de/1d/f4da6f02cdffe04d6362210b807146a26044c88d839208aec273bb0d9184/more_itertools-11.1.0.tar.gz", hash = "sha256:48e8f4d9e7e5878571ecf6f2b4e57634f93cd474cc8cfbd2376f2d11b396e30d", size = 145772, upload-time = "2026-05-22T14:14:29.909Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/a4/8e/469e5a4a2f5855992e425f3cb33804cc07bf18d48f2db061aec61ce50270/more_itertools-10.8.0-py3-none-any.whl", hash = "sha256:52d4362373dcf7c52546bc4af9a86ee7c4579df9a8dc268be0a2f949d376cc9b", size = 69667, upload-time = "2025-09-02T15:23:09.635Z" }, + { url = "https://files.pythonhosted.org/packages/e8/3d/1087453384dbde46a8c7f9356eead2c58be8a7bf156bca40243377c85715/more_itertools-11.1.0-py3-none-any.whl", hash = "sha256:4b65538ae22f6fed0ce4874efd317463a7489796a0939fa66824dd542125a192", size = 72226, upload-time = "2026-05-22T14:14:28.824Z" }, ] [[package]] @@ -1165,33 +1264,32 @@ wheels = [ [[package]] name = "opentelemetry-api" -version = "1.39.1" +version = "1.44.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "importlib-metadata" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/97/b9/3161be15bb8e3ad01be8be5a968a9237c3027c5be504362ff800fca3e442/opentelemetry_api-1.39.1.tar.gz", hash = "sha256:fbde8c80e1b937a2c61f20347e91c0c18a1940cecf012d62e65a7caf08967c9c", size = 65767, upload-time = "2025-12-11T13:32:39.182Z" } +sdist = { url = "https://files.pythonhosted.org/packages/ee/8b/aa9e2d8b8dfa7c946f7dec5d1f8f6ba8eca062f43509a06bdb5ce93d26c0/opentelemetry_api-1.44.0.tar.gz", hash = "sha256:67647e5e9566edcf421166fdf022b3537f818635daa852b289e34604dc6fb33a", size = 72406, upload-time = "2026-07-16T15:25:32.678Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/cf/df/d3f1ddf4bb4cb50ed9b1139cc7b1c54c34a1e7ce8fd1b9a37c0d1551a6bd/opentelemetry_api-1.39.1-py3-none-any.whl", hash = "sha256:2edd8463432a7f8443edce90972169b195e7d6a05500cd29e6d13898187c9950", size = 66356, upload-time = "2025-12-11T13:32:17.304Z" }, + { url = "https://files.pythonhosted.org/packages/ca/6f/a04e900f465ff3221ccc395522503e2d10e79fa21f2723c8e177aae1e0d1/opentelemetry_api-1.44.0-py3-none-any.whl", hash = "sha256:94b98c893a91b88657eaac1e3ba89618cdb85be6918196705354f34728b2cdef", size = 60018, upload-time = "2026-07-16T15:25:11.657Z" }, ] [[package]] name = "packaging" -version = "25.0" +version = "26.3" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/a1/d4/1fc4078c65507b51b96ca8f8c3ba19e6a61c8253c72794544580a7b6c24d/packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f", size = 165727, upload-time = "2025-04-19T11:48:59.673Z" } +sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412, upload-time = "2026-08-04T18:15:28.737Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469, upload-time = "2025-04-19T11:48:57.875Z" }, + { url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" }, ] [[package]] name = "pathable" -version = "0.4.4" +version = "0.6.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/67/93/8f2c2075b180c12c1e9f6a09d1a985bc2036906b13dff1d8917e395f2048/pathable-0.4.4.tar.gz", hash = "sha256:6905a3cd17804edfac7875b5f6c9142a218c7caef78693c2dbbbfbac186d88b2", size = 8124, upload-time = "2025-01-10T18:43:13.247Z" } +sdist = { url = "https://files.pythonhosted.org/packages/66/f3/5a20387de9bcd0607871bfc2198ee0e15836da7baa4592ccd7f24c27c986/pathable-0.6.0.tar.gz", hash = "sha256:6404b8b82aef5ff0fd478934137128b99b12212ba35afdde5525ca4f8388ea58", size = 18970, upload-time = "2026-05-19T18:15:11.911Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/7d/eb/b6260b31b1a96386c0a880edebe26f89669098acea8e0318bff6adb378fd/pathable-0.4.4-py3-none-any.whl", hash = "sha256:5ae9e94793b6ef5a4cbe0a7ce9dbbefc1eec38df253763fd0aeeacf2762dbbc2", size = 9592, upload-time = "2025-01-10T18:43:11.88Z" }, + { url = "https://files.pythonhosted.org/packages/a2/e8/6d75ffd9784bce2e93d1ae4415649427e39a53bb172d4672b2b59c6f0a7b/pathable-0.6.0-py3-none-any.whl", hash = "sha256:82c4ca6c98c502ad12e0d4e9779b6210afee93c38990988c8c5d1b49bdcdf566", size = 18983, upload-time = "2026-05-19T18:15:10.728Z" }, ] [[package]] @@ -1205,11 +1303,11 @@ wheels = [ [[package]] name = "platformdirs" -version = "4.5.0" +version = "4.11.5" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/61/33/9611380c2bdb1225fdef633e2a9610622310fed35ab11dac9620972ee088/platformdirs-4.5.0.tar.gz", hash = "sha256:70ddccdd7c99fc5942e9fc25636a8b34d04c24b335100223152c2803e4063312", size = 21632, upload-time = "2025-10-08T17:44:48.791Z" } +sdist = { url = "https://files.pythonhosted.org/packages/ea/06/cf1564dcc2e2261c8c8c6c05628dc8b418943bdae2a4e58640ceb2f770fa/platformdirs-4.11.5.tar.gz", hash = "sha256:e8b31f4f8bcbbedef91a6b57a706255e4f148d2a4e01648382a0a47342539173", size = 34823, upload-time = "2026-08-27T21:36:37.46Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/73/cb/ac7874b3e5d58441674fb70742e6c374b28b0c7cb988d37d991cde47166c/platformdirs-4.5.0-py3-none-any.whl", hash = "sha256:e578a81bb873cbb89a41fcc904c7ef523cc18284b7e3b3ccf06aca1403b7ebd3", size = 18651, upload-time = "2025-10-08T17:44:47.223Z" }, + { url = "https://files.pythonhosted.org/packages/c7/12/6f3fcd5067a9cbf4f8664b32957973498da8b083455203c8d9cab83a725c/platformdirs-4.11.5-py3-none-any.whl", hash = "sha256:89f8d42695853b89c7170bd49bc3dc593f98a71e695ede88e06a3b247bc4563b", size = 23900, upload-time = "2026-08-27T21:36:36.227Z" }, ] [[package]] @@ -1223,20 +1321,21 @@ wheels = [ [[package]] name = "py-key-value-aio" -version = "0.4.4" +version = "0.4.5" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "beartype" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/04/3c/0397c072a38d4bc580994b42e0c90c5f44f679303489e4376289534735e5/py_key_value_aio-0.4.4.tar.gz", hash = "sha256:e3012e6243ed7cc09bb05457bd4d03b1ba5c2b1ca8700096b3927db79ffbbe55", size = 92300, upload-time = "2026-02-16T21:21:43.245Z" } +sdist = { url = "https://files.pythonhosted.org/packages/fb/e2/d689d922894a7ecde73b6daeaf9b13dab5aae06fe6aaaf7514722644d382/py_key_value_aio-0.4.5.tar.gz", hash = "sha256:c6563a2c6abe5da5e20f4f9e875c2a9b425a2244a54fadbf46cf140a9eea45d7", size = 107547, upload-time = "2026-05-27T16:37:08.107Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/32/69/f1b537ee70b7def42d63124a539ed3026a11a3ffc3086947a1ca6e861868/py_key_value_aio-0.4.4-py3-none-any.whl", hash = "sha256:18e17564ecae61b987f909fc2cd41ee2012c84b4b1dcb8c055cf8b4bc1bf3f5d", size = 152291, upload-time = "2026-02-16T21:21:44.241Z" }, + { url = "https://files.pythonhosted.org/packages/f6/95/b8ba862968712caa12a19666175334fa979e1f198b896a430adb3bacfe87/py_key_value_aio-0.4.5-py3-none-any.whl", hash = "sha256:ab862adbcb8c72547d1c57821f22cbbb71ab86509039c96f36e914e0336c8dd7", size = 170005, upload-time = "2026-05-27T16:37:06.629Z" }, ] [package.optional-dependencies] filetree = [ - { name = "aiofile" }, + { name = "aiofile", version = "3.9.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "aiofile", version = "3.12.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "anyio" }, ] keyring = [ @@ -1248,11 +1347,11 @@ memory = [ [[package]] name = "pycparser" -version = "2.23" +version = "3.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/fe/cf/d2d3b9f5699fb1e4615c8e32ff220203e43b248e1dfcc6736ad9057731ca/pycparser-2.23.tar.gz", hash = "sha256:78816d4f24add8f10a06d6f05b4d424ad9e96cfebf68a4ddc99c65c0720d00c2", size = 173734, upload-time = "2025-09-09T13:23:47.91Z" } +sdist = { url = "https://files.pythonhosted.org/packages/1b/7d/92392ff7815c21062bea51aa7b87d45576f649f16458d78b7cf94b9ab2e6/pycparser-3.0.tar.gz", hash = "sha256:600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29", size = 103492, upload-time = "2026-01-21T14:26:51.89Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/a0/e3/59cd50310fc9b59512193629e1984c1f95e5c8ae6e5d8c69532ccc65a7fe/pycparser-2.23-py3-none-any.whl", hash = "sha256:e5c6e8d3fbad53479cab09ac03729e0a9faf2bee3db8208a550daf5af81a5934", size = 118140, upload-time = "2025-09-09T13:23:46.651Z" }, + { url = "https://files.pythonhosted.org/packages/0c/c3/44f3fbbfa403ea2a7c779186dc20772604442dde72947e7d01069cbe98e3/pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992", size = 48172, upload-time = "2026-01-21T14:26:50.693Z" }, ] [[package]] @@ -1407,23 +1506,23 @@ wheels = [ [[package]] name = "pygments" -version = "2.20.0" +version = "2.21.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/c3/b2/bc9c9196916376152d655522fdcebac55e66de6603a76a02bca1b6414f6c/pygments-2.20.0.tar.gz", hash = "sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f", size = 4955991, upload-time = "2026-03-29T13:29:33.898Z" } +sdist = { url = "https://files.pythonhosted.org/packages/49/2e/ced460408999b33da6b31b0021b0f37d329e202d4169aeb164493778f25b/pygments-2.21.0.tar.gz", hash = "sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c", size = 5005329, upload-time = "2026-08-17T08:02:48.824Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/f4/7e/a72dd26f3b0f4f2bf1dd8923c85f7ceb43172af56d63c7383eb62b332364/pygments-2.20.0-py3-none-any.whl", hash = "sha256:81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176", size = 1231151, upload-time = "2026-03-29T13:29:30.038Z" }, + { url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147, upload-time = "2026-08-17T08:02:44.912Z" }, ] [[package]] name = "pyjwt" -version = "2.12.1" +version = "2.13.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/c2/27/a3b6e5bf6ff856d2509292e95c8f57f0df7017cf5394921fc4e4ef40308a/pyjwt-2.12.1.tar.gz", hash = "sha256:c74a7a2adf861c04d002db713dd85f84beb242228e671280bf709d765b03672b", size = 102564, upload-time = "2026-03-13T19:27:37.25Z" } +sdist = { url = "https://files.pythonhosted.org/packages/3b/81/58d0ac84e1ef3a3843791d6954d94c0b33d526c75eeb1efbce9d0a4c4077/pyjwt-2.13.0.tar.gz", hash = "sha256:41571c89ca91598c79e8ef18a2d07367d4810fbbd6f637794879baf1b7703423", size = 107515, upload-time = "2026-05-21T19:54:36.618Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/e5/7a/8dd906bd22e79e47397a61742927f6747fe93242ef86645ee9092e610244/pyjwt-2.12.1-py3-none-any.whl", hash = "sha256:28ca37c070cad8ba8cd9790cd940535d40274d22f80ab87f3ac6a713e6e8454c", size = 29726, upload-time = "2026-03-13T19:27:35.677Z" }, + { url = "https://files.pythonhosted.org/packages/a3/5e/ecf12fdb62546d64385c158514e9b2b671f7832108ef2ecd2020ce0af2d1/pyjwt-2.13.0-py3-none-any.whl", hash = "sha256:66adcc2aff09b3f1bbd95fc1e1577df8ac8723c978552fd43304c8a290ac5728", size = 31274, upload-time = "2026-05-21T19:54:35.362Z" }, ] [package.optional-dependencies] @@ -1497,42 +1596,45 @@ wheels = [ [[package]] name = "python-dotenv" -version = "1.2.2" +version = "1.2.3" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/82/ed/0301aeeac3e5353ef3d94b6ec08bbcabd04a72018415dcb29e588514bba8/python_dotenv-1.2.2.tar.gz", hash = "sha256:2c371a91fbd7ba082c2c1dc1f8bf89ca22564a087c2c287cd9b662adde799cf3", size = 50135, upload-time = "2026-03-01T16:00:26.196Z" } +sdist = { url = "https://files.pythonhosted.org/packages/6a/53/ed9d74092561d4b01a2ef1349d52cdbc135e526c245f366b089cfca6de49/python_dotenv-1.2.3.tar.gz", hash = "sha256:a20a594dabeaa385725aa239d5244871c143ecb356add8a20fcf23773a6c3a35", size = 58945, upload-time = "2026-08-16T16:54:54.067Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/0b/d7/1959b9648791274998a9c3526f6d0ec8fd2233e4d4acce81bbae76b44b2a/python_dotenv-1.2.2-py3-none-any.whl", hash = "sha256:1d8214789a24de455a8b8bd8ae6fe3c6b69a5e3d64aa8a8e5d68e694bbcb285a", size = 22101, upload-time = "2026-03-01T16:00:25.09Z" }, + { url = "https://files.pythonhosted.org/packages/0d/17/c5c6b53ddc18f297992099b3d9ec16c855c0ccc83263a21fe4d1c625ec6c/python_dotenv-1.2.3-py3-none-any.whl", hash = "sha256:904552145e8bfed22162c09dab1c2b9b54fefa7b23ba780f4f26ca0316b0f0d9", size = 22780, upload-time = "2026-08-16T16:54:52.473Z" }, ] [[package]] name = "python-multipart" -version = "0.0.27" +version = "0.0.32" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/69/9b/f23807317a113dc36e74e75eb265a02dd1a4d9082abc3c1064acd22997c4/python_multipart-0.0.27.tar.gz", hash = "sha256:9870a6a8c5a20a5bf4f07c017bd1489006ff8836cff097b6933355ee2b49b602", size = 44043, upload-time = "2026-04-27T10:51:26.649Z" } +sdist = { url = "https://files.pythonhosted.org/packages/5b/42/55c32bb9b12693c092ad250a0e82edb5b31ddeda6eb772de5f308b3804ad/python_multipart-0.0.32.tar.gz", hash = "sha256:be54b7f3fa167bb83e4fcd936b887b708f4e57fe75911c02aebf53efaf8d938e", size = 46881, upload-time = "2026-06-04T16:18:58.647Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/99/78/4126abcbdbd3c559d43e0db7f7b9173fc6befe45d39a2856cc0b8ec2a5a6/python_multipart-0.0.27-py3-none-any.whl", hash = "sha256:6fccfad17a27334bd0193681b369f476eda3409f17381a2d65aa7df3f7275645", size = 29254, upload-time = "2026-04-27T10:51:24.997Z" }, + { url = "https://files.pythonhosted.org/packages/e1/04/e8135ebd1ad02c56ec633277529b2602ff99ff634be76cdba5744cf554fd/python_multipart-0.0.32-py3-none-any.whl", hash = "sha256:ff6d3f776f16878c894e52e107296ffc890e913c611b1a4ec6c44e2821fe2e23", size = 30042, upload-time = "2026-06-04T16:18:57.319Z" }, ] [[package]] name = "pywin32" -version = "311" +version = "312" source = { registry = "https://pypi.org/simple" } wheels = [ - { url = "https://files.pythonhosted.org/packages/7b/40/44efbb0dfbd33aca6a6483191dae0716070ed99e2ecb0c53683f400a0b4f/pywin32-311-cp310-cp310-win32.whl", hash = "sha256:d03ff496d2a0cd4a5893504789d4a15399133fe82517455e78bad62efbb7f0a3", size = 8760432, upload-time = "2025-07-14T20:13:05.9Z" }, - { url = "https://files.pythonhosted.org/packages/5e/bf/360243b1e953bd254a82f12653974be395ba880e7ec23e3731d9f73921cc/pywin32-311-cp310-cp310-win_amd64.whl", hash = "sha256:797c2772017851984b97180b0bebe4b620bb86328e8a884bb626156295a63b3b", size = 9590103, upload-time = "2025-07-14T20:13:07.698Z" }, - { url = "https://files.pythonhosted.org/packages/57/38/d290720e6f138086fb3d5ffe0b6caa019a791dd57866940c82e4eeaf2012/pywin32-311-cp310-cp310-win_arm64.whl", hash = "sha256:0502d1facf1fed4839a9a51ccbcc63d952cf318f78ffc00a7e78528ac27d7a2b", size = 8778557, upload-time = "2025-07-14T20:13:11.11Z" }, - { url = "https://files.pythonhosted.org/packages/7c/af/449a6a91e5d6db51420875c54f6aff7c97a86a3b13a0b4f1a5c13b988de3/pywin32-311-cp311-cp311-win32.whl", hash = "sha256:184eb5e436dea364dcd3d2316d577d625c0351bf237c4e9a5fabbcfa5a58b151", size = 8697031, upload-time = "2025-07-14T20:13:13.266Z" }, - { url = "https://files.pythonhosted.org/packages/51/8f/9bb81dd5bb77d22243d33c8397f09377056d5c687aa6d4042bea7fbf8364/pywin32-311-cp311-cp311-win_amd64.whl", hash = "sha256:3ce80b34b22b17ccbd937a6e78e7225d80c52f5ab9940fe0506a1a16f3dab503", size = 9508308, upload-time = "2025-07-14T20:13:15.147Z" }, - { url = "https://files.pythonhosted.org/packages/44/7b/9c2ab54f74a138c491aba1b1cd0795ba61f144c711daea84a88b63dc0f6c/pywin32-311-cp311-cp311-win_arm64.whl", hash = "sha256:a733f1388e1a842abb67ffa8e7aad0e70ac519e09b0f6a784e65a136ec7cefd2", size = 8703930, upload-time = "2025-07-14T20:13:16.945Z" }, - { url = "https://files.pythonhosted.org/packages/e7/ab/01ea1943d4eba0f850c3c61e78e8dd59757ff815ff3ccd0a84de5f541f42/pywin32-311-cp312-cp312-win32.whl", hash = "sha256:750ec6e621af2b948540032557b10a2d43b0cee2ae9758c54154d711cc852d31", size = 8706543, upload-time = "2025-07-14T20:13:20.765Z" }, - { url = "https://files.pythonhosted.org/packages/d1/a8/a0e8d07d4d051ec7502cd58b291ec98dcc0c3fff027caad0470b72cfcc2f/pywin32-311-cp312-cp312-win_amd64.whl", hash = "sha256:b8c095edad5c211ff31c05223658e71bf7116daa0ecf3ad85f3201ea3190d067", size = 9495040, upload-time = "2025-07-14T20:13:22.543Z" }, - { url = "https://files.pythonhosted.org/packages/ba/3a/2ae996277b4b50f17d61f0603efd8253cb2d79cc7ae159468007b586396d/pywin32-311-cp312-cp312-win_arm64.whl", hash = "sha256:e286f46a9a39c4a18b319c28f59b61de793654af2f395c102b4f819e584b5852", size = 8710102, upload-time = "2025-07-14T20:13:24.682Z" }, - { url = "https://files.pythonhosted.org/packages/a5/be/3fd5de0979fcb3994bfee0d65ed8ca9506a8a1260651b86174f6a86f52b3/pywin32-311-cp313-cp313-win32.whl", hash = "sha256:f95ba5a847cba10dd8c4d8fefa9f2a6cf283b8b88ed6178fa8a6c1ab16054d0d", size = 8705700, upload-time = "2025-07-14T20:13:26.471Z" }, - { url = "https://files.pythonhosted.org/packages/e3/28/e0a1909523c6890208295a29e05c2adb2126364e289826c0a8bc7297bd5c/pywin32-311-cp313-cp313-win_amd64.whl", hash = "sha256:718a38f7e5b058e76aee1c56ddd06908116d35147e133427e59a3983f703a20d", size = 9494700, upload-time = "2025-07-14T20:13:28.243Z" }, - { url = "https://files.pythonhosted.org/packages/04/bf/90339ac0f55726dce7d794e6d79a18a91265bdf3aa70b6b9ca52f35e022a/pywin32-311-cp313-cp313-win_arm64.whl", hash = "sha256:7b4075d959648406202d92a2310cb990fea19b535c7f4a78d3f5e10b926eeb8a", size = 8709318, upload-time = "2025-07-14T20:13:30.348Z" }, - { url = "https://files.pythonhosted.org/packages/c9/31/097f2e132c4f16d99a22bfb777e0fd88bd8e1c634304e102f313af69ace5/pywin32-311-cp314-cp314-win32.whl", hash = "sha256:b7a2c10b93f8986666d0c803ee19b5990885872a7de910fc460f9b0c2fbf92ee", size = 8840714, upload-time = "2025-07-14T20:13:32.449Z" }, - { url = "https://files.pythonhosted.org/packages/90/4b/07c77d8ba0e01349358082713400435347df8426208171ce297da32c313d/pywin32-311-cp314-cp314-win_amd64.whl", hash = "sha256:3aca44c046bd2ed8c90de9cb8427f581c479e594e99b5c0bb19b29c10fd6cb87", size = 9656800, upload-time = "2025-07-14T20:13:34.312Z" }, - { url = "https://files.pythonhosted.org/packages/c0/d2/21af5c535501a7233e734b8af901574572da66fcc254cb35d0609c9080dd/pywin32-311-cp314-cp314-win_arm64.whl", hash = "sha256:a508e2d9025764a8270f93111a970e1d0fbfc33f4153b388bb649b7eec4f9b42", size = 8932540, upload-time = "2025-07-14T20:13:36.379Z" }, + { url = "https://files.pythonhosted.org/packages/fe/1b/9cfdeac80ee45bebbbcb31f1b7b99a0d81a1c72de48d837be984e0e88b1d/pywin32-312-cp310-cp310-win32.whl", hash = "sha256:772235332b5d1024c696f11cea1ae4be7930f0a8b894bb43db14e3f435f1ff7e", size = 6361387, upload-time = "2026-06-04T07:49:14.329Z" }, + { url = "https://files.pythonhosted.org/packages/33/b1/7afc96d041d982c27bc2df6f853d43f01fd273e3d39d04be3647ddeb533d/pywin32-312-cp310-cp310-win_amd64.whl", hash = "sha256:5dbc35d2b5320dc07f25fa31269cfb767471002b17de5eb067d03da68c7cb2db", size = 6926780, upload-time = "2026-06-04T07:49:16.881Z" }, + { url = "https://files.pythonhosted.org/packages/ce/3a/4140da9ad54108e517f4a16b2d83da3033e08662144623e1239587cb7db6/pywin32-312-cp310-cp310-win_arm64.whl", hash = "sha256:3020656e34f1cf7faeb7bccd2b84653a607c6ff0c55ada85e6487d61716deabd", size = 4307203, upload-time = "2026-06-04T07:49:18.993Z" }, + { url = "https://files.pythonhosted.org/packages/1f/f5/10a6e845a00fc5e7afd0a988b744f403d4d57162a28d160a093c4d9322f0/pywin32-312-cp311-cp311-win32.whl", hash = "sha256:17948aeadbdb091f0ced6ef0841620794e68327b94ee415571c1203594b7215c", size = 6362659, upload-time = "2026-06-04T07:49:21.349Z" }, + { url = "https://files.pythonhosted.org/packages/35/c4/dcd2d62b5944b6d5db53413a5899016ccd57ffcb7278f3f81655d25d2027/pywin32-312-cp311-cp311-win_amd64.whl", hash = "sha256:d11417d84412f859b722fad0841b3614459ed0047f7542d8362e77884f6b6e8a", size = 6928825, upload-time = "2026-06-04T07:49:23.934Z" }, + { url = "https://files.pythonhosted.org/packages/b7/56/3cbb433fe4501cdba2eb9040f56a4e1a8243faa4186b25295564d1a7a79d/pywin32-312-cp311-cp311-win_arm64.whl", hash = "sha256:b2200a054ca6d6625c4842fc56a4976a4b47f96b73dbe5538c3f813a80359f47", size = 6721875, upload-time = "2026-06-04T07:49:26.416Z" }, + { url = "https://files.pythonhosted.org/packages/83/ff/32aa7d2ed0ab12b323aaa64f9b75e6ad4f8fd09f9ccfc28c79414d46838d/pywin32-312-cp312-cp312-win32.whl", hash = "sha256:dab4f65ac9c4e48400a2a0530c46c3c579cd5905ecd11b80692373915269208b", size = 6371877, upload-time = "2026-06-04T07:49:28.836Z" }, + { url = "https://files.pythonhosted.org/packages/03/d9/77040d3b43df3f3be32ea289433d660d2727f5ba327bc73be835127d9d60/pywin32-312-cp312-cp312-win_amd64.whl", hash = "sha256:b457f6d628a47e8a7346ce22acb7e1a46a4a78b52e1d17e1af56871bd19a93bc", size = 6914841, upload-time = "2026-06-04T07:49:31.85Z" }, + { url = "https://files.pythonhosted.org/packages/e3/cc/7b1ec671775756020a0ee7f4feeaf3c568f0ab86bd3900088cf986937a92/pywin32-312-cp312-cp312-win_arm64.whl", hash = "sha256:6017c58e12f6809fbb0555b75df144c2922a9ffd18e4b9b5afa863b6c1a9d950", size = 6727901, upload-time = "2026-06-04T07:49:34.244Z" }, + { url = "https://files.pythonhosted.org/packages/2d/41/12fbfd7f36ed2146d8bc9de96c2741296bf0d490b98508496cff322e274c/pywin32-312-cp313-cp313-win32.whl", hash = "sha256:7a27df850933d16a8eabfbaeb73d52b273e2da667f80d70b01a89d1f6828d02c", size = 6370184, upload-time = "2026-06-04T07:49:36.253Z" }, + { url = "https://files.pythonhosted.org/packages/ba/db/36a78e3403099d31d9746d13fdcde5accc43c1155f375a34d15983a479a7/pywin32-312-cp313-cp313-win_amd64.whl", hash = "sha256:c53e878d15a1c44788082bfe712a905433473aa38f86375b7cf8b45e3acbaaf9", size = 6914298, upload-time = "2026-06-04T07:49:38.876Z" }, + { url = "https://files.pythonhosted.org/packages/84/37/c1697194092b76de9ed47ca124323f02c57ffc8a45c06f88a3d5acaf01eb/pywin32-312-cp313-cp313-win_arm64.whl", hash = "sha256:59aba5d5940842075343a5ddc6b11f1cdf0d1567fe745290359dfbcc7c2eb831", size = 6727640, upload-time = "2026-06-04T07:49:41.083Z" }, + { url = "https://files.pythonhosted.org/packages/fc/2b/1f3cded5822fd49c02f40544cbb5f58c7cfd6b1694869fd476cb6170ee97/pywin32-312-cp314-cp314-win32.whl", hash = "sha256:a77a90fbb6881238d2ca9c6fd797b25817f3768fe78d214a90137ff055a75f5b", size = 6468928, upload-time = "2026-06-04T07:49:43.188Z" }, + { url = "https://files.pythonhosted.org/packages/21/82/3bf86d2e2808902013132e1ce905a7da0da53790f3836c64bf44d55e24f3/pywin32-312-cp314-cp314-win_amd64.whl", hash = "sha256:a4dd3a848290ef724347b19f301045831d8e802fa4464f491b98b1e0a081432e", size = 7024157, upload-time = "2026-06-04T07:49:45.34Z" }, + { url = "https://files.pythonhosted.org/packages/a4/0e/73f6d6800b4f27655abd9e9f6aaeaefcddb2b946e4674efa2bab184a7f7b/pywin32-312-cp314-cp314-win_arm64.whl", hash = "sha256:9fce94568364e0155e6dfb781ac5d95903be8baf28670632beab1b523f300daa", size = 6839598, upload-time = "2026-06-04T07:49:47.613Z" }, + { url = "https://files.pythonhosted.org/packages/eb/61/caa39686032d2ebdd04ff0ab5cbe163126c0066d98e00c9018646e42393b/pywin32-312-cp315-cp315-win32.whl", hash = "sha256:5c1fbe4a937a73ae9297384a3da38518cbc694c68ad8a809b2e19acd350f03ed", size = 6471159, upload-time = "2026-06-04T07:49:50.035Z" }, + { url = "https://files.pythonhosted.org/packages/0f/cd/7e1de64a4a6f69c04214169657ccab0d93a670ea50e35eb8f489d7378249/pywin32-312-cp315-cp315-win_amd64.whl", hash = "sha256:c2f03a0f73f804a13c2735b99392b0cd426bb4f2c4d0178e5ac966a0f21618d5", size = 7025293, upload-time = "2026-06-04T07:49:54.857Z" }, + { url = "https://files.pythonhosted.org/packages/23/ed/4532e9388e65fa16b46776ef47ad631a64eda1631884488af707666350ed/pywin32-312-cp315-cp315-win_arm64.whl", hash = "sha256:a8597d28f267b39074aef51fa593530082b39cbe5a074226096857b1fed2dfb9", size = 6840337, upload-time = "2026-06-04T07:49:57.531Z" }, ] [[package]] @@ -1610,300 +1712,417 @@ wheels = [ [[package]] name = "referencing" -version = "0.36.2" +version = "0.37.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "attrs" }, - { name = "rpds-py" }, + { name = "rpds-py", version = "0.30.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "rpds-py", version = "2026.6.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/2f/db/98b5c277be99dd18bfd91dd04e1b759cad18d1a338188c936e92f921c7e2/referencing-0.36.2.tar.gz", hash = "sha256:df2e89862cd09deabbdba16944cc3f10feb6b3e6f18e902f7cc25609a34775aa", size = 74744, upload-time = "2025-01-25T08:48:16.138Z" } +sdist = { url = "https://files.pythonhosted.org/packages/22/f5/df4e9027acead3ecc63e50fe1e36aca1523e1719559c499951bb4b53188f/referencing-0.37.0.tar.gz", hash = "sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8", size = 78036, upload-time = "2025-10-13T15:30:48.871Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/c1/b1/3baf80dc6d2b7bc27a95a67752d0208e410351e3feb4eb78de5f77454d8d/referencing-0.36.2-py3-none-any.whl", hash = "sha256:e8699adbbf8b5c7de96d8ffa0eb5c158b3beafce084968e2ea8bb08c6794dcd0", size = 26775, upload-time = "2025-01-25T08:48:14.241Z" }, -] - -[[package]] -name = "requests" -version = "2.33.1" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "certifi" }, - { name = "charset-normalizer" }, - { name = "idna" }, - { name = "urllib3" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/5f/a4/98b9c7c6428a668bf7e42ebb7c79d576a1c3c1e3ae2d47e674b468388871/requests-2.33.1.tar.gz", hash = "sha256:18817f8c57c6263968bc123d237e3b8b08ac046f5456bd1e307ee8f4250d3517", size = 134120, upload-time = "2026-03-30T16:09:15.531Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/d7/8e/7540e8a2036f79a125c1d2ebadf69ed7901608859186c856fa0388ef4197/requests-2.33.1-py3-none-any.whl", hash = "sha256:4e6d1ef462f3626a1f0a0a9c42dd93c63bad33f9f1c1937509b8c5c8718ab56a", size = 64947, upload-time = "2026-03-30T16:09:13.83Z" }, + { url = "https://files.pythonhosted.org/packages/2c/58/ca301544e1fa93ed4f80d724bf5b194f6e4b945841c5bfd555878eea9fcb/referencing-0.37.0-py3-none-any.whl", hash = "sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231", size = 26766, upload-time = "2025-10-13T15:30:47.625Z" }, ] [[package]] name = "rich" -version = "14.2.0" +version = "15.0.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "markdown-it-py" }, { name = "pygments" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/fb/d2/8920e102050a0de7bfabeb4c4614a49248cf8d5d7a8d01885fbb24dc767a/rich-14.2.0.tar.gz", hash = "sha256:73ff50c7c0c1c77c8243079283f4edb376f0f6442433aecb8ce7e6d0b92d1fe4", size = 219990, upload-time = "2025-10-09T14:16:53.064Z" } +sdist = { url = "https://files.pythonhosted.org/packages/c0/8f/0722ca900cc807c13a6a0c696dacf35430f72e0ec571c4275d2371fca3e9/rich-15.0.0.tar.gz", hash = "sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36", size = 230680, upload-time = "2026-04-12T08:24:00.75Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/25/7a/b0178788f8dc6cafce37a212c99565fa1fe7872c70c6c9c1e1a372d9d88f/rich-14.2.0-py3-none-any.whl", hash = "sha256:76bc51fe2e57d2b1be1f96c524b890b816e334ab4c1e45888799bfaab0021edd", size = 243393, upload-time = "2025-10-09T14:16:51.245Z" }, + { url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654, upload-time = "2026-04-12T08:24:02.83Z" }, ] [[package]] name = "rich-rst" -version = "1.3.2" +version = "2.1.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "docutils" }, + { name = "pygments" }, { name = "rich" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/bc/6d/a506aaa4a9eaa945ed8ab2b7347859f53593864289853c5d6d62b77246e0/rich_rst-1.3.2.tar.gz", hash = "sha256:a1196fdddf1e364b02ec68a05e8ff8f6914fee10fbca2e6b6735f166bb0da8d4", size = 14936, upload-time = "2025-10-14T16:49:45.332Z" } +sdist = { url = "https://files.pythonhosted.org/packages/e2/d6/d0b9fafc73b65767200da027acab1db1bdb1048f4fea5ebf659df01c700e/rich_rst-2.1.0.tar.gz", hash = "sha256:f4d117b49697f338769759fa5cacf5197da4888b347b9fda2e50aef5cd8d93bd", size = 302732, upload-time = "2026-07-05T02:59:44.308Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/13/2f/b4530fbf948867702d0a3f27de4a6aab1d156f406d72852ab902c4d04de9/rich_rst-1.3.2-py3-none-any.whl", hash = "sha256:a99b4907cbe118cf9d18b0b44de272efa61f15117c61e39ebdc431baf5df722a", size = 12567, upload-time = "2025-10-14T16:49:42.953Z" }, + { url = "https://files.pythonhosted.org/packages/2a/68/1fc93dd759605b5d00fc98b50200739e41ed32bd22d6ba35ca6c3932371b/rich_rst-2.1.0-py3-none-any.whl", hash = "sha256:7ecd1343ee12c879d0e7ae74c3eb6d263b023d2929c6d114212eb1fd91057255", size = 272987, upload-time = "2026-07-05T02:59:42.792Z" }, ] [[package]] name = "rpds-py" -version = "0.28.0" +version = "0.30.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/48/dc/95f074d43452b3ef5d06276696ece4b3b5d696e7c9ad7173c54b1390cd70/rpds_py-0.28.0.tar.gz", hash = "sha256:abd4df20485a0983e2ca334a216249b6186d6e3c1627e106651943dbdb791aea", size = 27419, upload-time = "2025-10-22T22:24:29.327Z" } +resolution-markers = [ + "python_full_version < '3.11' and sys_platform == 'win32'", + "python_full_version < '3.11' and sys_platform != 'win32'", +] +sdist = { url = "https://files.pythonhosted.org/packages/20/af/3f2f423103f1113b36230496629986e0ef7e199d2aa8392452b484b38ced/rpds_py-0.30.0.tar.gz", hash = "sha256:dd8ff7cf90014af0c0f787eea34794ebf6415242ee1d6fa91eaba725cc441e84", size = 69469, upload-time = "2025-11-30T20:24:38.837Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/82/f8/13bb772dc7cbf2c3c5b816febc34fa0cb2c64a08e0569869585684ce6631/rpds_py-0.28.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:7b6013db815417eeb56b2d9d7324e64fcd4fa289caeee6e7a78b2e11fc9b438a", size = 362820, upload-time = "2025-10-22T22:21:15.074Z" }, - { url = "https://files.pythonhosted.org/packages/84/91/6acce964aab32469c3dbe792cb041a752d64739c534e9c493c701ef0c032/rpds_py-0.28.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1a4c6b05c685c0c03f80dabaeb73e74218c49deea965ca63f76a752807397207", size = 348499, upload-time = "2025-10-22T22:21:17.658Z" }, - { url = "https://files.pythonhosted.org/packages/f1/93/c05bb1f4f5e0234db7c4917cb8dd5e2e0a9a7b26dc74b1b7bee3c9cfd477/rpds_py-0.28.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f4794c6c3fbe8f9ac87699b131a1f26e7b4abcf6d828da46a3a52648c7930eba", size = 379356, upload-time = "2025-10-22T22:21:19.847Z" }, - { url = "https://files.pythonhosted.org/packages/5c/37/e292da436f0773e319753c567263427cdf6c645d30b44f09463ff8216cda/rpds_py-0.28.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2e8456b6ee5527112ff2354dd9087b030e3429e43a74f480d4a5ca79d269fd85", size = 390151, upload-time = "2025-10-22T22:21:21.569Z" }, - { url = "https://files.pythonhosted.org/packages/76/87/a4e3267131616e8faf10486dc00eaedf09bd61c87f01e5ef98e782ee06c9/rpds_py-0.28.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:beb880a9ca0a117415f241f66d56025c02037f7c4efc6fe59b5b8454f1eaa50d", size = 524831, upload-time = "2025-10-22T22:21:23.394Z" }, - { url = "https://files.pythonhosted.org/packages/e1/c8/4a4ca76f0befae9515da3fad11038f0fce44f6bb60b21fe9d9364dd51fb0/rpds_py-0.28.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6897bebb118c44b38c9cb62a178e09f1593c949391b9a1a6fe777ccab5934ee7", size = 404687, upload-time = "2025-10-22T22:21:25.201Z" }, - { url = "https://files.pythonhosted.org/packages/6a/65/118afe854424456beafbbebc6b34dcf6d72eae3a08b4632bc4220f8240d9/rpds_py-0.28.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b1b553dd06e875249fd43efd727785efb57a53180e0fde321468222eabbeaafa", size = 382683, upload-time = "2025-10-22T22:21:26.536Z" }, - { url = "https://files.pythonhosted.org/packages/f7/bc/0625064041fb3a0c77ecc8878c0e8341b0ae27ad0f00cf8f2b57337a1e63/rpds_py-0.28.0-cp310-cp310-manylinux_2_31_riscv64.whl", hash = "sha256:f0b2044fdddeea5b05df832e50d2a06fe61023acb44d76978e1b060206a8a476", size = 398927, upload-time = "2025-10-22T22:21:27.864Z" }, - { url = "https://files.pythonhosted.org/packages/5d/1a/fed7cf2f1ee8a5e4778f2054153f2cfcf517748875e2f5b21cf8907cd77d/rpds_py-0.28.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:05cf1e74900e8da73fa08cc76c74a03345e5a3e37691d07cfe2092d7d8e27b04", size = 411590, upload-time = "2025-10-22T22:21:29.474Z" }, - { url = "https://files.pythonhosted.org/packages/c1/64/a8e0f67fa374a6c472dbb0afdaf1ef744724f165abb6899f20e2f1563137/rpds_py-0.28.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:efd489fec7c311dae25e94fe7eeda4b3d06be71c68f2cf2e8ef990ffcd2cd7e8", size = 559843, upload-time = "2025-10-22T22:21:30.917Z" }, - { url = "https://files.pythonhosted.org/packages/a9/ea/e10353f6d7c105be09b8135b72787a65919971ae0330ad97d87e4e199880/rpds_py-0.28.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:ada7754a10faacd4f26067e62de52d6af93b6d9542f0df73c57b9771eb3ba9c4", size = 584188, upload-time = "2025-10-22T22:21:32.827Z" }, - { url = "https://files.pythonhosted.org/packages/18/b0/a19743e0763caf0c89f6fc6ba6fbd9a353b24ffb4256a492420c5517da5a/rpds_py-0.28.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c2a34fd26588949e1e7977cfcbb17a9a42c948c100cab890c6d8d823f0586457", size = 550052, upload-time = "2025-10-22T22:21:34.702Z" }, - { url = "https://files.pythonhosted.org/packages/de/bc/ec2c004f6c7d6ab1e25dae875cdb1aee087c3ebed5b73712ed3000e3851a/rpds_py-0.28.0-cp310-cp310-win32.whl", hash = "sha256:f9174471d6920cbc5e82a7822de8dfd4dcea86eb828b04fc8c6519a77b0ee51e", size = 215110, upload-time = "2025-10-22T22:21:36.645Z" }, - { url = "https://files.pythonhosted.org/packages/6c/de/4ce8abf59674e17187023933547d2018363e8fc76ada4f1d4d22871ccb6e/rpds_py-0.28.0-cp310-cp310-win_amd64.whl", hash = "sha256:6e32dd207e2c4f8475257a3540ab8a93eff997abfa0a3fdb287cae0d6cd874b8", size = 223850, upload-time = "2025-10-22T22:21:38.006Z" }, - { url = "https://files.pythonhosted.org/packages/a6/34/058d0db5471c6be7bef82487ad5021ff8d1d1d27794be8730aad938649cf/rpds_py-0.28.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:03065002fd2e287725d95fbc69688e0c6daf6c6314ba38bdbaa3895418e09296", size = 362344, upload-time = "2025-10-22T22:21:39.713Z" }, - { url = "https://files.pythonhosted.org/packages/5d/67/9503f0ec8c055a0782880f300c50a2b8e5e72eb1f94dfc2053da527444dd/rpds_py-0.28.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:28ea02215f262b6d078daec0b45344c89e161eab9526b0d898221d96fdda5f27", size = 348440, upload-time = "2025-10-22T22:21:41.056Z" }, - { url = "https://files.pythonhosted.org/packages/68/2e/94223ee9b32332a41d75b6f94b37b4ce3e93878a556fc5f152cbd856a81f/rpds_py-0.28.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:25dbade8fbf30bcc551cb352376c0ad64b067e4fc56f90e22ba70c3ce205988c", size = 379068, upload-time = "2025-10-22T22:21:42.593Z" }, - { url = "https://files.pythonhosted.org/packages/b4/25/54fd48f9f680cfc44e6a7f39a5fadf1d4a4a1fd0848076af4a43e79f998c/rpds_py-0.28.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3c03002f54cc855860bfdc3442928ffdca9081e73b5b382ed0b9e8efe6e5e205", size = 390518, upload-time = "2025-10-22T22:21:43.998Z" }, - { url = "https://files.pythonhosted.org/packages/1b/85/ac258c9c27f2ccb1bd5d0697e53a82ebcf8088e3186d5d2bf8498ee7ed44/rpds_py-0.28.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b9699fa7990368b22032baf2b2dce1f634388e4ffc03dfefaaac79f4695edc95", size = 525319, upload-time = "2025-10-22T22:21:45.645Z" }, - { url = "https://files.pythonhosted.org/packages/40/cb/c6734774789566d46775f193964b76627cd5f42ecf246d257ce84d1912ed/rpds_py-0.28.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b9b06fe1a75e05e0713f06ea0c89ecb6452210fd60e2f1b6ddc1067b990e08d9", size = 404896, upload-time = "2025-10-22T22:21:47.544Z" }, - { url = "https://files.pythonhosted.org/packages/1f/53/14e37ce83202c632c89b0691185dca9532288ff9d390eacae3d2ff771bae/rpds_py-0.28.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac9f83e7b326a3f9ec3ef84cda98fb0a74c7159f33e692032233046e7fd15da2", size = 382862, upload-time = "2025-10-22T22:21:49.176Z" }, - { url = "https://files.pythonhosted.org/packages/6a/83/f3642483ca971a54d60caa4449f9d6d4dbb56a53e0072d0deff51b38af74/rpds_py-0.28.0-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:0d3259ea9ad8743a75a43eb7819324cdab393263c91be86e2d1901ee65c314e0", size = 398848, upload-time = "2025-10-22T22:21:51.024Z" }, - { url = "https://files.pythonhosted.org/packages/44/09/2d9c8b2f88e399b4cfe86efdf2935feaf0394e4f14ab30c6c5945d60af7d/rpds_py-0.28.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9a7548b345f66f6695943b4ef6afe33ccd3f1b638bd9afd0f730dd255c249c9e", size = 412030, upload-time = "2025-10-22T22:21:52.665Z" }, - { url = "https://files.pythonhosted.org/packages/dd/f5/e1cec473d4bde6df1fd3738be8e82d64dd0600868e76e92dfeaebbc2d18f/rpds_py-0.28.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c9a40040aa388b037eb39416710fbcce9443498d2eaab0b9b45ae988b53f5c67", size = 559700, upload-time = "2025-10-22T22:21:54.123Z" }, - { url = "https://files.pythonhosted.org/packages/8d/be/73bb241c1649edbf14e98e9e78899c2c5e52bbe47cb64811f44d2cc11808/rpds_py-0.28.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8f60c7ea34e78c199acd0d3cda37a99be2c861dd2b8cf67399784f70c9f8e57d", size = 584581, upload-time = "2025-10-22T22:21:56.102Z" }, - { url = "https://files.pythonhosted.org/packages/9c/9c/ffc6e9218cd1eb5c2c7dbd276c87cd10e8c2232c456b554169eb363381df/rpds_py-0.28.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:1571ae4292649100d743b26d5f9c63503bb1fedf538a8f29a98dce2d5ba6b4e6", size = 549981, upload-time = "2025-10-22T22:21:58.253Z" }, - { url = "https://files.pythonhosted.org/packages/5f/50/da8b6d33803a94df0149345ee33e5d91ed4d25fc6517de6a25587eae4133/rpds_py-0.28.0-cp311-cp311-win32.whl", hash = "sha256:5cfa9af45e7c1140af7321fa0bef25b386ee9faa8928c80dc3a5360971a29e8c", size = 214729, upload-time = "2025-10-22T22:21:59.625Z" }, - { url = "https://files.pythonhosted.org/packages/12/fd/b0f48c4c320ee24c8c20df8b44acffb7353991ddf688af01eef5f93d7018/rpds_py-0.28.0-cp311-cp311-win_amd64.whl", hash = "sha256:dd8d86b5d29d1b74100982424ba53e56033dc47720a6de9ba0259cf81d7cecaa", size = 223977, upload-time = "2025-10-22T22:22:01.092Z" }, - { url = "https://files.pythonhosted.org/packages/b4/21/c8e77a2ac66e2ec4e21f18a04b4e9a0417ecf8e61b5eaeaa9360a91713b4/rpds_py-0.28.0-cp311-cp311-win_arm64.whl", hash = "sha256:4e27d3a5709cc2b3e013bf93679a849213c79ae0573f9b894b284b55e729e120", size = 217326, upload-time = "2025-10-22T22:22:02.944Z" }, - { url = "https://files.pythonhosted.org/packages/b8/5c/6c3936495003875fe7b14f90ea812841a08fca50ab26bd840e924097d9c8/rpds_py-0.28.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:6b4f28583a4f247ff60cd7bdda83db8c3f5b05a7a82ff20dd4b078571747708f", size = 366439, upload-time = "2025-10-22T22:22:04.525Z" }, - { url = "https://files.pythonhosted.org/packages/56/f9/a0f1ca194c50aa29895b442771f036a25b6c41a35e4f35b1a0ea713bedae/rpds_py-0.28.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d678e91b610c29c4b3d52a2c148b641df2b4676ffe47c59f6388d58b99cdc424", size = 348170, upload-time = "2025-10-22T22:22:06.397Z" }, - { url = "https://files.pythonhosted.org/packages/18/ea/42d243d3a586beb72c77fa5def0487daf827210069a95f36328e869599ea/rpds_py-0.28.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e819e0e37a44a78e1383bf1970076e2ccc4dc8c2bbaa2f9bd1dc987e9afff628", size = 378838, upload-time = "2025-10-22T22:22:07.932Z" }, - { url = "https://files.pythonhosted.org/packages/e7/78/3de32e18a94791af8f33601402d9d4f39613136398658412a4e0b3047327/rpds_py-0.28.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5ee514e0f0523db5d3fb171f397c54875dbbd69760a414dccf9d4d7ad628b5bd", size = 393299, upload-time = "2025-10-22T22:22:09.435Z" }, - { url = "https://files.pythonhosted.org/packages/13/7e/4bdb435afb18acea2eb8a25ad56b956f28de7c59f8a1d32827effa0d4514/rpds_py-0.28.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5f3fa06d27fdcee47f07a39e02862da0100cb4982508f5ead53ec533cd5fe55e", size = 518000, upload-time = "2025-10-22T22:22:11.326Z" }, - { url = "https://files.pythonhosted.org/packages/31/d0/5f52a656875cdc60498ab035a7a0ac8f399890cc1ee73ebd567bac4e39ae/rpds_py-0.28.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:46959ef2e64f9e4a41fc89aa20dbca2b85531f9a72c21099a3360f35d10b0d5a", size = 408746, upload-time = "2025-10-22T22:22:13.143Z" }, - { url = "https://files.pythonhosted.org/packages/3e/cd/49ce51767b879cde77e7ad9fae164ea15dce3616fe591d9ea1df51152706/rpds_py-0.28.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8455933b4bcd6e83fde3fefc987a023389c4b13f9a58c8d23e4b3f6d13f78c84", size = 386379, upload-time = "2025-10-22T22:22:14.602Z" }, - { url = "https://files.pythonhosted.org/packages/6a/99/e4e1e1ee93a98f72fc450e36c0e4d99c35370220e815288e3ecd2ec36a2a/rpds_py-0.28.0-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:ad50614a02c8c2962feebe6012b52f9802deec4263946cddea37aaf28dd25a66", size = 401280, upload-time = "2025-10-22T22:22:16.063Z" }, - { url = "https://files.pythonhosted.org/packages/61/35/e0c6a57488392a8b319d2200d03dad2b29c0db9996f5662c3b02d0b86c02/rpds_py-0.28.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e5deca01b271492553fdb6c7fd974659dce736a15bae5dad7ab8b93555bceb28", size = 412365, upload-time = "2025-10-22T22:22:17.504Z" }, - { url = "https://files.pythonhosted.org/packages/ff/6a/841337980ea253ec797eb084665436007a1aad0faac1ba097fb906c5f69c/rpds_py-0.28.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:735f8495a13159ce6a0d533f01e8674cec0c57038c920495f87dcb20b3ddb48a", size = 559573, upload-time = "2025-10-22T22:22:19.108Z" }, - { url = "https://files.pythonhosted.org/packages/e7/5e/64826ec58afd4c489731f8b00729c5f6afdb86f1df1df60bfede55d650bb/rpds_py-0.28.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:961ca621ff10d198bbe6ba4957decca61aa2a0c56695384c1d6b79bf61436df5", size = 583973, upload-time = "2025-10-22T22:22:20.768Z" }, - { url = "https://files.pythonhosted.org/packages/b6/ee/44d024b4843f8386a4eeaa4c171b3d31d55f7177c415545fd1a24c249b5d/rpds_py-0.28.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:2374e16cc9131022e7d9a8f8d65d261d9ba55048c78f3b6e017971a4f5e6353c", size = 553800, upload-time = "2025-10-22T22:22:22.25Z" }, - { url = "https://files.pythonhosted.org/packages/7d/89/33e675dccff11a06d4d85dbb4d1865f878d5020cbb69b2c1e7b2d3f82562/rpds_py-0.28.0-cp312-cp312-win32.whl", hash = "sha256:d15431e334fba488b081d47f30f091e5d03c18527c325386091f31718952fe08", size = 216954, upload-time = "2025-10-22T22:22:24.105Z" }, - { url = "https://files.pythonhosted.org/packages/af/36/45f6ebb3210887e8ee6dbf1bc710ae8400bb417ce165aaf3024b8360d999/rpds_py-0.28.0-cp312-cp312-win_amd64.whl", hash = "sha256:a410542d61fc54710f750d3764380b53bf09e8c4edbf2f9141a82aa774a04f7c", size = 227844, upload-time = "2025-10-22T22:22:25.551Z" }, - { url = "https://files.pythonhosted.org/packages/57/91/f3fb250d7e73de71080f9a221d19bd6a1c1eb0d12a1ea26513f6c1052ad6/rpds_py-0.28.0-cp312-cp312-win_arm64.whl", hash = "sha256:1f0cfd1c69e2d14f8c892b893997fa9a60d890a0c8a603e88dca4955f26d1edd", size = 217624, upload-time = "2025-10-22T22:22:26.914Z" }, - { url = "https://files.pythonhosted.org/packages/d3/03/ce566d92611dfac0085c2f4b048cd53ed7c274a5c05974b882a908d540a2/rpds_py-0.28.0-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:e9e184408a0297086f880556b6168fa927d677716f83d3472ea333b42171ee3b", size = 366235, upload-time = "2025-10-22T22:22:28.397Z" }, - { url = "https://files.pythonhosted.org/packages/00/34/1c61da1b25592b86fd285bd7bd8422f4c9d748a7373b46126f9ae792a004/rpds_py-0.28.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:edd267266a9b0448f33dc465a97cfc5d467594b600fe28e7fa2f36450e03053a", size = 348241, upload-time = "2025-10-22T22:22:30.171Z" }, - { url = "https://files.pythonhosted.org/packages/fc/00/ed1e28616848c61c493a067779633ebf4b569eccaacf9ccbdc0e7cba2b9d/rpds_py-0.28.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:85beb8b3f45e4e32f6802fb6cd6b17f615ef6c6a52f265371fb916fae02814aa", size = 378079, upload-time = "2025-10-22T22:22:31.644Z" }, - { url = "https://files.pythonhosted.org/packages/11/b2/ccb30333a16a470091b6e50289adb4d3ec656fd9951ba8c5e3aaa0746a67/rpds_py-0.28.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d2412be8d00a1b895f8ad827cc2116455196e20ed994bb704bf138fe91a42724", size = 393151, upload-time = "2025-10-22T22:22:33.453Z" }, - { url = "https://files.pythonhosted.org/packages/8c/d0/73e2217c3ee486d555cb84920597480627d8c0240ff3062005c6cc47773e/rpds_py-0.28.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cf128350d384b777da0e68796afdcebc2e9f63f0e9f242217754e647f6d32491", size = 517520, upload-time = "2025-10-22T22:22:34.949Z" }, - { url = "https://files.pythonhosted.org/packages/c4/91/23efe81c700427d0841a4ae7ea23e305654381831e6029499fe80be8a071/rpds_py-0.28.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a2036d09b363aa36695d1cc1a97b36865597f4478470b0697b5ee9403f4fe399", size = 408699, upload-time = "2025-10-22T22:22:36.584Z" }, - { url = "https://files.pythonhosted.org/packages/ca/ee/a324d3198da151820a326c1f988caaa4f37fc27955148a76fff7a2d787a9/rpds_py-0.28.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8e1e9be4fa6305a16be628959188e4fd5cd6f1b0e724d63c6d8b2a8adf74ea6", size = 385720, upload-time = "2025-10-22T22:22:38.014Z" }, - { url = "https://files.pythonhosted.org/packages/19/ad/e68120dc05af8b7cab4a789fccd8cdcf0fe7e6581461038cc5c164cd97d2/rpds_py-0.28.0-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:0a403460c9dd91a7f23fc3188de6d8977f1d9603a351d5db6cf20aaea95b538d", size = 401096, upload-time = "2025-10-22T22:22:39.869Z" }, - { url = "https://files.pythonhosted.org/packages/99/90/c1e070620042459d60df6356b666bb1f62198a89d68881816a7ed121595a/rpds_py-0.28.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d7366b6553cdc805abcc512b849a519167db8f5e5c3472010cd1228b224265cb", size = 411465, upload-time = "2025-10-22T22:22:41.395Z" }, - { url = "https://files.pythonhosted.org/packages/68/61/7c195b30d57f1b8d5970f600efee72a4fad79ec829057972e13a0370fd24/rpds_py-0.28.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5b43c6a3726efd50f18d8120ec0551241c38785b68952d240c45ea553912ac41", size = 558832, upload-time = "2025-10-22T22:22:42.871Z" }, - { url = "https://files.pythonhosted.org/packages/b0/3d/06f3a718864773f69941d4deccdf18e5e47dd298b4628062f004c10f3b34/rpds_py-0.28.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:0cb7203c7bc69d7c1585ebb33a2e6074492d2fc21ad28a7b9d40457ac2a51ab7", size = 583230, upload-time = "2025-10-22T22:22:44.877Z" }, - { url = "https://files.pythonhosted.org/packages/66/df/62fc783781a121e77fee9a21ead0a926f1b652280a33f5956a5e7833ed30/rpds_py-0.28.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:7a52a5169c664dfb495882adc75c304ae1d50df552fbd68e100fdc719dee4ff9", size = 553268, upload-time = "2025-10-22T22:22:46.441Z" }, - { url = "https://files.pythonhosted.org/packages/84/85/d34366e335140a4837902d3dea89b51f087bd6a63c993ebdff59e93ee61d/rpds_py-0.28.0-cp313-cp313-win32.whl", hash = "sha256:2e42456917b6687215b3e606ab46aa6bca040c77af7df9a08a6dcfe8a4d10ca5", size = 217100, upload-time = "2025-10-22T22:22:48.342Z" }, - { url = "https://files.pythonhosted.org/packages/3c/1c/f25a3f3752ad7601476e3eff395fe075e0f7813fbb9862bd67c82440e880/rpds_py-0.28.0-cp313-cp313-win_amd64.whl", hash = "sha256:e0a0311caedc8069d68fc2bf4c9019b58a2d5ce3cd7cb656c845f1615b577e1e", size = 227759, upload-time = "2025-10-22T22:22:50.219Z" }, - { url = "https://files.pythonhosted.org/packages/e0/d6/5f39b42b99615b5bc2f36ab90423ea404830bdfee1c706820943e9a645eb/rpds_py-0.28.0-cp313-cp313-win_arm64.whl", hash = "sha256:04c1b207ab8b581108801528d59ad80aa83bb170b35b0ddffb29c20e411acdc1", size = 217326, upload-time = "2025-10-22T22:22:51.647Z" }, - { url = "https://files.pythonhosted.org/packages/5c/8b/0c69b72d1cee20a63db534be0df271effe715ef6c744fdf1ff23bb2b0b1c/rpds_py-0.28.0-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:f296ea3054e11fc58ad42e850e8b75c62d9a93a9f981ad04b2e5ae7d2186ff9c", size = 355736, upload-time = "2025-10-22T22:22:53.211Z" }, - { url = "https://files.pythonhosted.org/packages/f7/6d/0c2ee773cfb55c31a8514d2cece856dd299170a49babd50dcffb15ddc749/rpds_py-0.28.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:5a7306c19b19005ad98468fcefeb7100b19c79fc23a5f24a12e06d91181193fa", size = 342677, upload-time = "2025-10-22T22:22:54.723Z" }, - { url = "https://files.pythonhosted.org/packages/e2/1c/22513ab25a27ea205144414724743e305e8153e6abe81833b5e678650f5a/rpds_py-0.28.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e5d9b86aa501fed9862a443c5c3116f6ead8bc9296185f369277c42542bd646b", size = 371847, upload-time = "2025-10-22T22:22:56.295Z" }, - { url = "https://files.pythonhosted.org/packages/60/07/68e6ccdb4b05115ffe61d31afc94adef1833d3a72f76c9632d4d90d67954/rpds_py-0.28.0-cp313-cp313t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e5bbc701eff140ba0e872691d573b3d5d30059ea26e5785acba9132d10c8c31d", size = 381800, upload-time = "2025-10-22T22:22:57.808Z" }, - { url = "https://files.pythonhosted.org/packages/73/bf/6d6d15df80781d7f9f368e7c1a00caf764436518c4877fb28b029c4624af/rpds_py-0.28.0-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9a5690671cd672a45aa8616d7374fdf334a1b9c04a0cac3c854b1136e92374fe", size = 518827, upload-time = "2025-10-22T22:22:59.826Z" }, - { url = "https://files.pythonhosted.org/packages/7b/d3/2decbb2976cc452cbf12a2b0aaac5f1b9dc5dd9d1f7e2509a3ee00421249/rpds_py-0.28.0-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9f1d92ecea4fa12f978a367c32a5375a1982834649cdb96539dcdc12e609ab1a", size = 399471, upload-time = "2025-10-22T22:23:01.968Z" }, - { url = "https://files.pythonhosted.org/packages/b1/2c/f30892f9e54bd02e5faca3f6a26d6933c51055e67d54818af90abed9748e/rpds_py-0.28.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d252db6b1a78d0a3928b6190156042d54c93660ce4d98290d7b16b5296fb7cc", size = 377578, upload-time = "2025-10-22T22:23:03.52Z" }, - { url = "https://files.pythonhosted.org/packages/f0/5d/3bce97e5534157318f29ac06bf2d279dae2674ec12f7cb9c12739cee64d8/rpds_py-0.28.0-cp313-cp313t-manylinux_2_31_riscv64.whl", hash = "sha256:d61b355c3275acb825f8777d6c4505f42b5007e357af500939d4a35b19177259", size = 390482, upload-time = "2025-10-22T22:23:05.391Z" }, - { url = "https://files.pythonhosted.org/packages/e3/f0/886bd515ed457b5bd93b166175edb80a0b21a210c10e993392127f1e3931/rpds_py-0.28.0-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:acbe5e8b1026c0c580d0321c8aae4b0a1e1676861d48d6e8c6586625055b606a", size = 402447, upload-time = "2025-10-22T22:23:06.93Z" }, - { url = "https://files.pythonhosted.org/packages/42/b5/71e8777ac55e6af1f4f1c05b47542a1eaa6c33c1cf0d300dca6a1c6e159a/rpds_py-0.28.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:8aa23b6f0fc59b85b4c7d89ba2965af274346f738e8d9fc2455763602e62fd5f", size = 552385, upload-time = "2025-10-22T22:23:08.557Z" }, - { url = "https://files.pythonhosted.org/packages/5d/cb/6ca2d70cbda5a8e36605e7788c4aa3bea7c17d71d213465a5a675079b98d/rpds_py-0.28.0-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:7b14b0c680286958817c22d76fcbca4800ddacef6f678f3a7c79a1fe7067fe37", size = 575642, upload-time = "2025-10-22T22:23:10.348Z" }, - { url = "https://files.pythonhosted.org/packages/4a/d4/407ad9960ca7856d7b25c96dcbe019270b5ffdd83a561787bc682c797086/rpds_py-0.28.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:bcf1d210dfee61a6c86551d67ee1031899c0fdbae88b2d44a569995d43797712", size = 544507, upload-time = "2025-10-22T22:23:12.434Z" }, - { url = "https://files.pythonhosted.org/packages/51/31/2f46fe0efcac23fbf5797c6b6b7e1c76f7d60773e525cb65fcbc582ee0f2/rpds_py-0.28.0-cp313-cp313t-win32.whl", hash = "sha256:3aa4dc0fdab4a7029ac63959a3ccf4ed605fee048ba67ce89ca3168da34a1342", size = 205376, upload-time = "2025-10-22T22:23:13.979Z" }, - { url = "https://files.pythonhosted.org/packages/92/e4/15947bda33cbedfc134490a41841ab8870a72a867a03d4969d886f6594a2/rpds_py-0.28.0-cp313-cp313t-win_amd64.whl", hash = "sha256:7b7d9d83c942855e4fdcfa75d4f96f6b9e272d42fffcb72cd4bb2577db2e2907", size = 215907, upload-time = "2025-10-22T22:23:15.5Z" }, - { url = "https://files.pythonhosted.org/packages/08/47/ffe8cd7a6a02833b10623bf765fbb57ce977e9a4318ca0e8cf97e9c3d2b3/rpds_py-0.28.0-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:dcdcb890b3ada98a03f9f2bb108489cdc7580176cb73b4f2d789e9a1dac1d472", size = 353830, upload-time = "2025-10-22T22:23:17.03Z" }, - { url = "https://files.pythonhosted.org/packages/f9/9f/890f36cbd83a58491d0d91ae0db1702639edb33fb48eeb356f80ecc6b000/rpds_py-0.28.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:f274f56a926ba2dc02976ca5b11c32855cbd5925534e57cfe1fda64e04d1add2", size = 341819, upload-time = "2025-10-22T22:23:18.57Z" }, - { url = "https://files.pythonhosted.org/packages/09/e3/921eb109f682aa24fb76207698fbbcf9418738f35a40c21652c29053f23d/rpds_py-0.28.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4fe0438ac4a29a520ea94c8c7f1754cdd8feb1bc490dfda1bfd990072363d527", size = 373127, upload-time = "2025-10-22T22:23:20.216Z" }, - { url = "https://files.pythonhosted.org/packages/23/13/bce4384d9f8f4989f1a9599c71b7a2d877462e5fd7175e1f69b398f729f4/rpds_py-0.28.0-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8a358a32dd3ae50e933347889b6af9a1bdf207ba5d1a3f34e1a38cd3540e6733", size = 382767, upload-time = "2025-10-22T22:23:21.787Z" }, - { url = "https://files.pythonhosted.org/packages/23/e1/579512b2d89a77c64ccef5a0bc46a6ef7f72ae0cf03d4b26dcd52e57ee0a/rpds_py-0.28.0-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e80848a71c78aa328fefaba9c244d588a342c8e03bda518447b624ea64d1ff56", size = 517585, upload-time = "2025-10-22T22:23:23.699Z" }, - { url = "https://files.pythonhosted.org/packages/62/3c/ca704b8d324a2591b0b0adcfcaadf9c862375b11f2f667ac03c61b4fd0a6/rpds_py-0.28.0-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f586db2e209d54fe177e58e0bc4946bea5fb0102f150b1b2f13de03e1f0976f8", size = 399828, upload-time = "2025-10-22T22:23:25.713Z" }, - { url = "https://files.pythonhosted.org/packages/da/37/e84283b9e897e3adc46b4c88bb3f6ec92a43bd4d2f7ef5b13459963b2e9c/rpds_py-0.28.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5ae8ee156d6b586e4292491e885d41483136ab994e719a13458055bec14cf370", size = 375509, upload-time = "2025-10-22T22:23:27.32Z" }, - { url = "https://files.pythonhosted.org/packages/1a/c2/a980beab869d86258bf76ec42dec778ba98151f253a952b02fe36d72b29c/rpds_py-0.28.0-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:a805e9b3973f7e27f7cab63a6b4f61d90f2e5557cff73b6e97cd5b8540276d3d", size = 392014, upload-time = "2025-10-22T22:23:29.332Z" }, - { url = "https://files.pythonhosted.org/packages/da/b5/b1d3c5f9d3fa5aeef74265f9c64de3c34a0d6d5cd3c81c8b17d5c8f10ed4/rpds_py-0.28.0-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5d3fd16b6dc89c73a4da0b4ac8b12a7ecc75b2864b95c9e5afed8003cb50a728", size = 402410, upload-time = "2025-10-22T22:23:31.14Z" }, - { url = "https://files.pythonhosted.org/packages/74/ae/cab05ff08dfcc052afc73dcb38cbc765ffc86f94e966f3924cd17492293c/rpds_py-0.28.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:6796079e5d24fdaba6d49bda28e2c47347e89834678f2bc2c1b4fc1489c0fb01", size = 553593, upload-time = "2025-10-22T22:23:32.834Z" }, - { url = "https://files.pythonhosted.org/packages/70/80/50d5706ea2a9bfc9e9c5f401d91879e7c790c619969369800cde202da214/rpds_py-0.28.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:76500820c2af232435cbe215e3324c75b950a027134e044423f59f5b9a1ba515", size = 576925, upload-time = "2025-10-22T22:23:34.47Z" }, - { url = "https://files.pythonhosted.org/packages/ab/12/85a57d7a5855a3b188d024b099fd09c90db55d32a03626d0ed16352413ff/rpds_py-0.28.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:bbdc5640900a7dbf9dd707fe6388972f5bbd883633eb68b76591044cfe346f7e", size = 542444, upload-time = "2025-10-22T22:23:36.093Z" }, - { url = "https://files.pythonhosted.org/packages/6c/65/10643fb50179509150eb94d558e8837c57ca8b9adc04bd07b98e57b48f8c/rpds_py-0.28.0-cp314-cp314-win32.whl", hash = "sha256:adc8aa88486857d2b35d75f0640b949759f79dc105f50aa2c27816b2e0dd749f", size = 207968, upload-time = "2025-10-22T22:23:37.638Z" }, - { url = "https://files.pythonhosted.org/packages/b4/84/0c11fe4d9aaea784ff4652499e365963222481ac647bcd0251c88af646eb/rpds_py-0.28.0-cp314-cp314-win_amd64.whl", hash = "sha256:66e6fa8e075b58946e76a78e69e1a124a21d9a48a5b4766d15ba5b06869d1fa1", size = 218876, upload-time = "2025-10-22T22:23:39.179Z" }, - { url = "https://files.pythonhosted.org/packages/0f/e0/3ab3b86ded7bb18478392dc3e835f7b754cd446f62f3fc96f4fe2aca78f6/rpds_py-0.28.0-cp314-cp314-win_arm64.whl", hash = "sha256:a6fe887c2c5c59413353b7c0caff25d0e566623501ccfff88957fa438a69377d", size = 212506, upload-time = "2025-10-22T22:23:40.755Z" }, - { url = "https://files.pythonhosted.org/packages/51/ec/d5681bb425226c3501eab50fc30e9d275de20c131869322c8a1729c7b61c/rpds_py-0.28.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:7a69df082db13c7070f7b8b1f155fa9e687f1d6aefb7b0e3f7231653b79a067b", size = 355433, upload-time = "2025-10-22T22:23:42.259Z" }, - { url = "https://files.pythonhosted.org/packages/be/ec/568c5e689e1cfb1ea8b875cffea3649260955f677fdd7ddc6176902d04cd/rpds_py-0.28.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:b1cde22f2c30ebb049a9e74c5374994157b9b70a16147d332f89c99c5960737a", size = 342601, upload-time = "2025-10-22T22:23:44.372Z" }, - { url = "https://files.pythonhosted.org/packages/32/fe/51ada84d1d2a1d9d8f2c902cfddd0133b4a5eb543196ab5161d1c07ed2ad/rpds_py-0.28.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5338742f6ba7a51012ea470bd4dc600a8c713c0c72adaa0977a1b1f4327d6592", size = 372039, upload-time = "2025-10-22T22:23:46.025Z" }, - { url = "https://files.pythonhosted.org/packages/07/c1/60144a2f2620abade1a78e0d91b298ac2d9b91bc08864493fa00451ef06e/rpds_py-0.28.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e1460ebde1bcf6d496d80b191d854adedcc619f84ff17dc1c6d550f58c9efbba", size = 382407, upload-time = "2025-10-22T22:23:48.098Z" }, - { url = "https://files.pythonhosted.org/packages/45/ed/091a7bbdcf4038a60a461df50bc4c82a7ed6d5d5e27649aab61771c17585/rpds_py-0.28.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e3eb248f2feba84c692579257a043a7699e28a77d86c77b032c1d9fbb3f0219c", size = 518172, upload-time = "2025-10-22T22:23:50.16Z" }, - { url = "https://files.pythonhosted.org/packages/54/dd/02cc90c2fd9c2ef8016fd7813bfacd1c3a1325633ec8f244c47b449fc868/rpds_py-0.28.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd3bbba5def70b16cd1c1d7255666aad3b290fbf8d0fe7f9f91abafb73611a91", size = 399020, upload-time = "2025-10-22T22:23:51.81Z" }, - { url = "https://files.pythonhosted.org/packages/ab/81/5d98cc0329bbb911ccecd0b9e19fbf7f3a5de8094b4cda5e71013b2dd77e/rpds_py-0.28.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3114f4db69ac5a1f32e7e4d1cbbe7c8f9cf8217f78e6e002cedf2d54c2a548ed", size = 377451, upload-time = "2025-10-22T22:23:53.711Z" }, - { url = "https://files.pythonhosted.org/packages/b4/07/4d5bcd49e3dfed2d38e2dcb49ab6615f2ceb9f89f5a372c46dbdebb4e028/rpds_py-0.28.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:4b0cb8a906b1a0196b863d460c0222fb8ad0f34041568da5620f9799b83ccf0b", size = 390355, upload-time = "2025-10-22T22:23:55.299Z" }, - { url = "https://files.pythonhosted.org/packages/3f/79/9f14ba9010fee74e4f40bf578735cfcbb91d2e642ffd1abe429bb0b96364/rpds_py-0.28.0-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:cf681ac76a60b667106141e11a92a3330890257e6f559ca995fbb5265160b56e", size = 403146, upload-time = "2025-10-22T22:23:56.929Z" }, - { url = "https://files.pythonhosted.org/packages/39/4c/f08283a82ac141331a83a40652830edd3a4a92c34e07e2bbe00baaea2f5f/rpds_py-0.28.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:1e8ee6413cfc677ce8898d9cde18cc3a60fc2ba756b0dec5b71eb6eb21c49fa1", size = 552656, upload-time = "2025-10-22T22:23:58.62Z" }, - { url = "https://files.pythonhosted.org/packages/61/47/d922fc0666f0dd8e40c33990d055f4cc6ecff6f502c2d01569dbed830f9b/rpds_py-0.28.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:b3072b16904d0b5572a15eb9d31c1954e0d3227a585fc1351aa9878729099d6c", size = 576782, upload-time = "2025-10-22T22:24:00.312Z" }, - { url = "https://files.pythonhosted.org/packages/d3/0c/5bafdd8ccf6aa9d3bfc630cfece457ff5b581af24f46a9f3590f790e3df2/rpds_py-0.28.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:b670c30fd87a6aec281c3c9896d3bae4b205fd75d79d06dc87c2503717e46092", size = 544671, upload-time = "2025-10-22T22:24:02.297Z" }, - { url = "https://files.pythonhosted.org/packages/2c/37/dcc5d8397caa924988693519069d0beea077a866128719351a4ad95e82fc/rpds_py-0.28.0-cp314-cp314t-win32.whl", hash = "sha256:8014045a15b4d2b3476f0a287fcc93d4f823472d7d1308d47884ecac9e612be3", size = 205749, upload-time = "2025-10-22T22:24:03.848Z" }, - { url = "https://files.pythonhosted.org/packages/d7/69/64d43b21a10d72b45939a28961216baeb721cc2a430f5f7c3bfa21659a53/rpds_py-0.28.0-cp314-cp314t-win_amd64.whl", hash = "sha256:7a4e59c90d9c27c561eb3160323634a9ff50b04e4f7820600a2beb0ac90db578", size = 216233, upload-time = "2025-10-22T22:24:05.471Z" }, - { url = "https://files.pythonhosted.org/packages/ae/bc/b43f2ea505f28119bd551ae75f70be0c803d2dbcd37c1b3734909e40620b/rpds_py-0.28.0-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:f5e7101145427087e493b9c9b959da68d357c28c562792300dd21a095118ed16", size = 363913, upload-time = "2025-10-22T22:24:07.129Z" }, - { url = "https://files.pythonhosted.org/packages/28/f2/db318195d324c89a2c57dc5195058cbadd71b20d220685c5bd1da79ee7fe/rpds_py-0.28.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:31eb671150b9c62409a888850aaa8e6533635704fe2b78335f9aaf7ff81eec4d", size = 350452, upload-time = "2025-10-22T22:24:08.754Z" }, - { url = "https://files.pythonhosted.org/packages/ae/f2/1391c819b8573a4898cedd6b6c5ec5bc370ce59e5d6bdcebe3c9c1db4588/rpds_py-0.28.0-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:48b55c1f64482f7d8bd39942f376bfdf2f6aec637ee8c805b5041e14eeb771db", size = 380957, upload-time = "2025-10-22T22:24:10.826Z" }, - { url = "https://files.pythonhosted.org/packages/5a/5c/e5de68ee7eb7248fce93269833d1b329a196d736aefb1a7481d1e99d1222/rpds_py-0.28.0-pp311-pypy311_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:24743a7b372e9a76171f6b69c01aedf927e8ac3e16c474d9fe20d552a8cb45c7", size = 391919, upload-time = "2025-10-22T22:24:12.559Z" }, - { url = "https://files.pythonhosted.org/packages/fb/4f/2376336112cbfeb122fd435d608ad8d5041b3aed176f85a3cb32c262eb80/rpds_py-0.28.0-pp311-pypy311_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:389c29045ee8bbb1627ea190b4976a310a295559eaf9f1464a1a6f2bf84dde78", size = 528541, upload-time = "2025-10-22T22:24:14.197Z" }, - { url = "https://files.pythonhosted.org/packages/68/53/5ae232e795853dd20da7225c5dd13a09c0a905b1a655e92bdf8d78a99fd9/rpds_py-0.28.0-pp311-pypy311_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:23690b5827e643150cf7b49569679ec13fe9a610a15949ed48b85eb7f98f34ec", size = 405629, upload-time = "2025-10-22T22:24:16.001Z" }, - { url = "https://files.pythonhosted.org/packages/b9/2d/351a3b852b683ca9b6b8b38ed9efb2347596973849ba6c3a0e99877c10aa/rpds_py-0.28.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6f0c9266c26580e7243ad0d72fc3e01d6b33866cfab5084a6da7576bcf1c4f72", size = 384123, upload-time = "2025-10-22T22:24:17.585Z" }, - { url = "https://files.pythonhosted.org/packages/e0/15/870804daa00202728cc91cb8e2385fa9f1f4eb49857c49cfce89e304eae6/rpds_py-0.28.0-pp311-pypy311_pp73-manylinux_2_31_riscv64.whl", hash = "sha256:4c6c4db5d73d179746951486df97fd25e92396be07fc29ee8ff9a8f5afbdfb27", size = 400923, upload-time = "2025-10-22T22:24:19.512Z" }, - { url = "https://files.pythonhosted.org/packages/53/25/3706b83c125fa2a0bccceac951de3f76631f6bd0ee4d02a0ed780712ef1b/rpds_py-0.28.0-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a3b695a8fa799dd2cfdb4804b37096c5f6dba1ac7f48a7fbf6d0485bcd060316", size = 413767, upload-time = "2025-10-22T22:24:21.316Z" }, - { url = "https://files.pythonhosted.org/packages/ef/f9/ce43dbe62767432273ed2584cef71fef8411bddfb64125d4c19128015018/rpds_py-0.28.0-pp311-pypy311_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:6aa1bfce3f83baf00d9c5fcdbba93a3ab79958b4c7d7d1f55e7fe68c20e63912", size = 561530, upload-time = "2025-10-22T22:24:22.958Z" }, - { url = "https://files.pythonhosted.org/packages/46/c9/ffe77999ed8f81e30713dd38fd9ecaa161f28ec48bb80fa1cd9118399c27/rpds_py-0.28.0-pp311-pypy311_pp73-musllinux_1_2_i686.whl", hash = "sha256:7b0f9dceb221792b3ee6acb5438eb1f02b0cb2c247796a72b016dcc92c6de829", size = 585453, upload-time = "2025-10-22T22:24:24.779Z" }, - { url = "https://files.pythonhosted.org/packages/ed/d2/4a73b18821fd4669762c855fd1f4e80ceb66fb72d71162d14da58444a763/rpds_py-0.28.0-pp311-pypy311_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:5d0145edba8abd3db0ab22b5300c99dc152f5c9021fab861be0f0544dc3cbc5f", size = 552199, upload-time = "2025-10-22T22:24:26.54Z" }, + { url = "https://files.pythonhosted.org/packages/06/0c/0c411a0ec64ccb6d104dcabe0e713e05e153a9a2c3c2bd2b32ce412166fe/rpds_py-0.30.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:679ae98e00c0e8d68a7fda324e16b90fd5260945b45d3b824c892cec9eea3288", size = 370490, upload-time = "2025-11-30T20:21:33.256Z" }, + { url = "https://files.pythonhosted.org/packages/19/6a/4ba3d0fb7297ebae71171822554abe48d7cab29c28b8f9f2c04b79988c05/rpds_py-0.30.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4cc2206b76b4f576934f0ed374b10d7ca5f457858b157ca52064bdfc26b9fc00", size = 359751, upload-time = "2025-11-30T20:21:34.591Z" }, + { url = "https://files.pythonhosted.org/packages/cd/7c/e4933565ef7f7a0818985d87c15d9d273f1a649afa6a52ea35ad011195ea/rpds_py-0.30.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:389a2d49eded1896c3d48b0136ead37c48e221b391c052fba3f4055c367f60a6", size = 389696, upload-time = "2025-11-30T20:21:36.122Z" }, + { url = "https://files.pythonhosted.org/packages/5e/01/6271a2511ad0815f00f7ed4390cf2567bec1d4b1da39e2c27a41e6e3b4de/rpds_py-0.30.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:32c8528634e1bf7121f3de08fa85b138f4e0dc47657866630611b03967f041d7", size = 403136, upload-time = "2025-11-30T20:21:37.728Z" }, + { url = "https://files.pythonhosted.org/packages/55/64/c857eb7cd7541e9b4eee9d49c196e833128a55b89a9850a9c9ac33ccf897/rpds_py-0.30.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f207f69853edd6f6700b86efb84999651baf3789e78a466431df1331608e5324", size = 524699, upload-time = "2025-11-30T20:21:38.92Z" }, + { url = "https://files.pythonhosted.org/packages/9c/ed/94816543404078af9ab26159c44f9e98e20fe47e2126d5d32c9d9948d10a/rpds_py-0.30.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:67b02ec25ba7a9e8fa74c63b6ca44cf5707f2fbfadae3ee8e7494297d56aa9df", size = 412022, upload-time = "2025-11-30T20:21:40.407Z" }, + { url = "https://files.pythonhosted.org/packages/61/b5/707f6cf0066a6412aacc11d17920ea2e19e5b2f04081c64526eb35b5c6e7/rpds_py-0.30.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0c0e95f6819a19965ff420f65578bacb0b00f251fefe2c8b23347c37174271f3", size = 390522, upload-time = "2025-11-30T20:21:42.17Z" }, + { url = "https://files.pythonhosted.org/packages/13/4e/57a85fda37a229ff4226f8cbcf09f2a455d1ed20e802ce5b2b4a7f5ed053/rpds_py-0.30.0-cp310-cp310-manylinux_2_31_riscv64.whl", hash = "sha256:a452763cc5198f2f98898eb98f7569649fe5da666c2dc6b5ddb10fde5a574221", size = 404579, upload-time = "2025-11-30T20:21:43.769Z" }, + { url = "https://files.pythonhosted.org/packages/f9/da/c9339293513ec680a721e0e16bf2bac3db6e5d7e922488de471308349bba/rpds_py-0.30.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e0b65193a413ccc930671c55153a03ee57cecb49e6227204b04fae512eb657a7", size = 421305, upload-time = "2025-11-30T20:21:44.994Z" }, + { url = "https://files.pythonhosted.org/packages/f9/be/522cb84751114f4ad9d822ff5a1aa3c98006341895d5f084779b99596e5c/rpds_py-0.30.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:858738e9c32147f78b3ac24dc0edb6610000e56dc0f700fd5f651d0a0f0eb9ff", size = 572503, upload-time = "2025-11-30T20:21:46.91Z" }, + { url = "https://files.pythonhosted.org/packages/a2/9b/de879f7e7ceddc973ea6e4629e9b380213a6938a249e94b0cdbcc325bb66/rpds_py-0.30.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:da279aa314f00acbb803da1e76fa18666778e8a8f83484fba94526da5de2cba7", size = 598322, upload-time = "2025-11-30T20:21:48.709Z" }, + { url = "https://files.pythonhosted.org/packages/48/ac/f01fc22efec3f37d8a914fc1b2fb9bcafd56a299edbe96406f3053edea5a/rpds_py-0.30.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:7c64d38fb49b6cdeda16ab49e35fe0da2e1e9b34bc38bd78386530f218b37139", size = 560792, upload-time = "2025-11-30T20:21:50.024Z" }, + { url = "https://files.pythonhosted.org/packages/e2/da/4e2b19d0f131f35b6146425f846563d0ce036763e38913d917187307a671/rpds_py-0.30.0-cp310-cp310-win32.whl", hash = "sha256:6de2a32a1665b93233cde140ff8b3467bdb9e2af2b91079f0333a0974d12d464", size = 221901, upload-time = "2025-11-30T20:21:51.32Z" }, + { url = "https://files.pythonhosted.org/packages/96/cb/156d7a5cf4f78a7cc571465d8aec7a3c447c94f6749c5123f08438bcf7bc/rpds_py-0.30.0-cp310-cp310-win_amd64.whl", hash = "sha256:1726859cd0de969f88dc8673bdd954185b9104e05806be64bcd87badbe313169", size = 235823, upload-time = "2025-11-30T20:21:52.505Z" }, + { url = "https://files.pythonhosted.org/packages/4d/6e/f964e88b3d2abee2a82c1ac8366da848fce1c6d834dc2132c3fda3970290/rpds_py-0.30.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:a2bffea6a4ca9f01b3f8e548302470306689684e61602aa3d141e34da06cf425", size = 370157, upload-time = "2025-11-30T20:21:53.789Z" }, + { url = "https://files.pythonhosted.org/packages/94/ba/24e5ebb7c1c82e74c4e4f33b2112a5573ddc703915b13a073737b59b86e0/rpds_py-0.30.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dc4f992dfe1e2bc3ebc7444f6c7051b4bc13cd8e33e43511e8ffd13bf407010d", size = 359676, upload-time = "2025-11-30T20:21:55.475Z" }, + { url = "https://files.pythonhosted.org/packages/84/86/04dbba1b087227747d64d80c3b74df946b986c57af0a9f0c98726d4d7a3b/rpds_py-0.30.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:422c3cb9856d80b09d30d2eb255d0754b23e090034e1deb4083f8004bd0761e4", size = 389938, upload-time = "2025-11-30T20:21:57.079Z" }, + { url = "https://files.pythonhosted.org/packages/42/bb/1463f0b1722b7f45431bdd468301991d1328b16cffe0b1c2918eba2c4eee/rpds_py-0.30.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:07ae8a593e1c3c6b82ca3292efbe73c30b61332fd612e05abee07c79359f292f", size = 402932, upload-time = "2025-11-30T20:21:58.47Z" }, + { url = "https://files.pythonhosted.org/packages/99/ee/2520700a5c1f2d76631f948b0736cdf9b0acb25abd0ca8e889b5c62ac2e3/rpds_py-0.30.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:12f90dd7557b6bd57f40abe7747e81e0c0b119bef015ea7726e69fe550e394a4", size = 525830, upload-time = "2025-11-30T20:21:59.699Z" }, + { url = "https://files.pythonhosted.org/packages/e0/ad/bd0331f740f5705cc555a5e17fdf334671262160270962e69a2bdef3bf76/rpds_py-0.30.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:99b47d6ad9a6da00bec6aabe5a6279ecd3c06a329d4aa4771034a21e335c3a97", size = 412033, upload-time = "2025-11-30T20:22:00.991Z" }, + { url = "https://files.pythonhosted.org/packages/f8/1e/372195d326549bb51f0ba0f2ecb9874579906b97e08880e7a65c3bef1a99/rpds_py-0.30.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:33f559f3104504506a44bb666b93a33f5d33133765b0c216a5bf2f1e1503af89", size = 390828, upload-time = "2025-11-30T20:22:02.723Z" }, + { url = "https://files.pythonhosted.org/packages/ab/2b/d88bb33294e3e0c76bc8f351a3721212713629ffca1700fa94979cb3eae8/rpds_py-0.30.0-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:946fe926af6e44f3697abbc305ea168c2c31d3e3ef1058cf68f379bf0335a78d", size = 404683, upload-time = "2025-11-30T20:22:04.367Z" }, + { url = "https://files.pythonhosted.org/packages/50/32/c759a8d42bcb5289c1fac697cd92f6fe01a018dd937e62ae77e0e7f15702/rpds_py-0.30.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:495aeca4b93d465efde585977365187149e75383ad2684f81519f504f5c13038", size = 421583, upload-time = "2025-11-30T20:22:05.814Z" }, + { url = "https://files.pythonhosted.org/packages/2b/81/e729761dbd55ddf5d84ec4ff1f47857f4374b0f19bdabfcf929164da3e24/rpds_py-0.30.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d9a0ca5da0386dee0655b4ccdf46119df60e0f10da268d04fe7cc87886872ba7", size = 572496, upload-time = "2025-11-30T20:22:07.713Z" }, + { url = "https://files.pythonhosted.org/packages/14/f6/69066a924c3557c9c30baa6ec3a0aa07526305684c6f86c696b08860726c/rpds_py-0.30.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8d6d1cc13664ec13c1b84241204ff3b12f9bb82464b8ad6e7a5d3486975c2eed", size = 598669, upload-time = "2025-11-30T20:22:09.312Z" }, + { url = "https://files.pythonhosted.org/packages/5f/48/905896b1eb8a05630d20333d1d8ffd162394127b74ce0b0784ae04498d32/rpds_py-0.30.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3896fa1be39912cf0757753826bc8bdc8ca331a28a7c4ae46b7a21280b06bb85", size = 561011, upload-time = "2025-11-30T20:22:11.309Z" }, + { url = "https://files.pythonhosted.org/packages/22/16/cd3027c7e279d22e5eb431dd3c0fbc677bed58797fe7581e148f3f68818b/rpds_py-0.30.0-cp311-cp311-win32.whl", hash = "sha256:55f66022632205940f1827effeff17c4fa7ae1953d2b74a8581baaefb7d16f8c", size = 221406, upload-time = "2025-11-30T20:22:13.101Z" }, + { url = "https://files.pythonhosted.org/packages/fa/5b/e7b7aa136f28462b344e652ee010d4de26ee9fd16f1bfd5811f5153ccf89/rpds_py-0.30.0-cp311-cp311-win_amd64.whl", hash = "sha256:a51033ff701fca756439d641c0ad09a41d9242fa69121c7d8769604a0a629825", size = 236024, upload-time = "2025-11-30T20:22:14.853Z" }, + { url = "https://files.pythonhosted.org/packages/14/a6/364bba985e4c13658edb156640608f2c9e1d3ea3c81b27aa9d889fff0e31/rpds_py-0.30.0-cp311-cp311-win_arm64.whl", hash = "sha256:47b0ef6231c58f506ef0b74d44e330405caa8428e770fec25329ed2cb971a229", size = 229069, upload-time = "2025-11-30T20:22:16.577Z" }, + { url = "https://files.pythonhosted.org/packages/03/e7/98a2f4ac921d82f33e03f3835f5bf3a4a40aa1bfdc57975e74a97b2b4bdd/rpds_py-0.30.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:a161f20d9a43006833cd7068375a94d035714d73a172b681d8881820600abfad", size = 375086, upload-time = "2025-11-30T20:22:17.93Z" }, + { url = "https://files.pythonhosted.org/packages/4d/a1/bca7fd3d452b272e13335db8d6b0b3ecde0f90ad6f16f3328c6fb150c889/rpds_py-0.30.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6abc8880d9d036ecaafe709079969f56e876fcf107f7a8e9920ba6d5a3878d05", size = 359053, upload-time = "2025-11-30T20:22:19.297Z" }, + { url = "https://files.pythonhosted.org/packages/65/1c/ae157e83a6357eceff62ba7e52113e3ec4834a84cfe07fa4b0757a7d105f/rpds_py-0.30.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca28829ae5f5d569bb62a79512c842a03a12576375d5ece7d2cadf8abe96ec28", size = 390763, upload-time = "2025-11-30T20:22:21.661Z" }, + { url = "https://files.pythonhosted.org/packages/d4/36/eb2eb8515e2ad24c0bd43c3ee9cd74c33f7ca6430755ccdb240fd3144c44/rpds_py-0.30.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a1010ed9524c73b94d15919ca4d41d8780980e1765babf85f9a2f90d247153dd", size = 408951, upload-time = "2025-11-30T20:22:23.408Z" }, + { url = "https://files.pythonhosted.org/packages/d6/65/ad8dc1784a331fabbd740ef6f71ce2198c7ed0890dab595adb9ea2d775a1/rpds_py-0.30.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f8d1736cfb49381ba528cd5baa46f82fdc65c06e843dab24dd70b63d09121b3f", size = 514622, upload-time = "2025-11-30T20:22:25.16Z" }, + { url = "https://files.pythonhosted.org/packages/63/8e/0cfa7ae158e15e143fe03993b5bcd743a59f541f5952e1546b1ac1b5fd45/rpds_py-0.30.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d948b135c4693daff7bc2dcfc4ec57237a29bd37e60c2fabf5aff2bbacf3e2f1", size = 414492, upload-time = "2025-11-30T20:22:26.505Z" }, + { url = "https://files.pythonhosted.org/packages/60/1b/6f8f29f3f995c7ffdde46a626ddccd7c63aefc0efae881dc13b6e5d5bb16/rpds_py-0.30.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47f236970bccb2233267d89173d3ad2703cd36a0e2a6e92d0560d333871a3d23", size = 394080, upload-time = "2025-11-30T20:22:27.934Z" }, + { url = "https://files.pythonhosted.org/packages/6d/d5/a266341051a7a3ca2f4b750a3aa4abc986378431fc2da508c5034d081b70/rpds_py-0.30.0-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:2e6ecb5a5bcacf59c3f912155044479af1d0b6681280048b338b28e364aca1f6", size = 408680, upload-time = "2025-11-30T20:22:29.341Z" }, + { url = "https://files.pythonhosted.org/packages/10/3b/71b725851df9ab7a7a4e33cf36d241933da66040d195a84781f49c50490c/rpds_py-0.30.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a8fa71a2e078c527c3e9dc9fc5a98c9db40bcc8a92b4e8858e36d329f8684b51", size = 423589, upload-time = "2025-11-30T20:22:31.469Z" }, + { url = "https://files.pythonhosted.org/packages/00/2b/e59e58c544dc9bd8bd8384ecdb8ea91f6727f0e37a7131baeff8d6f51661/rpds_py-0.30.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:73c67f2db7bc334e518d097c6d1e6fed021bbc9b7d678d6cc433478365d1d5f5", size = 573289, upload-time = "2025-11-30T20:22:32.997Z" }, + { url = "https://files.pythonhosted.org/packages/da/3e/a18e6f5b460893172a7d6a680e86d3b6bc87a54c1f0b03446a3c8c7b588f/rpds_py-0.30.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:5ba103fb455be00f3b1c2076c9d4264bfcb037c976167a6047ed82f23153f02e", size = 599737, upload-time = "2025-11-30T20:22:34.419Z" }, + { url = "https://files.pythonhosted.org/packages/5c/e2/714694e4b87b85a18e2c243614974413c60aa107fd815b8cbc42b873d1d7/rpds_py-0.30.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7cee9c752c0364588353e627da8a7e808a66873672bcb5f52890c33fd965b394", size = 563120, upload-time = "2025-11-30T20:22:35.903Z" }, + { url = "https://files.pythonhosted.org/packages/6f/ab/d5d5e3bcedb0a77f4f613706b750e50a5a3ba1c15ccd3665ecc636c968fd/rpds_py-0.30.0-cp312-cp312-win32.whl", hash = "sha256:1ab5b83dbcf55acc8b08fc62b796ef672c457b17dbd7820a11d6c52c06839bdf", size = 223782, upload-time = "2025-11-30T20:22:37.271Z" }, + { url = "https://files.pythonhosted.org/packages/39/3b/f786af9957306fdc38a74cef405b7b93180f481fb48453a114bb6465744a/rpds_py-0.30.0-cp312-cp312-win_amd64.whl", hash = "sha256:a090322ca841abd453d43456ac34db46e8b05fd9b3b4ac0c78bcde8b089f959b", size = 240463, upload-time = "2025-11-30T20:22:39.021Z" }, + { url = "https://files.pythonhosted.org/packages/f3/d2/b91dc748126c1559042cfe41990deb92c4ee3e2b415f6b5234969ffaf0cc/rpds_py-0.30.0-cp312-cp312-win_arm64.whl", hash = "sha256:669b1805bd639dd2989b281be2cfd951c6121b65e729d9b843e9639ef1fd555e", size = 230868, upload-time = "2025-11-30T20:22:40.493Z" }, + { url = "https://files.pythonhosted.org/packages/ed/dc/d61221eb88ff410de3c49143407f6f3147acf2538c86f2ab7ce65ae7d5f9/rpds_py-0.30.0-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:f83424d738204d9770830d35290ff3273fbb02b41f919870479fab14b9d303b2", size = 374887, upload-time = "2025-11-30T20:22:41.812Z" }, + { url = "https://files.pythonhosted.org/packages/fd/32/55fb50ae104061dbc564ef15cc43c013dc4a9f4527a1f4d99baddf56fe5f/rpds_py-0.30.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:e7536cd91353c5273434b4e003cbda89034d67e7710eab8761fd918ec6c69cf8", size = 358904, upload-time = "2025-11-30T20:22:43.479Z" }, + { url = "https://files.pythonhosted.org/packages/58/70/faed8186300e3b9bdd138d0273109784eea2396c68458ed580f885dfe7ad/rpds_py-0.30.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2771c6c15973347f50fece41fc447c054b7ac2ae0502388ce3b6738cd366e3d4", size = 389945, upload-time = "2025-11-30T20:22:44.819Z" }, + { url = "https://files.pythonhosted.org/packages/bd/a8/073cac3ed2c6387df38f71296d002ab43496a96b92c823e76f46b8af0543/rpds_py-0.30.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:0a59119fc6e3f460315fe9d08149f8102aa322299deaa5cab5b40092345c2136", size = 407783, upload-time = "2025-11-30T20:22:46.103Z" }, + { url = "https://files.pythonhosted.org/packages/77/57/5999eb8c58671f1c11eba084115e77a8899d6e694d2a18f69f0ba471ec8b/rpds_py-0.30.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:76fec018282b4ead0364022e3c54b60bf368b9d926877957a8624b58419169b7", size = 515021, upload-time = "2025-11-30T20:22:47.458Z" }, + { url = "https://files.pythonhosted.org/packages/e0/af/5ab4833eadc36c0a8ed2bc5c0de0493c04f6c06de223170bd0798ff98ced/rpds_py-0.30.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:692bef75a5525db97318e8cd061542b5a79812d711ea03dbc1f6f8dbb0c5f0d2", size = 414589, upload-time = "2025-11-30T20:22:48.872Z" }, + { url = "https://files.pythonhosted.org/packages/b7/de/f7192e12b21b9e9a68a6d0f249b4af3fdcdff8418be0767a627564afa1f1/rpds_py-0.30.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9027da1ce107104c50c81383cae773ef5c24d296dd11c99e2629dbd7967a20c6", size = 394025, upload-time = "2025-11-30T20:22:50.196Z" }, + { url = "https://files.pythonhosted.org/packages/91/c4/fc70cd0249496493500e7cc2de87504f5aa6509de1e88623431fec76d4b6/rpds_py-0.30.0-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:9cf69cdda1f5968a30a359aba2f7f9aa648a9ce4b580d6826437f2b291cfc86e", size = 408895, upload-time = "2025-11-30T20:22:51.87Z" }, + { url = "https://files.pythonhosted.org/packages/58/95/d9275b05ab96556fefff73a385813eb66032e4c99f411d0795372d9abcea/rpds_py-0.30.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a4796a717bf12b9da9d3ad002519a86063dcac8988b030e405704ef7d74d2d9d", size = 422799, upload-time = "2025-11-30T20:22:53.341Z" }, + { url = "https://files.pythonhosted.org/packages/06/c1/3088fc04b6624eb12a57eb814f0d4997a44b0d208d6cace713033ff1a6ba/rpds_py-0.30.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5d4c2aa7c50ad4728a094ebd5eb46c452e9cb7edbfdb18f9e1221f597a73e1e7", size = 572731, upload-time = "2025-11-30T20:22:54.778Z" }, + { url = "https://files.pythonhosted.org/packages/d8/42/c612a833183b39774e8ac8fecae81263a68b9583ee343db33ab571a7ce55/rpds_py-0.30.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ba81a9203d07805435eb06f536d95a266c21e5b2dfbf6517748ca40c98d19e31", size = 599027, upload-time = "2025-11-30T20:22:56.212Z" }, + { url = "https://files.pythonhosted.org/packages/5f/60/525a50f45b01d70005403ae0e25f43c0384369ad24ffe46e8d9068b50086/rpds_py-0.30.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:945dccface01af02675628334f7cf49c2af4c1c904748efc5cf7bbdf0b579f95", size = 563020, upload-time = "2025-11-30T20:22:58.2Z" }, + { url = "https://files.pythonhosted.org/packages/0b/5d/47c4655e9bcd5ca907148535c10e7d489044243cc9941c16ed7cd53be91d/rpds_py-0.30.0-cp313-cp313-win32.whl", hash = "sha256:b40fb160a2db369a194cb27943582b38f79fc4887291417685f3ad693c5a1d5d", size = 223139, upload-time = "2025-11-30T20:23:00.209Z" }, + { url = "https://files.pythonhosted.org/packages/f2/e1/485132437d20aa4d3e1d8b3fb5a5e65aa8139f1e097080c2a8443201742c/rpds_py-0.30.0-cp313-cp313-win_amd64.whl", hash = "sha256:806f36b1b605e2d6a72716f321f20036b9489d29c51c91f4dd29a3e3afb73b15", size = 240224, upload-time = "2025-11-30T20:23:02.008Z" }, + { url = "https://files.pythonhosted.org/packages/24/95/ffd128ed1146a153d928617b0ef673960130be0009c77d8fbf0abe306713/rpds_py-0.30.0-cp313-cp313-win_arm64.whl", hash = "sha256:d96c2086587c7c30d44f31f42eae4eac89b60dabbac18c7669be3700f13c3ce1", size = 230645, upload-time = "2025-11-30T20:23:03.43Z" }, + { url = "https://files.pythonhosted.org/packages/ff/1b/b10de890a0def2a319a2626334a7f0ae388215eb60914dbac8a3bae54435/rpds_py-0.30.0-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:eb0b93f2e5c2189ee831ee43f156ed34e2a89a78a66b98cadad955972548be5a", size = 364443, upload-time = "2025-11-30T20:23:04.878Z" }, + { url = "https://files.pythonhosted.org/packages/0d/bf/27e39f5971dc4f305a4fb9c672ca06f290f7c4e261c568f3dea16a410d47/rpds_py-0.30.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:922e10f31f303c7c920da8981051ff6d8c1a56207dbdf330d9047f6d30b70e5e", size = 353375, upload-time = "2025-11-30T20:23:06.342Z" }, + { url = "https://files.pythonhosted.org/packages/40/58/442ada3bba6e8e6615fc00483135c14a7538d2ffac30e2d933ccf6852232/rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cdc62c8286ba9bf7f47befdcea13ea0e26bf294bda99758fd90535cbaf408000", size = 383850, upload-time = "2025-11-30T20:23:07.825Z" }, + { url = "https://files.pythonhosted.org/packages/14/14/f59b0127409a33c6ef6f5c1ebd5ad8e32d7861c9c7adfa9a624fc3889f6c/rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:47f9a91efc418b54fb8190a6b4aa7813a23fb79c51f4bb84e418f5476c38b8db", size = 392812, upload-time = "2025-11-30T20:23:09.228Z" }, + { url = "https://files.pythonhosted.org/packages/b3/66/e0be3e162ac299b3a22527e8913767d869e6cc75c46bd844aa43fb81ab62/rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1f3587eb9b17f3789ad50824084fa6f81921bbf9a795826570bda82cb3ed91f2", size = 517841, upload-time = "2025-11-30T20:23:11.186Z" }, + { url = "https://files.pythonhosted.org/packages/3d/55/fa3b9cf31d0c963ecf1ba777f7cf4b2a2c976795ac430d24a1f43d25a6ba/rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:39c02563fc592411c2c61d26b6c5fe1e51eaa44a75aa2c8735ca88b0d9599daa", size = 408149, upload-time = "2025-11-30T20:23:12.864Z" }, + { url = "https://files.pythonhosted.org/packages/60/ca/780cf3b1a32b18c0f05c441958d3758f02544f1d613abf9488cd78876378/rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:51a1234d8febafdfd33a42d97da7a43f5dcb120c1060e352a3fbc0c6d36e2083", size = 383843, upload-time = "2025-11-30T20:23:14.638Z" }, + { url = "https://files.pythonhosted.org/packages/82/86/d5f2e04f2aa6247c613da0c1dd87fcd08fa17107e858193566048a1e2f0a/rpds_py-0.30.0-cp313-cp313t-manylinux_2_31_riscv64.whl", hash = "sha256:eb2c4071ab598733724c08221091e8d80e89064cd472819285a9ab0f24bcedb9", size = 396507, upload-time = "2025-11-30T20:23:16.105Z" }, + { url = "https://files.pythonhosted.org/packages/4b/9a/453255d2f769fe44e07ea9785c8347edaf867f7026872e76c1ad9f7bed92/rpds_py-0.30.0-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6bdfdb946967d816e6adf9a3d8201bfad269c67efe6cefd7093ef959683c8de0", size = 414949, upload-time = "2025-11-30T20:23:17.539Z" }, + { url = "https://files.pythonhosted.org/packages/a3/31/622a86cdc0c45d6df0e9ccb6becdba5074735e7033c20e401a6d9d0e2ca0/rpds_py-0.30.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:c77afbd5f5250bf27bf516c7c4a016813eb2d3e116139aed0096940c5982da94", size = 565790, upload-time = "2025-11-30T20:23:19.029Z" }, + { url = "https://files.pythonhosted.org/packages/1c/5d/15bbf0fb4a3f58a3b1c67855ec1efcc4ceaef4e86644665fff03e1b66d8d/rpds_py-0.30.0-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:61046904275472a76c8c90c9ccee9013d70a6d0f73eecefd38c1ae7c39045a08", size = 590217, upload-time = "2025-11-30T20:23:20.885Z" }, + { url = "https://files.pythonhosted.org/packages/6d/61/21b8c41f68e60c8cc3b2e25644f0e3681926020f11d06ab0b78e3c6bbff1/rpds_py-0.30.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:4c5f36a861bc4b7da6516dbdf302c55313afa09b81931e8280361a4f6c9a2d27", size = 555806, upload-time = "2025-11-30T20:23:22.488Z" }, + { url = "https://files.pythonhosted.org/packages/f9/39/7e067bb06c31de48de3eb200f9fc7c58982a4d3db44b07e73963e10d3be9/rpds_py-0.30.0-cp313-cp313t-win32.whl", hash = "sha256:3d4a69de7a3e50ffc214ae16d79d8fbb0922972da0356dcf4d0fdca2878559c6", size = 211341, upload-time = "2025-11-30T20:23:24.449Z" }, + { url = "https://files.pythonhosted.org/packages/0a/4d/222ef0b46443cf4cf46764d9c630f3fe4abaa7245be9417e56e9f52b8f65/rpds_py-0.30.0-cp313-cp313t-win_amd64.whl", hash = "sha256:f14fc5df50a716f7ece6a80b6c78bb35ea2ca47c499e422aa4463455dd96d56d", size = 225768, upload-time = "2025-11-30T20:23:25.908Z" }, + { url = "https://files.pythonhosted.org/packages/86/81/dad16382ebbd3d0e0328776d8fd7ca94220e4fa0798d1dc5e7da48cb3201/rpds_py-0.30.0-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:68f19c879420aa08f61203801423f6cd5ac5f0ac4ac82a2368a9fcd6a9a075e0", size = 362099, upload-time = "2025-11-30T20:23:27.316Z" }, + { url = "https://files.pythonhosted.org/packages/2b/60/19f7884db5d5603edf3c6bce35408f45ad3e97e10007df0e17dd57af18f8/rpds_py-0.30.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:ec7c4490c672c1a0389d319b3a9cfcd098dcdc4783991553c332a15acf7249be", size = 353192, upload-time = "2025-11-30T20:23:29.151Z" }, + { url = "https://files.pythonhosted.org/packages/bf/c4/76eb0e1e72d1a9c4703c69607cec123c29028bff28ce41588792417098ac/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f251c812357a3fed308d684a5079ddfb9d933860fc6de89f2b7ab00da481e65f", size = 384080, upload-time = "2025-11-30T20:23:30.785Z" }, + { url = "https://files.pythonhosted.org/packages/72/87/87ea665e92f3298d1b26d78814721dc39ed8d2c74b86e83348d6b48a6f31/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ac98b175585ecf4c0348fd7b29c3864bda53b805c773cbf7bfdaffc8070c976f", size = 394841, upload-time = "2025-11-30T20:23:32.209Z" }, + { url = "https://files.pythonhosted.org/packages/77/ad/7783a89ca0587c15dcbf139b4a8364a872a25f861bdb88ed99f9b0dec985/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3e62880792319dbeb7eb866547f2e35973289e7d5696c6e295476448f5b63c87", size = 516670, upload-time = "2025-11-30T20:23:33.742Z" }, + { url = "https://files.pythonhosted.org/packages/5b/3c/2882bdac942bd2172f3da574eab16f309ae10a3925644e969536553cb4ee/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4e7fc54e0900ab35d041b0601431b0a0eb495f0851a0639b6ef90f7741b39a18", size = 408005, upload-time = "2025-11-30T20:23:35.253Z" }, + { url = "https://files.pythonhosted.org/packages/ce/81/9a91c0111ce1758c92516a3e44776920b579d9a7c09b2b06b642d4de3f0f/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47e77dc9822d3ad616c3d5759ea5631a75e5809d5a28707744ef79d7a1bcfcad", size = 382112, upload-time = "2025-11-30T20:23:36.842Z" }, + { url = "https://files.pythonhosted.org/packages/cf/8e/1da49d4a107027e5fbc64daeab96a0706361a2918da10cb41769244b805d/rpds_py-0.30.0-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:b4dc1a6ff022ff85ecafef7979a2c6eb423430e05f1165d6688234e62ba99a07", size = 399049, upload-time = "2025-11-30T20:23:38.343Z" }, + { url = "https://files.pythonhosted.org/packages/df/5a/7ee239b1aa48a127570ec03becbb29c9d5a9eb092febbd1699d567cae859/rpds_py-0.30.0-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4559c972db3a360808309e06a74628b95eaccbf961c335c8fe0d590cf587456f", size = 415661, upload-time = "2025-11-30T20:23:40.263Z" }, + { url = "https://files.pythonhosted.org/packages/70/ea/caa143cf6b772f823bc7929a45da1fa83569ee49b11d18d0ada7f5ee6fd6/rpds_py-0.30.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:0ed177ed9bded28f8deb6ab40c183cd1192aa0de40c12f38be4d59cd33cb5c65", size = 565606, upload-time = "2025-11-30T20:23:42.186Z" }, + { url = "https://files.pythonhosted.org/packages/64/91/ac20ba2d69303f961ad8cf55bf7dbdb4763f627291ba3d0d7d67333cced9/rpds_py-0.30.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:ad1fa8db769b76ea911cb4e10f049d80bf518c104f15b3edb2371cc65375c46f", size = 591126, upload-time = "2025-11-30T20:23:44.086Z" }, + { url = "https://files.pythonhosted.org/packages/21/20/7ff5f3c8b00c8a95f75985128c26ba44503fb35b8e0259d812766ea966c7/rpds_py-0.30.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:46e83c697b1f1c72b50e5ee5adb4353eef7406fb3f2043d64c33f20ad1c2fc53", size = 553371, upload-time = "2025-11-30T20:23:46.004Z" }, + { url = "https://files.pythonhosted.org/packages/72/c7/81dadd7b27c8ee391c132a6b192111ca58d866577ce2d9b0ca157552cce0/rpds_py-0.30.0-cp314-cp314-win32.whl", hash = "sha256:ee454b2a007d57363c2dfd5b6ca4a5d7e2c518938f8ed3b706e37e5d470801ed", size = 215298, upload-time = "2025-11-30T20:23:47.696Z" }, + { url = "https://files.pythonhosted.org/packages/3e/d2/1aaac33287e8cfb07aab2e6b8ac1deca62f6f65411344f1433c55e6f3eb8/rpds_py-0.30.0-cp314-cp314-win_amd64.whl", hash = "sha256:95f0802447ac2d10bcc69f6dc28fe95fdf17940367b21d34e34c737870758950", size = 228604, upload-time = "2025-11-30T20:23:49.501Z" }, + { url = "https://files.pythonhosted.org/packages/e8/95/ab005315818cc519ad074cb7784dae60d939163108bd2b394e60dc7b5461/rpds_py-0.30.0-cp314-cp314-win_arm64.whl", hash = "sha256:613aa4771c99f03346e54c3f038e4cc574ac09a3ddfb0e8878487335e96dead6", size = 222391, upload-time = "2025-11-30T20:23:50.96Z" }, + { url = "https://files.pythonhosted.org/packages/9e/68/154fe0194d83b973cdedcdcc88947a2752411165930182ae41d983dcefa6/rpds_py-0.30.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:7e6ecfcb62edfd632e56983964e6884851786443739dbfe3582947e87274f7cb", size = 364868, upload-time = "2025-11-30T20:23:52.494Z" }, + { url = "https://files.pythonhosted.org/packages/83/69/8bbc8b07ec854d92a8b75668c24d2abcb1719ebf890f5604c61c9369a16f/rpds_py-0.30.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:a1d0bc22a7cdc173fedebb73ef81e07faef93692b8c1ad3733b67e31e1b6e1b8", size = 353747, upload-time = "2025-11-30T20:23:54.036Z" }, + { url = "https://files.pythonhosted.org/packages/ab/00/ba2e50183dbd9abcce9497fa5149c62b4ff3e22d338a30d690f9af970561/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d08f00679177226c4cb8c5265012eea897c8ca3b93f429e546600c971bcbae7", size = 383795, upload-time = "2025-11-30T20:23:55.556Z" }, + { url = "https://files.pythonhosted.org/packages/05/6f/86f0272b84926bcb0e4c972262f54223e8ecc556b3224d281e6598fc9268/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5965af57d5848192c13534f90f9dd16464f3c37aaf166cc1da1cae1fd5a34898", size = 393330, upload-time = "2025-11-30T20:23:57.033Z" }, + { url = "https://files.pythonhosted.org/packages/cb/e9/0e02bb2e6dc63d212641da45df2b0bf29699d01715913e0d0f017ee29438/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9a4e86e34e9ab6b667c27f3211ca48f73dba7cd3d90f8d5b11be56e5dbc3fb4e", size = 518194, upload-time = "2025-11-30T20:23:58.637Z" }, + { url = "https://files.pythonhosted.org/packages/ee/ca/be7bca14cf21513bdf9c0606aba17d1f389ea2b6987035eb4f62bd923f25/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e5d3e6b26f2c785d65cc25ef1e5267ccbe1b069c5c21b8cc724efee290554419", size = 408340, upload-time = "2025-11-30T20:24:00.2Z" }, + { url = "https://files.pythonhosted.org/packages/c2/c7/736e00ebf39ed81d75544c0da6ef7b0998f8201b369acf842f9a90dc8fce/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:626a7433c34566535b6e56a1b39a7b17ba961e97ce3b80ec62e6f1312c025551", size = 383765, upload-time = "2025-11-30T20:24:01.759Z" }, + { url = "https://files.pythonhosted.org/packages/4a/3f/da50dfde9956aaf365c4adc9533b100008ed31aea635f2b8d7b627e25b49/rpds_py-0.30.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:acd7eb3f4471577b9b5a41baf02a978e8bdeb08b4b355273994f8b87032000a8", size = 396834, upload-time = "2025-11-30T20:24:03.687Z" }, + { url = "https://files.pythonhosted.org/packages/4e/00/34bcc2565b6020eab2623349efbdec810676ad571995911f1abdae62a3a0/rpds_py-0.30.0-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:fe5fa731a1fa8a0a56b0977413f8cacac1768dad38d16b3a296712709476fbd5", size = 415470, upload-time = "2025-11-30T20:24:05.232Z" }, + { url = "https://files.pythonhosted.org/packages/8c/28/882e72b5b3e6f718d5453bd4d0d9cf8df36fddeb4ddbbab17869d5868616/rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:74a3243a411126362712ee1524dfc90c650a503502f135d54d1b352bd01f2404", size = 565630, upload-time = "2025-11-30T20:24:06.878Z" }, + { url = "https://files.pythonhosted.org/packages/3b/97/04a65539c17692de5b85c6e293520fd01317fd878ea1995f0367d4532fb1/rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:3e8eeb0544f2eb0d2581774be4c3410356eba189529a6b3e36bbbf9696175856", size = 591148, upload-time = "2025-11-30T20:24:08.445Z" }, + { url = "https://files.pythonhosted.org/packages/85/70/92482ccffb96f5441aab93e26c4d66489eb599efdcf96fad90c14bbfb976/rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:dbd936cde57abfee19ab3213cf9c26be06d60750e60a8e4dd85d1ab12c8b1f40", size = 556030, upload-time = "2025-11-30T20:24:10.956Z" }, + { url = "https://files.pythonhosted.org/packages/20/53/7c7e784abfa500a2b6b583b147ee4bb5a2b3747a9166bab52fec4b5b5e7d/rpds_py-0.30.0-cp314-cp314t-win32.whl", hash = "sha256:dc824125c72246d924f7f796b4f63c1e9dc810c7d9e2355864b3c3a73d59ade0", size = 211570, upload-time = "2025-11-30T20:24:12.735Z" }, + { url = "https://files.pythonhosted.org/packages/d0/02/fa464cdfbe6b26e0600b62c528b72d8608f5cc49f96b8d6e38c95d60c676/rpds_py-0.30.0-cp314-cp314t-win_amd64.whl", hash = "sha256:27f4b0e92de5bfbc6f86e43959e6edd1425c33b5e69aab0984a72047f2bcf1e3", size = 226532, upload-time = "2025-11-30T20:24:14.634Z" }, + { url = "https://files.pythonhosted.org/packages/69/71/3f34339ee70521864411f8b6992e7ab13ac30d8e4e3309e07c7361767d91/rpds_py-0.30.0-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:c2262bdba0ad4fc6fb5545660673925c2d2a5d9e2e0fb603aad545427be0fc58", size = 372292, upload-time = "2025-11-30T20:24:16.537Z" }, + { url = "https://files.pythonhosted.org/packages/57/09/f183df9b8f2d66720d2ef71075c59f7e1b336bec7ee4c48f0a2b06857653/rpds_py-0.30.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:ee6af14263f25eedc3bb918a3c04245106a42dfd4f5c2285ea6f997b1fc3f89a", size = 362128, upload-time = "2025-11-30T20:24:18.086Z" }, + { url = "https://files.pythonhosted.org/packages/7a/68/5c2594e937253457342e078f0cc1ded3dd7b2ad59afdbf2d354869110a02/rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3adbb8179ce342d235c31ab8ec511e66c73faa27a47e076ccc92421add53e2bb", size = 391542, upload-time = "2025-11-30T20:24:20.092Z" }, + { url = "https://files.pythonhosted.org/packages/49/5c/31ef1afd70b4b4fbdb2800249f34c57c64beb687495b10aec0365f53dfc4/rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:250fa00e9543ac9b97ac258bd37367ff5256666122c2d0f2bc97577c60a1818c", size = 404004, upload-time = "2025-11-30T20:24:22.231Z" }, + { url = "https://files.pythonhosted.org/packages/e3/63/0cfbea38d05756f3440ce6534d51a491d26176ac045e2707adc99bb6e60a/rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9854cf4f488b3d57b9aaeb105f06d78e5529d3145b1e4a41750167e8c213c6d3", size = 527063, upload-time = "2025-11-30T20:24:24.302Z" }, + { url = "https://files.pythonhosted.org/packages/42/e6/01e1f72a2456678b0f618fc9a1a13f882061690893c192fcad9f2926553a/rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:993914b8e560023bc0a8bf742c5f303551992dcb85e247b1e5c7f4a7d145bda5", size = 413099, upload-time = "2025-11-30T20:24:25.916Z" }, + { url = "https://files.pythonhosted.org/packages/b8/25/8df56677f209003dcbb180765520c544525e3ef21ea72279c98b9aa7c7fb/rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:58edca431fb9b29950807e301826586e5bbf24163677732429770a697ffe6738", size = 392177, upload-time = "2025-11-30T20:24:27.834Z" }, + { url = "https://files.pythonhosted.org/packages/4a/b4/0a771378c5f16f8115f796d1f437950158679bcd2a7c68cf251cfb00ed5b/rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_31_riscv64.whl", hash = "sha256:dea5b552272a944763b34394d04577cf0f9bd013207bc32323b5a89a53cf9c2f", size = 406015, upload-time = "2025-11-30T20:24:29.457Z" }, + { url = "https://files.pythonhosted.org/packages/36/d8/456dbba0af75049dc6f63ff295a2f92766b9d521fa00de67a2bd6427d57a/rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ba3af48635eb83d03f6c9735dfb21785303e73d22ad03d489e88adae6eab8877", size = 423736, upload-time = "2025-11-30T20:24:31.22Z" }, + { url = "https://files.pythonhosted.org/packages/13/64/b4d76f227d5c45a7e0b796c674fd81b0a6c4fbd48dc29271857d8219571c/rpds_py-0.30.0-pp311-pypy311_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:dff13836529b921e22f15cb099751209a60009731a68519630a24d61f0b1b30a", size = 573981, upload-time = "2025-11-30T20:24:32.934Z" }, + { url = "https://files.pythonhosted.org/packages/20/91/092bacadeda3edf92bf743cc96a7be133e13a39cdbfd7b5082e7ab638406/rpds_py-0.30.0-pp311-pypy311_pp73-musllinux_1_2_i686.whl", hash = "sha256:1b151685b23929ab7beec71080a8889d4d6d9fa9a983d213f07121205d48e2c4", size = 599782, upload-time = "2025-11-30T20:24:35.169Z" }, + { url = "https://files.pythonhosted.org/packages/d1/b7/b95708304cd49b7b6f82fdd039f1748b66ec2b21d6a45180910802f1abf1/rpds_py-0.30.0-pp311-pypy311_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:ac37f9f516c51e5753f27dfdef11a88330f04de2d564be3991384b2f3535d02e", size = 562191, upload-time = "2025-11-30T20:24:36.853Z" }, +] + +[[package]] +name = "rpds-py" +version = "2026.6.3" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.15'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform != 'win32'", + "python_full_version >= '3.11' and python_full_version < '3.14' and sys_platform == 'win32'", + "python_full_version >= '3.11' and python_full_version < '3.14' and sys_platform != 'win32'", +] +sdist = { url = "https://files.pythonhosted.org/packages/aa/2a/9618a122aeb2a169a28b03889a2995fe297588964333d4a7d67bdf46e147/rpds_py-2026.6.3.tar.gz", hash = "sha256:1cebd1337c242e4ec2293e541f712b2da849b29f48f0c293684b71c0632625d4", size = 64051, upload-time = "2026-06-30T07:17:53.009Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/94/1f/a2dca5ffdbf1d475ffc4e80e4d5d720ff3a00f691795910116960ee12511/rpds_py-2026.6.3-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:7b689145a1485c335569bd056464f3243a29af7ed3871c7be31ad624ba239bc7", size = 342174, upload-time = "2026-06-30T07:14:54.821Z" }, + { url = "https://files.pythonhosted.org/packages/4d/dc/323d08583c0832911768663d1944f0107fcd4088704858d84b5e06d105a0/rpds_py-2026.6.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:db08f45aecde626498fb3df07bcf6d2ec040af42e859a4f5040d79c200342911", size = 345513, upload-time = "2026-06-30T07:14:56.515Z" }, + { url = "https://files.pythonhosted.org/packages/0b/2a/e31989834d18d2f26ec1d2774c5b1eb3331df4ea8ada525175294c94b48a/rpds_py-2026.6.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:acc992ab27b15f852c76755eb2ab7dce86585ddadba6fa5946e58556088845b4", size = 373783, upload-time = "2026-06-30T07:14:57.736Z" }, + { url = "https://files.pythonhosted.org/packages/87/fe/e80107ee3639585c9941c17d6a42cd65325022f656c023191fce78c324c8/rpds_py-2026.6.3-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:7f88d653e7b3b779d71ae7454e20dcc9b6bae903f33c269db9f2be41bda3f261", size = 378316, upload-time = "2026-06-30T07:14:59.077Z" }, + { url = "https://files.pythonhosted.org/packages/22/6f/81e3adf81acfb6fa694de2a6e4e7d8863121e3e0799e0a7725e6cf5679c4/rpds_py-2026.6.3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e52655eaf81e32593abedaa4bfe33170c8cfedf3365ed9be6e11e07f148f0278", size = 499423, upload-time = "2026-06-30T07:15:00.488Z" }, + { url = "https://files.pythonhosted.org/packages/2d/9a/41263969df0ce3d9af2a96d5005a288200af1989aed3354bfceb5fc0b21f/rpds_py-2026.6.3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dfcc8b909769d19db55c7cc9541eb64b9b774b1057ffffb4f1048070475bb9f9", size = 386077, upload-time = "2026-06-30T07:15:01.911Z" }, + { url = "https://files.pythonhosted.org/packages/5e/19/7e98f468bd50346faff5b10e5297374b443bfdddacc8e9fbc65984539597/rpds_py-2026.6.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c1255b302953c86a486b81d330d5ee1d5bd937691ce271b6be0ef0e299eaab7", size = 371315, upload-time = "2026-06-30T07:15:03.317Z" }, + { url = "https://files.pythonhosted.org/packages/99/3c/2b973b4d371906a134b03decfea7f5d9835a2c6d263454392e15b64b5b18/rpds_py-2026.6.3-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:8d2294a31386bfa251d8c8a39472beee17db67d4f1a6eabea665d35c9a4461c3", size = 383502, upload-time = "2026-06-30T07:15:04.627Z" }, + { url = "https://files.pythonhosted.org/packages/98/2a/12e2799500af0a307bca76b63361c51f9fe479223561489c29eea1f2ee41/rpds_py-2026.6.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f8f23ead891a3b762f35ab3b04623da7056545b48aa60d59957e6789914545da", size = 402673, upload-time = "2026-06-30T07:15:05.856Z" }, + { url = "https://files.pythonhosted.org/packages/2d/e3/21e5872d165fe08be4f229e3d5ee9d90019c0bf0e5538de60dbd54009450/rpds_py-2026.6.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:421aba32367055614287a4292b6a17f1939c9452299f7a0209c117e990b646d4", size = 549964, upload-time = "2026-06-30T07:15:07.159Z" }, + { url = "https://files.pythonhosted.org/packages/1a/d0/5ee0fe36844297de8123bee27bc12078c1a7416ad9f1b8a8ca18d6b0c0ac/rpds_py-2026.6.3-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:1e5822dfc2f0d4ab7e745eaa6d85945069329beeccef965af3f3bb26058fcab6", size = 615446, upload-time = "2026-06-30T07:15:08.531Z" }, + { url = "https://files.pythonhosted.org/packages/b1/80/1ea5873cb683f2fbe5f21b23ea1f6d179ead19f3c5b249b7eb5dca568ef2/rpds_py-2026.6.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:83e35b57523816c8613fd0776b40cd8bb9f596b37ddd2692eb4a6bb5ab2f8c93", size = 576975, upload-time = "2026-06-30T07:15:09.97Z" }, + { url = "https://files.pythonhosted.org/packages/c9/e1/90ef639217a5ddb15b7f4f61b1c33911fd044ad03c311bafdd2bcab85582/rpds_py-2026.6.3-cp311-cp311-win32.whl", hash = "sha256:de3eceba0b683bcbb1ab93da016d0270df1f9ae7be716b40214c5dafac6ea45a", size = 204453, upload-time = "2026-06-30T07:15:11.324Z" }, + { url = "https://files.pythonhosted.org/packages/f2/b7/b7a1695d7af36f521fb11e80d6d3adbd744f73b921859bd3c2a2c0dc706f/rpds_py-2026.6.3-cp311-cp311-win_amd64.whl", hash = "sha256:2c54a076ca4d370980ab57bc0e31df57bbe8d41340436a90ef8b1219a3cbb127", size = 223219, upload-time = "2026-06-30T07:15:12.476Z" }, + { url = "https://files.pythonhosted.org/packages/d7/a2/145afacf796e4506062825941176ad9445c2dcf2b3b6a1f13d3030a15e19/rpds_py-2026.6.3-cp311-cp311-win_arm64.whl", hash = "sha256:168c733a7112e071bb7a66460e667edfcff06c017a3c523f7a8a8e08d0140804", size = 219137, upload-time = "2026-06-30T07:15:13.631Z" }, + { url = "https://files.pythonhosted.org/packages/5c/be/2e8974163072e7bab7df1a5acd54c4498e75e35d6d18b864d3a9d5dadc92/rpds_py-2026.6.3-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:a0811d33247c3d6128a3001d763f2aa056bb3425204335400ac54f89eec3a0d0", size = 343691, upload-time = "2026-06-30T07:15:14.96Z" }, + { url = "https://files.pythonhosted.org/packages/a4/73/319dfa745dd668efe89309141ded489126461fcecd2b8f3a3cda185129b6/rpds_py-2026.6.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:538949e262e46caa31ac01bdb3c1e8f642622922cacbabbae6a8445d9dc33eaf", size = 338542, upload-time = "2026-06-30T07:15:16.267Z" }, + { url = "https://files.pythonhosted.org/packages/21/63/4239893be1c4d09b709b1a8f6be4188f0870084ff547f46606b8a75f1b03/rpds_py-2026.6.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:55927d532399c2c646100ff7feb48eaa940ad70f42cd68e1328f3ded9f81ca24", size = 368180, upload-time = "2026-06-30T07:15:17.62Z" }, + { url = "https://files.pythonhosted.org/packages/1c/ca/9c5de382225234ceb37b1844ebdb140db12b2a278bb9efe2fcd19f6c82ce/rpds_py-2026.6.3-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f56f1695bc5c0871cbc33dc0130fcf503aab0c57dcc5a6700a4f49eba4f2652e", size = 375067, upload-time = "2026-06-30T07:15:18.952Z" }, + { url = "https://files.pythonhosted.org/packages/87/dc/863f69d1bf04ade34b7fe0d59b9fdf6f0135fe2d7cbca74f1d665589559d/rpds_py-2026.6.3-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:270b293dae9058fc9fcedab50f13cebf46fb8ed1d1d54e0521a9da5d6b211975", size = 490509, upload-time = "2026-06-30T07:15:20.434Z" }, + { url = "https://files.pythonhosted.org/packages/ce/ef/eac16a12048b45ec7c7fa94f2be3438a5f26bf9cc8580b18a1cfd609b7f6/rpds_py-2026.6.3-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:127565fead0a10943b282957bd5447804ff3160ad79f2ad2635e6d249e380680", size = 382754, upload-time = "2026-06-30T07:15:21.831Z" }, + { url = "https://files.pythonhosted.org/packages/04/8f/d2f3f532616be4d06c316ef119683e832bd3d41e112bf3a88f4151c95b17/rpds_py-2026.6.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ecabd69db66de867690f9797f2f8fa27ba501bbc24540cbdbdc649cd15888ba6", size = 366189, upload-time = "2026-06-30T07:15:23.371Z" }, + { url = "https://files.pythonhosted.org/packages/e3/29/41a7b0e98a4b44cd676ab7598419623373eb43b20be68c084935c1a8cf88/rpds_py-2026.6.3-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:58eadac9cd119677b60e1cf8ac4052f35949d71b8a9e5556efccbe82533cf22a", size = 377750, upload-time = "2026-06-30T07:15:24.659Z" }, + { url = "https://files.pythonhosted.org/packages/2e/05/ecda0bec46f9a1565090bcdc941d023f6a25aff85fda28f89f8d19878152/rpds_py-2026.6.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:7491ee23305ac3eb59e492b6945881f5cd77a6f731061a3f25b77fd40f9e99a4", size = 395576, upload-time = "2026-06-30T07:15:25.987Z" }, + { url = "https://files.pythonhosted.org/packages/68/a8/6ed52f03ee6cb854ce78785cc9a9a672eb880e83fd7224d471f667d151f1/rpds_py-2026.6.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:2c99f7e8ccb3dd6e3e4bfeac657a7b208c9bac8075f4b078c02d7404c34107fa", size = 543807, upload-time = "2026-06-30T07:15:27.356Z" }, + { url = "https://files.pythonhosted.org/packages/8f/d6/156c0d3eea27ba09b92562ba2364ba124c0a061b199e17eac637cd25a5e2/rpds_py-2026.6.3-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:62698275682bf121181861295c9181e789030a2d516071f5b8f3c23c170cd0fc", size = 611187, upload-time = "2026-06-30T07:15:28.931Z" }, + { url = "https://files.pythonhosted.org/packages/f1/31/774212ed989c62f7f310220089f9b0a3fb8f40f5443d1727abd5d9f52bc9/rpds_py-2026.6.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a214c993455f99a89aaeadc9b21241900037adc9d97203e374d75513c5911822", size = 573030, upload-time = "2026-06-30T07:15:30.553Z" }, + { url = "https://files.pythonhosted.org/packages/c9/50/22f73127a41f1ce4f87fe39aadfb9a126345801c274aa93ae88456249327/rpds_py-2026.6.3-cp312-cp312-win32.whl", hash = "sha256:501f9f04a588d6a09179368c57071301445191767c64e4b52a6aa9871f1ef5ed", size = 202185, upload-time = "2026-06-30T07:15:32.027Z" }, + { url = "https://files.pythonhosted.org/packages/04/3a/f0ee4d4dde9d3b69dedf1b5f74e7a40017046d55052d173e418c6a94f960/rpds_py-2026.6.3-cp312-cp312-win_amd64.whl", hash = "sha256:2c958bf94822e9290a40aaf2a822d4bc5c88099093e3948ad6c571eca9272e5f", size = 220394, upload-time = "2026-06-30T07:15:33.359Z" }, + { url = "https://files.pythonhosted.org/packages/f3/83/3382fe37f809b59f02aac04dbc4e765b480b46ee0227ed516e3bdc4d3dfc/rpds_py-2026.6.3-cp312-cp312-win_arm64.whl", hash = "sha256:22bffe6042b9bcb0822bcd1955ec00e245daf17b4344e4ed8e9551b976b63e96", size = 215753, upload-time = "2026-06-30T07:15:34.778Z" }, + { url = "https://files.pythonhosted.org/packages/a4/9e/b818ee580026ec578138e961027a68820c40afeb1ec8f6819b54fb99e196/rpds_py-2026.6.3-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:3cfe765c1da0072636ca06628261e0ea05688e160d5c8a03e0217c3854037223", size = 343012, upload-time = "2026-06-30T07:15:36.005Z" }, + { url = "https://files.pythonhosted.org/packages/f3/6b/686d9dc4359a8f163cfbbf89ee0b4e586431de22fe8248edb63a8cf50d49/rpds_py-2026.6.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f4d78253f6996be4901669ad25319f842f740eccf4d58e3c7f3dd39e6dde1d8f", size = 338203, upload-time = "2026-06-30T07:15:37.462Z" }, + { url = "https://files.pythonhosted.org/packages/9e/9b/069aa329940f8207615e091f5eedbbd40e1e15eac68a0790fd05ccdf796c/rpds_py-2026.6.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:54f45a148e28767bf343d33a684693c70e451c6f4c0e9904709a723fafbdfc1f", size = 367984, upload-time = "2026-06-30T07:15:39.008Z" }, + { url = "https://files.pythonhosted.org/packages/14/db/34c203e4becff3703e4d3bc121842c00b8689197f398161203a880052f4e/rpds_py-2026.6.3-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:842e7b070435622248c7a2c44ae53fa1440e073cc3023bc919fed570884097a7", size = 374815, upload-time = "2026-06-30T07:15:40.253Z" }, + { url = "https://files.pythonhosted.org/packages/ee/7d/8071067d2cc453d916ad836e828c943f575e8a44612537759002a1e07381/rpds_py-2026.6.3-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8020133a74bd81b4572dd8e4be028a6b1ebcd70e6726edc3918008c08bee6ee6", size = 490545, upload-time = "2026-06-30T07:15:41.729Z" }, + { url = "https://files.pythonhosted.org/packages/a3/42/da06c5aa8f0484ff07f270787434204d9f4535e2f8c3b51ed402267e63c3/rpds_py-2026.6.3-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cdc7e35386f3847df728fbcb5e887e2d79c19e2fa1eba9e51b6621d23e3243af", size = 382828, upload-time = "2026-06-30T07:15:43.327Z" }, + { url = "https://files.pythonhosted.org/packages/57/d7/fe978efc2ae50abe48eb7464668ea99f53c010c60aeebb7b35ad27f23661/rpds_py-2026.6.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:acac386b453c2516111b50985d60ce46e7fadb5ea71ae7b25f4c946935bf27cf", size = 365678, upload-time = "2026-06-30T07:15:44.992Z" }, + { url = "https://files.pythonhosted.org/packages/69/9d/1d8922e1990b2a6eb532b6ff53d3e73d2b3bbffc84116c75826bee73dfc6/rpds_py-2026.6.3-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:425560c6fa0415f27261727bb20bd097568485e5eb0c121f1949417d1c516885", size = 377811, upload-time = "2026-06-30T07:15:46.523Z" }, + { url = "https://files.pythonhosted.org/packages/b1/3d/198dceafb4fb034a6a47347e1b0735d34e0bd4a50be4e898d408ee66cb14/rpds_py-2026.6.3-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a550fb4950a06dde3beb4721f5ad4b25bf4513784665b0a8522c792e2bd822a4", size = 395382, upload-time = "2026-06-30T07:15:47.955Z" }, + { url = "https://files.pythonhosted.org/packages/1f/f1/13968e49655d40b6b19d8b9140296bbc6f1d86b3f0f6c346cf9f1adddf4b/rpds_py-2026.6.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:4f4bca01b63096f606e095734dd56e74e175f94cfbf24ff3d63281cec61f7bb7", size = 543832, upload-time = "2026-06-30T07:15:49.33Z" }, + { url = "https://files.pythonhosted.org/packages/ac/ab/289bcb1b90bd3e40a2900c561fa0e2087345ecbb094f0b870f2345142b7c/rpds_py-2026.6.3-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ccffae9a092a00deb7efd545fe5e2c33c33b88e7c054337e9a74c179347d0b7d", size = 611011, upload-time = "2026-06-30T07:15:50.847Z" }, + { url = "https://files.pythonhosted.org/packages/1e/16/5043105e679436ccfbc8e5e0dd2d663ed18a8b8113515fd06a5e5d77c83e/rpds_py-2026.6.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:1cf01971c4f2c5553b772a542e4aaf191789cd331bc2cd4ff0e6e65ba49e1e97", size = 572431, upload-time = "2026-06-30T07:15:52.394Z" }, + { url = "https://files.pythonhosted.org/packages/85/ed/adab103321c0a6565d5ae1c2998349bc3ee175b82ccc5ae8fc04cc413075/rpds_py-2026.6.3-cp313-cp313-win32.whl", hash = "sha256:8c3d1e9c15b9d51ca0391e13da1a25a0a4df3c58a37c9dc368e0736cf7f69df0", size = 201710, upload-time = "2026-06-30T07:15:53.894Z" }, + { url = "https://files.pythonhosted.org/packages/7b/ed/a03b09668e74e5dabbf2e211f6468e1820c0552f7b0500082da31841bf7b/rpds_py-2026.6.3-cp313-cp313-win_amd64.whl", hash = "sha256:9250a9a0a6fd4648b3f868da8d91a4c52b5811a62df58e753d50ae4454a36f80", size = 219454, upload-time = "2026-06-30T07:15:55.25Z" }, + { url = "https://files.pythonhosted.org/packages/27/17/b8642c12930b71bc2b25831f6708ccf0f75abcd11883932ec9ce54ba3a78/rpds_py-2026.6.3-cp313-cp313-win_arm64.whl", hash = "sha256:900a67df3fd1660b035a4761c4ce73c382ea6b35f90f9863c36c6fd8bf8b09bb", size = 215063, upload-time = "2026-06-30T07:15:56.573Z" }, + { url = "https://files.pythonhosted.org/packages/b6/36/7fbe9dcdaf857fb3f63c2a2284b62492d95f5e8334e947e5fb6e7f68c9be/rpds_py-2026.6.3-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:931908d9fc855d8f74783377822be318edb6dcb19e47169dc038f9a1bf60b06e", size = 344510, upload-time = "2026-06-30T07:15:57.921Z" }, + { url = "https://files.pythonhosted.org/packages/ba/54/f785cc3d3f60839ca57a5af4927a9f347b07b2799c373fc20f7949f87c7e/rpds_py-2026.6.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:d7469697dce35be237db177d42e2a2ee26e6dcc5fc052078a6fefabd288c6edd", size = 339495, upload-time = "2026-06-30T07:15:59.238Z" }, + { url = "https://files.pythonhosted.org/packages/63/ef/d4cdaf309e6b095b43597103cf8c0b951d6cca2acce68c474f75ec12e0c7/rpds_py-2026.6.3-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bcfbcf66006befb9fd2aeaa9e01feaf881b4dc330a02ba07d2322b1c11be7b5d", size = 369454, upload-time = "2026-06-30T07:16:01.021Z" }, + { url = "https://files.pythonhosted.org/packages/96/4a/9559a68b7ee15db09d7981212e8c2e219d2a1d6d4faa0391d813c3496a36/rpds_py-2026.6.3-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:847927daf4cffbd4e90e42bc890069897101edd015f956cb8721b3473372edda", size = 374583, upload-time = "2026-06-30T07:16:02.287Z" }, + { url = "https://files.pythonhosted.org/packages/ef/75/8964aa7d2c6e8ac43eba8eb6e6b0fdda1f46d39f2fc3e6aa9f2cb17f485d/rpds_py-2026.6.3-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:aca6c1ef08a82bfe327cc156da694660f599923e2e6665b6d81c9c2d0ac9ffc8", size = 492919, upload-time = "2026-06-30T07:16:03.723Z" }, + { url = "https://files.pythonhosted.org/packages/8f/97/6908094ac804115e65aedfd90f1b5fee4eebebd3f6c4cfc5419939267565/rpds_py-2026.6.3-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ae50181a047c871561212bb97f7932a2d45fb53e947bd9b57ebad85b529cbc53", size = 383725, upload-time = "2026-06-30T07:16:05.305Z" }, + { url = "https://files.pythonhosted.org/packages/d1/9c/0d1fdc2e7aba23e290d603bc494e97bd205bae262ce33c6b32a69768ed5e/rpds_py-2026.6.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dc319e5a1de4b6913aac94bf6a2f9e847371e0a140a43dd4991db1a09bc2d504", size = 367255, upload-time = "2026-06-30T07:16:07.086Z" }, + { url = "https://files.pythonhosted.org/packages/c4/fe/f0209ca4a9ed074bc8acb44dfd0e81c3122e94c9689f5645b7973a866719/rpds_py-2026.6.3-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:e4316bf32babbed84e691e352faf967ce2f0f024174a8643c37c94a1080374fc", size = 379060, upload-time = "2026-06-30T07:16:08.525Z" }, + { url = "https://files.pythonhosted.org/packages/c6/8d/f1cc54c616b9d8897de8738aac148d20afca93f68187475fe194d09a71b9/rpds_py-2026.6.3-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8c6e5a2f750cc71c3e3b11d71661f21d6f9bc6cebc6564b1466417a1ec03ec77", size = 395960, upload-time = "2026-06-30T07:16:09.989Z" }, + { url = "https://files.pythonhosted.org/packages/fb/04/aafff00f73aeca2945f734f1d483c64ab8f472d0864ab02377fd8e89c3b2/rpds_py-2026.6.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:4470ce197d4090875cf6affbf1f853338387428df97c4fb7b7106317b8214698", size = 545356, upload-time = "2026-06-30T07:16:11.816Z" }, + { url = "https://files.pythonhosted.org/packages/fd/cc/e229663b9e4ddac5a4acbe9085dd80a71af2a5d356b8b39d6bff233f24b0/rpds_py-2026.6.3-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:ea964164cc9afa72d4d9b23cc28dafae93693c0a53e0b42acbff15b22c3f9ddd", size = 612319, upload-time = "2026-06-30T07:16:13.586Z" }, + { url = "https://files.pythonhosted.org/packages/e3/7a/8a0e6d3e6cd066af108b71b43122c3fe158dd9eb86acac626593a2582eb1/rpds_py-2026.6.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:639c8929aa0afe81be836b04de888460d6bed38b9c54cfc18da8f6bfabf5af5d", size = 573508, upload-time = "2026-06-30T07:16:15.23Z" }, + { url = "https://files.pythonhosted.org/packages/87/03/2a69ab618a789cf6cf85c86bb844c62d090e700ab1a2aa676b3741b6c516/rpds_py-2026.6.3-cp314-cp314-win32.whl", hash = "sha256:882076c00c0a608b131187055ddc5ae29f2e7eaf870d6168980420d58528a5c8", size = 202504, upload-time = "2026-06-30T07:16:16.893Z" }, + { url = "https://files.pythonhosted.org/packages/85/62/a3892ba945f4e24c78f352e5de3c7620d8479f73f211406a97263d13c7d2/rpds_py-2026.6.3-cp314-cp314-win_amd64.whl", hash = "sha256:0be972be84cfcaf46c8c6edf690ca0f154ac17babf1f6a955a51579b34ad2dc5", size = 220380, upload-time = "2026-06-30T07:16:18.108Z" }, + { url = "https://files.pythonhosted.org/packages/3d/e7/c2bd44dc831931815ad11ebb5f430b5a0a4d3caa9de837107876c30c3432/rpds_py-2026.6.3-cp314-cp314-win_arm64.whl", hash = "sha256:2a9c6f195058cb45335e8cc3802745c603d716eb96bc9625950c1aac71c0c703", size = 215976, upload-time = "2026-06-30T07:16:19.654Z" }, + { url = "https://files.pythonhosted.org/packages/79/9c/fff7b74bce9a091ec9a012a03f9ff5f69364eaf9451060dfc4486da2ffdd/rpds_py-2026.6.3-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:f90938e92afda60266da758ee7d363447f7f0138c9559f9e1811629580582d90", size = 346840, upload-time = "2026-06-30T07:16:21.268Z" }, + { url = "https://files.pythonhosted.org/packages/e9/44/77bcb1168b33704908295533d27f10eb811e9e3e193e8993dc99572211d3/rpds_py-2026.6.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:ec829541c45bca16e61c7ae50c20501f213605beb75d1aba91a6ee37fbbb56a4", size = 340282, upload-time = "2026-06-30T07:16:22.875Z" }, + { url = "https://files.pythonhosted.org/packages/87/3c/7a9081c7c9e645b39efe19e4ffbeccd80add246327cd9b888aecffd72317/rpds_py-2026.6.3-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:afd70d95892096cdb26f15a00c45907b17817577aa8d1c76b2dcc2788391f9e9", size = 370403, upload-time = "2026-06-30T07:16:24.415Z" }, + { url = "https://files.pythonhosted.org/packages/f7/69/af47021eb7dad6ff3396cb001c08f0f3c4d06c20253f75be6421a59fe6b7/rpds_py-2026.6.3-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:29dfa0533a5d4c94d4dfa1b694fcb56c9c63aad8330ffdd816fd225d0a7a162f", size = 376055, upload-time = "2026-06-30T07:16:26.111Z" }, + { url = "https://files.pythonhosted.org/packages/81/fc/a3bcf517084396a6dd258c592567a3c011ba4557f2fde23dceaf26e74f2e/rpds_py-2026.6.3-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:af05d726809bff6b141be124d4c7ce998f9c9c7f30edb1f46c07aa103d540b41", size = 494419, upload-time = "2026-06-30T07:16:27.596Z" }, + { url = "https://files.pythonhosted.org/packages/c9/eb/13d529d1788135425c7bf207f8463458ca5d92e43f3f701365b83e9dffc1/rpds_py-2026.6.3-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9826217f048f620d9a712672818bf231442c1b35d96b227a07eabd11b4bb6945", size = 384848, upload-time = "2026-06-30T07:16:29.183Z" }, + { url = "https://files.pythonhosted.org/packages/8e/f4/b7ac49f30013aba8f7b9566b1dd07e81de95e708c1374b7bacc5b9bc5c9c/rpds_py-2026.6.3-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:536bceea4fa4acf7e1c61da2b5786304367c816c8895be71b8f537c480b0ea1f", size = 371369, upload-time = "2026-06-30T07:16:30.912Z" }, + { url = "https://files.pythonhosted.org/packages/31/86/6260bafa622f788b07ddec0e52d810305c8b9b0b8c27f58a2ab04bf62b4f/rpds_py-2026.6.3-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:bc0011654b91cc4fb2ae701bec0a0ba1e552c0714247fa7af6c59e0ccfa3a4e1", size = 379673, upload-time = "2026-06-30T07:16:32.486Z" }, + { url = "https://files.pythonhosted.org/packages/19/c3/03f1ee79a047b48daeca157c89a18509cde22b6b951d642b9b0af1be660a/rpds_py-2026.6.3-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:539d75de9e0d536c84ff18dfeb805398e58227001ce09231a26a08b9aed1ee0e", size = 397500, upload-time = "2026-06-30T07:16:34.471Z" }, + { url = "https://files.pythonhosted.org/packages/f0/95/8ed0cd8c377dca12aea498f119fe639fc474d1461545c39d2b5872eb1c0f/rpds_py-2026.6.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:166cf54d9f44fc6ceb53c7860258dde44a81406646de79f8ed3234fca3b6e538", size = 545978, upload-time = "2026-06-30T07:16:36.45Z" }, + { url = "https://files.pythonhosted.org/packages/d3/f2/0eb57f0eaa83f8fc152a7e03de968ab77e1f00732bebc892b190c6eebde7/rpds_py-2026.6.3-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:d34c20167764fbcf927194d532dd7e0c56772f0a5f943fa5ef9e9afbba8fb9db", size = 613350, upload-time = "2026-06-30T07:16:38.213Z" }, + { url = "https://files.pythonhosted.org/packages/5b/de/e0674bdbc3ef7634989b3f854c3f34bc1f587d36e5bfdc5c378d57034619/rpds_py-2026.6.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:ea7bb13b7c9a29791f87a0387ba7d3ad3a6d783d827e4d3f27b40a0ff44495e2", size = 576486, upload-time = "2026-06-30T07:16:39.797Z" }, + { url = "https://files.pythonhosted.org/packages/f2/f6/21101359743cd136ada781e8210a85769578422ba460672eea0e29739200/rpds_py-2026.6.3-cp314-cp314t-win32.whl", hash = "sha256:6de4744d05bd1aa1be4ed7ea1189e3979196808008113bbbf899a460966b925e", size = 201068, upload-time = "2026-06-30T07:16:41.316Z" }, + { url = "https://files.pythonhosted.org/packages/a6/b2/9574d4d44f7760c2aa32d92a0a4f41698e33f5b204a0bf5c9758f52c79d5/rpds_py-2026.6.3-cp314-cp314t-win_amd64.whl", hash = "sha256:c7b9a2f8f4d8e90af72571d3d495deebdd7e3c75451f5b41719aee166e940fc2", size = 220600, upload-time = "2026-06-30T07:16:43.091Z" }, + { url = "https://files.pythonhosted.org/packages/08/ae/f23a2697e6ee6340a578b0f136be6483657bef0c6f9497b752bb5c0964bb/rpds_py-2026.6.3-cp315-cp315-macosx_10_12_x86_64.whl", hash = "sha256:e059c5dde6452b44424bd1834557556c226b57781dee1227af23518459722b13", size = 344726, upload-time = "2026-06-30T07:16:44.5Z" }, + { url = "https://files.pythonhosted.org/packages/c3/63/e7b3a1a5358dd32c930a1062d8e15b67fd6e8922e81df9e91706d66ee5c8/rpds_py-2026.6.3-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:2f7c26fbc5acd2522b95d4177fe4710ffd8e9b20529e703ffbf8db4d93903f05", size = 339587, upload-time = "2026-06-30T07:16:46.255Z" }, + { url = "https://files.pythonhosted.org/packages/ec/64/10a85681916ca55fffb91b0a211f84e34297c109243484dd6394660a8a7c/rpds_py-2026.6.3-cp315-cp315-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a3086b538543802f84c843911242db20447de00d8752dd0efc936dbcf02218ba", size = 369585, upload-time = "2026-06-30T07:16:48.101Z" }, + { url = "https://files.pythonhosted.org/packages/76/c2/baf95c7c38823e12ba34407c5f5767a89e5cf2233895e56f608167ae9493/rpds_py-2026.6.3-cp315-cp315-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8f2e5c5ee828d42cb11760761c0af6507927bec42d0ad5458f97c9203b054617", size = 375479, upload-time = "2026-06-30T07:16:49.93Z" }, + { url = "https://files.pythonhosted.org/packages/6a/94/0aad06c72d65101e11d33528d438cda99a39ce0da99466e156158f2541d3/rpds_py-2026.6.3-cp315-cp315-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ed0c1e5d10cdc7135537988c74a0188da68e2f3c30813ba3744ab1e42e0480f9", size = 492418, upload-time = "2026-06-30T07:16:51.641Z" }, + { url = "https://files.pythonhosted.org/packages/b5/17/de3f5a479a1f056535d7489819639d8cd591ea6281d700390b43b1abd745/rpds_py-2026.6.3-cp315-cp315-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8c2642a7603ec0b16ed77da4555db3b4b472341904873788327c0b0d7b95f1bb", size = 384123, upload-time = "2026-06-30T07:16:53.622Z" }, + { url = "https://files.pythonhosted.org/packages/46/7d/bf09bd1b145bb2671c03e1e6d1ab8651858d90d8c7dfeadd85a37a934fd8/rpds_py-2026.6.3-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8e4320744c1ffdd95a603def63344bfab2d33edeab301c5007e7de9f9f5b3885", size = 367351, upload-time = "2026-06-30T07:16:55.241Z" }, + { url = "https://files.pythonhosted.org/packages/a3/ea/1bb734f314b8be319149ddee80b18bd41372bdcfbdf88d28131c0cd37719/rpds_py-2026.6.3-cp315-cp315-manylinux_2_31_riscv64.whl", hash = "sha256:a9f4645593036b81bbdb36b9c8e0ea0d1c3fee968c4d59db0344c14087ef143a", size = 378827, upload-time = "2026-06-30T07:16:56.841Z" }, + { url = "https://files.pythonhosted.org/packages/4b/93/d9611e5b25e26df9a3649813ed66193ace9347a7c7fc4ab7cf70e94851c0/rpds_py-2026.6.3-cp315-cp315-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e55d236be29255554da47abe5c577637db7c24a02b8b46f0ca9524c855801868", size = 395966, upload-time = "2026-06-30T07:16:58.557Z" }, + { url = "https://files.pythonhosted.org/packages/c3/cb/99d77e16e5534ae1d90629bbe419ba6ee170833a6a85e3aa1cc41726fbbc/rpds_py-2026.6.3-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:24e9c5386e16669b674a69c156c8eeefcb578f3b3397b713b08e6d60f3c7b187", size = 545680, upload-time = "2026-06-30T07:17:00.164Z" }, + { url = "https://files.pythonhosted.org/packages/59/15/11a29755f790cef7a2f755e8e14f4f0c33f39489e1893a632a2eee59672b/rpds_py-2026.6.3-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:c60924535c75f1566b6eb75b5c31a48a43fef04fa2d0d201acbad8a9969c6107", size = 611853, upload-time = "2026-06-30T07:17:01.962Z" }, + { url = "https://files.pythonhosted.org/packages/68/86/0c27547e21644da938fb530f7e1a8148dd24d02db07e7a5f2567a17ce710/rpds_py-2026.6.3-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:38a2fea2787428f811719ceb9114cb78964a3138838320c29ac39526c79c16ba", size = 573715, upload-time = "2026-06-30T07:17:03.693Z" }, + { url = "https://files.pythonhosted.org/packages/29/71/4d8fcf700931815594bce892255bbd973b94efaf0fc1932b0590df18d886/rpds_py-2026.6.3-cp315-cp315-win32.whl", hash = "sha256:d483fe17f01ad64b7bf7cc38fcefff1ca9fb83f8c2b2542b68f97ffe0611b369", size = 202864, upload-time = "2026-06-30T07:17:05.746Z" }, + { url = "https://files.pythonhosted.org/packages/eb/62/b577562de0edbb55b2be85ce5fd09c33e386b9b13eee09833af4240fd5c4/rpds_py-2026.6.3-cp315-cp315-win_amd64.whl", hash = "sha256:67e3a721ffc5d8d2210d3671872298c4a84e4b8035cfe42ffd7cde35d772b146", size = 220430, upload-time = "2026-06-30T07:17:07.471Z" }, + { url = "https://files.pythonhosted.org/packages/c8/95/d6d0b2509825141eef60669a5739eec88dbc6a48053d6c92993a5704defe/rpds_py-2026.6.3-cp315-cp315-win_arm64.whl", hash = "sha256:6e84adbcf4bf841aed8116a8264b9f50b4cb3e7bd89b516122e616ac56ca269e", size = 215877, upload-time = "2026-06-30T07:17:09.008Z" }, + { url = "https://files.pythonhosted.org/packages/b7/bf/f3ea278f0afd615c1d0f19cb69043a41526e2bb600c2b536eb192218eb27/rpds_py-2026.6.3-cp315-cp315t-macosx_10_12_x86_64.whl", hash = "sha256:ae6dd8f10bd17aad820876d24caec9efdafd80a318d16c0a48edb5e136902c6b", size = 346933, upload-time = "2026-06-30T07:17:10.762Z" }, + { url = "https://files.pythonhosted.org/packages/9d/29/9907bdf1c5346763cf10b7f6852aad86652168c259def904cbe0082c5864/rpds_py-2026.6.3-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:bdbd97738551fca3917c1bd7188bec1920bb520104f28e7e1007f9ceb17b7690", size = 340274, upload-time = "2026-06-30T07:17:12.266Z" }, + { url = "https://files.pythonhosted.org/packages/6f/2c/8e03767b5778ef25cebf74a7a91a2c3806f8eced4c92cb7406bbe060756d/rpds_py-2026.6.3-cp315-cp315t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8b95977e7211527ab0ba576e286d023389fbeeb32a6b7b771665d333c60e5342", size = 370763, upload-time = "2026-06-30T07:17:14.107Z" }, + { url = "https://files.pythonhosted.org/packages/2e/e1/df2a7e1ba2efd796af26194250b8d42c821b46592311595162af9ef0528d/rpds_py-2026.6.3-cp315-cp315t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d15fde0e6fb0d88a60d221204873743e5d9f0b7d29165e62cd86d0413ad74ba6", size = 376467, upload-time = "2026-06-30T07:17:15.76Z" }, + { url = "https://files.pythonhosted.org/packages/6b/de/8a0814d1946af29cb068fb259aa8622f856df1d0bab58429448726b537f5/rpds_py-2026.6.3-cp315-cp315t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a136d453475ac0fcbda502ef1e6504bd28d6d904700915d278deeab0d00fe140", size = 496689, upload-time = "2026-06-30T07:17:17.308Z" }, + { url = "https://files.pythonhosted.org/packages/df/f3/f19e0c852ba13694f5a79f3b719331051573cb5693feacf8a88ffffc3a71/rpds_py-2026.6.3-cp315-cp315t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f826877d462181e5eb1c26a0026b8d0cab05d99844ecb6d8bf3627a2ca0c0442", size = 385340, upload-time = "2026-06-30T07:17:18.928Z" }, + { url = "https://files.pythonhosted.org/packages/e2/ae/7ec3a9d2d4351f99e37bcb06b6b6f954512646bfdbf9742e1de727865daf/rpds_py-2026.6.3-cp315-cp315t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:79486287de1730dbaff3dbd124d0ca4d2ef7f9d29bf2544f1f93c09b5bcbbd12", size = 372179, upload-time = "2026-06-30T07:17:20.539Z" }, + { url = "https://files.pythonhosted.org/packages/d3/ac/9cee911dff2aaa9a5a8354f6610bf2e6a616de9197c5fff4f54f82585f1e/rpds_py-2026.6.3-cp315-cp315t-manylinux_2_31_riscv64.whl", hash = "sha256:808345f53cb952433ca2816f1604ff3515608a81784954f38d4452acfe8e61d5", size = 379993, upload-time = "2026-06-30T07:17:22.212Z" }, + { url = "https://files.pythonhosted.org/packages/83/6b/7c2a07ba88d1e9a936612f7a5d067467ed03d971d5a06f7d309dff044a7e/rpds_py-2026.6.3-cp315-cp315t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1967debc37f64f2c4dc90a7f563aec558b471966e12adcac4e1c4240496b6ebf", size = 398909, upload-time = "2026-06-30T07:17:23.66Z" }, + { url = "https://files.pythonhosted.org/packages/97/0b/776ffcb66783637b0031f6d58d6fb55913c8b5abf00aeecd46bf933fb477/rpds_py-2026.6.3-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:f0840b5b17057f7fd918b76183a4b5a0635f43e14eb2ce60dce1d4ee4707ea00", size = 546584, upload-time = "2026-06-30T07:17:25.264Z" }, + { url = "https://files.pythonhosted.org/packages/55/33/ba3bc04d7092bd553c9b2b195624992d2cc4f3de1f380b7b93cbee67bd79/rpds_py-2026.6.3-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:faa679d19a6696fd54259ad321251ad77a13e70e03dd834daa762a44fb6196ef", size = 614357, upload-time = "2026-06-30T07:17:26.888Z" }, + { url = "https://files.pythonhosted.org/packages/8b/71/14edf065f04630b1a8472f7653cad03f6c478bcf95ea0e6aed55451e33ea/rpds_py-2026.6.3-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:23a439f31ccbeff1574e24889128821d1f7917470e830cf6544dced1c662262a", size = 576533, upload-time = "2026-06-30T07:17:28.546Z" }, + { url = "https://files.pythonhosted.org/packages/ba/76/65002b08596c389105720a8c0d22298b8dc25a4baf89b2ce431343c8b1de/rpds_py-2026.6.3-cp315-cp315t-win32.whl", hash = "sha256:913ca42ccad3f8cc6e292b587ae8ae49c8c823e5dce51a736252fc7c7cdfa577", size = 201204, upload-time = "2026-06-30T07:17:30.193Z" }, + { url = "https://files.pythonhosted.org/packages/8c/97/d855d6b3c322d1f27e26f5241c42016b56cf01377ea8ed348285f54652f0/rpds_py-2026.6.3-cp315-cp315t-win_amd64.whl", hash = "sha256:ae3d4fe8c0b9213624fdce7279d70e3b148b682ca20719ebd193a23ebfa47324", size = 220719, upload-time = "2026-06-30T07:17:31.788Z" }, + { url = "https://files.pythonhosted.org/packages/b4/9c/f0d19ac587fd0e4ab6b72cda355e9c5a6166b01ef7e064e437aef8eb9fef/rpds_py-2026.6.3-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:4cf2d36a2357e4d07bb5a4f98801265327b48256867816cfd2ceb001e9754a8f", size = 349791, upload-time = "2026-06-30T07:17:33.315Z" }, + { url = "https://files.pythonhosted.org/packages/38/c7/1d49d204c9fd2ee6c537601dc4c1ba921e03363ca576bfab94a00254ac9a/rpds_py-2026.6.3-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:30c6dc199b24a5e3e81d50da0f00858c5bbdb2617a750395687f4339c5818171", size = 352842, upload-time = "2026-06-30T07:17:34.897Z" }, + { url = "https://files.pythonhosted.org/packages/ac/e5/c0b5dc93cd0d4c06ce1f438907649514e2ea077bcd911e3154a51e96c38e/rpds_py-2026.6.3-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9891e594296ab9dada6551c8e7b387b2721f27a67eecd528412e8906247a7b90", size = 382094, upload-time = "2026-06-30T07:17:36.514Z" }, + { url = "https://files.pythonhosted.org/packages/0d/54/ec0e907b4ca8d541112db352409bd15f871c9b243e0c92c9b5a46ae96f01/rpds_py-2026.6.3-pp311-pypy311_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b5c2dc92304aa48a4a60443b548bb12f12e119d4b72f314015e67b9e1be97fca", size = 388662, upload-time = "2026-06-30T07:17:38.235Z" }, + { url = "https://files.pythonhosted.org/packages/d3/f4/921c22a4fd0f1c1ac13a3996ffbf0aa67951e2c8ad0d1d9574938a2932e8/rpds_py-2026.6.3-pp311-pypy311_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:127e08c0642d880cf32ca47ec2a4a77b901f7e2dd1ad9762adb13955d72ffcc9", size = 504896, upload-time = "2026-06-30T07:17:39.689Z" }, + { url = "https://files.pythonhosted.org/packages/0b/1b/a114b972cefa1ab1cdb3c7bb177cd3844a12826c507c722d3a73516dbbaf/rpds_py-2026.6.3-pp311-pypy311_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8bb68f03f395eb793220b45c097bd4d8c32944393da0fad8b999efac0868fc8c", size = 391545, upload-time = "2026-06-30T07:17:41.336Z" }, + { url = "https://files.pythonhosted.org/packages/4e/98/af9b3db77d47fcbe6c8c1f36e2c2147ec70292819e99c325f871584a1c11/rpds_py-2026.6.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a3450b693fde92133e9f51060568a4c31fcca76d5e53bbd611e689ca446517e9", size = 380059, upload-time = "2026-06-30T07:17:42.857Z" }, + { url = "https://files.pythonhosted.org/packages/c9/ba/0efd8668b97c1d26a61566386c636a7a7a09829e474fdf807caa15a2c844/rpds_py-2026.6.3-pp311-pypy311_pp73-manylinux_2_31_riscv64.whl", hash = "sha256:5e8d07bddee435a2ff6f1920e18feff28d0bc4533e42f4bf6927fbd073312c41", size = 393235, upload-time = "2026-06-30T07:17:44.637Z" }, + { url = "https://files.pythonhosted.org/packages/62/90/8c139ee9690f73b0829f32647de6f40d826f8f443af6fa72644f96351aac/rpds_py-2026.6.3-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:3a83ae6c67b7676b9878378547ca8e93ed77a580037bcbcd1d32f739e1e6089c", size = 413008, upload-time = "2026-06-30T07:17:46.225Z" }, + { url = "https://files.pythonhosted.org/packages/9c/97/0043896fdd7828ce09a1d9a8b06433714d0960fc4ff3fc4aa72b666b764e/rpds_py-2026.6.3-pp311-pypy311_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:2bfd04c19ddbd6640de0b51894d764bd2758854d5b75bd102d2ef10cb9c293a9", size = 558118, upload-time = "2026-06-30T07:17:47.759Z" }, + { url = "https://files.pythonhosted.org/packages/f6/40/02355f0e134f783a8f9814c4680a1bd311d37671577a5964ea838573ff37/rpds_py-2026.6.3-pp311-pypy311_pp73-musllinux_1_2_i686.whl", hash = "sha256:ca6546b66be9dc4738b1b043d5ebd5488c66c578c5ff0fd0e8065313fe3afb76", size = 623138, upload-time = "2026-06-30T07:17:49.355Z" }, + { url = "https://files.pythonhosted.org/packages/10/85/48f0abdcef5cce4e034c7a5b0ceeceba0b01bf0d942824f4bb720afe2dec/rpds_py-2026.6.3-pp311-pypy311_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:8e65860d238379ed982fd9ba690579b5e95af2f4840f99c772816dbe573cb826", size = 586486, upload-time = "2026-06-30T07:17:51.141Z" }, ] [[package]] name = "ruff" -version = "0.16.4" +version = "0.16.5" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/00/8f/d8074b1f25e003164087a8bfe79a0f1a3945135764dbb6aaab04103dcaf9/ruff-0.16.4.tar.gz", hash = "sha256:13171aa9d9af2240ee3504e639de73122c67e74036de5ba2e1d01422cd17e3dc", size = 4899731, upload-time = "2026-08-20T17:43:59.196Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f3/85/c8e12473c93018f92d19dd988a294202e1c27426c47ec4de53ffb847b8d8/ruff-0.16.5.tar.gz", hash = "sha256:1b88500f9ffbcab3dedb0082c9f9492e91ec3d618aac1236a3e0189938f7040b", size = 4912003, upload-time = "2026-08-27T16:34:18.258Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/ff/80/779895ef584e089d22f2c6df0d0e99a65ec2df0805f1fffd439415b8c1f0/ruff-0.16.4-py3-none-linux_armv6l.whl", hash = "sha256:df4075f71ddac40b9934af60c3ec8a53047dd5a5fdc43224e6e4e8e9a27cb6f7", size = 10006909, upload-time = "2026-08-20T17:43:16.888Z" }, - { url = "https://files.pythonhosted.org/packages/a9/e6/f553199b5e8927a05cb5c422d921fd0656b29ab976e91c44802107c6b0da/ruff-0.16.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:0c95538517af68004306b0fb3214ff2f2af67a65092aee77cd9eb86db6656604", size = 10240201, upload-time = "2026-08-20T17:43:19.337Z" }, - { url = "https://files.pythonhosted.org/packages/1c/70/4a6dc4bb34da4dee35e30f09bbd1bfbdd26f33b62fb9b8df31f08a199cd2/ruff-0.16.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:963f83df8e69e575b64d67dd447ebbc917db41a14bf38d4593a4183e7aaa8255", size = 9835122, upload-time = "2026-08-20T17:43:21.708Z" }, - { url = "https://files.pythonhosted.org/packages/24/12/c6e22d686372c15bcb7af99831f1a1be96df696491babf4f24e4f942c527/ruff-0.16.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:32a5057c7ff3f6e6480a48fccfb3a412a690f48a3d03ac5cf08177d6c2da3ade", size = 9977162, upload-time = "2026-08-20T17:43:24.236Z" }, - { url = "https://files.pythonhosted.org/packages/46/49/72b10ec912f5ab5854992eaf7aa7cd36729b6937d9dc4e0fb41b3bf428ec/ruff-0.16.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b3dce8d9b0c57c265b91885a66a567d8ea1372e8eb4e250fa8e5e3f579e99cff", size = 9829789, upload-time = "2026-08-20T17:43:26.966Z" }, - { url = "https://files.pythonhosted.org/packages/fa/80/0f30e32e7f6ee26edc39075502db9d368d788a44a79b55f763eb4ab03796/ruff-0.16.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7dc651db49283c69f8e72c834eec4fe5573e4c646856aebece0ce385dceb2a80", size = 10527949, upload-time = "2026-08-20T17:43:29.384Z" }, - { url = "https://files.pythonhosted.org/packages/52/3d/86e8ad3542169e56cac3859a343afdb9df2ad54d35a59ce1e67baee83421/ruff-0.16.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3817b87dbcabc92f13b05019257c5b89b5b4d51b5fb20f56fb5235ceb723cd07", size = 11333695, upload-time = "2026-08-20T17:43:31.872Z" }, - { url = "https://files.pythonhosted.org/packages/d0/16/481c29b380c20a0054a8261066665e1b3488e23636c49d0a43e75975b9bb/ruff-0.16.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e9fce1499134b2c8c68e5166f95705a5812062bb93aacc5f9873bb1a27084bc7", size = 10727741, upload-time = "2026-08-20T17:43:34.596Z" }, - { url = "https://files.pythonhosted.org/packages/5e/b6/56bc0b8cf45b54b28b3a5e6381c8945d51b5b18adf659454c32295209a31/ruff-0.16.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f2d812e482f5a7e02eee26cd73d2a37ebbdf47d795ea63ba1b89110ae93e9fb3", size = 10286522, upload-time = "2026-08-20T17:43:37.288Z" }, - { url = "https://files.pythonhosted.org/packages/e8/8b/b345b4fb110f2fbe2bd31eabd271e5e8b3b7e4ee6c0e02f2dc6be78db000/ruff-0.16.4-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:6baaf984aa7976edf93d3b627fe2d1d22ee94bbca05fa6f90fc76d73924e3454", size = 10584182, upload-time = "2026-08-20T17:43:39.984Z" }, - { url = "https://files.pythonhosted.org/packages/29/e5/827b34041c35f58774a9681a4213994c164fc987800f4dddabcf451da0bf/ruff-0.16.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:bdfcf0b28662eb890372d50f92c283bb94e67e7635ed93c7fd533970acff7b2b", size = 10134195, upload-time = "2026-08-20T17:43:42.351Z" }, - { url = "https://files.pythonhosted.org/packages/0f/10/d0bffcdd6729b87afc82ba0ef377173356a7dc8e972f5179968cf2fdf98c/ruff-0.16.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:b66b02cb9b04f537643cadf5768e5f98dc461890d530cb67113d71c8c76e605d", size = 9825821, upload-time = "2026-08-20T17:43:44.532Z" }, - { url = "https://files.pythonhosted.org/packages/f5/32/0db2a863b796ca62d83e92a07a3ccf00921b14db02059347576a2fda3d4b/ruff-0.16.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:8528bf9a4b291a60bf02ea453511e8ce6215bd2b982ee80405b66b008b6c30a0", size = 10267658, upload-time = "2026-08-20T17:43:46.989Z" }, - { url = "https://files.pythonhosted.org/packages/b2/a0/fbdeb59e48c6261f523e56c8f12e9c08fbe693786595cc7e3959207a9232/ruff-0.16.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:fbd85d2875fdd67e833213a651f613bbf25303abf6aa822a5121f4531195678d", size = 10697071, upload-time = "2026-08-20T17:43:49.891Z" }, - { url = "https://files.pythonhosted.org/packages/aa/28/0c6dd865859c6d17bc8ccc34cb72b0e02d6c7eb25e8a1e22b5bea681e2c0/ruff-0.16.4-py3-none-win32.whl", hash = "sha256:312769988007aaeb8e189b443ccdd03c0e6374489e053467be6d96518ebff76e", size = 10021687, upload-time = "2026-08-20T17:43:52.281Z" }, - { url = "https://files.pythonhosted.org/packages/a3/03/e724450f621698117f9aa6dd241c94d0274ae96781378dc86745ae29f0e7/ruff-0.16.4-py3-none-win_amd64.whl", hash = "sha256:05d9d27a18c4bcbefada602480ec9e01e0bc949d432e0ced5df77edac195919c", size = 10567657, upload-time = "2026-08-20T17:43:54.78Z" }, - { url = "https://files.pythonhosted.org/packages/0e/fe/da8b9e1347696bb22120b77280ec5ce25d500ca5cb39d5ad6e5c18de19c1/ruff-0.16.4-py3-none-win_arm64.whl", hash = "sha256:a3a61621c9b6f6a89573e938a080e648f1695baa3f58570a3a707bc51ff65a21", size = 10451579, upload-time = "2026-08-20T17:43:57.135Z" }, + { url = "https://files.pythonhosted.org/packages/c6/b6/77c90a970fe2dae17a723acbd011043ea97c98d7deacccefdc4ba74ec512/ruff-0.16.5-py3-none-linux_armv6l.whl", hash = "sha256:12e5f673e774c35fbb62f288809c7653b73445f8ecec6b6063fd6ea3521aa14b", size = 10011941, upload-time = "2026-08-27T16:33:41.287Z" }, + { url = "https://files.pythonhosted.org/packages/4b/46/6cf67cf6411885a1d6f7f6d801682f155536a85176d10b605e2ceffed8bd/ruff-0.16.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:eda58a5802de40e7ed5b32b64e0b32539338cc6fcd2c78f61e3ad6a0d79f51c3", size = 10204049, upload-time = "2026-08-27T16:33:44.056Z" }, + { url = "https://files.pythonhosted.org/packages/46/fd/c8720ca7a090abf0c2fef4abe8a5ef6e5127ed15196d8886ff75a2b370e2/ruff-0.16.5-py3-none-macosx_11_0_arm64.whl", hash = "sha256:c5ae9a7b9a8875131f40f8fe967cc86abf899779efd663cb7ce3d572d01da7eb", size = 9809037, upload-time = "2026-08-27T16:33:46.257Z" }, + { url = "https://files.pythonhosted.org/packages/43/45/a684caacdedaca180f52bacccc40bf0789d2c5a7c75f25324853e9eaedb5/ruff-0.16.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7b719b0a1f4d59710d283ab2965f621684a108a9e41da622e3b23f0326cd0025", size = 9964129, upload-time = "2026-08-27T16:33:48.352Z" }, + { url = "https://files.pythonhosted.org/packages/9e/f2/5d2bcdaca6b5b93d1b4dfc166cd2aebf7680143a1b38a28759df13a94d31/ruff-0.16.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2298f2780ed1be0c5cb1361e32ab7b1467f3cce7dabe101d2210a314f2fe42e9", size = 9821518, upload-time = "2026-08-27T16:33:50.57Z" }, + { url = "https://files.pythonhosted.org/packages/aa/ff/011cce29accf9257d5974145b733fc653a37985ed6825413a3987cefbfe0/ruff-0.16.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:258f29035a2dd021e7861e631b227a5b3f14e50c1184c9a6a122c5f4576154d7", size = 10534835, upload-time = "2026-08-27T16:33:52.522Z" }, + { url = "https://files.pythonhosted.org/packages/d7/5a/f0cf109bada9bba0e96c90c21c9f9251803f57225c32d293327a03c710d6/ruff-0.16.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b9a4f0432966834019c74d1b7e5c51224305d7713f3d7faf3e7451f1a3be3cde", size = 11252550, upload-time = "2026-08-27T16:33:54.521Z" }, + { url = "https://files.pythonhosted.org/packages/63/4d/1d481aaea2046c6a7ed7c291f9004c669cce3c087b6b376ed5b08271e3fe/ruff-0.16.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b5eb3a8c3d0ade9cea42b591fd530368e8798380e30e0a308b85a5cf718f09ea", size = 10777949, upload-time = "2026-08-27T16:33:56.88Z" }, + { url = "https://files.pythonhosted.org/packages/ee/34/ee245ca55f64443233034b3d02b03236b19242004281247c079390b7facd/ruff-0.16.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef0f69e191a13a3c9816f63163c88790cb12cd157bbbb384e9c44745702ab105", size = 10311656, upload-time = "2026-08-27T16:33:59.12Z" }, + { url = "https://files.pythonhosted.org/packages/a7/4d/c33a333e341c0a2b96c715b52d89a606f5a34cd4ac493cd9b8d0187186b8/ruff-0.16.5-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:0eeab41fbea2c42f98dfb9822cdccda9d24ba38d49f6dc945b5c236d48f0ef29", size = 10532125, upload-time = "2026-08-27T16:34:01.166Z" }, + { url = "https://files.pythonhosted.org/packages/30/e1/a64cef78b40192497bb98a27a8aa8f2c98ee9ee15bc97f7712d94ef32937/ruff-0.16.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:f0768e9df4300713fff30733c87575f68b6f1d8de41184e505b7fdd9c0c95eaf", size = 10097648, upload-time = "2026-08-27T16:34:03.16Z" }, + { url = "https://files.pythonhosted.org/packages/cc/4e/4cdc9ed3c3e109d2f71e62572a37457298d7bc7501ec3138babb7ed32bbd/ruff-0.16.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:95cc70cdc7aa80c338de356279d2adbeb2de0f520b9ecd8aba75b94e95e02f91", size = 9829344, upload-time = "2026-08-27T16:34:05.134Z" }, + { url = "https://files.pythonhosted.org/packages/39/4a/31ed35ce31729955fc583ee0d176d6e784c1290cb0b0a75cb2134c1ab72a/ruff-0.16.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d185c8398ded1bfd91c0c2cb258346307571eccc473a8490af8c3977399c384a", size = 10277117, upload-time = "2026-08-27T16:34:07.425Z" }, + { url = "https://files.pythonhosted.org/packages/a8/a0/60356d86687b4b666d593df213f4dc3041750d024cb7bf2cfa81cfd65c2e/ruff-0.16.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:fb8e3a3c4c6a784150a7ced53b015f4b253fc2bf97a610886419ead64b4756ef", size = 10711653, upload-time = "2026-08-27T16:34:09.712Z" }, + { url = "https://files.pythonhosted.org/packages/ed/20/656d67f5b25ca9bda4e02b1de25867b2954e1d19e03648060f167ad0f4cc/ruff-0.16.5-py3-none-win32.whl", hash = "sha256:288b0a5f080492fe5635db849f9e2e84aa3cce7b7f0e955997d416c507c76a26", size = 10034250, upload-time = "2026-08-27T16:34:11.8Z" }, + { url = "https://files.pythonhosted.org/packages/5b/42/ee8e68a207b9127fcde6c3d7e197def432f346cb1af159e1fa14ca0d1cdc/ruff-0.16.5-py3-none-win_amd64.whl", hash = "sha256:ddc6385fb2137f616357ca03d6c74f4be987f80fed4008566b754f6032b8546f", size = 10516714, upload-time = "2026-08-27T16:34:13.963Z" }, + { url = "https://files.pythonhosted.org/packages/73/e3/7df5a396e445b9ba49ce9a9437439a4d80042c61c0ade199abf8d16de1ac/ruff-0.16.5-py3-none-win_arm64.whl", hash = "sha256:a64abe90968719b851bb7cedffaa8753fbdbdadab483089682db623f3edc587e", size = 10391564, upload-time = "2026-08-27T16:34:16.064Z" }, ] [[package]] name = "secretstorage" -version = "3.4.0" +version = "3.5.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "cryptography" }, - { name = "jeepney" }, + { name = "cryptography", marker = "python_full_version >= '3.15' or sys_platform != 'win32'" }, + { name = "jeepney", marker = "python_full_version >= '3.15' or sys_platform != 'win32'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/31/9f/11ef35cf1027c1339552ea7bfe6aaa74a8516d8b5caf6e7d338daf54fd80/secretstorage-3.4.0.tar.gz", hash = "sha256:c46e216d6815aff8a8a18706a2fbfd8d53fcbb0dce99301881687a1b0289ef7c", size = 19748, upload-time = "2025-09-09T16:42:13.859Z" } +sdist = { url = "https://files.pythonhosted.org/packages/1c/03/e834bcd866f2f8a49a85eaff47340affa3bfa391ee9912a952a1faa68c7b/secretstorage-3.5.0.tar.gz", hash = "sha256:f04b8e4689cbce351744d5537bf6b1329c6fc68f91fa666f60a380edddcd11be", size = 19884, upload-time = "2025-11-23T19:02:53.191Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/91/ff/2e2eed29e02c14a5cb6c57f09b2d5b40e65d6cc71f45b52e0be295ccbc2f/secretstorage-3.4.0-py3-none-any.whl", hash = "sha256:0e3b6265c2c63509fb7415717607e4b2c9ab767b7f344a57473b779ca13bd02e", size = 15272, upload-time = "2025-09-09T16:42:12.744Z" }, -] - -[[package]] -name = "sniffio" -version = "1.3.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/a2/87/a6771e1546d97e7e041b6ae58d80074f81b7d5121207425c964ddf5cfdbd/sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc", size = 20372, upload-time = "2024-02-25T23:20:04.057Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235, upload-time = "2024-02-25T23:20:01.196Z" }, + { url = "https://files.pythonhosted.org/packages/b7/46/f5af3402b579fd5e11573ce652019a67074317e18c1935cc0b4ba9b35552/secretstorage-3.5.0-py3-none-any.whl", hash = "sha256:0ce65888c0725fcb2c5bc0fdb8e5438eece02c523557ea40ce0703c266248137", size = 15554, upload-time = "2025-11-23T19:02:51.545Z" }, ] [[package]] name = "sse-starlette" -version = "3.0.2" +version = "3.4.8" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, + { name = "starlette" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/42/6f/22ed6e33f8a9e76ca0a412405f31abb844b779d52c5f96660766edcd737c/sse_starlette-3.0.2.tar.gz", hash = "sha256:ccd60b5765ebb3584d0de2d7a6e4f745672581de4f5005ab31c3a25d10b52b3a", size = 20985, upload-time = "2025-07-27T09:07:44.565Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f8/00/b42a44342a054d58cb1115d7c8aa9cb4290dd9442f9c1b91a4b8173dba22/sse_starlette-3.4.8.tar.gz", hash = "sha256:ed89ffbb75cbf78a5fe2f2109cd584792ee7f9dfac96f791db546df8f15f3f9c", size = 32548, upload-time = "2026-08-05T11:19:49.982Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/ef/10/c78f463b4ef22eef8491f218f692be838282cd65480f6e423d7730dfd1fb/sse_starlette-3.0.2-py3-none-any.whl", hash = "sha256:16b7cbfddbcd4eaca11f7b586f3b8a080f1afe952c15813455b162edea619e5a", size = 11297, upload-time = "2025-07-27T09:07:43.268Z" }, + { url = "https://files.pythonhosted.org/packages/dd/3a/764912c58293d95b6dcdf4cc255f9d10de310580ced547b082eb9d72018c/sse_starlette-3.4.8-py3-none-any.whl", hash = "sha256:6e82314c786709a3cd9520f2285cf9fff90e181e598e8a357b0cf80f66afba0d", size = 16516, upload-time = "2026-08-05T11:19:48.748Z" }, ] [[package]] name = "starlette" -version = "1.3.1" +version = "1.6.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/eb/e3/7c1dc7381d9f8ab7d854328ebfa884e62cb3f3d8549ddfd37c7814f42afa/starlette-1.3.1.tar.gz", hash = "sha256:05d0213193f2fbaae60e2ecb593b4add4262ad4e46536b54abe36f11a71724e0", size = 2703240, upload-time = "2026-06-12T09:23:11.602Z" } +sdist = { url = "https://files.pythonhosted.org/packages/b5/b4/205b0d5241d934e8add0c38aa924c4f9fb7330834ff11e5444db964ec3f9/starlette-1.6.0.tar.gz", hash = "sha256:d4e3ac5e546444960c710297a3c9fc3f7ebae1b7e963f3d36173b49da535be9b", size = 2716969, upload-time = "2026-08-08T18:27:57.512Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/ec/bb/2799cc2ede3ed41131f8975621e7213dfc7ef4acbbaadfa440f32500c370/starlette-1.3.1-py3-none-any.whl", hash = "sha256:c7372aae11c3c3f26a42df7bd626cec2f47d03483d261d369516a615a53714c6", size = 73632, upload-time = "2026-06-12T09:23:10.017Z" }, + { url = "https://files.pythonhosted.org/packages/c8/cb/6a6a47d5b464bd08695d254f3da6e7986cc70c9fa5d778eda57538edfe56/starlette-1.6.0-py3-none-any.whl", hash = "sha256:a86dd39d14bb45f85a3d18525215a9ef0cfd1f192ac793220e72598c90335f0c", size = 75969, upload-time = "2026-08-08T18:27:56.196Z" }, ] [[package]] name = "tomli" -version = "2.3.0" +version = "2.4.1" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/52/ed/3f73f72945444548f33eba9a87fc7a6e969915e7b1acc8260b30e1f76a2f/tomli-2.3.0.tar.gz", hash = "sha256:64be704a875d2a59753d80ee8a533c3fe183e3f06807ff7dc2232938ccb01549", size = 17392, upload-time = "2025-10-08T22:01:47.119Z" } +sdist = { url = "https://files.pythonhosted.org/packages/22/de/48c59722572767841493b26183a0d1cc411d54fd759c5607c4590b6563a6/tomli-2.4.1.tar.gz", hash = "sha256:7c7e1a961a0b2f2472c1ac5b69affa0ae1132c39adcb67aba98568702b9cc23f", size = 17543, upload-time = "2026-03-25T20:22:03.828Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/b3/2e/299f62b401438d5fe1624119c723f5d877acc86a4c2492da405626665f12/tomli-2.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:88bd15eb972f3664f5ed4b57c1634a97153b4bac4479dcb6a495f41921eb7f45", size = 153236, upload-time = "2025-10-08T22:01:00.137Z" }, - { url = "https://files.pythonhosted.org/packages/86/7f/d8fffe6a7aefdb61bced88fcb5e280cfd71e08939da5894161bd71bea022/tomli-2.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:883b1c0d6398a6a9d29b508c331fa56adbcdff647f6ace4dfca0f50e90dfd0ba", size = 148084, upload-time = "2025-10-08T22:01:01.63Z" }, - { url = "https://files.pythonhosted.org/packages/47/5c/24935fb6a2ee63e86d80e4d3b58b222dafaf438c416752c8b58537c8b89a/tomli-2.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d1381caf13ab9f300e30dd8feadb3de072aeb86f1d34a8569453ff32a7dea4bf", size = 234832, upload-time = "2025-10-08T22:01:02.543Z" }, - { url = "https://files.pythonhosted.org/packages/89/da/75dfd804fc11e6612846758a23f13271b76d577e299592b4371a4ca4cd09/tomli-2.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a0e285d2649b78c0d9027570d4da3425bdb49830a6156121360b3f8511ea3441", size = 242052, upload-time = "2025-10-08T22:01:03.836Z" }, - { url = "https://files.pythonhosted.org/packages/70/8c/f48ac899f7b3ca7eb13af73bacbc93aec37f9c954df3c08ad96991c8c373/tomli-2.3.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0a154a9ae14bfcf5d8917a59b51ffd5a3ac1fd149b71b47a3a104ca4edcfa845", size = 239555, upload-time = "2025-10-08T22:01:04.834Z" }, - { url = "https://files.pythonhosted.org/packages/ba/28/72f8afd73f1d0e7829bfc093f4cb98ce0a40ffc0cc997009ee1ed94ba705/tomli-2.3.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:74bf8464ff93e413514fefd2be591c3b0b23231a77f901db1eb30d6f712fc42c", size = 245128, upload-time = "2025-10-08T22:01:05.84Z" }, - { url = "https://files.pythonhosted.org/packages/b6/eb/a7679c8ac85208706d27436e8d421dfa39d4c914dcf5fa8083a9305f58d9/tomli-2.3.0-cp311-cp311-win32.whl", hash = "sha256:00b5f5d95bbfc7d12f91ad8c593a1659b6387b43f054104cda404be6bda62456", size = 96445, upload-time = "2025-10-08T22:01:06.896Z" }, - { url = "https://files.pythonhosted.org/packages/0a/fe/3d3420c4cb1ad9cb462fb52967080575f15898da97e21cb6f1361d505383/tomli-2.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:4dc4ce8483a5d429ab602f111a93a6ab1ed425eae3122032db7e9acf449451be", size = 107165, upload-time = "2025-10-08T22:01:08.107Z" }, - { url = "https://files.pythonhosted.org/packages/ff/b7/40f36368fcabc518bb11c8f06379a0fd631985046c038aca08c6d6a43c6e/tomli-2.3.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d7d86942e56ded512a594786a5ba0a5e521d02529b3826e7761a05138341a2ac", size = 154891, upload-time = "2025-10-08T22:01:09.082Z" }, - { url = "https://files.pythonhosted.org/packages/f9/3f/d9dd692199e3b3aab2e4e4dd948abd0f790d9ded8cd10cbaae276a898434/tomli-2.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:73ee0b47d4dad1c5e996e3cd33b8a76a50167ae5f96a2607cbe8cc773506ab22", size = 148796, upload-time = "2025-10-08T22:01:10.266Z" }, - { url = "https://files.pythonhosted.org/packages/60/83/59bff4996c2cf9f9387a0f5a3394629c7efa5ef16142076a23a90f1955fa/tomli-2.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:792262b94d5d0a466afb5bc63c7daa9d75520110971ee269152083270998316f", size = 242121, upload-time = "2025-10-08T22:01:11.332Z" }, - { url = "https://files.pythonhosted.org/packages/45/e5/7c5119ff39de8693d6baab6c0b6dcb556d192c165596e9fc231ea1052041/tomli-2.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4f195fe57ecceac95a66a75ac24d9d5fbc98ef0962e09b2eddec5d39375aae52", size = 250070, upload-time = "2025-10-08T22:01:12.498Z" }, - { url = "https://files.pythonhosted.org/packages/45/12/ad5126d3a278f27e6701abde51d342aa78d06e27ce2bb596a01f7709a5a2/tomli-2.3.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e31d432427dcbf4d86958c184b9bfd1e96b5b71f8eb17e6d02531f434fd335b8", size = 245859, upload-time = "2025-10-08T22:01:13.551Z" }, - { url = "https://files.pythonhosted.org/packages/fb/a1/4d6865da6a71c603cfe6ad0e6556c73c76548557a8d658f9e3b142df245f/tomli-2.3.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7b0882799624980785240ab732537fcfc372601015c00f7fc367c55308c186f6", size = 250296, upload-time = "2025-10-08T22:01:14.614Z" }, - { url = "https://files.pythonhosted.org/packages/a0/b7/a7a7042715d55c9ba6e8b196d65d2cb662578b4d8cd17d882d45322b0d78/tomli-2.3.0-cp312-cp312-win32.whl", hash = "sha256:ff72b71b5d10d22ecb084d345fc26f42b5143c5533db5e2eaba7d2d335358876", size = 97124, upload-time = "2025-10-08T22:01:15.629Z" }, - { url = "https://files.pythonhosted.org/packages/06/1e/f22f100db15a68b520664eb3328fb0ae4e90530887928558112c8d1f4515/tomli-2.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:1cb4ed918939151a03f33d4242ccd0aa5f11b3547d0cf30f7c74a408a5b99878", size = 107698, upload-time = "2025-10-08T22:01:16.51Z" }, - { url = "https://files.pythonhosted.org/packages/89/48/06ee6eabe4fdd9ecd48bf488f4ac783844fd777f547b8d1b61c11939974e/tomli-2.3.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5192f562738228945d7b13d4930baffda67b69425a7f0da96d360b0a3888136b", size = 154819, upload-time = "2025-10-08T22:01:17.964Z" }, - { url = "https://files.pythonhosted.org/packages/f1/01/88793757d54d8937015c75dcdfb673c65471945f6be98e6a0410fba167ed/tomli-2.3.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:be71c93a63d738597996be9528f4abe628d1adf5e6eb11607bc8fe1a510b5dae", size = 148766, upload-time = "2025-10-08T22:01:18.959Z" }, - { url = "https://files.pythonhosted.org/packages/42/17/5e2c956f0144b812e7e107f94f1cc54af734eb17b5191c0bbfb72de5e93e/tomli-2.3.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c4665508bcbac83a31ff8ab08f424b665200c0e1e645d2bd9ab3d3e557b6185b", size = 240771, upload-time = "2025-10-08T22:01:20.106Z" }, - { url = "https://files.pythonhosted.org/packages/d5/f4/0fbd014909748706c01d16824eadb0307115f9562a15cbb012cd9b3512c5/tomli-2.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4021923f97266babc6ccab9f5068642a0095faa0a51a246a6a02fccbb3514eaf", size = 248586, upload-time = "2025-10-08T22:01:21.164Z" }, - { url = "https://files.pythonhosted.org/packages/30/77/fed85e114bde5e81ecf9bc5da0cc69f2914b38f4708c80ae67d0c10180c5/tomli-2.3.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a4ea38c40145a357d513bffad0ed869f13c1773716cf71ccaa83b0fa0cc4e42f", size = 244792, upload-time = "2025-10-08T22:01:22.417Z" }, - { url = "https://files.pythonhosted.org/packages/55/92/afed3d497f7c186dc71e6ee6d4fcb0acfa5f7d0a1a2878f8beae379ae0cc/tomli-2.3.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ad805ea85eda330dbad64c7ea7a4556259665bdf9d2672f5dccc740eb9d3ca05", size = 248909, upload-time = "2025-10-08T22:01:23.859Z" }, - { url = "https://files.pythonhosted.org/packages/f8/84/ef50c51b5a9472e7265ce1ffc7f24cd4023d289e109f669bdb1553f6a7c2/tomli-2.3.0-cp313-cp313-win32.whl", hash = "sha256:97d5eec30149fd3294270e889b4234023f2c69747e555a27bd708828353ab606", size = 96946, upload-time = "2025-10-08T22:01:24.893Z" }, - { url = "https://files.pythonhosted.org/packages/b2/b7/718cd1da0884f281f95ccfa3a6cc572d30053cba64603f79d431d3c9b61b/tomli-2.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:0c95ca56fbe89e065c6ead5b593ee64b84a26fca063b5d71a1122bf26e533999", size = 107705, upload-time = "2025-10-08T22:01:26.153Z" }, - { url = "https://files.pythonhosted.org/packages/19/94/aeafa14a52e16163008060506fcb6aa1949d13548d13752171a755c65611/tomli-2.3.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:cebc6fe843e0733ee827a282aca4999b596241195f43b4cc371d64fc6639da9e", size = 154244, upload-time = "2025-10-08T22:01:27.06Z" }, - { url = "https://files.pythonhosted.org/packages/db/e4/1e58409aa78eefa47ccd19779fc6f36787edbe7d4cd330eeeedb33a4515b/tomli-2.3.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:4c2ef0244c75aba9355561272009d934953817c49f47d768070c3c94355c2aa3", size = 148637, upload-time = "2025-10-08T22:01:28.059Z" }, - { url = "https://files.pythonhosted.org/packages/26/b6/d1eccb62f665e44359226811064596dd6a366ea1f985839c566cd61525ae/tomli-2.3.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c22a8bf253bacc0cf11f35ad9808b6cb75ada2631c2d97c971122583b129afbc", size = 241925, upload-time = "2025-10-08T22:01:29.066Z" }, - { url = "https://files.pythonhosted.org/packages/70/91/7cdab9a03e6d3d2bb11beae108da5bdc1c34bdeb06e21163482544ddcc90/tomli-2.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0eea8cc5c5e9f89c9b90c4896a8deefc74f518db5927d0e0e8d4a80953d774d0", size = 249045, upload-time = "2025-10-08T22:01:31.98Z" }, - { url = "https://files.pythonhosted.org/packages/15/1b/8c26874ed1f6e4f1fcfeb868db8a794cbe9f227299402db58cfcc858766c/tomli-2.3.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:b74a0e59ec5d15127acdabd75ea17726ac4c5178ae51b85bfe39c4f8a278e879", size = 245835, upload-time = "2025-10-08T22:01:32.989Z" }, - { url = "https://files.pythonhosted.org/packages/fd/42/8e3c6a9a4b1a1360c1a2a39f0b972cef2cc9ebd56025168c4137192a9321/tomli-2.3.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b5870b50c9db823c595983571d1296a6ff3e1b88f734a4c8f6fc6188397de005", size = 253109, upload-time = "2025-10-08T22:01:34.052Z" }, - { url = "https://files.pythonhosted.org/packages/22/0c/b4da635000a71b5f80130937eeac12e686eefb376b8dee113b4a582bba42/tomli-2.3.0-cp314-cp314-win32.whl", hash = "sha256:feb0dacc61170ed7ab602d3d972a58f14ee3ee60494292d384649a3dc38ef463", size = 97930, upload-time = "2025-10-08T22:01:35.082Z" }, - { url = "https://files.pythonhosted.org/packages/b9/74/cb1abc870a418ae99cd5c9547d6bce30701a954e0e721821df483ef7223c/tomli-2.3.0-cp314-cp314-win_amd64.whl", hash = "sha256:b273fcbd7fc64dc3600c098e39136522650c49bca95df2d11cf3b626422392c8", size = 107964, upload-time = "2025-10-08T22:01:36.057Z" }, - { url = "https://files.pythonhosted.org/packages/54/78/5c46fff6432a712af9f792944f4fcd7067d8823157949f4e40c56b8b3c83/tomli-2.3.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:940d56ee0410fa17ee1f12b817b37a4d4e4dc4d27340863cc67236c74f582e77", size = 163065, upload-time = "2025-10-08T22:01:37.27Z" }, - { url = "https://files.pythonhosted.org/packages/39/67/f85d9bd23182f45eca8939cd2bc7050e1f90c41f4a2ecbbd5963a1d1c486/tomli-2.3.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f85209946d1fe94416debbb88d00eb92ce9cd5266775424ff81bc959e001acaf", size = 159088, upload-time = "2025-10-08T22:01:38.235Z" }, - { url = "https://files.pythonhosted.org/packages/26/5a/4b546a0405b9cc0659b399f12b6adb750757baf04250b148d3c5059fc4eb/tomli-2.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a56212bdcce682e56b0aaf79e869ba5d15a6163f88d5451cbde388d48b13f530", size = 268193, upload-time = "2025-10-08T22:01:39.712Z" }, - { url = "https://files.pythonhosted.org/packages/42/4f/2c12a72ae22cf7b59a7fe75b3465b7aba40ea9145d026ba41cb382075b0e/tomli-2.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c5f3ffd1e098dfc032d4d3af5c0ac64f6d286d98bc148698356847b80fa4de1b", size = 275488, upload-time = "2025-10-08T22:01:40.773Z" }, - { url = "https://files.pythonhosted.org/packages/92/04/a038d65dbe160c3aa5a624e93ad98111090f6804027d474ba9c37c8ae186/tomli-2.3.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5e01decd096b1530d97d5d85cb4dff4af2d8347bd35686654a004f8dea20fc67", size = 272669, upload-time = "2025-10-08T22:01:41.824Z" }, - { url = "https://files.pythonhosted.org/packages/be/2f/8b7c60a9d1612a7cbc39ffcca4f21a73bf368a80fc25bccf8253e2563267/tomli-2.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:8a35dd0e643bb2610f156cca8db95d213a90015c11fee76c946aa62b7ae7e02f", size = 279709, upload-time = "2025-10-08T22:01:43.177Z" }, - { url = "https://files.pythonhosted.org/packages/7e/46/cc36c679f09f27ded940281c38607716c86cf8ba4a518d524e349c8b4874/tomli-2.3.0-cp314-cp314t-win32.whl", hash = "sha256:a1f7f282fe248311650081faafa5f4732bdbfef5d45fe3f2e702fbc6f2d496e0", size = 107563, upload-time = "2025-10-08T22:01:44.233Z" }, - { url = "https://files.pythonhosted.org/packages/84/ff/426ca8683cf7b753614480484f6437f568fd2fda2edbdf57a2d3d8b27a0b/tomli-2.3.0-cp314-cp314t-win_amd64.whl", hash = "sha256:70a251f8d4ba2d9ac2542eecf008b3c8a9fc5c3f9f02c56a9d7952612be2fdba", size = 119756, upload-time = "2025-10-08T22:01:45.234Z" }, - { url = "https://files.pythonhosted.org/packages/77/b8/0135fadc89e73be292b473cb820b4f5a08197779206b33191e801feeae40/tomli-2.3.0-py3-none-any.whl", hash = "sha256:e95b1af3c5b07d9e643909b5abbec77cd9f1217e6d0bca72b0234736b9fb1f1b", size = 14408, upload-time = "2025-10-08T22:01:46.04Z" }, + { url = "https://files.pythonhosted.org/packages/f4/11/db3d5885d8528263d8adc260bb2d28ebf1270b96e98f0e0268d32b8d9900/tomli-2.4.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f8f0fc26ec2cc2b965b7a3b87cd19c5c6b8c5e5f436b984e85f486d652285c30", size = 154704, upload-time = "2026-03-25T20:21:10.473Z" }, + { url = "https://files.pythonhosted.org/packages/6d/f7/675db52c7e46064a9aa928885a9b20f4124ecb9bc2e1ce74c9106648d202/tomli-2.4.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4ab97e64ccda8756376892c53a72bd1f964e519c77236368527f758fbc36a53a", size = 149454, upload-time = "2026-03-25T20:21:12.036Z" }, + { url = "https://files.pythonhosted.org/packages/61/71/81c50943cf953efa35bce7646caab3cf457a7d8c030b27cfb40d7235f9ee/tomli-2.4.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:96481a5786729fd470164b47cdb3e0e58062a496f455ee41b4403be77cb5a076", size = 237561, upload-time = "2026-03-25T20:21:13.098Z" }, + { url = "https://files.pythonhosted.org/packages/48/c1/f41d9cb618acccca7df82aaf682f9b49013c9397212cb9f53219e3abac37/tomli-2.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5a881ab208c0baf688221f8cecc5401bd291d67e38a1ac884d6736cbcd8247e9", size = 243824, upload-time = "2026-03-25T20:21:14.569Z" }, + { url = "https://files.pythonhosted.org/packages/22/e4/5a816ecdd1f8ca51fb756ef684b90f2780afc52fc67f987e3c61d800a46d/tomli-2.4.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:47149d5bd38761ac8be13a84864bf0b7b70bc051806bc3669ab1cbc56216b23c", size = 242227, upload-time = "2026-03-25T20:21:15.712Z" }, + { url = "https://files.pythonhosted.org/packages/6b/49/2b2a0ef529aa6eec245d25f0c703e020a73955ad7edf73e7f54ddc608aa5/tomli-2.4.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ec9bfaf3ad2df51ace80688143a6a4ebc09a248f6ff781a9945e51937008fcbc", size = 247859, upload-time = "2026-03-25T20:21:17.001Z" }, + { url = "https://files.pythonhosted.org/packages/83/bd/6c1a630eaca337e1e78c5903104f831bda934c426f9231429396ce3c3467/tomli-2.4.1-cp311-cp311-win32.whl", hash = "sha256:ff2983983d34813c1aeb0fa89091e76c3a22889ee83ab27c5eeb45100560c049", size = 97204, upload-time = "2026-03-25T20:21:18.079Z" }, + { url = "https://files.pythonhosted.org/packages/42/59/71461df1a885647e10b6bb7802d0b8e66480c61f3f43079e0dcd315b3954/tomli-2.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:5ee18d9ebdb417e384b58fe414e8d6af9f4e7a0ae761519fb50f721de398dd4e", size = 108084, upload-time = "2026-03-25T20:21:18.978Z" }, + { url = "https://files.pythonhosted.org/packages/b8/83/dceca96142499c069475b790e7913b1044c1a4337e700751f48ed723f883/tomli-2.4.1-cp311-cp311-win_arm64.whl", hash = "sha256:c2541745709bad0264b7d4705ad453b76ccd191e64aa6f0fc66b69a293a45ece", size = 95285, upload-time = "2026-03-25T20:21:20.309Z" }, + { url = "https://files.pythonhosted.org/packages/c1/ba/42f134a3fe2b370f555f44b1d72feebb94debcab01676bf918d0cb70e9aa/tomli-2.4.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:c742f741d58a28940ce01d58f0ab2ea3ced8b12402f162f4d534dfe18ba1cd6a", size = 155924, upload-time = "2026-03-25T20:21:21.626Z" }, + { url = "https://files.pythonhosted.org/packages/dc/c7/62d7a17c26487ade21c5422b646110f2162f1fcc95980ef7f63e73c68f14/tomli-2.4.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:7f86fd587c4ed9dd76f318225e7d9b29cfc5a9d43de44e5754db8d1128487085", size = 150018, upload-time = "2026-03-25T20:21:23.002Z" }, + { url = "https://files.pythonhosted.org/packages/5c/05/79d13d7c15f13bdef410bdd49a6485b1c37d28968314eabee452c22a7fda/tomli-2.4.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ff18e6a727ee0ab0388507b89d1bc6a22b138d1e2fa56d1ad494586d61d2eae9", size = 244948, upload-time = "2026-03-25T20:21:24.04Z" }, + { url = "https://files.pythonhosted.org/packages/10/90/d62ce007a1c80d0b2c93e02cab211224756240884751b94ca72df8a875ca/tomli-2.4.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:136443dbd7e1dee43c68ac2694fde36b2849865fa258d39bf822c10e8068eac5", size = 253341, upload-time = "2026-03-25T20:21:25.177Z" }, + { url = "https://files.pythonhosted.org/packages/1a/7e/caf6496d60152ad4ed09282c1885cca4eea150bfd007da84aea07bcc0a3e/tomli-2.4.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:5e262d41726bc187e69af7825504c933b6794dc3fbd5945e41a79bb14c31f585", size = 248159, upload-time = "2026-03-25T20:21:26.364Z" }, + { url = "https://files.pythonhosted.org/packages/99/e7/c6f69c3120de34bbd882c6fba7975f3d7a746e9218e56ab46a1bc4b42552/tomli-2.4.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:5cb41aa38891e073ee49d55fbc7839cfdb2bc0e600add13874d048c94aadddd1", size = 253290, upload-time = "2026-03-25T20:21:27.46Z" }, + { url = "https://files.pythonhosted.org/packages/d6/2f/4a3c322f22c5c66c4b836ec58211641a4067364f5dcdd7b974b4c5da300c/tomli-2.4.1-cp312-cp312-win32.whl", hash = "sha256:da25dc3563bff5965356133435b757a795a17b17d01dbc0f42fb32447ddfd917", size = 98141, upload-time = "2026-03-25T20:21:28.492Z" }, + { url = "https://files.pythonhosted.org/packages/24/22/4daacd05391b92c55759d55eaee21e1dfaea86ce5c571f10083360adf534/tomli-2.4.1-cp312-cp312-win_amd64.whl", hash = "sha256:52c8ef851d9a240f11a88c003eacb03c31fc1c9c4ec64a99a0f922b93874fda9", size = 108847, upload-time = "2026-03-25T20:21:29.386Z" }, + { url = "https://files.pythonhosted.org/packages/68/fd/70e768887666ddd9e9f5d85129e84910f2db2796f9096aa02b721a53098d/tomli-2.4.1-cp312-cp312-win_arm64.whl", hash = "sha256:f758f1b9299d059cc3f6546ae2af89670cb1c4d48ea29c3cacc4fe7de3058257", size = 95088, upload-time = "2026-03-25T20:21:30.677Z" }, + { url = "https://files.pythonhosted.org/packages/07/06/b823a7e818c756d9a7123ba2cda7d07bc2dd32835648d1a7b7b7a05d848d/tomli-2.4.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:36d2bd2ad5fb9eaddba5226aa02c8ec3fa4f192631e347b3ed28186d43be6b54", size = 155866, upload-time = "2026-03-25T20:21:31.65Z" }, + { url = "https://files.pythonhosted.org/packages/14/6f/12645cf7f08e1a20c7eb8c297c6f11d31c1b50f316a7e7e1e1de6e2e7b7e/tomli-2.4.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:eb0dc4e38e6a1fd579e5d50369aa2e10acfc9cace504579b2faabb478e76941a", size = 149887, upload-time = "2026-03-25T20:21:33.028Z" }, + { url = "https://files.pythonhosted.org/packages/5c/e0/90637574e5e7212c09099c67ad349b04ec4d6020324539297b634a0192b0/tomli-2.4.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c7f2c7f2b9ca6bdeef8f0fa897f8e05085923eb091721675170254cbc5b02897", size = 243704, upload-time = "2026-03-25T20:21:34.51Z" }, + { url = "https://files.pythonhosted.org/packages/10/8f/d3ddb16c5a4befdf31a23307f72828686ab2096f068eaf56631e136c1fdd/tomli-2.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f3c6818a1a86dd6dca7ddcaaf76947d5ba31aecc28cb1b67009a5877c9a64f3f", size = 251628, upload-time = "2026-03-25T20:21:36.012Z" }, + { url = "https://files.pythonhosted.org/packages/e3/f1/dbeeb9116715abee2485bf0a12d07a8f31af94d71608c171c45f64c0469d/tomli-2.4.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:d312ef37c91508b0ab2cee7da26ec0b3ed2f03ce12bd87a588d771ae15dcf82d", size = 247180, upload-time = "2026-03-25T20:21:37.136Z" }, + { url = "https://files.pythonhosted.org/packages/d3/74/16336ffd19ed4da28a70959f92f506233bd7cfc2332b20bdb01591e8b1d1/tomli-2.4.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:51529d40e3ca50046d7606fa99ce3956a617f9b36380da3b7f0dd3dd28e68cb5", size = 251674, upload-time = "2026-03-25T20:21:38.298Z" }, + { url = "https://files.pythonhosted.org/packages/16/f9/229fa3434c590ddf6c0aa9af64d3af4b752540686cace29e6281e3458469/tomli-2.4.1-cp313-cp313-win32.whl", hash = "sha256:2190f2e9dd7508d2a90ded5ed369255980a1bcdd58e52f7fe24b8162bf9fedbd", size = 97976, upload-time = "2026-03-25T20:21:39.316Z" }, + { url = "https://files.pythonhosted.org/packages/6a/1e/71dfd96bcc1c775420cb8befe7a9d35f2e5b1309798f009dca17b7708c1e/tomli-2.4.1-cp313-cp313-win_amd64.whl", hash = "sha256:8d65a2fbf9d2f8352685bc1364177ee3923d6baf5e7f43ea4959d7d8bc326a36", size = 108755, upload-time = "2026-03-25T20:21:40.248Z" }, + { url = "https://files.pythonhosted.org/packages/83/7a/d34f422a021d62420b78f5c538e5b102f62bea616d1d75a13f0a88acb04a/tomli-2.4.1-cp313-cp313-win_arm64.whl", hash = "sha256:4b605484e43cdc43f0954ddae319fb75f04cc10dd80d830540060ee7cd0243cd", size = 95265, upload-time = "2026-03-25T20:21:41.219Z" }, + { url = "https://files.pythonhosted.org/packages/3c/fb/9a5c8d27dbab540869f7c1f8eb0abb3244189ce780ba9cd73f3770662072/tomli-2.4.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:fd0409a3653af6c147209d267a0e4243f0ae46b011aa978b1080359fddc9b6cf", size = 155726, upload-time = "2026-03-25T20:21:42.23Z" }, + { url = "https://files.pythonhosted.org/packages/62/05/d2f816630cc771ad836af54f5001f47a6f611d2d39535364f148b6a92d6b/tomli-2.4.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:a120733b01c45e9a0c34aeef92bf0cf1d56cfe81ed9d47d562f9ed591a9828ac", size = 149859, upload-time = "2026-03-25T20:21:43.386Z" }, + { url = "https://files.pythonhosted.org/packages/ce/48/66341bdb858ad9bd0ceab5a86f90eddab127cf8b046418009f2125630ecb/tomli-2.4.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:559db847dc486944896521f68d8190be1c9e719fced785720d2216fe7022b662", size = 244713, upload-time = "2026-03-25T20:21:44.474Z" }, + { url = "https://files.pythonhosted.org/packages/df/6d/c5fad00d82b3c7a3ab6189bd4b10e60466f22cfe8a08a9394185c8a8111c/tomli-2.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:01f520d4f53ef97964a240a035ec2a869fe1a37dde002b57ebc4417a27ccd853", size = 252084, upload-time = "2026-03-25T20:21:45.62Z" }, + { url = "https://files.pythonhosted.org/packages/00/71/3a69e86f3eafe8c7a59d008d245888051005bd657760e96d5fbfb0b740c2/tomli-2.4.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7f94b27a62cfad8496c8d2513e1a222dd446f095fca8987fceef261225538a15", size = 247973, upload-time = "2026-03-25T20:21:46.937Z" }, + { url = "https://files.pythonhosted.org/packages/67/50/361e986652847fec4bd5e4a0208752fbe64689c603c7ae5ea7cb16b1c0ca/tomli-2.4.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:ede3e6487c5ef5d28634ba3f31f989030ad6af71edfb0055cbbd14189ff240ba", size = 256223, upload-time = "2026-03-25T20:21:48.467Z" }, + { url = "https://files.pythonhosted.org/packages/8c/9a/b4173689a9203472e5467217e0154b00e260621caa227b6fa01feab16998/tomli-2.4.1-cp314-cp314-win32.whl", hash = "sha256:3d48a93ee1c9b79c04bb38772ee1b64dcf18ff43085896ea460ca8dec96f35f6", size = 98973, upload-time = "2026-03-25T20:21:49.526Z" }, + { url = "https://files.pythonhosted.org/packages/14/58/640ac93bf230cd27d002462c9af0d837779f8773bc03dee06b5835208214/tomli-2.4.1-cp314-cp314-win_amd64.whl", hash = "sha256:88dceee75c2c63af144e456745e10101eb67361050196b0b6af5d717254dddf7", size = 109082, upload-time = "2026-03-25T20:21:50.506Z" }, + { url = "https://files.pythonhosted.org/packages/d5/2f/702d5e05b227401c1068f0d386d79a589bb12bf64c3d2c72ce0631e3bc49/tomli-2.4.1-cp314-cp314-win_arm64.whl", hash = "sha256:b8c198f8c1805dc42708689ed6864951fd2494f924149d3e4bce7710f8eb5232", size = 96490, upload-time = "2026-03-25T20:21:51.474Z" }, + { url = "https://files.pythonhosted.org/packages/45/4b/b877b05c8ba62927d9865dd980e34a755de541eb65fffba52b4cc495d4d2/tomli-2.4.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:d4d8fe59808a54658fcc0160ecfb1b30f9089906c50b23bcb4c69eddc19ec2b4", size = 164263, upload-time = "2026-03-25T20:21:52.543Z" }, + { url = "https://files.pythonhosted.org/packages/24/79/6ab420d37a270b89f7195dec5448f79400d9e9c1826df982f3f8e97b24fd/tomli-2.4.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:7008df2e7655c495dd12d2a4ad038ff878d4ca4b81fccaf82b714e07eae4402c", size = 160736, upload-time = "2026-03-25T20:21:53.674Z" }, + { url = "https://files.pythonhosted.org/packages/02/e0/3630057d8eb170310785723ed5adcdfb7d50cb7e6455f85ba8a3deed642b/tomli-2.4.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1d8591993e228b0c930c4bb0db464bdad97b3289fb981255d6c9a41aedc84b2d", size = 270717, upload-time = "2026-03-25T20:21:55.129Z" }, + { url = "https://files.pythonhosted.org/packages/7a/b4/1613716072e544d1a7891f548d8f9ec6ce2faf42ca65acae01d76ea06bb0/tomli-2.4.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:734e20b57ba95624ecf1841e72b53f6e186355e216e5412de414e3c51e5e3c41", size = 278461, upload-time = "2026-03-25T20:21:56.228Z" }, + { url = "https://files.pythonhosted.org/packages/05/38/30f541baf6a3f6df77b3df16b01ba319221389e2da59427e221ef417ac0c/tomli-2.4.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:8a650c2dbafa08d42e51ba0b62740dae4ecb9338eefa093aa5c78ceb546fcd5c", size = 274855, upload-time = "2026-03-25T20:21:57.653Z" }, + { url = "https://files.pythonhosted.org/packages/77/a3/ec9dd4fd2c38e98de34223b995a3b34813e6bdadf86c75314c928350ed14/tomli-2.4.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:504aa796fe0569bb43171066009ead363de03675276d2d121ac1a4572397870f", size = 283144, upload-time = "2026-03-25T20:21:59.089Z" }, + { url = "https://files.pythonhosted.org/packages/ef/be/605a6261cac79fba2ec0c9827e986e00323a1945700969b8ee0b30d85453/tomli-2.4.1-cp314-cp314t-win32.whl", hash = "sha256:b1d22e6e9387bf4739fbe23bfa80e93f6b0373a7f1b96c6227c32bef95a4d7a8", size = 108683, upload-time = "2026-03-25T20:22:00.214Z" }, + { url = "https://files.pythonhosted.org/packages/12/64/da524626d3b9cc40c168a13da8335fe1c51be12c0a63685cc6db7308daae/tomli-2.4.1-cp314-cp314t-win_amd64.whl", hash = "sha256:2c1c351919aca02858f740c6d33adea0c5deea37f9ecca1cc1ef9e884a619d26", size = 121196, upload-time = "2026-03-25T20:22:01.169Z" }, + { url = "https://files.pythonhosted.org/packages/5a/cd/e80b62269fc78fc36c9af5a6b89c835baa8af28ff5ad28c7028d60860320/tomli-2.4.1-cp314-cp314t-win_arm64.whl", hash = "sha256:eab21f45c7f66c13f2a9e0e1535309cee140182a9cdae1e041d02e47291e8396", size = 100393, upload-time = "2026-03-25T20:22:02.137Z" }, + { url = "https://files.pythonhosted.org/packages/7b/61/cceae43728b7de99d9b847560c262873a1f6c98202171fd5ed62640b494b/tomli-2.4.1-py3-none-any.whl", hash = "sha256:0d85819802132122da43cb86656f8d1f8c6587d54ae7dcaf30e90533028b49fe", size = 14583, upload-time = "2026-03-25T20:22:03.012Z" }, ] [[package]] @@ -1920,32 +2139,32 @@ wheels = [ [[package]] name = "typing-extensions" -version = "4.15.0" +version = "4.16.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/72/94/1a15dd82efb362ac84269196e94cf00f187f7ed21c242792a923cdb1c61f/typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466", size = 109391, upload-time = "2025-08-25T13:49:26.313Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555, upload-time = "2026-07-02T08:40:05.92Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614, upload-time = "2025-08-25T13:49:24.86Z" }, + { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" }, ] [[package]] name = "typing-inspection" -version = "0.4.2" +version = "0.4.4" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/55/e3/70399cb7dd41c10ac53367ae42139cf4b1ca5f36bb3dc6c9d33acdb43655/typing_inspection-0.4.2.tar.gz", hash = "sha256:ba561c48a67c5958007083d386c3295464928b01faa735ab8547c5692e87f464", size = 75949, upload-time = "2025-10-01T02:14:41.687Z" } +sdist = { url = "https://files.pythonhosted.org/packages/a3/26/b09b8010994eccc3c09092e6b34058f36a460eea2d4c3e8b910c695975a0/typing_inspection-0.4.4.tar.gz", hash = "sha256:547274fa6b0a561ccf549cc9524b999a578e737d015d8709d021f9d0d13bea47", size = 76928, upload-time = "2026-08-12T12:37:25.997Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/dc/9b/47798a6c91d8bdb567fe2698fe81e0c6b7cb7ef4d13da4114b41d239f65d/typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7", size = 14611, upload-time = "2025-10-01T02:14:40.154Z" }, + { url = "https://files.pythonhosted.org/packages/67/81/4add07e5172b7ac40d8ed5ff580409a7801a4fe26d529bdd915401dabfbe/typing_inspection-0.4.4-py3-none-any.whl", hash = "sha256:65b8397ba37ccbce054456aaccddfc91e6e3083c92824df348d96ca832f3f147", size = 14750, upload-time = "2026-08-12T12:37:24.648Z" }, ] [[package]] name = "uncalled-for" -version = "0.2.0" +version = "0.4.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/02/7c/b5b7d8136f872e3f13b0584e576886de0489d7213a12de6bebf29ff6ebfc/uncalled_for-0.2.0.tar.gz", hash = "sha256:b4f8fdbcec328c5a113807d653e041c5094473dd4afa7c34599ace69ccb7e69f", size = 49488, upload-time = "2026-02-27T17:40:58.137Z" } +sdist = { url = "https://files.pythonhosted.org/packages/6b/5a/92ce0b3ea5481915f55da994c2c2c5f7a3c09949afde196ee89f8ab961aa/uncalled_for-0.4.0.tar.gz", hash = "sha256:335b95bd2422332ec210d518f314a16e4c640921c39fc8bf2ad095bd3538f4af", size = 56979, upload-time = "2026-08-10T14:51:46.247Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/ff/7f/4320d9ce3be404e6310b915c3629fe27bf1e2f438a1a7a3cb0396e32e9a9/uncalled_for-0.2.0-py3-none-any.whl", hash = "sha256:2c0bd338faff5f930918f79e7eb9ff48290df2cb05fcc0b40a7f334e55d4d85f", size = 11351, upload-time = "2026-02-27T17:40:56.804Z" }, + { url = "https://files.pythonhosted.org/packages/a2/40/97cec87c077eb3291fc7905e6633e08b7ca593c57d30238444bcb6bb3d53/uncalled_for-0.4.0-py3-none-any.whl", hash = "sha256:16c4bb3337532e4bd5569adc192285976f3ad5305402256d34c67a12b5c968bd", size = 15502, upload-time = "2026-08-10T14:51:45.068Z" }, ] [[package]] @@ -1959,185 +2178,422 @@ wheels = [ [[package]] name = "uvicorn" -version = "0.38.0" +version = "0.52.4" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "click" }, { name = "h11" }, { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/cb/ce/f06b84e2697fef4688ca63bdb2fdf113ca0a3be33f94488f2cadb690b0cf/uvicorn-0.38.0.tar.gz", hash = "sha256:fd97093bdd120a2609fc0d3afe931d4d4ad688b6e75f0f929fde1bc36fe0e91d", size = 80605, upload-time = "2025-10-18T13:46:44.63Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f2/0f/3f86e61397dd33bf2ccf28188c40db6a740658aeebbbf6e7dbc101a1f487/uvicorn-0.52.4.tar.gz", hash = "sha256:73acfee47a0b133c5de13d219492d62d8a31e935f4fe6e41a232451a15379f86", size = 100627, upload-time = "2026-08-19T06:27:41.821Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/ee/d9/d88e73ca598f4f6ff671fb5fde8a32925c2e08a637303a1d12883c7305fa/uvicorn-0.38.0-py3-none-any.whl", hash = "sha256:48c0afd214ceb59340075b4a052ea1ee91c16fbc2a9b1469cca0e54566977b02", size = 68109, upload-time = "2025-10-18T13:46:42.958Z" }, + { url = "https://files.pythonhosted.org/packages/f1/79/4a20b54ab0491485ccd8c077db2d39187c7f12b3e15485d38a7be37c81b4/uvicorn-0.52.4-py3-none-any.whl", hash = "sha256:f86e41a149d7d05a9969337e3946a9c171c06a5d42680896daaba624aeac8da1", size = 79871, upload-time = "2026-08-19T06:27:40.36Z" }, ] [[package]] name = "watchfiles" -version = "1.1.1" +version = "1.2.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/c2/c9/8869df9b2a2d6c59d79220a4db37679e74f807c559ffe5265e08b227a210/watchfiles-1.1.1.tar.gz", hash = "sha256:a173cb5c16c4f40ab19cecf48a534c409f7ea983ab8fed0741304a1c0a31b3f2", size = 94440, upload-time = "2025-10-14T15:06:21.08Z" } +sdist = { url = "https://files.pythonhosted.org/packages/cd/41/5e1a4bb12aac5f1493fa1bdc11154eca3b258ca4eba65d39c473fe19d8e9/watchfiles-1.2.0.tar.gz", hash = "sha256:c995fba777f1ea992f090f9236e9284cf7a5d1a0130dd5a3d82c598cacd76838", size = 108252, upload-time = "2026-05-18T04:32:04.251Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/a7/1a/206e8cf2dd86fddf939165a57b4df61607a1e0add2785f170a3f616b7d9f/watchfiles-1.1.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:eef58232d32daf2ac67f42dea51a2c80f0d03379075d44a587051e63cc2e368c", size = 407318, upload-time = "2025-10-14T15:04:18.753Z" }, - { url = "https://files.pythonhosted.org/packages/b3/0f/abaf5262b9c496b5dad4ed3c0e799cbecb1f8ea512ecb6ddd46646a9fca3/watchfiles-1.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:03fa0f5237118a0c5e496185cafa92878568b652a2e9a9382a5151b1a0380a43", size = 394478, upload-time = "2025-10-14T15:04:20.297Z" }, - { url = "https://files.pythonhosted.org/packages/b1/04/9cc0ba88697b34b755371f5ace8d3a4d9a15719c07bdc7bd13d7d8c6a341/watchfiles-1.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8ca65483439f9c791897f7db49202301deb6e15fe9f8fe2fed555bf986d10c31", size = 449894, upload-time = "2025-10-14T15:04:21.527Z" }, - { url = "https://files.pythonhosted.org/packages/d2/9c/eda4615863cd8621e89aed4df680d8c3ec3da6a4cf1da113c17decd87c7f/watchfiles-1.1.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f0ab1c1af0cb38e3f598244c17919fb1a84d1629cc08355b0074b6d7f53138ac", size = 459065, upload-time = "2025-10-14T15:04:22.795Z" }, - { url = "https://files.pythonhosted.org/packages/84/13/f28b3f340157d03cbc8197629bc109d1098764abe1e60874622a0be5c112/watchfiles-1.1.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3bc570d6c01c206c46deb6e935a260be44f186a2f05179f52f7fcd2be086a94d", size = 488377, upload-time = "2025-10-14T15:04:24.138Z" }, - { url = "https://files.pythonhosted.org/packages/86/93/cfa597fa9389e122488f7ffdbd6db505b3b915ca7435ecd7542e855898c2/watchfiles-1.1.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e84087b432b6ac94778de547e08611266f1f8ffad28c0ee4c82e028b0fc5966d", size = 595837, upload-time = "2025-10-14T15:04:25.057Z" }, - { url = "https://files.pythonhosted.org/packages/57/1e/68c1ed5652b48d89fc24d6af905d88ee4f82fa8bc491e2666004e307ded1/watchfiles-1.1.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:620bae625f4cb18427b1bb1a2d9426dc0dd5a5ba74c7c2cdb9de405f7b129863", size = 473456, upload-time = "2025-10-14T15:04:26.497Z" }, - { url = "https://files.pythonhosted.org/packages/d5/dc/1a680b7458ffa3b14bb64878112aefc8f2e4f73c5af763cbf0bd43100658/watchfiles-1.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:544364b2b51a9b0c7000a4b4b02f90e9423d97fbbf7e06689236443ebcad81ab", size = 455614, upload-time = "2025-10-14T15:04:27.539Z" }, - { url = "https://files.pythonhosted.org/packages/61/a5/3d782a666512e01eaa6541a72ebac1d3aae191ff4a31274a66b8dd85760c/watchfiles-1.1.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:bbe1ef33d45bc71cf21364df962af171f96ecaeca06bd9e3d0b583efb12aec82", size = 630690, upload-time = "2025-10-14T15:04:28.495Z" }, - { url = "https://files.pythonhosted.org/packages/9b/73/bb5f38590e34687b2a9c47a244aa4dd50c56a825969c92c9c5fc7387cea1/watchfiles-1.1.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:1a0bb430adb19ef49389e1ad368450193a90038b5b752f4ac089ec6942c4dff4", size = 622459, upload-time = "2025-10-14T15:04:29.491Z" }, - { url = "https://files.pythonhosted.org/packages/f1/ac/c9bb0ec696e07a20bd58af5399aeadaef195fb2c73d26baf55180fe4a942/watchfiles-1.1.1-cp310-cp310-win32.whl", hash = "sha256:3f6d37644155fb5beca5378feb8c1708d5783145f2a0f1c4d5a061a210254844", size = 272663, upload-time = "2025-10-14T15:04:30.435Z" }, - { url = "https://files.pythonhosted.org/packages/11/a0/a60c5a7c2ec59fa062d9a9c61d02e3b6abd94d32aac2d8344c4bdd033326/watchfiles-1.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:a36d8efe0f290835fd0f33da35042a1bb5dc0e83cbc092dcf69bce442579e88e", size = 287453, upload-time = "2025-10-14T15:04:31.53Z" }, - { url = "https://files.pythonhosted.org/packages/1f/f8/2c5f479fb531ce2f0564eda479faecf253d886b1ab3630a39b7bf7362d46/watchfiles-1.1.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:f57b396167a2565a4e8b5e56a5a1c537571733992b226f4f1197d79e94cf0ae5", size = 406529, upload-time = "2025-10-14T15:04:32.899Z" }, - { url = "https://files.pythonhosted.org/packages/fe/cd/f515660b1f32f65df671ddf6f85bfaca621aee177712874dc30a97397977/watchfiles-1.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:421e29339983e1bebc281fab40d812742268ad057db4aee8c4d2bce0af43b741", size = 394384, upload-time = "2025-10-14T15:04:33.761Z" }, - { url = "https://files.pythonhosted.org/packages/7b/c3/28b7dc99733eab43fca2d10f55c86e03bd6ab11ca31b802abac26b23d161/watchfiles-1.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6e43d39a741e972bab5d8100b5cdacf69db64e34eb19b6e9af162bccf63c5cc6", size = 448789, upload-time = "2025-10-14T15:04:34.679Z" }, - { url = "https://files.pythonhosted.org/packages/4a/24/33e71113b320030011c8e4316ccca04194bf0cbbaeee207f00cbc7d6b9f5/watchfiles-1.1.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f537afb3276d12814082a2e9b242bdcf416c2e8fd9f799a737990a1dbe906e5b", size = 460521, upload-time = "2025-10-14T15:04:35.963Z" }, - { url = "https://files.pythonhosted.org/packages/f4/c3/3c9a55f255aa57b91579ae9e98c88704955fa9dac3e5614fb378291155df/watchfiles-1.1.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b2cd9e04277e756a2e2d2543d65d1e2166d6fd4c9b183f8808634fda23f17b14", size = 488722, upload-time = "2025-10-14T15:04:37.091Z" }, - { url = "https://files.pythonhosted.org/packages/49/36/506447b73eb46c120169dc1717fe2eff07c234bb3232a7200b5f5bd816e9/watchfiles-1.1.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5f3f58818dc0b07f7d9aa7fe9eb1037aecb9700e63e1f6acfed13e9fef648f5d", size = 596088, upload-time = "2025-10-14T15:04:38.39Z" }, - { url = "https://files.pythonhosted.org/packages/82/ab/5f39e752a9838ec4d52e9b87c1e80f1ee3ccdbe92e183c15b6577ab9de16/watchfiles-1.1.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9bb9f66367023ae783551042d31b1d7fd422e8289eedd91f26754a66f44d5cff", size = 472923, upload-time = "2025-10-14T15:04:39.666Z" }, - { url = "https://files.pythonhosted.org/packages/af/b9/a419292f05e302dea372fa7e6fda5178a92998411f8581b9830d28fb9edb/watchfiles-1.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aebfd0861a83e6c3d1110b78ad54704486555246e542be3e2bb94195eabb2606", size = 456080, upload-time = "2025-10-14T15:04:40.643Z" }, - { url = "https://files.pythonhosted.org/packages/b0/c3/d5932fd62bde1a30c36e10c409dc5d54506726f08cb3e1d8d0ba5e2bc8db/watchfiles-1.1.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:5fac835b4ab3c6487b5dbad78c4b3724e26bcc468e886f8ba8cc4306f68f6701", size = 629432, upload-time = "2025-10-14T15:04:41.789Z" }, - { url = "https://files.pythonhosted.org/packages/f7/77/16bddd9779fafb795f1a94319dc965209c5641db5bf1edbbccace6d1b3c0/watchfiles-1.1.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:399600947b170270e80134ac854e21b3ccdefa11a9529a3decc1327088180f10", size = 623046, upload-time = "2025-10-14T15:04:42.718Z" }, - { url = "https://files.pythonhosted.org/packages/46/ef/f2ecb9a0f342b4bfad13a2787155c6ee7ce792140eac63a34676a2feeef2/watchfiles-1.1.1-cp311-cp311-win32.whl", hash = "sha256:de6da501c883f58ad50db3a32ad397b09ad29865b5f26f64c24d3e3281685849", size = 271473, upload-time = "2025-10-14T15:04:43.624Z" }, - { url = "https://files.pythonhosted.org/packages/94/bc/f42d71125f19731ea435c3948cad148d31a64fccde3867e5ba4edee901f9/watchfiles-1.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:35c53bd62a0b885bf653ebf6b700d1bf05debb78ad9292cf2a942b23513dc4c4", size = 287598, upload-time = "2025-10-14T15:04:44.516Z" }, - { url = "https://files.pythonhosted.org/packages/57/c9/a30f897351f95bbbfb6abcadafbaca711ce1162f4db95fc908c98a9165f3/watchfiles-1.1.1-cp311-cp311-win_arm64.whl", hash = "sha256:57ca5281a8b5e27593cb7d82c2ac927ad88a96ed406aa446f6344e4328208e9e", size = 277210, upload-time = "2025-10-14T15:04:45.883Z" }, - { url = "https://files.pythonhosted.org/packages/74/d5/f039e7e3c639d9b1d09b07ea412a6806d38123f0508e5f9b48a87b0a76cc/watchfiles-1.1.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:8c89f9f2f740a6b7dcc753140dd5e1ab9215966f7a3530d0c0705c83b401bd7d", size = 404745, upload-time = "2025-10-14T15:04:46.731Z" }, - { url = "https://files.pythonhosted.org/packages/a5/96/a881a13aa1349827490dab2d363c8039527060cfcc2c92cc6d13d1b1049e/watchfiles-1.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:bd404be08018c37350f0d6e34676bd1e2889990117a2b90070b3007f172d0610", size = 391769, upload-time = "2025-10-14T15:04:48.003Z" }, - { url = "https://files.pythonhosted.org/packages/4b/5b/d3b460364aeb8da471c1989238ea0e56bec24b6042a68046adf3d9ddb01c/watchfiles-1.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8526e8f916bb5b9a0a777c8317c23ce65de259422bba5b31325a6fa6029d33af", size = 449374, upload-time = "2025-10-14T15:04:49.179Z" }, - { url = "https://files.pythonhosted.org/packages/b9/44/5769cb62d4ed055cb17417c0a109a92f007114a4e07f30812a73a4efdb11/watchfiles-1.1.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2edc3553362b1c38d9f06242416a5d8e9fe235c204a4072e988ce2e5bb1f69f6", size = 459485, upload-time = "2025-10-14T15:04:50.155Z" }, - { url = "https://files.pythonhosted.org/packages/19/0c/286b6301ded2eccd4ffd0041a1b726afda999926cf720aab63adb68a1e36/watchfiles-1.1.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:30f7da3fb3f2844259cba4720c3fc7138eb0f7b659c38f3bfa65084c7fc7abce", size = 488813, upload-time = "2025-10-14T15:04:51.059Z" }, - { url = "https://files.pythonhosted.org/packages/c7/2b/8530ed41112dd4a22f4dcfdb5ccf6a1baad1ff6eed8dc5a5f09e7e8c41c7/watchfiles-1.1.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f8979280bdafff686ba5e4d8f97840f929a87ed9cdf133cbbd42f7766774d2aa", size = 594816, upload-time = "2025-10-14T15:04:52.031Z" }, - { url = "https://files.pythonhosted.org/packages/ce/d2/f5f9fb49489f184f18470d4f99f4e862a4b3e9ac2865688eb2099e3d837a/watchfiles-1.1.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dcc5c24523771db3a294c77d94771abcfcb82a0e0ee8efd910c37c59ec1b31bb", size = 475186, upload-time = "2025-10-14T15:04:53.064Z" }, - { url = "https://files.pythonhosted.org/packages/cf/68/5707da262a119fb06fbe214d82dd1fe4a6f4af32d2d14de368d0349eb52a/watchfiles-1.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1db5d7ae38ff20153d542460752ff397fcf5c96090c1230803713cf3147a6803", size = 456812, upload-time = "2025-10-14T15:04:55.174Z" }, - { url = "https://files.pythonhosted.org/packages/66/ab/3cbb8756323e8f9b6f9acb9ef4ec26d42b2109bce830cc1f3468df20511d/watchfiles-1.1.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:28475ddbde92df1874b6c5c8aaeb24ad5be47a11f87cde5a28ef3835932e3e94", size = 630196, upload-time = "2025-10-14T15:04:56.22Z" }, - { url = "https://files.pythonhosted.org/packages/78/46/7152ec29b8335f80167928944a94955015a345440f524d2dfe63fc2f437b/watchfiles-1.1.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:36193ed342f5b9842edd3532729a2ad55c4160ffcfa3700e0d54be496b70dd43", size = 622657, upload-time = "2025-10-14T15:04:57.521Z" }, - { url = "https://files.pythonhosted.org/packages/0a/bf/95895e78dd75efe9a7f31733607f384b42eb5feb54bd2eb6ed57cc2e94f4/watchfiles-1.1.1-cp312-cp312-win32.whl", hash = "sha256:859e43a1951717cc8de7f4c77674a6d389b106361585951d9e69572823f311d9", size = 272042, upload-time = "2025-10-14T15:04:59.046Z" }, - { url = "https://files.pythonhosted.org/packages/87/0a/90eb755f568de2688cb220171c4191df932232c20946966c27a59c400850/watchfiles-1.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:91d4c9a823a8c987cce8fa2690923b069966dabb196dd8d137ea2cede885fde9", size = 288410, upload-time = "2025-10-14T15:05:00.081Z" }, - { url = "https://files.pythonhosted.org/packages/36/76/f322701530586922fbd6723c4f91ace21364924822a8772c549483abed13/watchfiles-1.1.1-cp312-cp312-win_arm64.whl", hash = "sha256:a625815d4a2bdca61953dbba5a39d60164451ef34c88d751f6c368c3ea73d404", size = 278209, upload-time = "2025-10-14T15:05:01.168Z" }, - { url = "https://files.pythonhosted.org/packages/bb/f4/f750b29225fe77139f7ae5de89d4949f5a99f934c65a1f1c0b248f26f747/watchfiles-1.1.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:130e4876309e8686a5e37dba7d5e9bc77e6ed908266996ca26572437a5271e18", size = 404321, upload-time = "2025-10-14T15:05:02.063Z" }, - { url = "https://files.pythonhosted.org/packages/2b/f9/f07a295cde762644aa4c4bb0f88921d2d141af45e735b965fb2e87858328/watchfiles-1.1.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5f3bde70f157f84ece3765b42b4a52c6ac1a50334903c6eaf765362f6ccca88a", size = 391783, upload-time = "2025-10-14T15:05:03.052Z" }, - { url = "https://files.pythonhosted.org/packages/bc/11/fc2502457e0bea39a5c958d86d2cb69e407a4d00b85735ca724bfa6e0d1a/watchfiles-1.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:14e0b1fe858430fc0251737ef3824c54027bedb8c37c38114488b8e131cf8219", size = 449279, upload-time = "2025-10-14T15:05:04.004Z" }, - { url = "https://files.pythonhosted.org/packages/e3/1f/d66bc15ea0b728df3ed96a539c777acfcad0eb78555ad9efcaa1274688f0/watchfiles-1.1.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f27db948078f3823a6bb3b465180db8ebecf26dd5dae6f6180bd87383b6b4428", size = 459405, upload-time = "2025-10-14T15:05:04.942Z" }, - { url = "https://files.pythonhosted.org/packages/be/90/9f4a65c0aec3ccf032703e6db02d89a157462fbb2cf20dd415128251cac0/watchfiles-1.1.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:059098c3a429f62fc98e8ec62b982230ef2c8df68c79e826e37b895bc359a9c0", size = 488976, upload-time = "2025-10-14T15:05:05.905Z" }, - { url = "https://files.pythonhosted.org/packages/37/57/ee347af605d867f712be7029bb94c8c071732a4b44792e3176fa3c612d39/watchfiles-1.1.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:bfb5862016acc9b869bb57284e6cb35fdf8e22fe59f7548858e2f971d045f150", size = 595506, upload-time = "2025-10-14T15:05:06.906Z" }, - { url = "https://files.pythonhosted.org/packages/a8/78/cc5ab0b86c122047f75e8fc471c67a04dee395daf847d3e59381996c8707/watchfiles-1.1.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:319b27255aacd9923b8a276bb14d21a5f7ff82564c744235fc5eae58d95422ae", size = 474936, upload-time = "2025-10-14T15:05:07.906Z" }, - { url = "https://files.pythonhosted.org/packages/62/da/def65b170a3815af7bd40a3e7010bf6ab53089ef1b75d05dd5385b87cf08/watchfiles-1.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c755367e51db90e75b19454b680903631d41f9e3607fbd941d296a020c2d752d", size = 456147, upload-time = "2025-10-14T15:05:09.138Z" }, - { url = "https://files.pythonhosted.org/packages/57/99/da6573ba71166e82d288d4df0839128004c67d2778d3b566c138695f5c0b/watchfiles-1.1.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:c22c776292a23bfc7237a98f791b9ad3144b02116ff10d820829ce62dff46d0b", size = 630007, upload-time = "2025-10-14T15:05:10.117Z" }, - { url = "https://files.pythonhosted.org/packages/a8/51/7439c4dd39511368849eb1e53279cd3454b4a4dbace80bab88feeb83c6b5/watchfiles-1.1.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:3a476189be23c3686bc2f4321dd501cb329c0a0469e77b7b534ee10129ae6374", size = 622280, upload-time = "2025-10-14T15:05:11.146Z" }, - { url = "https://files.pythonhosted.org/packages/95/9c/8ed97d4bba5db6fdcdb2b298d3898f2dd5c20f6b73aee04eabe56c59677e/watchfiles-1.1.1-cp313-cp313-win32.whl", hash = "sha256:bf0a91bfb5574a2f7fc223cf95eeea79abfefa404bf1ea5e339c0c1560ae99a0", size = 272056, upload-time = "2025-10-14T15:05:12.156Z" }, - { url = "https://files.pythonhosted.org/packages/1f/f3/c14e28429f744a260d8ceae18bf58c1d5fa56b50d006a7a9f80e1882cb0d/watchfiles-1.1.1-cp313-cp313-win_amd64.whl", hash = "sha256:52e06553899e11e8074503c8e716d574adeeb7e68913115c4b3653c53f9bae42", size = 288162, upload-time = "2025-10-14T15:05:13.208Z" }, - { url = "https://files.pythonhosted.org/packages/dc/61/fe0e56c40d5cd29523e398d31153218718c5786b5e636d9ae8ae79453d27/watchfiles-1.1.1-cp313-cp313-win_arm64.whl", hash = "sha256:ac3cc5759570cd02662b15fbcd9d917f7ecd47efe0d6b40474eafd246f91ea18", size = 277909, upload-time = "2025-10-14T15:05:14.49Z" }, - { url = "https://files.pythonhosted.org/packages/79/42/e0a7d749626f1e28c7108a99fb9bf524b501bbbeb9b261ceecde644d5a07/watchfiles-1.1.1-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:563b116874a9a7ce6f96f87cd0b94f7faf92d08d0021e837796f0a14318ef8da", size = 403389, upload-time = "2025-10-14T15:05:15.777Z" }, - { url = "https://files.pythonhosted.org/packages/15/49/08732f90ce0fbbc13913f9f215c689cfc9ced345fb1bcd8829a50007cc8d/watchfiles-1.1.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:3ad9fe1dae4ab4212d8c91e80b832425e24f421703b5a42ef2e4a1e215aff051", size = 389964, upload-time = "2025-10-14T15:05:16.85Z" }, - { url = "https://files.pythonhosted.org/packages/27/0d/7c315d4bd5f2538910491a0393c56bf70d333d51bc5b34bee8e68e8cea19/watchfiles-1.1.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ce70f96a46b894b36eba678f153f052967a0d06d5b5a19b336ab0dbbd029f73e", size = 448114, upload-time = "2025-10-14T15:05:17.876Z" }, - { url = "https://files.pythonhosted.org/packages/c3/24/9e096de47a4d11bc4df41e9d1e61776393eac4cb6eb11b3e23315b78b2cc/watchfiles-1.1.1-cp313-cp313t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cb467c999c2eff23a6417e58d75e5828716f42ed8289fe6b77a7e5a91036ca70", size = 460264, upload-time = "2025-10-14T15:05:18.962Z" }, - { url = "https://files.pythonhosted.org/packages/cc/0f/e8dea6375f1d3ba5fcb0b3583e2b493e77379834c74fd5a22d66d85d6540/watchfiles-1.1.1-cp313-cp313t-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:836398932192dae4146c8f6f737d74baeac8b70ce14831a239bdb1ca882fc261", size = 487877, upload-time = "2025-10-14T15:05:20.094Z" }, - { url = "https://files.pythonhosted.org/packages/ac/5b/df24cfc6424a12deb41503b64d42fbea6b8cb357ec62ca84a5a3476f654a/watchfiles-1.1.1-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:743185e7372b7bc7c389e1badcc606931a827112fbbd37f14c537320fca08620", size = 595176, upload-time = "2025-10-14T15:05:21.134Z" }, - { url = "https://files.pythonhosted.org/packages/8f/b5/853b6757f7347de4e9b37e8cc3289283fb983cba1ab4d2d7144694871d9c/watchfiles-1.1.1-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:afaeff7696e0ad9f02cbb8f56365ff4686ab205fcf9c4c5b6fdfaaa16549dd04", size = 473577, upload-time = "2025-10-14T15:05:22.306Z" }, - { url = "https://files.pythonhosted.org/packages/e1/f7/0a4467be0a56e80447c8529c9fce5b38eab4f513cb3d9bf82e7392a5696b/watchfiles-1.1.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3f7eb7da0eb23aa2ba036d4f616d46906013a68caf61b7fdbe42fc8b25132e77", size = 455425, upload-time = "2025-10-14T15:05:23.348Z" }, - { url = "https://files.pythonhosted.org/packages/8e/e0/82583485ea00137ddf69bc84a2db88bd92ab4a6e3c405e5fb878ead8d0e7/watchfiles-1.1.1-cp313-cp313t-musllinux_1_1_aarch64.whl", hash = "sha256:831a62658609f0e5c64178211c942ace999517f5770fe9436be4c2faeba0c0ef", size = 628826, upload-time = "2025-10-14T15:05:24.398Z" }, - { url = "https://files.pythonhosted.org/packages/28/9a/a785356fccf9fae84c0cc90570f11702ae9571036fb25932f1242c82191c/watchfiles-1.1.1-cp313-cp313t-musllinux_1_1_x86_64.whl", hash = "sha256:f9a2ae5c91cecc9edd47e041a930490c31c3afb1f5e6d71de3dc671bfaca02bf", size = 622208, upload-time = "2025-10-14T15:05:25.45Z" }, - { url = "https://files.pythonhosted.org/packages/c3/f4/0872229324ef69b2c3edec35e84bd57a1289e7d3fe74588048ed8947a323/watchfiles-1.1.1-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:d1715143123baeeaeadec0528bb7441103979a1d5f6fd0e1f915383fea7ea6d5", size = 404315, upload-time = "2025-10-14T15:05:26.501Z" }, - { url = "https://files.pythonhosted.org/packages/7b/22/16d5331eaed1cb107b873f6ae1b69e9ced582fcf0c59a50cd84f403b1c32/watchfiles-1.1.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:39574d6370c4579d7f5d0ad940ce5b20db0e4117444e39b6d8f99db5676c52fd", size = 390869, upload-time = "2025-10-14T15:05:27.649Z" }, - { url = "https://files.pythonhosted.org/packages/b2/7e/5643bfff5acb6539b18483128fdc0ef2cccc94a5b8fbda130c823e8ed636/watchfiles-1.1.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7365b92c2e69ee952902e8f70f3ba6360d0d596d9299d55d7d386df84b6941fb", size = 449919, upload-time = "2025-10-14T15:05:28.701Z" }, - { url = "https://files.pythonhosted.org/packages/51/2e/c410993ba5025a9f9357c376f48976ef0e1b1aefb73b97a5ae01a5972755/watchfiles-1.1.1-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bfff9740c69c0e4ed32416f013f3c45e2ae42ccedd1167ef2d805c000b6c71a5", size = 460845, upload-time = "2025-10-14T15:05:30.064Z" }, - { url = "https://files.pythonhosted.org/packages/8e/a4/2df3b404469122e8680f0fcd06079317e48db58a2da2950fb45020947734/watchfiles-1.1.1-cp314-cp314-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b27cf2eb1dda37b2089e3907d8ea92922b673c0c427886d4edc6b94d8dfe5db3", size = 489027, upload-time = "2025-10-14T15:05:31.064Z" }, - { url = "https://files.pythonhosted.org/packages/ea/84/4587ba5b1f267167ee715b7f66e6382cca6938e0a4b870adad93e44747e6/watchfiles-1.1.1-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:526e86aced14a65a5b0ec50827c745597c782ff46b571dbfe46192ab9e0b3c33", size = 595615, upload-time = "2025-10-14T15:05:32.074Z" }, - { url = "https://files.pythonhosted.org/packages/6a/0f/c6988c91d06e93cd0bb3d4a808bcf32375ca1904609835c3031799e3ecae/watchfiles-1.1.1-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:04e78dd0b6352db95507fd8cb46f39d185cf8c74e4cf1e4fbad1d3df96faf510", size = 474836, upload-time = "2025-10-14T15:05:33.209Z" }, - { url = "https://files.pythonhosted.org/packages/b4/36/ded8aebea91919485b7bbabbd14f5f359326cb5ec218cd67074d1e426d74/watchfiles-1.1.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5c85794a4cfa094714fb9c08d4a218375b2b95b8ed1666e8677c349906246c05", size = 455099, upload-time = "2025-10-14T15:05:34.189Z" }, - { url = "https://files.pythonhosted.org/packages/98/e0/8c9bdba88af756a2fce230dd365fab2baf927ba42cd47521ee7498fd5211/watchfiles-1.1.1-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:74d5012b7630714b66be7b7b7a78855ef7ad58e8650c73afc4c076a1f480a8d6", size = 630626, upload-time = "2025-10-14T15:05:35.216Z" }, - { url = "https://files.pythonhosted.org/packages/2a/84/a95db05354bf2d19e438520d92a8ca475e578c647f78f53197f5a2f17aaf/watchfiles-1.1.1-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:8fbe85cb3201c7d380d3d0b90e63d520f15d6afe217165d7f98c9c649654db81", size = 622519, upload-time = "2025-10-14T15:05:36.259Z" }, - { url = "https://files.pythonhosted.org/packages/1d/ce/d8acdc8de545de995c339be67711e474c77d643555a9bb74a9334252bd55/watchfiles-1.1.1-cp314-cp314-win32.whl", hash = "sha256:3fa0b59c92278b5a7800d3ee7733da9d096d4aabcfabb9a928918bd276ef9b9b", size = 272078, upload-time = "2025-10-14T15:05:37.63Z" }, - { url = "https://files.pythonhosted.org/packages/c4/c9/a74487f72d0451524be827e8edec251da0cc1fcf111646a511ae752e1a3d/watchfiles-1.1.1-cp314-cp314-win_amd64.whl", hash = "sha256:c2047d0b6cea13b3316bdbafbfa0c4228ae593d995030fda39089d36e64fc03a", size = 287664, upload-time = "2025-10-14T15:05:38.95Z" }, - { url = "https://files.pythonhosted.org/packages/df/b8/8ac000702cdd496cdce998c6f4ee0ca1f15977bba51bdf07d872ebdfc34c/watchfiles-1.1.1-cp314-cp314-win_arm64.whl", hash = "sha256:842178b126593addc05acf6fce960d28bc5fae7afbaa2c6c1b3a7b9460e5be02", size = 277154, upload-time = "2025-10-14T15:05:39.954Z" }, - { url = "https://files.pythonhosted.org/packages/47/a8/e3af2184707c29f0f14b1963c0aace6529f9d1b8582d5b99f31bbf42f59e/watchfiles-1.1.1-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:88863fbbc1a7312972f1c511f202eb30866370ebb8493aef2812b9ff28156a21", size = 403820, upload-time = "2025-10-14T15:05:40.932Z" }, - { url = "https://files.pythonhosted.org/packages/c0/ec/e47e307c2f4bd75f9f9e8afbe3876679b18e1bcec449beca132a1c5ffb2d/watchfiles-1.1.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:55c7475190662e202c08c6c0f4d9e345a29367438cf8e8037f3155e10a88d5a5", size = 390510, upload-time = "2025-10-14T15:05:41.945Z" }, - { url = "https://files.pythonhosted.org/packages/d5/a0/ad235642118090f66e7b2f18fd5c42082418404a79205cdfca50b6309c13/watchfiles-1.1.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3f53fa183d53a1d7a8852277c92b967ae99c2d4dcee2bfacff8868e6e30b15f7", size = 448408, upload-time = "2025-10-14T15:05:43.385Z" }, - { url = "https://files.pythonhosted.org/packages/df/85/97fa10fd5ff3332ae17e7e40e20784e419e28521549780869f1413742e9d/watchfiles-1.1.1-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:6aae418a8b323732fa89721d86f39ec8f092fc2af67f4217a2b07fd3e93c6101", size = 458968, upload-time = "2025-10-14T15:05:44.404Z" }, - { url = "https://files.pythonhosted.org/packages/47/c2/9059c2e8966ea5ce678166617a7f75ecba6164375f3b288e50a40dc6d489/watchfiles-1.1.1-cp314-cp314t-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f096076119da54a6080e8920cbdaac3dbee667eb91dcc5e5b78840b87415bd44", size = 488096, upload-time = "2025-10-14T15:05:45.398Z" }, - { url = "https://files.pythonhosted.org/packages/94/44/d90a9ec8ac309bc26db808a13e7bfc0e4e78b6fc051078a554e132e80160/watchfiles-1.1.1-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:00485f441d183717038ed2e887a7c868154f216877653121068107b227a2f64c", size = 596040, upload-time = "2025-10-14T15:05:46.502Z" }, - { url = "https://files.pythonhosted.org/packages/95/68/4e3479b20ca305cfc561db3ed207a8a1c745ee32bf24f2026a129d0ddb6e/watchfiles-1.1.1-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a55f3e9e493158d7bfdb60a1165035f1cf7d320914e7b7ea83fe22c6023b58fc", size = 473847, upload-time = "2025-10-14T15:05:47.484Z" }, - { url = "https://files.pythonhosted.org/packages/4f/55/2af26693fd15165c4ff7857e38330e1b61ab8c37d15dc79118cdba115b7a/watchfiles-1.1.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8c91ed27800188c2ae96d16e3149f199d62f86c7af5f5f4d2c61a3ed8cd3666c", size = 455072, upload-time = "2025-10-14T15:05:48.928Z" }, - { url = "https://files.pythonhosted.org/packages/66/1d/d0d200b10c9311ec25d2273f8aad8c3ef7cc7ea11808022501811208a750/watchfiles-1.1.1-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:311ff15a0bae3714ffb603e6ba6dbfba4065ab60865d15a6ec544133bdb21099", size = 629104, upload-time = "2025-10-14T15:05:49.908Z" }, - { url = "https://files.pythonhosted.org/packages/e3/bd/fa9bb053192491b3867ba07d2343d9f2252e00811567d30ae8d0f78136fe/watchfiles-1.1.1-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:a916a2932da8f8ab582f242c065f5c81bed3462849ca79ee357dd9551b0e9b01", size = 622112, upload-time = "2025-10-14T15:05:50.941Z" }, - { url = "https://files.pythonhosted.org/packages/ba/4c/a888c91e2e326872fa4705095d64acd8aa2fb9c1f7b9bd0588f33850516c/watchfiles-1.1.1-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:17ef139237dfced9da49fb7f2232c86ca9421f666d78c264c7ffca6601d154c3", size = 409611, upload-time = "2025-10-14T15:06:05.809Z" }, - { url = "https://files.pythonhosted.org/packages/1e/c7/5420d1943c8e3ce1a21c0a9330bcf7edafb6aa65d26b21dbb3267c9e8112/watchfiles-1.1.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:672b8adf25b1a0d35c96b5888b7b18699d27d4194bac8beeae75be4b7a3fc9b2", size = 396889, upload-time = "2025-10-14T15:06:07.035Z" }, - { url = "https://files.pythonhosted.org/packages/0c/e5/0072cef3804ce8d3aaddbfe7788aadff6b3d3f98a286fdbee9fd74ca59a7/watchfiles-1.1.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77a13aea58bc2b90173bc69f2a90de8e282648939a00a602e1dc4ee23e26b66d", size = 451616, upload-time = "2025-10-14T15:06:08.072Z" }, - { url = "https://files.pythonhosted.org/packages/83/4e/b87b71cbdfad81ad7e83358b3e447fedd281b880a03d64a760fe0a11fc2e/watchfiles-1.1.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0b495de0bb386df6a12b18335a0285dda90260f51bdb505503c02bcd1ce27a8b", size = 458413, upload-time = "2025-10-14T15:06:09.209Z" }, - { url = "https://files.pythonhosted.org/packages/d3/8e/e500f8b0b77be4ff753ac94dc06b33d8f0d839377fee1b78e8c8d8f031bf/watchfiles-1.1.1-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:db476ab59b6765134de1d4fe96a1a9c96ddf091683599be0f26147ea1b2e4b88", size = 408250, upload-time = "2025-10-14T15:06:10.264Z" }, - { url = "https://files.pythonhosted.org/packages/bd/95/615e72cd27b85b61eec764a5ca51bd94d40b5adea5ff47567d9ebc4d275a/watchfiles-1.1.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:89eef07eee5e9d1fda06e38822ad167a044153457e6fd997f8a858ab7564a336", size = 396117, upload-time = "2025-10-14T15:06:11.28Z" }, - { url = "https://files.pythonhosted.org/packages/c9/81/e7fe958ce8a7fb5c73cc9fb07f5aeaf755e6aa72498c57d760af760c91f8/watchfiles-1.1.1-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ce19e06cbda693e9e7686358af9cd6f5d61312ab8b00488bc36f5aabbaf77e24", size = 450493, upload-time = "2025-10-14T15:06:12.321Z" }, - { url = "https://files.pythonhosted.org/packages/6e/d4/ed38dd3b1767193de971e694aa544356e63353c33a85d948166b5ff58b9e/watchfiles-1.1.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3e6f39af2eab0118338902798b5aa6664f46ff66bc0280de76fca67a7f262a49", size = 457546, upload-time = "2025-10-14T15:06:13.372Z" }, + { url = "https://files.pythonhosted.org/packages/0d/5a/2bf22ecb24916983bf1cc0095e7dea2741d14d6553b0d6a2ac8bc96eca93/watchfiles-1.2.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:bb68bf4df85abebe5efddc53cf2075520f243a59868d9b3973278b23e76962a9", size = 400471, upload-time = "2026-05-18T04:31:08.908Z" }, + { url = "https://files.pythonhosted.org/packages/55/70/dea1f6a0e76607841a60fb51af150e70124864673f61704abb62b90cdcc7/watchfiles-1.2.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c16cb06dd17d43b9d185094268459eac92c9538356f050e55b54e82cf700e1d4", size = 394599, upload-time = "2026-05-18T04:30:19.845Z" }, + { url = "https://files.pythonhosted.org/packages/18/52/752dcc7dc817baef5e89518732925795ce52e36a683a9a3c9fb68b21504e/watchfiles-1.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77a0feab9af4c021c581f695258c642b3d10c5fd4c676e33a0d8606425d82631", size = 455458, upload-time = "2026-05-18T04:30:29.126Z" }, + { url = "https://files.pythonhosted.org/packages/12/48/366ebbb22fcc504c2f72b45f0b7e72f40a18795cc01752c16066d597b67a/watchfiles-1.2.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a16ffe19bf5cf9f5edaa1ad1dd830c5a816e8feec430c522302ab55483a4b994", size = 460513, upload-time = "2026-05-18T04:31:40.85Z" }, + { url = "https://files.pythonhosted.org/packages/ad/44/1f9e1b15e7a729062e0d0c3d0d7225ea4ab98b2267ef87287153be2495fc/watchfiles-1.2.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:204f299afcbd65918ab78dbc52626b0ae45e9d8cef403fdbf33ecf9e40eac66e", size = 493616, upload-time = "2026-05-18T04:30:58.47Z" }, + { url = "https://files.pythonhosted.org/packages/7e/55/8b1086dcc8a1d6a697a62767bd7ea368e74c61c6fd171683cfe24a3fe5d2/watchfiles-1.2.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:11743adfa510bfffebe97659fb280182b5c9b238708f667e866f308c3430dc19", size = 573154, upload-time = "2026-05-18T04:30:37.903Z" }, + { url = "https://files.pythonhosted.org/packages/14/7a/242f400cc77fafa7b18d53d19d9cb64fc6a6f61f28c55913bae7c674d92a/watchfiles-1.2.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:eb72919d93e3a16fc451d3aa3d4b1698423daca1b382d3d959c9ac51297c12a8", size = 467046, upload-time = "2026-05-18T04:30:41.869Z" }, + { url = "https://files.pythonhosted.org/packages/02/c8/79eee650c62d2c186598489814468e389b5def0ebe755399ff645b35b1b2/watchfiles-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b62f042afde2dde21ec1d2c1a74361e804673df86f51e418a999c9acfe671b07", size = 457100, upload-time = "2026-05-18T04:31:13.064Z" }, + { url = "https://files.pythonhosted.org/packages/81/36/519f6dbb7a95e4fe7c1513ed25b1520295ef9905a27f1f2226a73892bfb7/watchfiles-1.2.0-cp310-cp310-manylinux_2_31_riscv64.whl", hash = "sha256:027ae72bfdfd254862065d8b3e2a815c6ab9b1853ce41e6648ece84afd34a551", size = 467038, upload-time = "2026-05-18T04:30:32.915Z" }, + { url = "https://files.pythonhosted.org/packages/2f/12/951af6b9f89097e02511122258402cb3578443021930b70cf968d6310dc0/watchfiles-1.2.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e1cfd51e97e13ff3bd047c140764d277fc9b95b7cb5da59e46a47d167adab310", size = 632563, upload-time = "2026-05-18T04:30:11.539Z" }, + { url = "https://files.pythonhosted.org/packages/28/cc/0cba1f0a6117b7ec117271bdc3cb3a5a252005959755a2c09a745e0942cc/watchfiles-1.2.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:24b2405c0a46738dd9e1cf7135aa5dbdb9d42d024628651b3b13d5117e99f8df", size = 660851, upload-time = "2026-05-18T04:31:53.186Z" }, + { url = "https://files.pythonhosted.org/packages/d0/f2/26347558cc8bf6877845e66b315f644d03c173906aa09e233a3f4fd23928/watchfiles-1.2.0-cp310-cp310-win32.whl", hash = "sha256:8c520725602756229f045b032a1ff33d7ef0f7404189d62f6c2438cb6d8ef6a1", size = 277023, upload-time = "2026-05-18T04:30:18.825Z" }, + { url = "https://files.pythonhosted.org/packages/6d/68/a5e67b6b68e94f4c1511d61c46c55eba0737583620b6febf194c7b9cc23f/watchfiles-1.2.0-cp310-cp310-win_amd64.whl", hash = "sha256:03b14855c6f35539e2d95c442ae9530a75762f1e26567152b9ed05f96534a74d", size = 290107, upload-time = "2026-05-18T04:32:09.677Z" }, + { url = "https://files.pythonhosted.org/packages/fc/3d/8024c801df84d1587740d0359e7fdd80afeae3d159011f3d5376dd82f18e/watchfiles-1.2.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:704fd259e332e01f9b9c178f4bce9e49027e5587cc2600eeeaf8e76e1c846201", size = 400242, upload-time = "2026-05-18T04:31:19.014Z" }, + { url = "https://files.pythonhosted.org/packages/87/5b/f4dfd45323e949984a3a7f9dc31d1cbb049921e7d98253488dda72ccdaa9/watchfiles-1.2.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6543cf55d170003296d185c0af981f3e1311564907e1f4e08671fc7693a890a5", size = 394562, upload-time = "2026-05-18T04:30:08.46Z" }, + { url = "https://files.pythonhosted.org/packages/98/d8/19483ef075d601c409bce8bcbb5c0f81a10876fff870400568f08ce484a1/watchfiles-1.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:89d8c2394a065ca86f5d2910ff263ae67c127e1376ccc4f9fc35c71db879f80a", size = 456611, upload-time = "2026-05-18T04:30:45.723Z" }, + { url = "https://files.pythonhosted.org/packages/b1/6a/cc81fbe7ee42f2f22e661a6e12def7807e01b14b2f39e0ff83fd373fd307/watchfiles-1.2.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:772b80df316480d894a0e3165fdd19cf77f5d17f9a787f94029465ad0e3529d1", size = 461379, upload-time = "2026-05-18T04:31:29.292Z" }, + { url = "https://files.pythonhosted.org/packages/b1/57/7e669002082c0a0f4fb5113bb70125f7110124b846b0a11bc5ae8e90eac1/watchfiles-1.2.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d158cd89df6053823533e06fb1d73c549133bff5f0396170c0e53d9559340717", size = 493556, upload-time = "2026-05-18T04:30:05.44Z" }, + { url = "https://files.pythonhosted.org/packages/45/7d/f60a2b19807b21fe8281f3a8da4f59eef0d5f96825ac4680ba2d4f2ebf91/watchfiles-1.2.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d516b3283a758e087841aedb8031549fb41ced08f3db10aa6d2bf32dc042525b", size = 575255, upload-time = "2026-05-18T04:30:40.568Z" }, + { url = "https://files.pythonhosted.org/packages/bd/49/77f5b5e6efbcd57482f74948ebb1b97e5c0046d6b61475042d830c84b3ff/watchfiles-1.2.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:53b2290c92e0506d102cd448fbc610d87079553f86caa39d67440856a8b8bba5", size = 467052, upload-time = "2026-05-18T04:31:17.942Z" }, + { url = "https://files.pythonhosted.org/packages/ee/5a/73e2959af1b97fd5d556f9a8bdba017be23ceeef731869d5eaa0a753d5a3/watchfiles-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a711b51aec4370d0dcda5b6c09463206f133a5759341d7744b953a7b62e1100e", size = 456858, upload-time = "2026-05-18T04:30:30.182Z" }, + { url = "https://files.pythonhosted.org/packages/50/57/1bc8c27fad7e6c19bddee15d276dbb6ab72480ec01c127afff1673aee417/watchfiles-1.2.0-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:e2ca07fa7d89195ec0865d3d285666286740bfa83d83e5cee204043a31ecc165", size = 467579, upload-time = "2026-05-18T04:32:15.897Z" }, + { url = "https://files.pythonhosted.org/packages/09/6c/3c2e44edba3553c5e3c3b8c8a2a6dee6b9e12ae2cf4bd2378bebf9dc3038/watchfiles-1.2.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e0618518f282c4ebff60f5e5b1247b6d91bb8b9f4476947563a1e74acc66f3c6", size = 633253, upload-time = "2026-05-18T04:31:37.123Z" }, + { url = "https://files.pythonhosted.org/packages/30/c2/d8c84a882ab39bbefcc4915ab3e91830b7a7e990c5570b0b69075aba3faf/watchfiles-1.2.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:0d191c054d0715c3c95c99df9b8dbf6fd096d8c1e021e8f212e1bd8bc444ccb5", size = 660713, upload-time = "2026-05-18T04:31:24.62Z" }, + { url = "https://files.pythonhosted.org/packages/a9/07/f97736a5fc605364fe67b25e9fa4a6965dfd4840d50c406ada507e9d735f/watchfiles-1.2.0-cp311-cp311-win32.whl", hash = "sha256:9342472aff9b093c5acd4f6d8f70ae0937964ab56542502bcf5579782da69ae8", size = 277222, upload-time = "2026-05-18T04:31:21.131Z" }, + { url = "https://files.pythonhosted.org/packages/cf/99/2b04981977fc2608afd60360d928c6aecf6b950292ca221d98f4005f6694/watchfiles-1.2.0-cp311-cp311-win_amd64.whl", hash = "sha256:dbd6c97045dad81227c8d040173da044c1de08de64a5ea8b555da4aee1d5fa22", size = 290274, upload-time = "2026-05-18T04:31:45.966Z" }, + { url = "https://files.pythonhosted.org/packages/3c/74/f7f58a7075ee9cf612b0cfcddb78b8cd8234f0742d6f0075cf0da2dde1c6/watchfiles-1.2.0-cp311-cp311-win_arm64.whl", hash = "sha256:57a2d9fa4fb4c2ecae57b13dfff2c7ab53e21a2ba674fe9f05506680fcdcc0d7", size = 283460, upload-time = "2026-05-18T04:31:39.126Z" }, + { url = "https://files.pythonhosted.org/packages/b8/2f/e42c992d2afda3108ea1c02acecc991b9f31d05c14adc2a7cee9ee211fc4/watchfiles-1.2.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:bc13eb17538be00c874699dc0abe4ee2bc8d50bb1166a6b9e175ef3fd7eb8f26", size = 400115, upload-time = "2026-05-18T04:32:02.06Z" }, + { url = "https://files.pythonhosted.org/packages/5f/8f/6af2ea19065c91d8b0ea3516fdfc8c0d349f407e8e9fbf4e5a17360de8ad/watchfiles-1.2.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2d95ddc1eb6914154253d239089900813f6a767e174b8e6a50e7fdacb7e4236c", size = 393659, upload-time = "2026-05-18T04:30:50.951Z" }, + { url = "https://files.pythonhosted.org/packages/13/01/b32a967c56fb3e3e5be3db52c3d3b87fa4513aa367d8ed1ad96d42952e5f/watchfiles-1.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f70d8b291ef6e88d19b1f297a6905ddb978888d9272b0d05e6f53309856bcfc", size = 453207, upload-time = "2026-05-18T04:31:04.231Z" }, + { url = "https://files.pythonhosted.org/packages/04/98/97557a812180338cb1abd32e1cffcc4588f59b5f23e0cb006b2ba95ba64a/watchfiles-1.2.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:56d8641cf834c2836922899105bd3ce3d0dfc69291d52edf0b4d0436829b34c0", size = 459273, upload-time = "2026-05-18T04:31:50.377Z" }, + { url = "https://files.pythonhosted.org/packages/e8/a8/b4b08dcb7653b8087c6586f7ce649505900e866bbcfe40dc9587af02e686/watchfiles-1.2.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2581a94056e55d7d0a31a823ea92bf73749c489ca2285bfdc0fbe6b2bb49d50c", size = 489927, upload-time = "2026-05-18T04:31:42.485Z" }, + { url = "https://files.pythonhosted.org/packages/50/94/3dceea03545d2e5ddfd839f0ddd5e1cecbf1697b5a428d5ba11cef6af95d/watchfiles-1.2.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:41bc1199f7523b3f82843c88cbb979180c949caef0342cf90968f178e5d49b01", size = 570476, upload-time = "2026-05-18T04:31:03.071Z" }, + { url = "https://files.pythonhosted.org/packages/cc/f2/d39a5450c3532092b91f81d274360e613c2371bc874a89c7a1a3c5e8d138/watchfiles-1.2.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7571e4464cb6e434958f867f7f730b8ab0b75e3f8e5eac0499168486ab3c33a8", size = 465650, upload-time = "2026-05-18T04:30:12.701Z" }, + { url = "https://files.pythonhosted.org/packages/22/24/ed72f68cbc1333ca9b9f2200aa048bb6658ae41709bc1caad4310f4bdffd/watchfiles-1.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e53a384f76b631c3ae5334ce6a52f0baa3a911eb94a4eac7f160079868b716d5", size = 456398, upload-time = "2026-05-18T04:30:13.784Z" }, + { url = "https://files.pythonhosted.org/packages/0d/64/982ef4a4e5bab5b6e5b6becc8cd5e732f6130a78b855f0abec6439a9a135/watchfiles-1.2.0-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:d20029a60a71a052a24c4db7673bc4de39ab89adbaccbfb5d67987c5d73f424d", size = 465140, upload-time = "2026-05-18T04:31:52.111Z" }, + { url = "https://files.pythonhosted.org/packages/a0/0c/95282abf4ed680b6096010bcfc30c5fa7a041fc5aa5a2ad17a2cc6c75bba/watchfiles-1.2.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:2cb93af48550faf1cea04c303107c8b75833de7013e57ce27d3b8d21d8d0f58c", size = 630259, upload-time = "2026-05-18T04:31:25.676Z" }, + { url = "https://files.pythonhosted.org/packages/30/45/607c1de1530c4bdcf2cf1d1ecc2505ddba5d96bd43ba9f2b0e79876f850f/watchfiles-1.2.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:2995c176de7692b86a2e4c58d9ec718f753150a979cb4a754e2b4ffa38e70906", size = 659859, upload-time = "2026-05-18T04:30:24.333Z" }, + { url = "https://files.pythonhosted.org/packages/fa/08/d9e2e0f9e8e6791d33aefc694ad7eefa7f901f63caff84a81ded38692f9c/watchfiles-1.2.0-cp312-cp312-win32.whl", hash = "sha256:7a2cffd17d27d2ecbb310c2b1d8174f222a5495b1a721894afa88ec11e25b898", size = 275480, upload-time = "2026-05-18T04:30:31.307Z" }, + { url = "https://files.pythonhosted.org/packages/1c/e6/9d42569c0102645cc8cea5d8c7d8a1e9d4ada2cb7f05f75e554b8aa2202a/watchfiles-1.2.0-cp312-cp312-win_amd64.whl", hash = "sha256:f155b3a1b2a5fc89cdc70d47ee5d54e3b75e88efa34982028a35daef9ba00379", size = 288718, upload-time = "2026-05-18T04:32:10.745Z" }, + { url = "https://files.pythonhosted.org/packages/0a/26/88e0dc6ee3898169d7fa22bb6a69cabf2502d2ee25cb8c876d1262d204f8/watchfiles-1.2.0-cp312-cp312-win_arm64.whl", hash = "sha256:8fa585ede612ee9f9e91b18bebf9ba11b9ae29a4e3a0d0cf6fca3e382133f0d5", size = 281026, upload-time = "2026-05-18T04:30:22.23Z" }, + { url = "https://files.pythonhosted.org/packages/d1/4d/70a7feced9f87e2ff26dba42667290f41694fc64646c67261fbb8cab5d5c/watchfiles-1.2.0-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:01ea8d66f0693b9b60a6541c8d10263091ca9a9060d242f3c1f3143f9aad2c98", size = 399730, upload-time = "2026-05-18T04:31:38.162Z" }, + { url = "https://files.pythonhosted.org/packages/31/3a/0da302f2307aee316922806ebd5726c542cbd787c938271cf14a074c7daf/watchfiles-1.2.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:7ba0480b9a74af058f43b337e937a451e109295c420916d68ad24e3dc02f5e44", size = 392842, upload-time = "2026-05-18T04:30:27.051Z" }, + { url = "https://files.pythonhosted.org/packages/db/ef/d5bdb705c224dbc256aa0c1ec47bf4e61ec52558f2afb44a71a1fe4d7015/watchfiles-1.2.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4f34e26a19f91f710c08e0183429f0d1d15df734e6bc78c31e77b9ea9c433658", size = 452989, upload-time = "2026-05-18T04:31:11.945Z" }, + { url = "https://files.pythonhosted.org/packages/71/29/5495f2c1661949ef7a35e4d71111d129cfe7606414a26887a919d0a55406/watchfiles-1.2.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b4e77f6a55f858504069abd35d336a637555c09bca453dde1ee1e5ada8a6a1fb", size = 458978, upload-time = "2026-05-18T04:30:52.606Z" }, + { url = "https://files.pythonhosted.org/packages/d5/8c/7f9c07c433811c2fffd93e13fdfb7135de9aab5f2ae41be08960fa0047dc/watchfiles-1.2.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0cb4d80e212f116474a545c21c912b445f16bb0cef9e6a73a498164223e14e2f", size = 490248, upload-time = "2026-05-18T04:31:36.003Z" }, + { url = "https://files.pythonhosted.org/packages/3c/11/d93632febc52fbc21be90231bb7c17fd5387f46c9076fd40a5f9c2ae6910/watchfiles-1.2.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b974946a10af379d425e2eef5b62f5c6ebeaccf91d45eaad6f5b27ecd4f91aa0", size = 571847, upload-time = "2026-05-18T04:31:10.862Z" }, + { url = "https://files.pythonhosted.org/packages/55/b4/383173e73aabb07ad1d9c7aa859d95437ac46a6d6a1e11005facda0c9d19/watchfiles-1.2.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:86bc13c25a8d1fcd70b51d0ce7c9b65e90de5666fcbfd3e34957cc73ee19aeb5", size = 465974, upload-time = "2026-05-18T04:30:17.006Z" }, + { url = "https://files.pythonhosted.org/packages/a7/6c/89b1a230a78f57c52dd8893adb1f92f94411721b6ec12596c56d98c74356/watchfiles-1.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ca148d73dea36c9763aaa351e4d7a51780ec1584217c45276f4fe8239c768b71", size = 454782, upload-time = "2026-05-18T04:30:35.656Z" }, + { url = "https://files.pythonhosted.org/packages/24/62/1732118367cfff0a9fce3bf62ff4bfded09ef5df21d9d446b858b3f70a96/watchfiles-1.2.0-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:c525543d91961c6955b2636b308569e84a1d1c5f5f2932041ab9ef46422f43e3", size = 465182, upload-time = "2026-05-18T04:30:20.846Z" }, + { url = "https://files.pythonhosted.org/packages/28/96/716f7e5f51339bf22963f3345f9f27d7f3b30e2eadc597e257c881dd3c53/watchfiles-1.2.0-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:a204794696ffb8f9b10fba6f7cb5216d42f3b2b71860ccac6b6e42f5f10973b0", size = 629841, upload-time = "2026-05-18T04:31:05.397Z" }, + { url = "https://files.pythonhosted.org/packages/4c/fe/c40783950fd771ccf66ab3ec2722d188a9af1c7f96c6e811f36e40c6e03f/watchfiles-1.2.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:10d86db20695afe7997ac9e1717637d6714a8d0220458c33f3d2061f54cec427", size = 658028, upload-time = "2026-05-18T04:31:48.22Z" }, + { url = "https://files.pythonhosted.org/packages/71/72/4508db1856d1d87fcbb3b63f4839bab1b5682cb0e8d224d122263c09654a/watchfiles-1.2.0-cp313-cp313-win32.whl", hash = "sha256:eb283ee99e21ad6443c8cdb06ac5b34b1308c329cbdf03fa02b445363714c799", size = 275183, upload-time = "2026-05-18T04:30:59.57Z" }, + { url = "https://files.pythonhosted.org/packages/f9/36/14b76ca57652e5cc5fd1c11f32a261292c08a0d19a00351013c2549cbfb2/watchfiles-1.2.0-cp313-cp313-win_amd64.whl", hash = "sha256:a0f27f01bee51861392bb6b7c4fdb290b27d1eb194e9e28788d68102a0e898d9", size = 288059, upload-time = "2026-05-18T04:32:07.937Z" }, + { url = "https://files.pythonhosted.org/packages/1b/8d/0a85e395398d8d20fadfe5c5d32c726eee17a519e78fb356f2cf7531bffe/watchfiles-1.2.0-cp313-cp313-win_arm64.whl", hash = "sha256:3651aa7058595e9cfb75d35dd5ada2bf9f48a5b8a0f3562821d3e210c507e077", size = 280186, upload-time = "2026-05-18T04:31:54.484Z" }, + { url = "https://files.pythonhosted.org/packages/37/68/36db056f1fdcc5f07302f56e631774d6835bcd6fa3ace402304621d5f9e5/watchfiles-1.2.0-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:faea288b6f0ab1902ef08f4ca6de005dccf856c4e0c4f21b8c5fce02d90a1b08", size = 399031, upload-time = "2026-05-18T04:30:44.576Z" }, + { url = "https://files.pythonhosted.org/packages/c1/64/01a9d6f66a82a5c101ce939274106cc72759d62427e153f01edd2b9f87c2/watchfiles-1.2.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:01859b11fd9fbca670f4d5da00fbac282cfea9bd67a2125d8b2833a3b5617ea9", size = 391205, upload-time = "2026-05-18T04:30:25.413Z" }, + { url = "https://files.pythonhosted.org/packages/84/2c/0a44fe058cb4bb7b8ede6b6670698bbb7c0400740e378d00022189b7b31d/watchfiles-1.2.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fff610d7bb2256a317bb1e96f0d7862c7aa8076733ee5df0fd41bbe76a24a4f4", size = 451892, upload-time = "2026-05-18T04:32:14.005Z" }, + { url = "https://files.pythonhosted.org/packages/67/a1/351e0d56cd35e6488b5c8b4fb11a809a5bc923e8fe8fed9faf8920be0c89/watchfiles-1.2.0-cp313-cp313t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b141a4891c995a039cd89e9a49e62df1dc8a559a5d1a6e4c7106d16c12777a55", size = 458867, upload-time = "2026-05-18T04:31:22.279Z" }, + { url = "https://files.pythonhosted.org/packages/d5/7d/9d09605187f1b838998624049fcf8bf47b73c1a3b76901fcac1782f62277/watchfiles-1.2.0-cp313-cp313t-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f22943b7770483f6ea0721c6b11d022947a98eb0acae14694de034f4d0d38925", size = 490217, upload-time = "2026-05-18T04:31:43.657Z" }, + { url = "https://files.pythonhosted.org/packages/60/5d/a17a16eccb182f04188cd308ec24b1a71a9b5c4e7098269cf35d9fa56d02/watchfiles-1.2.0-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1bc6195825b7dcd217968bb1f801a60fd4c16e8eeab5bedc7fe917d7d5995ab4", size = 571458, upload-time = "2026-05-18T04:32:11.875Z" }, + { url = "https://files.pythonhosted.org/packages/d3/3d/4dd457062083ab1938e5dfd45032eb425cee2ac817287ca8ff4356183e5d/watchfiles-1.2.0-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d4a4b147f5dca2a5d325a06a832fb43f345751adfbc63204aec30e0d9ca965a2", size = 464707, upload-time = "2026-05-18T04:30:43.492Z" }, + { url = "https://files.pythonhosted.org/packages/c6/71/ea8c57b128f5383de74d0c7d2d9c57ad7c9a65a930c451bd25d524b295b7/watchfiles-1.2.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4543579a9bdb0c9560039b4ffddbdb39545707659fbc430ce4c10f3f68d557f9", size = 454663, upload-time = "2026-05-18T04:30:16.061Z" }, + { url = "https://files.pythonhosted.org/packages/53/fd/2e812bf938406d7db351f0703ddd3fc6c061cf30d96153a77bc79a943a44/watchfiles-1.2.0-cp313-cp313t-manylinux_2_31_riscv64.whl", hash = "sha256:20aa0e708b920bde876a4aa82dc7dd6ebea228a63a67cda6632c2fc87b787efa", size = 463537, upload-time = "2026-05-18T04:31:44.9Z" }, + { url = "https://files.pythonhosted.org/packages/86/56/d17a7f1dd1bc3035f1072694a551301272f1739c2d8e319c927cb9e29b38/watchfiles-1.2.0-cp313-cp313t-musllinux_1_1_aarch64.whl", hash = "sha256:d413349d565dab74297f2a63e84a097936be69bf8f3b3801f27f380e32040f44", size = 629194, upload-time = "2026-05-18T04:31:14.141Z" }, + { url = "https://files.pythonhosted.org/packages/be/06/f1ff66bf5cae50aa4062779a0ecd0bbaf15e466195719074078947d9a17d/watchfiles-1.2.0-cp313-cp313t-musllinux_1_1_x86_64.whl", hash = "sha256:f28b2725eb8cce327b9b3ab02415c853011dc55c95832fe90de6bc56f5315f72", size = 656194, upload-time = "2026-05-18T04:31:47.14Z" }, + { url = "https://files.pythonhosted.org/packages/e7/54/a9c7ea9a82a4ac65e7004c0a03920b5cdd2f9c3b678757d9cd425aa51d53/watchfiles-1.2.0-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:b8c8358484d5fa12ef34f05b7f4168eaf1932f408725ff6d023c33ec17bd79d4", size = 400205, upload-time = "2026-05-18T04:32:05.153Z" }, + { url = "https://files.pythonhosted.org/packages/aa/5d/c9ab3534374a4a67450696905d6ef16a04405448b8dc52bd752ae50423d4/watchfiles-1.2.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:9f04b092229ad2c50126dd3c922c8822e51e605993764a33058d4a791ab42281", size = 392508, upload-time = "2026-05-18T04:30:54.849Z" }, + { url = "https://files.pythonhosted.org/packages/26/ca/1ad30103535cf0cecd7b993e8d50edc5351b1820e38f2d22e3df58962feb/watchfiles-1.2.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7a7ce236284f002a156f70add88efe5c70879cccbb658be0822c54b1306fc09d", size = 452448, upload-time = "2026-05-18T04:30:53.727Z" }, + { url = "https://files.pythonhosted.org/packages/37/a1/ceee2cdf2afbd715fa07758d39c9859513eae411b23196f7fd039e5feedd/watchfiles-1.2.0-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b9909cc2b48468b575eefa944919e1fe8a36c5849d5c7c168f80a8c1db69398e", size = 459605, upload-time = "2026-05-18T04:30:23.312Z" }, + { url = "https://files.pythonhosted.org/packages/e8/f6/421e30fd1cb3907a84ed92ab3f1983e37ba2dca015e9a894a048418417a2/watchfiles-1.2.0-cp314-cp314-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0a37faaed405c67e28e6be45a1fa4f206ef5a2860f27c237db9fa30704c38242", size = 490757, upload-time = "2026-05-18T04:30:47.358Z" }, + { url = "https://files.pythonhosted.org/packages/41/b0/55ed1b97ed08be7bba6f9a541cac15f2a858e1d74d2b07b6da70a82aab00/watchfiles-1.2.0-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9649193aa27bd9ff2e80ff29bfaa93085496c7a3a377592823cc58b77ee88add", size = 568672, upload-time = "2026-05-18T04:30:38.915Z" }, + { url = "https://files.pythonhosted.org/packages/d1/cf/d8ae8a80dd7bafab395ea7681c10237311bbf34d37704a8c744e7cf31fc7/watchfiles-1.2.0-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4e4ff8e37f99cf1da89e255e07c9c4b37c214038c4283707bdec308cb1b0ea1f", size = 464197, upload-time = "2026-05-18T04:30:09.914Z" }, + { url = "https://files.pythonhosted.org/packages/7c/8a/3076c496ca8dafe0e8cd03fcebdfc47be4b1174b4e5b24ff6e396e6b3af2/watchfiles-1.2.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:054dc20fd2e3132b4c3883b4a00d72fd6e1f56fdaf89fccd12e8057d74cd74d7", size = 453181, upload-time = "2026-05-18T04:30:14.829Z" }, + { url = "https://files.pythonhosted.org/packages/e5/10/9745e17c98e7b8a86454df0a3c7b5686bd650383f1e9f26e4ebcbd6cc0c0/watchfiles-1.2.0-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:e140ed30ebde76796b686e67c182cff10ea2fbab186fafd1560f74bb5a473a6e", size = 465109, upload-time = "2026-05-18T04:30:28.123Z" }, + { url = "https://files.pythonhosted.org/packages/8f/95/8ef4a95481d3e0cb52d62a06fa6e972e81424be2d9698b91a2fecca9904c/watchfiles-1.2.0-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:bb7e52ecf68ba46d22df23467b87cffeb2146908aa523ebfe803019618cfda06", size = 630653, upload-time = "2026-05-18T04:31:49.304Z" }, + { url = "https://files.pythonhosted.org/packages/fd/e4/3b3bf36b0f829b50c6ebcb8d031583863c59f923d6a6af3d485e470d0fac/watchfiles-1.2.0-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:23282a321c8baf9b3a3c4afff673f9fe65eb7fdc2338d765ccad9d3d1916a5ba", size = 657838, upload-time = "2026-05-18T04:31:06.497Z" }, + { url = "https://files.pythonhosted.org/packages/21/b1/6cbbb50c1f3002ab568777d44aa21206dfb8807a840990c4037523b51812/watchfiles-1.2.0-cp314-cp314-win32.whl", hash = "sha256:c0db965c5f79aa49fe672d297cf1febc5ad149b658594944f49a54a2b96270a7", size = 275108, upload-time = "2026-05-18T04:30:06.891Z" }, + { url = "https://files.pythonhosted.org/packages/92/45/190ce6db8dcb4536682cf75d3889ff1a27182a58cb519d343cb6d9ea63d8/watchfiles-1.2.0-cp314-cp314-win_amd64.whl", hash = "sha256:71283b39fd17e5408eb123bd37aeecfd9d54c81fc184421943208aadb879d103", size = 288441, upload-time = "2026-05-18T04:32:12.901Z" }, + { url = "https://files.pythonhosted.org/packages/74/0d/3eae1c2313ab08378431d907c3f8095ecca00f3eda33111cf4f0f2591799/watchfiles-1.2.0-cp314-cp314-win_arm64.whl", hash = "sha256:c5c19526f4e54a00f2666a6c0e9e40d582c09e865055ea7378bf0009aab857b3", size = 280684, upload-time = "2026-05-18T04:31:26.902Z" }, + { url = "https://files.pythonhosted.org/packages/b1/75/fb64e6c25d6b5ca636d03df34ffb1c6e9873303e76d27967e045f8df088f/watchfiles-1.2.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:d73a585accffa5ae39c17264c36ec3166d2fad7000c780f5ef83b2722afb9dd2", size = 398857, upload-time = "2026-05-18T04:32:17.108Z" }, + { url = "https://files.pythonhosted.org/packages/73/4e/9f7adf01754cbf81843722ccfec169d8f26c69778281a302855cecd2ee08/watchfiles-1.2.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:ae99b14c5f21e026e0e9d96f40e07d8570ebee6cafd9d8fc318354606daa7a28", size = 392413, upload-time = "2026-05-18T04:31:07.911Z" }, + { url = "https://files.pythonhosted.org/packages/47/c8/bec626bcc2d69f44b9acb24ce7d60ed7b16b73628eea747fcbd169d8edda/watchfiles-1.2.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4429f3b105524a10b72c3a819b091c495d2811d419c1e1e8df773a5a5974f831", size = 452409, upload-time = "2026-05-18T04:31:20.142Z" }, + { url = "https://files.pythonhosted.org/packages/00/b7/b6362068e81e7c556d155a34c35d40ac3ef42d747b06d7f6e5bf58e359c2/watchfiles-1.2.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:43d818978d06062d9b22c4fab2ebe44cf5213d42dc8e62bda8c2760cfa2eeb33", size = 458827, upload-time = "2026-05-18T04:32:06.219Z" }, + { url = "https://files.pythonhosted.org/packages/67/f8/9a813fa42afb1e0b4625e75f0479826644d3ee8dc287e093799bc01f390c/watchfiles-1.2.0-cp314-cp314t-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b9f732dc58b2dbe69e464ccf8fff7a03b0dd0be439da4c0720d3558527d3d6b4", size = 490104, upload-time = "2026-05-18T04:31:56.034Z" }, + { url = "https://files.pythonhosted.org/packages/2f/bf/27dfb6094ca4c9aad21298b5525b6c53cb36121ee454331d05161e58d130/watchfiles-1.2.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8f200104103feb097de4cab8fe4f5dd18a2026934c7dea98c55a2f5fd6d5a33b", size = 571360, upload-time = "2026-05-18T04:31:57.133Z" }, + { url = "https://files.pythonhosted.org/packages/fb/39/44a096d67270ea93df91d33877dbe91fbda3aa4f8ec2edf799d93eda8736/watchfiles-1.2.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:63ac26eefbf4af1741247d6fb68b11c49a25b2f7413fbd318a83a12aaa9cf666", size = 464644, upload-time = "2026-05-18T04:30:57.33Z" }, + { url = "https://files.pythonhosted.org/packages/0e/80/c7472203bad6268e3ef1ad260739704847898938ad7ea8b63a5131f46b50/watchfiles-1.2.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0c4997d4e4a55f0d02b6cde327322daf3a0400e5df6c6b15948994bf72497925", size = 454771, upload-time = "2026-05-18T04:30:48.736Z" }, + { url = "https://files.pythonhosted.org/packages/51/cf/3b10b268b4b7f0fc26e9debb5eef1998b515887840f444cd3ec80c688755/watchfiles-1.2.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:4c887eba18b7945ac73067a8b4a66f21cd46c2539b2bc68588f7be6c7eb6d26b", size = 463494, upload-time = "2026-05-18T04:31:33.826Z" }, + { url = "https://files.pythonhosted.org/packages/3d/3e/a4302545cd589262a0dc7d140e86f7688eba3f9c72776c27f7e23b8864c4/watchfiles-1.2.0-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:3416ff151bb6b5a8d8d11664974fbef4d9305b9b2957839ab5a270468fd8df30", size = 629383, upload-time = "2026-05-18T04:31:15.596Z" }, + { url = "https://files.pythonhosted.org/packages/db/99/d5649df0a9a410d45b7c882304d0b790903ac9b6e8f2cfd12114e0c6b9f2/watchfiles-1.2.0-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:0e831a271c035d89789cffc386b6aa1375f39f1cd25eb7ca0997e4970d152fc5", size = 656093, upload-time = "2026-05-18T04:31:58.707Z" }, + { url = "https://files.pythonhosted.org/packages/92/b9/362702539275019a54dd2e94511b31a9b89c5f9e6a21966de7eb692549fc/watchfiles-1.2.0-cp315-cp315-macosx_10_12_x86_64.whl", hash = "sha256:37a6721cdf3f65dbb13aa9503510ccb4451603ac837e44d265d7992a597e1374", size = 400109, upload-time = "2026-05-18T04:31:16.879Z" }, + { url = "https://files.pythonhosted.org/packages/8f/75/71d5ba62db781e5587bded1d944c675374bc4aa37ff33d5018d98e8b6538/watchfiles-1.2.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:2b37d10b5a63bd4d87e18472d80fa525bd670586fae62e5dd580452764879b65", size = 392167, upload-time = "2026-05-18T04:31:28.058Z" }, + { url = "https://files.pythonhosted.org/packages/3c/01/c66dd95d0423fe30d31820e2d1d5bda773764131bbb6ac0cb1cf303ac328/watchfiles-1.2.0-cp315-cp315-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0a105bc2283f67e8fbec74253ec2d94925de92ed72c0393f1206bf326b7b7b69", size = 452372, upload-time = "2026-05-18T04:31:00.836Z" }, + { url = "https://files.pythonhosted.org/packages/91/15/2fe99557e72f85627c6a8eed50d889e8d101623e060a22ad75b875cb932d/watchfiles-1.2.0-cp315-cp315-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5327989a465505f05cfe06f04fa9d0c2fd5432bb243e10e6f012b1bdca3c8579", size = 459596, upload-time = "2026-05-18T04:31:34.96Z" }, + { url = "https://files.pythonhosted.org/packages/ed/23/d4acfa0023367428ed48351b3b9b267893037b6cadae55620c61c24bcfd4/watchfiles-1.2.0-cp315-cp315-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ecb47f183a8025b2aa18b546725c3657e542112ae9c0613a2af79b4fa8d04ad7", size = 490869, upload-time = "2026-05-18T04:31:59.923Z" }, + { url = "https://files.pythonhosted.org/packages/a4/5f/3164cbdce06c9fb95c4f7b9e2f9760b5e2797af43a9ecc317ef42a23a278/watchfiles-1.2.0-cp315-cp315-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8520a4ab0e37f770afc34459c4f8f7019e153f9124dc101c15538365875d1ab2", size = 571641, upload-time = "2026-05-18T04:32:00.948Z" }, + { url = "https://files.pythonhosted.org/packages/41/e6/85d3731c55e65cd7690f3f803d24c139588aaf863e4bf2148fe7a7fa1a19/watchfiles-1.2.0-cp315-cp315-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:71cd71740ed2c15211ebb237ced4e39a1cdf6f80566e5fe95428da1626f4fde6", size = 464444, upload-time = "2026-05-18T04:30:34.298Z" }, + { url = "https://files.pythonhosted.org/packages/f4/7d/562641012b8b09872742c3b8adf9629ec479fd78f8d68ae4a0c13da8add6/watchfiles-1.2.0-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f88af53d6ddaf72179ef613ddc905e6f4785f712b49b80b3bef9f3525e6194b4", size = 453593, upload-time = "2026-05-18T04:31:23.464Z" }, + { url = "https://files.pythonhosted.org/packages/56/fe/cb8ef3d6f929d14158fdaaad9925985b7310abc9384dcd4d82dd0016fb59/watchfiles-1.2.0-cp315-cp315-manylinux_2_31_riscv64.whl", hash = "sha256:cee9d5efd929efdac5f7e58f72b3376f676b64050a91c5b99a7094c5b2317488", size = 465096, upload-time = "2026-05-18T04:31:30.384Z" }, + { url = "https://files.pythonhosted.org/packages/25/91/80908e835e100527a9267147b08c0eee1fa6ab0ffec15edc04d1d44885f7/watchfiles-1.2.0-cp315-cp315-musllinux_1_1_aarch64.whl", hash = "sha256:b718bf356bbc15e559bd8ef41782b573b8ae0e3f177ab244b440568d7ea02cfb", size = 630638, upload-time = "2026-05-18T04:30:49.89Z" }, + { url = "https://files.pythonhosted.org/packages/46/4b/95ab2f256bb4af3cb2eb23b9317bda984ee6e0f11733a5c004a6c95b06e3/watchfiles-1.2.0-cp315-cp315-musllinux_1_1_x86_64.whl", hash = "sha256:922c0e019fe68b3ae392965a766b02a71ba1168c932cebc3733cd52c5fe5b377", size = 657684, upload-time = "2026-05-18T04:31:32.027Z" }, + { url = "https://files.pythonhosted.org/packages/23/f4/7513ef1e85fc4c6331b59479d6d72661fc391fbe543678052ac72c8b6c19/watchfiles-1.2.0-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:4674d49eb94706dfe666c069fc0a1b646ffcf920473492e209f6d5f60d3f0cc2", size = 403050, upload-time = "2026-05-18T04:30:36.753Z" }, + { url = "https://files.pythonhosted.org/packages/27/0b/a54103cfd732bb703c7a749222011a0483ef3705948dae3b203158601119/watchfiles-1.2.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:094b9b70103d4e963499bdea001ee3c2697b144cd9ae6218a62c0f89ec9e31db", size = 396629, upload-time = "2026-05-18T04:32:03.268Z" }, + { url = "https://files.pythonhosted.org/packages/5e/2c/73f31a3b893886206c3f54d73e8ad8dee58cdb2f69ad2622e0a8a9e07f4e/watchfiles-1.2.0-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b0ef001f8c25ad0fa9529f914c1600647ecd0f542d11c19b7894768c67b6acb7", size = 457318, upload-time = "2026-05-18T04:31:01.932Z" }, + { url = "https://files.pythonhosted.org/packages/e9/f9/45d021e4a5cc7b9dd567f7cbb06d3b75f751a690063fb6cc7ec60f4e46b7/watchfiles-1.2.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a88fc94e647bc4eec523f1caa540258eb71d14278b9daf72fa1e2658a98df0f0", size = 457771, upload-time = "2026-05-18T04:30:56.331Z" }, ] [[package]] name = "websockets" -version = "15.0.1" +version = "16.1.1" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/21/e6/26d09fab466b7ca9c7737474c52be4f76a40301b08362eb2dbc19dcc16c1/websockets-15.0.1.tar.gz", hash = "sha256:82544de02076bafba038ce055ee6412d68da13ab47f0c60cab827346de828dee", size = 177016, upload-time = "2025-03-05T20:03:41.606Z" } +resolution-markers = [ + "python_full_version < '3.11' and sys_platform == 'win32'", + "python_full_version < '3.11' and sys_platform != 'win32'", +] +sdist = { url = "https://files.pythonhosted.org/packages/21/f7/bc3a25c5ec26ce62ce487690becc2f3710bbc7b33338f005ad390db0b986/websockets-16.1.1.tar.gz", hash = "sha256:db234eda965dcce15df96bb9709f587cd87d4d52aaf0e80e2f34ec04c7670c57", size = 182204, upload-time = "2026-07-17T22:51:05.858Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/1e/da/6462a9f510c0c49837bbc9345aca92d767a56c1fb2939e1579df1e1cdcf7/websockets-15.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d63efaa0cd96cf0c5fe4d581521d9fa87744540d4bc999ae6e08595a1014b45b", size = 175423, upload-time = "2025-03-05T20:01:35.363Z" }, - { url = "https://files.pythonhosted.org/packages/1c/9f/9d11c1a4eb046a9e106483b9ff69bce7ac880443f00e5ce64261b47b07e7/websockets-15.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ac60e3b188ec7574cb761b08d50fcedf9d77f1530352db4eef1707fe9dee7205", size = 173080, upload-time = "2025-03-05T20:01:37.304Z" }, - { url = "https://files.pythonhosted.org/packages/d5/4f/b462242432d93ea45f297b6179c7333dd0402b855a912a04e7fc61c0d71f/websockets-15.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5756779642579d902eed757b21b0164cd6fe338506a8083eb58af5c372e39d9a", size = 173329, upload-time = "2025-03-05T20:01:39.668Z" }, - { url = "https://files.pythonhosted.org/packages/6e/0c/6afa1f4644d7ed50284ac59cc70ef8abd44ccf7d45850d989ea7310538d0/websockets-15.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0fdfe3e2a29e4db3659dbd5bbf04560cea53dd9610273917799f1cde46aa725e", size = 182312, upload-time = "2025-03-05T20:01:41.815Z" }, - { url = "https://files.pythonhosted.org/packages/dd/d4/ffc8bd1350b229ca7a4db2a3e1c482cf87cea1baccd0ef3e72bc720caeec/websockets-15.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4c2529b320eb9e35af0fa3016c187dffb84a3ecc572bcee7c3ce302bfeba52bf", size = 181319, upload-time = "2025-03-05T20:01:43.967Z" }, - { url = "https://files.pythonhosted.org/packages/97/3a/5323a6bb94917af13bbb34009fac01e55c51dfde354f63692bf2533ffbc2/websockets-15.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac1e5c9054fe23226fb11e05a6e630837f074174c4c2f0fe442996112a6de4fb", size = 181631, upload-time = "2025-03-05T20:01:46.104Z" }, - { url = "https://files.pythonhosted.org/packages/a6/cc/1aeb0f7cee59ef065724041bb7ed667b6ab1eeffe5141696cccec2687b66/websockets-15.0.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:5df592cd503496351d6dc14f7cdad49f268d8e618f80dce0cd5a36b93c3fc08d", size = 182016, upload-time = "2025-03-05T20:01:47.603Z" }, - { url = "https://files.pythonhosted.org/packages/79/f9/c86f8f7af208e4161a7f7e02774e9d0a81c632ae76db2ff22549e1718a51/websockets-15.0.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:0a34631031a8f05657e8e90903e656959234f3a04552259458aac0b0f9ae6fd9", size = 181426, upload-time = "2025-03-05T20:01:48.949Z" }, - { url = "https://files.pythonhosted.org/packages/c7/b9/828b0bc6753db905b91df6ae477c0b14a141090df64fb17f8a9d7e3516cf/websockets-15.0.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:3d00075aa65772e7ce9e990cab3ff1de702aa09be3940d1dc88d5abf1ab8a09c", size = 181360, upload-time = "2025-03-05T20:01:50.938Z" }, - { url = "https://files.pythonhosted.org/packages/89/fb/250f5533ec468ba6327055b7d98b9df056fb1ce623b8b6aaafb30b55d02e/websockets-15.0.1-cp310-cp310-win32.whl", hash = "sha256:1234d4ef35db82f5446dca8e35a7da7964d02c127b095e172e54397fb6a6c256", size = 176388, upload-time = "2025-03-05T20:01:52.213Z" }, - { url = "https://files.pythonhosted.org/packages/1c/46/aca7082012768bb98e5608f01658ff3ac8437e563eca41cf068bd5849a5e/websockets-15.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:39c1fec2c11dc8d89bba6b2bf1556af381611a173ac2b511cf7231622058af41", size = 176830, upload-time = "2025-03-05T20:01:53.922Z" }, - { url = "https://files.pythonhosted.org/packages/9f/32/18fcd5919c293a398db67443acd33fde142f283853076049824fc58e6f75/websockets-15.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:823c248b690b2fd9303ba00c4f66cd5e2d8c3ba4aa968b2779be9532a4dad431", size = 175423, upload-time = "2025-03-05T20:01:56.276Z" }, - { url = "https://files.pythonhosted.org/packages/76/70/ba1ad96b07869275ef42e2ce21f07a5b0148936688c2baf7e4a1f60d5058/websockets-15.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678999709e68425ae2593acf2e3ebcbcf2e69885a5ee78f9eb80e6e371f1bf57", size = 173082, upload-time = "2025-03-05T20:01:57.563Z" }, - { url = "https://files.pythonhosted.org/packages/86/f2/10b55821dd40eb696ce4704a87d57774696f9451108cff0d2824c97e0f97/websockets-15.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d50fd1ee42388dcfb2b3676132c78116490976f1300da28eb629272d5d93e905", size = 173330, upload-time = "2025-03-05T20:01:59.063Z" }, - { url = "https://files.pythonhosted.org/packages/a5/90/1c37ae8b8a113d3daf1065222b6af61cc44102da95388ac0018fcb7d93d9/websockets-15.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d99e5546bf73dbad5bf3547174cd6cb8ba7273062a23808ffea025ecb1cf8562", size = 182878, upload-time = "2025-03-05T20:02:00.305Z" }, - { url = "https://files.pythonhosted.org/packages/8e/8d/96e8e288b2a41dffafb78e8904ea7367ee4f891dafc2ab8d87e2124cb3d3/websockets-15.0.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:66dd88c918e3287efc22409d426c8f729688d89a0c587c88971a0faa2c2f3792", size = 181883, upload-time = "2025-03-05T20:02:03.148Z" }, - { url = "https://files.pythonhosted.org/packages/93/1f/5d6dbf551766308f6f50f8baf8e9860be6182911e8106da7a7f73785f4c4/websockets-15.0.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8dd8327c795b3e3f219760fa603dcae1dcc148172290a8ab15158cf85a953413", size = 182252, upload-time = "2025-03-05T20:02:05.29Z" }, - { url = "https://files.pythonhosted.org/packages/d4/78/2d4fed9123e6620cbf1706c0de8a1632e1a28e7774d94346d7de1bba2ca3/websockets-15.0.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8fdc51055e6ff4adeb88d58a11042ec9a5eae317a0a53d12c062c8a8865909e8", size = 182521, upload-time = "2025-03-05T20:02:07.458Z" }, - { url = "https://files.pythonhosted.org/packages/e7/3b/66d4c1b444dd1a9823c4a81f50231b921bab54eee2f69e70319b4e21f1ca/websockets-15.0.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:693f0192126df6c2327cce3baa7c06f2a117575e32ab2308f7f8216c29d9e2e3", size = 181958, upload-time = "2025-03-05T20:02:09.842Z" }, - { url = "https://files.pythonhosted.org/packages/08/ff/e9eed2ee5fed6f76fdd6032ca5cd38c57ca9661430bb3d5fb2872dc8703c/websockets-15.0.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:54479983bd5fb469c38f2f5c7e3a24f9a4e70594cd68cd1fa6b9340dadaff7cf", size = 181918, upload-time = "2025-03-05T20:02:11.968Z" }, - { url = "https://files.pythonhosted.org/packages/d8/75/994634a49b7e12532be6a42103597b71098fd25900f7437d6055ed39930a/websockets-15.0.1-cp311-cp311-win32.whl", hash = "sha256:16b6c1b3e57799b9d38427dda63edcbe4926352c47cf88588c0be4ace18dac85", size = 176388, upload-time = "2025-03-05T20:02:13.32Z" }, - { url = "https://files.pythonhosted.org/packages/98/93/e36c73f78400a65f5e236cd376713c34182e6663f6889cd45a4a04d8f203/websockets-15.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:27ccee0071a0e75d22cb35849b1db43f2ecd3e161041ac1ee9d2352ddf72f065", size = 176828, upload-time = "2025-03-05T20:02:14.585Z" }, - { url = "https://files.pythonhosted.org/packages/51/6b/4545a0d843594f5d0771e86463606a3988b5a09ca5123136f8a76580dd63/websockets-15.0.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:3e90baa811a5d73f3ca0bcbf32064d663ed81318ab225ee4f427ad4e26e5aff3", size = 175437, upload-time = "2025-03-05T20:02:16.706Z" }, - { url = "https://files.pythonhosted.org/packages/f4/71/809a0f5f6a06522af902e0f2ea2757f71ead94610010cf570ab5c98e99ed/websockets-15.0.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:592f1a9fe869c778694f0aa806ba0374e97648ab57936f092fd9d87f8bc03665", size = 173096, upload-time = "2025-03-05T20:02:18.832Z" }, - { url = "https://files.pythonhosted.org/packages/3d/69/1a681dd6f02180916f116894181eab8b2e25b31e484c5d0eae637ec01f7c/websockets-15.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0701bc3cfcb9164d04a14b149fd74be7347a530ad3bbf15ab2c678a2cd3dd9a2", size = 173332, upload-time = "2025-03-05T20:02:20.187Z" }, - { url = "https://files.pythonhosted.org/packages/a6/02/0073b3952f5bce97eafbb35757f8d0d54812b6174ed8dd952aa08429bcc3/websockets-15.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8b56bdcdb4505c8078cb6c7157d9811a85790f2f2b3632c7d1462ab5783d215", size = 183152, upload-time = "2025-03-05T20:02:22.286Z" }, - { url = "https://files.pythonhosted.org/packages/74/45/c205c8480eafd114b428284840da0b1be9ffd0e4f87338dc95dc6ff961a1/websockets-15.0.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0af68c55afbd5f07986df82831c7bff04846928ea8d1fd7f30052638788bc9b5", size = 182096, upload-time = "2025-03-05T20:02:24.368Z" }, - { url = "https://files.pythonhosted.org/packages/14/8f/aa61f528fba38578ec553c145857a181384c72b98156f858ca5c8e82d9d3/websockets-15.0.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64dee438fed052b52e4f98f76c5790513235efaa1ef7f3f2192c392cd7c91b65", size = 182523, upload-time = "2025-03-05T20:02:25.669Z" }, - { url = "https://files.pythonhosted.org/packages/ec/6d/0267396610add5bc0d0d3e77f546d4cd287200804fe02323797de77dbce9/websockets-15.0.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:d5f6b181bb38171a8ad1d6aa58a67a6aa9d4b38d0f8c5f496b9e42561dfc62fe", size = 182790, upload-time = "2025-03-05T20:02:26.99Z" }, - { url = "https://files.pythonhosted.org/packages/02/05/c68c5adbf679cf610ae2f74a9b871ae84564462955d991178f95a1ddb7dd/websockets-15.0.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:5d54b09eba2bada6011aea5375542a157637b91029687eb4fdb2dab11059c1b4", size = 182165, upload-time = "2025-03-05T20:02:30.291Z" }, - { url = "https://files.pythonhosted.org/packages/29/93/bb672df7b2f5faac89761cb5fa34f5cec45a4026c383a4b5761c6cea5c16/websockets-15.0.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3be571a8b5afed347da347bfcf27ba12b069d9d7f42cb8c7028b5e98bbb12597", size = 182160, upload-time = "2025-03-05T20:02:31.634Z" }, - { url = "https://files.pythonhosted.org/packages/ff/83/de1f7709376dc3ca9b7eeb4b9a07b4526b14876b6d372a4dc62312bebee0/websockets-15.0.1-cp312-cp312-win32.whl", hash = "sha256:c338ffa0520bdb12fbc527265235639fb76e7bc7faafbb93f6ba80d9c06578a9", size = 176395, upload-time = "2025-03-05T20:02:33.017Z" }, - { url = "https://files.pythonhosted.org/packages/7d/71/abf2ebc3bbfa40f391ce1428c7168fb20582d0ff57019b69ea20fa698043/websockets-15.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:fcd5cf9e305d7b8338754470cf69cf81f420459dbae8a3b40cee57417f4614a7", size = 176841, upload-time = "2025-03-05T20:02:34.498Z" }, - { url = "https://files.pythonhosted.org/packages/cb/9f/51f0cf64471a9d2b4d0fc6c534f323b664e7095640c34562f5182e5a7195/websockets-15.0.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ee443ef070bb3b6ed74514f5efaa37a252af57c90eb33b956d35c8e9c10a1931", size = 175440, upload-time = "2025-03-05T20:02:36.695Z" }, - { url = "https://files.pythonhosted.org/packages/8a/05/aa116ec9943c718905997412c5989f7ed671bc0188ee2ba89520e8765d7b/websockets-15.0.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5a939de6b7b4e18ca683218320fc67ea886038265fd1ed30173f5ce3f8e85675", size = 173098, upload-time = "2025-03-05T20:02:37.985Z" }, - { url = "https://files.pythonhosted.org/packages/ff/0b/33cef55ff24f2d92924923c99926dcce78e7bd922d649467f0eda8368923/websockets-15.0.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:746ee8dba912cd6fc889a8147168991d50ed70447bf18bcda7039f7d2e3d9151", size = 173329, upload-time = "2025-03-05T20:02:39.298Z" }, - { url = "https://files.pythonhosted.org/packages/31/1d/063b25dcc01faa8fada1469bdf769de3768b7044eac9d41f734fd7b6ad6d/websockets-15.0.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:595b6c3969023ecf9041b2936ac3827e4623bfa3ccf007575f04c5a6aa318c22", size = 183111, upload-time = "2025-03-05T20:02:40.595Z" }, - { url = "https://files.pythonhosted.org/packages/93/53/9a87ee494a51bf63e4ec9241c1ccc4f7c2f45fff85d5bde2ff74fcb68b9e/websockets-15.0.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3c714d2fc58b5ca3e285461a4cc0c9a66bd0e24c5da9911e30158286c9b5be7f", size = 182054, upload-time = "2025-03-05T20:02:41.926Z" }, - { url = "https://files.pythonhosted.org/packages/ff/b2/83a6ddf56cdcbad4e3d841fcc55d6ba7d19aeb89c50f24dd7e859ec0805f/websockets-15.0.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f3c1e2ab208db911594ae5b4f79addeb3501604a165019dd221c0bdcabe4db8", size = 182496, upload-time = "2025-03-05T20:02:43.304Z" }, - { url = "https://files.pythonhosted.org/packages/98/41/e7038944ed0abf34c45aa4635ba28136f06052e08fc2168520bb8b25149f/websockets-15.0.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:229cf1d3ca6c1804400b0a9790dc66528e08a6a1feec0d5040e8b9eb14422375", size = 182829, upload-time = "2025-03-05T20:02:48.812Z" }, - { url = "https://files.pythonhosted.org/packages/e0/17/de15b6158680c7623c6ef0db361da965ab25d813ae54fcfeae2e5b9ef910/websockets-15.0.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:756c56e867a90fb00177d530dca4b097dd753cde348448a1012ed6c5131f8b7d", size = 182217, upload-time = "2025-03-05T20:02:50.14Z" }, - { url = "https://files.pythonhosted.org/packages/33/2b/1f168cb6041853eef0362fb9554c3824367c5560cbdaad89ac40f8c2edfc/websockets-15.0.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:558d023b3df0bffe50a04e710bc87742de35060580a293c2a984299ed83bc4e4", size = 182195, upload-time = "2025-03-05T20:02:51.561Z" }, - { url = "https://files.pythonhosted.org/packages/86/eb/20b6cdf273913d0ad05a6a14aed4b9a85591c18a987a3d47f20fa13dcc47/websockets-15.0.1-cp313-cp313-win32.whl", hash = "sha256:ba9e56e8ceeeedb2e080147ba85ffcd5cd0711b89576b83784d8605a7df455fa", size = 176393, upload-time = "2025-03-05T20:02:53.814Z" }, - { url = "https://files.pythonhosted.org/packages/1b/6c/c65773d6cab416a64d191d6ee8a8b1c68a09970ea6909d16965d26bfed1e/websockets-15.0.1-cp313-cp313-win_amd64.whl", hash = "sha256:e09473f095a819042ecb2ab9465aee615bd9c2028e4ef7d933600a8401c79561", size = 176837, upload-time = "2025-03-05T20:02:55.237Z" }, - { url = "https://files.pythonhosted.org/packages/02/9e/d40f779fa16f74d3468357197af8d6ad07e7c5a27ea1ca74ceb38986f77a/websockets-15.0.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:0c9e74d766f2818bb95f84c25be4dea09841ac0f734d1966f415e4edfc4ef1c3", size = 173109, upload-time = "2025-03-05T20:03:17.769Z" }, - { url = "https://files.pythonhosted.org/packages/bc/cd/5b887b8585a593073fd92f7c23ecd3985cd2c3175025a91b0d69b0551372/websockets-15.0.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1009ee0c7739c08a0cd59de430d6de452a55e42d6b522de7aa15e6f67db0b8e1", size = 173343, upload-time = "2025-03-05T20:03:19.094Z" }, - { url = "https://files.pythonhosted.org/packages/fe/ae/d34f7556890341e900a95acf4886833646306269f899d58ad62f588bf410/websockets-15.0.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:76d1f20b1c7a2fa82367e04982e708723ba0e7b8d43aa643d3dcd404d74f1475", size = 174599, upload-time = "2025-03-05T20:03:21.1Z" }, - { url = "https://files.pythonhosted.org/packages/71/e6/5fd43993a87db364ec60fc1d608273a1a465c0caba69176dd160e197ce42/websockets-15.0.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f29d80eb9a9263b8d109135351caf568cc3f80b9928bccde535c235de55c22d9", size = 174207, upload-time = "2025-03-05T20:03:23.221Z" }, - { url = "https://files.pythonhosted.org/packages/2b/fb/c492d6daa5ec067c2988ac80c61359ace5c4c674c532985ac5a123436cec/websockets-15.0.1-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b359ed09954d7c18bbc1680f380c7301f92c60bf924171629c5db97febb12f04", size = 174155, upload-time = "2025-03-05T20:03:25.321Z" }, - { url = "https://files.pythonhosted.org/packages/68/a1/dcb68430b1d00b698ae7a7e0194433bce4f07ded185f0ee5fb21e2a2e91e/websockets-15.0.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:cad21560da69f4ce7658ca2cb83138fb4cf695a2ba3e475e0559e05991aa8122", size = 176884, upload-time = "2025-03-05T20:03:27.934Z" }, - { url = "https://files.pythonhosted.org/packages/fa/a8/5b41e0da817d64113292ab1f8247140aac61cbf6cfd085d6a0fa77f4984f/websockets-15.0.1-py3-none-any.whl", hash = "sha256:f7a866fbc1e97b5c617ee4116daaa09b722101d4a3c170c787450ba409f9736f", size = 169743, upload-time = "2025-03-05T20:03:39.41Z" }, + { url = "https://files.pythonhosted.org/packages/08/e7/d1671fb984f9dd844e1da5288070c7c23c9eaba3082d3871aae19c3ab8b9/websockets-16.1.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:49ae99bdfcae803a885c926bf14f886196e84925395bb3f568fef5c0f0979d7d", size = 179570, upload-time = "2026-07-17T22:48:24.032Z" }, + { url = "https://files.pythonhosted.org/packages/99/f5/70df723bf571f5e0b1b845e0a4ff1c966eeb84f667599fc251caa37d15a3/websockets-16.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5bfd1ac19b1b9986a9c95a82d5e23a391ebb09e12c34d7be6094b86efcc35731", size = 177252, upload-time = "2026-07-17T22:48:25.775Z" }, + { url = "https://files.pythonhosted.org/packages/90/72/2f14b2e167170b8bf1c8bb7f9b0d78000f470d41a2085a91f33e3917b6c9/websockets-16.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9246a0d063cfcbcc85f2359dd6876d681213f4790832272aa16641b4ed5d64d4", size = 177530, upload-time = "2026-07-17T22:48:27.337Z" }, + { url = "https://files.pythonhosted.org/packages/f3/18/a17e2f0cde02dc10154c808deed7e1d8528afff93612f70d3f0a5b19b011/websockets-16.1.1-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:1214e673c404684b9bf7154f5cf43b45025b1a6160fac3a9e438e9c1a97e22cb", size = 186038, upload-time = "2026-07-17T22:48:28.756Z" }, + { url = "https://files.pythonhosted.org/packages/d5/b0/41de283899cf5929d637b72a508cdbc9aa40dc0f317c6b77613fd1000488/websockets-16.1.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:90001d893bc368e302ef168d82130b4e4fdd27b85fa094682df9b667c2d48838", size = 187278, upload-time = "2026-07-17T22:48:30.328Z" }, + { url = "https://files.pythonhosted.org/packages/50/61/874aab5257e027f9f61b5004cec65e592babca7942b1bc09f38e72b7f1fd/websockets-16.1.1-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:130937b167a52af203c8d58e78d67705874e82759862e3b9671a452fec4abc87", size = 189936, upload-time = "2026-07-17T22:48:31.896Z" }, + { url = "https://files.pythonhosted.org/packages/a6/1a/42173913ac5519607220849ed417c864d77384e4119f06dbba964a50f096/websockets-16.1.1-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:9c9f23004a3d40e89c01a7955d186a6cc83418d93b749701944ce2de3e95a1f3", size = 187796, upload-time = "2026-07-17T22:48:33.344Z" }, + { url = "https://files.pythonhosted.org/packages/1b/f4/37c1840bd89b529479aec41470b97b7c683b107ca90b6399ac5afb99dedf/websockets-16.1.1-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f55f0b01956a094c8587146d9558c91937e78789c333860ffaf35931a6e5dbc4", size = 186481, upload-time = "2026-07-17T22:48:34.843Z" }, + { url = "https://files.pythonhosted.org/packages/9e/70/652d9b964adcfbeb056f42e0ca6bece34d108fe75534e74df20643cae199/websockets-16.1.1-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6aaface73b9c71974c6497366d8b9628357f6c9749e09c4ea3610176c63f2ae3", size = 184351, upload-time = "2026-07-17T22:48:36.307Z" }, + { url = "https://files.pythonhosted.org/packages/13/f1/af3850e5d48d482921985be72ebcb169c6180b3a77b57bd612deebcee23b/websockets-16.1.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:dc0fad4933f427acd5b1cec210f3ea6dce7089e1724e4b9ec6ef47c6c04d1b3b", size = 186791, upload-time = "2026-07-17T22:48:37.762Z" }, + { url = "https://files.pythonhosted.org/packages/1d/40/1a4e3ed4969ec378dcad337e5f1472c5e292cb3e733bc392f0dc2e230abd/websockets-16.1.1-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:f2769a0344a09e9ccf5b3cce538bc75a51b53eff3275d3896310c8552049195d", size = 185413, upload-time = "2026-07-17T22:48:39.127Z" }, + { url = "https://files.pythonhosted.org/packages/aa/3e/4e3fa1afe8f1a6a780434cd9ba8eb422632b044eff3dd73f6af67523c147/websockets-16.1.1-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:f70541f3104339f59f830522d94ebadb1bf47426287381623443d8bb1cdbf33d", size = 187178, upload-time = "2026-07-17T22:48:40.676Z" }, + { url = "https://files.pythonhosted.org/packages/71/ab/dd742766aa5dda7f349be0de49e4d565b84cf6f7f7fa02e07692f0f2bdd9/websockets-16.1.1-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:dc385593a42e31cd6fb60c19f0ecb015b386603818fc2c6c274fb42bd2bb4165", size = 185051, upload-time = "2026-07-17T22:48:42.098Z" }, + { url = "https://files.pythonhosted.org/packages/ae/f5/76438c6560f416f1c0a7f587679fb97cc6e99ed336011d43ce2002dd27c1/websockets-16.1.1-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:387e8e4aa5df2f90b198fa3cad3478822a89cf905b6a6d6c97dc3664689640cc", size = 185846, upload-time = "2026-07-17T22:48:43.472Z" }, + { url = "https://files.pythonhosted.org/packages/62/12/5c0320f2127823d27b2d56d611d31b0b284ad4edcb41364d66bf4c92b537/websockets-16.1.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:fd46fff7eb62c24804d234f0051c7a8ea81285ad63e0337d3dcf33ca82aee58a", size = 186066, upload-time = "2026-07-17T22:48:44.884Z" }, + { url = "https://files.pythonhosted.org/packages/a2/97/875986b857b955c3f9dd192cb8a1af81254dfb2ea22cc9590f0a1e020b8b/websockets-16.1.1-cp310-cp310-win32.whl", hash = "sha256:7883388947767080f094950b342b30d35a2a06b849cd967c422fa0db72b40ea9", size = 179940, upload-time = "2026-07-17T22:48:46.481Z" }, + { url = "https://files.pythonhosted.org/packages/54/82/1013a5fe7ddae8e102bc3b4b39db81d8d28fd02100a324ce6ede8cd832b1/websockets-16.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:d57685547e0060cc6fd90ee6a28405d6bd395e525545f13c8d7cd99c78afd79f", size = 180239, upload-time = "2026-07-17T22:48:48.043Z" }, + { url = "https://files.pythonhosted.org/packages/2b/03/47debfe28e9d6d354be5d777b67fd44c359b9eb299a5d103500bd7cc3e37/websockets-16.1.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d0fcf657e9f13ff4b177960ab2200237b12994232dfb6df16f1cfe1d4339f93c", size = 179566, upload-time = "2026-07-17T22:48:49.596Z" }, + { url = "https://files.pythonhosted.org/packages/72/93/31efa1ed78c17e5cfc229fd449e3966e1b9cc15753204cd585cc8dd01f4a/websockets-16.1.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b852788aa51764e2d8e4cf5493d559326bcae5e38d16ba25ffa322b034df272a", size = 177250, upload-time = "2026-07-17T22:48:50.942Z" }, + { url = "https://files.pythonhosted.org/packages/01/4a/542378ab3972b0c1cf1df3df3eff9591cea0d30c58c3aa3c4ddbc244e787/websockets-16.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1427fb4cf0d72f66333e2cacc3ff5f575bf2d7008166ce991a4a470b21d51a22", size = 177528, upload-time = "2026-07-17T22:48:52.59Z" }, + { url = "https://files.pythonhosted.org/packages/33/d9/162321f63c7eed558e9e1798ed7a1e34a4f6dab51f35419e4ed7a4907979/websockets-16.1.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:da4ca1a9d72f9030b3146b8d7022719a9f3d478f61efe6f7dd51d243f61c51b2", size = 186859, upload-time = "2026-07-17T22:48:53.915Z" }, + { url = "https://files.pythonhosted.org/packages/de/09/87df740f7430ce564bd52402e9c9458d4d0459cc7d2ee29e530c8204851b/websockets-16.1.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:86d7f0f8bdb25d2c632b72527325e4776430fd5bc61b9118de4e2b8ddb5f5b01", size = 188095, upload-time = "2026-07-17T22:48:55.384Z" }, + { url = "https://files.pythonhosted.org/packages/d2/12/3d2703af7cc095f3c81904c92208cc1ae79affbc67376944b50ee9301f73/websockets-16.1.1-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:7dfcad78ea1492ee3a9ec765cb7f51bbc17d477107aaf6b22abf7b2558d1c5a0", size = 191385, upload-time = "2026-07-17T22:48:56.742Z" }, + { url = "https://files.pythonhosted.org/packages/1d/69/986aa0234a964a00f5149cfc46e136e96c8faad1c783474550f40d31aef4/websockets-16.1.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:fb9a0a6dc3d1b3986cb88091b6899f0396651e0f74e2c9766ab8d6ffc3842e29", size = 188653, upload-time = "2026-07-17T22:48:58.134Z" }, + { url = "https://files.pythonhosted.org/packages/35/6b/10f9d03e3970a69ba67bd3b46b87a929b586d0300fadbfe14f57c1f85490/websockets-16.1.1-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:29dfa8114c4a620c69591c5973860f768eac29d3fd6904f37f34266cb219c512", size = 187426, upload-time = "2026-07-17T22:48:59.515Z" }, + { url = "https://files.pythonhosted.org/packages/56/db/bb3aad62bf63d8bb3f0634b2eabffcfb3677a34bd19492110ff6869cf703/websockets-16.1.1-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6ff9417c0ada4d0f7d212f928303e5579bdf3ace4c802fa4afabb30995da58c3", size = 184882, upload-time = "2026-07-17T22:49:00.916Z" }, + { url = "https://files.pythonhosted.org/packages/6c/4c/c09a2ea9bfbeccce52fdc383e5f28af4bc8843338aabac28c81489af6120/websockets-16.1.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8fe0b50da2d84535fb4f7b4bfa951280f97ce3d558a0443b541166d609e67b57", size = 187584, upload-time = "2026-07-17T22:49:02.283Z" }, + { url = "https://files.pythonhosted.org/packages/c7/8b/31bb4eb4d9eaacf1fdd39d115772a8aeaedfc19b5dc262e57ffbc8a9d42c/websockets-16.1.1-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:34420aaa64440ebd51ac72ca8a45ef4626429438c9b02e633ae412ed43f925d3", size = 186174, upload-time = "2026-07-17T22:49:03.973Z" }, + { url = "https://files.pythonhosted.org/packages/2f/e4/dc02d725610a1ad49e193ef91a548194d71bdc6cdf27da83067dd1f73995/websockets-16.1.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:a6a61aff018180c9c50b7b0da33bfd29d378af3497429c95006c589a23a11648", size = 187986, upload-time = "2026-07-17T22:49:05.553Z" }, + { url = "https://files.pythonhosted.org/packages/e0/73/30ed84c8bfd14c73d4af29d5ed9323c3073b48e0b7b23b67070f4e7fd59b/websockets-16.1.1-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:04fd29a0e2fe9414a95b00e92c67ae51bf900c50c0f8a4b2dafdad621f49ea1d", size = 185565, upload-time = "2026-07-17T22:49:06.959Z" }, + { url = "https://files.pythonhosted.org/packages/7d/d3/4be8d4959f51e31b4f8fc0ece12b45bd3b6c0d15ea23b9990d9c11fc805f/websockets-16.1.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:5c31aa7e39ee3e8a358573257f1c0bb5c52430d1b637030dd9c8cc2c282926be", size = 186598, upload-time = "2026-07-17T22:49:08.293Z" }, + { url = "https://files.pythonhosted.org/packages/26/fa/abb38597a52d84ed9cfacadc7a0c6f2db282c0ab23cdf72b58a666a21227/websockets-16.1.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:d14bfb217eb4701e850f1525c9d29d79c44794cdf1c299ead25f39f8c78dea81", size = 186834, upload-time = "2026-07-17T22:49:09.766Z" }, + { url = "https://files.pythonhosted.org/packages/59/80/1119ad08a228b90c4eb77fbe48df7836731a605f5f881ba701ca826a4a65/websockets-16.1.1-cp311-cp311-win32.whl", hash = "sha256:2e28e602bb13da44fbe518c1781a88e3b9d4c3d48d02c9bad83e546164336f57", size = 179940, upload-time = "2026-07-17T22:49:11.196Z" }, + { url = "https://files.pythonhosted.org/packages/71/b2/e511c1c6f64a95c2f3fc54bffda0e14eaa7e9442be605c29270f7589b918/websockets-16.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:7421fad442de870a8cbf2287d1cad7e706ece0dbfeba5e911df132cbdc1cb56a", size = 180239, upload-time = "2026-07-17T22:49:12.519Z" }, + { url = "https://files.pythonhosted.org/packages/17/9d/681cda21c9eee743203a6cb79b9d3d05adad9aa60ec660c6c9bf4dd619ca/websockets-16.1.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:cc97814dfb786a83b6e2dc2e79351e1b83e6d715647d6887fcabd83026417a00", size = 179600, upload-time = "2026-07-17T22:49:13.92Z" }, + { url = "https://files.pythonhosted.org/packages/fb/8d/6195a88b45e8d2a8f745fc2046e36f885a3c9763e6767d2c46229bf9510c/websockets-16.1.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:e047dc87ef7ca50f4d309bf775ad4a71711c58556d75d7bd0604b2317f43e94b", size = 177272, upload-time = "2026-07-17T22:49:15.453Z" }, + { url = "https://files.pythonhosted.org/packages/73/e3/fe2d498c64dea0095c9a9f9a351af4cd6eef31b618395582bc1f38ba45ff/websockets-16.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:01fbdcbac298efe19360b94bc0039c8f746f0220ba570f327577bfee81059175", size = 177542, upload-time = "2026-07-17T22:49:16.875Z" }, + { url = "https://files.pythonhosted.org/packages/fe/ed/f1831681fce0e3242346e5458486003c5f124ed69e5e0b847fd029db4973/websockets-16.1.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:0f62863e8a00a6d33c3d6566ec0b89f23787b747ffe0c3bc71ec0e76b82c94b1", size = 187137, upload-time = "2026-07-17T22:49:18.323Z" }, + { url = "https://files.pythonhosted.org/packages/6f/79/4ff9dcc1bb46f6b4c536936dde1fd60f9b564f3304307274db97f4c9496d/websockets-16.1.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8087e82f842609734c9b5a1330464f8e94e346ba0e18c832c08bafa4b0d63c15", size = 188374, upload-time = "2026-07-17T22:49:19.65Z" }, + { url = "https://files.pythonhosted.org/packages/62/c3/5c49b6efb36cab733d23773f6de575e1dba65736ead17d5d2b2a1daef779/websockets-16.1.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:2bb5d041a8307d2e18782e7ce777f6fdb1e8c2f5d09291484b18c294b789d9aa", size = 191155, upload-time = "2026-07-17T22:49:21.331Z" }, + { url = "https://files.pythonhosted.org/packages/6e/f6/56ccceda3a4838d18f1d40821480da4775397e8b1eecf4031e20c50e2e90/websockets-16.1.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:1db4de4a0e95673f7545d393c49eeb0c2f18ac1ef93073218c79d5cdb2ee75ab", size = 189011, upload-time = "2026-07-17T22:49:22.889Z" }, + { url = "https://files.pythonhosted.org/packages/86/d6/ad5286241a2bce1107e2798d3bfbd62cf79aee167bdb654f8cb1e9dbf949/websockets-16.1.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f17dbe07eb3ea7f99e4df9b7e0efefe80fbf30d37a8cc4d561a0aed310bc8847", size = 187766, upload-time = "2026-07-17T22:49:24.339Z" }, + { url = "https://files.pythonhosted.org/packages/bc/67/d65c970b7e347fdca69479beb7811c2060529956730a7a4e3ae7c66b0e31/websockets-16.1.1-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:4b57693728576d84ede0a77987ab16881b783d2cd9f1dc180a8fbbc3f79c4428", size = 185173, upload-time = "2026-07-17T22:49:25.743Z" }, + { url = "https://files.pythonhosted.org/packages/1d/5b/14af3cd4ee69d8ea9baca58f3dc3cfb1ba78332a347fd478cb096549d60e/websockets-16.1.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:2a636ff1e7a5c4edf71ef0e79adae7f25dba93b4fcbe3dc958733477ffeb0eaf", size = 187809, upload-time = "2026-07-17T22:49:27.147Z" }, + { url = "https://files.pythonhosted.org/packages/7b/11/be301710d70de97e3e7b3586e6d492c9c06d6a61bf1c2202c36cf0c75607/websockets-16.1.1-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:d6bec75c290fe484a8ba4cacdf838501e17c06ecfbbf31eede81a9e431bd7751", size = 186412, upload-time = "2026-07-17T22:49:28.611Z" }, + { url = "https://files.pythonhosted.org/packages/db/07/fe1435bf6fe738a3d3b54dbe0c18dabf12cba4d909ac8b58b539ce27c1f4/websockets-16.1.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:54509b8e92fee4453e152b7558ddef37ce9705a044922f2095a6105e3f80c96f", size = 188290, upload-time = "2026-07-17T22:49:29.965Z" }, + { url = "https://files.pythonhosted.org/packages/8a/0a/81f394aff8efcbb01208c1ced77df0a3c7fcce584a88c7273663697946c2/websockets-16.1.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:f0aa4aad3b1b69ad3fd85a0fd0952ec64331c762bd77ec51cc814170873890b2", size = 185844, upload-time = "2026-07-17T22:49:31.447Z" }, + { url = "https://files.pythonhosted.org/packages/39/5c/dd485b995473f415510251fe9bd708f2d24458f439fce958daf8d66dc7c6/websockets-16.1.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:42290eb6db4ccaca7012656738214f8514082fb6fa40cdeb61bb9a471b52e383", size = 186823, upload-time = "2026-07-17T22:49:33.104Z" }, + { url = "https://files.pythonhosted.org/packages/9d/0b/f78de76ff446f1e66af12b43c48a35f31744de93cfdec2f4ea67d5d7bbf1/websockets-16.1.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:53260c8930da5771cec89439bff99c20c8cb03ddb9588b980697355a83cd4bd3", size = 187102, upload-time = "2026-07-17T22:49:34.616Z" }, + { url = "https://files.pythonhosted.org/packages/37/a1/4cf892007778eaf84ad162bfc98046e0ed89b63ac55949e3236626b2a23f/websockets-16.1.1-cp312-cp312-win32.whl", hash = "sha256:1d27fa8462ad6a1cb36206a3d0640b2333340def181fae11ed7f9adeaa5c0747", size = 179943, upload-time = "2026-07-17T22:49:36.213Z" }, + { url = "https://files.pythonhosted.org/packages/d9/de/6abe251d28c3a3f217096575400b27750b18e0b1d2fff3a2a239960fea07/websockets-16.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:b436f6ec4fc3a6b4237c84d3f83170ed2b40bb584222f0ac47a0c8a5921980c7", size = 180243, upload-time = "2026-07-17T22:49:37.626Z" }, + { url = "https://files.pythonhosted.org/packages/ce/fd/6ec6c6d2850aea25b1b2aa9901a016980bb87d01e89b3eb00470b1b5d471/websockets-16.1.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ab59169ace05dcb49a1d4118f0bde139557adf45091bd85747e36bf5de984dd1", size = 179587, upload-time = "2026-07-17T22:49:38.959Z" }, + { url = "https://files.pythonhosted.org/packages/5f/d8/1d299d2dd34087db39831a34cc645ef8a6f89d78efada6983093513cd81c/websockets-16.1.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5e3b7d601f6f84156b08cc4a5e541c2b50ad7b36cfc302b657a12477c904a5df", size = 177272, upload-time = "2026-07-17T22:49:40.293Z" }, + { url = "https://files.pythonhosted.org/packages/3d/86/0a70d3ae2f0f2256bb41302d9804dbca65d4360281e7feb3e1f94102ac46/websockets-16.1.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:cd2ca96a082a36964aca83e992f72abeb61b7306c1a6cba4c7d06a7b93750cac", size = 177530, upload-time = "2026-07-17T22:49:41.786Z" }, + { url = "https://files.pythonhosted.org/packages/b5/c2/c676c69444d9db448b3f0a55a98dcc534affce0bce961d9d2f0b8499b10a/websockets-16.1.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:f5d497865f05bb222cab7016c6034542e84e5f29f49c6fd3f4939cda7197b5b8", size = 187197, upload-time = "2026-07-17T22:49:43.658Z" }, + { url = "https://files.pythonhosted.org/packages/0b/13/88137fbaf726ebe29d62c1117fa11fa2bbb6209dc79d4ad738efbe36a2aa/websockets-16.1.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bae954c382e013d5ea5b190d2830526bfa45ad121c326da0049b8c769f185db6", size = 188433, upload-time = "2026-07-17T22:49:45.147Z" }, + { url = "https://files.pythonhosted.org/packages/01/6d/46c2f2ce6751cb26f39293e1ecbf8544cb01321397cd476c2756b98c216d/websockets-16.1.1-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:e09f753a169951eb4f28c2c774f71069304f66e7277e0f5a2892423599cfa854", size = 189868, upload-time = "2026-07-17T22:49:46.581Z" }, + { url = "https://files.pythonhosted.org/packages/29/2b/170a9e8097636cfde4dc3c592b6e00b18a44a2f5407606d96ca542dd5838/websockets-16.1.1-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:024193f8551a2b0eafbdd160911012c4e6c228c28430c84433253299a9e42d6a", size = 189059, upload-time = "2026-07-17T22:49:47.972Z" }, + { url = "https://files.pythonhosted.org/packages/a7/48/f0d4ebc9ab4b473b8861b9e20fdb663d515d42f7befdf62cdb60fee7a1ec/websockets-16.1.1-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:aabe464bfd13bd25f4821faf111da6fefdc389f870265a53105580e45b0a2e49", size = 187814, upload-time = "2026-07-17T22:49:49.344Z" }, + { url = "https://files.pythonhosted.org/packages/d5/ba/39a41d3ae8e72696a9492581900611c5a91e2b07563b0bcd2523adea9854/websockets-16.1.1-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a28fcbc9b6baf54a2e23f8655f308e4ccc6afdd7266f8fe7954f320dcda0f785", size = 185229, upload-time = "2026-07-17T22:49:50.787Z" }, + { url = "https://files.pythonhosted.org/packages/3c/36/ac15b604f850d1907f0a85ed721cefe47cd45034b3620069b829746cccbe/websockets-16.1.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:79eace538c6a97e96d0d03d4f9d314f9677f5ed85a8a984992ffd90b13cb8a56", size = 187874, upload-time = "2026-07-17T22:49:52.228Z" }, + { url = "https://files.pythonhosted.org/packages/a8/f3/3fbd5d71d59299c3770faa5884d4f45070236ca5a35ab3a61830812c409a/websockets-16.1.1-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:496af849a472b531f758dbd4d61338f5000538cb1a7b3d20d9d32a264517f509", size = 186469, upload-time = "2026-07-17T22:49:53.776Z" }, + { url = "https://files.pythonhosted.org/packages/b4/fc/dd90349bba58af2a53ef2ddd9c32716c81eb6d59a0687939fff561860878/websockets-16.1.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:5283810d2646741a0d8da2aa733d6aefa0545809afccb2a5d105a26bc45125f1", size = 188347, upload-time = "2026-07-17T22:49:55.202Z" }, + { url = "https://files.pythonhosted.org/packages/4c/f3/f73ba86427682da59b78c11d77ba56d5b801c32e84afe79b274bbd6a9bb2/websockets-16.1.1-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:4e3b680b1e0a27457e727a0d572fd81dffa87b6dbf8b228ab57da64f7d85aead", size = 185903, upload-time = "2026-07-17T22:49:56.75Z" }, + { url = "https://files.pythonhosted.org/packages/34/7c/f95eb20e80104173b3a0a092291f89ea4047ef6e608e0a57ca06eb14eecb/websockets-16.1.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:69159730a823dde3ea8d08783e8d47ef135a6d7e8d44eb127e32b321c9db8e3e", size = 186855, upload-time = "2026-07-17T22:49:58.467Z" }, + { url = "https://files.pythonhosted.org/packages/b0/35/dd875b3e050ff232d60fa377707f890e369f74d134f1be32e8f68879747c/websockets-16.1.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ed5bb271084b46530ee2ddc0410537a9961152c5ccba2fc98c5276d992ccba87", size = 187140, upload-time = "2026-07-17T22:50:00.016Z" }, + { url = "https://files.pythonhosted.org/packages/e8/dc/5cbfcb41824502f6af93b8f3943a4d06c67c23c7d2e31eb18748c4a5b2a7/websockets-16.1.1-cp313-cp313-win32.whl", hash = "sha256:cfb70b4eb56cac4da0a83588f3ad50d46beb0690391082f3d4e2d488c70b68ea", size = 179928, upload-time = "2026-07-17T22:50:01.685Z" }, + { url = "https://files.pythonhosted.org/packages/b0/c1/71e5deb5b7f8f226997ab64908c184ac3105c0155ce2d486f318e5dd08a8/websockets-16.1.1-cp313-cp313-win_amd64.whl", hash = "sha256:d9531d9cbeac99af6f038fb1bc351403531f7d634a2c2e10e2f7c854c6ed5b68", size = 180242, upload-time = "2026-07-17T22:50:03.117Z" }, + { url = "https://files.pythonhosted.org/packages/73/a2/ba78a164eeea4620df4a4df4bd2ed6017438c4655cc0f36f2c0bc0432355/websockets-16.1.1-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:443aefe96b7fdb132e2a70806cca1f2af49bb3f28e47abcd7c2e9dcf4d8fa1b8", size = 179635, upload-time = "2026-07-17T22:50:05.001Z" }, + { url = "https://files.pythonhosted.org/packages/b9/08/d26d7a7628cd4ac34cbbdb63ac80914ca842ed8e42938c40a53567806df3/websockets-16.1.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:6456ff333092d509127d75a638cb411afae8ff17f092635015d1902efec8a293", size = 177320, upload-time = "2026-07-17T22:50:06.427Z" }, + { url = "https://files.pythonhosted.org/packages/0f/45/ebec83e6269536aa5932533c67b0af5c781f3e73fdbcd68672dcf43f4f44/websockets-16.1.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:fce6c48559c86d1ac3632ccb1bebc7d5442fbe79bd9bb0e40379ee54be2a4051", size = 177544, upload-time = "2026-07-17T22:50:07.834Z" }, + { url = "https://files.pythonhosted.org/packages/c9/d5/abc614d2297f6c1c3e01e61260364457a47c25cc1cf6a879038902bc6aa8/websockets-16.1.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:92b820d345f7a3fc7b8163949ee92df910f290c3fc517b3d5301c78065adafe1", size = 187270, upload-time = "2026-07-17T22:50:09.275Z" }, + { url = "https://files.pythonhosted.org/packages/52/71/4c99af3b87dff1b2927981f6876607d4acb45338c665242168d3982f7758/websockets-16.1.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2a606d9c24035242a3e256e9d5b77ed9cd6bccfcb7cf993e5ca3c0f6f68fb6a7", size = 188509, upload-time = "2026-07-17T22:50:10.722Z" }, + { url = "https://files.pythonhosted.org/packages/9b/b4/5c8ca14b0df7eb84ed0524165c5359150210140817a3312aee57bf62a1cf/websockets-16.1.1-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:414e596c75f74e0994084694189d7dc9229fb278e33064d6784b73ffbba3ca31", size = 189882, upload-time = "2026-07-17T22:50:12.293Z" }, + { url = "https://files.pythonhosted.org/packages/25/c1/bedfba9e70557129cb8083748d167bdcc01483dedf0f0df143676df05cbe/websockets-16.1.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:536676848fc5961aca9d20389951f59169508f765637a172403dc5434d722fa0", size = 189114, upload-time = "2026-07-17T22:50:13.789Z" }, + { url = "https://files.pythonhosted.org/packages/df/09/aa835b2787835aebd839114be5de51b797cb480b63ba42b26d34dfe147cb/websockets-16.1.1-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:97fd3a0e8b53efa41970ac1dff3d8cf0d2884cadeb4caaf95db7ad1526926ee3", size = 187861, upload-time = "2026-07-17T22:50:15.179Z" }, + { url = "https://files.pythonhosted.org/packages/20/26/f6408330694dbc9830857d9d23bc14ac4f6875127a480cfdda8d5ca21198/websockets-16.1.1-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:7b1b19636af86a3c7995d4d028dbe376f39b4bf31541146f9c123582a6c94562", size = 185286, upload-time = "2026-07-17T22:50:16.741Z" }, + { url = "https://files.pythonhosted.org/packages/17/9a/e0675e70dd8a80762cf35bb18799d3f290a4890ffe6439bc51d222796083/websockets-16.1.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:41c8e77f17294c0ac18008a7309b99b34ee72247ef10b6dff4c3f8b5ac29896b", size = 187935, upload-time = "2026-07-17T22:50:18.213Z" }, + { url = "https://files.pythonhosted.org/packages/33/c1/3234cfb86afde01b81e9bddcc6e534c440975d60a13991259e833069ab3e/websockets-16.1.1-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:9f63bcef7f4b02b06b35fc01c93b96c43b5e88e1e8868676caacf493d5a31f3a", size = 186444, upload-time = "2026-07-17T22:50:19.67Z" }, + { url = "https://files.pythonhosted.org/packages/89/87/9c15206e1d778923d8daa9657de07aa62ea815e13448319c98458c37b281/websockets-16.1.1-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:dab9eb87869da2d6ed3af3f3adf28414baae6ec9d4df355ffc18889132f3436c", size = 188409, upload-time = "2026-07-17T22:50:21.28Z" }, + { url = "https://files.pythonhosted.org/packages/f2/00/cf5de5c67676de2d3eef8b2a518f168f6796595447a5b7161ba0d012915c/websockets-16.1.1-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:43e3a9fdd7cbf7ba6040c31fae0faf84ca1474fef777c4e37912f1540f854499", size = 185958, upload-time = "2026-07-17T22:50:22.719Z" }, + { url = "https://files.pythonhosted.org/packages/62/c0/731b6ddede2e4136912ec4cff2cffbda35af73546be4762c3d7bd3bd79af/websockets-16.1.1-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:056ae37939ed7e9974f364f5864e76e49182622d8f9751ac1903c0d09b013985", size = 186911, upload-time = "2026-07-17T22:50:24.108Z" }, + { url = "https://files.pythonhosted.org/packages/8c/7f/39c634472c4469a24a7c09cecddffb08fac6d0e74f73881a94ee8a40a196/websockets-16.1.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:a0eadbbf2c30f01efa58e1f110eb6fa293261f6b0b1aa38f7f48707107690af9", size = 187204, upload-time = "2026-07-17T22:50:25.548Z" }, + { url = "https://files.pythonhosted.org/packages/26/89/9667c256c256dafcc62d21328ce7a40067da857969b68ee9af375b0aaf72/websockets-16.1.1-cp314-cp314-win32.whl", hash = "sha256:195c978b065fa40910582464f99d6b15c8b314c68e0546549a55ed83f4735328", size = 179603, upload-time = "2026-07-17T22:50:27.086Z" }, + { url = "https://files.pythonhosted.org/packages/bd/dd/1c099d6c0fc5deb6b46ccdbb6981fdb4b12c917869cb3952408409dc18db/websockets-16.1.1-cp314-cp314-win_amd64.whl", hash = "sha256:4e8d01cc3bcae7bbf8167f944aeafefed590fae5693552bba9794a9df68371cc", size = 179948, upload-time = "2026-07-17T22:50:28.521Z" }, + { url = "https://files.pythonhosted.org/packages/35/25/9956b2d5e0529d5d23924f21bba1440d4c5c88a562e4f08550871ffa97a7/websockets-16.1.1-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:0ffd3031ea8bda8d61762e84220186105ba3b748b3c8da2ae4f7816fac03e573", size = 179963, upload-time = "2026-07-17T22:50:29.982Z" }, + { url = "https://files.pythonhosted.org/packages/17/06/55ffc976c488b6aee9ea05761ff7c4e88e7c1fd82818c8ca7b556ad2f90c/websockets-16.1.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:84a2cef8deffbd9ab8ee0ea546a2a6a7030c28f44e6cdd4547dbfeb489eb8999", size = 177497, upload-time = "2026-07-17T22:50:31.396Z" }, + { url = "https://files.pythonhosted.org/packages/0c/e8/f7dac2e980bacc92bdc26cebae4ae4d50cae5380732c50980598fc0bbae4/websockets-16.1.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:3df13f73af9b3b38ab1195eb299ecb67a4330c911c97ae04043ff74085728abe", size = 177698, upload-time = "2026-07-17T22:50:32.829Z" }, + { url = "https://files.pythonhosted.org/packages/b2/39/26762f734113e22da2b942c3aca85798e0c0405d64c256549540ff31e5a1/websockets-16.1.1-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:23253dd5bcae3f9aaee0a1d30967a8dbd52e5d3cff93a2e5b84df57b77d4750d", size = 187561, upload-time = "2026-07-17T22:50:34.24Z" }, + { url = "https://files.pythonhosted.org/packages/11/94/c3f330851806b9b02138b774d593478323e73c99238681b4b93efe64e02d/websockets-16.1.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9c1c5705e314449e3308872fe084b8571ce078ee4fc55a98a769bdefe5917392", size = 188732, upload-time = "2026-07-17T22:50:36.088Z" }, + { url = "https://files.pythonhosted.org/packages/d1/f2/eb2c450f052de334ae33cf200ece6e87b0e14d186807074e4eb1cd2cdea2/websockets-16.1.1-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:69e52d175a0a7d1e13b4b67ad41c560b7d98e8c6f6126eb0bda496c784faf8c7", size = 190872, upload-time = "2026-07-17T22:50:38.008Z" }, + { url = "https://files.pythonhosted.org/packages/70/31/2ac8cecf3a74f7fed9132129fc3d90b3998a1554570c11a69b2a8c20332d/websockets-16.1.1-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:1f79c89b5eb034d1722938a891916582f8f7f503f58ca22518a63c3f2cd18499", size = 189305, upload-time = "2026-07-17T22:50:39.53Z" }, + { url = "https://files.pythonhosted.org/packages/6a/cf/8ab19650d3c0d4562c92e70ab47c257c4aa5c6a713ed87fe63766b31fefc/websockets-16.1.1-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:39f2a024af5c345ffe8fcf1ee18c049c024c94df393bb09b044a6917c77bde43", size = 188033, upload-time = "2026-07-17T22:50:40.912Z" }, + { url = "https://files.pythonhosted.org/packages/66/d7/a49a38a6127a4acb134fb1912b215d900cc657605cff32445bf519f3acc4/websockets-16.1.1-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:952303a7318d4cbe1011400839bb2051c9f84fa0a35923267f5daba34b15d458", size = 185748, upload-time = "2026-07-17T22:50:42.559Z" }, + { url = "https://files.pythonhosted.org/packages/95/3e/ad1fa40388c7f2e0bb2c7930d0090b6c5498594bd1cdaec18864df3d9e97/websockets-16.1.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:249116b4a76063d930a46391ad56e135c286e4562a18309029fc2c73f4ed4c62", size = 188285, upload-time = "2026-07-17T22:50:43.974Z" }, + { url = "https://files.pythonhosted.org/packages/35/b8/d5db28ca264b9104f82196f92dc8843e35fd391f763d42e4ad358f5bc97e/websockets-16.1.1-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:61922544a0587a13fd3f53e4c0e5e606510c7b0d9d22c8444e5fae22a06b38cb", size = 186777, upload-time = "2026-07-17T22:50:45.474Z" }, + { url = "https://files.pythonhosted.org/packages/42/9c/726cb39d0cc43ae848dce4aa2acb04eecc6738b1264ec6d700bf6bcfb9f8/websockets-16.1.1-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:46dcaa042cd1de6c59e7d9269fa63ff7572b6df40510600b678f0826b3c7af51", size = 188682, upload-time = "2026-07-17T22:50:46.973Z" }, + { url = "https://files.pythonhosted.org/packages/be/c7/1168704de8c2dd483edabe4a22cbe4465dd8be8dd95561d214f9fe092871/websockets-16.1.1-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:38565aca3e01ea8734e578fb2118dade0ecb0250533f29e22b8d1a7a196cf4d0", size = 186377, upload-time = "2026-07-17T22:50:48.413Z" }, + { url = "https://files.pythonhosted.org/packages/ca/40/f9ff2d630ffce4e7dfea0b2288e1caf9ebbf9ff8a9ec9396136ce8b94935/websockets-16.1.1-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:42f599f4d48c7e1a3338fdaac3acd075be3b3cf02d4b274f3bf2767aedd3d217", size = 187148, upload-time = "2026-07-17T22:50:49.845Z" }, + { url = "https://files.pythonhosted.org/packages/b5/71/e177c8299f78d7cbe2d14df228643c10c70c0e86e108e092056bbcc16e46/websockets-16.1.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:dcc04fedf83effaeb9cce98abc9469bb1b42ef85f03e01c8c1f4438ef7555737", size = 187578, upload-time = "2026-07-17T22:50:51.619Z" }, + { url = "https://files.pythonhosted.org/packages/49/b2/b6987faf330f5af5c787a2610124c2e8403d51724f9001ec4fff6311fe7a/websockets-16.1.1-cp314-cp314t-win32.whl", hash = "sha256:8483c2096363120eea8b07c06ae7304d520f686665fffd4811fad423930a65d7", size = 179729, upload-time = "2026-07-17T22:50:53.269Z" }, + { url = "https://files.pythonhosted.org/packages/a2/6e/fbac6ed878dd362fbad7d415fa4f84d38e3e33fed8cde45c64e783acf826/websockets-16.1.1-cp314-cp314t-win_amd64.whl", hash = "sha256:bcce07e23e5769375158f5efdcdafa8d5cd014b93c6683865b840ed65b96f231", size = 180072, upload-time = "2026-07-17T22:50:54.969Z" }, + { url = "https://files.pythonhosted.org/packages/e1/ed/71fea6e141590cafc40b14dc5943b0845606bee87bdb52a21b6a73eb4311/websockets-16.1.1-pp311-pypy311_pp73-macosx_10_15_x86_64.whl", hash = "sha256:820fb8450edddae3812fd58cbc08e2bf22812cb248ecb5f06dbb82119a56e869", size = 177185, upload-time = "2026-07-17T22:50:56.665Z" }, + { url = "https://files.pythonhosted.org/packages/01/ec/00e7eeca200facf9266a83e4cbbf1bed0e67fba1d4d45031d3e5b3d81b5c/websockets-16.1.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:125f22dbefaf1554fea66fc83851490edb284ce4f501d37ffed2752f418332d9", size = 177459, upload-time = "2026-07-17T22:50:58.197Z" }, + { url = "https://files.pythonhosted.org/packages/75/fd/5774c4b33f7c0d8f0c51809c8b3a93456c48e3543579262cfa64eb5f522e/websockets-16.1.1-pp311-pypy311_pp73-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:30bbe120437b5648a77d3519b7024ea09530e0b5b18d3698c5a0ae536fe0cc2e", size = 178294, upload-time = "2026-07-17T22:50:59.641Z" }, + { url = "https://files.pythonhosted.org/packages/37/c3/48e2c03d2bd79bb45948841c592d24156312dd5f58cdf8f549febe652fb6/websockets-16.1.1-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b6b9dadbef0cccd9f4c4ee96b08898afa73e26803bbe0f6aeb5bb12b0074206d", size = 179190, upload-time = "2026-07-17T22:51:01.129Z" }, + { url = "https://files.pythonhosted.org/packages/2d/3f/73e511ecf2496ceac57dd4ed8388efe2bcf0769338a2dbf242c8366ae87e/websockets-16.1.1-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:56cd5fc4f10a9ea8aa0804bddb7b42506cf9e136046f3b4c27de8fec9e2ecba5", size = 180330, upload-time = "2026-07-17T22:51:02.603Z" }, + { url = "https://files.pythonhosted.org/packages/be/4d/2d0d67834092e354d2b0498f014a41249a89556bc406cf86f3e1557bb463/websockets-16.1.1-py3-none-any.whl", hash = "sha256:6abbd3e82c731c8e531714466acd5d87b5e88ac3243465337ba71d68e23ae7e3", size = 173814, upload-time = "2026-07-17T22:51:04.184Z" }, +] + +[[package]] +name = "websockets" +version = "17.1" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.15'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform != 'win32'", + "python_full_version >= '3.11' and python_full_version < '3.14' and sys_platform == 'win32'", + "python_full_version >= '3.11' and python_full_version < '3.14' and sys_platform != 'win32'", +] +sdist = { url = "https://files.pythonhosted.org/packages/18/72/fba934cb3dff7a85d811820efffcd141ddd52b5a2a01637f64551373ff4d/websockets-17.1.tar.gz", hash = "sha256:acfea4c20bf54384883ea33b1240fc1db4f52e190823a4e2b334bc3e8bfca96a", size = 187520, upload-time = "2026-08-26T17:25:33.063Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7d/ad/66a74d42fb537bd44056483eae6cbb7ebb10b742c300a0bf8cee427556d4/websockets-17.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:88b882764ef65147a7a5ae13168dedbe225a04e2ff4858fe543f2c402f093e9c", size = 216984, upload-time = "2026-08-26T14:55:20.747Z" }, + { url = "https://files.pythonhosted.org/packages/70/1b/344ab22cea729e872f759b926441f7b822ab6cd106db527736afc066927f/websockets-17.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:98a5b2589a56a4b4f098b0a958099a4356ab904a7844f1da3841efca469af7e9", size = 214667, upload-time = "2026-08-26T14:55:22.298Z" }, + { url = "https://files.pythonhosted.org/packages/2e/42/bace574b6ae80e1a8d6935b8c5f03fb67236233ec572e976fe826ff719cf/websockets-17.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:020e271205f8ab3406d7a59cd00de6dec722315924411c421bd00642f18bad86", size = 214944, upload-time = "2026-08-26T14:55:23.618Z" }, + { url = "https://files.pythonhosted.org/packages/ee/87/08e35ca4a0ffafb500a16ff461bf9561ad2b755362adb5d077d4dba9affc/websockets-17.1-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:65be6bda2b537fefa4b3a5ccd6ab386533ce39dd8fe62433ec90901fdc81752d", size = 224004, upload-time = "2026-08-26T14:55:24.748Z" }, + { url = "https://files.pythonhosted.org/packages/5c/9a/00ae2e147eaa086fe8bdddd36f57216ce72b9a9dfc0b17c717005ebdacaf/websockets-17.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:0c84bdef916556cbe1d5a43b423398be4dd3cba6522b463e53d848578b920695", size = 224278, upload-time = "2026-08-26T14:55:26.016Z" }, + { url = "https://files.pythonhosted.org/packages/98/e2/7aeb4e00defa68826f449392922a382ce7fdf542fe52190558dc1714e284/websockets-17.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:47a62d6045c6eaa0d8f97bc2fb68b8cf90077a0cbfd4e83d6f2d2145611ee134", size = 225511, upload-time = "2026-08-26T14:55:27.183Z" }, + { url = "https://files.pythonhosted.org/packages/7e/e4/655be3d93c3edbe1a51606073b5454ea6b1b32d87aa26253a6df952417b7/websockets-17.1-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:34879e19bb0a3c44f9317679435aea5327fac993933a704cbf353bf1234b10c7", size = 228802, upload-time = "2026-08-26T14:55:28.431Z" }, + { url = "https://files.pythonhosted.org/packages/e4/33/98549a2afa9d68fe1b5a8e0a61cd461a43ea1ab7209bce675eea67c79190/websockets-17.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:2d72879819f5145a342d0030c418702496c65a4b913ef81f5ae944dd91dd50f6", size = 226075, upload-time = "2026-08-26T14:55:29.695Z" }, + { url = "https://files.pythonhosted.org/packages/8e/6b/cbc27e014d6c292b9b2709cfd32781a2b61eb30cd4c9130e7c57e41a204a/websockets-17.1-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:84f25e099fdfe3b09f953d84698f729a1f7d1e99101b2787d7a28ed77b323750", size = 224846, upload-time = "2026-08-26T14:55:30.964Z" }, + { url = "https://files.pythonhosted.org/packages/10/a6/e57925f7a423d90f24559e85bac21a7f0b44c0cf4a5c0babc0759ca54bab/websockets-17.1-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:469355ab1af100b9380f1afb09985019f4a4b94fa1dd0e9396db4361626d7ab8", size = 222136, upload-time = "2026-08-26T14:55:32.376Z" }, + { url = "https://files.pythonhosted.org/packages/32/07/b9de0400addb542ba7c819022abc3afa46cd7e518068881bceadac69d995/websockets-17.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:00679b7468b4c2b12b0757118174e8eabac56bb2f579a928a104d9554a56e098", size = 225000, upload-time = "2026-08-26T14:55:33.527Z" }, + { url = "https://files.pythonhosted.org/packages/4c/bb/af2828a1d7f2beb792af6ba56d7b02d56262070266b95d2af9ef391fbfb0/websockets-17.1-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:a9fe648abd1d9b89aebfa30407bfdd08a0271ec5dc7d44a4c6ccd1ce22cf562a", size = 223592, upload-time = "2026-08-26T14:55:34.636Z" }, + { url = "https://files.pythonhosted.org/packages/fe/51/7379f254730c1dc7d8e4dd8d686868d8f7be55bdc94c6d3a44538840f639/websockets-17.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:f47aafd92aa28b941180e6da8a42b0f711851b14b81a5b6bb28dbbb1fa35152c", size = 224360, upload-time = "2026-08-26T14:55:35.777Z" }, + { url = "https://files.pythonhosted.org/packages/88/c6/fcd91320dd71dda7046df9bc60f60c70ee15c052dee21e31ed6221dc8b5d/websockets-17.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:c89406fa3dcd4aa8662c6406cc5c0de1790e9614d2c3aaf03ca53a8a8ccf3405", size = 225404, upload-time = "2026-08-26T14:55:36.85Z" }, + { url = "https://files.pythonhosted.org/packages/1b/b2/655a4f939388079f80f1b3f8a1b9d40783e70a376e7423988cc9a590a09f/websockets-17.1-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:b3b451fd2723ad3191a209afe6f3f4bc86c83e9a85bdc255353b91803ee6aa66", size = 222982, upload-time = "2026-08-26T14:55:38.006Z" }, + { url = "https://files.pythonhosted.org/packages/87/75/37c84c4371c6aa668910d7841036c4397ea10554c07030603ccd5e44b02a/websockets-17.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:054c28db2dcec0e857e3b705d8c28012613e555b38c765d6a4f75340a4fc06a0", size = 224017, upload-time = "2026-08-26T14:55:39.39Z" }, + { url = "https://files.pythonhosted.org/packages/5e/20/8a9a94323bfcfe03bde3f9d98926bea4855856359702fe3ca0d07051ef5d/websockets-17.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:f8e822efd54137d8cc8310eb64635ab827a4a6c72ff08691f38aa624776d8ecb", size = 224252, upload-time = "2026-08-26T14:55:40.498Z" }, + { url = "https://files.pythonhosted.org/packages/3d/dd/aa66e6500188cd40306abeb92c9a738ca6dd7029d8d8532c538055ab5daf/websockets-17.1-cp311-cp311-win32.whl", hash = "sha256:dcb8d5f7edef7a399d322cf28d4c4e6f98dab64d301c8f50581a1080e5198142", size = 217484, upload-time = "2026-08-26T14:55:41.763Z" }, + { url = "https://files.pythonhosted.org/packages/01/a2/cdf3b551f0b9177023afd3a45d3b431a0d4064951008c4321a8b42ac2288/websockets-17.1-cp311-cp311-win_amd64.whl", hash = "sha256:b1bc819c6db90e8f91a38250a1ab4c058261871aa52d2fe36382eddedf146dee", size = 217779, upload-time = "2026-08-26T14:55:42.942Z" }, + { url = "https://files.pythonhosted.org/packages/e0/13/51253dbed7d16a4bb87b05110ad3bf12165f410e915f6da1edd4186d8dc1/websockets-17.1-cp311-cp311-win_arm64.whl", hash = "sha256:edadce7a22052056fd4384543019856b34850363c9d387929f677ae01d79709c", size = 217710, upload-time = "2026-08-26T14:55:44.016Z" }, + { url = "https://files.pythonhosted.org/packages/a6/0d/098f23c4c858e5de9459ffc554fa07d5493fbcfca7f040b5800cf1cecc35/websockets-17.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:76dd004f59115087c7b700474cb18f01325e37250032e19396c08ae41448e4b3", size = 217015, upload-time = "2026-08-26T14:55:45.194Z" }, + { url = "https://files.pythonhosted.org/packages/13/86/bc1317b1a4d8c4688e2a7e564b5e004dab44c2534d7ca05de6ae9a863fca/websockets-17.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:581fa678ef46f4277cc8491312468e582f8ad609dbab907ba6096a08c6a0ff98", size = 214692, upload-time = "2026-08-26T14:55:46.366Z" }, + { url = "https://files.pythonhosted.org/packages/8f/e7/df821761772beaa48c211ee0e234930b35c1473778470773823f56d3911b/websockets-17.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:87f0d5e77548b0c40c8464cdb6108792e7e53f487c6400028a4ec28a8afbe5ab", size = 214959, upload-time = "2026-08-26T14:55:47.885Z" }, + { url = "https://files.pythonhosted.org/packages/3e/92/c3fb72f11764812fc648bf3838d224972427b348e8b3989d9e0a9df87da3/websockets-17.1-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:882af300d2c6a092b93767d5de03c7bb56dfb06314140c8e872d3f48e09f7b74", size = 224278, upload-time = "2026-08-26T14:55:49.241Z" }, + { url = "https://files.pythonhosted.org/packages/fb/05/9f82d090c8d2d861604147ef6dfb938a90b039f9358d5193f1df62558593/websockets-17.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:0c863507ada5805517ca6dff1c524dcd42942efe6304dacf06700878398d21a6", size = 224557, upload-time = "2026-08-26T14:55:50.348Z" }, + { url = "https://files.pythonhosted.org/packages/8a/50/5cbf677b865290fe36819ff00615826e7edc1df38786f770123ff39a933d/websockets-17.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d41ef69d5416fbc1d98cf96c37be6192d10fd101c3e0f8b3ddc36e09432b3c08", size = 225791, upload-time = "2026-08-26T14:55:51.75Z" }, + { url = "https://files.pythonhosted.org/packages/c1/1c/eb8a032285243381b09a221ae384c972d5000453ad136add4d1595cec798/websockets-17.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:5aefe78e6a3077fe22b5e64b04666a85a3eb8b934d40e8595a693adcbceb6f11", size = 228574, upload-time = "2026-08-26T14:55:52.922Z" }, + { url = "https://files.pythonhosted.org/packages/69/85/413736251cb3ac04ce84cbd90e893d9a36a9698d4820b323aff3aa187e50/websockets-17.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f64e001bb7fa89b9f32cfa600bf8e9ac8ca26759d9b92ae01453ee303d9cd7b4", size = 226428, upload-time = "2026-08-26T14:55:54.263Z" }, + { url = "https://files.pythonhosted.org/packages/d2/2b/a08bcc7fa1ca81a10f84ba32b6e6edd73a913f4b0c2640eed1fd626efacd/websockets-17.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:677014a073bcb1fbaa7e21144786864f16c08f856d66834f611eceb9006cbab8", size = 225184, upload-time = "2026-08-26T14:55:55.943Z" }, + { url = "https://files.pythonhosted.org/packages/e5/8a/3bd2d0cf6b148c8c866d5d9fdcde30c04bfd81fdfac86813e69377eb4448/websockets-17.1-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0de501b7f2db11e83739ac20e2d33d46da4604b829f506c24be80e7def069391", size = 222430, upload-time = "2026-08-26T14:55:57.103Z" }, + { url = "https://files.pythonhosted.org/packages/3b/c9/8e891ae342668735eabbbc669895e15195e4b45f24a4beeb58af76f414c7/websockets-17.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:f62114a54117e4948a1e414e89521f7fe1e3c2f83f2a571a06a4fc6718b0900a", size = 225227, upload-time = "2026-08-26T14:55:58.375Z" }, + { url = "https://files.pythonhosted.org/packages/e1/6f/c816f332dca11425e9bda7c07f7573eb5c5f8a735849d02b0d81e8ee20fa/websockets-17.1-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:eec113a5b41d124ef42ff56b0d74a6da3fd986400038eab9e58ee42a4024e837", size = 223831, upload-time = "2026-08-26T14:55:59.664Z" }, + { url = "https://files.pythonhosted.org/packages/53/67/5e91d5308ce24fc1ec74f56536c12f4888bad45ff5ea50f3180f8c518c57/websockets-17.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:5f051f8030a51815dc00e24bd2e5f1435af095c1cc111d747ac6e2a3620d7641", size = 224600, upload-time = "2026-08-26T14:56:00.873Z" }, + { url = "https://files.pythonhosted.org/packages/bb/96/faa298ecf2570d35b0eb37caddf4992178d907e108ed74bfffb6bc092c29/websockets-17.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:655a8e28010f09fd6fa317e857afab3af7647f33e41dee88fa421e92086d1090", size = 225707, upload-time = "2026-08-26T14:56:02.001Z" }, + { url = "https://files.pythonhosted.org/packages/0b/12/5710d2482ca5061c1eec5eb46f6313837c760d4115b1795c85b6c08be4e3/websockets-17.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:dc2b79afc074d2f3e64b26539350f697fe1b85ea1c49ea24eb588f247b053ce1", size = 223263, upload-time = "2026-08-26T14:56:03.092Z" }, + { url = "https://files.pythonhosted.org/packages/27/47/0c30f4eebfd1d93fae779d268f678d48847fb98516f5200849574eee8820/websockets-17.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:e4bd7eacb87d8cf3ed70d6392c770a0d92441f05d7d2a3efafb5bc171d5e3067", size = 224244, upload-time = "2026-08-26T14:56:04.321Z" }, + { url = "https://files.pythonhosted.org/packages/41/33/46c256195a1255079ae23d1b1267b2e1843dc5f46a67f973cdf2a3523dff/websockets-17.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ccbf3f4a9890d50b3a08ee04029fde30a03bfdeffaa19977628bf17251764e60", size = 224520, upload-time = "2026-08-26T14:56:05.521Z" }, + { url = "https://files.pythonhosted.org/packages/06/9a/aef0792731df4352e5f417369b532b3325fe434765ca90c193f594ae1e67/websockets-17.1-cp312-cp312-win32.whl", hash = "sha256:7e724f843fa6a0614aece65a7c73e51d0f4412ca41dccac13c3caf98e69536bb", size = 217485, upload-time = "2026-08-26T14:56:06.715Z" }, + { url = "https://files.pythonhosted.org/packages/50/23/493ecfdaf32898e5ea24dc900e33e5e317f9662d5d9ab2d44b2e111b4e1c/websockets-17.1-cp312-cp312-win_amd64.whl", hash = "sha256:617243e19a0992095956f406ee9cd3bc4ba92862d83cb1d83bb59ce574412bec", size = 217786, upload-time = "2026-08-26T14:56:08.055Z" }, + { url = "https://files.pythonhosted.org/packages/97/3d/91954e2f7876f74ce1213e9b92c65a63b559cc4b942a931ebeb351cd9932/websockets-17.1-cp312-cp312-win_arm64.whl", hash = "sha256:9f4a08ff7cb68c27b18e09223cc6304e01d0f82d5a240d251266dfd2e6e44729", size = 217711, upload-time = "2026-08-26T14:56:09.267Z" }, + { url = "https://files.pythonhosted.org/packages/1d/31/5f6450a7879f4f063ef08897cc385ea3ce3f1fe17f08b11e3fd959abdf27/websockets-17.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:2a0162a6372110a5601cb5c9fd826635cedf69f3e110c545dd19774e040b970e", size = 217006, upload-time = "2026-08-26T14:56:10.509Z" }, + { url = "https://files.pythonhosted.org/packages/d0/2a/c1b006fc861695d2aa4e35327b842015ce1d98cf8f99241829b3d6460bfc/websockets-17.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:829dba1bc049779de9b332088c1a6a9858e96bd67e50b6b644a95e02b67836bc", size = 214690, upload-time = "2026-08-26T14:56:11.681Z" }, + { url = "https://files.pythonhosted.org/packages/46/69/66e5b7d01445e0eeb1d4ab419c30315f2c90cf7a8a8cd4ecc47f894dba54/websockets-17.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:fd8f47dbf2e8adb15c847215f83436de3fdb120b51fdae0fbbdf69fd97a3ad80", size = 214947, upload-time = "2026-08-26T14:56:12.923Z" }, + { url = "https://files.pythonhosted.org/packages/07/ce/033cafe2d2538562efa876b9149a2c7a0f7787870a4b1bb6e28adc9ceb6b/websockets-17.1-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:9f4c0377a83e163a303514fdfab501dbe379bdc13e5b9312a91d112658b29dce", size = 224329, upload-time = "2026-08-26T14:56:14.212Z" }, + { url = "https://files.pythonhosted.org/packages/34/c7/e1c2e8a67f6cc0aa43abe0046fb3b7a020980649e6a843751dc7ce9eb170/websockets-17.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:c3241d684a76eaaef8b2dc789afde4343cd3aad55ea81e4e8ab3605b529bae51", size = 224611, upload-time = "2026-08-26T14:56:15.702Z" }, + { url = "https://files.pythonhosted.org/packages/be/de/07c6d48eb3d2069709410c851e7de10ab83d752c4bd09862899627c2729b/websockets-17.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e5f5c7a893507d0e83a80b88aefd6522f7e882cd53f9722c6f23f5a020c9557c", size = 225848, upload-time = "2026-08-26T14:56:16.962Z" }, + { url = "https://files.pythonhosted.org/packages/f3/dd/3c68572d20509648cc2fb6f50ccf3deeb4b87270f2c8966e99476e278ea3/websockets-17.1-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:00bf34b64501e3477e81fc281532ff3cbf4da26633c10b63979d5085d46602d3", size = 227290, upload-time = "2026-08-26T14:56:18.204Z" }, + { url = "https://files.pythonhosted.org/packages/0a/4a/8f6651c8a22093539c9215af0c5bbf217b87b382c99d2112039b92d593c2/websockets-17.1-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ce0305b702b20d1e1d60a9aaace6bc89970e1753565543f310d549eab22c2435", size = 226476, upload-time = "2026-08-26T14:56:19.459Z" }, + { url = "https://files.pythonhosted.org/packages/f5/be/f6fc33cea86b1127fd1297b18c107e81580ab55a73a39f9a934441ef321f/websockets-17.1-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:29176d8b429cfa0fa443c473878d37a5c06cfd0cb36b71ba4314accc71e05906", size = 225233, upload-time = "2026-08-26T14:56:20.939Z" }, + { url = "https://files.pythonhosted.org/packages/cb/83/65edaf05f7c9b1dea82f4d252fdc37706a84571646f06119a27b0a16fe19/websockets-17.1-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:3709a1ab30b4b922027d22f68d2b61a0656a91680ac894a537624e6be7dd7f7c", size = 222488, upload-time = "2026-08-26T14:56:22.208Z" }, + { url = "https://files.pythonhosted.org/packages/07/42/d1169c2f7f1f0032b0d4b0c00f0711a070cd7c735de37bfeb876bc0f9606/websockets-17.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:43bd0c1ceb924d67f5c1a5254d8361dd9d94246e6331a726064dfa2917880780", size = 225295, upload-time = "2026-08-26T14:56:23.445Z" }, + { url = "https://files.pythonhosted.org/packages/a6/f4/64e2a386c3899b917c2933225c9b47887874229d159797f3bf1a11c20d51/websockets-17.1-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:1fce0f43e0d41422e0b2cad6561e1970df22f212f4c7e884967df7cf591b031c", size = 223891, upload-time = "2026-08-26T14:56:24.647Z" }, + { url = "https://files.pythonhosted.org/packages/26/b3/dfb5c482f7e310a3432fdbb045ddfe6d34114680e89a233d4ff900a32961/websockets-17.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:4031152769179ab8dcdeafc7b0e58052a49117560a28671700b47b2c7b717aad", size = 224661, upload-time = "2026-08-26T14:56:26.027Z" }, + { url = "https://files.pythonhosted.org/packages/a4/cf/94865130a336029f46412adc127c4fbe380f46172b90ce251369e35c4302/websockets-17.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:a06f3b5085176763182449559e20391d7ce616a8972a9f7a33deda87ea6d4f3c", size = 225766, upload-time = "2026-08-26T14:56:27.455Z" }, + { url = "https://files.pythonhosted.org/packages/96/34/eb8c658f86dfe562ed49a887a27424bfe9e618c26ea6f865b093d075d3a6/websockets-17.1-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:77b37cceca17291897c3c73bd30a7c7c7909593554b5da574ec852af83c1742a", size = 223323, upload-time = "2026-08-26T14:56:28.807Z" }, + { url = "https://files.pythonhosted.org/packages/1b/7e/2629609652ece5ca0c7ac235927dd4511b08131e3a5d53439b798fddf002/websockets-17.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:d8e83333385cac6030a5167fd18bf96cc6c58b914c308e683f05b0cf94bc8dd0", size = 224276, upload-time = "2026-08-26T14:56:29.991Z" }, + { url = "https://files.pythonhosted.org/packages/a1/6b/8525737fe840b38e5f40956c198fb586a4fac1e07144d41a5b949b989cf8/websockets-17.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:073c5c3f7e127041fa9d34a9e29ceefee8c3cafbd267ed2927318f425144380d", size = 224558, upload-time = "2026-08-26T14:56:31.184Z" }, + { url = "https://files.pythonhosted.org/packages/74/ab/3a958c6cbcf74b118f601c20a80ac8bd5e8dfec0bcf7345116feaeefb121/websockets-17.1-cp313-cp313-win32.whl", hash = "sha256:2afb58c7ba48b329d56769f8dfd89f394efe587b65ef806bae810a484d6d3608", size = 217475, upload-time = "2026-08-26T14:56:32.431Z" }, + { url = "https://files.pythonhosted.org/packages/22/36/fb521f0f2994c25509651f169efe5582dddd8713d57a0757ba87859372ef/websockets-17.1-cp313-cp313-win_amd64.whl", hash = "sha256:0340bbef6bfbe16da888b3983d666a4db4954ac3253c38f13bc7aba0c7db5a2f", size = 217784, upload-time = "2026-08-26T14:56:33.608Z" }, + { url = "https://files.pythonhosted.org/packages/68/92/9b8419584681a12a7534b746dfb2737c466efe2455483e2fbf8b941a04ec/websockets-17.1-cp313-cp313-win_arm64.whl", hash = "sha256:7a72efa3bf4fa3a6669a54420a472ad056da3973d827f10e3a536da463f926c2", size = 217715, upload-time = "2026-08-26T14:56:34.865Z" }, + { url = "https://files.pythonhosted.org/packages/90/0d/500cf5daea09d4669dff3a7d67159094a0bd6c4ef130381404f6edd3eb5f/websockets-17.1-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:0c9982938980e086da59f70d05f9418cd143401a601a0faac10fa48f7bb1cd3e", size = 217048, upload-time = "2026-08-26T14:56:36.03Z" }, + { url = "https://files.pythonhosted.org/packages/97/12/5b12c6168aa269cffbfd24d177cd492b130120403a418c7e89462e27b4ac/websockets-17.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:57b39dc8541cf7ed3f639da82bf7451060483967f9e733da1f8173e4095f0642", size = 214737, upload-time = "2026-08-26T14:56:37.43Z" }, + { url = "https://files.pythonhosted.org/packages/0c/36/e453e5106e4e2416f008ac222837c2f1637a063b08008afcd1088889b631/websockets-17.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:96abdecbaae746851b87c3a36cb4a661df93ca3d92f114270f79228bf1d00de6", size = 214955, upload-time = "2026-08-26T14:56:38.71Z" }, + { url = "https://files.pythonhosted.org/packages/dd/30/0204bb86176db02cdfc678ce65ed808a66fab87d250ce61a8790800a60b0/websockets-17.1-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:d9fc873e239c5abeb150bc24dbd1a7af23a9254526383ce0a077f5e20adbeb19", size = 224331, upload-time = "2026-08-26T14:56:39.924Z" }, + { url = "https://files.pythonhosted.org/packages/46/c8/d8372256e00c4e3cab1115c45075d1eeedb642a3f2b42bd70c4deae03f06/websockets-17.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:6f42912fa9eb4cb7c7ec9fde9b3332ba339eb8a8811981043d4029599f3d950b", size = 224685, upload-time = "2026-08-26T14:56:41.169Z" }, + { url = "https://files.pythonhosted.org/packages/12/7d/650355b8f67f908ff99603351d4458d1a0b787d627950a47c38db7e25308/websockets-17.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f98bf378d7a5be047a044a1a27c987a8f355e10e3b5754617dbe756248cbc5ce", size = 225927, upload-time = "2026-08-26T14:56:42.359Z" }, + { url = "https://files.pythonhosted.org/packages/34/6c/a9ffa5b903579eed76017870f055d75ecc73988d9d0c9b65a92ba0bf2a27/websockets-17.1-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:d334d11398086bb5559606cb42d51c013ea7c061c7db701521392373d3c087f5", size = 227300, upload-time = "2026-08-26T14:56:43.538Z" }, + { url = "https://files.pythonhosted.org/packages/9b/5d/4551c2269066af7481ee44605a0813770961615b5b5da3e87a8f5cb859ea/websockets-17.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:5c27336b1a0ac56569493e858497870347854372395f50483725f8cdacc5a45c", size = 226533, upload-time = "2026-08-26T14:56:44.669Z" }, + { url = "https://files.pythonhosted.org/packages/3c/43/237a99233e5c445759a613831b3a92e91905afc064dc3bd0ad33c35fd1e2/websockets-17.1-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:67258b00302a5aaf0b267771c7014b13429abd7ea17eebc4c55bd935ff101555", size = 225280, upload-time = "2026-08-26T14:56:45.83Z" }, + { url = "https://files.pythonhosted.org/packages/d3/b5/e9407a91613d1d1cd932414143a1012096b26674a782fc55a0bd23217ee4/websockets-17.1-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:455ffeea0879d313205df1e745e5883e1feb7f31ecd26be882f5f0babd3db04f", size = 222540, upload-time = "2026-08-26T14:56:47.053Z" }, + { url = "https://files.pythonhosted.org/packages/db/d2/db76628db0577b783205d9779f64d8e373416b04c62d1546be4b75dc8540/websockets-17.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:f7233eaf441a345a5943a929fd4b5ea3278f11aed35a9ed0f3106b8cb3ca846a", size = 225354, upload-time = "2026-08-26T14:56:48.32Z" }, + { url = "https://files.pythonhosted.org/packages/a9/4c/2174181c067b89a74ae18e2650c2ac29959f4b796afe876ab3f4d30d642c/websockets-17.1-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:c65da239a5ad553619804c1f9d65c1a0b3005381c6158ee14da2c7444cbd0c78", size = 223867, upload-time = "2026-08-26T14:56:49.579Z" }, + { url = "https://files.pythonhosted.org/packages/df/75/274decb9a8253561b5be3261e02a6676fc8ecdf31e95b722e53d5bfb8fd2/websockets-17.1-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:9fa1ffa08c81a4f809cdab6129f8e55bee4650b9d6d3461019dda73aacd146b6", size = 224652, upload-time = "2026-08-26T14:56:50.885Z" }, + { url = "https://files.pythonhosted.org/packages/9f/e6/49824f1fb4db7656d2f7492b1d8be16147b759d909490e32f4776843ee64/websockets-17.1-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:406b8107943a43ef4649b1e0cb0cdc052bbf08fe1c8905a623c4af9586e5cebb", size = 225822, upload-time = "2026-08-26T14:56:52.356Z" }, + { url = "https://files.pythonhosted.org/packages/b8/6a/5dc43838c0b02a95f42c47a0de33c5ddd7767a9feeb4d0d8777ac1cfefe4/websockets-17.1-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:4e8ffcb486c8490a34a4cef5e4409d8da5a1cb1681e5bf7d786ce5e84aa8540d", size = 223379, upload-time = "2026-08-26T14:56:53.699Z" }, + { url = "https://files.pythonhosted.org/packages/c2/62/585637cf06d6b321232f79c55dc14d65518d12cf87c94c44f5864068810e/websockets-17.1-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:fb88076df585b69c5761c387c0081aa87d7b9eb1b205a6535ca4777e25650d81", size = 224330, upload-time = "2026-08-26T14:56:55.184Z" }, + { url = "https://files.pythonhosted.org/packages/de/68/c3b234a6a1366b6ab5bbfaa4434a1b946e1dc4e8ddd6824bfd93a8835b7f/websockets-17.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:5d4724255fb8398acd9e583b97eb2279cec20e0bd0f9a94bf75f6056ef9f13da", size = 224622, upload-time = "2026-08-26T14:56:56.393Z" }, + { url = "https://files.pythonhosted.org/packages/6a/d4/84cf3d1376f5d8207f55f43c1c818babd6b89447f5dcd01f18a6d5526796/websockets-17.1-cp314-cp314-win32.whl", hash = "sha256:be3f0129c5654517b2abf07dcb75bb1d9479759a4ccfb569e8293579e9fc029a", size = 217036, upload-time = "2026-08-26T14:56:57.652Z" }, + { url = "https://files.pythonhosted.org/packages/d0/0f/9e7ac63c5d7cb642952200814f584318e65146df008b7d375d5d9c6b2c97/websockets-17.1-cp314-cp314-win_amd64.whl", hash = "sha256:2a4dc6ef83f4559e0d05f313a375cb38f63c986096a9da99fe94fdd779d313e5", size = 217382, upload-time = "2026-08-26T14:56:59.065Z" }, + { url = "https://files.pythonhosted.org/packages/54/bb/1ae6b91f7f3ac05f5c9f14a72dc2181c115ff370bcd8a7f10f02c174adfd/websockets-17.1-cp314-cp314-win_arm64.whl", hash = "sha256:46c0331c9eaaf73a559f3a9e388466be0df96eb83d40f06f1ca6ab6613b35c82", size = 217268, upload-time = "2026-08-26T14:57:00.654Z" }, + { url = "https://files.pythonhosted.org/packages/b3/f0/f65644d0e0b2b90918a8c41503841cc4072a58f2bf76c09bc36e751fc0dd/websockets-17.1-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:d411ea5ca18ac1b12c0c94be88b60c18ca641ac43bcdfdf1c9f79d46cdbe1603", size = 217379, upload-time = "2026-08-26T14:57:02.181Z" }, + { url = "https://files.pythonhosted.org/packages/ff/35/4c46d1f620ac1a30f92b6eae78ee40a772a93f568647ca7ccdc5ea283cf8/websockets-17.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:07fa3e7c30e2c577928d359b56bf872a3e0cbcc15553eaa0907c1ee86344b56f", size = 214911, upload-time = "2026-08-26T14:57:03.478Z" }, + { url = "https://files.pythonhosted.org/packages/04/6e/4587e8406d7c1188e97b9cf466c081e93399380d447f885bfce81626cd37/websockets-17.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:6de9acef07e3a78e9567fcd26c29011a4da8f050b13004bbf880a0fd82a6eea5", size = 215115, upload-time = "2026-08-26T14:57:04.692Z" }, + { url = "https://files.pythonhosted.org/packages/ec/06/1381c8fff525041025909eb80ace32489194a00ba22a0a8d428030afcc84/websockets-17.1-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:ea0ed9373b880115911d9d39634bccc95b8ce590c9c42e8589f5cacc3ef3cee2", size = 224696, upload-time = "2026-08-26T14:57:05.899Z" }, + { url = "https://files.pythonhosted.org/packages/36/9d/9034e867dc85340be058619751742b895f722326e83100d110063461ca07/websockets-17.1-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:50903d335bfda026c2fa11dd9aed09d8cbee0c451e3a85122a9acb041b7dc69b", size = 224975, upload-time = "2026-08-26T14:57:07.262Z" }, + { url = "https://files.pythonhosted.org/packages/40/eb/ed03aa3cae748ebf6397e5d44028f433f746bad09dc568ff754fda3a3c9b/websockets-17.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5a74531ce81af587f906ab42f194032388fcff8fc7938402e5917c9147a39441", size = 226151, upload-time = "2026-08-26T14:57:08.524Z" }, + { url = "https://files.pythonhosted.org/packages/b1/c9/cc1964a096d16f3b73cb1ee5f14f277f5a3bcac07c6e8f9a1dcded99f4c8/websockets-17.1-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:8fbf28e639544503b7d1c96452a5e5e043e4108d89b1f3fa02910603622d19db", size = 228292, upload-time = "2026-08-26T14:57:09.846Z" }, + { url = "https://files.pythonhosted.org/packages/1a/26/46da6dd0363c2db2e4876fd59a40fd40c1943a82d7018d0a33afbce47d52/websockets-17.1-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f612dc57f00c07cf4aa2673f7cbceabd654ad2457b7e639f061b794d6e11f9fd", size = 226722, upload-time = "2026-08-26T14:57:11.118Z" }, + { url = "https://files.pythonhosted.org/packages/78/98/ecd8f5e1c5d0e54c08ebc5c66852271112166db68107cb0e17ca1bf25009/websockets-17.1-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:1c7ac77401227212dc6e849182feee50d57cf456ec6329ffd6979c94bb136c5c", size = 225451, upload-time = "2026-08-26T14:57:12.601Z" }, + { url = "https://files.pythonhosted.org/packages/65/4d/da8d2760db53e17aae763738b6ba834b1fcf16813d3632f3edb6951e1ec8/websockets-17.1-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:32a2a68d989d6e5b74a9d5095415c51189ebae29fceb7cf2b64a1c0318a81256", size = 223003, upload-time = "2026-08-26T14:57:13.875Z" }, + { url = "https://files.pythonhosted.org/packages/a4/40/ea401c141a79c5b1d0021a0dab9d0df2051c108f1620fbb39a6e7c714c3b/websockets-17.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:aec00f018d34c67500ff0438dc314b40277be4a1b983cbacbf53ccf7db63e257", size = 225704, upload-time = "2026-08-26T14:57:15.091Z" }, + { url = "https://files.pythonhosted.org/packages/e1/8e/07ab3f44215d89840d5385fdcaaab1fed8caeffa67c6899e15062957c12c/websockets-17.1-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:0014eaff8ad5b3b43feda2279f9d34bf2eaae040720b9fbbb55944b10f40b14d", size = 224192, upload-time = "2026-08-26T14:57:16.3Z" }, + { url = "https://files.pythonhosted.org/packages/58/93/ccf1af0a23e5748d4e22292a377d78d15cf294d7e707bbb11a8990ae6bd5/websockets-17.1-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:db9d7ee47f3ba531e278be539af39e2c7c7d28fb94897b6cd1120d63b0ef5922", size = 225082, upload-time = "2026-08-26T14:57:17.531Z" }, + { url = "https://files.pythonhosted.org/packages/e2/db/e32200f99ce282e728d2929f2c429db353cf3282db7d0eba99eb32c9fec1/websockets-17.1-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:ff3e2ba7a9f0a110b0555452e9b5a03a34e11662544e01beea15f144b48ba7b7", size = 226101, upload-time = "2026-08-26T14:57:18.802Z" }, + { url = "https://files.pythonhosted.org/packages/28/3d/e7a6e9777b29433620167c98f3caaff0d6b08b1239a273ef7f7fd1393349/websockets-17.1-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:6da17fc94bd270f5987b10bee113461ac36a36a98b0481ddcc98056e5a90001a", size = 223794, upload-time = "2026-08-26T14:57:20.313Z" }, + { url = "https://files.pythonhosted.org/packages/48/05/ac569090726dedd6656f3ee28b0c02dfb1ba76e898dceaccc2987a237cef/websockets-17.1-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:e8dc3fa6d6b7ead3f9de57895f41b116a28787548e066365d9d90f7356bcaad2", size = 224567, upload-time = "2026-08-26T14:57:21.634Z" }, + { url = "https://files.pythonhosted.org/packages/14/50/4ef62941111db6b31193f4fabbb65f845a5177579040cb8fe0d774d25034/websockets-17.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:b65d5fe48219dc2d5e158de9e6514e75600f379cc7e37108d35f31764c155566", size = 224993, upload-time = "2026-08-26T14:57:22.86Z" }, + { url = "https://files.pythonhosted.org/packages/28/42/2b95ada4ea19bf3a2072b68669ce4f4afb212690b727d31640576287fd68/websockets-17.1-cp314-cp314t-win32.whl", hash = "sha256:2cce251f3e2469b99b6802b55435bcdd07123b41870f54c87b336183af9d7e68", size = 217168, upload-time = "2026-08-26T14:57:24.466Z" }, + { url = "https://files.pythonhosted.org/packages/32/0a/67d5ee08dd8060a37d612fd40a625b5376ad19ae48fe1c8ad428c278b817/websockets-17.1-cp314-cp314t-win_amd64.whl", hash = "sha256:8f6c38cdcaf98a911d7acc25577f2f9e710f3a2fc2bde1563556784320196b51", size = 217508, upload-time = "2026-08-26T14:57:25.983Z" }, + { url = "https://files.pythonhosted.org/packages/76/a3/822005d0c674451d2411027b878cdc128a2b7ea5a30d337d9e279da22eba/websockets-17.1-cp314-cp314t-win_arm64.whl", hash = "sha256:d1e2f5fa2b6d01f0d85b4f223fea7ed1d504be282a02a81bd2be4817ef7a2f03", size = 217425, upload-time = "2026-08-26T14:57:27.324Z" }, + { url = "https://files.pythonhosted.org/packages/de/d5/99a6c6a1eb5d5ae9f45f59a3c97f4e3b21f310eb404a547fb3e7d2fc054c/websockets-17.1-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:88381602e379165b66244b2ebc29f9b23ea0851fbe63ae157f91ca324f072d6f", size = 216970, upload-time = "2026-08-26T14:57:28.575Z" }, + { url = "https://files.pythonhosted.org/packages/a6/0e/1e7f6e833728193958d3ed3d67b5d57c3c7cfa948abf94d4bc553257c954/websockets-17.1-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:88bc5138e53903a85c354e59df7ba73ce306f7b09724cef74dba121e60a88ce2", size = 214699, upload-time = "2026-08-26T14:57:29.862Z" }, + { url = "https://files.pythonhosted.org/packages/07/00/95d39549f86e34425a0412bcbe61708dd1fc46af654e2134a6c4389102ad/websockets-17.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:3546ef55b3a074494106508bc6505c73825970d2d9505f7bf53882b3e88b0d1e", size = 214927, upload-time = "2026-08-26T14:57:31.148Z" }, + { url = "https://files.pythonhosted.org/packages/4c/ff/b442415fc4f7f9943b0fc8e8eebaa13923ca73361e167c439ba634eecbd9/websockets-17.1-cp315-cp315-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:9ae55d24241fc055f22aea3ac924559069848bd0ad4ea065fdd72d2194685fe8", size = 224373, upload-time = "2026-08-26T14:57:32.833Z" }, + { url = "https://files.pythonhosted.org/packages/a8/dd/b83537aae4cf61615b9d8b2dbb235c0030ba85457a6d934798273814600f/websockets-17.1-cp315-cp315-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:d7b349265fad6244013eecd99df8d83c12bf3013943e431f4fadd5bffc37db42", size = 224801, upload-time = "2026-08-26T14:57:34.041Z" }, + { url = "https://files.pythonhosted.org/packages/76/83/5ab0abed58454909e8dbab45086ac68ee4556d7a8ada26735addc909b903/websockets-17.1-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:dc5789e5ea182b77a38881383ada5347202a6c66f4857d054e075290e80b604b", size = 225967, upload-time = "2026-08-26T14:57:35.292Z" }, + { url = "https://files.pythonhosted.org/packages/4b/26/e2412f2b998a8c1dfc00c0709ff6ee0c634dd0b0b4f92bdfe9667876b71c/websockets-17.1-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:ce13c7d233239e739600a57d4a73c1192ad8259e655a4d55aa1a454242bc809d", size = 227664, upload-time = "2026-08-26T14:57:36.493Z" }, + { url = "https://files.pythonhosted.org/packages/ec/25/0dd4495df3c0e02f6db705312ba85ab9b2dd42257dc23eb0da10066e4844/websockets-17.1-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:1036189bd34b0bc1b10a4679321e2c7968af317efe6e8e4c1c5141c4254fb5bb", size = 226447, upload-time = "2026-08-26T14:57:37.781Z" }, + { url = "https://files.pythonhosted.org/packages/be/67/6df3f63ffc48f08126ed0cd2fd2a41092967c3e364f8ec100deae90b6d77/websockets-17.1-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:e78fd4b7b2c5086a38671c9c882c1e643385eccea360b5b1fda4a105e590087e", size = 225343, upload-time = "2026-08-26T14:57:39.133Z" }, + { url = "https://files.pythonhosted.org/packages/b1/8d/a8479bbb09ff054907d141123d8f52fb6ae5ac39c6dbe39e6a02a8408309/websockets-17.1-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:46e7a10bf04318c7b0c0273791925ae5e1cbe4a11e34aa934d2ef27862058a80", size = 222748, upload-time = "2026-08-26T14:57:40.478Z" }, + { url = "https://files.pythonhosted.org/packages/40/fb/4c3d2a3269cde3f3087916de9c3d9fc5d7196b46846d8c3a9ae59ad0a884/websockets-17.1-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:33e45c7ea38428e740a7f233555d71df0b875cef7fc080acebc9654475e35335", size = 225453, upload-time = "2026-08-26T14:57:41.859Z" }, + { url = "https://files.pythonhosted.org/packages/7f/1c/6467b401d19408f34e1c7389c222c2c7e1dfdf08c551190269b5eabc726c/websockets-17.1-cp315-cp315-musllinux_1_2_armv7l.whl", hash = "sha256:6e63c01803be425ff062b7f7fc201a74def1d49fc94a2410dd17375df75936e9", size = 224112, upload-time = "2026-08-26T14:57:43.136Z" }, + { url = "https://files.pythonhosted.org/packages/c5/5f/744e032ac80e11039a7447657ebabb46e9b5c2dbcec83be571335212932f/websockets-17.1-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:722ec21717eec6477bce582147a28acdfe034e604239466a6a95daedb863e774", size = 224646, upload-time = "2026-08-26T14:57:44.871Z" }, + { url = "https://files.pythonhosted.org/packages/9f/47/bcb9128d9afc4d0934d9192e2a24897ca2f7a63df2654904915349c6c46d/websockets-17.1-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:e74e41f0ad12ff1e8983e349daef79d37cc8280c743ce9d134d6c74c18dab5d6", size = 225797, upload-time = "2026-08-26T14:57:46.338Z" }, + { url = "https://files.pythonhosted.org/packages/c7/e0/b058047b7cf565e1105b10ef6b6b24a6ebe3575678c7dc75a645334705a7/websockets-17.1-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:12fe8984a32dbfd084e0603f1a8d740c0180cb85b3174585c54a80d2455a8394", size = 223605, upload-time = "2026-08-26T14:57:48.175Z" }, + { url = "https://files.pythonhosted.org/packages/b9/69/fc1555bff884de363f1bf9eebf2836dbeb29fa7e4f957debb7bbcf43abba/websockets-17.1-cp315-cp315-musllinux_1_2_s390x.whl", hash = "sha256:01dcb47deebc40b38fd4a493b9b9f4d0a704b7bec6f35e4d34085b329abce71a", size = 224508, upload-time = "2026-08-26T14:57:49.407Z" }, + { url = "https://files.pythonhosted.org/packages/e7/f9/648d4e68621688b19093b06f7b497d520952e68cdea1c1b54371fe9491de/websockets-17.1-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:f4c45ee2512d3757b5e6c67c5a34e435143f2ecb7df3324f9fd888688c45c0f4", size = 224767, upload-time = "2026-08-26T14:57:50.799Z" }, + { url = "https://files.pythonhosted.org/packages/58/93/f8342b55864f71df13eb8e9ef7dce691b87a87f04f75bb8a1385b3336e7c/websockets-17.1-cp315-cp315-win32.whl", hash = "sha256:0f4f50dfe2cc810fc4e2de979b35e83bf8bb4bccdc6fe472d93762ea7b1d5927", size = 217003, upload-time = "2026-08-26T14:57:52.122Z" }, + { url = "https://files.pythonhosted.org/packages/ea/f0/7b5fdb774c245e0b6217009e2a24d2105c1a64923949f33be41aa7959302/websockets-17.1-cp315-cp315-win_amd64.whl", hash = "sha256:4af784f3e436f65b355c117c6497320f2b5cf6a559295cb1c4c7338e335d45cc", size = 217300, upload-time = "2026-08-26T14:57:53.492Z" }, + { url = "https://files.pythonhosted.org/packages/76/33/1fe6ed1b5087516115ca451b2c240314b010647071f8fc3bd78a21e4dddb/websockets-17.1-cp315-cp315-win_arm64.whl", hash = "sha256:d58159af7835fde09c462394293c0d7aaf8fb4557d8f8e5699f5e722ccae013d", size = 217214, upload-time = "2026-08-26T14:57:54.88Z" }, + { url = "https://files.pythonhosted.org/packages/94/ca/ed02e75996a266d76c5fcb5dd9b930db4cf2b388ca5fa3d2a72086f81568/websockets-17.1-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:1a5cf4e7bbe3ca499e6a289206cb4fcb7444b09919e129bd517f57d5fa192c13", size = 217282, upload-time = "2026-08-26T14:57:56.108Z" }, + { url = "https://files.pythonhosted.org/packages/bd/7d/d536f5bc89ea5b52fd1c1727c59fabafee6bc41f5ce92c3bd2f83047908c/websockets-17.1-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:416b4bc8789a1865a3ff643ec4ee073a5f52402d0dbeafd27b1798d5dd6b6a51", size = 214863, upload-time = "2026-08-26T14:57:57.355Z" }, + { url = "https://files.pythonhosted.org/packages/37/37/944cf17bad668e9be1247e6314f88a48b9faf7c250e383410db8b38af0b9/websockets-17.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:259f45358c76d3b18489e3e80636cdbe807e05ecf1b10fdf1a779106d23d0c8e", size = 215073, upload-time = "2026-08-26T14:57:58.719Z" }, + { url = "https://files.pythonhosted.org/packages/74/bf/3267966cc1bbc2b8fa62fd329651b0af502df1f5d1c0eed027ff339d6aa8/websockets-17.1-cp315-cp315t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:d9d01e8ede41fea4f5a847dad9d628355f74905f437a5b6856d67aa66d193800", size = 225229, upload-time = "2026-08-26T14:58:00.235Z" }, + { url = "https://files.pythonhosted.org/packages/7f/d8/85ea722f483510abb39fc71aafb4465d17cf9051a275ab036874ff3c300c/websockets-17.1-cp315-cp315t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:a7b35181a14cbfcae163b4de545d22abfd07d06c2c41ca69cfcd99251d6888ab", size = 225500, upload-time = "2026-08-26T14:58:01.994Z" }, + { url = "https://files.pythonhosted.org/packages/50/ce/64c7d00005bd0d15ecb5c5fcb7fb2597b6b92ddd16c4fa6bbc3d2835ad63/websockets-17.1-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6a8e768a048c2220697477ce2e67e4345dc9f693d0ee6af53945b5e30227c6a7", size = 226829, upload-time = "2026-08-26T14:58:03.327Z" }, + { url = "https://files.pythonhosted.org/packages/b4/dc/096c67940fb957e667ca3c542818150434eb0388c6fdc90b3a502f3c3e96/websockets-17.1-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:880069d21cc33a558dcf180924a546d1ecf8ada5be3e4e70acee87019d706a24", size = 228457, upload-time = "2026-08-26T14:58:04.78Z" }, + { url = "https://files.pythonhosted.org/packages/51/fe/f2331b6b7ccc67589891da354fa46a5cb79e95f83b9fd0e734d77f1f2140/websockets-17.1-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:cec1bb8f22abccc8d20f8ca63df9be41600c26c190f4b97ee86c675fd4a863a6", size = 227265, upload-time = "2026-08-26T14:58:06.102Z" }, + { url = "https://files.pythonhosted.org/packages/47/a5/fb1642302f8ec77ca922203074f155a9831a5128ad75e725059a476d1227/websockets-17.1-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f3a1d577e081667dda7f8e5b4796e6e32f9713c93e2a3d930669519840a3c623", size = 226143, upload-time = "2026-08-26T14:58:07.464Z" }, + { url = "https://files.pythonhosted.org/packages/d7/41/7133fcfb63f5562750b269d6a845c689dde6a2c6407286da395beea19ddd/websockets-17.1-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:dc053f9e95a76213c5eb7ed95779f7daf0d2bf0e4e03073629ebfa43a033f151", size = 223501, upload-time = "2026-08-26T14:58:08.766Z" }, + { url = "https://files.pythonhosted.org/packages/64/b1/82b36bfabc79ff2d383a1fc043cee6a13f794ef4f6bf1b4810ad6988cf6f/websockets-17.1-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:bb0efe019480a1c93e168ce96479273aaebd672fc8c350d5eed1e507ababb1b8", size = 226330, upload-time = "2026-08-26T14:58:09.987Z" }, + { url = "https://files.pythonhosted.org/packages/41/7d/5b511b9bf6e9ad331e6ff902fcbcc71c3794d10ef3b5efe80ccb8f0a7861/websockets-17.1-cp315-cp315t-musllinux_1_2_armv7l.whl", hash = "sha256:615746b12b26a3fd4077bc6fbeb277a1c192a45dd57b531d07ad9ed5c52a9a7a", size = 224980, upload-time = "2026-08-26T14:58:11.303Z" }, + { url = "https://files.pythonhosted.org/packages/e0/50/aed08f25301f8eef23be903ff9319fcf35630ca2bdec9d226f7d804dd5b3/websockets-17.1-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:1a20136d61f9ca3a31493732762661fafc2c20e8861930214e21afc6a8a692a2", size = 225478, upload-time = "2026-08-26T14:58:12.543Z" }, + { url = "https://files.pythonhosted.org/packages/3e/47/0d63d4168536b4682c9d19b7399443b1176f25dbb68878374fa716670230/websockets-17.1-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:2786cbd273ab69c22612db8a41229ddf2c158060b17b5928884bf388d07887f3", size = 226588, upload-time = "2026-08-26T14:58:14.457Z" }, + { url = "https://files.pythonhosted.org/packages/b3/dd/844bd0b6386fc81ed6a55f4b6dd26f01c6987eda205afa10175ea12b2164/websockets-17.1-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:b1c323fc3be1dc3f87f6c59458cb7d9e13dcbbf971d6c3f3e2bbaf58d3bfcdfe", size = 224336, upload-time = "2026-08-26T14:58:15.778Z" }, + { url = "https://files.pythonhosted.org/packages/96/18/03709c84bc88ec4dcea68d4be4ccd07d611073dec111203a5bf45af8809d/websockets-17.1-cp315-cp315t-musllinux_1_2_s390x.whl", hash = "sha256:12c8e2b25df59755954a04dfa09c990b96691025aaf7eafd19ed6da24b09c18d", size = 225197, upload-time = "2026-08-26T14:58:17.141Z" }, + { url = "https://files.pythonhosted.org/packages/27/cf/0d1c694b6466c89e875b85b32b51312c472cf6708eee91914866f5087dde/websockets-17.1-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:f58f58b4b29bbea2a3635e2c56eff4a3adab011fe383802a9e542e31b97085fc", size = 225493, upload-time = "2026-08-26T14:58:18.521Z" }, + { url = "https://files.pythonhosted.org/packages/4e/f5/99857c3dd9676749f33e3668665a34ad6099505fb8d75eb084f49f7807a9/websockets-17.1-cp315-cp315t-win32.whl", hash = "sha256:f78a3ffb1994304db2c0c4588e4d1a518079b557054fa3bb985a6f5e50ff49a3", size = 217130, upload-time = "2026-08-26T14:58:20.037Z" }, + { url = "https://files.pythonhosted.org/packages/2c/84/77599922ab441bfe61508f97dab2c71f8e114d31793993ea54011db16199/websockets-17.1-cp315-cp315t-win_amd64.whl", hash = "sha256:ad68c28a27246fed109a4409393d677b7e1388345cbbd2f5aee5c182d8506110", size = 217448, upload-time = "2026-08-26T14:58:21.382Z" }, + { url = "https://files.pythonhosted.org/packages/ce/3c/8b9a225b523f06a9389be81f1b0ab07c49bec6014742e6aa359c1f920f1f/websockets-17.1-cp315-cp315t-win_arm64.whl", hash = "sha256:e552e0037230ac16e5f568de7012041344d1b18c9feed30ec2891b8eba55af81", size = 217372, upload-time = "2026-08-26T14:58:22.807Z" }, + { url = "https://files.pythonhosted.org/packages/e7/e4/af4abbcf07eac6a725ec6f865611526b2b0c23d482723de551bec667880d/websockets-17.1-pp311-pypy311_pp73-macosx_10_15_x86_64.whl", hash = "sha256:10ecb38ffc05e1841b619d99c725307a223ef9ad58e7b1ed33311d472dc43918", size = 214602, upload-time = "2026-08-26T14:58:25.211Z" }, + { url = "https://files.pythonhosted.org/packages/4d/fe/819fba7ba35f92b639333da7355041c07dd50048f9c76fba0b8e292a6483/websockets-17.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:17aa424ab61620aad21b36b2240efc87b500cc496e7d0e999a5c2ae99395e886", size = 214874, upload-time = "2026-08-26T14:58:26.689Z" }, + { url = "https://files.pythonhosted.org/packages/4f/a7/d370ab794f47fbeea648d17ad08caf0bb50131d6c04b7ad83e6af63c405a/websockets-17.1-pp311-pypy311_pp73-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:764cf7bfa149365f32b7a0fd9fed32debdac29dd06295d5635cde1745b446cd8", size = 215821, upload-time = "2026-08-26T17:25:23.616Z" }, + { url = "https://files.pythonhosted.org/packages/9b/6b/251b00fe634e2a9c2cb5d6390e0e97cec55e3d18dd09b4b976620eed5d7b/websockets-17.1-pp311-pypy311_pp73-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:8d1b108bd8f5f6a8b90801f6db3b3858d5deca889acfdb8ac497bbb24e4b0edf", size = 215714, upload-time = "2026-08-26T17:25:26.295Z" }, + { url = "https://files.pythonhosted.org/packages/c4/b1/37fe0c96c206b4208a072c3a74add6a72af4b8228be3f5435163c5a6d099/websockets-17.1-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a62d8c424383c9dc769ff3672018df822603117e32686e567d452ed035b6fb2e", size = 216608, upload-time = "2026-08-26T17:25:28.134Z" }, + { url = "https://files.pythonhosted.org/packages/be/7e/75a0a491b512412e08333b9f8412757af6186fe1c598186261002de1a793/websockets-17.1-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:8196d217eeca52b9235ee1f8a684a09885a5f953d5a31e80ef915bf2c5c94f9d", size = 217870, upload-time = "2026-08-26T17:25:29.745Z" }, + { url = "https://files.pythonhosted.org/packages/41/63/23572870e01836a98346075b9e17a8bc24a6ddd9800a3204ceee58677f3c/websockets-17.1-py3-none-any.whl", hash = "sha256:f221081107b8c48184d99f7019604486376e7ef826037e70aad6b02540732c23", size = 211134, upload-time = "2026-08-26T17:25:31.397Z" }, ] [[package]] name = "zipp" -version = "3.23.0" +version = "4.1.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/e3/02/0f2892c661036d50ede074e376733dca2ae7c6eb617489437771209d4180/zipp-3.23.0.tar.gz", hash = "sha256:a07157588a12518c9d4034df3fbbee09c814741a33ff63c05fa29d26a2404166", size = 25547, upload-time = "2025-06-08T17:06:39.4Z" } +sdist = { url = "https://files.pythonhosted.org/packages/b9/d8/eab98a517c14134c0b2eb4e2387bc5f457334293ec5d2dd3857ec2966802/zipp-4.1.0.tar.gz", hash = "sha256:4cb57381f544315db7688e976e922a2b18cdb513d21cc194eb42232ba2a3e602", size = 26214, upload-time = "2026-05-18T20:08:57.967Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/2e/54/647ade08bf0db230bfea292f893923872fd20be6ac6f53b2b936ba839d75/zipp-3.23.0-py3-none-any.whl", hash = "sha256:071652d6115ed432f5ce1d34c336c0adfd6a884660d1e9712a256d3d3bd4b14e", size = 10276, upload-time = "2025-06-08T17:06:38.034Z" }, + { url = "https://files.pythonhosted.org/packages/3a/13/547360d81e6d88d58492968ffda9f9542854f11310ee556fef14260cc886/zipp-4.1.0-py3-none-any.whl", hash = "sha256:25ad4e16390cd314347dd8f1de67a2ac538ae658ed4ab9db16029c07c188e97f", size = 10238, upload-time = "2026-05-18T20:08:57.045Z" }, ] diff --git a/internal/ado/tracker.go b/internal/ado/tracker.go index a936d46a0..f87e79896 100644 --- a/internal/ado/tracker.go +++ b/internal/ado/tracker.go @@ -11,7 +11,6 @@ import ( "time" "github.com/steveyegge/beads/internal/config" - "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/tracker" "github.com/steveyegge/beads/internal/types" ) @@ -37,7 +36,7 @@ var adoShorthandPattern = regexp.MustCompile(`^ado:([1-9]\d*)$`) // ADO and the local beads database. type Tracker struct { client *Client - store storage.Storage + store tracker.Store mapper tracker.FieldMapper baseURL string // Resolved base URL for external ref matching org string @@ -75,7 +74,7 @@ func (t *Tracker) ConfigPrefix() string { return "ado" } // Init initializes the tracker with configuration from the beads config store. // No network calls are made during initialization. -func (t *Tracker) Init(ctx context.Context, store storage.Storage) error { +func (t *Tracker) Init(ctx context.Context, store tracker.Store) error { t.store = store pat := t.getConfig(ctx, "ado.pat", "AZURE_DEVOPS_PAT") diff --git a/internal/config/yaml_config.go b/internal/config/yaml_config.go index 7f6896452..f86b0ef2c 100644 --- a/internal/config/yaml_config.go +++ b/internal/config/yaml_config.go @@ -364,6 +364,69 @@ func WorkspaceYamlValue(beadsDir, key string) (string, bool) { return readYamlValueAtPath(filepath.Join(beadsDir, "config.yaml"), key) } +// WorkspaceYamlValueStrict reads one dotted key from a workspace config.yaml +// without conflating a malformed or unreadable file with an absent key. A +// missing file or key returns present=false and no error; all other I/O and +// YAML shape errors are returned to the caller. +func WorkspaceYamlValueStrict(beadsDir, key string) (value string, present bool, err error) { + if beadsDir == "" { + return "", false, nil + } + data, err := os.ReadFile(filepath.Join(beadsDir, "config.yaml")) //nolint:gosec // beadsDir is caller-resolved workspace state + if os.IsNotExist(err) { + return "", false, nil + } + if err != nil { + return "", false, fmt.Errorf("reading workspace config.yaml: %w", err) + } + var root map[string]interface{} + if err := yaml.Unmarshal(data, &root); err != nil { + return "", false, fmt.Errorf("parsing workspace config.yaml: %w", err) + } + if root == nil { + return "", false, nil + } + if raw, ok := root[key]; ok { + value, err := strictYamlScalarString(raw) + if err != nil { + return "", true, err + } + return value, true, nil + } + var node interface{} = root + parts := strings.Split(key, ".") + for i, part := range parts { + m, ok := node.(map[string]interface{}) + if !ok { + return "", true, fmt.Errorf("workspace config key %q has a non-map parent", key) + } + node, ok = m[part] + if !ok { + return "", false, nil + } + if i == len(parts)-1 { + value, err := strictYamlScalarString(node) + if err != nil { + return "", true, err + } + return value, true, nil + } + } + return "", false, nil +} + +func strictYamlScalarString(v interface{}) (string, error) { + if v == nil { + return "", fmt.Errorf("workspace config value is null") + } + switch v.(type) { + case map[string]interface{}, []interface{}: + return "", fmt.Errorf("workspace config value must be a scalar") + default: + return fmt.Sprintf("%v", v), nil + } +} + func readYamlValueAtPath(path, key string) (string, bool) { data, err := os.ReadFile(path) //nolint:gosec // path is a resolved config.yaml path, not user input if err != nil { diff --git a/internal/config/yaml_config_test.go b/internal/config/yaml_config_test.go index e7b162c0e..d6fd9522c 100644 --- a/internal/config/yaml_config_test.go +++ b/internal/config/yaml_config_test.go @@ -409,6 +409,53 @@ func TestSetYamlConfigInDir_WritesTargetConfigDespiteLocalStub(t *testing.T) { } } +func TestWorkspaceYamlValueStrictDistinguishesMissingAndMalformed(t *testing.T) { + beadsDir := filepath.Join(t.TempDir(), ".beads") + if value, present, err := WorkspaceYamlValueStrict(beadsDir, "dolt.shared-server"); err != nil || present || value != "" { + t.Fatalf("missing config = (%q, %v, %v), want empty/false/nil", value, present, err) + } + if err := os.MkdirAll(beadsDir, 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt: ["), 0o600); err != nil { + t.Fatal(err) + } + if _, _, err := WorkspaceYamlValueStrict(beadsDir, "dolt.shared-server"); err == nil { + t.Fatal("malformed config should return an error") + } +} + +func TestWorkspaceYamlValueStrictReadsNestedScalar(t *testing.T) { + beadsDir := filepath.Join(t.TempDir(), ".beads") + if err := os.MkdirAll(beadsDir, 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("dolt:\n shared-server: false\n"), 0o600); err != nil { + t.Fatal(err) + } + value, present, err := WorkspaceYamlValueStrict(beadsDir, "dolt.shared-server") + if err != nil || !present || value != "false" { + t.Fatalf("nested scalar = (%q, %v, %v), want false/true/nil", value, present, err) + } +} + +func TestWorkspaceYamlValueStrictRejectsNullAndWrongParent(t *testing.T) { + for _, body := range []string{"dolt:\n shared-server: null\n", "dolt: false\n", "dolt: []\n"} { + t.Run(strings.ReplaceAll(body, "\n", "_"), func(t *testing.T) { + beadsDir := filepath.Join(t.TempDir(), ".beads") + if err := os.MkdirAll(beadsDir, 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte(body), 0o600); err != nil { + t.Fatal(err) + } + if _, _, err := WorkspaceYamlValueStrict(beadsDir, "dolt.shared-server"); err == nil { + t.Fatalf("config %q should be rejected", body) + } + }) + } +} + func TestSetYamlConfigInDir_ValidatesBeforeOpeningConfig(t *testing.T) { beadsDir := filepath.Join(t.TempDir(), ".beads") diff --git a/internal/configfile/backend_messages.go b/internal/configfile/backend_messages.go index 74dba9310..68b48bb4c 100644 --- a/internal/configfile/backend_messages.go +++ b/internal/configfile/backend_messages.go @@ -1,12 +1,24 @@ package configfile -import "fmt" +import ( + "fmt" + "os" + "path/filepath" +) // This file is the single source of truth for the user-facing removed-backend // and unknown-backend messages. cmd/bd, the public beads package, and the Dolt // store must all fail closed with the same text, so the wording is deliberately -// centralized here. The framing of these messages is pending a separate -// maintainer decision — reword them here, in one place, once that lands. +// centralized here. +// +// Rejection is fail-closed and stays that way: bd never rewrites metadata.json +// on an open path. But a workspace whose metadata names a removed backend often +// holds a live Dolt database — bd v1.2.x opened these workspaces as Dolt no +// matter what the "backend" field said, so the field is the only stale thing +// about them. Sending those users down the export-and-reinitialize path would +// destroy a database that is one JSON edit from healthy, so the messages below +// branch on whether Dolt data is actually present and, when it is, name the +// exact edit instead (D-8). // RemovedBackendRationale explains why direct PostgreSQL/MySQL support was // removed. Shortened site-specific messages (e.g. bd init flag guidance) @@ -31,21 +43,134 @@ func removedBackendRationale(backend string) string { return RemovedBackendRationale } -// RemovedBackendDetail returns the shared body of every removed-backend error: -// the rationale, the untouched-data guarantee, and the migration path. Callers -// prepend a site-specific lead-in; RemovedBackendError carries the standard one. +// ExistingDoltDataDir returns the path of a Dolt database directory already +// present in the workspace beneath beadsDir, or "" when there is none. It +// checks the embedded layout (.beads/embeddeddolt) and the server-mode data dir +// (.beads/dolt by default, or the dolt_data_dir / BEADS_DOLT_DATA_DIR override, +// absolute or relative to beadsDir); under either root a database lives +// directly at /.dolt or one level down at //.dolt. +// +// It stats and reads directories only — never opens or writes storage — because +// every caller is on a rejection path that has promised not to touch the data. +// An empty beadsDir returns "", so callers without a workspace directory fall +// back to the generic message. +// +// The detection approach is ported from PR #4740 by Steve Yegge. +func ExistingDoltDataDir(beadsDir string, cfg *Config) string { + if beadsDir == "" { + return "" + } + + doltDir := filepath.Join(beadsDir, "dolt") + if custom := cfg.GetDoltDataDir(); custom != "" { + if filepath.IsAbs(custom) { + doltDir = custom + } else { + doltDir = filepath.Join(beadsDir, custom) + } + } + + for _, root := range []string{filepath.Join(beadsDir, "embeddeddolt"), doltDir} { + if isDoltRepository(root) { + return root + } + entries, err := os.ReadDir(root) + if err != nil { + continue + } + for _, entry := range entries { + if !entry.IsDir() { + continue + } + if db := filepath.Join(root, entry.Name()); isDoltRepository(db) { + return db + } + } + } + return "" +} + +// isDoltRepository reports whether dir is a Dolt database root, i.e. holds a +// .dolt directory. +func isDoltRepository(dir string) bool { + info, err := os.Stat(filepath.Join(dir, ".dolt")) + return err == nil && info.IsDir() +} + +// RemovedBackendDetail returns the shared body of a removed-backend error for a +// caller with no workspace directory to inspect: the rationale, the +// untouched-data guarantee, and the export/reinitialize recovery path. Callers +// that know the workspace should use RemovedBackendDetailAt, which can offer the +// metadata heal when the workspace already holds Dolt data. func RemovedBackendDetail(backend string) string { - return fmt.Sprintf("%s; the configured %s database was not opened or modified; export it with a bd version that supports %s, then follow bd help init-safety to reinitialize with Dolt and import the exported data", removedBackendRationale(backend), backend, backend) + return removedBackendRecoveryDetail(backend, "") +} + +// RemovedBackendDetailAt returns the body of a removed-backend error for a known +// workspace: the metadata heal when beadsDir already holds a Dolt database, and +// the export/reinitialize recovery path otherwise. Callers prepend a +// site-specific lead-in; RemovedBackendErrorAt carries the standard one. +func RemovedBackendDetailAt(backend, beadsDir string, cfg *Config) string { + if doltDir := ExistingDoltDataDir(beadsDir, cfg); doltDir != "" { + return removedBackendHealDetail(backend, beadsDir, doltDir) + } + return removedBackendRecoveryDetail(backend, beadsDir) +} + +// removedBackendHealDetail is the branch for a workspace that already has Dolt +// data: the stale metadata value is the whole problem, so the message names the +// exact edit that fixes it rather than a destructive rebuild. +func removedBackendHealDetail(backend, beadsDir, doltDir string) string { + return fmt.Sprintf("%s; however, this workspace already has a Dolt database at %s, and bd v1.2.x opened workspaces like this as Dolt — the stale \"backend\" value is the only problem; to heal, edit %s and change \"backend\": %q to \"backend\": %q (or delete the \"backend\" field entirely; Dolt is the default), then rerun the command; %s", + removedBackendRationale(backend), doltDir, ConfigPath(beadsDir), + backend, BackendDolt, BackendNotOpenedGuarantee) +} + +// removedBackendRecoveryDetail is the branch for a workspace with no Dolt data: +// the configured database really is the only copy, so recovery runs through an +// export from a bd release that still has the backend. +func removedBackendRecoveryDetail(backend, beadsDir string) string { + absent := "" + if beadsDir != "" { + absent = fmt.Sprintf(", and no Dolt database was found under %s", beadsDir) + } + return fmt.Sprintf("%s; the configured %s database was not opened or modified%s; to recover the data, export it to JSONL with a bd release that still includes the %s backend, then follow 'bd help init-safety' to reinitialize this workspace with Dolt and import the exported data", + removedBackendRationale(backend), backend, absent, backend) } // RemovedBackendError is the standard fail-closed error for metadata that -// selects a backend whose direct support was removed. +// selects a backend whose direct support was removed, for callers with no +// workspace directory to inspect. Prefer RemovedBackendErrorAt. func RemovedBackendError(backend string) error { return fmt.Errorf("storage backend %q is no longer supported: %s", backend, RemovedBackendDetail(backend)) } +// RemovedBackendErrorAt is RemovedBackendError for a known workspace: when +// beadsDir already holds a Dolt database the error names metadata.json as the +// one thing to fix, because that is the truth for every workspace bd v1.2.x +// opened as Dolt despite the stale "backend" value. +func RemovedBackendErrorAt(backend, beadsDir string, cfg *Config) error { + if doltDir := ExistingDoltDataDir(beadsDir, cfg); doltDir != "" { + return fmt.Errorf("storage backend %q in %s is no longer supported: %s", + backend, ConfigPath(beadsDir), removedBackendHealDetail(backend, beadsDir, doltDir)) + } + return fmt.Errorf("storage backend %q is no longer supported: %s", backend, removedBackendRecoveryDetail(backend, beadsDir)) +} + // UnknownBackendError is the standard fail-closed error for metadata that // names a backend this build does not recognize. func UnknownBackendError(backend string) error { - return fmt.Errorf("storage backend %q in metadata.json is not recognized or supported; %s; the supported backend is %q; fix or restore metadata.json and retry", backend, BackendNotOpenedGuarantee, BackendDolt) + return UnknownBackendErrorAt(backend, "", nil) +} + +// UnknownBackendErrorAt is UnknownBackendError enriched with the metadata heal +// when the workspace already holds a Dolt database — the same truth the +// removed-backend branch tells, for a value bd never recognized at all. +func UnknownBackendErrorAt(backend, beadsDir string, cfg *Config) error { + remedy := "fix or restore metadata.json and retry" + if doltDir := ExistingDoltDataDir(beadsDir, cfg); doltDir != "" { + remedy = fmt.Sprintf("a Dolt database exists at %s — edit %s and set \"backend\": %q (or delete the \"backend\" field), then rerun", + doltDir, ConfigPath(beadsDir), BackendDolt) + } + return fmt.Errorf("storage backend %q in metadata.json is not recognized or supported; %s; the supported backend is %q; %s", backend, BackendNotOpenedGuarantee, BackendDolt, remedy) } diff --git a/internal/configfile/backend_messages_test.go b/internal/configfile/backend_messages_test.go new file mode 100644 index 000000000..dc2c5dddd --- /dev/null +++ b/internal/configfile/backend_messages_test.go @@ -0,0 +1,219 @@ +package configfile + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +// plantDoltRepository creates the .dolt marker that makes dir look like a Dolt +// database root, creating parents as needed, and returns dir. +func plantDoltRepository(t *testing.T, dir string) string { + t.Helper() + if err := os.MkdirAll(filepath.Join(dir, ".dolt"), 0o755); err != nil { + t.Fatalf("plant dolt repository at %s: %v", dir, err) + } + return dir +} + +// TestExistingDoltDataDir covers the layouts a workspace's Dolt data can live +// in. Detection drives the removed-backend message's branch, so a miss sends a +// user with a live database down the destructive export/reinitialize path. +func TestExistingDoltDataDir(t *testing.T) { + // Each case seeds a workspace and returns the config to detect with plus the + // directory detection must find ("" for none). + tests := []struct { + name string + setup func(t *testing.T, beadsDir string) (*Config, string) + }{ + { + name: "embedded layout, database one level down", + setup: func(t *testing.T, beadsDir string) (*Config, string) { + return &Config{}, plantDoltRepository(t, filepath.Join(beadsDir, "embeddeddolt", "beads")) + }, + }, + { + name: "embedded layout, database at the root", + setup: func(t *testing.T, beadsDir string) (*Config, string) { + return &Config{}, plantDoltRepository(t, filepath.Join(beadsDir, "embeddeddolt")) + }, + }, + { + name: "server layout at the root", + setup: func(t *testing.T, beadsDir string) (*Config, string) { + return &Config{}, plantDoltRepository(t, filepath.Join(beadsDir, "dolt")) + }, + }, + { + name: "server layout, database one level down", + setup: func(t *testing.T, beadsDir string) (*Config, string) { + return &Config{}, plantDoltRepository(t, filepath.Join(beadsDir, "dolt", "beads")) + }, + }, + { + name: "relative dolt_data_dir", + setup: func(t *testing.T, beadsDir string) (*Config, string) { + return &Config{DoltDataDir: "custom-data"}, plantDoltRepository(t, filepath.Join(beadsDir, "custom-data", "beads")) + }, + }, + { + name: "absolute dolt_data_dir", + setup: func(t *testing.T, _ string) (*Config, string) { + dir := plantDoltRepository(t, filepath.Join(t.TempDir(), "elsewhere")) + return &Config{DoltDataDir: dir}, dir + }, + }, + { + name: "BEADS_DOLT_DATA_DIR overrides the configured data dir", + setup: func(t *testing.T, _ string) (*Config, string) { + dir := plantDoltRepository(t, filepath.Join(t.TempDir(), "env-data")) + t.Setenv("BEADS_DOLT_DATA_DIR", dir) + return &Config{DoltDataDir: "ignored-when-env-is-set"}, dir + }, + }, + { + name: "nil config still finds the default layouts", + setup: func(t *testing.T, beadsDir string) (*Config, string) { + return nil, plantDoltRepository(t, filepath.Join(beadsDir, "dolt")) + }, + }, + { + name: "nothing present", + setup: func(t *testing.T, beadsDir string) (*Config, string) { + // A directory without a .dolt marker is not a database, a .dolt + // that is a regular file is not one either, and neither is a + // data-dir root that is itself a file. + if err := os.MkdirAll(filepath.Join(beadsDir, "embeddeddolt", "beads"), 0o755); err != nil { + t.Fatalf("create decoy database dir: %v", err) + } + if err := os.WriteFile(filepath.Join(beadsDir, "embeddeddolt", "beads", ".dolt"), []byte("not a dir"), 0o600); err != nil { + t.Fatalf("create decoy .dolt file: %v", err) + } + if err := os.WriteFile(filepath.Join(beadsDir, "dolt"), []byte("not a dir"), 0o600); err != nil { + t.Fatalf("create decoy data dir file: %v", err) + } + return &Config{}, "" + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + beadsDir := t.TempDir() + cfg, want := tt.setup(t, beadsDir) + if got := ExistingDoltDataDir(beadsDir, cfg); got != want { + t.Errorf("ExistingDoltDataDir() = %q, want %q", got, want) + } + }) + } +} + +// TestExistingDoltDataDirWithoutBeadsDir pins the degradation contract: a caller +// with no workspace directory gets "" (and so the generic message) rather than +// a guess rooted at the process working directory. +func TestExistingDoltDataDirWithoutBeadsDir(t *testing.T) { + if got := ExistingDoltDataDir("", &Config{}); got != "" { + t.Errorf("ExistingDoltDataDir(\"\") = %q, want \"\"", got) + } + if got := ExistingDoltDataDir("", nil); got != "" { + t.Errorf("ExistingDoltDataDir(\"\", nil) = %q, want \"\"", got) + } +} + +// TestRemovedBackendErrorHealBranch pins the message a workspace with live Dolt +// data gets: metadata.json is the only thing wrong, so the error must name the +// file, the exact edit, and the untouched-data guarantee — and must NOT send the +// user to export and reinitialize a database that is one JSON edit from healthy. +func TestRemovedBackendErrorHealBranch(t *testing.T) { + for _, backend := range []string{BackendSQLite, BackendPostgres, BackendMySQL} { + t.Run(backend, func(t *testing.T) { + beadsDir := t.TempDir() + doltDir := plantDoltRepository(t, filepath.Join(beadsDir, "embeddeddolt", "beads")) + + message := RemovedBackendErrorAt(backend, beadsDir, &Config{Backend: backend}).Error() + for _, want := range []string{ + "no longer supported", + removedBackendRationale(backend), + doltDir, + ConfigPath(beadsDir), + `"backend": "` + backend + `"`, + `"backend": "dolt"`, + BackendNotOpenedGuarantee, + } { + if !strings.Contains(message, want) { + t.Errorf("heal-branch message missing %q:\n%s", want, message) + } + } + if strings.Contains(strings.ToLower(message), "export") { + t.Errorf("heal-branch message must not offer the destructive export path:\n%s", message) + } + }) + } +} + +// TestRemovedBackendErrorRecoveryBranch pins the no-Dolt-data message: the +// configured database really is the only copy, so the export/reinitialize path +// stays — along with every substring the existing rejection tests match on. +func TestRemovedBackendErrorRecoveryBranch(t *testing.T) { + for _, backend := range []string{BackendSQLite, BackendPostgres, BackendMySQL} { + t.Run(backend, func(t *testing.T) { + beadsDir := t.TempDir() + message := RemovedBackendErrorAt(backend, beadsDir, &Config{Backend: backend}).Error() + + wants := []string{"no longer supported", "was not opened", "export", "dolt", beadsDir, "no Dolt database was found"} + if backend == BackendSQLite { + wants = append(wants, "single engine") + } else { + wants = append(wants, "general-purpose server databases", "simple and resource-light") + } + lowered := strings.ToLower(message) + for _, want := range wants { + if !strings.Contains(lowered, strings.ToLower(want)) { + t.Errorf("recovery-branch message missing %q:\n%s", want, message) + } + } + if strings.Contains(message, "to heal") { + t.Errorf("recovery-branch message must not offer a metadata heal when there is no Dolt data:\n%s", message) + } + }) + } +} + +// TestRemovedBackendErrorWithoutWorkspace pins the beadsDir-less fallback: the +// recovery branch without the "no Dolt database was found" clause, which is what +// the old RemovedBackendError said and what callers with no directory still get. +func TestRemovedBackendErrorWithoutWorkspace(t *testing.T) { + message := RemovedBackendError(BackendSQLite).Error() + for _, want := range []string{"no longer supported", "single engine", "was not opened", "export"} { + if !strings.Contains(message, want) { + t.Errorf("workspace-less message missing %q:\n%s", want, message) + } + } + if strings.Contains(message, "no Dolt database was found") { + t.Errorf("workspace-less message must not claim a search it never ran:\n%s", message) + } +} + +// TestUnknownBackendErrorHealBranch covers the same enrichment for a value bd +// never recognized at all: with Dolt data present, say so and name the edit. +func TestUnknownBackendErrorHealBranch(t *testing.T) { + beadsDir := t.TempDir() + doltDir := plantDoltRepository(t, filepath.Join(beadsDir, "dolt")) + + message := UnknownBackendErrorAt("mystery", beadsDir, &Config{Backend: "mystery"}).Error() + for _, want := range []string{"not recognized", BackendNotOpenedGuarantee, doltDir, ConfigPath(beadsDir), `"backend": "dolt"`} { + if !strings.Contains(message, want) { + t.Errorf("unknown-backend heal message missing %q:\n%s", want, message) + } + } + + // Without Dolt data the text is exactly today's. + plain := UnknownBackendErrorAt("mystery", t.TempDir(), &Config{Backend: "mystery"}).Error() + if plain != UnknownBackendError("mystery").Error() { + t.Errorf("unknown-backend message changed for a workspace with no Dolt data:\n got %s\nwant %s", plain, UnknownBackendError("mystery").Error()) + } + if !strings.Contains(plain, "fix or restore metadata.json and retry") { + t.Errorf("unknown-backend message lost its original remedy:\n%s", plain) + } +} diff --git a/internal/configfile/configfile.go b/internal/configfile/configfile.go index fff16210c..8df2f3890 100644 --- a/internal/configfile/configfile.go +++ b/internal/configfile/configfile.go @@ -623,11 +623,16 @@ func (c *Config) GetDoltServerTLS() bool { // When set, dolt stores its data in this directory instead of .beads/dolt/. // This is useful on WSL where the project lives on a slow NTFS mount (9P) // but dolt data can be placed on native ext4 for significantly better I/O. -// Checks BEADS_DOLT_DATA_DIR env var first, then config. +// Checks BEADS_DOLT_DATA_DIR env var first, then config. Nil-safe, like +// GetBackend: rejection paths resolve the data dir for workspaces whose config +// may not have loaded, and the env override still applies to those. func (c *Config) GetDoltDataDir() string { if d := os.Getenv("BEADS_DOLT_DATA_DIR"); d != "" { return d } + if c == nil { + return "" + } return c.DoltDataDir } diff --git a/internal/configfile/proxied_server_client_info.go b/internal/configfile/proxied_server_client_info.go index e85ebc93a..be9d4a70d 100644 --- a/internal/configfile/proxied_server_client_info.go +++ b/internal/configfile/proxied_server_client_info.go @@ -48,9 +48,38 @@ func SaveProxiedServerClientInfo(beadsDir string, info *ProxiedServerClientInfo) return fmt.Errorf("marshaling %s: %w", ProxiedServerClientInfoFileName, err) } path := ProxiedServerClientInfoPath(beadsDir) - if err := os.WriteFile(path, data, 0o600); err != nil { + tmp, err := os.CreateTemp(beadsDir, ".proxied-server-client-info-*.tmp") + if err != nil { return fmt.Errorf("writing %s: %w", ProxiedServerClientInfoFileName, err) } + tmpPath := tmp.Name() + defer func() { _ = os.Remove(tmpPath) }() + if err = tmp.Chmod(0o600); err == nil { + _, err = tmp.Write(data) + } + if err == nil { + err = tmp.Sync() + } + if closeErr := tmp.Close(); err == nil { + err = closeErr + } + if err != nil { + return fmt.Errorf("writing %s: %w", ProxiedServerClientInfoFileName, err) + } + if err = os.Rename(tmpPath, path); err != nil { + return fmt.Errorf("writing %s: %w", ProxiedServerClientInfoFileName, err) + } + d, err := os.Open(beadsDir) // #nosec G304 -- beadsDir is the discovered workspace directory + if err != nil { + return fmt.Errorf("syncing %s directory: %w", ProxiedServerClientInfoFileName, err) + } + if err = d.Sync(); err != nil { + _ = d.Close() + return fmt.Errorf("syncing %s directory: %w", ProxiedServerClientInfoFileName, err) + } + if err = d.Close(); err != nil { + return fmt.Errorf("closing %s directory: %w", ProxiedServerClientInfoFileName, err) + } return nil } diff --git a/internal/doltserver/doltserver.go b/internal/doltserver/doltserver.go index f0cc047fe..4be44120a 100644 --- a/internal/doltserver/doltserver.go +++ b/internal/doltserver/doltserver.go @@ -542,6 +542,100 @@ func ReadPortFile(beadsDir string) int { return readPortFile(beadsDir) } +// ManagesLiveServerOnPort reports whether beadsDir has a dolt sql-server that +// bd brought under management FOR IT and that is still alive on port. It is +// the affirmative proof of ownership available from local state: bd writes +// both state files in Start(), so a workspace that can show a live PID beside +// a port file naming the port a caller is actually connected on is a workspace +// whose server bd started — or adopted — for itself. Two file reads and a +// signal 0 cannot separate those two, which is why the invariant is stated +// that way; see the residual gaps below. +// +// The absence of that proof is what matters at the call sites. An operator who +// points bd at an endpoint — through BEADS_DOLT_SERVER_PORT, a config.yaml +// pin, `bd init --server-port`, or a hand-built library Config — produces no +// state files at all, because bd never started anything. Nothing else about +// the connection distinguishes the two: both end as "a local TCP dolt +// sql-server on port N". +// +// Read-only, deliberately. IsRunning answers a similar question but repairs as +// it goes: it deletes stale PID and port files, and will stop an orphaned +// server whose port it cannot determine. Callers that are merely classifying a +// connection must not mutate a workspace's server state as a side effect, so +// this duplicates the two cheap checks rather than reusing IsRunning. +// +// Two residual gaps remain, both of which answer "owned" for a server bd did +// not launch. Both are narrower than what trusting the port file alone — or +// ResolveServerMode alone — left open, and #6123 owns closing them as part of +// reconciling the four resolvers that answer "is this dolt server ours?". +// +// Adopted server (the wider of the two). Start() writes these same two state +// files for a server it adopts rather than launches: reclaimPort returns the +// PID of a dolt process whose CWD is this workspace's dolt dir, and Start +// records that foreign PID and the port before reporting Running. So an +// operator running `dolt sql-server` over .beads/dolt under systemd or a +// container — exactly the operator portConflictDiagnostics addresses — mints +// this proof by typing `bd dolt start`. +// +// Typing it is not required, though, and the effect does not wear off. The +// storage layer dials with a 500 ms timeout, so any open that times out — +// under load, or inside a systemd/container restart window — reaches the same +// adopt branch through its auto-start path with no operator action at all. +// Nothing suppresses that by default for the topology this predicate exists to +// gate: when the endpoint comes only from BEADS_DOLT_SERVER_PORT, +// ResolveServerMode still answers Owned (that is the bug being closed here), so +// EnsureRunningDetailed's ServerModeExternal branch never fires and Start() +// proceeds. Once the adopt branch has written the two files they stay: +// IsRunning clears them only for a PID that is corrupt, dead, or not dolt, and +// an adopted server is a live dolt process on all three counts. The workspace +// then answers "owned" from that point on, so a single timed-out dial disarms +// the gate permanently. +// +// One setting does suppress it: `dolt.auto-start: false` (or +// BEADS_DOLT_AUTO_START=0) fails serverOpenCanAutoStart and IsAutoStartDisabled, +// so a timed-out open errors instead of adopting. That closes the incidental +// route only — `bd dolt start` never consults either check, so the deliberate +// route above stays open. It is the one mitigation an operator has while #6123 +// is open. +// +// Closing it means recording adoption distinctly from launch (skip the write on +// the adopt branch, or mark it so this helper declines it), which is a behavior +// change on the auto-start path and belongs with #6123 rather than in a +// gate-hardening patch — though incidental and permanent is a sharper argument +// for #6123 than a resolver tidy-up would be. It is unix-only in practice: +// isProcessInDir returns false on Windows, so reclaimPort never takes the +// CWD-match adopt branch there. +// +// Recycled PID (narrower). This stops short of IsRunning's isDoltProcess() +// command-name check, which shells out to `ps` (PowerShell on Windows) — +// measured at hundreds of milliseconds on a busy machine, and this runs on +// every writable open. So: the recorded server died, an unrelated live process +// inherited its PID number, AND the port file still names the port some other +// server now answers on. It fails toward "owned" only when all three coincide. +// Note that isDoltProcess here would close only this gap, not the adopted-server +// one — reclaimPort already requires isDoltProcess before it will adopt. +// +// Callers needing certainty over latency should use IsRunning. +func ManagesLiveServerOnPort(beadsDir string, port int) bool { + if beadsDir == "" || port <= 0 { + return false + } + // The port file first: it is the cheaper read, and a workspace pointed at + // somebody else's endpoint usually has no port file at all. + if readPortFile(beadsDir) != port { + return false + } + data, err := os.ReadFile(pidPath(beadsDir)) + if err != nil { + return false + } + pid, err := strconv.Atoi(strings.TrimSpace(string(data))) + if err != nil || pid <= 0 { + return false + } + return isProcessAlive(pid) +} + // PortFileSnapshot captures the exact prior contents of a project's port // file, so a caller that speculatively lets EnsureRunningDetailed write a // new one can restore the pre-call state exactly if it later decides not to diff --git a/internal/doltserver/managed_server_proof_test.go b/internal/doltserver/managed_server_proof_test.go new file mode 100644 index 000000000..e4b75e7ef --- /dev/null +++ b/internal/doltserver/managed_server_proof_test.go @@ -0,0 +1,121 @@ +package doltserver + +import ( + "os" + "path/filepath" + "strconv" + "testing" +) + +// TestManagesLiveServerOnPort pins the ownership proof: both state files, a +// live PID, and a port file agreeing with the port the caller is connected on. +// +// Every "false" case below is a silent in-place migration of somebody else's +// database if it ever flips, so each one names the topology it stands for. +func TestManagesLiveServerOnPort(t *testing.T) { + const port = 3307 + + // dead is a PID no live process answers to: above every default pid_max. + const dead = 2147483646 + + newDir := func(t *testing.T) string { + t.Helper() + dir := filepath.Join(t.TempDir(), ".beads") + if err := os.MkdirAll(dir, 0o700); err != nil { + t.Fatalf("mkdir: %v", err) + } + return dir + } + write := func(t *testing.T, dir, name string, v int) { + t.Helper() + if err := os.WriteFile(filepath.Join(dir, name), []byte(strconv.Itoa(v)), 0o600); err != nil { + t.Fatalf("write %s: %v", name, err) + } + } + + // The PID recorded here is this test binary's, which is emphatically not a + // dolt sql-server: parseDoltProcessPIDs requires "dolt" followed by + // "sql-server" in the command line, so an identity check would never return + // it. That is the point — this subtest pins the predicate's liveness-only + // contract and is the live demonstration that any live PID beside an + // agreeing port file is accepted today, dolt or not. #6123 is expected to + // tighten that (a distinct adoption marker, or an identity check); when it + // does, this subtest goes red, and that is the signal to re-derive #6088's + // guarantee from whatever the new proof is, not to relax the assertion. + t.Run("any live pid with an agreeing port file is proof", func(t *testing.T) { + dir := newDir(t) + write(t, dir, PortFileName, port) + write(t, dir, PIDFileName, os.Getpid()) + if !ManagesLiveServerOnPort(dir, port) { + t.Fatal("a workspace with a live recorded server on this port owns it (#6088 must keep migrating)") + } + }) + + t.Run("dead pid is not proof", func(t *testing.T) { + // The workspace once ran its own server on this port; it died, and an + // externally managed server now answers there. 3307 is both the common + // external port and bd's own default, so the collision is likely. + dir := newDir(t) + write(t, dir, PortFileName, port) + write(t, dir, PIDFileName, dead) + if ManagesLiveServerOnPort(dir, port) { + t.Fatal("a port file records that bd once bound a port, not that bd answers on it now") + } + }) + + t.Run("port file naming a different port is not proof", func(t *testing.T) { + dir := newDir(t) + write(t, dir, PortFileName, 40083) + write(t, dir, PIDFileName, os.Getpid()) + if ManagesLiveServerOnPort(dir, port) { + t.Fatal("bd's server is on another port; this endpoint is somebody else's") + } + }) + + t.Run("missing state files are not proof", func(t *testing.T) { + dir := newDir(t) + if ManagesLiveServerOnPort(dir, port) { + t.Fatal("bd never started a server here") + } + write(t, dir, PortFileName, port) + if ManagesLiveServerOnPort(dir, port) { + t.Fatal("a port file with no pid file proves nothing about liveness") + } + }) + + t.Run("garbage pid file is not proof", func(t *testing.T) { + dir := newDir(t) + write(t, dir, PortFileName, port) + if err := os.WriteFile(filepath.Join(dir, PIDFileName), []byte("not-a-pid"), 0o600); err != nil { + t.Fatalf("write pid: %v", err) + } + if ManagesLiveServerOnPort(dir, port) { + t.Fatal("an unparseable pid file must fail closed") + } + }) + + t.Run("degenerate inputs fail closed", func(t *testing.T) { + if ManagesLiveServerOnPort("", port) { + t.Fatal("no workspace, no proof") + } + if ManagesLiveServerOnPort(newDir(t), 0) { + t.Fatal("port 0 means unresolved; there is no endpoint to own") + } + }) + + // Read-only: unlike IsRunning, classifying a connection must never repair + // or delete a workspace's server state as a side effect. + t.Run("does not mutate workspace state", func(t *testing.T) { + dir := newDir(t) + write(t, dir, PortFileName, port) + write(t, dir, PIDFileName, dead) + if ManagesLiveServerOnPort(dir, port) { + t.Fatal("dead pid must not be proof") + } + for _, name := range []string{PortFileName, PIDFileName} { + if _, err := os.Stat(filepath.Join(dir, name)); err != nil { + t.Fatalf("%s was removed: %v — the predicate must not repair state it merely reads", name, err) + } + } + }) +} diff --git a/internal/github/tracker.go b/internal/github/tracker.go index a959aac91..08ad33660 100644 --- a/internal/github/tracker.go +++ b/internal/github/tracker.go @@ -10,7 +10,6 @@ import ( "strings" "github.com/steveyegge/beads/internal/config" - "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/tracker" "github.com/steveyegge/beads/internal/types" ) @@ -32,14 +31,14 @@ var ghShorthandPattern = regexp.MustCompile(`^github:([1-9]\d*)$`) type Tracker struct { client *Client config *MappingConfig - store storage.Storage + store tracker.Store } func (t *Tracker) Name() string { return "github" } func (t *Tracker) DisplayName() string { return "GitHub" } func (t *Tracker) ConfigPrefix() string { return "github" } -func (t *Tracker) Init(ctx context.Context, store storage.Storage) error { +func (t *Tracker) Init(ctx context.Context, store tracker.Store) error { t.store = store token := t.getConfig(ctx, "github.token", "GITHUB_TOKEN") diff --git a/internal/gitlab/tracker.go b/internal/gitlab/tracker.go index 8469b950a..8a83fb64b 100644 --- a/internal/gitlab/tracker.go +++ b/internal/gitlab/tracker.go @@ -9,7 +9,6 @@ import ( "strings" "github.com/steveyegge/beads/internal/config" - "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/tracker" "github.com/steveyegge/beads/internal/types" ) @@ -36,7 +35,7 @@ const gitLabMilestoneIdentifierPrefix = "milestone:" type Tracker struct { client *Client config *MappingConfig - store storage.Storage + store tracker.Store filter *IssueFilter // Optional filters for issue fetching projectPath string // GitLab project path (e.g., "socwave/socwave") for GraphQL } @@ -48,7 +47,7 @@ func (t *Tracker) ConfigPrefix() string { return "gitlab" } // GitLabClient returns the underlying GitLab API client. func (t *Tracker) GitLabClient() *Client { return t.client } -func (t *Tracker) Init(ctx context.Context, store storage.Storage) error { +func (t *Tracker) Init(ctx context.Context, store tracker.Store) error { t.store = store token, err := t.getConfig(ctx, "gitlab.token", "GITLAB_TOKEN") diff --git a/internal/httpapi/apigen/types.gen.go b/internal/httpapi/apigen/types.gen.go index 26b322d2a..a034b22cb 100644 --- a/internal/httpapi/apigen/types.gen.go +++ b/internal/httpapi/apigen/types.gen.go @@ -1,6 +1,6 @@ // Package apigen provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.6.0 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.1 DO NOT EDIT. package apigen import ( @@ -13,7 +13,7 @@ import ( ) const ( - BearerTokenScopes = "bearerToken.Scopes" + BearerTokenScopes bearerTokenContextKey = "bearerToken.Scopes" ) // Defines values for ApplyItemKind. @@ -387,8 +387,8 @@ type ApplyCloseItem struct { // // THERE IS DELIBERATELY NO `expected_status` HERE. A close is idempotent — re-closing a closed issue is `changed: false` — so a guard spelled to refuse an already-closed row is asking for a REFUSAL where this verb answers with a no-op. That belongs on an `update` item whose `patch.status` crosses into the done category. // - // DECODE IT AS A 64-BIT INTEGER, on `ApplyUpdateItem.expected_version`'s terms, including its note that a corrupted token here costs the whole plan. - ExpectedVersion *int64 `json:"expected_version,omitempty"` + // IT IS A STRING, and it must be the `revision` string a response carried, verbatim. A JSON number — or any other type — is a `400` naming this member. The token spans the FULL 64-bit range, so a number would be rounded past 2^53 by an IEEE-754-double parser and the guard would miss a row nothing else touched; a string round-trips exactly in every consumer. + ExpectedVersion *string `json:"expected_version,omitempty"` // Force Bypasses close policy — the open-children refusal and the live-blocker refusal — and nothing else. // @@ -583,8 +583,8 @@ type ApplyItemResult struct { // // It is ALWAYS PRESENT, including as 0. Zero is a real value — a legacy row backfilled and not mutated since — and a `dep_add` is 0 too, because an edge acts on no single row's version. An absent member would be ambiguous between the two. // - // DECODE IT AS A 64-BIT INTEGER, for the reason `UpdateIssueRequest.expected_version` spells out: an IEEE-754-double parser corrupts it silently, and the corruption only shows up as a `precondition_failed` on the NEXT request. This member is the one every other `revision` on the surface is spelled against, so the warning belongs here most of all — a client that reads it through a lossy parser here carries the damage into every guard it composes. - Revision int64 `json:"revision"` + // IT IS A STRING, the token's decimal spelling — `"-3819021935081927"`, or `"0"` for a legacy migration-0054 row. Send it back verbatim as an `expected_version`; do not parse it into a number. A JSON number would not survive the trip: the token spans the FULL 64-bit range, and an IEEE-754-double parser — JavaScript's `JSON.parse`, Go's `any`, Python's `float` — rounds anything past 2^53 to a value NEAR the token that is not it, so a guard composed from it is refused against a row nothing else touched. A string round-trips exactly in every consumer. + Revision string `json:"revision"` } // ApplyItemResultKind Echoes the item's kind, so a caller walking the results does not have to walk the request alongside them. @@ -704,8 +704,8 @@ type ApplyUpdateItem struct { // // `expected_status` and `expected_assignee` carry no such rule, because a caller CAN know what its own earlier item set them to. // - // DECODE IT AS A 64-BIT INTEGER, for the reason `UpdateIssueRequest.expected_version` spells out. It bites harder here than anywhere else on the surface: a corrupted token refuses the WHOLE plan rather than one write, so a client with a lossy parser loses every item of every batch it guards. - ExpectedVersion *int64 `json:"expected_version,omitempty"` + // IT IS A STRING, and it must be the `revision` string a response carried, verbatim. A JSON number — or any other type — is a `400` naming this member. The token spans the FULL 64-bit range, so a number would be rounded past 2^53 by an IEEE-754-double parser and the guard would miss a row nothing else touched; a string round-trips exactly in every consumer. + ExpectedVersion *string `json:"expected_version,omitempty"` // ForceAssigneeTransfer Bypasses ONLY a genuine transfer away from a live foreign in-progress owner. Reasserting the exact current assignee is idempotent and needs no force. It requires `patch.assignee` — a request setting it without one is a `400` — and it must be false when `expected_assignee` is sent. ForceAssigneeTransfer *bool `json:"force_assignee_transfer,omitempty"` @@ -872,10 +872,10 @@ type CloseIssueRequest struct { // // IT IS CHECKED BEFORE THE IDEMPOTENT RE-CLOSE, which is the one place this guard differs from the update's. A re-close of a row somebody else has moved since the caller read it is a `409` and not the 200-with-`already_closed` the same body earns without a guard: a replay whose premise has expired is a refusal the caller wants to see, and it is the only way `already_closed` can be trusted as "nothing has happened here since". // - // The token is the `revision` this operation's own response carries. Compose the next expectation from the value a write ANSWERED with, never from a number the client incremented itself: the token is OPAQUE and compared for equality alone, so it has no predecessor a client can compute. A first guarded close seeds itself from `GET /v0/beads/issues/{id}`'s `revision` — the read that sources a guard — or, for a chain already mid-flight, from an unguarded lifecycle write or `POST /v0/beads/issues:batchApply`'s `ApplyItemResult.revision`. + // The token is the `revision` this operation's own response carries. Compose the next expectation from the value a write ANSWERED with, never from one the client composed itself: the token is OPAQUE and compared for equality alone, so it has no predecessor a client can compute. A first guarded close seeds itself from `GET /v0/beads/issues/{id}`'s `revision` — the read that sources a guard — or, for a chain already mid-flight, from an unguarded lifecycle write or `POST /v0/beads/issues:batchApply`'s `ApplyItemResult.revision`. // - // DECODE IT AS A 64-BIT INTEGER, for the reason `UpdateIssueRequest.expected_version` spells out: an IEEE-754-double parser corrupts it silently, and the corruption only surfaces as a `precondition_failed` on the NEXT request. - ExpectedVersion *int64 `json:"expected_version,omitempty"` + // IT IS A STRING, and it must be the `revision` string a response carried, verbatim. A JSON number — or any other type — is a `400` naming this member. The token spans the FULL 64-bit range, so a number would be rounded past 2^53 by an IEEE-754-double parser and the guard would miss a row nothing else touched; a string round-trips exactly in every consumer. + ExpectedVersion *string `json:"expected_version,omitempty"` // Force Bypass close policy — the open-children refusal and the live-blocker refusal — and nothing else. The refusals are the ROLE's, so this endpoint cannot skip a guard by forgetting one exists. A forced close still reports `open_children`. // @@ -904,8 +904,8 @@ type CloseIssueResponse struct { // // It is here because `expected_version` is: a guard whose token no response carries is a guard a caller cannot fill, and a close-then-reopen or close-then-delete chain has to compose its next expectation from the value the close ANSWERED with. An idempotent re-close carries one too — the row still has a version, and a caller that guarded a replay needs the token whether or not the replay wrote. // - // DECODE IT AS A 64-BIT INTEGER, for the reason `UpdateIssueResponse.revision` spells out. - Revision int64 `json:"revision"` + // IT IS A STRING, the token's decimal spelling — `"-3819021935081927"`, or `"0"` for a legacy migration-0054 row. Send it back verbatim as an `expected_version`; do not parse it into a number. A JSON number would not survive the trip: the token spans the FULL 64-bit range, and an IEEE-754-double parser — JavaScript's `JSON.parse`, Go's `any`, Python's `float` — rounds anything past 2^53 to a value NEAR the token that is not it, so a guard composed from it is refused against a row nothing else touched. A string round-trips exactly in every consumer. + Revision string `json:"revision"` } // CloseOutcome What happened to ONE requested item. @@ -1173,8 +1173,10 @@ type DeleteIssuesRequest struct { // // IT GUARDS LIFECYCLE STATE, NOT THE GRAPH. The token is reminted by status, assignee and started-at writes and deliberately not by label, dependency or rename writes, so a match does not promise the bead's edges are the ones you saw. // - // The token is the `revision` a lifecycle write answers with, and the one `GET /v0/beads/issues/{id}` publishes — which is where a delete guard should seed itself, since reading the bead before erasing it is the only way to be sure it is the bead you meant. DECODE IT AS A 64-BIT INTEGER, for the reason `UpdateIssueRequest.expected_version` spells out. - ExpectedVersion *int64 `json:"expected_version,omitempty"` + // The token is the `revision` a lifecycle write answers with, and the one `GET /v0/beads/issues/{id}` publishes — which is where a delete guard should seed itself, since reading the bead before erasing it is the only way to be sure it is the bead you meant. + // + // IT IS A STRING, and it must be the `revision` string a response carried, verbatim. A JSON number — or any other type — is a `400` naming this member. The token spans the FULL 64-bit range, so a number would be rounded past 2^53 by an IEEE-754-double parser and the guard would miss a row nothing else touched; a string round-trips exactly in every consumer. + ExpectedVersion *string `json:"expected_version,omitempty"` // Force Delete the named beads and leave their dependents ORPHANED, reported in `orphaned`. Without it and without `cascade`, a named bead with a dependent the request did not name is refused. // @@ -1463,7 +1465,9 @@ type Problem struct { // PRESENT ONLY WHERE THE REFUSING OPERATION CAN REPORT IT. An all-or-nothing operation rolls its transaction back, so a value read after the fact would describe a row the refusal never saw; where the role behind an operation does not carry the observed value, this member is omitted rather than reconstructed. Its absence therefore means "this server cannot tell you what it found", never "it found zero". // // NO v0 OPERATION EMITS IT TODAY, nor `actual_status` or `actual_assignee`. Every operation that publishes a guard refuses all-or-nothing, and none of the roles behind them carries the observed value out of the rolled-back transaction. The three members are declared so that an operation whose role CAN report what it found is an addition rather than a wire change — a client must not wait for them, and must never read their absence as a value. - ActualVersion *int64 `json:"actual_version,omitempty"` + // + // IT IS A STRING, and it must be the `revision` string a response carried, verbatim. A JSON number — or any other type — is a `400` naming this member. The token spans the FULL 64-bit range, so a number would be rounded past 2^53 by an IEEE-754-double parser and the guard would miss a row nothing else touched; a string round-trips exactly in every consumer. + ActualVersion *string `json:"actual_version,omitempty"` // Assignee With `already_claimed`: the actor currently holding the issue, read inside the transaction that refused. // @@ -1499,7 +1503,9 @@ type Problem struct { // ExpectedVersion With `precondition_failed`: the row `revision` the request guarded on, echoed from the request itself. // // THE EXPECTED/ACTUAL PAIRS ARE SPLIT BY TYPE rather than carried as one polymorphic `expected`/`actual`, and the reason is this document's: a member that is "a version or a status or an assignee" is a schema alternation, and no composition keyword is available to spell one here (see `ApplyItem`). Three typed pairs cost three member names and are readable by a generated client without a cast. - ExpectedVersion *int64 `json:"expected_version,omitempty"` + // + // IT IS A STRING, and it must be the `revision` string a response carried, verbatim. A JSON number — or any other type — is a `400` naming this member. The token spans the FULL 64-bit range, so a number would be rounded past 2^53 by an IEEE-754-double parser and the guard would miss a row nothing else touched; a string round-trips exactly in every consumer. + ExpectedVersion *string `json:"expected_version,omitempty"` // Floor With `events_journal_truncated`: the lowest seq still retained, or `head + 1` when the journal retains nothing at all. Resuming from `floor - 1` continues with a known, explicit gap. Floor *int64 `json:"floor,omitempty"` @@ -1655,12 +1661,12 @@ type ReleaseIssueResponse struct { // Issue A tracked work item. Property semantics documented here apply to every schema that repeats them below. Issue Issue `json:"issue"` - // Revision The row's optimistic-concurrency token AFTER the release, spelled the way `UpdateIssueResponse.revision` spells it and carrying the same promise: a read-modify-write loop composes its next `expected_version` from THIS value, never from a number it incremented itself. + // Revision The row's optimistic-concurrency token AFTER the release, spelled the way `UpdateIssueResponse.revision` spells it and carrying the same promise: a read-modify-write loop composes its next `expected_version` from THIS value, never from one it composed itself. // // A release REMINTS the token by design, so a caller that guarded a following write on a version it read BEFORE the release will miss. That is the point — a concurrent reclaim or close conflicts rather than silently merging — and this member is how the caller stays in step. // - // DECODE IT AS A 64-BIT INTEGER, for the reason `UpdateIssueRequest.expected_version` spells out: an IEEE-754-double parser corrupts it silently, and the corruption only shows up as a `precondition_failed` on the NEXT request. - Revision int64 `json:"revision"` + // IT IS A STRING, the token's decimal spelling — `"-3819021935081927"`, or `"0"` for a legacy migration-0054 row. Send it back verbatim as an `expected_version`; do not parse it into a number. A JSON number would not survive the trip: the token spans the FULL 64-bit range, and an IEEE-754-double parser — JavaScript's `JSON.parse`, Go's `any`, Python's `float` — rounds anything past 2^53 to a value NEAR the token that is not it, so a guard composed from it is refused against a row nothing else touched. A string round-trips exactly in every consumer. + Revision string `json:"revision"` } // RememberRequest What to remember, and optionally under what key. @@ -1727,8 +1733,10 @@ type ReopenIssueRequest struct { // // IT IS CHECKED BEFORE THE NON-DONE NO-OP, the mirror of the close's check-before-the-idempotent-re-close, and for the same reason: a reopen of a row somebody else has moved is a `409` rather than the 200-with-`already_open` the same body earns unguarded, which is what lets `already_open` be read as "nothing has happened here since". // - // The token is the `revision` this operation's own response carries; compose the next expectation from a value a write ANSWERED with and never from one the client computed. DECODE IT AS A 64-BIT INTEGER, for the reason `UpdateIssueRequest.expected_version` spells out. - ExpectedVersion *int64 `json:"expected_version,omitempty"` + // The token is the `revision` this operation's own response carries; compose the next expectation from a value a write ANSWERED with and never from one the client computed. + // + // IT IS A STRING, and it must be the `revision` string a response carried, verbatim. A JSON number — or any other type — is a `400` naming this member. The token spans the FULL 64-bit range, so a number would be rounded past 2^53 by an IEEE-754-double parser and the guard would miss a row nothing else touched; a string round-trips exactly in every consumer. + ExpectedVersion *string `json:"expected_version,omitempty"` // Reason Why the issue is being reopened. Recorded on the `reopened` EVENT this move records — not on a field of the issue, and not carried in the response, so a caller that wants it back reads the issue's events. Refused for control characters, and bounded by what the column holds rather than by the number above. Reason *string `json:"reason,omitempty"` @@ -1743,7 +1751,9 @@ type ReopenIssueResponse struct { Issue Issue `json:"issue"` // Revision The row's optimistic-concurrency token AFTER this reopen, spelled the way `CloseIssueResponse.revision` spells it and here for the same reason: a recovery flow that reopens and then re-closes composes its next `expected_version` from this value. DECODE IT AS A 64-BIT INTEGER. - Revision int64 `json:"revision"` + // + // IT IS A STRING, the token's decimal spelling — `"-3819021935081927"`, or `"0"` for a legacy migration-0054 row. Send it back verbatim as an `expected_version`; do not parse it into a number. A JSON number would not survive the trip: the token spans the FULL 64-bit range, and an IEEE-754-double parser — JavaScript's `JSON.parse`, Go's `any`, Python's `float` — rounds anything past 2^53 to a value NEAR the token that is not it, so a guard composed from it is refused against a row nothing else touched. A string round-trips exactly in every consumer. + Revision string `json:"revision"` } // SetSettingRequest What to store under the key the path names. The key is not a member here: it has one spelling, and a body carrying it too would give one request two anchors and a question about what to do when they disagree. @@ -1909,10 +1919,10 @@ type UpdateIssueRequest struct { // ExpectedVersion Requires the row's revision to equal this value before the patch. A miss refuses the WHOLE request with `409 precondition_failed` and writes nothing — `ApplyUpdateItem.expected_version`'s contract, on the operation that patches one row. // - // The token is the `revision` this operation's own response carries, and the same one `GET /v0/beads/issues/{id}` publishes — which is where a first guarded write seeds itself, rather than from an unguarded one or from `POST /v0/beads/issues:batchApply`'s `ApplyItemResult.revision`. Compose the next expectation from the value the write ANSWERED with, never from a number the client incremented itself: the token is OPAQUE and compared for equality alone, so it has no predecessor a client can compute. + // The token is the `revision` this operation's own response carries, and the same one `GET /v0/beads/issues/{id}` publishes — which is where a first guarded write seeds itself, rather than from an unguarded one or from `POST /v0/beads/issues:batchApply`'s `ApplyItemResult.revision`. Compose the next expectation from the value the write ANSWERED with, never from one the client composed itself: the token is OPAQUE and compared for equality alone, so it has no predecessor a client can compute. // - // DECODE IT AS A 64-BIT INTEGER. Live tokens run past 5e17, where an IEEE-754 double's ulp is already 64, so a parser that decodes JSON numbers as doubles — JavaScript's `JSON.parse`, Go's `any`, Python's `float` — hands back a value NEAR the token that is not it, and the guard is refused against a row nothing else touched. - ExpectedVersion *int64 `json:"expected_version,omitempty"` + // IT IS A STRING, and it must be the `revision` string a response carried, verbatim. A JSON number — or any other type — is a `400` naming this member. The token spans the FULL 64-bit range, so a number would be rounded past 2^53 by an IEEE-754-double parser and the guard would miss a row nothing else touched; a string round-trips exactly in every consumer. + ExpectedVersion *string `json:"expected_version,omitempty"` // ForceAssigneeTransfer Bypasses ONLY a genuine transfer away from a live foreign in-progress owner. Reasserting the exact current assignee is idempotent and needs no force. It requires `patch.assignee` — a request setting it without one is a `400` — and it must be false when `expected_assignee` is sent. ForceAssigneeTransfer *bool `json:"force_assignee_transfer,omitempty"` @@ -1940,8 +1950,8 @@ type UpdateIssueResponse struct { // // It is here because `expected_version` is: a guard whose token no response carries is a guard a caller cannot fill. A read-modify-write loop composes its next expectation from THIS value and never from a number it incremented itself, for the reason `compareAndSetMetadata` gives about a value the store renormalizes. `GET /v0/beads/issues/{id}`'s `revision` is the read that publishes the same token, and this member agrees with it. // - // DECODE IT AS A 64-BIT INTEGER, for the reason `UpdateIssueRequest.expected_version` spells out: an IEEE-754-double parser corrupts it silently, and the corruption only shows up as a `precondition_failed` on the NEXT request. - Revision int64 `json:"revision"` + // IT IS A STRING, the token's decimal spelling — `"-3819021935081927"`, or `"0"` for a legacy migration-0054 row. Send it back verbatim as an `expected_version`; do not parse it into a number. A JSON number would not survive the trip: the token spans the FULL 64-bit range, and an IEEE-754-double parser — JavaScript's `JSON.parse`, Go's `any`, Python's `float` — rounds anything past 2^53 to a value NEAR the token that is not it, so a guard composed from it is refused against a row nothing else touched. A string round-trips exactly in every consumer. + Revision string `json:"revision"` } // IssueID defines model for IssueID. @@ -1968,6 +1978,9 @@ type Unauthenticated = Problem // Unavailable RFC 9457 problem detail. This is the only error shape on this surface. The core declares `type`; this server never emits it, so `about:blank` is implied throughout. type Unavailable = Problem +// bearerTokenContextKey is the context key for bearerToken security scheme +type bearerTokenContextKey string + // ListDependenciesParams defines parameters for ListDependencies. type ListDependenciesParams struct { // IssueId The issues to read edges for. Repeat the parameter; at least one is required and at most 100 are accepted, and either bound is a 400 `invalid_argument` with `param: "issue_id"`, `reason: "invalid_value"`. diff --git a/internal/httpapi/batch_apply.go b/internal/httpapi/batch_apply.go index a62cddd20..f1558775b 100644 --- a/internal/httpapi/batch_apply.go +++ b/internal/httpapi/batch_apply.go @@ -421,6 +421,15 @@ func applyUpdateItem(prefix string, encoded json.RawMessage, raw map[string]json if offender, unknown := unknownMember(raw, applyUpdateItemMembers); unknown { return nil, applyUnknownMember(prefix, offender, applyUpdateItemMembers) } + // The guard is read BEFORE the whole-item decode, and through the same + // reader every other operation uses. It is the one member of this item whose + // wire type is not its Go type — a decimal string standing for an int64 — + // so letting the struct decode reach it first would answer a mistyped token + // with the item-level "wrong JSON type" instead of a 400 naming the member. + expectedVersion, res := applyVersionGuardMember(raw, prefix) + if res != nil { + return nil, res + } var wire apigen.ApplyUpdateItem if err := json.Unmarshal(encoded, &wire); err != nil { res := InvalidArgument(applyParam(prefix, ""), ReasonInvalidValue, "an `update` member carries the wrong JSON type") @@ -447,7 +456,7 @@ func applyUpdateItem(prefix string, encoded json.RawMessage, raw map[string]json return nil, res } - item := &issueops.UpdateItem{Target: target, Patch: patch, ExpectedVersion: wire.ExpectedVersion} + item := &issueops.UpdateItem{Target: target, Patch: patch, ExpectedVersion: expectedVersion} if wire.ExpectedStatus != nil { status := issueops.Status(*wire.ExpectedStatus) item.ExpectedStatus = &status @@ -842,7 +851,7 @@ func applyBatchResponse(result issueops.ApplyBatchResult) apigen.ApplyBatchRespo Kind: apigen.ApplyItemResultKind(item.Kind), IssueId: item.IssueID, Changed: item.Changed, - Revision: item.RowVersion, + Revision: types.RevisionToken(item.RowVersion), } if item.DependsOnID != "" { dependsOn := item.DependsOnID @@ -1219,15 +1228,21 @@ func applyBoolMember(raw map[string]json.RawMessage, prefix, member string) (boo return *value, nil } -// applyVersionGuardMember is the family's int64 reader, and it names the member -// itself rather than taking one. +// applyVersionGuardMember is the family's revision-token reader, and it names +// the member itself rather than taking one. // // Its siblings above are generic because they read many members; this one has -// read exactly one on every operation that has ever published a 64-bit member — -// the row-version guard — so the member name lives in the function instead of -// at five call sites that could disagree about how to spell it. A second int64 -// member would re-generalize it, which is a two-line change and not a reason to -// carry a parameter nothing varies. +// read exactly one on every operation that publishes a row-version guard, so the +// member name lives in the function instead of at five call sites that could +// disagree about how to spell it. +// +// THE TOKEN IS A STRING ON THE WIRE AND AN int64 INSIDE. It is opaque and +// equality-only, and it spans the full int64 range, which a JSON number does not +// survive in an IEEE-754-double parser; responses emit it as a decimal string +// (types.RevisionToken) and this is where it comes back. STRING ONLY, with no +// number-or-string transitional spelling: this API refuses unknown members by +// name and keeps one spelling of the guard, and a numeric token accepted here +// would be a value the client rounded before it ever reached the server. // // prefix stays, because a batch item's guard is reported qualified by the item // that carried it where a single operation's is spelled bare. @@ -1236,13 +1251,20 @@ func applyVersionGuardMember(raw map[string]json.RawMessage, prefix string) (*in if !ok { return nil, nil } - var value *int64 - if err := json.Unmarshal(encoded, &value); err != nil || value == nil { + refuse := func() (*int64, *Result) { res := InvalidArgument(prefix+expectedVersionMember, ReasonInvalidValue, - "`"+expectedVersionMember+"` must be an integer") + "`"+expectedVersionMember+"` must be a string: the `revision` token a response carried, echoed verbatim") return nil, &res } - return value, nil + var value *string + if err := json.Unmarshal(encoded, &value); err != nil || value == nil { + return refuse() + } + parsed, err := types.ParseRevisionToken(*value) + if err != nil { + return refuse() + } + return &parsed, nil } // applyBoundedText applies the bounds a stored string carries wherever it is diff --git a/internal/httpapi/batch_apply_test.go b/internal/httpapi/batch_apply_test.go index b78e75ab3..52b6db015 100644 --- a/internal/httpapi/batch_apply_test.go +++ b/internal/httpapi/batch_apply_test.go @@ -81,7 +81,7 @@ func TestApplyBatchForwardsEveryLevelOfTheDocumentedBody(t *testing.T) { "estimated_minutes":null}}}, {"kind":"close","close":{ "target":{"id":"bd-7"},"reason":"done","session":"s-1","force":true, - "expected_version":42}}, + "expected_version":"42"}}, {"kind":"dep_add","dep_add":{ "source":{"key":"root"},"target":{"id":"bd-7"},"type":"waits-for", "metadata":{"gate":"any-children"}}} @@ -265,8 +265,8 @@ func TestApplyBatchAnswersWithTheLeanResult(t *testing.T) { if first["kind"] != "create" || first["issue_id"] != "bd-1" || first["changed"] != true { t.Errorf("items[0] = %v, want the item's kind, id and changed flag", first) } - if first["revision"] != float64(77) { - t.Errorf("items[0].revision = %v, want the row's token under the already-committed spelling", first["revision"]) + if first["revision"] != "77" { + t.Errorf("items[0].revision = %v, want the row's token as a decimal string", first["revision"]) } if _, present := first["issue"]; present { t.Error("items[0] carries a hydrated issue; the wire result is lean and the snapshot stops at the library boundary") @@ -280,8 +280,8 @@ func TestApplyBatchAnswersWithTheLeanResult(t *testing.T) { } // 0 is a real value — a legacy row, and every dep_add — so the member is // emitted rather than omitted, or a client could not tell the two apart. - if second["revision"] != float64(0) { - t.Errorf("items[1].revision = %v, want 0 emitted rather than omitted", second["revision"]) + if second["revision"] != "0" { + t.Errorf("items[1].revision = %v, want \"0\" emitted rather than omitted", second["revision"]) } } @@ -639,8 +639,8 @@ func TestApplyBatchReportsAPreconditionMissAsAConflict(t *testing.T) { err: itemErr(1, issueops.ItemUpdate, "root", "bd-1", issueops.ErrVersionMismatch), wantParam: "items[1].update.expected_version", assert: func(t *testing.T, body map[string]any) { - if body["expected_version"] != float64(42) { - t.Errorf("expected_version = %v, want the guard the request sent", body["expected_version"]) + if body["expected_version"] != "42" { + t.Errorf("expected_version = %v, want the guard the request sent, echoed as the string it arrived as", body["expected_version"]) } }, }, @@ -672,7 +672,7 @@ func TestApplyBatchReportsAPreconditionMissAsAConflict(t *testing.T) { resp := ts.claim(t, batchApplyPath, `{"actor":"alice","items":[ {"kind":"create","create":{"key":"root","title":"one"}}, {"kind":"update","update":{"target":{"id":"bd-1"}, - "expected_version":42,"expected_status":"open","expected_assignee":"bob", + "expected_version":"42","expected_status":"open","expected_assignee":"bob", "patch":{"title":"x"}}} ]}`) if resp.StatusCode != http.StatusConflict { @@ -713,6 +713,66 @@ func TestApplyBatchReportsAPreconditionMissAsAConflict(t *testing.T) { } } +// TestApplyBatchRefusesANumericVersionGuard pins the one spelling of the guard +// on the batch surface, on BOTH item kinds that carry it. +// +// `expected_version` is a decimal string, and a bare number is refused rather +// than coerced. There is no transitional number-or-string acceptance on purpose: +// a number is the shape a double-based client has ALREADY rounded by the time it +// leaves the client, so taking it would mean guarding on a token the server +// never minted and refusing a row nobody touched — the exact failure the string +// exists to remove. The update arm also pins the ORDER: the guard is read before +// the item's typed decode, so a mistyped token earns a 400 naming the member +// instead of the item-level "wrong JSON type". +func TestApplyBatchRefusesANumericVersionGuard(t *testing.T) { + for _, test := range []struct { + name string + item string + wantParam string + }{ + { + name: "update", + item: `{"kind":"update","update":{"target":{"id":"bd-1"},"expected_version":42,"patch":{"title":"x"}}}`, + wantParam: "items[0].update.expected_version", + }, + { + name: "update past 2^53", + item: `{"kind":"update","update":{"target":{"id":"bd-1"},"expected_version":9007199254740993,"patch":{"title":"x"}}}`, + wantParam: "items[0].update.expected_version", + }, + { + name: "close", + item: `{"kind":"close","close":{"target":{"id":"bd-1"},"expected_version":42}}`, + wantParam: "items[0].close.expected_version", + }, + { + name: "a string that is not a decimal token", + item: `{"kind":"update","update":{"target":{"id":"bd-1"},"expected_version":"forty-two","patch":{"title":"x"}}}`, + wantParam: "items[0].update.expected_version", + }, + } { + t.Run(test.name, func(t *testing.T) { + applier := &roleBatchApplier{} + ts := newApplyBatchServer(t, applier) + + resp := ts.claim(t, batchApplyPath, `{"actor":"alice","items":[`+test.item+`]}`) + if resp.StatusCode != http.StatusBadRequest { + t.Fatalf("status = %d, want 400: %s", resp.StatusCode, readAll(t, resp)) + } + body := decodeBody(t, resp) + if body["code"] != string(CodeInvalidArgument) { + t.Errorf("code = %v, want %s", body["code"], CodeInvalidArgument) + } + if body["param"] != test.wantParam { + t.Errorf("param = %v, want %q — the refusal must name the member, not the item", body["param"], test.wantParam) + } + if calls := applier.requests(); len(calls) != 0 { + t.Errorf("%d batches reached the role; a malformed guard is refused before any database work", len(calls)) + } + }) + } +} + // TestApplyBatchMapsTheRolesTypedRefusalsOntoTheDocumentedCodes walks the rest // of the refusal table. Every branch reads a TYPED error rather than prose, // which is what lets a client stop substring-matching messages. diff --git a/internal/httpapi/close.go b/internal/httpapi/close.go index 23364f563..ea466dc57 100644 --- a/internal/httpapi/close.go +++ b/internal/httpapi/close.go @@ -76,7 +76,7 @@ func (s *Server) handleClose(w http.ResponseWriter, r *http.Request) { Issue: *result.Issue, AlreadyClosed: !result.Changed, OpenChildren: result.OpenChildren, - Revision: result.Issue.RowVersion, + Revision: types.RevisionToken(result.Issue.RowVersion), }) } diff --git a/internal/httpapi/close_test.go b/internal/httpapi/close_test.go index 5e701e24e..159c60358 100644 --- a/internal/httpapi/close_test.go +++ b/internal/httpapi/close_test.go @@ -549,9 +549,12 @@ const guardToken int64 = 9007199254740993 // never-written version 0. func guard(v int64) *int64 { return &v } -// revisionOf reads `revision` as the 64-BIT INTEGER the document declares, -// which is the whole reason it exists beside decodeBody: that helper decodes -// into `any`, and `any` is a float64. +// revisionOf reads `revision` as the decimal STRING the document declares and +// parses it back to the int64 the row holds. That is the whole reason it exists +// beside decodeBody: that helper decodes into `any`, which would take the string +// but hand back its text, and would silently have taken a float64 back when the +// member was a number — which is the corruption the string exists to prevent. +// Decoding into *string is what makes a number-typed member fail here. // // NEVER ORDER IT AND NEVER COMPUTE ONE. The token is opaque and compared for // equality alone, so "the previous revision" is not `revision - 1`; it is the @@ -560,7 +563,7 @@ func revisionOf(t *testing.T, resp *http.Response) int64 { t.Helper() raw := readAll(t, resp) var body struct { - Revision *int64 `json:"revision"` + Revision *string `json:"revision"` } if err := json.Unmarshal([]byte(raw), &body); err != nil { t.Fatalf("decode revision from %q: %v", raw, err) @@ -568,7 +571,11 @@ func revisionOf(t *testing.T, resp *http.Response) int64 { if body.Revision == nil { t.Fatalf("the response carries no `revision`: %s", raw) } - return *body.Revision + token, err := types.ParseRevisionToken(*body.Revision) + if err != nil { + t.Fatalf("`revision` %q is not a decimal token: %v", *body.Revision, err) + } + return token } // TestCloseForwardsTheVersionGuard: the member reaches the role as the POINTER @@ -584,8 +591,8 @@ func TestCloseForwardsTheVersionGuard(t *testing.T) { body string want *int64 }{ - {"a guard is forwarded", `{"actor":"alice","expected_version":9007199254740993}`, guard(guardToken)}, - {"the never-written version is a real guard", `{"actor":"alice","expected_version":0}`, guard(0)}, + {"a guard is forwarded", `{"actor":"alice","expected_version":"9007199254740993"}`, guard(guardToken)}, + {"the never-written version is a real guard", `{"actor":"alice","expected_version":"0"}`, guard(0)}, {"an absent guard stays nil", `{"actor":"alice"}`, nil}, } { t.Run(tc.name, func(t *testing.T) { @@ -664,7 +671,7 @@ func TestCloseRefusesAStaleGuard(t *testing.T) { lifecycle := &roleLifecycle{closeErr: fmt.Errorf("close bd-1: %w", issueops.ErrVersionMismatch)} ts := newCloseServer(t, lifecycle) - resp := ts.closeIssue(t, closePath, `{"actor":"alice","expected_version":9007199254740993}`) + resp := ts.closeIssue(t, closePath, `{"actor":"alice","expected_version":"9007199254740993"}`) if resp.StatusCode != http.StatusConflict { t.Fatalf("status = %d, want 409: %s", resp.StatusCode, readAll(t, resp)) } @@ -698,7 +705,7 @@ func TestCloseGuardOutranksClosePolicy(t *testing.T) { lifecycle := &roleLifecycle{closeErr: fmt.Errorf("close bd-1: %w", issueops.ErrVersionMismatch)} ts := newCloseServer(t, lifecycle) - resp := ts.closeIssue(t, closePath, `{"actor":"alice","expected_version":41,"force":false}`) + resp := ts.closeIssue(t, closePath, `{"actor":"alice","expected_version":"41","force":false}`) body := decodeBody(t, resp) if body["code"] != string(CodePreconditionFailed) { t.Errorf("code = %v, want %s: the role checks the version before policy and the wire must not reorder it", @@ -714,7 +721,7 @@ func TestCloseForceDoesNotBypassTheGuard(t *testing.T) { lifecycle := &roleLifecycle{closeResult: issueops.CloseResult{Issue: closedIssue("bd-1"), Changed: true}} ts := newCloseServer(t, lifecycle) - if resp := ts.closeIssue(t, closePath, `{"actor":"alice","force":true,"expected_version":41}`); resp.StatusCode != http.StatusOK { + if resp := ts.closeIssue(t, closePath, `{"actor":"alice","force":true,"expected_version":"41"}`); resp.StatusCode != http.StatusOK { t.Fatalf("status = %d, want 200: %s", resp.StatusCode, readAll(t, resp)) } got := lifecycle.closeRequests() @@ -726,11 +733,20 @@ func TestCloseForceDoesNotBypassTheGuard(t *testing.T) { } } -// TestCloseRefusesAMalformedGuard: the token is an integer and nothing else, -// refused at the edge before any database work. +// TestCloseRefusesAMalformedGuard: the token is a decimal STRING and nothing +// else, refused at the edge before any database work. +// +// The bare number is the case that matters. It is what the member used to be, so +// accepting it would be the transitional spelling this contract deliberately +// does not have — and a JSON number is exactly the shape that arrives already +// rounded from a double-based client. func TestCloseRefusesAMalformedGuard(t *testing.T) { for _, body := range []string{ - `{"actor":"alice","expected_version":"41"}`, + `{"actor":"alice","expected_version":41}`, + `{"actor":"alice","expected_version":9007199254740993}`, + `{"actor":"alice","expected_version":"41.5"}`, + `{"actor":"alice","expected_version":"not-a-token"}`, + `{"actor":"alice","expected_version":""}`, `{"actor":"alice","expected_version":1.5}`, `{"actor":"alice","expected_version":null}`, `{"actor":"alice","expected_version":true}`, diff --git a/internal/httpapi/create_test.go b/internal/httpapi/create_test.go index d0c53c33d..5e633ce50 100644 --- a/internal/httpapi/create_test.go +++ b/internal/httpapi/create_test.go @@ -280,6 +280,51 @@ func TestCreateAnswersTheStoredRow(t *testing.T) { } } +// TestCreateEchoesSubSecondTimestamps pins that the create response carries the +// role's timestamps at FULL precision, as the text a consumer parses. +// +// The role's snapshot is where the sub-second stamp comes from — that is the +// storage-side contract RunLifecycleCreateEchoesSubSecondTimestamps holds — and +// this is the half that says the wire does not round it away on the way out. A +// handler that re-rendered the time through a second-granular layout would print +// the same instant with the fraction gone, and every same-second create through +// POST /v0/beads/issues would tie. +func TestCreateEchoesSubSecondTimestamps(t *testing.T) { + stored := createdIssue("bd-nano") + stored.CreatedAt = time.Date(2026, 8, 1, 9, 0, 0, 123456789, time.UTC) + stored.UpdatedAt = time.Date(2026, 8, 1, 9, 0, 1, 987654321, time.UTC) + lifecycle := &roleLifecycle{createResult: issueops.CreateResult{Issue: stored}} + ts := newCreateServer(t, lifecycle) + + resp := ts.createIssue(t, `{"actor":"alice","title":"as sent"}`) + if resp.StatusCode != http.StatusOK { + t.Fatalf("status = %d, want 200: %s", resp.StatusCode, readAll(t, resp)) + } + body := decodeBody(t, resp) + for _, member := range []struct { + name string + want time.Time + }{ + {"created_at", stored.CreatedAt}, + {"updated_at", stored.UpdatedAt}, + } { + text, ok := body[member.name].(string) + if !ok { + t.Errorf("%s = %v, want an RFC3339 string", member.name, body[member.name]) + continue + } + got, err := time.Parse(time.RFC3339Nano, text) + if err != nil { + t.Errorf("%s = %q, which does not parse as RFC3339Nano: %v", member.name, text, err) + continue + } + if !got.Equal(member.want) { + t.Errorf("%s = %q, want %v exactly — the fraction the role stored must survive the wire", + member.name, text, member.want) + } + } +} + // TestCreateRefusesAnOccupiedExplicitID pins the 409 and its `param`. It is a // conflict rather than a 400 because the body is well-formed and stays // well-formed: the identical request succeeded before the id was taken. diff --git a/internal/httpapi/delete_test.go b/internal/httpapi/delete_test.go index e2048a30e..5f22606c8 100644 --- a/internal/httpapi/delete_test.go +++ b/internal/httpapi/delete_test.go @@ -314,13 +314,13 @@ func TestDeleteForwardsTheVersionGuard(t *testing.T) { body string want *int64 }{ - {"a guard is forwarded", `{"ids":["bd-1"],"expected_version":9007199254740993}`, guard(guardToken)}, - {"the never-written version is a real guard", `{"ids":["bd-1"],"expected_version":0}`, guard(0)}, + {"a guard is forwarded", `{"ids":["bd-1"],"expected_version":"9007199254740993"}`, guard(guardToken)}, + {"the never-written version is a real guard", `{"ids":["bd-1"],"expected_version":"0"}`, guard(0)}, {"an absent guard stays nil", `{"ids":["bd-1"]}`, nil}, // Cascade and force bypass POLICY, never a precondition. Both travel // beside the guard rather than instead of it. - {"cascade does not displace it", `{"ids":["bd-1"],"cascade":true,"expected_version":41}`, guard(41)}, - {"force does not displace it", `{"ids":["bd-1"],"force":true,"expected_version":41}`, guard(41)}, + {"cascade does not displace it", `{"ids":["bd-1"],"cascade":true,"expected_version":"41"}`, guard(41)}, + {"force does not displace it", `{"ids":["bd-1"],"force":true,"expected_version":"41"}`, guard(41)}, } { t.Run(tc.name, func(t *testing.T) { deleter := &roleDeleter{} @@ -358,7 +358,7 @@ func TestDeleteRefusesAGuardBesideSeveralIDs(t *testing.T) { deleter := &roleDeleter{} ts := newTestServer(t, rolesConfig(Config{Deleter: deleter})) - resp := ts.delete(t, `{"ids":["bd-1","bd-2"],"expected_version":41}`) + resp := ts.delete(t, `{"ids":["bd-1","bd-2"],"expected_version":"41"}`) if resp.StatusCode != http.StatusBadRequest { t.Fatalf("status = %d, want 400: %s", resp.StatusCode, readAll(t, resp)) } @@ -401,7 +401,7 @@ func TestDeleteCountsDistinctIDsForTheGuard(t *testing.T) { deleter := &roleDeleter{} ts := newTestServer(t, rolesConfig(Config{Deleter: deleter})) - resp := ts.delete(t, `{"ids":`+tc.ids+`,"expected_version":41}`) + resp := ts.delete(t, `{"ids":`+tc.ids+`,"expected_version":"41"}`) if resp.StatusCode != http.StatusOK { t.Fatalf("status = %d, want 200: %s", resp.StatusCode, readAll(t, resp)) } @@ -432,7 +432,7 @@ func TestDeleteCountsDistinctIDsForTheGuard(t *testing.T) { // list came out broken. func TestDeleteRefusesABlankID(t *testing.T) { for _, body := range []string{ - `{"ids":[" ","bd-1"],"expected_version":41}`, + `{"ids":[" ","bd-1"],"expected_version":"41"}`, `{"ids":["bd-1",""]}`, } { deleter := &roleDeleter{} @@ -464,7 +464,7 @@ func TestDeleteRefusesAStaleGuard(t *testing.T) { deleter := &roleDeleter{err: fmt.Errorf("delete bd-1: %w", issueops.ErrVersionMismatch)} ts := newTestServer(t, rolesConfig(Config{Deleter: deleter})) - resp := ts.delete(t, `{"ids":["bd-1"],"expected_version":9007199254740993}`) + resp := ts.delete(t, `{"ids":["bd-1"],"expected_version":"9007199254740993"}`) if resp.StatusCode != http.StatusConflict { t.Fatalf("status = %d, want 409: %s", resp.StatusCode, readAll(t, resp)) } @@ -483,10 +483,15 @@ func TestDeleteRefusesAStaleGuard(t *testing.T) { } } -// TestDeleteRefusesAMalformedGuard: the token is an integer and nothing else. +// TestDeleteRefusesAMalformedGuard: the token is a decimal STRING and nothing +// else — including not the bare number the member used to be, which is the +// spelling a double-based client would have already rounded. func TestDeleteRefusesAMalformedGuard(t *testing.T) { for _, body := range []string{ - `{"ids":["bd-1"],"expected_version":"41"}`, + `{"ids":["bd-1"],"expected_version":41}`, + `{"ids":["bd-1"],"expected_version":9007199254740993}`, + `{"ids":["bd-1"],"expected_version":"41.5"}`, + `{"ids":["bd-1"],"expected_version":"not-a-token"}`, `{"ids":["bd-1"],"expected_version":null}`, `{"ids":["bd-1"],"expected_version":{}}`, } { diff --git a/internal/httpapi/get_issue_test.go b/internal/httpapi/get_issue_test.go index 21308b435..702c709e6 100644 --- a/internal/httpapi/get_issue_test.go +++ b/internal/httpapi/get_issue_test.go @@ -457,8 +457,13 @@ func TestGetIssuePublishesTheRevisionToken(t *testing.T) { if err != nil { t.Fatalf("read body: %v", err) } + // Decoded as the STRING the document declares. The first case is + // the point of the shape: 2^53+1 is the smallest token a + // double-based parser cannot hold, so a number-typed member would + // hand a browser client a value one off the row's and its next + // guard would 409 against a row nobody touched. var body struct { - Revision *int64 `json:"revision"` + Revision *string `json:"revision"` } if err := json.Unmarshal(raw, &body); err != nil { t.Fatalf("decode %q: %v", raw, err) @@ -466,8 +471,8 @@ func TestGetIssuePublishesTheRevisionToken(t *testing.T) { if body.Revision == nil { t.Fatalf("the detail response carries no `revision`: %s", raw) } - if *body.Revision != tc.token { - t.Errorf("revision = %d, want the row's token %d", *body.Revision, tc.token) + if *body.Revision != types.RevisionToken(tc.token) { + t.Errorf("revision = %q, want the row's token %q", *body.Revision, types.RevisionToken(tc.token)) } // The storage spelling never rides along: row_lock is json:"-" on // the issue for a reason that still holds, and `revision` is the diff --git a/internal/httpapi/problem.go b/internal/httpapi/problem.go index 681eb5934..187b412d5 100644 --- a/internal/httpapi/problem.go +++ b/internal/httpapi/problem.go @@ -16,6 +16,7 @@ import ( "github.com/steveyegge/beads/internal/httpapi/apigen" "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/storage/uow" + "github.com/steveyegge/beads/internal/types" "github.com/steveyegge/beads/issueops" ) @@ -1132,8 +1133,14 @@ func (r Result) WithDeclaredLater(declaredLater bool) Result { // // It is the REQUEST's value rather than a read, which is why there is no // `actual_version` beside it here — see PreconditionFailed. +// +// The parameter stays int64 because every caller holds the PARSED guard by the +// time it refuses; the member is a decimal string on the wire, so the echo goes +// back out through types.RevisionToken and a client comparing it to what it sent +// gets its own spelling back. func (r Result) WithExpectedVersion(expected int64) Result { - r.Problem.ExpectedVersion = &expected + token := types.RevisionToken(expected) + r.Problem.ExpectedVersion = &token return r } diff --git a/internal/httpapi/release.go b/internal/httpapi/release.go index 7ef81f33b..40cbffd14 100644 --- a/internal/httpapi/release.go +++ b/internal/httpapi/release.go @@ -8,6 +8,7 @@ import ( "github.com/steveyegge/beads/internal/httpapi/apigen" "github.com/steveyegge/beads/internal/storage" + "github.com/steveyegge/beads/internal/types" "github.com/steveyegge/beads/issueops" ) @@ -84,7 +85,7 @@ func (s *Server) handleRelease(w http.ResponseWriter, r *http.Request) { writeJSON(w, apigen.ReleaseIssueResponse{ Issue: *result.Issue, Changed: result.Changed, - Revision: result.Issue.RowVersion, + Revision: types.RevisionToken(result.Issue.RowVersion), }) } diff --git a/internal/httpapi/release_test.go b/internal/httpapi/release_test.go index d9eb30250..376d136f7 100644 --- a/internal/httpapi/release_test.go +++ b/internal/httpapi/release_test.go @@ -74,8 +74,8 @@ func TestReleaseWritesOnceAndAnswersWithTheRowItWrote(t *testing.T) { if body["changed"] != true { t.Errorf("changed = %v, want true — the role reports it true on every answer it returns without an error", body["changed"]) } - if body["revision"] != float64(77) { - t.Errorf("revision = %v, want the post-release token off the row the role answered with", body["revision"]) + if body["revision"] != "77" { + t.Errorf("revision = %v, want the post-release token off the row the role answered with, as a decimal string", body["revision"]) } issue, ok := body["issue"].(map[string]any) if !ok { @@ -345,7 +345,7 @@ func TestReleaseRefusesUnknownAndMalformedBodies(t *testing.T) { body string param string }{ - {name: "an unknown member", body: `{"actor":"alice","expected_version":3}`, param: "expected_version"}, + {name: "an unknown member", body: `{"actor":"alice","expected_version":"3"}`, param: "expected_version"}, {name: "a missing actor", body: `{"force":true}`, param: claimActorMember}, {name: "an actor that is blank after trimming", body: `{"actor":" "}`, param: claimActorMember}, {name: "an actor carrying a newline", body: `{"actor":"alice\nbd: released by mallory"}`, param: claimActorMember}, diff --git a/internal/httpapi/reopen.go b/internal/httpapi/reopen.go index d5850f285..30f45c375 100644 --- a/internal/httpapi/reopen.go +++ b/internal/httpapi/reopen.go @@ -5,6 +5,7 @@ import ( "net/http" "github.com/steveyegge/beads/internal/httpapi/apigen" + "github.com/steveyegge/beads/internal/types" "github.com/steveyegge/beads/issueops" ) @@ -78,7 +79,7 @@ func (s *Server) handleReopen(w http.ResponseWriter, r *http.Request) { writeJSON(w, apigen.ReopenIssueResponse{ Issue: *result.Issue, AlreadyOpen: !result.Changed, - Revision: result.Issue.RowVersion, + Revision: types.RevisionToken(result.Issue.RowVersion), }) } diff --git a/internal/httpapi/reopen_test.go b/internal/httpapi/reopen_test.go index 643458de2..65394dd6c 100644 --- a/internal/httpapi/reopen_test.go +++ b/internal/httpapi/reopen_test.go @@ -347,8 +347,8 @@ func TestReopenForwardsTheVersionGuard(t *testing.T) { body string want *int64 }{ - {"a guard is forwarded", `{"actor":"alice","expected_version":9007199254740993}`, guard(guardToken)}, - {"the never-written version is a real guard", `{"actor":"alice","expected_version":0}`, guard(0)}, + {"a guard is forwarded", `{"actor":"alice","expected_version":"9007199254740993"}`, guard(guardToken)}, + {"the never-written version is a real guard", `{"actor":"alice","expected_version":"0"}`, guard(0)}, {"an absent guard stays nil", `{"actor":"alice"}`, nil}, } { t.Run(tc.name, func(t *testing.T) { @@ -423,7 +423,7 @@ func TestReopenRefusesAStaleGuard(t *testing.T) { lifecycle := &roleLifecycle{reopenErr: fmt.Errorf("reopen bd-1: %w", issueops.ErrVersionMismatch)} ts := newReopenServer(t, lifecycle) - resp := ts.reopenIssue(t, reopenPath, `{"actor":"alice","expected_version":9007199254740993}`) + resp := ts.reopenIssue(t, reopenPath, `{"actor":"alice","expected_version":"9007199254740993"}`) if resp.StatusCode != http.StatusConflict { t.Fatalf("status = %d, want 409: %s", resp.StatusCode, readAll(t, resp)) } @@ -442,11 +442,15 @@ func TestReopenRefusesAStaleGuard(t *testing.T) { } } -// TestReopenRefusesAMalformedGuard: the token is an integer and nothing else, -// refused at the edge before any database work. +// TestReopenRefusesAMalformedGuard: the token is a decimal STRING and nothing +// else — including not the bare number the member used to be — refused at the +// edge before any database work. func TestReopenRefusesAMalformedGuard(t *testing.T) { for _, body := range []string{ - `{"actor":"alice","expected_version":"41"}`, + `{"actor":"alice","expected_version":41}`, + `{"actor":"alice","expected_version":9007199254740993}`, + `{"actor":"alice","expected_version":"41.5"}`, + `{"actor":"alice","expected_version":"not-a-token"}`, `{"actor":"alice","expected_version":null}`, `{"actor":"alice","expected_version":[]}`, } { diff --git a/internal/httpapi/spec/openapi.v0.yaml b/internal/httpapi/spec/openapi.v0.yaml index a8ac80f43..953206fec 100644 --- a/internal/httpapi/spec/openapi.v0.yaml +++ b/internal/httpapi/spec/openapi.v0.yaml @@ -1456,6 +1456,13 @@ paths: `await_id`. + The per-type `storage-class.` keys in `config.yaml` are CLI-door + policy that `bd create` resolves before it calls the role, so they do not + reach any create on this surface — this operation, `issues:batchCreate` + and `issues:batchApply` all mint the unset (versioned) class no matter + what those keys say on the server's machine. + + `comments` and an inline `dependencies` list on the issue itself — the role refuses both, because edges belong to the request's own `dependencies` member where their direction can be stated. @@ -6613,8 +6620,7 @@ components: epic_closeable: type: boolean revision: - type: integer - format: int64 + type: string description: >- The row's optimistic-concurrency token, and THE READ THAT SOURCES A GUARD. Every `expected_version` on this surface is composed from a @@ -6640,18 +6646,12 @@ components: `updated_at`, `status` and the label set. - It is ALWAYS PRESENT, including as 0 — a legacy row backfilled and + It is ALWAYS PRESENT, including as `"0"` — a legacy row backfilled and not mutated since — because an absent member would be ambiguous between a legacy-zero row and a server that does not publish the token. - DECODE IT AS A 64-BIT INTEGER, for the reason - `UpdateIssueRequest.expected_version` spells out: an IEEE-754-double - parser corrupts it silently, and the corruption only shows up as a - `precondition_failed` on the NEXT request. - - IT IS THE ANCHOR ROW'S ALONE. The issues nested under `dependencies` and `dependents` are `IssueWithDependencyMetadata` and carry no token: a caller that means to guard a NEIGHBOUR reads @@ -6663,6 +6663,15 @@ components: IT IS NOT ON THE LIST ROWS, and that is a decision rather than an oversight — see `GET /v0/beads/issues`. + + IT IS A STRING, the token's decimal spelling — `"-3819021935081927"`, or + `"0"` for a legacy migration-0054 row. Send it back verbatim as an + `expected_version`; do not parse it into a number. A JSON number would not + survive the trip: the token spans the FULL 64-bit range, and an + IEEE-754-double parser — JavaScript's `JSON.parse`, Go's `any`, Python's + `float` — rounds anything past 2^53 to a value NEAR the token that is not + it, so a guard composed from it is refused against a row nothing else + touched. A string round-trips exactly in every consumer. IssueWithDependencyMetadata: type: object description: >- @@ -7456,8 +7465,7 @@ components: computed against the same snapshot, and nothing is recorded in history either. expected_version: - type: integer - format: int64 + type: string description: >- Requires the named bead's revision to equal this value before anything is erased. A miss refuses the whole request with @@ -7503,10 +7511,14 @@ components: The token is the `revision` a lifecycle write answers with, and the one `GET /v0/beads/issues/{id}` publishes — which is where a delete guard should seed itself, since reading the bead before erasing it - is the only way to be sure it is the bead you meant. DECODE IT AS A - 64-BIT INTEGER, for the reason - `UpdateIssueRequest.expected_version` spells out. + is the only way to be sure it is the bead you meant. + + IT IS A STRING, and it must be the `revision` string a response carried, + verbatim. A JSON number — or any other type — is a `400` naming this + member. The token spans the FULL 64-bit range, so a number would be + rounded past 2^53 by an IEEE-754-double parser and the guard would miss a + row nothing else touched; a string round-trips exactly in every consumer. DeleteIssuesResult: type: object required: [dry_run, deleted, dependencies, labels, events, references_updated] @@ -8942,8 +8954,7 @@ components: patch: $ref: '#/components/schemas/ApplyPatchBody' expected_version: - type: integer - format: int64 + type: string description: >- Requires the row's `revision` to equal this value before the patch. A miss refuses the WHOLE request with `409 precondition_failed`. @@ -8962,11 +8973,11 @@ components: because a caller CAN know what its own earlier item set them to. - DECODE IT AS A 64-BIT INTEGER, for the reason - `UpdateIssueRequest.expected_version` spells out. It bites harder - here than anywhere else on the surface: a corrupted token refuses - the WHOLE plan rather than one write, so a client with a lossy - parser loses every item of every batch it guards. + IT IS A STRING, and it must be the `revision` string a response carried, + verbatim. A JSON number — or any other type — is a `400` naming this + member. The token spans the FULL 64-bit range, so a number would be + rounded past 2^53 by an IEEE-754-double parser and the guard would miss a + row nothing else touched; a string round-trips exactly in every consumer. expected_status: type: string maxLength: 255 @@ -9230,8 +9241,7 @@ components: open child is NOT refused: the policy is a gate on the closing act, not an invariant the store maintains. expected_version: - type: integer - format: int64 + type: string description: >- Requires the row's `revision` to equal this value, evaluated as-modified and checked before the idempotent close. A miss refuses @@ -9247,10 +9257,11 @@ components: `update` item whose `patch.status` crosses into the done category. - DECODE IT AS A 64-BIT INTEGER, on - `ApplyUpdateItem.expected_version`'s terms, including its note that - a corrupted token here costs the whole plan. - + IT IS A STRING, and it must be the `revision` string a response carried, + verbatim. A JSON number — or any other type — is a `400` naming this + member. The token spans the FULL 64-bit range, so a number would be + rounded past 2^53 by an IEEE-754-double parser and the guard would miss a + row nothing else touched; a string round-trips exactly in every consumer. ApplyDepAddItem: type: object additionalProperties: false @@ -9376,8 +9387,7 @@ components: idempotent re-add of an edge that already existed with the same type. revision: - type: integer - format: int64 + type: string description: >- The row's optimistic-concurrency token AFTER the item, and the value an `expected_version` guard is composed from. The same member the @@ -9402,14 +9412,14 @@ components: member would be ambiguous between the two. - DECODE IT AS A 64-BIT INTEGER, for the reason - `UpdateIssueRequest.expected_version` spells out: an IEEE-754-double - parser corrupts it silently, and the corruption only shows up as a - `precondition_failed` on the NEXT request. This member is the one - every other `revision` on the surface is spelled against, so the - warning belongs here most of all — a client that reads it through a - lossy parser here carries the damage into every guard it composes. - + IT IS A STRING, the token's decimal spelling — `"-3819021935081927"`, or + `"0"` for a legacy migration-0054 row. Send it back verbatim as an + `expected_version`; do not parse it into a number. A JSON number would not + survive the trip: the token spans the FULL 64-bit range, and an + IEEE-754-double parser — JavaScript's `JSON.parse`, Go's `any`, Python's + `float` — rounds anything past 2^53 to a value NEAR the token that is not + it, so a guard composed from it is refused against a row nothing else + touched. A string round-trips exactly in every consumer. AddDependenciesRequest: type: object additionalProperties: false @@ -9693,14 +9703,13 @@ components: space that answers "where is the `already_released` member" — there is none, and the operation description says why. revision: - type: integer - format: int64 + type: string description: >- The row's optimistic-concurrency token AFTER the release, spelled the way `UpdateIssueResponse.revision` spells it and carrying the same promise: a read-modify-write loop composes its next - `expected_version` from THIS value, never from a number it - incremented itself. + `expected_version` from THIS value, never from one it composed + itself. A release REMINTS the token by design, so a caller that guarded a @@ -9710,11 +9719,14 @@ components: step. - DECODE IT AS A 64-BIT INTEGER, for the reason - `UpdateIssueRequest.expected_version` spells out: an IEEE-754-double - parser corrupts it silently, and the corruption only shows up as a - `precondition_failed` on the NEXT request. - + IT IS A STRING, the token's decimal spelling — `"-3819021935081927"`, or + `"0"` for a legacy migration-0054 row. Send it back verbatim as an + `expected_version`; do not parse it into a number. A JSON number would not + survive the trip: the token spans the FULL 64-bit range, and an + IEEE-754-double parser — JavaScript's `JSON.parse`, Go's `any`, Python's + `float` — rounds anything past 2^53 to a value NEAR the token that is not + it, so a guard composed from it is refused against a row nothing else + touched. A string round-trips exactly in every consumer. ClaimNextRequest: type: object additionalProperties: false @@ -9968,8 +9980,7 @@ components: anyway" has said nothing about whether the row is still the one it read. expected_version: - type: integer - format: int64 + type: string description: >- Requires the row's revision to equal this value BEFORE the close. A miss refuses the whole request with `409 precondition_failed` and @@ -9988,7 +9999,7 @@ components: The token is the `revision` this operation's own response carries. Compose the next expectation from the value a write ANSWERED with, - never from a number the client incremented itself: the token is + never from one the client composed itself: the token is OPAQUE and compared for equality alone, so it has no predecessor a client can compute. A first guarded close seeds itself from `GET /v0/beads/issues/{id}`'s `revision` — the read that sources a @@ -9997,11 +10008,11 @@ components: `ApplyItemResult.revision`. - DECODE IT AS A 64-BIT INTEGER, for the reason - `UpdateIssueRequest.expected_version` spells out: an IEEE-754-double - parser corrupts it silently, and the corruption only surfaces as a - `precondition_failed` on the NEXT request. - + IT IS A STRING, and it must be the `revision` string a response carried, + verbatim. A JSON number — or any other type — is a `400` naming this + member. The token spans the FULL 64-bit range, so a number would be + rounded past 2^53 by an IEEE-754-double parser and the guard would miss a + row nothing else touched; a string round-trips exactly in every consumer. CloseIssueResponse: type: object required: [issue, already_closed, open_children, revision] @@ -10023,8 +10034,7 @@ components: bypassed the guard is exactly the caller that wants the number. An unforced close that got this far had none, so it reports 0. revision: - type: integer - format: int64 + type: string description: >- The row's optimistic-concurrency token AFTER this close, spelled the way `UpdateIssueResponse.revision` spells it. @@ -10039,9 +10049,14 @@ components: wrote. - DECODE IT AS A 64-BIT INTEGER, for the reason - `UpdateIssueResponse.revision` spells out. - + IT IS A STRING, the token's decimal spelling — `"-3819021935081927"`, or + `"0"` for a legacy migration-0054 row. Send it back verbatim as an + `expected_version`; do not parse it into a number. A JSON number would not + survive the trip: the token spans the FULL 64-bit range, and an + IEEE-754-double parser — JavaScript's `JSON.parse`, Go's `any`, Python's + `float` — rounds anything past 2^53 to a value NEAR the token that is not + it, so a guard composed from it is refused against a row nothing else + touched. A string round-trips exactly in every consumer. ReopenIssueRequest: type: object additionalProperties: false @@ -10070,8 +10085,7 @@ components: events. Refused for control characters, and bounded by what the column holds rather than by the number above. expected_version: - type: integer - format: int64 + type: string description: >- Requires the row's revision to equal this value BEFORE the reopen. A miss refuses the whole request with `409 precondition_failed` and @@ -10088,9 +10102,14 @@ components: The token is the `revision` this operation's own response carries; compose the next expectation from a value a write ANSWERED with and - never from one the client computed. DECODE IT AS A 64-BIT INTEGER, - for the reason `UpdateIssueRequest.expected_version` spells out. + never from one the client computed. + + IT IS A STRING, and it must be the `revision` string a response carried, + verbatim. A JSON number — or any other type — is a `400` naming this + member. The token spans the FULL 64-bit range, so a number would be + rounded past 2^53 by an IEEE-754-double parser and the guard would miss a + row nothing else touched; a string round-trips exactly in every consumer. ReopenIssueResponse: type: object required: [issue, already_open, revision] @@ -10105,8 +10124,7 @@ components: and `ClaimResponse.already_claimed`. The response still carries the row. revision: - type: integer - format: int64 + type: string description: >- The row's optimistic-concurrency token AFTER this reopen, spelled the way `CloseIssueResponse.revision` spells it and here for the same @@ -10114,6 +10132,15 @@ components: next `expected_version` from this value. DECODE IT AS A 64-BIT INTEGER. + + IT IS A STRING, the token's decimal spelling — `"-3819021935081927"`, or + `"0"` for a legacy migration-0054 row. Send it back verbatim as an + `expected_version`; do not parse it into a number. A JSON number would not + survive the trip: the token spans the FULL 64-bit range, and an + IEEE-754-double parser — JavaScript's `JSON.parse`, Go's `any`, Python's + `float` — rounds anything past 2^53 to a value NEAR the token that is not + it, so a guard composed from it is refused against a row nothing else + touched. A string round-trips exactly in every consumer. MetadataValue: # No x-go-type-import: the generator already imports encoding/json # unconditionally, and naming it here emits the import a second time. @@ -10222,8 +10249,7 @@ components: patch: $ref: '#/components/schemas/IssuePatchBody' expected_version: - type: integer - format: int64 + type: string description: >- Requires the row's revision to equal this value before the patch. A miss refuses the WHOLE request with `409 precondition_failed` and @@ -10237,16 +10263,16 @@ components: unguarded one or from `POST /v0/beads/issues:batchApply`'s `ApplyItemResult.revision`. Compose the next expectation from the value the write ANSWERED with, - never from a number the client incremented itself: the token is + never from one the client composed itself: the token is OPAQUE and compared for equality alone, so it has no predecessor a client can compute. - DECODE IT AS A 64-BIT INTEGER. Live tokens run past 5e17, where an - IEEE-754 double's ulp is already 64, so a parser that decodes JSON - numbers as doubles — JavaScript's `JSON.parse`, Go's `any`, Python's - `float` — hands back a value NEAR the token that is not it, and the - guard is refused against a row nothing else touched. + IT IS A STRING, and it must be the `revision` string a response carried, + verbatim. A JSON number — or any other type — is a `400` naming this + member. The token spans the FULL 64-bit range, so a number would be + rounded past 2^53 by an IEEE-754-double parser and the guard would miss a + row nothing else touched; a string round-trips exactly in every consumer. expected_status: type: string maxLength: 255 @@ -10509,8 +10535,7 @@ components: patch is a 200 with `changed: false` rather than an error — idempotent, like every replay answer on this surface. revision: - type: integer - format: int64 + type: string description: >- The row's optimistic-concurrency token AFTER this write, spelled the way `ApplyItemResult.revision` spells it. @@ -10525,11 +10550,14 @@ components: the same token, and this member agrees with it. - DECODE IT AS A 64-BIT INTEGER, for the reason - `UpdateIssueRequest.expected_version` spells out: an IEEE-754-double - parser corrupts it silently, and the corruption only shows up as a - `precondition_failed` on the NEXT request. - + IT IS A STRING, the token's decimal spelling — `"-3819021935081927"`, or + `"0"` for a legacy migration-0054 row. Send it back verbatim as an + `expected_version`; do not parse it into a number. A JSON number would not + survive the trip: the token spans the FULL 64-bit range, and an + IEEE-754-double parser — JavaScript's `JSON.parse`, Go's `any`, Python's + `float` — rounds anything past 2^53 to a value NEAR the token that is not + it, so a guard composed from it is refused against a row nothing else + touched. A string round-trips exactly in every consumer. CreateIssueRequest: type: object additionalProperties: false @@ -10954,8 +10982,7 @@ components: block and never close). Both polarities are reported; this member is never omitted to mean false. See `issue_id`. expected_version: - type: integer - format: int64 + type: string description: >- With `precondition_failed`: the row `revision` the request guarded on, echoed from the request itself. @@ -10967,9 +10994,15 @@ components: is a schema alternation, and no composition keyword is available to spell one here (see `ApplyItem`). Three typed pairs cost three member names and are readable by a generated client without a cast. + + + IT IS A STRING, and it must be the `revision` string a response carried, + verbatim. A JSON number — or any other type — is a `400` naming this + member. The token spans the FULL 64-bit range, so a number would be + rounded past 2^53 by an IEEE-754-double parser and the guard would miss a + row nothing else touched; a string round-trips exactly in every consumer. actual_version: - type: integer - format: int64 + type: string description: >- With `precondition_failed`: the `revision` the row was found holding, read inside the transaction that refused the guard. @@ -10992,6 +11025,13 @@ components: what it found is an addition rather than a wire change — a client must not wait for them, and must never read their absence as a value. + + + IT IS A STRING, and it must be the `revision` string a response carried, + verbatim. A JSON number — or any other type — is a `400` naming this + member. The token spans the FULL 64-bit range, so a number would be + rounded past 2^53 by an IEEE-754-double parser and the guard would miss a + row nothing else touched; a string round-trips exactly in every consumer. expected_status: type: string description: >- diff --git a/internal/httpapi/update.go b/internal/httpapi/update.go index 7bc766d83..12757e940 100644 --- a/internal/httpapi/update.go +++ b/internal/httpapi/update.go @@ -104,7 +104,7 @@ func (s *Server) handleUpdate(w http.ResponseWriter, r *http.Request) { writeJSON(w, apigen.UpdateIssueResponse{ Issue: *result.Issue, Changed: result.Changed, - Revision: result.Issue.RowVersion, + Revision: types.RevisionToken(result.Issue.RowVersion), }) } diff --git a/internal/httpapi/update_test.go b/internal/httpapi/update_test.go index e85dcbc5f..fcca7d714 100644 --- a/internal/httpapi/update_test.go +++ b/internal/httpapi/update_test.go @@ -320,7 +320,12 @@ func TestUpdateRejectsTheShapesTheDocumentRefuses(t *testing.T) { {"unknown metadata member", `{"actor":"alice","patch":{"metadata":{"clear":true}}}`, "patch.metadata.clear"}, {"force_assignee_transfer without an assignee edit", `{"actor":"alice","patch":{"title":"t"},"force_assignee_transfer":true}`, "force_assignee_transfer"}, {"force_assignee_transfer beside expected_assignee", `{"actor":"alice","patch":{"assignee":"bob"},"force_assignee_transfer":true,"expected_assignee":"carol"}`, "force_assignee_transfer"}, - {"expected_version is not a number", `{"actor":"alice","patch":{"title":"t"},"expected_version":"3"}`, "expected_version"}, + // The guard is a decimal STRING; a bare number is the spelling this + // contract deliberately does not also accept, since a double-based + // client would have rounded it before it ever arrived. + {"expected_version is a number", `{"actor":"alice","patch":{"title":"t"},"expected_version":3}`, "expected_version"}, + {"expected_version is a number past 2^53", `{"actor":"alice","patch":{"title":"t"},"expected_version":9007199254740993}`, "expected_version"}, + {"expected_version is not a decimal token", `{"actor":"alice","patch":{"title":"t"},"expected_version":"three"}`, "expected_version"}, {"null expected_status", `{"actor":"alice","patch":{"title":"t"},"expected_status":null}`, "expected_status"}, {"null force_close_policy", `{"actor":"alice","patch":{"title":"t"},"force_close_policy":null}`, "force_close_policy"}, {"blank title", `{"actor":"alice","patch":{"title":" "}}`, "patch.title"}, @@ -609,7 +614,7 @@ func TestUpdateForwardsTheGuardedMembers(t *testing.T) { resp := ts.updateIssue(t, updatePath, `{ "actor":"alice", - "expected_version": 41, + "expected_version": "41", "expected_status": "open", "force_close_policy": true, "patch": { @@ -757,20 +762,23 @@ func TestUpdateGuardsComposeFromTheRevisionTheWriteAnswered(t *testing.T) { if first.StatusCode != http.StatusOK { t.Fatalf("status = %d, want 200: %s", first.StatusCode, readAll(t, first)) } - revision, ok := decodeBody(t, first)["revision"].(float64) + revision, ok := decodeBody(t, first)["revision"].(string) if !ok { - t.Fatalf("the response carries no `revision`; a guard whose token no response carries cannot be filled") + t.Fatalf("the response carries no string `revision`; a guard whose token no response carries cannot be filled") } // The token must be the ROW's, read off the snapshot the role answered // with. Without this the loop below round-trips whatever the handler put // there — including a constant zero — and could not fail against a // `revision` that describes no row. - if int64(revision) != stored { - t.Fatalf("revision = %d, want the %d the role's row carries", int64(revision), stored) + if revision != types.RevisionToken(stored) { + t.Fatalf("revision = %q, want the %q the role's row carries", revision, types.RevisionToken(stored)) } + // The guard is the response's token spliced back in VERBATIM, which is the + // whole discipline the string spelling exists to make possible: nothing + // here parses, re-renders or arithmetics the value. second := ts.updateIssue(t, updatePath, - fmt.Sprintf(`{"actor":"alice","expected_version":%d,"patch":{"title":"second"}}`, int64(revision))) + fmt.Sprintf(`{"actor":"alice","expected_version":%q,"patch":{"title":"second"}}`, revision)) if second.StatusCode != http.StatusOK { t.Fatalf("guarded status = %d, want 200: %s", second.StatusCode, readAll(t, second)) } @@ -778,8 +786,8 @@ func TestUpdateGuardsComposeFromTheRevisionTheWriteAnswered(t *testing.T) { if len(got) != 2 { t.Fatalf("the role was called %d times, want 2", len(got)) } - if got[1].ExpectedVersion == nil || *got[1].ExpectedVersion != int64(revision) { - t.Errorf("expected_version = %v, want the %d the write answered with", got[1].ExpectedVersion, int64(revision)) + if got[1].ExpectedVersion == nil || *got[1].ExpectedVersion != stored { + t.Errorf("expected_version = %v, want the %d the write answered with", got[1].ExpectedVersion, stored) } } @@ -798,11 +806,11 @@ func TestUpdateRefusesAStaleGuard(t *testing.T) { }{ { name: "version", - body: `{"actor":"alice","expected_version":7,"patch":{"title":"t"}}`, + body: `{"actor":"alice","expected_version":"7","patch":{"title":"t"}}`, err: fmt.Errorf("update bd-1: %w", issueops.ErrVersionMismatch), wantParam: "expected_version", wantEcho: "expected_version", - wantValue: float64(7), + wantValue: "7", }, { name: "status", diff --git a/internal/jira/tracker.go b/internal/jira/tracker.go index 8636f36b8..94a2149d6 100644 --- a/internal/jira/tracker.go +++ b/internal/jira/tracker.go @@ -10,7 +10,6 @@ import ( "github.com/steveyegge/beads/internal/config" "github.com/steveyegge/beads/internal/debug" - "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/tracker" "github.com/steveyegge/beads/internal/types" ) @@ -24,7 +23,7 @@ func init() { // Tracker implements tracker.IssueTracker for Jira. type Tracker struct { client *Client - store storage.Storage + store tracker.Store jiraURL string projectKeys []string // one or more project keys (first is primary) apiVersion string // "2" or "3" (default: "3") @@ -58,7 +57,7 @@ func (t *Tracker) Name() string { return "jira" } func (t *Tracker) DisplayName() string { return "Jira" } func (t *Tracker) ConfigPrefix() string { return "jira" } -func (t *Tracker) Init(ctx context.Context, store storage.Storage) error { +func (t *Tracker) Init(ctx context.Context, store tracker.Store) error { t.store = store jiraURL, err := t.getConfig(ctx, "jira.url", "JIRA_URL") diff --git a/internal/linear/tracker.go b/internal/linear/tracker.go index 4e9218078..367af2f09 100644 --- a/internal/linear/tracker.go +++ b/internal/linear/tracker.go @@ -9,7 +9,6 @@ import ( "time" "github.com/steveyegge/beads/internal/config" - "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/tracker" "github.com/steveyegge/beads/internal/types" ) @@ -26,7 +25,7 @@ func init() { type Tracker struct { clients map[string]*Client // keyed by team ID config *MappingConfig - store storage.Storage + store tracker.Store teamIDs []string // ordered list of configured team IDs projectID string } @@ -41,7 +40,7 @@ func (t *Tracker) Name() string { return "linear" } func (t *Tracker) DisplayName() string { return "Linear" } func (t *Tracker) ConfigPrefix() string { return "linear" } -func (t *Tracker) Init(ctx context.Context, store storage.Storage) error { +func (t *Tracker) Init(ctx context.Context, store tracker.Store) error { t.store = store // Resolve authentication: OAuth client-credentials takes precedence over API key. @@ -808,7 +807,7 @@ func BuildLabelCacheFromTracker(ctx context.Context, t *Tracker) (*LabelCache, e // configLoaderAdapter wraps storage.Storage to implement linear.ConfigLoader. type configLoaderAdapter struct { ctx context.Context - store storage.Storage + store tracker.Store } func (c *configLoaderAdapter) GetAllConfig() (map[string]string, error) { diff --git a/internal/migration/freeze.go b/internal/migration/freeze.go index 58dbe34b9..dbafddff3 100644 --- a/internal/migration/freeze.go +++ b/internal/migration/freeze.go @@ -1,77 +1,289 @@ -// Package migration provides read-side access to the town-wide -// MIGRATION-FREEZE write-freeze sentinel used during Gas Town dolt -// migrations. The sentinel file itself is created and removed by the gt CLI -// (see gt migrate freeze/thaw, gastownhall/gastown's internal/migration -// package) — bd only reads it, before a write command runs, to refuse -// human-typed writes that would bypass the gt-layer gate (dc-6jaq). +// Package migration provides read-side access to the MIGRATION-FREEZE +// write-freeze marker. The marker is a plain file that an operator — or an +// external orchestration tool driving a migration — creates to stop writes +// against a workspace, and removes to resume them. bd only ever reads it, +// before a write command runs, so a human typing 'bd create'/'bd update' +// mid-migration cannot slip a write past whatever quiesced the workspace +// (dc-6jaq). package migration import ( + "errors" + "fmt" + "io" + "io/fs" "os" "path/filepath" "strings" + "syscall" "time" ) -// FileName is the freeze sentinel placed at the town root. +// FileName is the name of the freeze marker file. bd looks for it in a start +// directory and every ancestor up to the filesystem root, so a marker placed +// at the top of a multi-repo tree freezes every workspace beneath it. const FileName = "MIGRATION-FREEZE" -// Info is the parsed contents of a MIGRATION-FREEZE file. +// EnvFreezeFile names an explicit freeze-marker path. When set and non-empty +// it is authoritative: bd checks that path only and skips the ancestor walk, +// so it doubles as the hook for markers that live outside any workspace tree +// and as an opt-out (point it at a path that does not exist). +const EnvFreezeFile = "BD_MIGRATION_FREEZE_FILE" + +// maxMarkerSize caps how much of a marker bd will read. The payload is one +// short line; anything larger is a mistake or a hostile file (the ancestor +// walk can reach directories bd does not control), and a freeze must not turn +// into a multi-gigabyte allocation. +const maxMarkerSize = 64 << 10 + +// Info is the parsed contents of a freeze marker. type Info struct { - Operator string // who initiated the freeze (e.g. "mayor", a username) + Operator string // who initiated the freeze (a username, a tool name) Reason string // human-readable migration reason Timestamp time.Time // when the freeze was set } -// FilePath returns the full path to the freeze sentinel file. -func FilePath(townRoot string) string { - return filepath.Join(townRoot, FileName) +// Result is the outcome of a freeze lookup. +type Result struct { + // Path is the active marker's path, or "" when no marker was found. + Path string + + // FromEnv reports that Path — or, when the lookup failed, the path that + // failed — came from EnvFreezeFile rather than an ancestor walk. Callers + // use it to add "or unset BD_MIGRATION_FREEZE_FILE" to a refusal. + FromEnv bool + + // Err reports that the lookup could not be completed: a path that is + // neither present nor absent as far as bd can tell (a permission error on + // the marker or a directory above it). Callers must treat a non-nil Err as + // frozen — an undeterminable gate is not an open gate — and say so. + Err error } -// IsFrozen reports whether a migration freeze is currently active. -func IsFrozen(townRoot string) bool { - if townRoot == "" { +// Frozen reports whether writes must be refused: either a marker was found or +// the lookup could not be completed. +func (r Result) Frozen() bool { return r.Path != "" || r.Err != nil } + +// Find looks for an active freeze marker and reports what it found. +// +// EnvFreezeFile, when set, is authoritative and the only path consulted. +// Otherwise Find walks the current working directory to the filesystem root, +// then does the same for each directory in also, stopping at the first marker. +// +// Passing the resolved workspace in also is what keys the gate on the store +// being written rather than on the caller's shell: `BEADS_DIR=/work/repo/.beads +// bd create` run from $HOME, `bd -C /work/repo create` (which sets BEADS_DIR +// without ever chdir'ing), and a daemon with an unrelated cwd must all still +// be stopped by /work/MIGRATION-FREEZE. +func Find(also ...string) Result { + if r, handled := lookupEnvOverride(); handled { + return r + } + + starts := make([]string, 0, len(also)+1) + if cwd, err := os.Getwd(); err == nil { + starts = append(starts, cwd) + } + starts = append(starts, also...) + return walkAll(starts) +} + +// FindFrom looks for an active freeze marker in dir and its ancestors only, +// ignoring the process working directory. Use it when the caller's cwd is not +// part of the operation — a command handed an explicit target path — and in +// tests that must exercise the walk without depending on process state. +// EnvFreezeFile still wins when set. +func FindFrom(dir string) Result { + if r, handled := lookupEnvOverride(); handled { + return r + } + return walkAll([]string{dir}) +} + +// lookupEnvOverride resolves EnvFreezeFile. The second return reports whether +// the variable was set at all; when it was, its answer is final and no walk +// runs — that is what makes the variable a usable opt-out. +func lookupEnvOverride() (Result, bool) { + override := os.Getenv(EnvFreezeFile) + if override == "" { + return Result{}, false + } + switch found, err := statMarker(override, true); { + case err != nil: + return Result{FromEnv: true, Err: err}, true + case found: + return Result{Path: override, FromEnv: true}, true + default: + return Result{FromEnv: true}, true + } +} + +// walkAll walks each start directory to the filesystem root, returning the +// first marker found. Duplicate and empty starts are skipped, as are ancestors +// already visited by an earlier start. +func walkAll(starts []string) Result { + seen := make(map[string]bool) + for _, start := range starts { + if start == "" { + continue + } + dir, err := filepath.Abs(start) + if err != nil { + continue + } + for { + if !seen[dir] { + seen[dir] = true + switch found, statErr := statMarker(filepath.Join(dir, FileName), false); { + case statErr != nil: + return Result{Err: statErr} + case found && !inUntrustedDir(dir): + return Result{Path: filepath.Join(dir, FileName)} + } + } + parent := filepath.Dir(dir) + if parent == dir { + break + } + dir = parent + } + } + return Result{} +} + +// statMarker reports whether path is a usable freeze marker. A missing path is +// simply not a marker; so is a directory or a device named MIGRATION-FREEZE, +// which the walk can otherwise hit in vendored fixtures or an extracted +// archive. Any other stat failure — a permission error on the marker or on a +// directory above it — is returned, because "bd cannot tell" must not read as +// "not frozen". +// +// trusted separates the operator-named EnvFreezeFile path from one the untrusted +// ancestor walk stumbled onto, which decides how a symlink is treated. os.Lstat +// does not follow links, so a symlink is neither regular nor absent; left alone +// it would silently fail OPEN — the one direction a write gate must never take. +// On the trusted path a symlink is honored (resolved with os.Stat, so a link to +// a real regular marker still freezes): the operator named it, and an +// indirection like `current -> releases/N` is exactly what EnvFreezeFile is +// for. On the untrusted walk a symlink is NOT followed — anything the walk +// merely passed through could otherwise redirect the gate — but the skip is +// announced on stderr so it is visible rather than a silent bypass. +func statMarker(path string, trusted bool) (bool, error) { + info, err := os.Lstat(path) + if err != nil { + return classifyMarkerStatErr(path, err) + } + switch { + case info.Mode().IsRegular(): + return true, nil + case info.Mode()&os.ModeSymlink != 0: + return statSymlinkMarker(path, trusted) + default: + // A directory, device, socket, or similar named MIGRATION-FREEZE is not + // a marker. + return false, nil + } +} + +// statSymlinkMarker decides a symlink found where a marker was expected. On the +// untrusted walk it refuses to follow but warns, so an ignored would-be marker +// never disappears in silence. On the operator-named path it follows the link +// with os.Stat and honors a regular target; a dangling or non-regular target is +// simply not a marker, and an unreadable one stays fail-closed. +func statSymlinkMarker(path string, trusted bool) (bool, error) { + if !trusted { + fmt.Fprintf(os.Stderr, + "bd: ignoring symlinked %s at %s; a freeze marker must be a regular file (set %s to honor a symlink)\n", + FileName, path, EnvFreezeFile) + return false, nil + } + info, err := os.Stat(path) + if err != nil { + return classifyMarkerStatErr(path, err) + } + return info.Mode().IsRegular(), nil +} + +// classifyMarkerStatErr maps a stat/lstat error to the (found, err) a marker +// lookup reports: a genuinely-absent path (ENOENT/EINVAL, or ENOTDIR when a +// component of the path is not a directory) is "not a marker"; anything else is +// undeterminable and returned so the caller treats it as frozen. +func classifyMarkerStatErr(path string, err error) (bool, error) { + switch { + case errors.Is(err, fs.ErrNotExist), errors.Is(err, fs.ErrInvalid): + return false, nil + case errors.Is(err, syscall.ENOTDIR): + // A component of path is not a directory, so the marker cannot exist + // here. That is an answer, not a failure. + return false, nil + default: + return false, fmt.Errorf("checking for a %s marker at %s: %w", FileName, path, err) + } +} + +// inUntrustedDir reports whether dir is a world-writable sticky directory — +// /tmp and its kin. The ancestor walk reaches those on the way to the root, +// and a marker there is both forgeable by any local account and, thanks to the +// sticky bit, undeletable by the victim the refusal tells to delete it. An +// explicit BD_MIGRATION_FREEZE_FILE is exempt: that path is the operator's own +// stated intent, not something the walk stumbled onto. +func inUntrustedDir(dir string) bool { + info, err := os.Stat(dir) + if err != nil { return false } - _, err := os.Stat(FilePath(townRoot)) - return err == nil + mode := info.Mode() + return mode.IsDir() && mode&os.ModeSticky != 0 && mode.Perm()&0o002 != 0 } -// Read parses the freeze sentinel. Returns nil if not frozen or unreadable. -func Read(townRoot string) *Info { - if townRoot == "" { +// ReadFile parses the freeze marker at path. Returns nil when the file is +// missing or unreadable. At most maxMarkerSize bytes are read. +func ReadFile(path string) *Info { + if path == "" { return nil } - data, err := os.ReadFile(FilePath(townRoot)) + f, err := os.Open(path) //nolint:gosec // G304: path comes from Find/FindFrom — an ancestor walk for a fixed filename, or the operator's own BD_MIGRATION_FREEZE_FILE + if err != nil { + return nil + } + defer func() { _ = f.Close() }() + + data, err := io.ReadAll(io.LimitReader(f, maxMarkerSize)) if err != nil { return nil } return parse(string(data)) } -// parse mirrors gt's own freeze-file format: operator, RFC3339 timestamp, -// and reason, tab-separated on a single line. +// parse reads the marker's optional payload: operator, RFC3339 timestamp, and +// reason, tab-separated on a single line. Every field is optional — an empty +// file is a valid freeze, and so is one that records a reason but no operator. func parse(content string) *Info { - content = strings.TrimSpace(content) - if content == "" { - // No recorded timestamp to parse (e.g. an empty sentinel file, such + // Only the first line is payload. Taking it before splitting keeps a + // multi-line file from smuggling extra lines into Reason, and trimming + // per-field afterwards (rather than trimming the whole string first) + // preserves a leading empty operator instead of shifting the timestamp + // into it. + line, _, _ := strings.Cut(content, "\n") + line = strings.TrimRight(line, "\r") + if strings.TrimSpace(line) == "" { + // No recorded timestamp to parse (e.g. an empty marker file, such // as one created with `touch`) — leave Timestamp at its zero value // rather than fabricating "now": a caller that ever inspects it // should not be told the freeze started at check-time. return &Info{} } - parts := strings.SplitN(content, "\t", 3) + + parts := strings.SplitN(line, "\t", 3) info := &Info{} - if len(parts) >= 1 { - info.Operator = parts[0] - } + info.Operator = strings.TrimSpace(parts[0]) if len(parts) >= 2 { - if t, err := time.Parse(time.RFC3339, parts[1]); err == nil { + if t, err := time.Parse(time.RFC3339, strings.TrimSpace(parts[1])); err == nil { info.Timestamp = t } } if len(parts) >= 3 { - info.Reason = parts[2] + info.Reason = strings.TrimSpace(parts[2]) } return info } diff --git a/internal/migration/freeze_test.go b/internal/migration/freeze_test.go index 35969cf36..0c092d31e 100644 --- a/internal/migration/freeze_test.go +++ b/internal/migration/freeze_test.go @@ -1,47 +1,406 @@ package migration import ( + "io" "os" "path/filepath" + "runtime" + "strings" "testing" "time" ) -func TestIsFrozen(t *testing.T) { +// pinNoOverride neutralizes an inherited BD_MIGRATION_FREEZE_FILE without +// making it authoritative. Find/FindFrom short-circuit on a set variable, so a +// developer who exported the documented opt-out would otherwise see every +// walk-based test in this file fail on a healthy checkout. +func pinNoOverride(t *testing.T) { + t.Helper() + t.Setenv(EnvFreezeFile, "") +} + +// writeMarker writes a freeze marker at dir/MIGRATION-FREEZE and returns its path. +func writeMarker(t *testing.T, dir, content string) string { + t.Helper() + path := filepath.Join(dir, FileName) + if err := os.WriteFile(path, []byte(content), 0644); err != nil { + t.Fatalf("writing marker at %s: %v", path, err) + } + return path +} + +// captureStderr runs f with os.Stderr redirected to a pipe and returns what it +// wrote. These tests run sequentially (no t.Parallel), so swapping the +// process-global stderr for the duration of one call is safe here. +func captureStderr(t *testing.T, f func()) string { + t.Helper() + r, w, err := os.Pipe() + if err != nil { + t.Fatalf("os.Pipe: %v", err) + } + old := os.Stderr + os.Stderr = w + defer func() { os.Stderr = old }() + + f() + + if err := w.Close(); err != nil { + t.Fatalf("closing stderr pipe: %v", err) + } + os.Stderr = old + out, err := io.ReadAll(r) + if err != nil { + t.Fatalf("reading captured stderr: %v", err) + } + return string(out) +} + +// TestFindFromWalkTerminates covers the walk's not-found exit. FindFrom takes +// the start directory explicitly, so this runs without touching process state +// and without the "a real marker might exist above TMPDIR" caveat that forced +// the old no-marker test to pin the override and skip the walk entirely. +// Breaking the `parent == dir` termination — hanging at /, or returning the +// root candidate — fails here instead of passing the whole suite. +func TestFindFromWalkTerminates(t *testing.T) { + pinNoOverride(t) + + // An absolute path that does not exist: every ancestor up to / is walked, + // nothing is found, and the loop must stop at the root. + deep := filepath.Join(t.TempDir(), "a", "b", "c", "d") + res := FindFrom(deep) + if res.Err != nil { + t.Fatalf("FindFrom(%q).Err = %v, want nil", deep, res.Err) + } + if res.Path != "" { + t.Fatalf("FindFrom(%q).Path = %q, want \"\" — no marker exists anywhere above a fresh temp dir", deep, res.Path) + } + if res.Frozen() { + t.Errorf("Frozen() = true for an empty result") + } +} + +func TestFindFromMarkerInStartDir(t *testing.T) { + pinNoOverride(t) dir := t.TempDir() + want := writeMarker(t, dir, "operator\t2026-08-16T12:00:00Z\tmigrating\n") - if IsFrozen(dir) { - t.Fatalf("IsFrozen(%q) = true before sentinel written, want false", dir) + res := FindFrom(dir) + if !res.Frozen() { + t.Fatalf("FindFrom(%q) = %+v, want the marker in the start directory", dir, res) } - - if err := os.WriteFile(FilePath(dir), []byte("mayor\t2026-08-16T12:00:00Z\tdolt v2 migration\n"), 0644); err != nil { - t.Fatalf("writing sentinel: %v", err) + if !sameFile(t, res.Path, want) { + t.Errorf("Path = %q, want %q", res.Path, want) } - - if !IsFrozen(dir) { - t.Fatalf("IsFrozen(%q) = false after sentinel written, want true", dir) + if res.FromEnv { + t.Errorf("FromEnv = true for a walk-found marker") } } -func TestIsFrozenEmptyTownRoot(t *testing.T) { - if IsFrozen("") { - t.Fatalf("IsFrozen(\"\") = true, want false (no town root to check)") +func TestFindFromWalksUpToGrandparent(t *testing.T) { + pinNoOverride(t) + root := t.TempDir() + want := writeMarker(t, root, "") + deep := filepath.Join(root, "rig", "repo") + if err := os.MkdirAll(deep, 0755); err != nil { + t.Fatalf("creating %s: %v", deep, err) + } + + res := FindFrom(deep) + if !res.Frozen() { + t.Fatalf("FindFrom(%q) = %+v, want the marker two levels up at %q", deep, res, want) + } + if !sameFile(t, res.Path, want) { + t.Errorf("Path = %q, want %q", res.Path, want) } } -func TestReadParsesOperatorReasonTimestamp(t *testing.T) { +// TestFindWalksExtraRootsNotJustCwd is the target-workspace contract: a caller +// whose working directory is nowhere near the frozen tree must still be +// stopped when it names that tree. This is the `BEADS_DIR=... bd create` and +// `bd -C ` shape, neither of which chdirs. +func TestFindWalksExtraRootsNotJustCwd(t *testing.T) { + pinNoOverride(t) + unrelated := t.TempDir() + frozenRoot := t.TempDir() + want := writeMarker(t, frozenRoot, "operator\t\treason\n") + workspace := filepath.Join(frozenRoot, "repo", ".beads") + if err := os.MkdirAll(workspace, 0755); err != nil { + t.Fatalf("creating %s: %v", workspace, err) + } + t.Chdir(unrelated) + + if res := Find(); res.Frozen() { + t.Fatalf("Find() with an unrelated cwd = %+v, want not frozen (guards the test's own premise)", res) + } + + res := Find(workspace) + if !res.Frozen() { + t.Fatalf("Find(%q) = %+v, want the marker above the named workspace", workspace, res) + } + if !sameFile(t, res.Path, want) { + t.Errorf("Path = %q, want %q", res.Path, want) + } +} + +// TestFindEnvOverrideAuthoritative pins both directions of the override: an +// existing file freezes even with no ancestor marker, and a missing file does +// NOT freeze even when an ancestor marker exists. The second half is what +// makes the variable a usable opt-out. +func TestFindEnvOverrideAuthoritative(t *testing.T) { + t.Run("existing file freezes without any ancestor marker", func(t *testing.T) { + work := t.TempDir() + override := filepath.Join(t.TempDir(), "freeze-marker") + if err := os.WriteFile(override, []byte("operator\t\treason\n"), 0644); err != nil { + t.Fatalf("writing override marker: %v", err) + } + t.Chdir(work) + t.Setenv(EnvFreezeFile, override) + + res := Find() + if res.Path != override { + t.Errorf("Path = %q, want the override path %q", res.Path, override) + } + if !res.FromEnv { + t.Errorf("FromEnv = false, want true — the refusal needs it to offer the unset hint") + } + }) + + t.Run("missing file wins over an ancestor marker", func(t *testing.T) { + root := t.TempDir() + writeMarker(t, root, "operator\t\treason\n") + deep := filepath.Join(root, "nested") + if err := os.MkdirAll(deep, 0755); err != nil { + t.Fatalf("creating %s: %v", deep, err) + } + t.Chdir(deep) + t.Setenv(EnvFreezeFile, filepath.Join(root, "no-such-marker")) + + res := Find() + if res.Frozen() { + t.Errorf("Find() = %+v, want not frozen — the override must skip the ancestor walk entirely", res) + } + }) + + t.Run("override also outranks an explicitly named workspace", func(t *testing.T) { + root := t.TempDir() + writeMarker(t, root, "") + t.Chdir(t.TempDir()) + t.Setenv(EnvFreezeFile, filepath.Join(root, "no-such-marker")) + + if res := Find(root); res.Frozen() { + t.Errorf("Find(%q) = %+v, want not frozen", root, res) + } + }) +} + +// TestLookupFailureIsFrozen is the fail-closed contract: a marker path bd +// cannot resolve is not the same as a marker that is absent, and the ambiguity +// must not silently disarm the gate. +func TestLookupFailureIsFrozen(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("POSIX directory permissions do not produce the same stat failure on Windows") + } + if os.Geteuid() == 0 { + t.Skip("running as root: permission bits do not deny the stat") + } + + t.Run("env override in an unreadable directory", func(t *testing.T) { + locked := filepath.Join(t.TempDir(), "locked") + if err := os.Mkdir(locked, 0755); err != nil { + t.Fatalf("creating %s: %v", locked, err) + } + override := filepath.Join(locked, FileName) + if err := os.WriteFile(override, nil, 0644); err != nil { + t.Fatalf("writing override marker: %v", err) + } + if err := os.Chmod(locked, 0000); err != nil { + t.Fatalf("chmod: %v", err) + } + t.Cleanup(func() { _ = os.Chmod(locked, 0755) }) + t.Setenv(EnvFreezeFile, override) + + res := Find() + if res.Err == nil { + t.Fatalf("Find() = %+v, want a lookup error for an unstattable authoritative path", res) + } + if !res.Frozen() { + t.Errorf("Frozen() = false on a lookup failure — an undeterminable gate must not read as an open one") + } + if !res.FromEnv { + t.Errorf("FromEnv = false, want true so the refusal can name the variable") + } + }) + + t.Run("unreadable ancestor during the walk", func(t *testing.T) { + locked := filepath.Join(t.TempDir(), "locked") + nested := filepath.Join(locked, "repo") + if err := os.MkdirAll(nested, 0755); err != nil { + t.Fatalf("creating %s: %v", nested, err) + } + if err := os.Chmod(locked, 0000); err != nil { + t.Fatalf("chmod: %v", err) + } + t.Cleanup(func() { _ = os.Chmod(locked, 0755) }) + pinNoOverride(t) + + res := FindFrom(nested) + if res.Err == nil { + t.Fatalf("FindFrom(%q) = %+v, want a lookup error for an unreadable ancestor", nested, res) + } + if !res.Frozen() { + t.Errorf("Frozen() = false on a lookup failure") + } + }) +} + +// TestNonRegularMarkerIsNotAFreeze covers the vendored-fixture / extracted- +// archive case: a *directory* named MIGRATION-FREEZE must not freeze every +// workspace below it with an unreadable, unremovable-sounding refusal. +func TestNonRegularMarkerIsNotAFreeze(t *testing.T) { + pinNoOverride(t) + root := t.TempDir() + if err := os.Mkdir(filepath.Join(root, FileName), 0755); err != nil { + t.Fatalf("creating marker directory: %v", err) + } + nested := filepath.Join(root, "repo") + if err := os.MkdirAll(nested, 0755); err != nil { + t.Fatalf("creating %s: %v", nested, err) + } + + if res := FindFrom(nested); res.Frozen() { + t.Errorf("FindFrom(%q) = %+v, want not frozen — a directory is not a marker", nested, res) + } +} + +// TestEnvOverrideFollowsSymlink is the fail-open regression on the authoritative +// path: an operator who points BD_MIGRATION_FREEZE_FILE through an indirection +// symlink (the `current -> releases/N` pattern the variable exists for) must +// still be frozen when the link resolves to a real marker. os.Lstat alone would +// see the link, not the regular file it targets, and wave the write through. +func TestEnvOverrideFollowsSymlink(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("symlink creation needs privilege on Windows") + } + dir := t.TempDir() + target := filepath.Join(dir, "real-marker") + if err := os.WriteFile(target, []byte("alice\t\tmigrating\n"), 0644); err != nil { + t.Fatalf("writing target marker: %v", err) + } + link := filepath.Join(dir, "current-freeze") + if err := os.Symlink(target, link); err != nil { + t.Fatalf("creating symlink: %v", err) + } + t.Chdir(t.TempDir()) + t.Setenv(EnvFreezeFile, link) + + res := Find() + if !res.Frozen() { + t.Fatalf("Find() with %s at a symlink to a real marker = %+v, want frozen — the authoritative path must follow the link", EnvFreezeFile, res) + } + if res.Path != link { + t.Errorf("Path = %q, want the operator-named path %q", res.Path, link) + } + if !res.FromEnv { + t.Errorf("FromEnv = false, want true") + } +} + +// TestEnvOverrideDanglingSymlinkNotFrozen keeps the opt-out honest: a symlink +// whose target does not exist is the same as naming a missing path — no marker, +// no freeze — not an undeterminable failure that would fail closed. +func TestEnvOverrideDanglingSymlinkNotFrozen(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("symlink creation needs privilege on Windows") + } + dir := t.TempDir() + link := filepath.Join(dir, "current-freeze") + if err := os.Symlink(filepath.Join(dir, "no-such-target"), link); err != nil { + t.Fatalf("creating dangling symlink: %v", err) + } + t.Chdir(t.TempDir()) + t.Setenv(EnvFreezeFile, link) + + res := Find() + if res.Frozen() { + t.Errorf("Find() with %s at a dangling symlink = %+v, want not frozen", EnvFreezeFile, res) + } +} + +// TestWalkSymlinkMarkerIgnoredWithWarning is the untrusted-walk half of the +// symlink rule: a symlink named MIGRATION-FREEZE that the ancestor walk hits is +// NOT followed — otherwise anything the walk merely passed through could +// redirect the gate — but the skip must be announced, not a silent fail-open. +func TestWalkSymlinkMarkerIgnoredWithWarning(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("symlink creation needs privilege on Windows") + } + pinNoOverride(t) + root := t.TempDir() + target := filepath.Join(t.TempDir(), "real-marker") + if err := os.WriteFile(target, nil, 0644); err != nil { + t.Fatalf("writing target marker: %v", err) + } + if err := os.Symlink(target, filepath.Join(root, FileName)); err != nil { + t.Fatalf("creating symlink marker: %v", err) + } + nested := filepath.Join(root, "repo") + if err := os.MkdirAll(nested, 0755); err != nil { + t.Fatalf("creating %s: %v", nested, err) + } + + var res Result + stderr := captureStderr(t, func() { res = FindFrom(nested) }) + if res.Frozen() { + t.Errorf("FindFrom(%q) = %+v, want not frozen — a symlinked marker on the untrusted walk is not followed", nested, res) + } + if !strings.Contains(stderr, FileName) || !strings.Contains(stderr, "symlink") { + t.Errorf("stderr = %q, want a warning naming the ignored symlinked %s so the skip is not silent", stderr, FileName) + } +} + +// TestStickyWorldWritableMarkerIgnored covers the shared-machine denial of +// service: /tmp is world-writable and sticky, so any local account can drop a +// marker there that freezes every workspace below it AND that the victim +// cannot delete. Markers found by the walk in such a directory are ignored. +func TestStickyWorldWritableMarkerIgnored(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("no sticky bit on Windows") + } + pinNoOverride(t) + root := t.TempDir() + writeMarker(t, root, "attacker\t\tdenial of service\n") + if err := os.Chmod(root, os.ModeSticky|0777); err != nil { + t.Fatalf("chmod sticky+world-writable: %v", err) + } + t.Cleanup(func() { _ = os.Chmod(root, 0755) }) + nested := filepath.Join(root, "repo") + if err := os.MkdirAll(nested, 0755); err != nil { + t.Fatalf("creating %s: %v", nested, err) + } + + if res := FindFrom(nested); res.Frozen() { + t.Errorf("FindFrom(%q) = %+v, want not frozen — a marker in a sticky world-writable directory is forgeable and undeletable", nested, res) + } + + // The operator's own explicit path is exempt: naming it is intent. + override := filepath.Join(root, FileName) + t.Setenv(EnvFreezeFile, override) + if res := Find(); !res.Frozen() { + t.Errorf("Find() with %s=%q = %+v, want frozen — an explicitly named marker is not second-guessed", EnvFreezeFile, override, res) + } +} + +func TestReadFileParsesOperatorTimestampReason(t *testing.T) { dir := t.TempDir() ts := "2026-08-16T12:00:00Z" - if err := os.WriteFile(FilePath(dir), []byte("mayor\t"+ts+"\tdolt v2 migration\n"), 0644); err != nil { - t.Fatalf("writing sentinel: %v", err) - } + path := writeMarker(t, dir, "operator\t"+ts+"\tdolt v2 migration\n") - info := Read(dir) + info := ReadFile(path) if info == nil { - t.Fatalf("Read(%q) = nil, want parsed Info", dir) + t.Fatalf("ReadFile(%q) = nil, want parsed Info", path) } - if info.Operator != "mayor" { - t.Errorf("Operator = %q, want %q", info.Operator, "mayor") + if info.Operator != "operator" { + t.Errorf("Operator = %q, want %q", info.Operator, "operator") } if info.Reason != "dolt v2 migration" { t.Errorf("Reason = %q, want %q", info.Reason, "dolt v2 migration") @@ -52,49 +411,128 @@ func TestReadParsesOperatorReasonTimestamp(t *testing.T) { } } -func TestReadNotFrozenReturnsNil(t *testing.T) { +// TestReadFileLeadingEmptyOperatorKeepsFields is the field-shift regression: a +// marker that records a timestamp and reason but no operator must keep them in +// their own fields, not slide the timestamp into Operator and drop Reason. +func TestReadFileLeadingEmptyOperatorKeepsFields(t *testing.T) { dir := t.TempDir() - if info := Read(dir); info != nil { - t.Fatalf("Read(%q) = %+v, want nil (no sentinel present)", dir, info) + ts := "2026-08-16T12:00:00Z" + path := writeMarker(t, dir, "\t"+ts+"\tdisk swap\n") + + info := ReadFile(path) + if info == nil { + t.Fatalf("ReadFile(%q) = nil, want parsed Info", path) + } + if info.Operator != "" { + t.Errorf("Operator = %q, want \"\" — the payload records no operator", info.Operator) + } + if info.Reason != "disk swap" { + t.Errorf("Reason = %q, want %q — a leading empty field must not shift the rest", info.Reason, "disk swap") + } + wantTS, _ := time.Parse(time.RFC3339, ts) + if !info.Timestamp.Equal(wantTS) { + t.Errorf("Timestamp = %v, want %v", info.Timestamp, wantTS) } } -func TestReadEmptyContentDoesNotFabricateTimestamp(t *testing.T) { +// TestReadFileTakesFirstLineOnly keeps a multi-line marker from smuggling +// extra lines into Reason, which is echoed to a terminal. +func TestReadFileTakesFirstLineOnly(t *testing.T) { dir := t.TempDir() - if err := os.WriteFile(FilePath(dir), []byte(""), 0644); err != nil { - t.Fatalf("writing empty sentinel: %v", err) - } + path := writeMarker(t, dir, "operator\t\treal reason\nError: spoofed second line\n") - info := Read(dir) + info := ReadFile(path) if info == nil { - t.Fatalf("Read(%q) = nil for empty-but-present sentinel, want non-nil Info", dir) + t.Fatalf("ReadFile(%q) = nil, want parsed Info", path) + } + if info.Reason != "real reason" { + t.Errorf("Reason = %q, want %q (no trailing lines)", info.Reason, "real reason") + } + if strings.Contains(info.Reason, "spoofed") || strings.Contains(info.Operator, "spoofed") { + t.Errorf("parsed fields carry a later line: %+v", info) + } +} + +func TestReadFileCRLF(t *testing.T) { + dir := t.TempDir() + path := writeMarker(t, dir, "operator\t\twindows reason\r\n") + + info := ReadFile(path) + if info == nil { + t.Fatalf("ReadFile(%q) = nil", path) + } + if info.Reason != "windows reason" { + t.Errorf("Reason = %q, want %q (CR stripped)", info.Reason, "windows reason") + } +} + +// TestReadFileCapsSize keeps a hostile or accidental giant marker from turning +// the refusal into a full-size allocation. +func TestReadFileCapsSize(t *testing.T) { + dir := t.TempDir() + huge := strings.Repeat("x", maxMarkerSize*2) + path := writeMarker(t, dir, "operator\t\t"+huge+"\n") + + info := ReadFile(path) + if info == nil { + t.Fatalf("ReadFile(%q) = nil", path) + } + if len(info.Reason) > maxMarkerSize { + t.Errorf("len(Reason) = %d, want <= %d — the read must be capped", len(info.Reason), maxMarkerSize) + } +} + +func TestReadFileMissingReturnsNil(t *testing.T) { + dir := t.TempDir() + if info := ReadFile(filepath.Join(dir, FileName)); info != nil { + t.Fatalf("ReadFile = %+v, want nil (no marker present)", info) + } + if info := ReadFile(""); info != nil { + t.Fatalf("ReadFile(\"\") = %+v, want nil", info) + } +} + +func TestReadFileEmptyContentDoesNotFabricateTimestamp(t *testing.T) { + dir := t.TempDir() + path := writeMarker(t, dir, "") + + info := ReadFile(path) + if info == nil { + t.Fatalf("ReadFile(%q) = nil for an empty-but-present marker, want non-nil Info", path) } if !info.Timestamp.IsZero() { t.Errorf("Timestamp = %v, want zero value (no recorded timestamp to report — must not fabricate one)", info.Timestamp) } if info.Operator != "" || info.Reason != "" { - t.Errorf("Operator/Reason = %q/%q, want both empty for an empty sentinel", info.Operator, info.Reason) + t.Errorf("Operator/Reason = %q/%q, want both empty for an empty marker", info.Operator, info.Reason) } } -func TestReadMalformedContentDoesNotPanic(t *testing.T) { +func TestReadFileMalformedContentDoesNotPanic(t *testing.T) { dir := t.TempDir() - if err := os.WriteFile(FilePath(dir), []byte("not tab separated at all"), 0644); err != nil { - t.Fatalf("writing sentinel: %v", err) - } - info := Read(dir) + path := writeMarker(t, dir, "not tab separated at all") + + info := ReadFile(path) if info == nil { - t.Fatalf("Read(%q) = nil for malformed-but-present sentinel, want non-nil Info with best-effort fields", dir) + t.Fatalf("ReadFile(%q) = nil for a malformed-but-present marker, want non-nil Info with best-effort fields", path) } if info.Operator != "not tab separated at all" { t.Errorf("Operator = %q, want the whole line back (no tabs to split on)", info.Operator) } } -func TestFilePathJoinsTownRoot(t *testing.T) { - got := FilePath("/some/town/root") - want := filepath.Join("/some/town/root", "MIGRATION-FREEZE") - if got != want { - t.Errorf("FilePath = %q, want %q", got, want) +// sameFile compares two paths by identity rather than string equality: on +// macOS t.TempDir() lives under /var, a symlink to /private/var, so the walk's +// filepath.Abs spelling can differ from the one the test holds. +func sameFile(t *testing.T, a, b string) bool { + t.Helper() + ai, err := os.Stat(a) + if err != nil { + t.Fatalf("stat %s: %v", a, err) } + bi, err := os.Stat(b) + if err != nil { + t.Fatalf("stat %s: %v", b, err) + } + return os.SameFile(ai, bi) } diff --git a/internal/notion/tracker.go b/internal/notion/tracker.go index 6a0ced962..1cac3c5eb 100644 --- a/internal/notion/tracker.go +++ b/internal/notion/tracker.go @@ -10,7 +10,7 @@ import ( "time" "github.com/steveyegge/beads/internal/config" - "github.com/steveyegge/beads/internal/storage" + "github.com/steveyegge/beads/internal/tracker" itracker "github.com/steveyegge/beads/internal/tracker" "github.com/steveyegge/beads/internal/types" ) @@ -47,7 +47,7 @@ func init() { type Tracker struct { client notionAPI - store storage.Storage + store tracker.Store config *MappingConfig dataSourceID string viewURL string @@ -65,7 +65,7 @@ func (t *Tracker) Name() string { return "notion" } func (t *Tracker) DisplayName() string { return "Notion" } func (t *Tracker) ConfigPrefix() string { return "notion" } -func (t *Tracker) Init(ctx context.Context, store storage.Storage) error { +func (t *Tracker) Init(ctx context.Context, store tracker.Store) error { t.store = store t.dataSourceID = t.getConfig(ctx, "notion.data_source_id", "NOTION_DATA_SOURCE_ID") t.viewURL = t.getConfig(ctx, "notion.view_url", "NOTION_VIEW_URL") diff --git a/internal/storage/dbproxy/proxy/backend_dial_timeout_test.go b/internal/storage/dbproxy/proxy/backend_dial_timeout_test.go new file mode 100644 index 000000000..108cb7312 --- /dev/null +++ b/internal/storage/dbproxy/proxy/backend_dial_timeout_test.go @@ -0,0 +1,102 @@ +package proxy + +import ( + "context" + "errors" + "io" + "log" + "net" + "testing" + "time" +) + +type blockingBackend struct{} + +func (blockingBackend) ID(context.Context) string { return "blocking" } +func (blockingBackend) DSN(context.Context, string, string, string) string { return "" } +func (blockingBackend) Start(context.Context) error { return nil } +func (blockingBackend) Stop(context.Context) error { return nil } +func (blockingBackend) Running(context.Context) bool { return true } +func (blockingBackend) Dial(ctx context.Context) (net.Conn, error) { + <-ctx.Done() + return nil, ctx.Err() +} + +func TestHandleConnBoundsBlockedBackendDial(t *testing.T) { + p := NewProxyServer(ProxyOpts{Server: blockingBackend{}}) + p.logger = log.Default() + client, peer := net.Pipe() + defer peer.Close() + start := time.Now() + err := p.handleConn(context.Background(), client) + if !errors.Is(err, context.DeadlineExceeded) { + t.Fatalf("error = %v, want deadline exceeded", err) + } + if elapsed := time.Since(start); elapsed > backendDialTimeout+time.Second { + t.Fatalf("blocked dial took %s", elapsed) + } + _, _ = io.Copy(io.Discard, peer) +} + +func TestHandleConnCanceledClientDialClosesAndDrains(t *testing.T) { + stats := &Stats{} + p := NewProxyServer(ProxyOpts{Server: blockingBackend{}, Stats: stats}) + p.logger = log.Default() + client, peer := net.Pipe() + defer peer.Close() + ctx, cancel := context.WithCancel(context.Background()) + cancel() + err := p.handleConn(ctx, client) + if !errors.Is(err, context.Canceled) { + t.Fatalf("error = %v, want context canceled", err) + } + if got := p.activeConns.Load(); got != 0 { + t.Fatalf("active connections = %d, want 0", got) + } + snapshot := stats.Snapshot() + if snapshot.BackendDialAttempts != 1 || snapshot.BackendDialErrors != 1 || snapshot.HandledConns != 0 { + t.Fatalf("stats = %+v, want one failed dial and no handled conns", snapshot) + } +} + +type tcpBlackholeBackend struct{ address string } + +func (b tcpBlackholeBackend) ID(context.Context) string { return "tcp-blackhole" } +func (b tcpBlackholeBackend) DSN(context.Context, string, string, string) string { return b.address } +func (b tcpBlackholeBackend) Start(context.Context) error { return nil } +func (b tcpBlackholeBackend) Stop(context.Context) error { return nil } +func (b tcpBlackholeBackend) Running(context.Context) bool { return true } +func (b tcpBlackholeBackend) Dial(ctx context.Context) (net.Conn, error) { + d := net.Dialer{} + return d.DialContext(ctx, "tcp", b.address) +} + +func TestHandleConnTCPBlackholeIsBounded(t *testing.T) { + listener, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatal(err) + } + defer listener.Close() + accepted := make(chan net.Conn, 1) + go func() { conn, _ := listener.Accept(); accepted <- conn }() + p := NewProxyServer(ProxyOpts{Server: tcpBlackholeBackend{address: listener.Addr().String()}, Stats: &Stats{}}) + p.logger = log.Default() + client, peer := net.Pipe() + defer peer.Close() + ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond) + defer cancel() + start := time.Now() + err = p.handleConn(ctx, client) + if conn := <-accepted; conn != nil { + _ = conn.Close() + } + if err == nil { + t.Fatal("blackhole connection unexpectedly completed without cancellation") + } + if time.Since(start) > time.Second { + t.Fatalf("blackhole dial exceeded bound") + } + if p.activeConns.Load() != 0 { + t.Fatal("active connection leaked") + } +} diff --git a/internal/storage/dbproxy/proxy/external_transport_lifecycle_internal_test.go b/internal/storage/dbproxy/proxy/external_transport_lifecycle_internal_test.go new file mode 100644 index 000000000..a07c4f44b --- /dev/null +++ b/internal/storage/dbproxy/proxy/external_transport_lifecycle_internal_test.go @@ -0,0 +1,464 @@ +package proxy + +import ( + "context" + "errors" + "fmt" + "io" + "net" + "os" + "path/filepath" + "runtime" + "strconv" + "strings" + "sync" + "testing" + "time" + + "github.com/steveyegge/beads/internal/configfile" + "github.com/steveyegge/beads/internal/storage/dbproxy/pidfile" + "github.com/steveyegge/beads/internal/storage/dbproxy/server" +) + +// unixSocketPath returns a bindable Unix socket path. t.TempDir() embeds the +// full test name, which on macOS sits under a long /var/folders/... root and +// overflows the ~104-byte sun_path limit, so bind fails with "invalid +// argument". A short unnamed temp dir stays well inside the limit. +func unixSocketPath(t *testing.T) string { + t.Helper() + dir, err := os.MkdirTemp("", "bdproxy") + if err != nil { + t.Fatalf("temp dir for unix socket: %v", err) + } + t.Cleanup(func() { _ = os.RemoveAll(dir) }) + return filepath.Join(dir, "u.sock") +} + +// externalTransportFixture is a deliberately small real TCP/Unix listener +// used to exercise the production proxy transport. It withholds all bytes in +// blackhole mode and echoes bytes in echo mode. The open set lets tests prove +// that the proxy closes the upstream socket instead of relying on fixture +// cleanup to hide a leak. +type externalTransportFixture struct { + t *testing.T + network string + address string + listener net.Listener + blackhole bool + + mu sync.Mutex + open map[net.Conn]struct{} + accepted chan net.Conn + doneCh chan struct{} + closeOnce sync.Once +} + +func newExternalTransportFixture(t *testing.T, network, address string, blackhole bool) *externalTransportFixture { + t.Helper() + if network == "unix" { + _ = os.Remove(address) + } + ln, err := net.Listen(network, address) + if err != nil { + t.Fatalf("listen upstream %s %q: %v", network, address, err) + } + f := &externalTransportFixture{ + t: t, + network: network, + address: ln.Addr().String(), + listener: ln, + blackhole: blackhole, + open: make(map[net.Conn]struct{}), + accepted: make(chan net.Conn, 16), + doneCh: make(chan struct{}), + } + go f.acceptLoop() + t.Cleanup(func() { f.Close() }) + return f +} + +func (f *externalTransportFixture) acceptLoop() { + defer close(f.doneCh) + for { + conn, err := f.listener.Accept() + if err != nil { + return + } + f.mu.Lock() + f.open[conn] = struct{}{} + f.mu.Unlock() + select { + case f.accepted <- conn: + default: + _ = conn.Close() + } + go f.serve(conn) + } +} + +func (f *externalTransportFixture) serve(conn net.Conn) { + defer func() { + f.mu.Lock() + delete(f.open, conn) + f.mu.Unlock() + _ = conn.Close() + }() + if f.blackhole { + // Reading, without writing a protocol response, models an upstream + // that accepted the transport but never completes a SQL handshake. + var b [1]byte + _, _ = conn.Read(b[:]) + return + } + _, _ = io.Copy(conn, conn) +} + +func (f *externalTransportFixture) nextAccepted(timeout time.Duration) net.Conn { + f.t.Helper() + select { + case conn := <-f.accepted: + return conn + case <-time.After(timeout): + f.t.Fatalf("upstream %s did not accept a connection within %s", f.network, timeout) + return nil + } +} + +func (f *externalTransportFixture) openCount() int { + f.mu.Lock() + defer f.mu.Unlock() + return len(f.open) +} + +func (f *externalTransportFixture) Close() { + f.closeOnce.Do(func() { + f.mu.Lock() + listener := f.listener + conns := make([]net.Conn, 0, len(f.open)) + for conn := range f.open { + conns = append(conns, conn) + } + f.mu.Unlock() + _ = listener.Close() + for _, conn := range conns { + _ = conn.Close() + } + select { + case <-f.doneCh: + case <-time.After(2 * time.Second): + f.t.Errorf("upstream %s accept loop did not stop", f.network) + } + if f.network == "unix" { + _ = os.Remove(f.address) + } + }) +} + +func (f *externalTransportFixture) reopen(t *testing.T, blackhole bool) *externalTransportFixture { + t.Helper() + address := f.address + f.Close() + return newExternalTransportFixture(t, f.network, address, blackhole) +} + +func externalServerConfig(t *testing.T, network, address string) configfile.ExternalDoltConfig { + t.Helper() + if network == "unix" { + return configfile.ExternalDoltConfig{Socket: address} + } + host, portText, err := net.SplitHostPort(address) + if err != nil { + t.Fatalf("split upstream address %q: %v", address, err) + } + port, err := strconv.Atoi(portText) + if err != nil { + t.Fatalf("parse upstream port %q: %v", portText, err) + } + return configfile.ExternalDoltConfig{Host: host, Port: port} +} + +type runningExternalProxy struct { + proxy *proxyServer + cancel context.CancelFunc + done chan error + finished chan struct{} + root string + port int +} + +func startExternalProxy(t *testing.T, fixture *externalTransportFixture) *runningExternalProxy { + t.Helper() + root := t.TempDir() + upstream, err := server.NewExternalDoltServer(externalServerConfig(t, fixture.network, fixture.address)) + if err != nil { + t.Fatalf("new external Dolt server: %v", err) + } + port := freeTCPPortForInternalTest(t) + p := NewProxyServer(ProxyOpts{ + RootDir: root, + Port: port, + IdleTimeout: IdleTimeoutNever, + Server: upstream, + Stats: &Stats{}, + }) + ctx, cancel := context.WithCancel(context.Background()) + done := make(chan error, 1) + finished := make(chan struct{}) + go func() { + defer close(finished) + done <- p.ListenAndServe(ctx) + }() + waitForInternalPid(t, root, 5*time.Second) + t.Cleanup(func() { + cancel() + select { + case <-finished: + case <-time.After(5 * time.Second): + t.Errorf("proxy did not stop during cleanup") + } + }) + return &runningExternalProxy{proxy: p, cancel: cancel, done: done, finished: finished, root: root, port: port} +} + +func freeTCPPortForInternalTest(t *testing.T) int { + t.Helper() + ln, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatalf("allocate proxy port: %v", err) + } + port := ln.Addr().(*net.TCPAddr).Port + _ = ln.Close() + return port +} + +func waitForInternalPid(t *testing.T, root string, timeout time.Duration) { + t.Helper() + deadline := time.Now().Add(timeout) + for time.Now().Before(deadline) { + pf, err := pidfile.Read(root, PIDFileName) + if err == nil && pf != nil { + return + } + time.Sleep(10 * time.Millisecond) + } + t.Fatalf("proxy pidfile did not appear within %s", timeout) +} + +func eventuallyInternal(t *testing.T, timeout time.Duration, check func() bool, message string) { + t.Helper() + deadline := time.Now().Add(timeout) + for time.Now().Before(deadline) { + if check() { + return + } + time.Sleep(10 * time.Millisecond) + } + t.Fatalf("eventually: %s", message) +} + +func dialInternalProxy(t *testing.T, port int) net.Conn { + t.Helper() + conn, err := net.DialTimeout("tcp", net.JoinHostPort("127.0.0.1", fmt.Sprint(port)), 2*time.Second) + if err != nil { + t.Fatalf("dial proxy: %v", err) + } + return conn +} + +func consumeReadiness(t *testing.T, fixture *externalTransportFixture) { + t.Helper() + conn := fixture.nextAccepted(5 * time.Second) + if conn == nil { + return + } + eventuallyInternal(t, 2*time.Second, func() bool { return fixture.openCount() == 0 }, "readiness upstream connection closed") +} + +func TestExternalProxyEstablishedTunnelClientCloseDrainsTCPAndUnix(t *testing.T) { + for _, network := range []string{"tcp", "unix"} { + network := network + t.Run(network, func(t *testing.T) { + if network == "unix" && runtime.GOOS == "windows" { + t.Skip("Unix sockets are unavailable on Windows") + } + address := "" + if network == "unix" { + address = unixSocketPath(t) + } + fixture := newExternalTransportFixture(t, network, address, true) + running := startExternalProxy(t, fixture) + consumeReadiness(t, fixture) + client := dialInternalProxy(t, running.port) + defer client.Close() + fixture.nextAccepted(5 * time.Second) + client.Close() + eventuallyInternal(t, 2*time.Second, func() bool { + return running.proxy.activeConns.Load() == 0 && fixture.openCount() == 0 + }, "client close did not drain proxy and upstream connections") + snapshot := running.proxy.stats.Snapshot() + if snapshot.BackendDialAttempts < 1 || snapshot.BackendDialSuccess < 1 || snapshot.HandledConns < 1 { + t.Fatalf("stats = %+v, want handled client tunnel", snapshot) + } + select { + case err := <-running.done: + t.Fatalf("proxy exited before explicit cancellation: %v", err) + default: + } + running.cancel() + select { + case <-running.done: + case <-time.After(2 * time.Second): + t.Fatal("proxy did not stop after cancellation") + } + }) + } +} + +func TestExternalProxyShutdownClosesEstablishedTCPAndUnixTunnels(t *testing.T) { + for _, network := range []string{"tcp", "unix"} { + network := network + t.Run(network, func(t *testing.T) { + address := "" + if network == "unix" { + address = unixSocketPath(t) + } + fixture := newExternalTransportFixture(t, network, address, true) + running := startExternalProxy(t, fixture) + consumeReadiness(t, fixture) + client := dialInternalProxy(t, running.port) + fixture.nextAccepted(5 * time.Second) + running.cancel() + select { + case <-running.done: + case <-time.After(2 * time.Second): + t.Fatal("proxy shutdown exceeded bounded timeout") + } + _ = client.SetReadDeadline(time.Now().Add(time.Second)) + var b [1]byte + if _, err := client.Read(b[:]); err == nil { + t.Fatal("client read succeeded after proxy shutdown") + } + _ = client.Close() + eventuallyInternal(t, 2*time.Second, func() bool { + return running.proxy.activeConns.Load() == 0 && fixture.openCount() == 0 + }, "proxy shutdown did not drain established tunnel") + if got := running.proxy.stats.Snapshot().BackendStopCalls; got != 1 { + t.Fatalf("backend stop calls = %d, want 1", got) + } + }) + } +} + +func TestExternalProxyOutageAndRestoreReDialsTCPAndUnix(t *testing.T) { + for _, network := range []string{"tcp", "unix"} { + network := network + t.Run(network, func(t *testing.T) { + address := "" + if network == "unix" { + address = unixSocketPath(t) + } + fixture := newExternalTransportFixture(t, network, address, false) + running := startExternalProxy(t, fixture) + consumeReadiness(t, fixture) + client := dialInternalProxy(t, running.port) + fixture.nextAccepted(5 * time.Second) + marker := []byte("proxy-recovery-marker") + if _, err := client.Write(marker); err != nil { + t.Fatalf("write healthy marker: %v", err) + } + got := make([]byte, len(marker)) + if _, err := io.ReadFull(client, got); err != nil { + t.Fatalf("read healthy marker: %v", err) + } + if string(got) != string(marker) { + t.Fatalf("healthy echo = %q, want %q", got, marker) + } + _ = client.Close() + eventuallyInternal(t, 2*time.Second, func() bool { return running.proxy.activeConns.Load() == 0 }, "healthy tunnel did not close") + + fixture = fixture.reopen(t, false) + // Close the restored listener to create a deterministic outage, then + // rebind it in the same test so the proxy must re-dial the endpoint. + fixture.Close() + failed := dialInternalProxy(t, running.port) + _ = failed.SetReadDeadline(time.Now().Add(2 * time.Second)) + var b [1]byte + if _, err := failed.Read(b[:]); err == nil { + t.Fatal("outage client unexpectedly received data") + } + _ = failed.Close() + eventuallyInternal(t, 2*time.Second, func() bool { + return running.proxy.stats.Snapshot().BackendDialErrors >= 1 + }, "proxy did not record outage dial error") + + fixture = newExternalTransportFixture(t, network, fixture.address, false) + recovered := dialInternalProxy(t, running.port) + defer recovered.Close() + fixture.nextAccepted(5 * time.Second) + if _, err := recovered.Write(marker); err != nil { + t.Fatalf("write restored marker: %v", err) + } + got = make([]byte, len(marker)) + if _, err := io.ReadFull(recovered, got); err != nil { + t.Fatalf("read restored marker: %v", err) + } + if string(got) != string(marker) { + t.Fatalf("restored echo = %q, want %q", got, marker) + } + snapshot := running.proxy.stats.Snapshot() + if snapshot.BackendDialSuccess < 2 || snapshot.HandledConns < 2 { + t.Fatalf("recovery stats = %+v, want readiness, healthy, and restored dials", snapshot) + } + }) + } +} + +func TestExternalProxyUnavailableStartupIsBoundedForTCPAndUnix(t *testing.T) { + for _, network := range []string{"tcp", "unix"} { + network := network + t.Run(network, func(t *testing.T) { + address := "" + if network == "tcp" { + ln, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatal(err) + } + address = ln.Addr().String() + _ = ln.Close() + } else { + address = unixSocketPath(t) + } + upstream, err := server.NewExternalDoltServer(externalServerConfig(t, network, address)) + if err != nil { + t.Fatal(err) + } + root := t.TempDir() + port := freeTCPPortForInternalTest(t) + p := NewProxyServer(ProxyOpts{RootDir: root, Port: port, Server: upstream, Stats: &Stats{}}) + ctx, cancel := context.WithTimeout(context.Background(), 700*time.Millisecond) + defer cancel() + start := time.Now() + err = p.ListenAndServe(ctx) + if time.Since(start) > 2*time.Second { + t.Fatalf("unavailable startup exceeded bound: %s", time.Since(start)) + } + if err == nil || (!errors.Is(err, context.DeadlineExceeded) && !errors.Is(err, context.Canceled) && !containsInternal(err.Error(), "database server not ready")) { + t.Fatalf("unavailable startup error = %v", err) + } + pf, readErr := pidfile.Read(root, PIDFileName) + if readErr != nil { + t.Fatal(readErr) + } + if pf != nil { + t.Fatalf("unavailable startup published pidfile: %+v", pf) + } + if got := p.stats.Snapshot().BackendStopCalls; got != 1 { + t.Fatalf("backend stop calls = %d, want 1", got) + } + }) + } +} + +func containsInternal(value, needle string) bool { + return strings.Contains(value, needle) +} diff --git a/internal/storage/dbproxy/proxy/server.go b/internal/storage/dbproxy/proxy/server.go index c096f94dc..1e0ae8c60 100644 --- a/internal/storage/dbproxy/proxy/server.go +++ b/internal/storage/dbproxy/proxy/server.go @@ -84,9 +84,11 @@ const ( readyDialTimeout = 2 * time.Second readyInitialBackoff = 50 * time.Millisecond readyMaxBackoff = 1 * time.Second + backendDialTimeout = 5 * time.Second idleWatcherMinInterval = 1 * time.Second backendStopTimeout = 5 * time.Minute tcpKeepAlivePeriod = 30 * time.Second + backendHealthInterval = 100 * time.Millisecond ) var errIdleTimeout = errors.New("idle timeout reached") @@ -337,6 +339,20 @@ func (p *proxyServer) ListenAndServe(parentCtx context.Context) error { return nil }) g.Go(func() error { return p.idleWatcher(gctx) }) + g.Go(func() error { + t := time.NewTicker(backendHealthInterval) + defer t.Stop() + for { + select { + case <-gctx.Done(): + return nil + case <-t.C: + if !p.server.Running(gctx) { + return errors.New("database server exited") + } + } + } + }) g.Go(func() error { return p.acceptLoop(gctx) }) runErr := g.Wait() @@ -437,7 +453,9 @@ func (p *proxyServer) handleConn(ctx context.Context, client net.Conn) error { }() p.stats.IncBackendDialAttempt() - backend, err := p.server.Dial(ctx) + dialCtx, cancelDial := context.WithTimeout(ctx, backendDialTimeout) + backend, err := p.server.Dial(dialCtx) + cancelDial() if err != nil { p.tracef("handleConn(%s) backend dial error: %v", addr, err) p.stats.IncBackendDialError() diff --git a/internal/storage/dbproxy/proxy/server_test.go b/internal/storage/dbproxy/proxy/server_test.go index 369e2b662..5f7711860 100644 --- a/internal/storage/dbproxy/proxy/server_test.go +++ b/internal/storage/dbproxy/proxy/server_test.go @@ -406,6 +406,53 @@ func TestProxy_BackendDialError(t *testing.T) { assertNoPidFile(t, root) } +func TestProxy_BackendDialFailureHasStableDiagnosticAndNoFallbackFiles(t *testing.T) { + t.Parallel() + + ts := server.New() + stats := &proxy.Stats{} + port := freeTCPPort(t) + root := t.TempDir() + h := runProxy(t, proxy.ProxyOpts{ + RootDir: root, Port: port, Server: ts, Stats: stats, + }) + waitListening(t, root, listenWait) + + before, err := os.ReadDir(root) + require.NoError(t, err) + ts.SetDialErr(errors.New("upstream unavailable")) + c := dialProxy(t, port) + _, err = c.Read(make([]byte, 1)) + assert.Error(t, err) + require.NoError(t, c.Close()) + require.Eventually(t, func() bool { + return stats.Snapshot().BackendDialErrors >= 1 + }, ioTimeout, 10*time.Millisecond) + + logData, err := os.ReadFile(filepath.Join(root, proxy.LogFileName)) + require.NoError(t, err) + assert.Contains(t, string(logData), "backend dial error:") + assert.NotContains(t, string(logData), "fallback") + after, err := os.ReadDir(root) + require.NoError(t, err) + assert.Equal(t, dirEntryNames(before), dirEntryNames(after), "dial failure must not create fallback files") + pf, err := pidfile.Read(root, proxy.PIDFileName) + require.NoError(t, err) + assert.NotNil(t, pf, "proxy remains alive after one upstream dial failure") + + h.Cancel() + require.NoError(t, h.waitErr(t, shutdownWait)) + assertNoPidFile(t, root) +} + +func dirEntryNames(entries []os.DirEntry) []string { + names := make([]string, 0, len(entries)) + for _, entry := range entries { + names = append(names, entry.Name()) + } + return names +} + func TestProxy_IdleTimeout_Fires(t *testing.T) { t.Parallel() diff --git a/internal/storage/dolt/batch_applier.go b/internal/storage/dolt/batch_applier.go index 886eb85cb..bfc778a41 100644 --- a/internal/storage/dolt/batch_applier.go +++ b/internal/storage/dolt/batch_applier.go @@ -36,6 +36,14 @@ var _ issueops.BatchApplier = (*batchApplier)(nil) // The message is composed inside the body because its default names how much // LANDED, which is not knowable until every item has run — an update that // matched and an edge that was already there both land nothing. +// +// Durability contract: a nil error means the applied updates and edges are +// durable in the branch working set. The Dolt history commit runs after the +// SQL transaction (runIssueOperationTxWithMessage) and may be deferred — if it +// fails after retries the changes still landed and ride the next Dolt commit; +// the only signal is the bd.db.post_tx_commit_dropped counter, since the batch +// path has no verify-by-re-read recovery. A nil return is therefore not a retry +// signal: the mutations already applied, and retrying would double-apply. func (o *batchApplier) ApplyBatch(ctx context.Context, request issueops.ApplyBatchRequest) (issueops.ApplyBatchResult, error) { plan, err := storage.PlanApplyBatch(request) if err != nil { diff --git a/internal/storage/dolt/batch_closer.go b/internal/storage/dolt/batch_closer.go index e27dd9c2f..791de16da 100644 --- a/internal/storage/dolt/batch_closer.go +++ b/internal/storage/dolt/batch_closer.go @@ -29,6 +29,15 @@ type batchCloser struct{ store *DoltStore } // CloseBatch runs every close, and the optional claim, in ONE transaction with // one commit. The message is composed inside the body because it names what // LANDED, which is not knowable until the last item has been tried. +// +// Durability contract: a nil error means the closes (and the optional claim) +// are durable in the branch working set. The Dolt history commit runs after +// the SQL transaction (runIssueOperationTxWithMessage) and may be deferred — if +// it fails after retries the change still landed and rides the next Dolt +// commit; the only signal is the bd.db.post_tx_commit_dropped counter, since +// the batch path has no verify-by-re-read recovery. A nil return is therefore +// not a retry signal: the closes already applied, and retrying would +// double-apply. func (o *batchCloser) CloseBatch(ctx context.Context, request issueops.CloseBatchRequest) (issueops.CloseBatchResult, error) { if err := storageissueops.ValidateCloseBatchRequest(request); err != nil { return issueops.CloseBatchResult{}, err diff --git a/internal/storage/dolt/batch_creator.go b/internal/storage/dolt/batch_creator.go index 57753cfa3..78df3d877 100644 --- a/internal/storage/dolt/batch_creator.go +++ b/internal/storage/dolt/batch_creator.go @@ -28,6 +28,14 @@ type batchCreator struct{ store *DoltStore } // message is composed inside the body because its default names how much // LANDED, which is not knowable until every item has been prepared and routed // to its plane. +// +// Durability contract: a nil error means the batch's data is durable in the +// branch working set. The Dolt history commit runs after the SQL transaction +// (runIssueOperationTxWithMessage) and may be deferred — if it fails after +// retries the creates still landed and ride the next Dolt commit; the only +// signal is the bd.db.post_tx_commit_dropped counter, since the batch path has +// no verify-by-re-read recovery. A nil return is therefore not a retry signal: +// the creates already applied, and retrying would double-create. func (o *batchCreator) CreateBatch(ctx context.Context, request issueops.CreateBatchRequest) (issueops.CreateBatchResult, error) { if err := storageissueops.ValidateCreateBatchRequest(request); err != nil { return issueops.CreateBatchResult{}, err diff --git a/internal/storage/dolt/batch_creator_contract_test.go b/internal/storage/dolt/batch_creator_contract_test.go index aa4c1ce1c..db4e6878e 100644 --- a/internal/storage/dolt/batch_creator_contract_test.go +++ b/internal/storage/dolt/batch_creator_contract_test.go @@ -57,6 +57,9 @@ func TestBatchCreatorContract(t *testing.T) { t.Run("DoesNotMutateTheCallerRequest", func(t *testing.T) { conformance.RunBatchCreatorDoesNotMutateTheCallerRequest(t, ctx, fixture) }) + t.Run("EchoesSubSecondTimestamps", func(t *testing.T) { + conformance.RunBatchCreatorEchoesSubSecondTimestamps(t, ctx, fixture) + }) } // newDoltBatchCreatorFixture composes the frozen role kit with this backend's diff --git a/internal/storage/dolt/dolt_commit_ordering_test.go b/internal/storage/dolt/dolt_commit_ordering_test.go new file mode 100644 index 000000000..4c82fdd47 --- /dev/null +++ b/internal/storage/dolt/dolt_commit_ordering_test.go @@ -0,0 +1,550 @@ +package dolt + +import ( + "context" + "database/sql" + "database/sql/driver" + "errors" + "io" + "strings" + "sync" + "sync/atomic" + "testing" + + mysql "github.com/go-sql-driver/mysql" + + "github.com/steveyegge/beads/internal/storage" + storageissueops "github.com/steveyegge/beads/internal/storage/issueops" +) + +// Regression test for the server-mode lost-update bug +// (LatentLabsSpace/NEXUS#92): the issue-mutation path used to run +// CALL DOLT_ADD / CALL DOLT_COMMIT inside the still-open SQL transaction. +// DOLT_ADD stages the whole table from the session's BEGIN-time root, so a +// Dolt commit built before the transaction's commit-time merge writes every +// concurrently-committed row back to its BEGIN-time value. +// +// The fix is an ordering contract: the Dolt add/commit MUST execute strictly +// after driver-level tx.Commit(). This test pins that contract with a +// sequence-capturing driver, so it needs no running Dolt server and holds +// for embedded and server mode alike. + +// --- sequence-capturing driver -------------------------------------------- + +type seqRecorder struct { + mu sync.Mutex + events []string + conns []int // conns[i] is the driver connection that produced events[i] +} + +func (r *seqRecorder) add(conn int, ev string) { + r.mu.Lock() + defer r.mu.Unlock() + r.events = append(r.events, ev) + r.conns = append(r.conns, conn) +} + +func (r *seqRecorder) snapshot() []string { + r.mu.Lock() + defer r.mu.Unlock() + out := make([]string, len(r.events)) + copy(out, r.events) + return out +} + +// snapshotConns returns the events with the connection id each ran on. +func (r *seqRecorder) snapshotConns() ([]string, []int) { + r.mu.Lock() + defer r.mu.Unlock() + evs := make([]string, len(r.events)) + copy(evs, r.events) + cs := make([]int, len(r.conns)) + copy(cs, r.conns) + return evs, cs +} + +type seqConnector struct { + rec *seqRecorder + nextID atomic.Int64 + // queryErr, when set, can fail a statement after it is recorded (the + // driver routes CALL statements through QueryContext via DrainCall). + queryErr func(query string) error + // rows, when set, serves a canned result set for matching queries. + rows func(query string) (driver.Rows, bool) + // commitErr, when set, can fail the driver-level tx COMMIT after it is + // recorded (for exercising the ambiguous commit-phase path). + commitErr func() error +} + +func (c *seqConnector) Connect(context.Context) (driver.Conn, error) { + return &seqConn{parent: c, id: int(c.nextID.Add(1))}, nil +} +func (c *seqConnector) Driver() driver.Driver { return seqDriver{} } + +type seqDriver struct{} + +func (seqDriver) Open(string) (driver.Conn, error) { return nil, driver.ErrSkip } + +type seqConn struct { + parent *seqConnector + id int +} + +func (c *seqConn) Prepare(string) (driver.Stmt, error) { return nil, driver.ErrSkip } +func (c *seqConn) Close() error { return nil } +func (c *seqConn) Begin() (driver.Tx, error) { + return c.BeginTx(context.Background(), driver.TxOptions{}) +} + +func (c *seqConn) BeginTx(context.Context, driver.TxOptions) (driver.Tx, error) { + c.parent.rec.add(c.id, "BEGIN") + return &seqTx{rec: c.parent.rec, conn: c.id, commitErr: c.parent.commitErr}, nil +} + +func (c *seqConn) ExecContext(_ context.Context, query string, _ []driver.NamedValue) (driver.Result, error) { + c.parent.rec.add(c.id, query) + if c.parent.queryErr != nil { + if err := c.parent.queryErr(query); err != nil { + return nil, err + } + } + return driver.RowsAffected(1), nil +} + +func (c *seqConn) QueryContext(_ context.Context, query string, _ []driver.NamedValue) (driver.Rows, error) { + c.parent.rec.add(c.id, query) + if c.parent.queryErr != nil { + if err := c.parent.queryErr(query); err != nil { + return nil, err + } + } + if c.parent.rows != nil { + if rows, ok := c.parent.rows(query); ok { + return rows, nil + } + } + if strings.Contains(query, "FROM dolt_status") { + // doltAddAndCommit's empty-commit guard: report one staged row so the + // post-tx sequence under test still reaches DOLT_COMMIT. + return &valRows{cols: []string{"count"}, vals: [][]driver.Value{{int64(1)}}}, nil + } + return &seqRows{}, nil +} + +type seqTx struct { + rec *seqRecorder + conn int + commitErr func() error +} + +func (t *seqTx) Commit() error { + t.rec.add(t.conn, "COMMIT") + if t.commitErr != nil { + return t.commitErr() + } + return nil +} +func (t *seqTx) Rollback() error { t.rec.add(t.conn, "ROLLBACK"); return nil } + +type seqRows struct{} + +func (*seqRows) Columns() []string { return []string{} } +func (*seqRows) Close() error { return nil } +func (*seqRows) Next(dest []driver.Value) error { return io.EOF } + +// valRows serves one canned row, for tests that need a re-read to see state. +type valRows struct { + cols []string + vals [][]driver.Value + i int +} + +func (r *valRows) Columns() []string { return r.cols } +func (r *valRows) Close() error { return nil } +func (r *valRows) Next(dest []driver.Value) error { + if r.i >= len(r.vals) { + return io.EOF + } + copy(dest, r.vals[r.i]) + r.i++ + return nil +} + +// --- the ordering contract ------------------------------------------------- + +func TestIssueOperationDoltCommitRunsAfterTxCommit(t *testing.T) { + rec := &seqRecorder{} + db := sql.OpenDB(&seqConnector{rec: rec}) + defer func() { _ = db.Close() }() + + s := &DoltStore{db: db} + + err := s.runIssueOperationTx(context.Background(), "bd: update test-1", func(tx *sql.Tx) (storageissueops.ChangedTables, error) { + if _, err := tx.ExecContext(context.Background(), "UPDATE issues SET status = 'in_progress' WHERE id = 'test-1'"); err != nil { + return nil, err + } + return storageissueops.ChangedTables{"issues": true}, nil + }) + if err != nil { + t.Fatalf("runIssueOperationTx: %v", err) + } + + events := rec.snapshot() + idx := func(pred func(string) bool) int { + for i, ev := range events { + if pred(ev) { + return i + } + } + return -1 + } + + commitIdx := idx(func(ev string) bool { return ev == "COMMIT" }) + doltAddIdx := idx(func(ev string) bool { return strings.Contains(ev, "DOLT_ADD") }) + doltCommitIdx := idx(func(ev string) bool { return strings.Contains(ev, "DOLT_COMMIT") }) + + if commitIdx == -1 { + t.Fatalf("no driver-level tx COMMIT recorded; events: %v", events) + } + if doltAddIdx == -1 || doltCommitIdx == -1 { + t.Fatalf("DOLT_ADD/DOLT_COMMIT not recorded; events: %v", events) + } + if doltAddIdx < commitIdx { + t.Errorf("DOLT_ADD ran INSIDE the open transaction (index %d < COMMIT index %d) — lost-update ordering regression; events: %v", + doltAddIdx, commitIdx, events) + } + if doltCommitIdx < commitIdx { + t.Errorf("DOLT_COMMIT ran INSIDE the open transaction (index %d < COMMIT index %d) — lost-update ordering regression; events: %v", + doltCommitIdx, commitIdx, events) + } + if doltCommitIdx < doltAddIdx { + t.Errorf("DOLT_COMMIT before DOLT_ADD; events: %v", events) + } + + // No transaction may still be open when the Dolt commit runs: assert no + // BEGIN after the data COMMIT and before the DOLT_COMMIT. + for i := commitIdx + 1; i < doltCommitIdx; i++ { + if events[i] == "BEGIN" { + t.Errorf("unexpected BEGIN between tx COMMIT and DOLT_COMMIT at index %d; events: %v", i, events) + } + } +} + +// TestIssueOperationNoTablesSkipsDoltCommit pins the no-op contract: an +// operation reporting no changed tables must not create a Dolt commit. +func TestIssueOperationNoTablesSkipsDoltCommit(t *testing.T) { + rec := &seqRecorder{} + db := sql.OpenDB(&seqConnector{rec: rec}) + defer func() { _ = db.Close() }() + + s := &DoltStore{db: db} + + err := s.runIssueOperationTx(context.Background(), "bd: noop", func(tx *sql.Tx) (storageissueops.ChangedTables, error) { + return nil, nil + }) + if err != nil { + t.Fatalf("runIssueOperationTx: %v", err) + } + for _, ev := range rec.snapshot() { + if strings.Contains(ev, "DOLT_COMMIT") { + t.Errorf("no-op operation produced a DOLT_COMMIT; events: %v", rec.snapshot()) + } + } +} + +// TestPostTxDoltAddCommitSharesOneConnection pins the connection contract: +// the post-tx DOLT_ADD…DOLT_COMMIT sequence must run on ONE pinned pool +// connection (GH#2455). With MaxIdleConns(0) every bare s.db statement gets a +// fresh driver connection, so an unpinned sequence deterministically shows +// distinct connection ids — including a DOLT_COMMIT on a different session +// than the DOLT_ADD it depends on, which under a multi-branch pool commits +// the wrong branch's staged root or degrades to nothing-to-commit. +func TestPostTxDoltAddCommitSharesOneConnection(t *testing.T) { + rec := &seqRecorder{} + db := sql.OpenDB(&seqConnector{rec: rec}) + defer func() { _ = db.Close() }() + db.SetMaxIdleConns(0) + + s := &DoltStore{db: db} + + err := s.runIssueOperationTx(context.Background(), "bd: update test-1", func(tx *sql.Tx) (storageissueops.ChangedTables, error) { + if _, err := tx.ExecContext(context.Background(), "UPDATE issues SET status = 'in_progress' WHERE id = 'test-1'"); err != nil { + return nil, err + } + return storageissueops.ChangedTables{"issues": true, "events": true}, nil + }) + if err != nil { + t.Fatalf("runIssueOperationTx: %v", err) + } + + events, conns := rec.snapshotConns() + doltConn := 0 + for i, ev := range events { + if !strings.Contains(ev, "DOLT_ADD") && !strings.Contains(ev, "DOLT_COMMIT") { + continue + } + if doltConn == 0 { + doltConn = conns[i] + continue + } + if conns[i] != doltConn { + t.Fatalf("post-tx dolt statement %q ran on connection %d, want pinned connection %d; events: %v conns: %v", + ev, conns[i], doltConn, events, conns) + } + } + if doltConn == 0 { + t.Fatalf("no DOLT_ADD/DOLT_COMMIT recorded; events: %v", events) + } +} + +// TestPostTxDoltCommitFailureDoesNotFailMutation pins the swallow contract: +// a post-tx DOLT_ADD/DOLT_COMMIT failure happens after the data transaction +// committed, so the mutation IS applied and the operation must report +// success (the failure is logged; the change rides the next dolt commit). +// Surfacing it would make callers treat an applied mutation as failed — +// automated retries double-apply, hooks are skipped, and claim callers +// abandon claims they hold (the wy-x543k inversion). +func TestPostTxDoltCommitFailureDoesNotFailMutation(t *testing.T) { + rec := &seqRecorder{} + connector := &seqConnector{rec: rec} + connector.queryErr = func(query string) error { + if strings.Contains(query, "DOLT_COMMIT") { + return errors.New("boom: injected dolt commit failure") + } + return nil + } + db := sql.OpenDB(connector) + defer func() { _ = db.Close() }() + + s := &DoltStore{db: db} + + err := s.runIssueOperationTx(context.Background(), "bd: update test-1", func(tx *sql.Tx) (storageissueops.ChangedTables, error) { + return storageissueops.ChangedTables{"issues": true}, nil + }) + if err != nil { + t.Fatalf("post-tx dolt commit failure must not fail the mutation (data committed); got: %v", err) + } + + // The data COMMIT and the DOLT_COMMIT attempt must both have run. + events := rec.snapshot() + sawCommit, sawDoltCommit := false, false + for _, ev := range events { + if ev == "COMMIT" { + sawCommit = true + } + if strings.Contains(ev, "DOLT_COMMIT") { + sawDoltCommit = true + } + } + if !sawCommit { + t.Fatalf("data transaction never committed; events: %v", events) + } + if !sawDoltCommit { + t.Fatalf("post-tx DOLT_COMMIT never attempted; events: %v", events) + } +} + +// TestBatchMutatorPostTxDoltCommitFailureReturnsSuccess pins the batch-path +// facet of the swallow contract (PR #6040 review, cat-4 gap). CreateBatch, +// ApplyBatch, and CloseBatch all funnel through runIssueOperationTxWithMessage +// — the message-composing entry point — and, unlike the claim paths, have NO +// verify-by-re-read recovery. So a post-tx DOLT_COMMIT failure on a batch must +// still report success: the batch's data COMMITted (durable in the branch +// working set) and was staged by DOLT_ADD before the trailing history commit +// was attempted, and surfacing the audit-commit failure would make a batch +// caller retry an already-applied batch (double-apply/double-create). This +// drives that exact entry point with the commit message composed from what +// "landed", exactly as the batch mutators do. +func TestBatchMutatorPostTxDoltCommitFailureReturnsSuccess(t *testing.T) { + rec := &seqRecorder{} + connector := &seqConnector{rec: rec} + connector.queryErr = func(query string) error { + if strings.Contains(query, "DOLT_COMMIT") { + return errors.New("boom: injected dolt commit failure") + } + return nil + } + db := sql.OpenDB(connector) + defer func() { _ = db.Close() }() + + s := &DoltStore{db: db} + + // Mirror a batch mutator: run the item work in the tx, then compose the + // commit message from what landed. CreateBatch/ApplyBatch/CloseBatch all + // build their message inside the body for exactly this reason, which is why + // they use runIssueOperationTxWithMessage rather than runIssueOperationTx. + err := s.runIssueOperationTxWithMessage(context.Background(), func(tx *sql.Tx) (storageissueops.ChangedTables, string, error) { + if _, err := tx.ExecContext(context.Background(), "INSERT INTO issues (id) VALUES ('batch-1')"); err != nil { + return nil, "", err + } + return storageissueops.ChangedTables{"issues": true}, "bd: create 1 issue (batch)", nil + }) + if err != nil { + t.Fatalf("batch post-tx dolt commit failure must not fail the mutation (data committed); got: %v", err) + } + + // Durability proof: the batch data must have COMMITted and been staged by + // DOLT_ADD before the swallowed DOLT_COMMIT — i.e. it is in the working set, + // not lost — and the operation still returned success above. + events := rec.snapshot() + idx := func(pred func(string) bool) int { + for i, ev := range events { + if pred(ev) { + return i + } + } + return -1 + } + commitIdx := idx(func(ev string) bool { return ev == "COMMIT" }) + doltAddIdx := idx(func(ev string) bool { return strings.Contains(ev, "DOLT_ADD") }) + doltCommitIdx := idx(func(ev string) bool { return strings.Contains(ev, "DOLT_COMMIT") }) + if commitIdx == -1 { + t.Fatalf("batch data transaction never committed; events: %v", events) + } + if doltAddIdx == -1 { + t.Fatalf("post-tx DOLT_ADD never staged the batch working set; events: %v", events) + } + if doltCommitIdx == -1 { + t.Fatalf("post-tx DOLT_COMMIT never attempted; events: %v", events) + } + if !(commitIdx < doltAddIdx && doltAddIdx < doltCommitIdx) { + t.Fatalf("batch durability ordering violated: want COMMIT(%d) < DOLT_ADD(%d) < DOLT_COMMIT(%d); events: %v", + commitIdx, doltAddIdx, doltCommitIdx, events) + } +} + +// TestPostTxDoltCommitRetriesSerializationConflict pins the retry contract: +// Dolt's rollback-guaranteed commit conflicts (1213/1205, 1105 autocommit +// rollback) were retried when the dolt commit ran inside withRetryTx, and +// they are routine under the concurrent-writer load the post-tx ordering +// targets — so the post-tx sequence must retry them too, not fail (and lose +// the audit commit) on first conflict. +func TestPostTxDoltCommitRetriesSerializationConflict(t *testing.T) { + rec := &seqRecorder{} + connector := &seqConnector{rec: rec} + failures := 0 + connector.queryErr = func(query string) error { + if strings.Contains(query, "DOLT_COMMIT") && failures == 0 { + failures++ + return &mysql.MySQLError{Number: 1213, Message: "Deadlock found when trying to get lock"} + } + return nil + } + db := sql.OpenDB(connector) + defer func() { _ = db.Close() }() + + s := &DoltStore{db: db} + + if err := s.doltAddAndCommitPostTx(context.Background(), []string{"issues"}, "bd: update test-1"); err != nil { + t.Fatalf("serialization conflict must be retried to success, got: %v", err) + } + doltCommits := 0 + for _, ev := range rec.snapshot() { + if strings.Contains(ev, "DOLT_COMMIT") { + doltCommits++ + } + } + if doltCommits < 2 { + t.Fatalf("expected the DOLT_COMMIT to be retried after 1213, saw %d attempt(s)", doltCommits) + } +} + +// TestPostTxDoltCommitSurvivesCallerCancellation pins the detached-context +// contract: the data transaction has already committed when the post-tx +// dolt commit runs, so the caller's request-scoped cancellation (deadline, +// shutdown, Ctrl-C) must not skip the audit commit — the post-tx phase runs +// on a detached context with its own budget. +func TestPostTxDoltCommitSurvivesCallerCancellation(t *testing.T) { + rec := &seqRecorder{} + db := sql.OpenDB(&seqConnector{rec: rec}) + defer func() { _ = db.Close() }() + + s := &DoltStore{db: db} + + ctx, cancel := context.WithCancel(context.Background()) + cancel() // already cancelled before the post-tx commit starts + + if err := s.doltAddAndCommitPostTx(ctx, []string{"issues"}, "bd: update test-1"); err != nil { + t.Fatalf("post-tx dolt commit must survive caller cancellation, got: %v", err) + } + sawDoltCommit := false + for _, ev := range rec.snapshot() { + if strings.Contains(ev, "DOLT_COMMIT") { + sawDoltCommit = true + } + } + if !sawDoltCommit { + t.Fatalf("DOLT_COMMIT never ran under a cancelled caller context; events: %v", rec.snapshot()) + } +} + +// TestAmbiguousTxCommitDoesNotMintDoltCommit pins the ErrCommitIndeterminate +// contract: a connection loss during the SQL COMMIT is ambiguous — and NO +// post-tx dolt commit may be attempted off that error. In server mode the +// branch working set is shared, so staging it after a commit that actually +// rolled back would mint a dolt commit of a CONCURRENT writer's pending rows +// under this operation's message — phantom audit evidence for a mutation +// the caller is simultaneously told did not land. The error must surface +// unchanged so the claim-verify protocol resolves the true outcome. +func TestAmbiguousTxCommitDoesNotMintDoltCommit(t *testing.T) { + rec := &seqRecorder{} + connector := &seqConnector{rec: rec} + connector.commitErr = func() error { return errors.New("invalid connection") } + db := sql.OpenDB(connector) + defer func() { _ = db.Close() }() + + s := &DoltStore{db: db} + + err := s.runIssueOperationTx(context.Background(), "bd: update test-1", func(tx *sql.Tx) (storageissueops.ChangedTables, error) { + return storageissueops.ChangedTables{"issues": true}, nil + }) + if err == nil { + t.Fatal("ambiguous commit loss must surface its error to the caller") + } + if !errors.Is(err, storage.ErrCommitIndeterminate) { + t.Fatalf("commit-phase connection loss must carry ErrCommitIndeterminate, got: %v", err) + } + for _, ev := range rec.snapshot() { + if strings.Contains(ev, "DOLT_ADD") || strings.Contains(ev, "DOLT_COMMIT") { + t.Fatalf("no dolt staging/commit may be attempted after an ambiguous tx commit (phantom audit hazard); events: %v", rec.snapshot()) + } + } +} + +// TestVerifiedClaimResolvesPostTxCommitFailureAsApplied pins the end-to-end +// recovery: a claim whose data transaction committed but whose trailing dolt +// commit failed must resolve as SUCCESS via verify-by-re-read — not surface +// an error for a claim the caller actually holds (the wy-x543k inversion). +func TestVerifiedClaimResolvesPostTxCommitFailureAsApplied(t *testing.T) { + rec := &seqRecorder{} + connector := &seqConnector{rec: rec} + connector.queryErr = func(query string) error { + if strings.Contains(query, "DOLT_COMMIT") { + return errors.New("boom: injected dolt commit failure") + } + return nil + } + connector.rows = func(query string) (driver.Rows, bool) { + // The verify re-read: report the claim as applied. + if strings.Contains(query, "SELECT assignee, status FROM issues") { + return &valRows{ + cols: []string{"assignee", "status"}, + vals: [][]driver.Value{{"claim-actor", "in_progress"}}, + }, true + } + return nil, false + } + db := sql.OpenDB(connector) + defer func() { _ = db.Close() }() + + s := &DoltStore{db: db, serverMode: true} + + write := func() error { + return s.runIssueOperationTx(context.Background(), "bd: claim test-1 by claim-actor", func(tx *sql.Tx) (storageissueops.ChangedTables, error) { + return storageissueops.ChangedTables{"issues": true}, nil + }) + } + if err := s.verifiedClaimWrite(context.Background(), "test-1", claimedBy("claim-actor"), write); err != nil { + t.Fatalf("post-tx dolt commit failure must resolve as applied via re-read, got: %v", err) + } +} diff --git a/internal/storage/dolt/ephemeral_routing.go b/internal/storage/dolt/ephemeral_routing.go index 3f9ba9565..0938a9505 100644 --- a/internal/storage/dolt/ephemeral_routing.go +++ b/internal/storage/dolt/ephemeral_routing.go @@ -3,8 +3,14 @@ package dolt import ( "context" "database/sql" + "errors" "fmt" "strings" + "time" + + "github.com/cenkalti/backoff/v4" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" "github.com/steveyegge/beads/internal/storage/domain" "github.com/steveyegge/beads/internal/storage/issueops" @@ -328,6 +334,29 @@ func (s *DoltStore) demoteToWispInTx(ctx context.Context, tx *sql.Tx, id string, return s.doltAddAndCommitInTx(ctx, tx, permanentIssueAuxTables, fmt.Sprintf("bd: demote %s to wisp", id)) } +// doltAddAndCommitInTx stages and Dolt-commits INSIDE a still-open SQL +// transaction. +// +// HAZARD (LatentLabsSpace/NEXUS#92): DOLT_ADD stages the whole table from +// this session's BEGIN-time root, and DOLT_COMMIT here runs before the +// transaction's commit-time merge — so under concurrent writers the produced +// Dolt commit writes every concurrently-changed row in the staged tables +// back to its BEGIN-time value (lost update). The main issue-mutation path +// (runIssueOperationTxWithMessage) no longer uses this; it commits the SQL +// transaction first and then calls doltAddAndCommitPostTx. +// +// The hazard remains LIVE everywhere the in-tx ordering survives — a larger +// surface than this helper's callers: wisp promote/demote (this file), +// legacy reopen (issues.go), RunInIssueLifecycleTransaction +// (transaction.go), AND the same DOLT_ADD/DOLT_COMMIT-inside-tx pattern +// inlined directly in the legacy DoltStore write methods in issues.go and +// slots.go (UpdateIssue, UpdateIssueChecked, ClaimIssue, ClaimReadyIssue, +// UnclaimIssue, UnclaimIssueIfAssignee, ReclaimExpiredLeases, CloseIssue*, +// DeleteIssue*, MergeMetadata, SlotClear) — several reachable from live CLI +// paths (bd edit/note/priority/defer/unclaim, linear sync) and from the +// uow/domain claim surfaces. Every one of these should migrate to the +// post-tx ordering; until then any of them racing a concurrent writer can +// still silently revert that writer's committed rows. func (s *DoltStore) doltAddAndCommitInTx(ctx context.Context, tx *sql.Tx, tables []string, commitMsg string) error { // Batch/off auto-commit (bd-4wamg): leave the writes in the working set // for a later explicit commit point (bd dolt commit / CommitPending) @@ -368,6 +397,91 @@ func (s *DoltStore) doltAddAndCommitInTx(ctx context.Context, tx *sql.Tx, tables return nil } +const ( + // postTxCommitMaxElapsed is deliberately short: the caller swallows the + // final error, so a long fight for a best-effort commit buys nothing and + // a stuck server (migration lock, read-only manifest) would otherwise + // stall EVERY mutation for the full outage. The 25ms initial interval + // mirrors withRetryTx's conflict tuning so routine 1213/1205 races retry + // promptly. + postTxCommitMaxElapsed = 5 * time.Second + // postTxCommitGrace pads the detached context past the backoff budget. + // The two bounds are NOT redundant: MaxElapsedTime only stops SCHEDULING + // further attempts, while the ctx deadline is the only thing that can + // cancel an attempt already hung in-flight (stuck server mid-statement). + postTxCommitGrace = 2 * time.Second +) + +// doltAddAndCommitPostTx stages and Dolt-commits tables OUTSIDE any open SQL +// transaction, against the session's current — post-merge — root. This is +// the safe ordering for operations whose data transaction has already +// committed: staging whole tables here cannot resurrect pre-transaction row +// states, because the working set already reflects the commit-time merge +// with concurrent writers (see runIssueOperationTxWithMessage). +// +// If this fails, the data change has still landed: it remains in the branch +// working set and is carried into the next Dolt commit on the branch +// (runIssueOperationTxWithMessage logs and swallows the failure for exactly +// that reason — see the failure-mode note there). +// +// Division of labor with doltAddAndCommit (#5740 review, blocking item 3): +// that helper owns everything about publishing — deferral (VersionCommitDeferred), +// the pinned connection (GH#2455), the staged-set guard, circuit admission, +// and publication-failure accounting via recordDoltPublicationFailure. This +// wrapper adds exactly two things and no second copy of any of them: a +// detached context, and a retry over the conflicts that helper does not +// retry. +// +// The retry is deliberately narrower than withRetryTx's classifier was when +// the dolt commit still ran in-tx. It covers only Dolt's rollback-guaranteed +// commit conflicts (1213/1205 serialization, 1105 autocommit rollback) — +// routine under the concurrent-writer load this path exists for, carrying no +// breaker accounting of their own, and safe to replay because re-staging is +// idempotent and a replayed DOLT_COMMIT whose first attempt actually landed +// degrades to nothing-to-commit, which doltAddAndCommit swallows. Connection +// losses are NOT retried here: doltAddAndCommit has already recorded them +// against the circuit breaker, so replaying would count one failed +// publication through the breaker several times and could trip it for +// unrelated operations — for a trailing commit whose data is already +// durable. Those failures go straight back to the caller, which swallows and +// counts them once (bd.db.post_tx_commit_dropped). +func (s *DoltStore) doltAddAndCommitPostTx(ctx context.Context, tables []string, commitMsg string) error { + // Detach from the caller's cancellation: the data transaction has already + // committed, so a request deadline or shutdown landing in this window + // must not deterministically skip the audit commit (values — tracing — + // are preserved). The commit gets its own budget instead. + ctx = context.WithoutCancel(ctx) + ctx, cancel := context.WithTimeout(ctx, postTxCommitMaxElapsed+postTxCommitGrace) + defer cancel() + + bo := backoff.NewExponentialBackOff() + bo.InitialInterval = 25 * time.Millisecond + bo.MaxElapsedTime = postTxCommitMaxElapsed + var lastErr error + err := backoff.Retry(func() error { + err := s.doltAddAndCommit(ctx, tables, commitMsg) + if err == nil { + return nil + } + lastErr = err + // Mirror withRetryTx's accounting so conflict pressure that moved out + // of it stays visible on the same counters. + if isSerializationError(err) || isDoltAutocommitRollbackError(err) { + doltMetrics.serializationErrors.Add(ctx, 1) + doltMetrics.writeRetries.Add(ctx, 1, metric.WithAttributes(attribute.String("type", "serialization"))) + return err + } + return backoff.Permanent(err) + }, backoff.WithContext(bo, ctx)) + if err != nil && lastErr != nil && !errors.Is(err, lastErr) { + // backoff.Retry returns the bare ctx error when the deadline expires + // mid-sleep, discarding the last real Dolt failure — the only + // diagnostic for a swallowed audit commit. Keep both. + return fmt.Errorf("%w (last attempt: %w)", err, lastErr) + } + return err +} + // getAllWispDependencyRecords returns all wisp dependency records, keyed by issue_id. // Used by DetectCycles to include wisp dependencies in cross-table cycle detection. (bd-xe27) func (s *DoltStore) getAllWispDependencyRecords(ctx context.Context) (map[string][]*types.Dependency, error) { diff --git a/internal/storage/dolt/gateway_session_test.go b/internal/storage/dolt/gateway_session_test.go new file mode 100644 index 000000000..53b41b8db --- /dev/null +++ b/internal/storage/dolt/gateway_session_test.go @@ -0,0 +1,92 @@ +package dolt + +import ( + "context" + "database/sql" + "errors" + "regexp" + "strings" + "testing" + + "github.com/DATA-DOG/go-sqlmock" +) + +// gatewaySessionMock stands in for a gateway that answers SELECT DATABASE() +// with the database it actually put the session on — which need not be the one +// named in the handshake. +func gatewaySessionMock(t *testing.T, answer any) *sql.DB { + t.Helper() + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New(): %v", err) + } + t.Cleanup(func() { _ = db.Close() }) + mock.ExpectQuery(regexp.QuoteMeta("SELECT DATABASE()")). + WillReturnRows(sqlmock.NewRows([]string{"DATABASE()"}).AddRow(answer)) + return db +} + +func TestAssertGatewaySessionDatabase(t *testing.T) { + ctx := context.Background() + + t.Run("session on the requested database passes", func(t *testing.T) { + if err := assertGatewaySessionDatabase(ctx, gatewaySessionMock(t, "team_b"), "team_b"); err != nil { + t.Fatalf("assertGatewaySessionDatabase() = %v, want nil", err) + } + }) + + t.Run("case-folded match passes", func(t *testing.T) { + if err := assertGatewaySessionDatabase(ctx, gatewaySessionMock(t, "Team_B"), "team_b"); err != nil { + t.Fatalf("assertGatewaySessionDatabase() = %v, want nil", err) + } + }) + + // Before this assertion the direct gateway open accepted the mismatch in + // silence: bd went on to read team_a's identity and adopt it as the + // workspace's own, on a `bd init --database=team_b` that never reached + // team_b at all. + t.Run("credential-scoped gateway is caught and both databases are named", func(t *testing.T) { + err := assertGatewaySessionDatabase(ctx, gatewaySessionMock(t, "team_a"), "team_b") + if err == nil { + t.Fatal("assertGatewaySessionDatabase() = nil, want a mismatch error") + } + for _, want := range []string{ + `connected this session to database "team_a"`, + `not the requested "team_b"`, + "ask the server administrator", + "re-run init without --database", + } { + if !strings.Contains(err.Error(), want) { + t.Fatalf("mismatch message %q missing %q", err.Error(), want) + } + } + }) + + t.Run("no session database is reported as not provisioned or not granted", func(t *testing.T) { + for _, answer := range []any{nil, ""} { + err := assertGatewaySessionDatabase(ctx, gatewaySessionMock(t, answer), "team_b") + if err == nil { + t.Fatalf("assertGatewaySessionDatabase(%v) = nil, want an error", answer) + } + for _, want := range []string{"no database", "not provisioned", "has not been granted access"} { + if !strings.Contains(err.Error(), want) { + t.Fatalf("message %q missing %q", err.Error(), want) + } + } + } + }) + + t.Run("query failure surfaces the driver error", func(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New(): %v", err) + } + t.Cleanup(func() { _ = db.Close() }) + cause := errors.New("connection reset by peer") + mock.ExpectQuery(regexp.QuoteMeta("SELECT DATABASE()")).WillReturnError(cause) + + if got := assertGatewaySessionDatabase(ctx, db, "team_b"); !errors.Is(got, cause) { + t.Fatalf("assertGatewaySessionDatabase() = %v, want it to wrap %v", got, cause) + } + }) +} diff --git a/internal/storage/dolt/history_presence_contract_test.go b/internal/storage/dolt/history_presence_contract_test.go new file mode 100644 index 000000000..08ecfec87 --- /dev/null +++ b/internal/storage/dolt/history_presence_contract_test.go @@ -0,0 +1,43 @@ +package dolt + +import ( + "context" + "testing" + + "github.com/steveyegge/beads/internal/storage/storagecontract" + "github.com/steveyegge/beads/internal/types" +) + +// TestHistoryPresenceContract runs the HistoryPresence contract against the +// server-backed store. It shares a body with the embedded leg +// (issueops.HistoricalIssueIDsInTx) and differs only in how the read +// connection is opened, which is what this wiring checks. +func TestHistoryPresenceContract(t *testing.T) { + store, cleanup := setupTestStore(t) + defer cleanup() + ctx, cancel := testContext(t) + defer cancel() + + fixture := storagecontract.HistoryPresenceFixture{ + Prefix: "hp", + Presence: store, + CreateIssue: func(ctx context.Context, id, title string) error { + return store.CreateIssue(ctx, &types.Issue{ + ID: id, + Title: title, + Status: types.StatusOpen, + Priority: 2, + IssueType: types.TypeTask, + }, "tester") + }, + DeleteIssue: store.DeleteIssue, + Commit: store.Commit, + CurrentCommit: store.GetCurrentCommit, + ResetHard: func(ctx context.Context, commit string) error { + _, err := store.db.ExecContext(ctx, "CALL DOLT_RESET('--hard', ?)", commit) + return err + }, + } + + storagecontract.RunHistoryPresenceContract(t, ctx, fixture) +} diff --git a/internal/storage/dolt/initschema_gate_test.go b/internal/storage/dolt/initschema_gate_test.go index 9b8f97223..5fcdd0423 100644 --- a/internal/storage/dolt/initschema_gate_test.go +++ b/internal/storage/dolt/initschema_gate_test.go @@ -91,6 +91,27 @@ func TestInitSchemaOnDBWithRetryAndGate_GateErrorClassification(t *testing.T) { } }) + t.Run("shared-store refusal is permanent, not retried", func(t *testing.T) { + // The classification keys on the error TYPE, so the new #5920 decision + // inherits it — pinned explicitly because retrying this particular + // refusal would mean retrying it into the migration it just refused. + calls := 0 + gate := func(context.Context, *sql.DB) error { + calls++ + return &schema.RemoteMigrateGateError{ + CurrentVersion: 65, LatestVersion: 66, Pending: 1, + Decision: "shared-no-remote", + } + } + _, err := initSchemaOnDBWithRetryAndGate(ctx, db, gate) + if !schema.IsRemoteMigrateGateError(err) { + t.Fatalf("err = %T (%v), want *schema.RemoteMigrateGateError", err, err) + } + if calls != 1 { + t.Fatalf("gate calls = %d, want 1 (a shared-store refusal must not be retried)", calls) + } + }) + t.Run("non-retryable probe error is permanent", func(t *testing.T) { calls := 0 gate := func(context.Context, *sql.DB) error { diff --git a/internal/storage/dolt/issue_operations_tx.go b/internal/storage/dolt/issue_operations_tx.go index 74d3bc507..6a1e36349 100644 --- a/internal/storage/dolt/issue_operations_tx.go +++ b/internal/storage/dolt/issue_operations_tx.go @@ -3,7 +3,7 @@ package dolt import ( "context" "database/sql" - "sort" + "log" storageissueops "github.com/steveyegge/beads/internal/storage/issueops" ) @@ -19,20 +19,85 @@ func (s *DoltStore) runIssueOperationTx(ctx context.Context, commitMsg string, f // commit message is only known once the body has run. A ready claim names the // id it won, and nothing outside the transaction can predict which one that // is, so the message is composed where the selection happens. +// +// Ordering contract (lost-update fix, LatentLabsSpace/NEXUS#92): the Dolt +// commit MUST run after the SQL transaction commits, never inside it. +// DOLT_ADD stages the ENTIRE table from the session's transaction root; when +// it ran inside the still-open transaction, the Dolt commit was built from +// the pre-merge BEGIN-time snapshot with the then-current branch HEAD as its +// parent — so every row a concurrent writer had committed inside the +// transaction's window was silently written back to its BEGIN-time value +// (observed in production as reverted claims). Committing the SQL +// transaction first lets Dolt's commit-time three-way merge reconcile this +// session's changes with concurrent writers; the post-commit DOLT_ADD then +// stages the merged state, which cannot resurrect stale rows. +// +// Failure mode note: if the post-commit Dolt commit fails (after retries), +// the data change HAS landed — it remains in the branch working set and +// rides the next Dolt commit on the branch. That failure is therefore +// logged and NOT propagated: the mutation succeeded, and surfacing an error +// here would make every caller treat an applied mutation as failed — +// automated retries double-apply (duplicate creates/comments), completion +// hooks are skipped for a persisted state change, and the claim verify +// wrappers report claims the caller actually holds as failed (the wy-x543k +// inversion). The only cost of a swallowed failure is a missing dolt-log +// audit line until the next commit. +// +// Caller contract (non-verified batch mutators): CreateBatch, ApplyBatch, and +// CloseBatch route through here and, unlike the claim paths, have no +// verify-by-re-read recovery — so for them a nil error means "data durable in +// the branch working set; the trailing Dolt history commit may be deferred and +// is observable only via bd.db.post_tx_commit_dropped." That is the conscious, +// documented contract: a nil return is not a retry signal, and propagating a +// publish-failure sentinel to those callers would reintroduce the double-apply +// inversion this reorder exists to prevent. +// +// Audit-trail caveat (server mode): sessions on one branch share the working +// set, so a concurrent writer's DOLT_COMMIT can absorb this operation's rows +// under its own message; this operation's commit then degrades to +// nothing-to-commit and its message never reaches dolt log. The data is +// intact — doltAddAndCommit logs the absorption so the missing audit line is +// explicable. func (s *DoltStore) runIssueOperationTxWithMessage(ctx context.Context, fn func(*sql.Tx) (storageissueops.ChangedTables, string, error)) error { - return s.withRetryTx(ctx, func(tx *sql.Tx) error { - tables, commitMsg, err := fn(tx) - if err != nil { - return err - } - if len(tables) == 0 { - return nil - } - staged := make([]string, 0, len(tables)) - for table := range tables { - staged = append(staged, table) - } - sort.Strings(staged) - return s.doltAddAndCommitInTx(ctx, tx, staged, commitMsg) + var tables storageissueops.ChangedTables + var commitMsg string + err := s.withRetryTx(ctx, func(tx *sql.Tx) error { + // Plain assignment (not append-into-captured-state): a retried + // transaction re-runs the body and overwrites both values, so a + // rolled-back attempt cannot leak tables into the commit. + var err error + tables, commitMsg, err = fn(tx) + return err }) + if err != nil { + // Includes ErrCommitIndeterminate (ambiguous commit loss): NO post-tx + // dolt commit is attempted there. If the ambiguous commit actually + // landed, its audit entry is lost (the change rides the next dolt + // commit) — accepted, because attempting one would stage the SHARED + // branch working set, and when the commit actually rolled back that + // mints a dolt commit of a concurrent writer's pending rows under + // THIS operation's message (phantom audit evidence), fires even for + // definite rollbacks (a caller cancellation during tx.Commit is also + // tagged indeterminate), and delays the claim-verify re-read that + // resolves the true outcome. + return err + } + staged := sortedDirtyTables(tables) + if len(staged) == 0 { + return nil + } + if commitMsg == "" { + // A body can dirty tables without composing a message (e.g. a ready + // claim whose side effects landed but which claimed nothing); never + // mint a Dolt commit with an empty message. + commitMsg = "bd: issue operation" + } + if err := s.doltAddAndCommitPostTx(ctx, staged, commitMsg); err != nil { + // See the failure-mode note above: the mutation is applied and + // durable; only the trailing history commit is missing, and the + // change rides the next dolt commit on the branch. + doltMetrics.postTxCommitDropped.Add(ctx, 1) + log.Printf("dolt: post-tx dolt commit failed for %q (data already committed; change rides the next dolt commit): %v", commitMsg, err) + } + return nil } diff --git a/internal/storage/dolt/issues.go b/internal/storage/dolt/issues.go index 999a002a6..3efcde47c 100644 --- a/internal/storage/dolt/issues.go +++ b/internal/storage/dolt/issues.go @@ -662,7 +662,8 @@ func (s *DoltStore) deleteIssue(ctx context.Context, id string) error { } if err := s.withWriteTx(ctx, func(tx *sql.Tx) error { - if err := issueops.DeleteIssueInTx(ctx, tx, id); err != nil { + // storage.DeleteIssue carries no actor, so the journal rows record none. + if err := issueops.DeleteIssueInTx(ctx, tx, id, ""); err != nil { return err } @@ -738,7 +739,8 @@ func (s *DoltStore) deleteIssues(ctx context.Context, ids []string, cascade bool var result *types.DeleteIssuesResult if err := s.withWriteTx(ctx, func(tx *sql.Tx) error { - r, err := issueops.DeleteIssuesInTx(ctx, tx, ids, cascade, force, dryRun) + // storage.DeleteIssues carries no actor, so the journal rows record none. + r, err := issueops.DeleteIssuesInTx(ctx, tx, ids, cascade, force, dryRun, "") if err != nil { result = r return err diff --git a/internal/storage/dolt/journal_coverage_test.go b/internal/storage/dolt/journal_coverage_test.go index d051960ec..5bbda0b4b 100644 --- a/internal/storage/dolt/journal_coverage_test.go +++ b/internal/storage/dolt/journal_coverage_test.go @@ -12,6 +12,7 @@ import ( "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/storage/issueops" "github.com/steveyegge/beads/internal/types" + publicops "github.com/steveyegge/beads/issueops" ) // errRollbackProbe is the sentinel a journal test returns from a transaction @@ -955,11 +956,70 @@ func TestEventsJournal_ActorAttribution(t *testing.T) { t.Errorf("defer auto-wake row actor = %q, %v; want %q", actor, ok, issueops.DeferWakeActor) } - // Delete plumbing carries no actor; the row records the empty string. + // storage.DeleteIssue is the ACTORLESS SYSTEM SURFACE — the interface gc + // decay, molecule cleanup and `bd doctor --fix` reach for, which has no + // request behind it and no actor to record. Its row is empty by contract, + // not by omission: the role-path case below is what pins the attributed + // half, and the two together are the whole of the 0066 promise. if err := store.DeleteIssue(ctx, iss.ID); err != nil { t.Fatalf("delete: %v", err) } if actor, ok := journalActorFor(t, store, "delete", iss.ID); !ok || actor != "" { - t.Errorf("delete row actor = %q, %v; want empty (actorless plumbing)", actor, ok) + t.Errorf("delete row actor = %q, %v; want empty (actorless system surface)", actor, ok) + } +} + +// TestEventsJournal_DeleteRoleAttributesTheRequester is the #5985 regression: +// `bd delete --force --actor A` must land `actor = A` on the delete row AND +// on the cascade dep_remove rows the same request produces. +// +// It goes through the ROLE (store.Deleter()), which is what every user-initiated +// delete reaches — not storage.DeleteIssue, the actorless system surface the +// case above pins. That distinction is the whole bug: the actor was in hand at +// the role body, which already passed it to the reference rewrite, and was +// dropped one call below. +// +// The assertions read the DATABASE rather than a returned result, because the +// column is what an LWW consumer reconciling replicas actually attributes from. +func TestEventsJournal_DeleteRoleAttributesTheRequester(t *testing.T) { + store, cleanup := setupTestStore(t) + defer cleanup() + ctx := context.Background() + enableJournalForTest(t, store) + + target := &types.Issue{ID: "bd-delrole-target", Title: "doomed", IssueType: types.TypeTask, Status: types.StatusOpen} + dependent := &types.Issue{ID: "bd-delrole-dependent", Title: "survivor", IssueType: types.TypeTask, Status: types.StatusOpen} + for _, iss := range []*types.Issue{target, dependent} { + if err := store.CreateIssue(ctx, iss, "creator-1"); err != nil { + t.Fatalf("create %s: %v", iss.ID, err) + } + } + // An INBOUND edge, so the delete has an edge to cascade off and needs Force + // to orphan its dependent — the shape #5985 reported. + if err := store.AddDependency(ctx, &types.Dependency{ + IssueID: dependent.ID, DependsOnID: target.ID, Type: types.DepBlocks, + }, "linker-1"); err != nil { + t.Fatalf("add dep: %v", err) + } + clearJournal(t, store) + + deleter, err := store.Deleter() + if err != nil { + t.Fatalf("Deleter(): %v", err) + } + if _, err := deleter.Delete(ctx, publicops.DeleteRequest{ + IDs: []string{target.ID}, Force: true, Actor: "deleter-1", + }); err != nil { + t.Fatalf("delete: %v", err) + } + + if actor, ok := journalActorFor(t, store, "delete", target.ID); !ok || actor != "deleter-1" { + t.Errorf("delete row actor = %q, %v; want %q", actor, ok, "deleter-1") + } + // The cascade edge removal is journaled under the edge's SOURCE — the + // surviving dependent — and belongs to the identity whose delete removed it, + // not to whoever created the edge. + if actor, ok := journalActorFor(t, store, "dep_remove", dependent.ID); !ok || actor != "deleter-1" { + t.Errorf("cascade dep_remove row actor = %q, %v; want %q", actor, ok, "deleter-1") } } diff --git a/internal/storage/dolt/lenient_open_dirty_tables_integration_test.go b/internal/storage/dolt/lenient_open_dirty_tables_integration_test.go new file mode 100644 index 000000000..e8eaa0727 --- /dev/null +++ b/internal/storage/dolt/lenient_open_dirty_tables_integration_test.go @@ -0,0 +1,236 @@ +//go:build integration && !windows + +package dolt + +import ( + "context" + "database/sql" + "errors" + "os" + "path/filepath" + "strconv" + "testing" + "time" + + _ "github.com/go-sql-driver/mysql" + + "github.com/steveyegge/beads/internal/doltserver" + "github.com/steveyegge/beads/internal/storage/doltutil" + "github.com/steveyegge/beads/internal/storage/schema" + "github.com/steveyegge/beads/internal/testutil" + "github.com/steveyegge/beads/internal/testutil/integration" +) + +// TestServerModeLenientOpenDirtyTableGate covers gastownhall/beads#5781, the +// server-mode counterpart of #4566, which was fixed for embedded only. A pending +// schema migration that alters a table carrying uncommitted rows must refuse a +// plain writable open, but the working-set-reconcile open behind "bd dolt +// commit" / "bd vc commit" (Config.LenientOpen) must still succeed, because +// that commit is the refusal's own documented recovery. Against an external +// Dolt server there is no equivalent of deleting the local database, so +// without this the operator's only escape is hand-issuing DOLT_ADD/DOLT_COMMIT +// through the raw dolt client. +func TestServerModeLenientOpenDirtyTableGate(t *testing.T) { + integration.RequireDolt(t) + port, err := testutil.FindFreePort() + if err != nil { + t.Fatalf("find free port: %v", err) + } + t.Setenv("BEADS_DOLT_SHARED_SERVER", "0") + t.Setenv("BEADS_DOLT_SERVER_PORT", strconv.Itoa(port)) + t.Setenv("BEADS_DOLT_PORT", "") + t.Setenv("BEADS_DOLT_PASSWORD", "") + + beadsDir := filepath.Join(t.TempDir(), ".beads") + if err := os.MkdirAll(beadsDir, 0o700); err != nil { + t.Fatalf("mkdir beads dir: %v", err) + } + state, err := doltserver.Start(beadsDir) + if err != nil { + t.Fatalf("start local Dolt server: %v", err) + } + t.Cleanup(func() { + current, stateErr := doltserver.IsRunning(beadsDir) + if stateErr != nil { + t.Errorf("check local Dolt server before stop: %v", stateErr) + return + } + if current == nil || !current.Running { + return + } + if err := doltserver.Stop(beadsDir); err != nil { + t.Errorf("stop local Dolt server: %v", err) + } + }) + + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + + t.Run("dirty database deadlocks a plain open and recovers through a lenient one", func(t *testing.T) { + const database = "lenient_dirty" + cfg := lenientOpenConfig(beadsDir, state.Port, database) + admin := prepareLenientOpenDatabaseAtV51(t, ctx, state.Port, database) + defer admin.Close() + + if _, err := admin.ExecContext(ctx, + "INSERT INTO issues (id, title, description, design, acceptance_criteria, notes) VALUES (?, ?, '', '', '', '')", + database+"-1", "uncommitted issue", + ); err != nil { + t.Fatalf("dirty issues table: %v", err) + } + + gated, gateErr := New(ctx, cfg) + if gateErr == nil { + gated.Close() + t.Fatal("New (plain writable open) = nil, want *schema.DirtyTablesError") + } + var dirtyErr *schema.DirtyTablesError + if !errors.As(gateErr, &dirtyErr) { + t.Fatalf("New error = %T (%v), want error wrapping *schema.DirtyTablesError", gateErr, gateErr) + } + if !containsTable(dirtyErr.Tables, "issues") { + t.Fatalf("DirtyTablesError.Tables = %v, want to include %q", dirtyErr.Tables, "issues") + } + + lenientCfg := lenientOpenConfig(beadsDir, state.Port, database) + lenientCfg.LenientOpen = true + store, err := New(ctx, lenientCfg) + if err != nil { + t.Fatalf("New (LenientOpen) = %v, want a usable store", err) + } + defer store.Close() + + if got := lenientOpenSchemaVersion(t, ctx, store.db); got != 51 { + t.Fatalf("schema version after lenient open = %d, want 51 (the migration must stay skipped)", got) + } + + if err := store.Commit(ctx, "checkpoint before migration"); err != nil { + t.Fatalf("Commit: %v", err) + } + if got := lenientOpenDirtyCount(t, ctx, store.db); got != 0 { + t.Fatalf("dolt_status rows after commit = %d, want 0", got) + } + store.Close() + + migrated, err := New(ctx, lenientOpenConfig(beadsDir, state.Port, database)) + if err != nil { + t.Fatalf("New (post-commit plain open): %v", err) + } + defer migrated.Close() + if got := lenientOpenSchemaVersion(t, ctx, migrated.db); got != schema.LatestVersion() { + t.Fatalf("schema version after post-commit open = %d, want latest %d", got, schema.LatestVersion()) + } + }) + + t.Run("clean database still migrates through a lenient open", func(t *testing.T) { + const database = "lenient_clean" + admin := prepareLenientOpenDatabaseAtV51(t, ctx, state.Port, database) + defer admin.Close() + + cfg := lenientOpenConfig(beadsDir, state.Port, database) + cfg.LenientOpen = true + store, err := New(ctx, cfg) + if err != nil { + t.Fatalf("New (LenientOpen, clean database): %v", err) + } + defer store.Close() + if got := lenientOpenSchemaVersion(t, ctx, store.db); got != schema.LatestVersion() { + t.Fatalf("schema version = %d, want latest %d (a lenient open must not skip migrations wholesale)", + got, schema.LatestVersion()) + } + }) +} + +func lenientOpenConfig(beadsDir string, port int, database string) *Config { + return &Config{ + Path: filepath.Join(beadsDir, database), + BeadsDir: beadsDir, + ServerHost: "127.0.0.1", + ServerPort: port, + ServerUser: "root", + Database: database, + CommitterName: "Beads Test", + CommitterEmail: "beads@example.com", + MaxOpenConns: 1, + } +} + +// prepareLenientOpenDatabaseAtV51 creates database on the running server, +// migrates it to schema v51, and commits that baseline so the working set +// starts clean. v51 leaves every later migration pending, including several +// that alter `issues`. Returns an open connection to the prepared database. +func prepareLenientOpenDatabaseAtV51(t *testing.T, ctx context.Context, port int, database string) *sql.DB { + t.Helper() + adminDSN := doltutil.ServerDSN{Host: "127.0.0.1", Port: port, User: "root"}.String() + admin, err := sql.Open("mysql", adminDSN) + if err != nil { + t.Fatalf("open admin connection: %v", err) + } + if _, err := admin.ExecContext(ctx, "CREATE DATABASE `"+database+"`"); err != nil { + admin.Close() + t.Fatalf("create database %s: %v", database, err) + } + if err := admin.Close(); err != nil { + t.Fatalf("close admin connection: %v", err) + } + + dsn := doltutil.ServerDSN{Host: "127.0.0.1", Port: port, User: "root", Database: database}.String() + db, err := sql.Open("mysql", dsn) + if err != nil { + t.Fatalf("open %s: %v", database, err) + } + conn, err := db.Conn(ctx) + if err != nil { + db.Close() + t.Fatalf("pin %s: %v", database, err) + } + defer conn.Close() + if _, err := schema.MigrateUpTo(ctx, conn, 51); err != nil { + db.Close() + t.Fatalf("migrate %s to v51: %v", database, err) + } + if _, err := conn.ExecContext(ctx, + "CALL DOLT_COMMIT('-Am', 'test: v51 baseline', '--author', 'Beads Test ')", + ); err != nil { + db.Close() + t.Fatalf("commit v51 baseline: %v", err) + } + if got := lenientOpenSchemaVersion(t, ctx, conn); got != 51 { + db.Close() + t.Fatalf("baseline schema version = %d, want 51", got) + } + return db +} + +type lenientOpenQueryer interface { + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func lenientOpenSchemaVersion(t *testing.T, ctx context.Context, db lenientOpenQueryer) int { + t.Helper() + var version int + if err := db.QueryRowContext(ctx, + "SELECT COALESCE(MAX(version), 0) FROM schema_migrations", + ).Scan(&version); err != nil { + t.Fatalf("read schema version: %v", err) + } + return version +} + +func lenientOpenDirtyCount(t *testing.T, ctx context.Context, db lenientOpenQueryer) int { + t.Helper() + var count int + if err := db.QueryRowContext(ctx, "SELECT COUNT(*) FROM dolt_status").Scan(&count); err != nil { + t.Fatalf("count dolt_status: %v", err) + } + return count +} + +func containsTable(tables []string, want string) bool { + for _, table := range tables { + if table == want { + return true + } + } + return false +} diff --git a/internal/storage/dolt/lifecycle_create_contract_test.go b/internal/storage/dolt/lifecycle_create_contract_test.go index 267075c98..b8b40def1 100644 --- a/internal/storage/dolt/lifecycle_create_contract_test.go +++ b/internal/storage/dolt/lifecycle_create_contract_test.go @@ -36,6 +36,9 @@ func TestLifecycleCreateContract(t *testing.T) { t.Run("WritesEveryScalarField", func(t *testing.T) { conformance.RunLifecycleCreateWritesEveryScalarField(t, ctx, fixture) }) + t.Run("EchoesSubSecondTimestamps", func(t *testing.T) { + conformance.RunLifecycleCreateEchoesSubSecondTimestamps(t, ctx, fixture) + }) } func newDoltLifecycleCreateFixture(t *testing.T, prefix string) (conformance.LifecycleCreateFixture, context.Context, func()) { diff --git a/internal/storage/dolt/open.go b/internal/storage/dolt/open.go index a79f62ea8..25e6c477c 100644 --- a/internal/storage/dolt/open.go +++ b/internal/storage/dolt/open.go @@ -80,11 +80,13 @@ func ApplyResolvedServerPort(beadsDir string, cfg *Config) { // requireDoltBackend keeps metadata-driven callers from bypassing the storage // factory and interpreting another backend's workspace as Dolt. Removed backend // identifiers deliberately remain recognizable in metadata so this check can fail -// closed instead of opening a new, empty Dolt database. -func requireDoltBackend(fileCfg *configfile.Config) error { +// closed instead of opening a new, empty Dolt database. beadsDir is the workspace +// the config came from, so the refusal can offer the metadata heal when that +// workspace already holds a Dolt database. +func requireDoltBackend(fileCfg *configfile.Config, beadsDir string) error { switch fileCfg.Backend { case configfile.BackendPostgres, configfile.BackendMySQL, configfile.BackendSQLite: - return fmt.Errorf("configured storage backend %q is no longer supported and cannot be opened as Dolt: %s", fileCfg.Backend, configfile.RemovedBackendDetail(fileCfg.Backend)) + return fmt.Errorf("configured storage backend %q is no longer supported and cannot be opened as Dolt: %s", fileCfg.Backend, configfile.RemovedBackendDetailAt(fileCfg.Backend, beadsDir, fileCfg)) } if !configfile.IsSupportedBackend(fileCfg.Backend) { return fmt.Errorf("configured storage backend %q in metadata.json is not recognized and cannot be opened as Dolt; %s", fileCfg.Backend, configfile.BackendNotOpenedGuarantee) @@ -114,7 +116,7 @@ func NewFromConfigWithCLIOptions(ctx context.Context, beadsDir string, cfg *Conf if fileCfg == nil { fileCfg = configfile.DefaultConfig() } - if err := requireDoltBackend(fileCfg); err != nil { + if err := requireDoltBackend(fileCfg, beadsDir); err != nil { return nil, err } @@ -144,7 +146,7 @@ func NewFromConfigWithOptions(ctx context.Context, beadsDir string, cfg *Config) if fileCfg == nil { fileCfg = configfile.DefaultConfig() } - if err := requireDoltBackend(fileCfg); err != nil { + if err := requireDoltBackend(fileCfg, beadsDir); err != nil { return nil, err } diff --git a/internal/storage/dolt/ready_claimer.go b/internal/storage/dolt/ready_claimer.go index 66c039da2..1117c49e7 100644 --- a/internal/storage/dolt/ready_claimer.go +++ b/internal/storage/dolt/ready_claimer.go @@ -66,6 +66,11 @@ func (c *readyClaimer) ClaimNext(ctx context.Context, request issueops.ClaimNext write := func() (*types.Issue, error) { var claimed *types.Issue err := c.store.runIssueOperationTxWithMessage(ctx, func(tx *sql.Tx) (storageissueops.ChangedTables, string, error) { + // Reset on every attempt: withRetryTx replays this body, and a + // replay that finds nothing ready must not leak the previous + // attempt's selection into the verify pass (which would verify an + // issue this call did not claim and fail loudly and falsely). + claimed = nil attempt, tables, err := storageissueops.ExecuteClaimNext(ctx, tx, request.Actor, filter) if err != nil { return nil, "", err @@ -78,6 +83,10 @@ func (c *readyClaimer) ClaimNext(ctx context.Context, request issueops.ClaimNext // The message names the claimed issue because that is the one `bd // dolt log` affordance callers actually grep, and it is what the // store's own ClaimReadyIssue wrote before the claim moved here. + // Post-tx ordering caveat: a concurrent writer's commit can absorb + // this one (nothing-to-commit), in which case the claim appears + // under the OTHER writer's message — the grep is best-effort + // evidence of a claim, and its absence is not proof of failure. return tables, storageissueops.ClaimNextCommitMessage(attempt.Claimed.ID), nil }) return claimed, err diff --git a/internal/storage/dolt/shared_server_predicate_test.go b/internal/storage/dolt/shared_server_predicate_test.go new file mode 100644 index 000000000..0d2ca30de --- /dev/null +++ b/internal/storage/dolt/shared_server_predicate_test.go @@ -0,0 +1,346 @@ +package dolt + +import ( + "context" + "os" + "path/filepath" + "strconv" + "testing" + + "github.com/steveyegge/beads/internal/configfile" + "github.com/steveyegge/beads/internal/doltserver" +) + +// clearPredicateEnv fixes every BEADS_DOLT_* signal the predicate reads. The +// predicate reads process state, so a leaked variable from a sibling test would +// otherwise decide the answer. One list, shared by every test in this file: two +// copies would mean the next signal added to the predicate has to be added to +// both, and forgetting one silently reintroduces exactly the leak this exists +// to prevent. +func clearPredicateEnv(t *testing.T) { + t.Helper() + for _, k := range []string{ + "BEADS_DOLT_SHARED_SERVER", "BEADS_DOLT_SERVER_MODE", + "BEADS_DOLT_SERVER_HOST", "BEADS_DOLT_SERVER_PORT", "BEADS_DOLT_PORT", + "BEADS_DOLT_SERVER_SOCKET", "BEADS_DOLT_SERVER_TLS", + } { + t.Setenv(k, "") + } +} + +// unmanagedWorkspace is a .beads directory with no server state files: bd never +// started a server here. Whatever it is connected to, it was pointed at. +func unmanagedWorkspace(t *testing.T) string { + t.Helper() + dir := filepath.Join(t.TempDir(), ".beads") + if err := os.MkdirAll(dir, 0o755); err != nil { + t.Fatalf("mkdir: %v", err) + } + return dir +} + +// managedWorkspace is a .beads directory carrying the state files +// doltserver.Start writes: a port file naming port, and a PID file naming a +// live process. This is the auto-started single-workspace server of #6088. +// +// The PID is this test process, which is alive by construction. That is a +// faithful stand-in because the predicate deliberately checks liveness only — +// doltserver.ManagesLiveServerOnPort documents why it stops short of the +// `ps`-based command-name check that would distinguish a dolt process. +func managedWorkspace(t *testing.T, port int) string { + t.Helper() + dir := unmanagedWorkspace(t) + writeServerState(t, dir, port, os.Getpid()) + return dir +} + +func writeServerState(t *testing.T, beadsDir string, port, pid int) { + t.Helper() + if port > 0 { + if err := os.WriteFile(filepath.Join(beadsDir, doltserver.PortFileName), + []byte(strconv.Itoa(port)), 0o600); err != nil { + t.Fatalf("write port file: %v", err) + } + } + if pid > 0 { + if err := os.WriteFile(filepath.Join(beadsDir, doltserver.PIDFileName), + []byte(strconv.Itoa(pid)), 0o600); err != nil { + t.Fatalf("write pid file: %v", err) + } + } +} + +// deadPID returns a PID that is almost certainly not running. Allocating and +// reaping a real child would be exact, but the predicate only needs a number +// no live process answers to; PID 0x7FFFFFFE is above every default pid_max. +const deadPID = 2147483646 + +// TestSharedServerDatabase pins which topologies the #5920 consent gate applies +// to. Getting this wrong is expensive in both directions: too broad and bd +// refuses to migrate a workspace's own database (#6088, the release blocker +// this predicate was narrowed to fix), too narrow and an upgraded client +// silently promotes the schema for a whole team (#5920, and the env-port bypass +// that reopened it). +func TestSharedServerDatabase(t *testing.T) { + t.Run("a live bd-managed server for this workspace is not shared", func(t *testing.T) { + clearPredicateEnv(t) + cfg := &Config{BeadsDir: managedWorkspace(t, 3307), ServerHost: "127.0.0.1", ServerPort: 3307} + if sharedServerDatabase(cfg) { + t.Fatal("a server bd started for this workspace must migrate on open, as embedded does (#6088)") + } + }) + + t.Run("no workspace fails closed", func(t *testing.T) { + clearPredicateEnv(t) + // A bare dolt.New pointed at an endpoint: nothing proves bd owns it, + // and a library caller attached to a team's server must not migrate it. + cfg := &Config{ServerHost: "127.0.0.1", ServerPort: 3307} + if !sharedServerDatabase(cfg) { + t.Fatal("without a workspace to prove ownership, the database must be treated as shared") + } + if !sharedServerDatabase(nil) { + t.Fatal("a nil config must be treated as shared") + } + }) + + t.Run("shared-server mode is shared", func(t *testing.T) { + clearPredicateEnv(t) + t.Setenv("BEADS_DOLT_SHARED_SERVER", "1") + cfg := &Config{BeadsDir: managedWorkspace(t, 3308), ServerHost: "127.0.0.1", ServerPort: 3308} + if !sharedServerDatabase(cfg) { + t.Fatal("shared-server mode is one server for many workspaces — the #5920 shape") + } + }) + + t.Run("explicit external server mode is shared", func(t *testing.T) { + clearPredicateEnv(t) + t.Setenv("BEADS_DOLT_SERVER_MODE", "1") + // Even with the ownership proof present: an explicit declaration that + // the lifecycle is external outranks it. + cfg := &Config{BeadsDir: managedWorkspace(t, 3307), ServerHost: "127.0.0.1", ServerPort: 3307} + if !sharedServerDatabase(cfg) { + t.Fatal("an operator-managed server is not bd's to migrate unprompted") + } + }) + + for _, tt := range []struct { + name string + cfg Config + }{ + {name: "remote host", cfg: Config{ServerHost: "db.example.com", ServerPort: 3307}}, + {name: "TLS endpoint", cfg: Config{ServerHost: "127.0.0.1", ServerPort: 3307, ServerTLS: true}}, + {name: "unix socket", cfg: Config{ServerHost: "127.0.0.1", ServerSocket: "/tmp/dolt.sock"}}, + } { + t.Run(tt.name+" is shared", func(t *testing.T) { + clearPredicateEnv(t) + cfg := tt.cfg + cfg.BeadsDir = managedWorkspace(t, 3307) + if !sharedServerDatabase(&cfg) { + t.Fatalf("%s cannot be a server bd auto-started for this workspace", tt.name) + } + }) + } +} + +// TestSharedServerDatabaseOwnershipProof covers the bypasses that made the +// #5920 gate miss the reported deployment, and the false positives that a +// coarser rule would create. +// +// The unifying point: a local TCP endpoint on 127.0.0.1 looks identical however +// bd arrived at it. The env var, a config.yaml pin, `bd init --server-port`, a +// library caller's hand-built Config and a stale port file all produce one, and +// each was (or would be) a separate silent bypass. Only the state files bd +// writes when it starts a server distinguish them. +func TestSharedServerDatabaseOwnershipProof(t *testing.T) { + // 3307 is both the reported deployment's port and + // configfile.DefaultDoltServerPort, which is why these collisions are + // likely rather than exotic. + const port = 3307 + + t.Run("env-pointed server with no bd-managed server is shared", func(t *testing.T) { + clearPredicateEnv(t) + t.Setenv("BEADS_DOLT_SERVER_PORT", strconv.Itoa(port)) + cfg := &Config{ + BeadsDir: unmanagedWorkspace(t), + ServerHost: "127.0.0.1", + ServerPort: port, + ServerPortSource: doltserver.PortSourceEnv, + } + if !sharedServerDatabase(cfg) { + t.Fatal("BEADS_DOLT_SERVER_PORT names a server that already existed; bd never started it") + } + }) + + // The reported bug's second door. applyConfigDefaults stamps + // PortSourceCallerExplicit onto ANY caller-preset port, and + // `bd init --server-port` is the documented way to attach a workspace to an + // existing server — so treating that source as proof of ownership left the + // blocker open through the flag bd's own help text recommends. + t.Run("bd init --server-port at an external server is shared", func(t *testing.T) { + clearPredicateEnv(t) + cfg := &Config{ + BeadsDir: unmanagedWorkspace(t), + ServerHost: "127.0.0.1", + ServerPort: port, + ServerPortSource: doltserver.PortSourceCallerExplicit, + } + if !sharedServerDatabase(cfg) { + t.Fatal("a caller asserting a port is not bd having started that server") + } + }) + + // Same door, library spelling: an embedder building a Config by hand. + t.Run("hand-built library config at an external server is shared", func(t *testing.T) { + clearPredicateEnv(t) + cfg := &Config{BeadsDir: unmanagedWorkspace(t), ServerHost: "127.0.0.1", ServerPort: port} + if !sharedServerDatabase(cfg) { + t.Fatal("an embedder pointed at a team's server must not migrate it") + } + }) + + // A port file records that bd once bound a port, not that the process + // answering it now is bd's. Without a liveness check, a workspace whose own + // server died launders whatever server later occupies that port. + t.Run("stale port file whose server died is shared", func(t *testing.T) { + clearPredicateEnv(t) + dir := unmanagedWorkspace(t) + writeServerState(t, dir, port, deadPID) + t.Setenv("BEADS_DOLT_SERVER_PORT", strconv.Itoa(port)) + cfg := &Config{ + BeadsDir: dir, + ServerHost: "127.0.0.1", + ServerPort: port, + ServerPortSource: doltserver.PortSourceEnv, + } + if !sharedServerDatabase(cfg) { + t.Fatal("the recorded server is gone; an external server now on that port is not ours to migrate") + } + }) + + t.Run("port file with no pid file is shared", func(t *testing.T) { + clearPredicateEnv(t) + dir := unmanagedWorkspace(t) + writeServerState(t, dir, port, 0) + cfg := &Config{BeadsDir: dir, ServerHost: "127.0.0.1", ServerPort: port} + if !sharedServerDatabase(cfg) { + t.Fatal("a port file alone is a record, not a live server") + } + }) + + // The port file must name the port we actually connected on: a live server + // bd manages on one port says nothing about a different endpoint. + t.Run("live bd server on a different port is shared", func(t *testing.T) { + clearPredicateEnv(t) + cfg := &Config{BeadsDir: managedWorkspace(t, 40083), ServerHost: "127.0.0.1", ServerPort: port} + if !sharedServerDatabase(cfg) { + t.Fatal("bd's server is on another port; this endpoint is somebody else's") + } + }) + + // The #6088 direction, and the false positive a coarser rule would create: + // a single-user workspace that pinned dolt.port in config.yaml — the very + // configuration bd's own auto-start warning recommends ("To pin a port: set + // dolt.port in .beads/config.yaml") — with bd auto-starting its own server + // on that port. Classifying the pin itself as shared would hard-refuse it. + t.Run("config.yaml-pinned port with a live bd server still migrates", func(t *testing.T) { + clearPredicateEnv(t) + cfg := &Config{ + BeadsDir: managedWorkspace(t, port), + ServerHost: "127.0.0.1", + ServerPort: port, + ServerPortSource: doltserver.PortSourceConfigYaml, + } + if sharedServerDatabase(cfg) { + t.Fatal("a pinned port bd auto-started on is still this workspace's own server") + } + }) + + // Same, for the env var: exporting BEADS_DOLT_SERVER_PORT is also how a + // caller tells bd which port to BIND before doltserver.Start, which is the + // shape #5781's lenient-open recovery runs in. + t.Run("env port that bd itself bound still migrates", func(t *testing.T) { + clearPredicateEnv(t) + t.Setenv("BEADS_DOLT_SERVER_PORT", "34567") + cfg := &Config{ + BeadsDir: managedWorkspace(t, 34567), + ServerHost: "127.0.0.1", + ServerPort: 34567, + ServerPortSource: doltserver.PortSourceEnv, + } + if sharedServerDatabase(cfg) { + t.Fatal("bd started this server for this workspace and recorded it; it must still migrate on open") + } + }) + + // dolt's own config.yaml inside the workspace's dolt dir is not written by + // bd as an ownership record — an operator can run their own long-lived + // sql-server over that directory, or leave a stale file behind. + t.Run("dolt config.yaml port without a live bd server is shared", func(t *testing.T) { + clearPredicateEnv(t) + cfg := &Config{ + BeadsDir: unmanagedWorkspace(t), + ServerHost: "127.0.0.1", + ServerPort: port, + ServerPortSource: doltserver.PortSourceDoltConfigYaml, + } + if !sharedServerDatabase(cfg) { + t.Fatal("nothing in bd writes dolt's config.yaml as proof of ownership") + } + }) +} + +// TestSharedServerDatabaseThroughResolvedConfig closes the gap between the unit +// tests above, which hand-build a Config, and what a real open produces. +// +// Every other test here asserts the predicate's behavior for a given Config. If +// the config path stopped producing that Config — a caller presetting the port, +// a change to ApplyResolvedServerPort's precedence, applyConfigDefaults' +// re-stamp condition (store.go, be-9tju) — the bug would return with every one +// of them still green. This one drives the real path. +func TestSharedServerDatabaseThroughResolvedConfig(t *testing.T) { + clearPredicateEnv(t) + + // The reported deployment's exact workspace shape: server mode, and NO + // dolt_server_port. The endpoint exists only in the environment. + // + // The port is deliberately NOT 3307. This test binary runs with + // BEADS_TEST_MODE=1, whose production-port firewall rewrites a resolved + // production port to 1 (applyConfigDefaults) — which would mask the very + // resolution this test exists to pin. Provenance is what is under test, not + // the number. + const envPort = 45671 + + dir := unmanagedWorkspace(t) + metadata := `{"database":"beads","backend":"dolt","dolt_mode":"server","dolt_database":"beads"}` + if err := os.WriteFile(filepath.Join(dir, "metadata.json"), []byte(metadata), 0o600); err != nil { + t.Fatalf("write metadata: %v", err) + } + t.Setenv("BEADS_DOLT_SERVER_PORT", strconv.Itoa(envPort)) + + fileCfg, err := configfile.Load(dir) + if err != nil { + t.Fatalf("load metadata: %v", err) + } + cfg := &Config{} + if err := applyResolvedConfig(context.Background(), dir, fileCfg, cfg); err != nil { + t.Fatalf("applyResolvedConfig: %v", err) + } + applyConfigDefaults(cfg) + + // The connection path honors the env var... + if cfg.ServerPort != envPort { + t.Fatalf("resolved ServerPort = %d, want %d — the env var must decide the endpoint", + cfg.ServerPort, envPort) + } + // ...while the lifecycle resolver, which reads metadata.json only, does + // not. That disagreement IS the bug; if it ever closes, this test should be + // revisited rather than silently continuing to pass for a new reason. + if got := doltserver.ResolveServerMode(dir); got != doltserver.ServerModeOwned { + t.Logf("note: ResolveServerMode now returns %v for the env-port shape (was ServerModeOwned)", got) + } + // The predicate must gate it regardless. + if !sharedServerDatabase(cfg) { + t.Fatal("a workspace whose endpoint came only from BEADS_DOLT_SERVER_PORT must be gated, " + + "not migrated in place (#5920 bypass)") + } +} diff --git a/internal/storage/dolt/shared_store_migrate_gate_test.go b/internal/storage/dolt/shared_store_migrate_gate_test.go new file mode 100644 index 000000000..f58fc1c65 --- /dev/null +++ b/internal/storage/dolt/shared_store_migrate_gate_test.go @@ -0,0 +1,132 @@ +package dolt + +import ( + "context" + "errors" + "fmt" + "testing" + + "github.com/steveyegge/beads/internal/storage/schema" +) + +// TestDoltNew_SharedStoreMigrateGate_NoRemote is the server-mode half of +// gastownhall/beads#5920: a dolt sql-server database with NO remote at all. +// +// Before this gate, the first upgraded client to open such a database writably +// migrated it silently, promoting the schema cursor for every co-resident bd +// client on the same server — which then refused the database until each was +// upgraded too (~14 minutes of a locked-out team, in the incident). A +// sql-server store serves co-resident clients by construction, so the refusal +// does not depend on a remote existing. +// +// One CREATE/DROP DATABASE cycle covers the whole matrix: consecutive cycles +// destabilize the test dolt server, so the states are walked in order on a +// single database. +func TestDoltNew_SharedStoreMigrateGate_NoRemote(t *testing.T) { + skipIfNoDolt(t) + t.Setenv(schema.AllowRemoteMigrateEnv, "0") + t.Setenv(schema.SmartGateEnv, "0") + t.Cleanup(func() { + schema.SetSharedMigrateConsent(false) + schema.SetForceAllowRemoteMigrate(false) + }) + + ctx, cancel := testContext(t) + defer cancel() + + tmpDir := t.TempDir() + dbName := uniqueTestDBName(t) + + store, err := New(ctx, &Config{ + Path: tmpDir, + CommitterName: "test", + CommitterEmail: "test@example.com", + Database: dbName, + CreateIfMissing: true, + }) + if err != nil { + t.Fatalf("New (create): %v", err) + } + defer func() { + dropCtx, dropCancel := context.WithTimeout(context.Background(), 5*testTimeout) + defer dropCancel() + _, _ = store.db.ExecContext(dropCtx, fmt.Sprintf("DROP DATABASE IF EXISTS `%s`", dbName)) + store.Close() + }() + + // Precondition: no remote anywhere. This is the state the ordinary #4259 + // gate allows straight through. + if remotes, err := store.ListRemotes(ctx); err != nil { + t.Fatalf("ListRemotes: %v", err) + } else if len(remotes) != 0 { + t.Fatalf("precondition failed: %d remote(s) registered; this test covers the no-remote case", len(remotes)) + } + + // Put the database one migration behind the binary by regressing only the + // recorded cursor, exactly as the #4259 integration test does. + if _, err := store.db.ExecContext(ctx, + "DELETE FROM schema_migrations WHERE version = ?", schema.LatestVersion()); err != nil { + t.Fatalf("regress schema_migrations: %v", err) + } + + openWith := func(cfg *Config) error { + cfg.Path = tmpDir + cfg.CommitterName = "test" + cfg.CommitterEmail = "test@example.com" + cfg.Database = dbName + s, err := New(ctx, cfg) + if err == nil { + s.Close() + } + return err + } + cursor := func() int { + var v int + if err := store.db.QueryRowContext(ctx, + "SELECT COALESCE(MAX(version), 0) FROM schema_migrations").Scan(&v); err != nil { + t.Fatalf("read schema cursor: %v", err) + } + return v + } + + behind := cursor() + if behind != schema.LatestVersion()-1 { + t.Fatalf("precondition failed: cursor = %d, want %d", behind, schema.LatestVersion()-1) + } + + t.Run("writable open refuses without consent", func(t *testing.T) { + err := openWith(&Config{}) + var gateErr *schema.RemoteMigrateGateError + if !errors.As(err, &gateErr) { + t.Fatalf("New (writable, behind, no remote) = %T (%v), want *schema.RemoteMigrateGateError", err, err) + } + if gateErr.Decision != "shared-no-remote" { + t.Errorf("Decision = %q, want %q", gateErr.Decision, "shared-no-remote") + } + if got := cursor(); got != behind { + t.Fatalf("the refused open promoted the cursor to %d (was %d) — this is the #5920 regression", got, behind) + } + }) + + // The bd-578h9.5 contract: reads must keep working on the old schema while + // the operator decides. Read-only opens never touch the schema at all. + t.Run("read-only open still succeeds", func(t *testing.T) { + if err := openWith(&Config{ReadOnly: true}); err != nil { + t.Fatalf("New (read-only, behind, no remote) = %v, want success", err) + } + if got := cursor(); got != behind { + t.Fatalf("read-only open promoted the cursor to %d (was %d)", got, behind) + } + }) + + t.Run("verb consent migrates", func(t *testing.T) { + schema.SetSharedMigrateConsent(true) + defer schema.SetSharedMigrateConsent(false) + if err := openWith(&Config{}); err != nil { + t.Fatalf("New (writable, consented) = %v, want success", err) + } + if got := cursor(); got != schema.LatestVersion() { + t.Fatalf("cursor = %d after a consented open, want %d", got, schema.LatestVersion()) + } + }) +} diff --git a/internal/storage/dolt/store.go b/internal/storage/dolt/store.go index 3672b4d31..f316dafe4 100644 --- a/internal/storage/dolt/store.go +++ b/internal/storage/dolt/store.go @@ -301,6 +301,7 @@ var _ storage.ActiveDatabaseSizer = (*DoltStore)(nil) var _ storage.LifecycleManager = (*DoltStore)(nil) var _ storage.PendingCommitter = (*DoltStore)(nil) var _ storage.GarbageCollector = (*DoltStore)(nil) +var _ storage.FullGarbageCollector = (*DoltStore)(nil) var _ storage.Flattener = (*DoltStore)(nil) var _ storage.Compactor = (*DoltStore)(nil) var _ storage.SchemaMigrator = (*DoltStore)(nil) @@ -371,12 +372,14 @@ type Config struct { ReadOnly bool // Open in read-only mode (skip schema init) Preview bool // Non-mutating preview: embedded opens skip schema init and refuse writes - // LenientOpen opens the store leniently: embedded mode only. A migration - // gate refusal (#4259) or a dirty-working-set refusal (#4566) skips the - // migration instead of failing the open. Set for working-set-reconcile - // commands (bd dolt commit, bd vc commit; #4566), whose entire purpose is - // to clear the working set that the migration would otherwise refuse to - // touch. Ignored in server mode. + // LenientOpen opens the store leniently: a migration gate refusal (#4259) + // or a dirty-working-set refusal (#4566) skips the migration instead of + // failing the open. Set for working-set-reconcile commands (bd dolt + // commit, bd vc commit; #4566), whose entire purpose is to clear the + // working set that the migration would otherwise refuse to touch. + // Honored in embedded and server mode alike. Migrations still RUN on a + // lenient open — only those two refusals are tolerated — so a lenient + // open of a clean database converges normally. LenientOpen bool // Server connection options @@ -876,6 +879,7 @@ var doltMetrics struct { circuitRejected metric.Int64Counter serializationErrors metric.Int64Counter writeRetries metric.Int64Counter + postTxCommitDropped metric.Int64Counter connAcquireMs metric.Float64Histogram poolWaitCount metric.Int64Counter poolWaitMs metric.Float64Histogram @@ -910,6 +914,10 @@ func init() { metric.WithDescription("Write-tx retries in withRetryTx (label: type=serialization|connection)"), metric.WithUnit("{retry}"), ) + doltMetrics.postTxCommitDropped, _ = m.Int64Counter("bd.db.post_tx_commit_dropped", + metric.WithDescription("Post-tx dolt commits abandoned after retries; the data landed but no dolt commit was minted (change rides the next commit on the branch)"), + metric.WithUnit("{commit}"), + ) doltMetrics.connAcquireMs, _ = m.Float64Histogram("bd.db.conn_acquire_ms", metric.WithDescription("Time to acquire a pooled connection for a Dolt transaction"), metric.WithUnit("ms"), @@ -1129,6 +1137,16 @@ func (s *DoltStore) withReadTxLongTimeout(ctx context.Context, fn func(tx *sql.T }) } +// withRetryTx runs fn in a write transaction, replaying the WHOLE body on +// rollback-guaranteed conflicts (1213/1205 serialization, Dolt's exact 1105 +// autocommit rollback) and on pre-commit transient connection errors. +// +// Contract for closures: fn may run multiple times. Any state the closure +// captures must be re-derived on EVERY attempt — unconditional assignment, +// or an explicit reset at the top of the body when an assignment is +// conditional — otherwise a rolled-back attempt's values leak into post-tx +// logic (verify passes, hooks, return values). See ready_claimer.ClaimNext's +// `claimed = nil` reset for the canonical example. func (s *DoltStore) withRetryTx(ctx context.Context, fn func(tx *sql.Tx) error) error { // Keep circuit admission at the transaction retry boundary. Calling // withRetry from here would multiply retries and could replay a write after @@ -2032,7 +2050,12 @@ func newServerMode(ctx context.Context, cfg *Config) (*DoltStore, error) { if !cfg.ReadOnly && !cfg.Gateway { applied, err := store.initSchema(ctx, dbFacts.bootstrapHeal) if err != nil { - return nil, fmt.Errorf("failed to initialize schema: %w", err) + if !cfg.LenientOpen || !warnLenientOpenRefusal(err) { + return nil, fmt.Errorf("failed to initialize schema: %w", err) + } + // A tolerated refusal still reports what the aborted pass + // applied (0 for both guards today, since each refuses before + // migrating), so the rebuild below stays correct either way. } // initSchema runs migrations over a separate pool (openMigrationDB). // The Ping above already pinned a connection in store.db to the @@ -2067,6 +2090,43 @@ func newServerMode(ctx context.Context, cfg *Config) (*DoltStore, error) { return store, nil } +// warnLenientOpenRefusal reports whether a lenient open (Config.LenientOpen) +// may continue past err instead of failing, warning on stderr when it may. +// +// Server mode reaches the same two pending-migration refusals embedded mode +// relaxes for this intent (embeddeddolt's openWorkingSetReconcile): the #4566 +// dirty-table guard, whose documented recovery IS the commit these opens exist +// to run, and the #4259 remote-migrate gate, a coordination stop with no +// business blocking a commit of the local working set. Against an external +// server the operator cannot sidestep either by deleting a local database, so +// leaving them fatal here left the refusals with no in-band recovery at all +// (#5781). +// +// Every other migration failure still fails the open, and the schema-skew and +// identity guards run before this point either way: lenient relaxes migration, +// not safety. +func warnLenientOpenRefusal(err error) bool { + var dirtyErr *schema.DirtyTablesError + if errors.As(err, &dirtyErr) { + fmt.Fprintf(os.Stderr, + "Warning: %v\n"+ + " Committing the working set at the current schema; when it completes,\n"+ + " re-run 'bd migrate'.\n", + dirtyErr) + return true + } + var gateErr *schema.RemoteMigrateGateError + if errors.As(err, &gateErr) { + fmt.Fprintf(os.Stderr, + "Warning: %s"+ + " Working-set reconcile command: continuing on schema v%d without\n"+ + " migrating; the commit applies to the working set at the current schema.\n", + gateErr.UserMessage(), gateErr.CurrentVersion) + return true + } + return false +} + var ( cleanServerCircuitState = CleanStaleCircuitBreakerFiles newServerCircuitBreaker = maybeNewCircuitBreaker @@ -2372,6 +2432,40 @@ type serverConnFacts struct { alreadyExisted bool } +// assertGatewaySessionDatabase verifies the gateway actually placed this +// session on the database bd asked for, comparing case-insensitively as MySQL +// does for schema names. A NULL or empty answer means the session is on no +// database at all, which for a gateway means the same thing as a refusal: the +// name bd asked for is not provisioned for this credential. +// +// The uow provider makes the same assertion for the proxied-server open +// (uow.assertSessionDatabase); this is the direct-open sibling, kept here +// rather than shared because internal/storage/dolt does not depend on uow. +func assertGatewaySessionDatabase(ctx context.Context, db *sql.DB, want string) error { + conn, err := db.Conn(ctx) + if err != nil { + return fmt.Errorf("failed to pin gateway connection (database %q): %w", want, err) + } + defer func() { _ = conn.Close() }() + + var current sql.NullString + if err := conn.QueryRowContext(ctx, "SELECT DATABASE()").Scan(¤t); err != nil { + return fmt.Errorf("failed to read the session database after connecting to gateway server for database %q: %w", want, err) + } + switch { + case !current.Valid || current.String == "": + return fmt.Errorf( + "the gateway server left this session on no database after requesting %q — either the database is not provisioned on the server or this credential has not been granted access to it; ask the server administrator to provision the database and grant access", + want) + case strings.EqualFold(current.String, want): + return nil + default: + return fmt.Errorf( + "the gateway server connected this session to database %q, not the requested %q — this credential appears to be scoped to %q. The requested database is not provisioned for this credential; ask the server administrator to provision it on the server (and grant this credential access), or re-run init without --database to use the provisioned one", + current.String, want, current.String) + } +} + // openServerConnection connects to (and if needed creates) the target database // on a dolt sql-server via MySQL protocol. See serverConnFacts for what the // returned facts mean and why they are not a single bool. @@ -2400,14 +2494,26 @@ func openServerConnection(ctx context.Context, cfg *Config) (*sql.DB, string, se // A gateway server owns database routing and existence, so bd does not probe or create // it: skip the no-database admin connection (and the SHOW DATABASES / CREATE DATABASE - // it would run) and verify the project connection directly — a successful connect IS - // the existence proof. connReady must be set before returning the pool, or the defer - // above would close the *sql.DB we just handed the caller. + // it would run) and verify the project connection directly — a successful connect that + // lands on the requested database IS the existence proof. connReady must be set before + // returning the pool, or the defer above would close the *sql.DB we just handed the + // caller. if cfg.Gateway { if err := db.PingContext(ctx); err != nil { return nil, "", serverConnFacts{}, fmt.Errorf("failed to connect to gateway server %s:%d (database %q): %w", cfg.ServerHost, cfg.ServerPort, cfg.Database, err) } + // A connect proves the gateway accepted the credential, NOT that it + // honored the database name. A gateway scopes connections by + // credential, so it can take a foreign name in the handshake and serve + // its own database anyway — and every read below is unqualified, so bd + // would read one project's data while believing it was in another's. + // On `bd init --database=` that adoption is completely silent: + // resolveInitIssuePrefix adopts whatever prefix comes back. One query + // closes it. + if err := assertGatewaySessionDatabase(ctx, db, cfg.Database); err != nil { + return nil, "", serverConnFacts{}, err + } connReady = true // Neither fact is established for a gateway database: we did not // create it, and existence was never probed, so we cannot honestly @@ -2686,15 +2792,36 @@ func initSchemaOnDBWithRetryAndGateBootstrapHeal( // Must exceed schema.MigrateUpWithLock's 5s GET_LOCK wait so a contended // schema migration can time out once and still retry. schemaBO.MaxElapsedTime = serverRetryMaxElapsed + + // The gate authorizes this LOGICAL open, once — it is not a per-attempt + // re-check. Two things make re-checking wrong (gastownhall/beads#5012 + // shape, caught by the fresh-bootstrap heal tests): + // + // - an attempt that dies mid-pass leaves the schema cursor ADVANCED, so + // a re-check no longer sees the fresh database it allowed a moment + // ago. It sees "existing database, migrations pending" and refuses the + // very migration it just authorized, stranding the open half-migrated; + // - fresh-bootstrap heal authority is issued only to the open that won + // the bare CREATE for this exact database incarnation, so it is + // standing proof that creating it was consent for its schema. That + // proof survives a retry; a version read does not. + // + // Same argument, same shape as the proxied path's skip in + // schema.MigrateUpWithLock. Only the ALLOW is latched: a gate whose probes + // hit a transient startup/catalog race has not decided anything yet, and + // is still retried below. + gateSatisfied := bootstrapHeal != nil + var applied int err := backoff.Retry(func() error { - if gate != nil { + if gate != nil && !gateSatisfied { if gateErr := gate(ctx, db); gateErr != nil { if !schema.IsRemoteMigrateGateError(gateErr) && isRetryableError(gateErr) { return gateErr } return backoff.Permanent(gateErr) } + gateSatisfied = true } var schemaErr error applied, schemaErr = initSchemaOnDBWithBootstrapHeal(ctx, db, bootstrapHeal, endpoint) @@ -2709,6 +2836,91 @@ func initSchemaOnDBWithRetryAndGateBootstrapHeal( return applied, err } +// sharedServerDatabase reports whether this store's database is served to bd +// clients beyond this workspace — the condition the #5920 consent gate exists +// for, since migrating promotes the schema version for every one of them at +// once and locks out any still on an older bd. +// +// The line is who owns the server's lifecycle, which doltserver already +// resolves for the auto-start decision: +// +// - bd auto-started this server for THIS workspace (ServerModeOwned): the +// database is this workspace's own, the way an embedded database is, and +// bd migrates it on open exactly as it always has. Refusing here would +// leave a single-user workspace unable to migrate itself, and would break +// the #4566/#5781 dirty-table recovery, whose whole shape is +// refuse-then-commit-then-migrate on a bd-owned local server. +// - anything else — shared-server mode, an explicit dolt_server_port in +// metadata.json, host inference, a caller with no workspace at all — +// is someone else's server. Fail closed: without a workspace to prove +// ownership from, assume the database is shared. +// +// This narrows #6048's original predicate, which treated every DoltStore as +// shared on the reasoning that "a sql-server accepts co-resident clients by +// construction". True in the abstract, but it swept in bd's own +// single-workspace servers and so refused migrations that no other client +// could ever observe. The #5920 report, and the regression test for it, are +// both the external-server shape this keeps gated. +// Every signal it reads is one that is set on EVERY open. Deliberately absent +// are cfg.AutoStart, cfg.ServerMode and s.autoStartedServerDir, which all name +// the right idea but are populated only by the CLI (or, for the last, only +// under BEADS_TEST_MODE): a library caller pointed at a genuinely shared +// server leaves them false, and reading them would silently ungate it. +// +// ResolveServerMode alone is not enough, because it answers a DIFFERENT +// question. Its contract is "may bd manage this server's lifecycle", and its +// port arm reads dolt_server_port from metadata.json ONLY — while the +// connection path (configfile.GetDoltServerPort, and doltserver's precedence +// chain behind ApplyResolvedServerPort) takes BEADS_DOLT_SERVER_PORT first. +// A workspace pointed at an externally-managed server purely by that env var +// therefore resolved ServerModeOwned while bd was connected to a server it had +// never started: bd believed it owned a private server and silently promoted +// the schema of a shared one. +// +// So ownership is not inferred from the connection at all. It is PROVEN, by +// the state files bd writes when it starts a server (see +// doltserver.ManagesLiveServerOnPort), and everything else is shared. The +// inverse — enumerating the ways an endpoint can be foreign — was tried and is +// unbounded: an env var, a config.yaml pin, `bd init --server-port`, a +// hand-built library Config and a stale port file all produce a local TCP +// endpoint indistinguishable from an owned one, and each is a separate silent +// bypass. There is exactly one way to be sure, and it is cheap. +func sharedServerDatabase(cfg *Config) bool { + // No workspace to prove ownership from — a bare dolt.New pointed at some + // endpoint. Fail closed. + if cfg == nil || cfg.BeadsDir == "" { + return true + } + // Somebody else's server by construction: a host that is not this + // machine, a TLS endpoint (Hosted Dolt), or a unix socket — bd's own + // auto-start only ever creates a local TCP listener. + if !isLocalHost(cfg.ServerHost) || cfg.ServerTLS || cfg.ServerSocket != "" { + return true + } + // The one shared topology that is otherwise indistinguishable from an + // owned one: same machine, same TCP shape, one server for many workspaces. + if doltserver.IsSharedServerMode() { + return true + } + // The proof. Without a live server bd started for THIS workspace on the + // very port this store is connected to, the database belongs to someone + // else and migrating it is not this open's call to make. + // + // cfg.BeadsDir, not doltserver.ResolveServerDir(cfg.BeadsDir): the two + // differ only in shared-server mode, which returned above. Resolving here + // would read another directory's state files for the one topology this + // line can no longer be reached in. + if !doltserver.ManagesLiveServerOnPort(cfg.BeadsDir, cfg.ServerPort) { + return true + } + // Proof of a bd-managed server does not override an explicit declaration + // that the lifecycle is external (metadata dolt_server_port, host + // inference, BEADS_DOLT_SERVER_MODE). Keeping this last means the change + // above can only ever ADD shared classifications to what #5920/#6048 + // already gated, never remove one. + return doltserver.ResolveServerMode(cfg.BeadsDir) != doltserver.ServerModeOwned +} + func (s *DoltStore) initSchema(ctx context.Context, bootstrapHeal *schema.FreshBootstrapHealCapability) (int, error) { // Schema migrations can run arbitrarily long (e.g. full-table recomputes // such as the is_blocked backfill in migration 0047). The main connection @@ -2757,8 +2969,17 @@ func (s *DoltStore) initSchema(ctx context.Context, bootstrapHeal *schema.FreshB // depend on that external guard alone. ReadOnly: s.readOnly, } + // #5920: on a database served to OTHER workspaces' bd clients, migrating + // promotes the schema for all of them at once, so this open must not do it + // unprompted. On a server whose lifecycle bd owns for this one workspace, + // the pre-existing contract stands and the open migrates (see + // sharedServerDatabase). gate := func(ctx context.Context, db *sql.DB) error { - return schema.CheckRemoteMigrateGateForRemoteWithRemoteCheckAndAdopt(ctx, db, s.remote, s.hasPersistedCLIRemote, adopt) + if !sharedServerDatabase(s.cfg) { + return schema.CheckRemoteMigrateGateForRemoteWithRemoteCheckAndAdopt( + ctx, db, s.remote, s.hasPersistedCLIRemote, adopt) + } + return schema.CheckSharedStoreMigrateGate(ctx, db, s.remote, s.hasPersistedCLIRemote, adopt) } applied, err := initSchemaOnDBWithRetryAndGateBootstrapHeal(ctx, migDB, gate, bootstrapHeal, s.serverEndpoint) return applied, err @@ -2912,8 +3133,8 @@ func (s *DoltStore) ActiveDatabaseSize(ctx context.Context) (int64, error) { return size, nil } -// DoltGC runs Dolt garbage collection to reclaim disk space. -// Pins a single connection to avoid session state loss on pooled *sql.DB. +// DoltGC runs Dolt's default, generational garbage collection to reclaim disk +// space. Pins a single connection to avoid session state loss on pooled *sql.DB. func (s *DoltStore) DoltGC(ctx context.Context) error { conn, err := s.db.Conn(ctx) if err != nil { @@ -2923,6 +3144,18 @@ func (s *DoltStore) DoltGC(ctx context.Context) error { return versioncontrolops.DoltGC(ctx, conn) } +// DoltGCFull runs a full Dolt garbage collection across all storage +// generations. Pins a single connection to avoid session state loss on pooled +// *sql.DB. +func (s *DoltStore) DoltGCFull(ctx context.Context) error { + conn, err := s.db.Conn(ctx) + if err != nil { + return fmt.Errorf("acquire connection for gc: %w", err) + } + defer conn.Close() + return versioncontrolops.DoltGCFull(ctx, conn) +} + // ListRemoteRefs returns the names of all cached remote-tracking refs. func (s *DoltStore) ListRemoteRefs(ctx context.Context) ([]string, error) { return versioncontrolops.ListRemoteRefs(ctx, s.db) @@ -3358,9 +3591,23 @@ func (s *DoltStore) doltAddAndCommit(ctx context.Context, tables []string, commi } if err := schema.DrainCall(ctx, conn, "CALL DOLT_COMMIT('-m', ?, '--author', ?)", - commitMsg, s.commitAuthorString()); err != nil && !isDoltNothingToCommit(err) { - return s.recordDoltPublicationFailure(ctx, - fmt.Errorf("dolt commit after SQL mutation: %w: %w", err, ErrCommitIndeterminate)) + commitMsg, s.commitAuthorString()); err != nil { + if !isDoltNothingToCommit(err) { + return s.recordDoltPublicationFailure(ctx, + fmt.Errorf("dolt commit after SQL mutation: %w: %w", err, ErrCommitIndeterminate)) + } + // Reaching nothing-to-commit past the staged guard above means the + // staged set was swept between the guard and the commit, and the + // server cannot say by what: absorption — sessions on one branch + // share the working set, so a concurrent writer's DOLT_COMMIT can + // sweep this operation's rows under ITS message — or a retried + // commit whose first attempt actually landed. The data is intact + // either way; log neutrally (server mode only: embedded has no + // concurrent sessions) so a missing audit line is explicable + // without asserting a concurrent writer that may not exist. + if s.serverMode { + log.Printf("dolt: commit %q made no dolt commit (nothing to commit): change absorbed into a concurrent writer's commit, or an already-committed retry", commitMsg) + } } return nil }) diff --git a/internal/storage/dolt/transaction.go b/internal/storage/dolt/transaction.go index 9c5388948..cd8af9c7b 100644 --- a/internal/storage/dolt/transaction.go +++ b/internal/storage/dolt/transaction.go @@ -807,7 +807,9 @@ func (t *doltTransaction) DeleteIssue(ctx context.Context, id string) error { if isWisp { table = "wisps" } - if err := issueops.DeleteIssueInTx(ctx, t.txFor(table), id); err != nil { + // storage.Tx.DeleteIssue carries no actor (it is the actorless system + // surface), so the journal rows record none — 0066's "system/unknown". + if err := issueops.DeleteIssueInTx(ctx, t.txFor(table), id, ""); err != nil { return wrapExecError("delete issue in tx", err) } // Mark every table the ON DELETE CASCADE fans out to, not just the row's diff --git a/internal/storage/dolt/versioned.go b/internal/storage/dolt/versioned.go index 47859f949..7c1678355 100644 --- a/internal/storage/dolt/versioned.go +++ b/internal/storage/dolt/versioned.go @@ -33,6 +33,30 @@ func (s *DoltStore) History(ctx context.Context, issueID string) ([]*storage.His return result, err } +// HistoricalIssueIDs reports which of ids appear in HEAD's committed history +// of the issues table. Implements storage.HistoryPresence. +// +// Uses withReadTxLongTimeout for the same reason History does (ga-ahnxx): the +// dolt_history_issues scan underneath is proportional to commits × revisions +// and can outrun the shared pool's 10s ReadTimeout on a mature repo, where it +// would surface as an intermittent i/o timeout rather than an answer. +func (s *DoltStore) HistoricalIssueIDs(ctx context.Context, ids []string) (map[string]struct{}, error) { + var present map[string]struct{} + err := s.withReadTxLongTimeout(ctx, func(tx *sql.Tx) error { + var err error + present, err = issueops.HistoricalIssueIDsInTx(ctx, tx, ids) + if err != nil { + return wrapQueryError("check issue history presence", err) + } + return nil + }) + return present, err +} + +// The auto-export guard reaches this through storage.UnwrapStore, so the +// assertion must keep holding on the concrete store. +var _ storage.HistoryPresence = (*DoltStore)(nil) + // AsOf returns the state of an issue at a specific commit hash or branch ref. // Implements storage.VersionedStorage. func (s *DoltStore) AsOf(ctx context.Context, issueID string, ref string) (*types.Issue, error) { diff --git a/internal/storage/dolt/wisps.go b/internal/storage/dolt/wisps.go index 8d390197f..3cd08ab0a 100644 --- a/internal/storage/dolt/wisps.go +++ b/internal/storage/dolt/wisps.go @@ -347,7 +347,8 @@ func (s *DoltStore) deleteWisp(ctx context.Context, id string) error { // Edges are journaled before the row goes, while their source snapshots can // still be read. An active wisp is a bead like any other, so its delete is // a journalled mutation, not silent cleanup. - if err := issueops.RecordDependencyRemovalsForIssuesInTx(ctx, tx, []string{id}); err != nil { + // The wisp delete surface carries no actor, so these record none. + if err := issueops.RecordDependencyRemovalsForIssuesInTx(ctx, tx, []string{id}, ""); err != nil { return fmt.Errorf("journal dependency removals for wisp %s: %w", id, err) } @@ -447,7 +448,8 @@ func (s *DoltStore) deleteWispBatchTx(ctx context.Context, ids []string) (int, e } // Edges are journaled before the rows go, while their source snapshots can // still be read. - if err := issueops.RecordDependencyRemovalsForIssuesInTx(ctx, tx, deletedIDs); err != nil { + // The batched wisp delete surface carries no actor, so these record none. + if err := issueops.RecordDependencyRemovalsForIssuesInTx(ctx, tx, deletedIDs, ""); err != nil { return 0, fmt.Errorf("journal dependency removals for batched wisp delete: %w", err) } diff --git a/internal/storage/domain/db/delete_repo_test.go b/internal/storage/domain/db/delete_repo_test.go index 58e2e3f3a..d81095731 100644 --- a/internal/storage/domain/db/delete_repo_test.go +++ b/internal/storage/domain/db/delete_repo_test.go @@ -77,7 +77,7 @@ func (s *testSuite) TestEventsSQLRepositoryDelete() { func (s *testSuite) issueDeleteRemovesRow() { s.seedIssueRow("bd-del-r1") r := s.issueRepo() - s.Require().NoError(r.Delete(s.Ctx(), "bd-del-r1", domain.IssueTableOpts{})) + s.Require().NoError(r.Delete(s.Ctx(), "bd-del-r1", domain.IssueTableOpts{}, "tester")) var c int s.Require().NoError(s.Runner().QueryRowContext(s.Ctx(), @@ -87,7 +87,7 @@ func (s *testSuite) issueDeleteRemovesRow() { func (s *testSuite) issueDeleteMissing() { r := s.issueRepo() - err := r.Delete(s.Ctx(), "bd-del-nope", domain.IssueTableOpts{}) + err := r.Delete(s.Ctx(), "bd-del-nope", domain.IssueTableOpts{}, "tester") s.Require().Error(err) s.Contains(err.Error(), "not found") } @@ -97,7 +97,7 @@ func (s *testSuite) issueDeleteWispRouting() { s.seedIssueRow("bd-del-w1") r := s.issueRepo() - s.Require().NoError(r.Delete(s.Ctx(), "bd-del-w1", domain.IssueTableOpts{UseWispsTable: true})) + s.Require().NoError(r.Delete(s.Ctx(), "bd-del-w1", domain.IssueTableOpts{UseWispsTable: true}, "tester")) var wispCount, issueCount int s.Require().NoError(s.Runner().QueryRowContext(s.Ctx(), @@ -109,7 +109,7 @@ func (s *testSuite) issueDeleteWispRouting() { } func (s *testSuite) issueDeleteByIDsEmpty() { - n, err := s.issueRepo().DeleteByIDs(s.Ctx(), nil, domain.IssueTableOpts{}) + n, err := s.issueRepo().DeleteByIDs(s.Ctx(), nil, domain.IssueTableOpts{}, "tester") s.Require().NoError(err) s.Equal(0, n) } @@ -120,7 +120,7 @@ func (s *testSuite) issueDeleteByIDsBulk() { s.seedIssueRow("bd-del-bulk-c") n, err := s.issueRepo().DeleteByIDs(s.Ctx(), - []string{"bd-del-bulk-a", "bd-del-bulk-b", "bd-del-bulk-c"}, domain.IssueTableOpts{}) + []string{"bd-del-bulk-a", "bd-del-bulk-b", "bd-del-bulk-c"}, domain.IssueTableOpts{}, "tester") s.Require().NoError(err) s.Equal(3, n) @@ -136,7 +136,7 @@ func (s *testSuite) issueDeleteByIDsWispRouting() { s.seedIssueRow("bd-del-bulk-w1") n, err := s.issueRepo().DeleteByIDs(s.Ctx(), - []string{"bd-del-bulk-w1", "bd-del-bulk-w2"}, domain.IssueTableOpts{UseWispsTable: true}) + []string{"bd-del-bulk-w1", "bd-del-bulk-w2"}, domain.IssueTableOpts{UseWispsTable: true}, "tester") s.Require().NoError(err) s.Equal(2, n) @@ -152,7 +152,7 @@ func (s *testSuite) issueDeleteByIDsWispRouting() { func (s *testSuite) issueDeleteByIDsMissing() { s.seedIssueRow("bd-del-mix-a") n, err := s.issueRepo().DeleteByIDs(s.Ctx(), - []string{"bd-del-mix-a", "bd-del-mix-missing"}, domain.IssueTableOpts{}) + []string{"bd-del-mix-a", "bd-del-mix-missing"}, domain.IssueTableOpts{}, "tester") s.Require().NoError(err) s.Equal(1, n, "only one row matched") } @@ -265,7 +265,7 @@ func (s *testSuite) issueRecomputeIsBlockedFlips() { } func (s *testSuite) depDeleteAllEmpty() { - n, err := s.depRepo().DeleteAllForIDs(s.Ctx(), nil, domain.DepInsertOpts{}) + n, err := s.depRepo().DeleteAllForIDs(s.Ctx(), nil, domain.DepInsertOpts{}, "tester") s.Require().NoError(err) s.Equal(0, n) } @@ -282,7 +282,7 @@ func (s *testSuite) depDeleteAllRemoves() { s.Require().NoError(r.Insert(s.Ctx(), newDep("bd-del-da-b", "bd-del-da-c", types.DepBlocks), "tester", domain.DepInsertOpts{})) - n, err := r.DeleteAllForIDs(s.Ctx(), []string{"bd-del-da-a"}, domain.DepInsertOpts{}) + n, err := r.DeleteAllForIDs(s.Ctx(), []string{"bd-del-da-a"}, domain.DepInsertOpts{}, "tester") s.Require().NoError(err) s.Equal(2, n) @@ -301,7 +301,7 @@ func (s *testSuite) depDeleteAllWispRouting() { domain.DepInsertOpts{UseWispsTable: true})) n, err := r.DeleteAllForIDs(s.Ctx(), []string{"bd-del-dw-src"}, - domain.DepInsertOpts{UseWispsTable: true}) + domain.DepInsertOpts{UseWispsTable: true}, "tester") s.Require().NoError(err) s.Equal(1, n) diff --git a/internal/storage/domain/db/dependency.go b/internal/storage/domain/db/dependency.go index 53f09dffa..7d15ceb60 100644 --- a/internal/storage/domain/db/dependency.go +++ b/internal/storage/domain/db/dependency.go @@ -761,7 +761,7 @@ func combineArgs(a, b []any) []any { return out } -func (r *dependencySQLRepositoryImpl) DeleteAllForIDs(ctx context.Context, ids []string, opts domain.DepInsertOpts) (int, error) { +func (r *dependencySQLRepositoryImpl) DeleteAllForIDs(ctx context.Context, ids []string, opts domain.DepInsertOpts, actor string) (int, error) { if len(ids) == 0 { return 0, nil } @@ -788,7 +788,7 @@ func (r *dependencySQLRepositoryImpl) DeleteAllForIDs(ctx context.Context, ids [ ph := strings.Join(placeholders, ",") // Journal the edges this batch is about to remove, while they and their // source snapshots are still readable. - if err := issueops.RecordDependencyRemovalsForTableInTx(ctx, r.runner, table, batch); err != nil { + if err := issueops.RecordDependencyRemovalsForTableInTx(ctx, r.runner, table, batch, actor); err != nil { return total, fmt.Errorf("db: DependencySQLRepository.DeleteAllForIDs journal removals from %s: %w", table, err) } //nolint:gosec // G201: table is one of two hardcoded constants; ? placeholders only. diff --git a/internal/storage/domain/db/issue.go b/internal/storage/domain/db/issue.go index 1f08abed5..2b128b54d 100644 --- a/internal/storage/domain/db/issue.go +++ b/internal/storage/domain/db/issue.go @@ -943,14 +943,14 @@ func (r *issueSQLRepositoryImpl) GetReadyWorkWithCounts(ctx context.Context, fil return r.getReadyWorkWithCountsUnion(ctx, filter) } -func (r *issueSQLRepositoryImpl) Delete(ctx context.Context, id string, opts domain.IssueTableOpts) error { +func (r *issueSQLRepositoryImpl) Delete(ctx context.Context, id string, opts domain.IssueTableOpts, actor string) error { table := "issues" if opts.UseWispsTable { table = "wisps" } // Edges are journaled before the row goes, while its snapshot can still be // read. - if err := issueops.RecordDependencyRemovalsForIssuesInTx(ctx, r.runner, []string{id}); err != nil { + if err := issueops.RecordDependencyRemovalsForIssuesInTx(ctx, r.runner, []string{id}, actor); err != nil { return fmt.Errorf("db: IssueSQLRepository.Delete %s: journal dependency removals: %w", id, err) } //nolint:gosec // G201: table is a hardcoded constant. @@ -969,12 +969,11 @@ func (r *issueSQLRepositoryImpl) Delete(ctx context.Context, id string, opts dom if err := issueops.DeleteLeaseInTx(ctx, r.runner, id); err != nil { return err } - // The rows==0 return above keeps this actually-deleted-only. The repository - // Delete surface carries no actor, so the row records none. - return issueops.RecordDeleteInTx(ctx, r.runner, id, "") + // The rows==0 return above keeps this actually-deleted-only. + return issueops.RecordDeleteInTx(ctx, r.runner, id, actor) } -func (r *issueSQLRepositoryImpl) DeleteByIDs(ctx context.Context, ids []string, opts domain.IssueTableOpts) (int, error) { +func (r *issueSQLRepositoryImpl) DeleteByIDs(ctx context.Context, ids []string, opts domain.IssueTableOpts, actor string) (int, error) { if len(ids) == 0 { return 0, nil } @@ -992,7 +991,7 @@ func (r *issueSQLRepositoryImpl) DeleteByIDs(ctx context.Context, ids []string, } // Edges are journaled before the rows go, while their source snapshots can // still be read. - if err := issueops.RecordDependencyRemovalsForIssuesInTx(ctx, r.runner, actualIDs); err != nil { + if err := issueops.RecordDependencyRemovalsForIssuesInTx(ctx, r.runner, actualIDs, actor); err != nil { return 0, fmt.Errorf("db: IssueSQLRepository.DeleteByIDs journal dependency removals: %w", err) } total := 0 @@ -1030,9 +1029,8 @@ func (r *issueSQLRepositoryImpl) DeleteByIDs(ctx context.Context, ids []string, } } } - // The repository DeleteByIDs surface carries no actor, so the rows record none. for _, id := range actualIDs { - if err := issueops.RecordDeleteInTx(ctx, r.runner, id, ""); err != nil { + if err := issueops.RecordDeleteInTx(ctx, r.runner, id, actor); err != nil { return total, err } } diff --git a/internal/storage/domain/db/issue_mergeops_test.go b/internal/storage/domain/db/issue_mergeops_test.go index ab96ad80a..25b52d9cd 100644 --- a/internal/storage/domain/db/issue_mergeops_test.go +++ b/internal/storage/domain/db/issue_mergeops_test.go @@ -57,7 +57,7 @@ func (s *testSuite) issueUpdateSetMetadataMerges() { got := s.readMetadataMap("bd-mo-set", domain.IssueTableOpts{}) s.Equal("yes", got["existing"], "pre-existing key must survive a set-metadata edit") s.Equal("gold", got["tier"]) - s.Equal("99", got["score"], "--set-metadata values are stored as JSON strings (GH#4146)") + s.Equal(float64(99), got["score"], "--set-metadata infers scalar types: 99 is stored as a JSON number (v1.2.2 contract)") } func (s *testSuite) issueUpdateMergeMetadataOverlays() { @@ -161,7 +161,7 @@ func (s *testSuite) issueUpdateMergeOpsWispRouting() { got := map[string]any{} s.Require().NoError(json.Unmarshal(out.Metadata, &got)) s.Equal("wisp", got["kind"], "wisp's pre-existing metadata key must survive") - s.Equal("1", got["extra"]) + s.Equal(float64(1), got["extra"]) } // TestIssueUseCase_ApplyUpdateMergeOps proves the ops flow through the domain @@ -185,7 +185,7 @@ func (s *testSuite) iucApplyUpdateSetMetadata() { got := map[string]any{} s.Require().NoError(json.Unmarshal(updated.Metadata, &got)) s.Equal("safe", got["sibling"]) - s.Equal("1", got["mine"]) + s.Equal(float64(1), got["mine"]) } func (s *testSuite) iucApplyUpdateAppendNotes() { diff --git a/internal/storage/domain/db/journal_behavior_test.go b/internal/storage/domain/db/journal_behavior_test.go index 700cb4a94..85dc635d3 100644 --- a/internal/storage/domain/db/journal_behavior_test.go +++ b/internal/storage/domain/db/journal_behavior_test.go @@ -13,6 +13,7 @@ type journalRow struct { Seq int64 Op string IssueID string + Actor string Issue *types.Issue Dep *issueops.EventDep Comment *issueops.EventComment @@ -30,9 +31,16 @@ func (s *testSuite) enableJournalForTest() { s.T().Cleanup(func() { s.journalEnabled = false }) } +// clearJournal drops the rows written so far, so an assertion reads only what +// the mutation under test produced. +func (s *testSuite) clearJournal() { + _, err := s.Runner().ExecContext(s.Ctx(), "DELETE FROM bd_events_journal") + s.Require().NoError(err) +} + func (s *testSuite) readJournal() []journalRow { rows, err := s.Runner().QueryContext(s.Ctx(), - `SELECT seq, op, issue_id, issue_json, dep_json, comment_json FROM bd_events_journal ORDER BY seq ASC`) + `SELECT seq, op, issue_id, actor, issue_json, dep_json, comment_json FROM bd_events_journal ORDER BY seq ASC`) s.Require().NoError(err) defer rows.Close() @@ -44,7 +52,7 @@ func (s *testSuite) readJournal() []journalRow { depJS []byte commentJS []byte ) - s.Require().NoError(rows.Scan(&jr.Seq, &jr.Op, &jr.IssueID, &issueJS, &depJS, &commentJS)) + s.Require().NoError(rows.Scan(&jr.Seq, &jr.Op, &jr.IssueID, &jr.Actor, &issueJS, &depJS, &commentJS)) if len(issueJS) > 0 { jr.HasIssue = true var iss types.Issue @@ -90,7 +98,7 @@ func (s *testSuite) TestEventsJournal_UOWPlumbing() { s.Require().NoError(err) _, err = ir.Close(ctx, "bd-mj-1", domain.CloseRowParams{Reason: "done"}, "actor", domain.IssueTableOpts{}) s.Require().NoError(err) - s.Require().NoError(ir.Delete(ctx, "bd-mj-2", domain.IssueTableOpts{})) + s.Require().NoError(ir.Delete(ctx, "bd-mj-2", domain.IssueTableOpts{}, "actor")) got := s.readJournal() wantOps := []string{ @@ -243,7 +251,7 @@ func (s *testSuite) TestEventsJournal_NoPhantomDeletes() { s.Require().NoError(err) // Delete a mix: two real ids and two that do not exist. - n, err := ir.DeleteByIDs(ctx, []string{"bd-pd-1", "bd-pd-missing-a", "bd-pd-2", "bd-pd-missing-b"}, domain.IssueTableOpts{}) + n, err := ir.DeleteByIDs(ctx, []string{"bd-pd-1", "bd-pd-missing-a", "bd-pd-2", "bd-pd-missing-b"}, domain.IssueTableOpts{}, "actor") s.Require().NoError(err) s.Equal(2, n, "only the two present ids are deleted") @@ -256,6 +264,96 @@ func (s *testSuite) TestEventsJournal_NoPhantomDeletes() { "journal must record a delete only for ids that removed a row, no phantoms") } +// TestEventsJournal_DeleteActorAttribution pins the repository seam the UOW +// door bottoms out in: IssueSQLRepository.Delete / DeleteByIDs and +// DependencySQLRepository.DeleteAllForIDs each journal under the actor they are +// handed, not the empty string (#5985). +// +// It asserts at the repository rather than through the use case because that is +// where the actor was being dropped — deleteMany had it in hand the whole time. +// The empty-actor half of the contract stays pinned by the derived-maintenance +// rows in TestEventsJournal_UOWPlumbing. +func (s *testSuite) TestEventsJournal_DeleteActorAttribution() { + s.enableJournalForTest() + ctx := s.Ctx() + ir := s.issueRepo() + dr := s.depRepo() + + for _, id := range []string{"bd-da-single", "bd-da-bulk-1", "bd-da-bulk-2", "bd-da-edge-src", "bd-da-edge-tgt"} { + s.Require().NoError(ir.Insert(ctx, newTestIssue(id, "t"), "creator", domain.InsertIssueOpts{})) + } + s.Require().NoError(dr.Insert(ctx, &types.Dependency{ + IssueID: "bd-da-edge-src", DependsOnID: "bd-da-edge-tgt", Type: types.DepBlocks, + }, "linker", domain.DepInsertOpts{})) + + actorOf := func(op, id string) string { + s.T().Helper() + for _, r := range s.readJournal() { + if r.Op == op && r.IssueID == id { + return r.Actor + } + } + s.Failf("no journal row", "op %q for %q", op, id) + return "" + } + + // The bulk edge delete: its dep_remove row belongs to the delete that caused + // it, journaled under the edge's source. + s.clearJournal() + _, err := dr.DeleteAllForIDs(ctx, []string{"bd-da-edge-tgt"}, domain.DepInsertOpts{}, "edge-remover") + s.Require().NoError(err) + s.Equal("edge-remover", actorOf("dep_remove", "bd-da-edge-src")) + + s.clearJournal() + s.Require().NoError(ir.Delete(ctx, "bd-da-single", domain.IssueTableOpts{}, "single-deleter")) + s.Equal("single-deleter", actorOf("delete", "bd-da-single")) + + s.clearJournal() + n, err := ir.DeleteByIDs(ctx, []string{"bd-da-bulk-1", "bd-da-bulk-2"}, domain.IssueTableOpts{}, "bulk-deleter") + s.Require().NoError(err) + s.Equal(2, n) + s.Equal("bulk-deleter", actorOf("delete", "bd-da-bulk-1")) + s.Equal("bulk-deleter", actorOf("delete", "bd-da-bulk-2")) +} + +// TestEventsJournal_CascadeDeleteAttribution is the same promise one level up, +// where a user's `bd delete --cascade` actually enters: every row a cascade +// produces — the named bead, the beads the cascade reached, and the edges that +// went with them — carries the REQUESTING actor. A consumer resolving a delete +// conflict reads this column, and an empty one there would read as a system +// write it must not overrule. +func (s *testSuite) TestEventsJournal_CascadeDeleteAttribution() { + s.enableJournalForTest() + ctx := s.Ctx() + ir := s.issueRepo() + dr := s.depRepo() + + s.Require().NoError(ir.Insert(ctx, newTestIssue("bd-cda-parent", "t"), "creator", domain.InsertIssueOpts{})) + s.Require().NoError(ir.Insert(ctx, newTestIssue("bd-cda-child", "t"), "creator", domain.InsertIssueOpts{})) + s.Require().NoError(dr.Insert(ctx, &types.Dependency{ + IssueID: "bd-cda-child", DependsOnID: "bd-cda-parent", Type: types.DepParentChild, + }, "linker", domain.DepInsertOpts{})) + s.clearJournal() + + _, err := s.issueUseCase().DeleteIssues(ctx, + domain.DeleteIssuesParams{IDs: []string{"bd-cda-parent"}, Cascade: true}, "cascade-deleter") + s.Require().NoError(err) + + var deletes, depRemoves int + for _, r := range s.readJournal() { + switch r.Op { + case "delete": + deletes++ + s.Equalf("cascade-deleter", r.Actor, "delete row for %s", r.IssueID) + case "dep_remove": + depRemoves++ + s.Equalf("cascade-deleter", r.Actor, "dep_remove row for %s", r.IssueID) + } + } + s.Equal(2, deletes, "the named bead and the one the cascade reached") + s.GreaterOrEqual(depRemoves, 1, "the parent-child edge must be journaled") +} + // TestEventsJournal_DisabledWritesNothing asserts the default-off knob writes // no rows. func (s *testSuite) TestEventsJournal_DisabledWritesNothing() { @@ -339,7 +437,7 @@ func (s *testSuite) TestEventsJournal_ReplayFromZeroReconstructsLiveSet() { }, "actor", domain.DepInsertOpts{})) _, err := ir.Close(ctx, "bd-rp-2", domain.CloseRowParams{Reason: "done"}, "actor", domain.IssueTableOpts{}) s.Require().NoError(err) - s.Require().NoError(ir.Delete(ctx, "bd-rp-4", domain.IssueTableOpts{})) + s.Require().NoError(ir.Delete(ctx, "bd-rp-4", domain.IssueTableOpts{}, "actor")) // Replay: create/update/close/comment/dep_* set the snapshot, delete drops it. replay := map[string]*types.Issue{} diff --git a/internal/storage/domain/dependency.go b/internal/storage/domain/dependency.go index 45b96d105..493d5b90b 100644 --- a/internal/storage/domain/dependency.go +++ b/internal/storage/domain/dependency.go @@ -152,7 +152,10 @@ type DependencySQLRepository interface { GetBlockingInfoAcrossIssuesAndWisps(ctx context.Context, issueIDs []string) (BlockingInfo, error) IsBlocked(ctx context.Context, issueID string, opts DepListOpts) (bool, []string, error) - DeleteAllForIDs(ctx context.Context, ids []string, opts DepInsertOpts) (int, error) + // DeleteAllForIDs takes actor for the same reason Delete above does: the + // edges it drops are journaled as dep_remove rows, and a cascade removal + // belongs to the identity whose delete caused it. + DeleteAllForIDs(ctx context.Context, ids []string, opts DepInsertOpts, actor string) (int, error) CountAllForIDs(ctx context.Context, ids []string, opts DepCountsOpts) (int, error) DetectCycles(ctx context.Context) ([][]*types.Issue, error) // DetectCycleReport answers the same walk in the shape issueops.CycleDetector diff --git a/internal/storage/domain/issue.go b/internal/storage/domain/issue.go index 560f8f070..cadb0fd22 100644 --- a/internal/storage/domain/issue.go +++ b/internal/storage/domain/issue.go @@ -75,8 +75,12 @@ type IssueSQLRepository interface { GetReadyWork(ctx context.Context, filter types.WorkFilter) (SearchPage, error) GetReadyWorkWithCounts(ctx context.Context, filter types.WorkFilter) (SearchCountsPage, error) GetDescendants(ctx context.Context, rootID string, filter types.IssueFilter) ([]*types.Issue, error) - Delete(ctx context.Context, id string, opts IssueTableOpts) error - DeleteByIDs(ctx context.Context, ids []string, opts IssueTableOpts) (int, error) + // Delete and DeleteByIDs take actor for the reason Close/Reopen/Claim do: + // the events journal records one row per removed bead and the identity that + // asked for the removal is only known above this seam. A caller with no + // request behind it passes "" (system/unknown), never a placeholder. + Delete(ctx context.Context, id string, opts IssueTableOpts, actor string) error + DeleteByIDs(ctx context.Context, ids []string, opts IssueTableOpts, actor string) (int, error) PartitionWispIDs(ctx context.Context, ids []string) (wispIDs, regularIDs []string, err error) FindAllDependents(ctx context.Context, ids []string) ([]string, error) FindWispDependentsRecursive(ctx context.Context, ids []string) (map[string]bool, error) diff --git a/internal/storage/domain/issue_delete.go b/internal/storage/domain/issue_delete.go index 832cfa9f6..442c9f181 100644 --- a/internal/storage/domain/issue_delete.go +++ b/internal/storage/domain/issue_delete.go @@ -163,10 +163,10 @@ func (u *issueUseCaseImpl) deleteMany(ctx context.Context, params DeleteIssuesPa return result, fmt.Errorf("delete: affected by deletion: %w", err) } - if _, err := u.depRepo.DeleteAllForIDs(ctx, regularIDs, DepInsertOpts{}); err != nil { + if _, err := u.depRepo.DeleteAllForIDs(ctx, regularIDs, DepInsertOpts{}, actor); err != nil { return result, fmt.Errorf("delete: drop deps: %w", err) } - if _, err := u.depRepo.DeleteAllForIDs(ctx, wispIDs, DepInsertOpts{UseWispsTable: true}); err != nil { + if _, err := u.depRepo.DeleteAllForIDs(ctx, wispIDs, DepInsertOpts{UseWispsTable: true}, actor); err != nil { return result, fmt.Errorf("delete: drop wisp deps: %w", err) } // The SYNC-PLANE edges pointing at a deleted wisp, which are not the same @@ -177,7 +177,7 @@ func (u *issueUseCaseImpl) deleteMany(ctx context.Context, params DeleteIssuesPa // a row that no longer exists — dangling, not orphaned, which is not what // issueops.DeleteRequest.Force promises. The store body has always done // this (issueops.deleteIssueRowInTx -> DeleteWispFromDependenciesInTx). - if _, err := u.depRepo.DeleteAllForIDs(ctx, wispIDs, DepInsertOpts{}); err != nil { + if _, err := u.depRepo.DeleteAllForIDs(ctx, wispIDs, DepInsertOpts{}, actor); err != nil { return result, fmt.Errorf("delete: drop sync-plane edges into deleted wisps: %w", err) } if _, err := u.labelRepo.DeleteAllForIDs(ctx, regularIDs, LabelOpts{}); err != nil { @@ -193,11 +193,11 @@ func (u *issueUseCaseImpl) deleteMany(ctx context.Context, params DeleteIssuesPa return result, fmt.Errorf("delete: drop wisp events: %w", err) } - issuesDeleted, err := u.issueRepo.DeleteByIDs(ctx, regularIDs, IssueTableOpts{}) + issuesDeleted, err := u.issueRepo.DeleteByIDs(ctx, regularIDs, IssueTableOpts{}, actor) if err != nil { return result, fmt.Errorf("delete: drop issue rows: %w", err) } - wispsDeleted, err := u.issueRepo.DeleteByIDs(ctx, wispIDs, IssueTableOpts{UseWispsTable: true}) + wispsDeleted, err := u.issueRepo.DeleteByIDs(ctx, wispIDs, IssueTableOpts{UseWispsTable: true}, actor) if err != nil { return result, fmt.Errorf("delete: drop wisp rows: %w", err) } diff --git a/internal/storage/embeddeddolt/batch_creator_contract_test.go b/internal/storage/embeddeddolt/batch_creator_contract_test.go index d87ee5c6d..8bfb53398 100644 --- a/internal/storage/embeddeddolt/batch_creator_contract_test.go +++ b/internal/storage/embeddeddolt/batch_creator_contract_test.go @@ -58,6 +58,9 @@ func TestBatchCreatorContract(t *testing.T) { t.Run("DoesNotMutateTheCallerRequest", func(t *testing.T) { conformance.RunBatchCreatorDoesNotMutateTheCallerRequest(t, ctx, fixture) }) + t.Run("EchoesSubSecondTimestamps", func(t *testing.T) { + conformance.RunBatchCreatorEchoesSubSecondTimestamps(t, ctx, fixture) + }) } func newEmbeddedBatchCreatorFixture(t *testing.T, te *testEnv, prefix string) conformance.BatchCreatorFixture { diff --git a/internal/storage/embeddeddolt/history_presence_contract_test.go b/internal/storage/embeddeddolt/history_presence_contract_test.go new file mode 100644 index 000000000..0539ea243 --- /dev/null +++ b/internal/storage/embeddeddolt/history_presence_contract_test.go @@ -0,0 +1,44 @@ +//go:build cgo + +package embeddeddolt_test + +import ( + "context" + "testing" + + "github.com/steveyegge/beads/internal/storage/storagecontract" + "github.com/steveyegge/beads/internal/types" +) + +// TestHistoryPresenceContract runs the HistoryPresence contract against the +// embedded store — the DEFAULT open path, and the one with no DiffStore, so +// this capability is auto-export's only way to prove a deletion there +// (GH#5896). +func TestHistoryPresenceContract(t *testing.T) { + skipUnlessEmbeddedDolt(t) + te := newTestEnv(t, "hp") + ctx := t.Context() + + fixture := storagecontract.HistoryPresenceFixture{ + Prefix: "hp", + Presence: te.store, + CreateIssue: func(ctx context.Context, id, title string) error { + return te.store.CreateIssue(ctx, &types.Issue{ + ID: id, + Title: title, + Status: types.StatusOpen, + Priority: 2, + IssueType: types.TypeTask, + }, "tester") + }, + DeleteIssue: te.store.DeleteIssue, + Commit: te.store.Commit, + CurrentCommit: te.store.GetCurrentCommit, + ResetHard: func(ctx context.Context, commit string) error { + te.exec(t, ctx, "CALL DOLT_RESET('--hard', ?)", commit) + return nil + }, + } + + storagecontract.RunHistoryPresenceContract(t, ctx, fixture) +} diff --git a/internal/storage/embeddeddolt/journal_actor_matrix_test.go b/internal/storage/embeddeddolt/journal_actor_matrix_test.go new file mode 100644 index 000000000..b4623843a --- /dev/null +++ b/internal/storage/embeddeddolt/journal_actor_matrix_test.go @@ -0,0 +1,180 @@ +//go:build cgo + +package embeddeddolt_test + +import ( + "context" + "testing" + + "github.com/steveyegge/beads/internal/storage/embeddeddolt" + "github.com/steveyegge/beads/internal/types" + publicops "github.com/steveyegge/beads/issueops" +) + +// journalOpActor is one (op, issue_id, actor) triple read straight out of the +// journal table. +type journalOpActor struct { + op string + id string + actor string +} + +func readJournalOpActors(t *testing.T, env *testEnv) []journalOpActor { + t.Helper() + ctx := context.Background() + db, cleanup, err := embeddeddolt.OpenSQL(ctx, env.dataDir, env.database, "main") + if err != nil { + t.Fatalf("OpenSQL: %v", err) + } + defer cleanup() + rows, err := db.QueryContext(ctx, "SELECT op, issue_id, actor FROM bd_events_journal ORDER BY seq ASC") + if err != nil { + t.Fatalf("query journal: %v", err) + } + defer rows.Close() + var out []journalOpActor + for rows.Next() { + var r journalOpActor + if err := rows.Scan(&r.op, &r.id, &r.actor); err != nil { + t.Fatalf("scan: %v", err) + } + out = append(out, r) + } + if err := rows.Err(); err != nil { + t.Fatalf("rows: %v", err) + } + return out +} + +// TestEventsJournal_ActorMatrixOnEmbedded runs one mutation of every journaled +// kind through the DEFAULT LOCAL WORKSPACE — the embedded store, no daemon, no +// SQL server — and asserts at the database that each landed a row and that each +// row names the right identity. +// +// It is the release gate the field report implies. Its two earlier claims were +// that the journal had no actor column and no rows; both turned out to be +// something else (a migration that had since landed, and default-off +// activation), but the sub-claim underneath them — that a consumer cannot trust +// this column — was real for deletes. A per-op matrix is what makes that +// trustworthy as a whole rather than one op at a time: a future path that +// forgets to thread its actor fails here even if its own test does not exist +// yet. +// +// The empty cases are asserted as deliberately as the attributed ones. A +// derived is_blocked recompute is bd's own bookkeeping, not something the actor +// who tripped it did, and the 0066 contract says a consumer must read an empty +// actor as system/unknown rather than as a conflicting writer — so a test that +// let an empty actor pass anywhere would be pinning nothing. +func TestEventsJournal_ActorMatrixOnEmbedded(t *testing.T) { + env := newTestEnv(t, "am") + store := env.store + store.SetEventsJournalEnabled(true) + ctx := context.Background() + + mustCreate := func(id string) { + t.Helper() + if err := store.CreateIssue(ctx, &types.Issue{ + ID: id, Title: "t-" + id, IssueType: types.TypeTask, Status: types.StatusOpen, + }, "alice"); err != nil { + t.Fatalf("create %s: %v", id, err) + } + } + + // The §1 spread: every op a consumer can observe, in one workspace. + mustCreate("am-a") + mustCreate("am-b") + if err := store.UpdateIssue(ctx, "am-a", map[string]any{"title": "renamed"}, "alice"); err != nil { + t.Fatalf("update: %v", err) + } + // Label edits journal as `update` — a label is part of the bead's state, so + // a replaying consumer needs the whole post-mutation snapshot, not an event + // kind of its own. + if err := store.AddLabel(ctx, "am-a", "urgent", "alice"); err != nil { + t.Fatalf("add label: %v", err) + } + if err := store.RemoveLabel(ctx, "am-a", "urgent", "alice"); err != nil { + t.Fatalf("remove label: %v", err) + } + if _, err := store.AddIssueComment(ctx, "am-a", "alice", "a note"); err != nil { + t.Fatalf("comment: %v", err) + } + if err := store.AddDependency(ctx, &types.Dependency{ + IssueID: "am-b", DependsOnID: "am-a", Type: types.DepBlocks, + }, "alice"); err != nil { + t.Fatalf("add dep: %v", err) + } + // A direct `bd dep remove`, which has always been attributed. + if err := store.RemoveDependency(ctx, "am-b", "am-a", "alice"); err != nil { + t.Fatalf("remove dep: %v", err) + } + // Re-add, so the delete below has an edge to cascade off. + if err := store.AddDependency(ctx, &types.Dependency{ + IssueID: "am-b", DependsOnID: "am-a", Type: types.DepBlocks, + }, "alice"); err != nil { + t.Fatalf("re-add dep: %v", err) + } + if err := store.CloseIssue(ctx, "am-b", "done", "alice", ""); err != nil { + t.Fatalf("close: %v", err) + } + // The role, which is what `bd delete` reaches — not storage.DeleteIssue. + deleter, err := store.Deleter() + if err != nil { + t.Fatalf("Deleter(): %v", err) + } + if _, err := deleter.Delete(ctx, publicops.DeleteRequest{ + IDs: []string{"am-a"}, Force: true, Actor: "alice", + }); err != nil { + t.Fatalf("delete: %v", err) + } + + rows := readJournalOpActors(t, env) + has := func(op, id, actor string) bool { + for _, r := range rows { + if r.op == op && r.id == id && r.actor == actor { + return true + } + } + return false + } + + for _, want := range []struct { + what string + op string + id string + actor string + }{ + {"create", "create", "am-a", "alice"}, + {"update", "update", "am-a", "alice"}, + {"comment", "comment", "am-a", "alice"}, + {"dep_add", "dep_add", "am-b", "alice"}, + {"dep_remove (direct)", "dep_remove", "am-b", "alice"}, + {"close", "close", "am-b", "alice"}, + // The delete row and the edge the cascade took with it. The edge is + // journaled under its SOURCE, the surviving bead, which is why the two + // rows name different ids and the same actor. + {"delete (role path)", "delete", "am-a", "alice"}, + {"dep_remove (cascade)", "dep_remove", "am-b", "alice"}, + } { + if !has(want.op, want.id, want.actor) { + t.Errorf("no %s row for %s with actor %q\njournal: %+v", want.what, want.id, want.actor, rows) + } + } + + // The other half of the contract: derived readiness maintenance is bd's own + // bookkeeping and stays unattributed. Removing am-b's only blocker flips its + // persisted is_blocked, which journals as an update carrying no actor. + if !has("update", "am-b", "") { + t.Errorf("no unattributed derived is_blocked update for am-b; the '' half of the contract is not being exercised\njournal: %+v", rows) + } + + // Nothing may carry an actor bd never saw, and no attributed op may slip + // through empty. Every '' row in this workspace is a derived update. + for _, r := range rows { + if r.actor == "" && r.op != "update" { + t.Errorf("op %q for %s recorded no actor; only derived is_blocked updates may\njournal: %+v", r.op, r.id, rows) + } + if r.actor != "" && r.actor != "alice" { + t.Errorf("row %+v names an actor no mutation used", r) + } + } +} diff --git a/internal/storage/embeddeddolt/lifecycle_create_contract_test.go b/internal/storage/embeddeddolt/lifecycle_create_contract_test.go index 55da92ff7..96d586b0d 100644 --- a/internal/storage/embeddeddolt/lifecycle_create_contract_test.go +++ b/internal/storage/embeddeddolt/lifecycle_create_contract_test.go @@ -37,6 +37,9 @@ func TestLifecycleCreateContract(t *testing.T) { t.Run("WritesEveryScalarField", func(t *testing.T) { conformance.RunLifecycleCreateWritesEveryScalarField(t, ctx, fixture) }) + t.Run("EchoesSubSecondTimestamps", func(t *testing.T) { + conformance.RunLifecycleCreateEchoesSubSecondTimestamps(t, ctx, fixture) + }) } func newEmbeddedLifecycleCreateFixture(t *testing.T, te *testEnv, prefix string) conformance.LifecycleCreateFixture { diff --git a/internal/storage/embeddeddolt/migrate_dep_rekey_dedup_test.go b/internal/storage/embeddeddolt/migrate_dep_rekey_dedup_test.go new file mode 100644 index 000000000..1fc2e250f --- /dev/null +++ b/internal/storage/embeddeddolt/migrate_dep_rekey_dedup_test.go @@ -0,0 +1,552 @@ +//go:build cgo + +package embeddeddolt_test + +import ( + "context" + "database/sql" + "errors" + "path/filepath" + "slices" + "strings" + "sync" + "testing" + + "github.com/steveyegge/beads/internal/storage/depid" + "github.com/steveyegge/beads/internal/storage/embeddeddolt" + "github.com/steveyegge/beads/internal/storage/issueops" + "github.com/steveyegge/beads/internal/storage/schema" + "github.com/steveyegge/beads/internal/types" +) + +// Real-Dolt coverage for the merge-aware dependency-id re-key +// (rekeyDependencyIDs, internal/storage/schema/dep_id_backfill.go) and its +// completion marker, ignored migration 0026 (gastownhall/beads#5268). +// +// Why this cannot be a sqlmock test. The bug IS Dolt's primary-key enforcement: +// the old row-at-a-time rewrite issued statements a statement-echo mock happily +// accepts, and only a real engine answers the second one with "duplicate primary +// key given" and leaves the table half-re-keyed. The same reason +// migrate_wisp_dep_forward_repair_test.go exists. These tests also exercise +// properties of MigrateUp's step ORDER rather than of any single statement: that +// a pending 0026 forces a pass on a database whose main cursor is already at +// latest, that an aborted re-key leaves 0026 unrecorded so the next open retries, +// and that the ON UPDATE CASCADE on the typed target columns is what makes a +// plain rename leave a stale primary key behind. + +// depRekeyMarkerVersion is ignored migration 0026, the clone-local marker whose +// pending state forces the one repair pass. +const depRekeyMarkerVersion = 26 + +// TestDepRekeyMarkerIsLatestIgnored keeps the fixtures in this file honest. They +// force the repair pass by unrecording the marker, which only works while the +// pass is genuinely pending afterwards. If a later ignored migration lands, this +// fails first with an actionable message instead of the marker-driven tests +// failing with assertions that indict the repair code. +func TestDepRekeyMarkerIsLatestIgnored(t *testing.T) { + if got := schema.LatestIgnoredVersion(); got != depRekeyMarkerVersion { + t.Fatalf("latest ignored migration is %d, not the dep-rekey marker %d; "+ + "if you added ignored %d, point depRekeyMarkerVersion at 0026 anyway and confirm "+ + "unrecordIgnoredVersionsFrom still leaves the marker pending", got, depRekeyMarkerVersion, got) + } +} + +// TestEmbeddedDepRekeyRepairsHalfRekeyedDuplicateEdge is the victim repair: a +// database that a pre-1.3.0 binary left half-re-keyed and then declared +// migrated, because the per-step commits had already carried the main cursor to +// latest before the re-key aborted. +// +// The seeded shape is the reporter's, minus the 5,336-row haystack: one logical +// edge recorded twice, once as an issue ref and once as an external ref -- legal, +// since the unique keys are per typed column -- with the external twin already +// moved onto the deterministic id by the aborted pass. +func TestEmbeddedDepRekeyRepairsHalfRekeyedDuplicateEdge(t *testing.T) { + requireEmbedded(t) + ctx := t.Context() + + dataDir := seedMigratedStore(t, ctx) + conn, closeConn := openDepConn(t, ctx, dataDir) + + const source, target = "hq-cv-vvnmq", "ops-w05" + want := depid.New(source, target) + seedIssue(t, ctx, conn, source) + seedIssue(t, ctx, conn, target) + // The surviving orientation, still carrying its 0043-minted random id. + seedDependency(t, ctx, conn, "random-issue-row", source, strptr(target), nil, nil) + // The twin the aborted pass already moved onto the deterministic id. It is + // the loser anyway: the survivor rule is the typed column, not who got there + // first, so the repair has to free this id before reusing it. + seedDependency(t, ctx, conn, want, source, nil, nil, strptr(target)) + commitSeed(t, ctx, conn, "test: reproduce the #5268 half-re-keyed duplicate edge") + + // What makes this database a class-2b victim: the main cursor is at latest + // and every numbered migration is recorded, so without a pending marker + // migrationWorkNeeded short-circuits and the re-key never runs again. + unrecordIgnoredVersionsFrom(t, ctx, conn, depRekeyMarkerVersion) + closeConn() + + conn2, _ := openDepConn(t, ctx, dataDir) + + // Pre-fix this returns "rekey dependency ids: dependencies: re-key id + // random-issue-row -> ...: duplicate primary key given". + if _, err := schema.MigrateUp(ctx, conn2); err != nil { + t.Fatalf("MigrateUp over a half-re-keyed duplicate edge: %v", err) + } + + wantRows := []depRow{{id: want, issueID: source, dependsOnIssueID: target}} + if got := readDeps(t, ctx, conn2); !slices.Equal(got, wantRows) { + t.Fatalf("dependencies = %v, want %v", got, wantRows) + } + if !ignoredVersionRecorded(t, ctx, conn2, depRekeyMarkerVersion) { + t.Fatalf("ignored migration %d not recorded after a successful pass", depRekeyMarkerVersion) + } + + // With the marker recorded and both cursors at latest, migrationWorkNeeded + // is false and MigrateUp short-circuits before the re-key. Prove that + // directly rather than by "nothing changed": seed a row whose id IS + // divergent, and assert the next open leaves it alone. If the pass still + // ran, this row would be re-keyed. + seedIssue(t, ctx, conn2, "steady-src") + seedDependency(t, ctx, conn2, "steady-random-id", "steady-src", nil, nil, strptr("external:e1")) + commitSeed(t, ctx, conn2, "test: a divergent row written after the repair pass") + + if _, err := schema.MigrateUp(ctx, conn2); err != nil { + t.Fatalf("MigrateUp on the converged store: %v", err) + } + wantSteady := []depRow{ + {id: want, issueID: source, dependsOnIssueID: target}, + {id: "steady-random-id", issueID: "steady-src", dependsOnExternal: "external:e1"}, + } + if got := readDeps(t, ctx, conn2); !slices.Equal(got, wantSteady) { + t.Fatalf("after the steady-state open dependencies = %v, want %v", got, wantSteady) + } +} + +// TestEmbeddedDepRekeyMergesFreshDuplicateEdges is the class-1 victim: a +// database with duplicate typed edges and pending migrations, i.e. any rig that +// upgrades across the #4259 fix carrying an old wisp-to-issue conversion. The +// re-key runs because migrations are pending, and must merge rather than abort. +func TestEmbeddedDepRekeyMergesFreshDuplicateEdges(t *testing.T) { + requireEmbedded(t) + ctx := t.Context() + + t.Run("dependencies, main cursor behind", func(t *testing.T) { + dataDir := seedMainSchemaAt(t, ctx, 53) + conn, closeConn := openDepConn(t, ctx, dataDir) + + seedIssue(t, ctx, conn, "src") + seedIssue(t, ctx, conn, "tgt") + seedIssue(t, ctx, conn, "other") + // The duplicate pair, both still random, plus an unrelated edge that + // must survive the pass re-keyed and intact. + seedDependency(t, ctx, conn, "rand-a", "src", strptr("tgt"), nil, nil) + seedDependency(t, ctx, conn, "rand-b", "src", nil, nil, strptr("tgt")) + seedDependency(t, ctx, conn, "rand-c", "other", strptr("tgt"), nil, nil) + commitSeed(t, ctx, conn, "test: duplicate typed edges before the 54..latest jump") + closeConn() + + conn2, _ := openDepConn(t, ctx, dataDir) + if _, err := schema.MigrateUp(ctx, conn2); err != nil { + t.Fatalf("MigrateUp over duplicate typed edges: %v", err) + } + if v := currentMainVersion(t, ctx, conn2); v != schema.LatestVersion() { + t.Fatalf("main schema version = %d, want latest %d", v, schema.LatestVersion()) + } + + want := []depRow{ + {id: depid.New("other", "tgt"), issueID: "other", dependsOnIssueID: "tgt"}, + {id: depid.New("src", "tgt"), issueID: "src", dependsOnIssueID: "tgt"}, + } + if got := readDeps(t, ctx, conn2); !slices.Equal(got, want) { + t.Fatalf("dependencies = %v, want %v", got, want) + } + }) + + t.Run("wisp_dependencies", func(t *testing.T) { + // The clone-local twin of the same table. Its re-key never syncs, but it + // aborts the whole pass just as loudly, so it needs the same merge. + dataDir := seedMigratedStore(t, ctx) + conn, closeConn := openDepConn(t, ctx, dataDir) + + seedWisp(t, ctx, conn, "w1") + seedIssue(t, ctx, conn, "wt") + seedWispDependency(t, ctx, conn, "rand-w-a", "w1", strptr("wt"), nil, nil) + seedWispDependency(t, ctx, conn, "rand-w-b", "w1", nil, nil, strptr("wt")) + commitSeed(t, ctx, conn, "test: duplicate typed wisp edges") + + unrecordIgnoredVersionsFrom(t, ctx, conn, depRekeyMarkerVersion) + closeConn() + + conn2, _ := openDepConn(t, ctx, dataDir) + if _, err := schema.MigrateUp(ctx, conn2); err != nil { + t.Fatalf("MigrateUp over duplicate typed wisp edges: %v", err) + } + want := []depRow{{id: depid.New("w1", "wt"), issueID: "w1", dependsOnIssueID: "wt"}} + if got := readDepTable(t, ctx, conn2, "wisp_dependencies"); !slices.Equal(got, want) { + t.Fatalf("wisp_dependencies = %v, want %v", got, want) + } + }) +} + +// TestEmbeddedDepRekeyConvergesRenameChain is the state a rename leaves behind +// on any binary that predates the issueops fix in this change: the FK's ON UPDATE +// CASCADE retargets depends_on_issue_id before the rewrite can match the old +// value, so the row keeps an id derived from the pre-rename target. Rename a +// second issue INTO the freed name and two rows contend for one deterministic +// id, with neither row corrupt. +// +// This is mechanically convergible -- vacate the occupant first -- and refusing +// it would fail every open of an ordinary workspace, so the planner orders the +// chain instead. +func TestEmbeddedDepRekeyConvergesRenameChain(t *testing.T) { + requireEmbedded(t) + ctx := t.Context() + + dataDir := seedMigratedStore(t, ctx) + conn, closeConn := openDepConn(t, ctx, dataDir) + + for _, id := range []string{"src", "name-a", "name-b"} { + seedIssue(t, ctx, conn, id) + } + // src -> name-b, keyed as if its target had been renamed a -> b. + seedDependency(t, ctx, conn, depid.New("src", "name-a"), "src", strptr("name-b"), nil, nil) + // src -> name-a, keyed as if its target had been renamed c -> a. It wants + // the id the row above is currently sitting on. + seedDependency(t, ctx, conn, depid.New("src", "name-c"), "src", strptr("name-a"), nil, nil) + commitSeed(t, ctx, conn, "test: two renames leaving a re-key chain") + + unrecordIgnoredVersionsFrom(t, ctx, conn, depRekeyMarkerVersion) + closeConn() + + conn2, _ := openDepConn(t, ctx, dataDir) + if _, err := schema.MigrateUp(ctx, conn2); err != nil { + t.Fatalf("MigrateUp over a re-key chain: %v", err) + } + want := []depRow{ + {id: depid.New("src", "name-a"), issueID: "src", dependsOnIssueID: "name-a"}, + {id: depid.New("src", "name-b"), issueID: "src", dependsOnIssueID: "name-b"}, + } + got := readDeps(t, ctx, conn2) + slices.SortFunc(got, func(a, b depRow) int { return strings.Compare(a.id, b.id) }) + slices.SortFunc(want, func(a, b depRow) int { return strings.Compare(a.id, b.id) }) + if !slices.Equal(got, want) { + t.Fatalf("dependencies = %v, want %v", got, want) + } +} + +// TestEmbeddedRenameKeepsDependencyIDsDeterministic closes the chain state at +// its source. updateIssueIDInTx renames the issues row first, so +// fk_dep_issue_target's ON UPDATE CASCADE has already moved depends_on_issue_id +// by the time replaceDependencyTargetInTx looks for the old value -- it matched +// nothing, and the row kept a primary key derived from the old name. After the +// fix the id is re-derived, so no rename mints a stale key for the migration +// pass to untangle later. +func TestEmbeddedRenameKeepsDependencyIDsDeterministic(t *testing.T) { + requireEmbedded(t) + ctx := t.Context() + + dataDir := seedMigratedStore(t, ctx) + conn, _ := openDepConn(t, ctx, dataDir) + + for _, id := range []string{"src", "old-target"} { + seedIssue(t, ctx, conn, id) + } + seedDependency(t, ctx, conn, depid.New("src", "old-target"), "src", strptr("old-target"), nil, nil) + commitSeed(t, ctx, conn, "test: an edge whose target is about to be renamed") + + renameIssue(t, ctx, conn, "old-target", "new-target") + + want := []depRow{{id: depid.New("src", "new-target"), issueID: "src", dependsOnIssueID: "new-target"}} + if got := readDeps(t, ctx, conn); !slices.Equal(got, want) { + t.Fatalf("after renaming the target, dependencies = %v, want %v", got, want) + } + + // The source side already had this property (rekeyDependencySourceInTx); + // assert it too so the two halves cannot drift apart. + renameIssue(t, ctx, conn, "src", "new-src") + want = []depRow{{id: depid.New("new-src", "new-target"), issueID: "new-src", dependsOnIssueID: "new-target"}} + if got := readDeps(t, ctx, conn); !slices.Equal(got, want) { + t.Fatalf("after renaming the source, dependencies = %v, want %v", got, want) + } +} + +// TestEmbeddedDepRekeyRefusesToWriteIntoDirtyDependencies covers the +// marker-versus-guard hazard. MigrateUp's changed-signature guard runs AFTER +// ignoredSource.migrate has durably recorded 0026, so a re-key that wrote into a +// pre-existing dirty table would fail the open once and then never retry: the +// heal would sit uncommitted and ride an unrelated user commit. The re-key +// refuses at plan time instead -- nothing written, marker unrecorded -- and the +// documented DirtyTablesError recovery converges it. +func TestEmbeddedDepRekeyRefusesToWriteIntoDirtyDependencies(t *testing.T) { + requireEmbedded(t) + ctx := t.Context() + + dataDir := seedMigratedStore(t, ctx) + conn, closeConn := openDepConn(t, ctx, dataDir) + + seedIssue(t, ctx, conn, "d-src") + seedIssue(t, ctx, conn, "d-tgt") + commitSeed(t, ctx, conn, "test: issues for the dirty-dependencies victim") + // Deliberately NOT committed: this is the working-set state a batch-mode + // session, or a pre-1.3.0 aborted re-key, leaves behind. + seedDependency(t, ctx, conn, "dirty-random-id", "d-src", strptr("d-tgt"), nil, nil) + unrecordIgnoredVersionsFrom(t, ctx, conn, depRekeyMarkerVersion) + closeConn() + + conn2, closeConn2 := openDepConn(t, ctx, dataDir) + before := readDeps(t, ctx, conn2) + + _, err := schema.MigrateUp(ctx, conn2) + if err == nil { + t.Fatal("MigrateUp re-keyed a pre-existing dirty dependencies table") + } + var dirtyErr *schema.DirtyTablesError + if !errors.As(err, &dirtyErr) { + t.Fatalf("error %v is not a *schema.DirtyTablesError", err) + } + if !slices.Contains(dirtyErr.Tables, "dependencies") { + t.Errorf("dirtyErr.Tables = %v, want it to name dependencies", dirtyErr.Tables) + } + if got := readDeps(t, ctx, conn2); !slices.Equal(got, before) { + t.Fatalf("dependencies = %v, want the pre-pass rows %v untouched", got, before) + } + if ignoredVersionRecorded(t, ctx, conn2, depRekeyMarkerVersion) { + t.Fatalf("ignored migration %d recorded despite the refusal", depRekeyMarkerVersion) + } + + // The documented recovery: commit the working set, re-open, converge. + commitSeed(t, ctx, conn2, "test: commit the dirty dependency row") + closeConn2() + + conn3, _ := openDepConn(t, ctx, dataDir) + if _, err := schema.MigrateUp(ctx, conn3); err != nil { + t.Fatalf("MigrateUp after committing the working set: %v", err) + } + want := []depRow{{id: depid.New("d-src", "d-tgt"), issueID: "d-src", dependsOnIssueID: "d-tgt"}} + if got := readDeps(t, ctx, conn3); !slices.Equal(got, want) { + t.Fatalf("dependencies = %v, want %v", got, want) + } + if !ignoredVersionRecorded(t, ctx, conn3, depRekeyMarkerVersion) { + t.Fatalf("ignored migration %d not recorded after the retried pass", depRekeyMarkerVersion) + } +} + +// TestEmbeddedDepRekeyAbortLeavesMarkerUnrecorded pins the retry guarantee that +// the marker's position in MigrateUp buys: a re-key that cannot converge fails +// the pass BEFORE ignoredSource.migrate records 0026, so the database does not +// claim it migrated and the next open tries again. This is the property whose +// absence turned #5268 from a loud error into silent half-applied state. +// +// The unconvergible shape is a rotation: two rows each holding exactly the id +// the other needs, with no free id to move through. Unlike the chain above there +// is no ordering that works, and unlike a malformed squatter it is insertable +// under every constraint the live schema carries. +func TestEmbeddedDepRekeyAbortLeavesMarkerUnrecorded(t *testing.T) { + requireEmbedded(t) + ctx := t.Context() + + dataDir := seedMigratedStore(t, ctx) + conn, closeConn := openDepConn(t, ctx, dataDir) + + for _, id := range []string{"c-src", "c1", "c2"} { + seedIssue(t, ctx, conn, id) + } + seedDependency(t, ctx, conn, depid.New("c-src", "c2"), "c-src", strptr("c1"), nil, nil) + seedDependency(t, ctx, conn, depid.New("c-src", "c1"), "c-src", strptr("c2"), nil, nil) + commitSeed(t, ctx, conn, "test: two dependency rows holding each other's deterministic id") + + unrecordIgnoredVersionsFrom(t, ctx, conn, depRekeyMarkerVersion) + closeConn() + + conn2, closeConn2 := openDepConn(t, ctx, dataDir) + before := readDeps(t, ctx, conn2) + + _, err := schema.MigrateUp(ctx, conn2) + if err == nil { + t.Fatal("MigrateUp succeeded over an unconvergible rotation") + } + var conflict *schema.DependencyRekeyConflictError + if !errors.As(err, &conflict) { + t.Fatalf("error %v is not a *schema.DependencyRekeyConflictError", err) + } + if !strings.Contains(err.Error(), "bd doctor") { + t.Errorf("error %q does not point at bd doctor", err) + } + if ignoredVersionRecorded(t, ctx, conn2, depRekeyMarkerVersion) { + t.Fatalf("ignored migration %d recorded despite the failed re-key", depRekeyMarkerVersion) + } + // Nothing was written: the plan is validated before the first statement. + // Compared by value, since a row COUNT cannot see a pre-validation write. + if got := readDeps(t, ctx, conn2); !slices.Equal(got, before) { + t.Fatalf("dependencies = %v, want the seeded rows %v untouched", got, before) + } + + // A read-only command must still open. The re-key is a convergence repair, + // not a precondition for reading, and before it existed this clone opened + // fine; bricking `bd list` on latent id corruption the user cannot inspect + // without it would be the worse outcome. Nothing is lost: the marker is + // still unrecorded, so the next strict open retries. + closeConn2() + store, err := embeddeddolt.OpenForReadOnlyCommand(ctx, filepath.Dir(dataDir), "testdb", "main") + if err != nil { + t.Fatalf("OpenForReadOnlyCommand over an unconvergible re-key: %v", err) + } + store.Close() + + // Repair the way `bd doctor` would -- break the rotation by giving one row + // a free id -- and prove the retried pass converges. + conn3, closeConn3 := openDepConn(t, ctx, dataDir) + mustExecConn(t, ctx, conn3, "UPDATE dependencies SET id = ? WHERE id = ?", + "interim-free-id", depid.New("c-src", "c2")) + commitSeed(t, ctx, conn3, "test: break the re-key rotation") + closeConn3() + + conn4, _ := openDepConn(t, ctx, dataDir) + if _, err := schema.MigrateUp(ctx, conn4); err != nil { + t.Fatalf("MigrateUp after breaking the rotation: %v", err) + } + want := []depRow{ + {id: depid.New("c-src", "c1"), issueID: "c-src", dependsOnIssueID: "c1"}, + {id: depid.New("c-src", "c2"), issueID: "c-src", dependsOnIssueID: "c2"}, + } + got := readDeps(t, ctx, conn4) + slices.SortFunc(got, func(a, b depRow) int { return strings.Compare(a.id, b.id) }) + slices.SortFunc(want, func(a, b depRow) int { return strings.Compare(a.id, b.id) }) + if !slices.Equal(got, want) { + t.Fatalf("dependencies = %v, want %v", got, want) + } + if !ignoredVersionRecorded(t, ctx, conn4, depRekeyMarkerVersion) { + t.Fatalf("ignored migration %d not recorded after the retried pass succeeded", depRekeyMarkerVersion) + } +} + +// --- helpers --- + +type depRow struct { + id string + issueID string + dependsOnIssueID string + dependsOnWispID string + dependsOnExternal string +} + +// seedMigratedStore returns the dataDir of a store that has completed a full +// MigrateUp, i.e. one whose main AND ignored cursors are both at latest -- the +// state every marker-driven fixture below starts from. +func seedMigratedStore(t *testing.T, ctx context.Context) string { + t.Helper() + dataDir := seedMainSchemaAt(t, ctx, schema.LatestVersion()) + conn, closeConn := openDepConn(t, ctx, dataDir) + if _, err := schema.MigrateUp(ctx, conn); err != nil { + t.Fatalf("MigrateUp on the seed store: %v", err) + } + closeConn() + return dataDir +} + +// openDepConn is openPinnedConn with a guarded t.Cleanup. These tests reopen the +// store mid-test to force a fresh migration pass, so the close has to be +// callable explicitly AND be idempotent: without the cleanup, any t.Fatal +// between open and close leaks the pinned connection and the embedded Dolt +// engine behind it for the rest of the test binary. +func openDepConn(t *testing.T, ctx context.Context, dataDir string) (*sql.Conn, func()) { + t.Helper() + conn, cleanup := openPinnedConn(t, ctx, dataDir) + var once sync.Once + closeOnce := func() { once.Do(cleanup) } + t.Cleanup(closeOnce) + return conn, closeOnce +} + +func seedDependency(t *testing.T, ctx context.Context, conn *sql.Conn, id, issueID string, issueTarget, wispTarget, externalTarget *string) { + t.Helper() + seedDepTable(t, ctx, conn, "dependencies", id, issueID, issueTarget, wispTarget, externalTarget) +} + +func seedWispDependency(t *testing.T, ctx context.Context, conn *sql.Conn, id, issueID string, issueTarget, wispTarget, externalTarget *string) { + t.Helper() + seedDepTable(t, ctx, conn, "wisp_dependencies", id, issueID, issueTarget, wispTarget, externalTarget) +} + +// seedDepTable inserts an edge with an EXPLICIT id, which is the whole point: +// the affected rows predate the deterministic derivation, so they cannot be +// created through AddDependency. It deliberately does not replace +// migrate_wisp_dep_forward_repair_test.go's seedWispDep, which seeds the LEGACY +// wisp_dependencies shape -- that table has no id column at all, so the two +// helpers cannot share an INSERT. +func seedDepTable(t *testing.T, ctx context.Context, conn *sql.Conn, table, id, issueID string, issueTarget, wispTarget, externalTarget *string) { + t.Helper() + mustExecConn(t, ctx, conn, ` +INSERT INTO `+table+` (id, issue_id, depends_on_issue_id, depends_on_wisp_id, depends_on_external, type, created_at, created_by, metadata) +VALUES (?, ?, ?, ?, ?, 'blocks', NOW(), 'tester', JSON_OBJECT())`, + id, issueID, nullable(issueTarget), nullable(wispTarget), nullable(externalTarget)) +} + +// renameIssue drives the real rename path (issueops.UpdateIssueIDInTx), so the +// FK's ON UPDATE CASCADE fires exactly as it does for `bd rename`. +func renameIssue(t *testing.T, ctx context.Context, conn *sql.Conn, oldID, newID string) { + t.Helper() + tx, err := conn.BeginTx(ctx, nil) + if err != nil { + t.Fatalf("begin rename tx: %v", err) + } + issue := &types.Issue{ID: newID, Title: "i", Status: types.StatusOpen, Priority: 2, IssueType: types.TypeTask} + if err := issueops.UpdateIssueIDInTx(ctx, tx, oldID, newID, issue, "tester"); err != nil { + _ = tx.Rollback() + t.Fatalf("rename %s -> %s: %v", oldID, newID, err) + } + if err := tx.Commit(); err != nil { + t.Fatalf("commit rename %s -> %s: %v", oldID, newID, err) + } +} + +func readDeps(t *testing.T, ctx context.Context, conn *sql.Conn) []depRow { + t.Helper() + return readDepTable(t, ctx, conn, "dependencies") +} + +func readDepTable(t *testing.T, ctx context.Context, conn *sql.Conn, table string) []depRow { + t.Helper() + rows, err := conn.QueryContext(ctx, ` +SELECT id, issue_id, + COALESCE(depends_on_issue_id, ''), + COALESCE(depends_on_wisp_id, ''), + COALESCE(depends_on_external, '') +FROM `+table+` +ORDER BY issue_id, id`) + if err != nil { + t.Fatalf("read %s: %v", table, err) + } + defer func() { _ = rows.Close() }() + + var out []depRow + for rows.Next() { + var r depRow + if err := rows.Scan(&r.id, &r.issueID, &r.dependsOnIssueID, &r.dependsOnWispID, &r.dependsOnExternal); err != nil { + t.Fatalf("scan %s row: %v", table, err) + } + out = append(out, r) + } + if err := rows.Err(); err != nil { + t.Fatalf("iterate %s: %v", table, err) + } + return out +} + +// unrecordIgnoredVersionsFrom removes the ignored-series cursor rows from +// version upward, reproducing the state a clone is in before it has run the +// marker's pass. It deletes a RANGE rather than the single row because the +// cursor is COALESCE(MAX(version), 0) and migrate only applies versions above +// it: with a later ignored migration present, dropping only 0026 would leave the +// cursor at latest and the pass would silently never run. The cursor table is +// dolt-ignored, so this needs no commit. +func unrecordIgnoredVersionsFrom(t *testing.T, ctx context.Context, conn *sql.Conn, version int) { + t.Helper() + mustExecConn(t, ctx, conn, "DELETE FROM ignored_schema_migrations WHERE version >= ?", version) +} + +func ignoredVersionRecorded(t *testing.T, ctx context.Context, conn *sql.Conn, version int) bool { + t.Helper() + return scalarInt(t, ctx, conn, + "SELECT COUNT(*) FROM ignored_schema_migrations WHERE version = ?", version) > 0 +} diff --git a/internal/storage/embeddeddolt/migrate_events_flip_test.go b/internal/storage/embeddeddolt/migrate_events_flip_test.go index 185f139d9..4b5ade2e1 100644 --- a/internal/storage/embeddeddolt/migrate_events_flip_test.go +++ b/internal/storage/embeddeddolt/migrate_events_flip_test.go @@ -168,10 +168,10 @@ func mustDrain(t *testing.T, ctx context.Context, conn *sql.Conn, sqlText string } } -func scalarInt(t *testing.T, ctx context.Context, conn *sql.Conn, query string) int { +func scalarInt(t *testing.T, ctx context.Context, conn *sql.Conn, query string, args ...any) int { t.Helper() var v int - if err := conn.QueryRowContext(ctx, query).Scan(&v); err != nil { + if err := conn.QueryRowContext(ctx, query, args...).Scan(&v); err != nil { t.Fatalf("scalar %q: %v", query, err) } return v diff --git a/internal/storage/embeddeddolt/migrate_ignored_cursor_untrack_test.go b/internal/storage/embeddeddolt/migrate_ignored_cursor_untrack_test.go new file mode 100644 index 000000000..5a8e19f78 --- /dev/null +++ b/internal/storage/embeddeddolt/migrate_ignored_cursor_untrack_test.go @@ -0,0 +1,651 @@ +//go:build cgo + +package embeddeddolt_test + +import ( + "context" + "database/sql" + "os" + "path/filepath" + "strconv" + "strings" + "testing" + + "github.com/steveyegge/beads/internal/storage/dberrors" + "github.com/steveyegge/beads/internal/storage/embeddeddolt" +) + +// These tests cover gastownhall/beads#4356 against the real engine: a database +// whose ignored_schema_migrations table is COMMITTED at HEAD. +// +// dolt_ignore only exempts tables that were never committed, so on such a +// database the ignore pattern bd re-asserts at every open is inert. Every +// staging path anti-joins dolt_ignore, so the table can be dirtied but never +// committed, and Dolt's merge preflight refuses to start while a tracked table +// is dirty — push keeps working and every pull dies with Error 1105, forever. +// +// The fixture recipe is DOLT_ADD('-f') + DOLT_COMMIT, the same one +// internal/storage/dolt/aux_row_id_rekey_test.go uses to force an ignored +// table onto the versioned plane, and the state 0062's header notes that +// branch-per-test databases materialize on their own. + +const untrackScratchTable = "__temp__ignored_schema_migrations_untrack" + +// legacyTrackedFixture is a store whose cursor table has been committed into +// HEAD, closed and ready to be reopened through the code path under test. The +// store must be closed to reopen it, so the fixture hands back the paths +// rather than a live store. +type legacyTrackedFixture struct { + beadsDir string + dataDir string + database string + // cursorRows is the cursor's contents before any heal ran, captured as + // "version|content_hash" so the assertion is about the rows themselves and + // not merely their number. + cursorRows []string + commits int +} + +// newLegacyTrackedFixture builds a fully migrated database and then commits +// its ignored-lane cursor table into HEAD, which is the shape upgraded +// lineages arrive in. +func newLegacyTrackedFixture(t *testing.T, database string) *legacyTrackedFixture { + t.Helper() + ctx := t.Context() + + pristine := newPristineEmbeddedDoltFixture(t, database) + closeEmbeddedDoltStore(t, pristine.store) + + fixture := &legacyTrackedFixture{ + beadsDir: pristine.beadsDir, + dataDir: pristine.dataDir, + database: database, + } + fixture.withRawConn(t, func(conn *sql.Conn) { + mustExecOn(t, ctx, conn, "CALL DOLT_ADD('-f', 'ignored_schema_migrations')") + mustExecOn(t, ctx, conn, "CALL DOLT_COMMIT('-m', 'legacy tracked baseline')") + if !trackedAtHead(t, ctx, conn, "ignored_schema_migrations") { + t.Fatal("fixture did not commit ignored_schema_migrations into HEAD; the wedge cannot be reproduced") + } + fixture.cursorRows = cursorRows(t, ctx, conn) + fixture.commits = commitCount(t, ctx, conn) + }) + if len(fixture.cursorRows) == 0 { + t.Fatal("fixture captured no cursor rows; a heal that dropped them all would pass vacuously") + } + return fixture +} + +// withRawConn runs fn on a pinned connection to the fixture's database. It +// opens and closes its own engine, so it must not be called while a store is +// open on the same directory: embedded working-set writes are not reliably +// visible across handles until each is closed. +func (f *legacyTrackedFixture) withRawConn(t *testing.T, fn func(conn *sql.Conn)) { + t.Helper() + withRawConn(t, f.dataDir, f.database, fn) +} + +func withRawConn(t *testing.T, dataDir, database string, fn func(conn *sql.Conn)) { + t.Helper() + ctx := t.Context() + pool, cleanup, err := embeddeddolt.OpenSQL(ctx, dataDir, database, "") + if err != nil { + t.Fatalf("OpenSQL(%s): %v", dataDir, err) + } + defer func() { _ = cleanup() }() + conn, err := pool.Conn(ctx) + if err != nil { + t.Fatalf("pin connection: %v", err) + } + defer func() { _ = conn.Close() }() + fn(conn) +} + +// reopen runs the code under test: a writable open, which is what calls +// schema.MigrateUp and therefore the reconcile. +func (f *legacyTrackedFixture) reopen(t *testing.T) *embeddeddolt.EmbeddedDoltStore { + t.Helper() + store, err := embeddeddolt.Open(t.Context(), f.beadsDir, f.database, "main") + if err != nil { + t.Fatalf("reopen store: %v", err) + } + return store +} + +// reopenAndClose is the whole heal, observed from the outside: open the store +// (which migrates), then close it so the assertions can use a raw connection. +func (f *legacyTrackedFixture) reopenAndClose(t *testing.T) { + t.Helper() + closeEmbeddedDoltStore(t, f.reopen(t)) +} + +func mustExecOn(t *testing.T, ctx context.Context, conn *sql.Conn, stmt string, args ...any) { + t.Helper() + if _, err := conn.ExecContext(ctx, stmt, args...); err != nil { + t.Fatalf("exec %q: %v", stmt, err) + } +} + +// trackedAtHead answers the question the whole fix turns on, using the +// spelling the field diagnosed with: a table that is not committed at HEAD +// cannot be selected AS OF 'HEAD' at all. (Production uses the always- +// succeeding SHOW TABLES listing instead, because a probe that fails on every +// healthy database would pin the pooled Dolt session to a stale catalog +// snapshot — be-bv7x. Both are asserted here, and they must agree.) +func trackedAtHead(t *testing.T, ctx context.Context, conn *sql.Conn, table string) bool { + t.Helper() + + var n int + //nolint:gosec // G201: test-local table names. + selectErr := conn.QueryRowContext(ctx, "SELECT COUNT(*) FROM "+table+" AS OF 'HEAD'").Scan(&n) + if selectErr != nil && !dberrors.IsTableNotExist(selectErr) { + t.Fatalf("probing %s AS OF HEAD: %v", table, selectErr) + } + + rows, err := conn.QueryContext(ctx, "SHOW TABLES AS OF 'HEAD'") + if err != nil { + t.Fatalf("listing tables at HEAD: %v", err) + } + defer func() { _ = rows.Close() }() + listed := false + for rows.Next() { + var name string + if err := rows.Scan(&name); err != nil { + t.Fatalf("listing tables at HEAD: %v", err) + } + if strings.EqualFold(name, table) { + listed = true + } + } + if err := rows.Err(); err != nil { + t.Fatalf("listing tables at HEAD: %v", err) + } + + if listed != (selectErr == nil) { + t.Fatalf("the two tracked-at-HEAD probes disagree for %s: listing=%v, AS OF error=%v", + table, listed, selectErr) + } + return listed +} + +func cursorRows(t *testing.T, ctx context.Context, conn *sql.Conn) []string { + t.Helper() + rows, err := conn.QueryContext(ctx, + "SELECT version, IFNULL(content_hash, '') FROM ignored_schema_migrations ORDER BY version") + if err != nil { + t.Fatalf("reading cursor rows: %v", err) + } + defer func() { _ = rows.Close() }() + var out []string + for rows.Next() { + var version int + var hash string + if err := rows.Scan(&version, &hash); err != nil { + t.Fatalf("reading cursor rows: %v", err) + } + out = append(out, strconv.Itoa(version)+"|"+hash) + } + if err := rows.Err(); err != nil { + t.Fatalf("reading cursor rows: %v", err) + } + return out +} + +func commitCount(t *testing.T, ctx context.Context, conn *sql.Conn) int { + t.Helper() + var n int + if err := conn.QueryRowContext(ctx, "SELECT COUNT(*) FROM dolt_log").Scan(&n); err != nil { + t.Fatalf("counting commits: %v", err) + } + return n +} + +func untrackCommitCount(t *testing.T, ctx context.Context, conn *sql.Conn) int { + t.Helper() + var n int + if err := conn.QueryRowContext(ctx, + "SELECT COUNT(*) FROM dolt_log WHERE message LIKE '%4356%'").Scan(&n); err != nil { + t.Fatalf("counting untrack commits: %v", err) + } + return n +} + +func tablePresent(t *testing.T, ctx context.Context, conn *sql.Conn, table string) bool { + t.Helper() + var n int + if err := conn.QueryRowContext(ctx, + "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = ?", + table).Scan(&n); err != nil { + t.Fatalf("probing %s: %v", table, err) + } + return n > 0 +} + +// assertHealed is the post-condition every path in this file shares: the +// cursor table is back to being an untracked ADD delta with all its rows, the +// scratch table is gone, and the working set is clean — which is exactly what +// makes a pull possible again. +func assertHealed(t *testing.T, f *legacyTrackedFixture, wantRows []string) { + t.Helper() + ctx := t.Context() + f.withRawConn(t, func(conn *sql.Conn) { + if trackedAtHead(t, ctx, conn, "ignored_schema_migrations") { + t.Error("ignored_schema_migrations is still committed at HEAD; dolt_ignore stays inert and pulls stay wedged") + } + if !tablePresent(t, ctx, conn, "ignored_schema_migrations") { + t.Fatal("ignored_schema_migrations is gone from the working set; the ignored migration series would replay from zero") + } + got := cursorRows(t, ctx, conn) + if len(got) != len(wantRows) { + t.Fatalf("cursor rows after heal = %d, want %d (rows must survive the untrack)", len(got), len(wantRows)) + } + for i := range got { + if got[i] != wantRows[i] { + t.Fatalf("cursor row %d after heal = %q, want %q", i, got[i], wantRows[i]) + } + } + if tablePresent(t, ctx, conn, untrackScratchTable) { + t.Errorf("%s survived the heal", untrackScratchTable) + } + if dirty := dirtyTableNames(t, ctx, conn); len(dirty) > 0 { + t.Errorf("working set is dirty after the heal: %v — a tracked dirty table is the wedge itself", dirty) + } + if n := untrackCommitCount(t, ctx, conn); n != 1 { + t.Errorf("commits referencing #4356 = %d, want exactly 1", n) + } + }) +} + +// TestLegacyTrackedIgnoredCursorHealsOnOpen is the core claim: a database in +// the legacy shape repairs itself on the next writable open, losing nothing. +func TestLegacyTrackedIgnoredCursorHealsOnOpen(t *testing.T) { + f := newLegacyTrackedFixture(t, "healopen") + + f.reopenAndClose(t) + + assertHealed(t, f, f.cursorRows) + f.withRawConn(t, func(conn *sql.Conn) { + if got := commitCount(t, t.Context(), conn); got != f.commits+1 { + t.Errorf("commits after heal = %d, want %d (the untrack must be one scoped commit)", got, f.commits+1) + } + }) +} + +// The reconcile runs at EVERY open, which is the property a one-shot migration +// could not have — so it has to cost nothing once the database is healthy. A +// second open must not commit again, and '--skip-empty' plus the gate are what +// keep it from churning empty commits into everyone's history. +func TestIgnoredCursorHealIsIdempotent(t *testing.T) { + f := newLegacyTrackedFixture(t, "healidem") + + f.reopenAndClose(t) + var afterFirst int + f.withRawConn(t, func(conn *sql.Conn) { + afterFirst = commitCount(t, t.Context(), conn) + }) + + f.reopenAndClose(t) + f.reopenAndClose(t) + + assertHealed(t, f, f.cursorRows) + f.withRawConn(t, func(conn *sql.Conn) { + if got := commitCount(t, t.Context(), conn); got != afterFirst { + t.Errorf("commits after two more opens = %d, want %d (a healthy database must produce no commit at all)", got, afterFirst) + } + }) +} + +// An operator who put the cursor table back on the versioned plane on purpose +// (a dolt_ignore row with ignored=0) has made a choice the reconcile must not +// overrule, exactly as seedDoltIgnorePatterns leaves that override alone. +func TestIgnoredCursorHealRespectsOperatorOverride(t *testing.T) { + f := newLegacyTrackedFixture(t, "healoverride") + ctx := t.Context() + + f.withRawConn(t, func(conn *sql.Conn) { + mustExecOn(t, ctx, conn, "REPLACE INTO dolt_ignore VALUES ('ignored_schema_migrations', false)") + mustExecOn(t, ctx, conn, "CALL DOLT_COMMIT('-Am', 'operator: version the cursor table on purpose')") + }) + + f.reopenAndClose(t) + + f.withRawConn(t, func(conn *sql.Conn) { + if !trackedAtHead(t, ctx, conn, "ignored_schema_migrations") { + t.Error("the reconcile untracked a table the operator had explicitly un-ignored") + } + if n := untrackCommitCount(t, ctx, conn); n != 0 { + t.Errorf("commits referencing #4356 = %d, want 0 under an operator override", n) + } + }) +} + +// TestLegacyTrackedIgnoredCursorUnwedgesPull is the reported bug, end to end, +// over a real file:// remote: two clones of one legacy lineage, the wedge +// reproduced as the exact Error 1105 the issue reports, and both clones +// converging after each heals. The peer's untrack and this clone's untrack +// delete the same table, so the merge is a delete/delete — clean by +// construction, which is what makes the fix safe to roll out one machine at a +// time. +func TestLegacyTrackedIgnoredCursorUnwedgesPull(t *testing.T) { + ctx := t.Context() + f := newLegacyTrackedFixture(t, "healpull") + + remoteDir := filepath.Join(t.TempDir(), "remote") + if err := os.MkdirAll(remoteDir, 0o700); err != nil { + t.Fatalf("create remote dir: %v", err) + } + remoteURL := "file://" + remoteDir + + f.withRawConn(t, func(conn *sql.Conn) { + mustExecOn(t, ctx, conn, "CALL DOLT_REMOTE('add', 'origin', ?)", remoteURL) + // Push works on a wedged database — that asymmetry ("push works, pull + // never does") is how the field recognizes this bug. + mustExecOn(t, ctx, conn, "CALL DOLT_PUSH('origin', 'main')") + }) + + // The peer clone inherits the tracked cursor table, heals on its own first + // writable open, and publishes both the untrack and a data change. + peerBeads := filepath.Join(t.TempDir(), "peer") + peerData := filepath.Join(peerBeads, "embeddeddolt") + if err := os.MkdirAll(peerData, 0o700); err != nil { + t.Fatalf("create peer data dir: %v", err) + } + withRawConn(t, peerData, "", func(conn *sql.Conn) { + mustExecOn(t, ctx, conn, "CALL DOLT_CLONE(?, ?)", remoteURL, f.database) + }) + peer, err := embeddeddolt.Open(ctx, peerBeads, f.database, "main") + if err != nil { + t.Fatalf("open peer clone: %v", err) + } + if err := peer.SetConfig(ctx, "peer.marker", "from the peer"); err != nil { + t.Fatalf("peer SetConfig: %v", err) + } + if err := peer.Commit(ctx, "peer: add a marker"); err != nil { + t.Fatalf("peer commit: %v", err) + } + if err := peer.Push(ctx); err != nil { + t.Fatalf("peer push: %v", err) + } + closeEmbeddedDoltStore(t, peer) + withRawConn(t, peerData, f.database, func(conn *sql.Conn) { + if trackedAtHead(t, ctx, conn, "ignored_schema_migrations") { + t.Fatal("the peer clone did not heal on open; it would keep re-tracking the table for the whole fleet") + } + }) + + // This clone is still in the legacy shape. Dirty the cursor table the way + // any ignored-lane migration pass does, and the pull is dead. + f.withRawConn(t, func(conn *sql.Conn) { + mustExecOn(t, ctx, conn, + "INSERT IGNORE INTO ignored_schema_migrations (version, content_hash) VALUES (99999, NULL)") + if dirty := dirtyTableNames(t, ctx, conn); len(dirty) != 1 || dirty[0] != "ignored_schema_migrations" { + t.Fatalf("dolt_status = %v, want exactly [ignored_schema_migrations]: the wedge precondition is a DIRTY TRACKED cursor table", dirty) + } + _, err := conn.ExecContext(ctx, "CALL DOLT_PULL('origin', 'main')") + if err == nil { + t.Fatal("pull succeeded on a tracked+dirty cursor table; the wedge is not reproduced and this test proves nothing") + } + if !strings.Contains(err.Error(), "cannot merge with uncommitted changes") { + t.Fatalf("pre-heal pull error = %v, want Dolt's uncommitted-changes refusal (gastownhall/beads#4356)", err) + } + }) + + // Heal, and the same pull goes through. + store := f.reopen(t) + if err := store.Pull(ctx); err != nil { + closeEmbeddedDoltStore(t, store) + t.Fatalf("post-heal pull failed: %v", err) + } + closeEmbeddedDoltStore(t, store) + + f.withRawConn(t, func(conn *sql.Conn) { + if trackedAtHead(t, ctx, conn, "ignored_schema_migrations") { + t.Error("the cursor table is tracked again after the pull; the fleet has not converged") + } + var marker string + if err := conn.QueryRowContext(ctx, + "SELECT value FROM config WHERE `key` = 'peer.marker'").Scan(&marker); err != nil { + t.Fatalf("reading the merged peer row: %v", err) + } + if marker != "from the peer" { + t.Errorf("merged peer value = %q, want %q", marker, "from the peer") + } + var kept int + if err := conn.QueryRowContext(ctx, + "SELECT COUNT(*) FROM ignored_schema_migrations WHERE version = 99999").Scan(&kept); err != nil { + t.Fatalf("reading the cursor row written before the heal: %v", err) + } + if kept != 1 { + t.Error("the cursor row written before the heal did not survive it") + } + if got := len(cursorRows(t, ctx, conn)); got != len(f.cursorRows)+1 { + t.Errorf("cursor rows after heal+pull = %d, want %d", got, len(f.cursorRows)+1) + } + }) +} + +// TestIgnoredCursorHealConvergesFromEveryCrashState walks the states that can +// persist if the process dies mid-repair. Each is manufactured with the same +// raw SQL the repair itself issues, and each must converge in ONE reopen — +// that is what lets the repair be fatal past the drop instead of having to be +// transactional, which Dolt cannot give it. +func TestIgnoredCursorHealConvergesFromEveryCrashState(t *testing.T) { + for i, tt := range []struct { + name string + // crash runs against a legacy-tracked database and leaves it in the + // state its name describes. + crash func(t *testing.T, ctx context.Context, conn *sql.Conn) + }{ + { + // Died after the backup, before the drop. HEAD still carries the + // table and so does the working set; the scratch table is a + // duplicate. Phase A simply re-runs. + name: "backed up, not yet dropped", + crash: func(t *testing.T, ctx context.Context, conn *sql.Conn) { + backupCursorRows(t, ctx, conn) + }, + }, + { + // Died between the drop and its commit. HEAD still carries the + // table, the working set does not — so the re-run's copy has no + // source and must treat that as "already saved" rather than as a + // failure, or the pre-mutation policy swallows it and the database + // never converges. + name: "dropped, drop not committed", + crash: func(t *testing.T, ctx context.Context, conn *sql.Conn) { + backupCursorRows(t, ctx, conn) + mustExecOn(t, ctx, conn, "DROP TABLE IF EXISTS ignored_schema_migrations") + }, + }, + { + // Died after the drop was committed, before the recreate. The + // table now reads as untracked — i.e. healthy — so only the + // surviving scratch table can tell the reconcile there is a cursor + // to put back. + name: "drop committed, rows not restored", + crash: func(t *testing.T, ctx context.Context, conn *sql.Conn) { + backupCursorRows(t, ctx, conn) + mustExecOn(t, ctx, conn, "DROP TABLE IF EXISTS ignored_schema_migrations") + mustExecOn(t, ctx, conn, "CALL DOLT_ADD('-f', 'ignored_schema_migrations')") + mustExecOn(t, ctx, conn, "CALL DOLT_COMMIT('--skip-empty', '-m', 'schema: untrack legacy ignored_schema_migrations so dolt_ignore can apply (gastownhall/beads#4356)')") + }, + }, + { + // Died after the rows were restored, before the scratch table was + // dropped. Everything is already correct; the reconcile must clean + // up without touching the rows. + name: "restored, scratch table left behind", + crash: func(t *testing.T, ctx context.Context, conn *sql.Conn) { + backupCursorRows(t, ctx, conn) + mustExecOn(t, ctx, conn, "DROP TABLE IF EXISTS ignored_schema_migrations") + mustExecOn(t, ctx, conn, "CALL DOLT_ADD('-f', 'ignored_schema_migrations')") + mustExecOn(t, ctx, conn, "CALL DOLT_COMMIT('--skip-empty', '-m', 'schema: untrack legacy ignored_schema_migrations so dolt_ignore can apply (gastownhall/beads#4356)')") + restoreCursorFromScratch(t, ctx, conn) + }, + }, + } { + t.Run(tt.name, func(t *testing.T) { + ctx := t.Context() + f := newLegacyTrackedFixture(t, "crash"+strconv.Itoa(i)) + + f.withRawConn(t, func(conn *sql.Conn) { + tt.crash(t, ctx, conn) + }) + + f.reopenAndClose(t) + + assertHealed(t, f, f.cursorRows) + }) + } +} + +// backupCursorRows manufactures the repair's scratch table. It derives both +// the shape and the column list from the live cursor table (CREATE ... LIKE, +// SELECT *) rather than restating them: a hand-copied DDL here is a fourth +// place the cursor shape would have to be kept in sync, and the point of the +// crash matrix is to exercise the real shape, whatever it currently is. +func backupCursorRows(t *testing.T, ctx context.Context, conn *sql.Conn) { + t.Helper() + mustExecOn(t, ctx, conn, "CREATE TABLE IF NOT EXISTS "+untrackScratchTable+" LIKE ignored_schema_migrations") + mustExecOn(t, ctx, conn, "INSERT IGNORE INTO "+untrackScratchTable+" SELECT * FROM ignored_schema_migrations") +} + +// restoreCursorFromScratch recreates the cursor table from the scratch copy, +// the way the repair's own restore phase does. +func restoreCursorFromScratch(t *testing.T, ctx context.Context, conn *sql.Conn) { + t.Helper() + mustExecOn(t, ctx, conn, "CREATE TABLE IF NOT EXISTS ignored_schema_migrations LIKE "+untrackScratchTable) + mustExecOn(t, ctx, conn, "INSERT IGNORE INTO ignored_schema_migrations SELECT * FROM "+untrackScratchTable) +} + +// untrackCursorInPlace performs the repair by hand, leaving the scratch table +// behind — the "restored, scratch left behind" crash state. +func untrackCursorInPlace(t *testing.T, ctx context.Context, conn *sql.Conn) { + t.Helper() + backupCursorRows(t, ctx, conn) + mustExecOn(t, ctx, conn, "DROP TABLE IF EXISTS ignored_schema_migrations") + mustExecOn(t, ctx, conn, "CALL DOLT_ADD('-f', 'ignored_schema_migrations')") + mustExecOn(t, ctx, conn, "CALL DOLT_COMMIT('--skip-empty', '-m', 'schema: untrack legacy ignored_schema_migrations so dolt_ignore can apply (gastownhall/beads#4356)')") + restoreCursorFromScratch(t, ctx, conn) +} + +// TestIgnoredCursorHealNeverResurrectsRolledBackVersions is the guard on the +// resume path's blast radius. +// +// The sanctioned recovery from a bad release is a cursor ROLLBACK: delete the +// affected rows from ignored_schema_migrations so the corrected migration +// series re-applies on the next open. A scratch table left behind by an +// interrupted repair holds a snapshot from BEFORE that rollback, so a resume +// that unioned it back into a live cursor table would restore exactly the +// versions the operator deleted — with their original applied_at — and the +// corrected migrations would be silently skipped forever. The reconcile must +// treat a live cursor table as the truth and the scratch as junk to remove. +func TestIgnoredCursorHealNeverResurrectsRolledBackVersions(t *testing.T) { + ctx := t.Context() + f := newLegacyTrackedFixture(t, "rollback") + + // A timestamp no migration pass could ever mint, so the row's provenance + // after the reopen is unambiguous: this exact value means it came from the + // stale backup, anything else means the migration genuinely re-applied. + const staleApplied = "2000-01-01 00:00:00" + + var rolledBack int + f.withRawConn(t, func(conn *sql.Conn) { + // An interrupted repair: untracked and restored, scratch still there. + untrackCursorInPlace(t, ctx, conn) + // The operator then rolls the cursor back to re-apply a corrected + // ignored migration. The scratch still remembers the deleted version. + if err := conn.QueryRowContext(ctx, + "SELECT MAX(version) FROM ignored_schema_migrations").Scan(&rolledBack); err != nil { + t.Fatalf("reading the cursor high-water mark: %v", err) + } + mustExecOn(t, ctx, conn, "DELETE FROM ignored_schema_migrations WHERE version = ?", rolledBack) + mustExecOn(t, ctx, conn, + "UPDATE "+untrackScratchTable+" SET applied_at = ? WHERE version = ?", staleApplied, rolledBack) + var stillInScratch int + if err := conn.QueryRowContext(ctx, + "SELECT COUNT(*) FROM "+untrackScratchTable+" WHERE version = ?", rolledBack).Scan(&stillInScratch); err != nil { + t.Fatalf("reading the scratch table: %v", err) + } + if stillInScratch != 1 { + t.Fatalf("scratch table does not hold the rolled-back version %d; the hazard is not reproduced", rolledBack) + } + }) + + f.reopenAndClose(t) + + f.withRawConn(t, func(conn *sql.Conn) { + // The version is expected BACK — that is the whole point of a cursor + // rollback. What must not happen is it coming back from the backup: + // then the migration never re-ran, and the corrected body that the + // rollback existed to apply is skipped forever while the cursor claims + // it succeeded. + var appliedAt string + if err := conn.QueryRowContext(ctx, + "SELECT applied_at FROM ignored_schema_migrations WHERE version = ?", rolledBack).Scan(&appliedAt); err != nil { + t.Fatalf("reading the rolled-back cursor row after the reconcile: %v", err) + } + if strings.HasPrefix(appliedAt, "2000-01-01") { + t.Errorf("cursor version %d carries the stale backup's applied_at (%s): the reconcile resurrected it instead of letting the corrected migration re-apply", + rolledBack, appliedAt) + } + if tablePresent(t, ctx, conn, untrackScratchTable) { + t.Errorf("%s survived; it is not dolt_ignore'd, so the next pull's auto-commit would replicate it fleet-wide", untrackScratchTable) + } + if dirty := dirtyTableNames(t, ctx, conn); len(dirty) > 0 { + t.Errorf("working set is dirty after the reconcile: %v", dirty) + } + }) +} + +// The operator veto is re-read on the resume path, not inherited from whatever +// open crashed: someone who resolved a crashed repair by deliberately +// versioning the cursor table must not have stale rows pushed back into it. +// The scratch is still cleaned up — it is bd's own junk either way. +func TestIgnoredCursorHealResumeRespectsOperatorOverride(t *testing.T) { + ctx := t.Context() + f := newLegacyTrackedFixture(t, "resumeoverride") + + f.withRawConn(t, func(conn *sql.Conn) { + untrackCursorInPlace(t, ctx, conn) + mustExecOn(t, ctx, conn, "REPLACE INTO dolt_ignore VALUES ('ignored_schema_migrations', false)") + mustExecOn(t, ctx, conn, "CALL DOLT_COMMIT('-Am', 'operator: version the cursor table on purpose')") + }) + + f.reopenAndClose(t) + + f.withRawConn(t, func(conn *sql.Conn) { + if tablePresent(t, ctx, conn, untrackScratchTable) { + t.Errorf("%s survived an override-suppressed resume; the cleanup is always correct", untrackScratchTable) + } + if got := len(cursorRows(t, ctx, conn)); got != len(f.cursorRows) { + t.Errorf("cursor rows = %d, want %d", got, len(f.cursorRows)) + } + }) +} + +// A broad house pattern next to the exact override is the shape that made the +// naive "any matching ignored=1 row" predicate destructive: Dolt resolves +// dolt_ignore most-specific-first, so it keeps the table TRACKED here, and a +// heal would drop and commit away a lineage the operator chose to keep. +func TestIgnoredCursorHealRespectsOverrideUnderBroaderPattern(t *testing.T) { + ctx := t.Context() + f := newLegacyTrackedFixture(t, "broadoverride") + + f.withRawConn(t, func(conn *sql.Conn) { + mustExecOn(t, ctx, conn, `REPLACE INTO dolt_ignore VALUES ('ignored\_%', true)`) + mustExecOn(t, ctx, conn, "REPLACE INTO dolt_ignore VALUES ('ignored_schema_migrations', false)") + mustExecOn(t, ctx, conn, "CALL DOLT_COMMIT('-Am', 'operator: version the cursor table under a broad house pattern')") + }) + + f.reopenAndClose(t) + + f.withRawConn(t, func(conn *sql.Conn) { + if !trackedAtHead(t, ctx, conn, "ignored_schema_migrations") { + t.Error("the reconcile untracked a table Dolt keeps tracked for the operator; the committed lineage is gone") + } + if n := untrackCommitCount(t, ctx, conn); n != 0 { + t.Errorf("commits referencing #4356 = %d, want 0 under an operator override", n) + } + }) +} diff --git a/internal/storage/embeddeddolt/store.go b/internal/storage/embeddeddolt/store.go index b7275fb48..57c663146 100644 --- a/internal/storage/embeddeddolt/store.go +++ b/internal/storage/embeddeddolt/store.go @@ -27,6 +27,7 @@ var _ storage.DoltStorage = (*EmbeddedDoltStore)(nil) var _ storage.StoreLocator = (*EmbeddedDoltStore)(nil) var _ storage.ActiveDatabaseSizer = (*EmbeddedDoltStore)(nil) var _ storage.GarbageCollector = (*EmbeddedDoltStore)(nil) +var _ storage.FullGarbageCollector = (*EmbeddedDoltStore)(nil) var _ storage.Flattener = (*EmbeddedDoltStore)(nil) var _ storage.Compactor = (*EmbeddedDoltStore)(nil) var _ storage.SchemaMigrator = (*EmbeddedDoltStore)(nil) @@ -449,6 +450,22 @@ func (s *EmbeddedDoltStore) initSchema(ctx context.Context) error { } return nil } + var rekeyErr *schema.DependencyRekeyConflictError + if s.intent != openStrict && errors.As(err, &rekeyErr) { + // Same principle for the dependency re-key's refusal (#5268): it is + // a convergence repair, not a precondition for reading, and before + // that pass existed these clones opened fine. Bricking 'bd list' and + // 'bd show' on latent id corruption the user cannot even inspect + // without them would be a worse outcome than a stale primary key. + // Nothing is lost by continuing: the 0026 marker stays unrecorded, + // so the next open retries the repair. + fmt.Fprintf(os.Stderr, + "Warning: %v\n"+ + " Continuing without re-keying dependencies. Dependency ids stay as\n"+ + " they are until the conflict is resolved; run 'bd doctor' to inspect.\n", + rekeyErr) + return nil + } return fmt.Errorf("embeddeddolt: migrate: %w", err) } @@ -478,7 +495,8 @@ func (s *EmbeddedDoltStore) GetIssueByExternalRef(ctx context.Context, externalR func (s *EmbeddedDoltStore) DeleteIssue(ctx context.Context, id string) error { return s.withConn(ctx, true, func(tx *sql.Tx) error { - return issueops.DeleteIssueInTx(ctx, tx, id) + // storage.DeleteIssue carries no actor, so the journal rows record none. + return issueops.DeleteIssueInTx(ctx, tx, id, "") }) } @@ -681,13 +699,22 @@ func (s *EmbeddedDoltStore) Close() error { return nil } -// DoltGC runs Dolt garbage collection to reclaim disk space. +// DoltGC runs Dolt's default, generational garbage collection to reclaim disk +// space. func (s *EmbeddedDoltStore) DoltGC(ctx context.Context) error { return s.withMutatingDBConn(ctx, func(db versioncontrolops.DBConn) error { return versioncontrolops.DoltGC(ctx, db) }) } +// DoltGCFull runs a full Dolt garbage collection across all storage +// generations. +func (s *EmbeddedDoltStore) DoltGCFull(ctx context.Context) error { + return s.withMutatingDBConn(ctx, func(db versioncontrolops.DBConn) error { + return versioncontrolops.DoltGCFull(ctx, db) + }) +} + // ListRemoteRefs returns the names of all cached remote-tracking refs. func (s *EmbeddedDoltStore) ListRemoteRefs(ctx context.Context) ([]string, error) { var refs []string @@ -961,7 +988,8 @@ func (s *EmbeddedDoltStore) DeleteIssues(ctx context.Context, ids []string, casc var result *types.DeleteIssuesResult err := s.withConn(ctx, !dryRun, func(tx *sql.Tx) error { var err error - result, err = issueops.DeleteIssuesInTx(ctx, tx, ids, cascade, force, dryRun) + // storage.DeleteIssues carries no actor, so the journal rows record none. + result, err = issueops.DeleteIssuesInTx(ctx, tx, ids, cascade, force, dryRun, "") return err }) return result, err diff --git a/internal/storage/embeddeddolt/transaction.go b/internal/storage/embeddeddolt/transaction.go index 2f096a939..64efdded2 100644 --- a/internal/storage/embeddeddolt/transaction.go +++ b/internal/storage/embeddeddolt/transaction.go @@ -152,7 +152,8 @@ func (t *embeddedTransaction) DeleteIssue(ctx context.Context, id string) error for _, cascaded := range issueops.DeleteCascadeTables(issueops.IsActiveWispInTx(ctx, t.tx, id)) { t.dirty.MarkDirty(cascaded) } - return issueops.DeleteIssueInTx(ctx, t.tx, id) + // storage.Tx.DeleteIssue carries no actor, so the journal rows record none. + return issueops.DeleteIssueInTx(ctx, t.tx, id, "") } func (t *embeddedTransaction) GetIssue(ctx context.Context, id string) (*types.Issue, error) { diff --git a/internal/storage/embeddeddolt/version_control.go b/internal/storage/embeddeddolt/version_control.go index 1ea0c1911..47f55cc87 100644 --- a/internal/storage/embeddeddolt/version_control.go +++ b/internal/storage/embeddeddolt/version_control.go @@ -274,6 +274,26 @@ func (s *EmbeddedDoltStore) CommitExists(ctx context.Context, commitHash string) return exists, err } +// HistoricalIssueIDs reports which of ids appear in HEAD's committed history +// of the issues table. Implements storage.HistoryPresence. +// +// This is the capability that lets embedded mode — the default open path, and +// the one with no DiffStore — prove a deletion for auto-export's orphan guard +// instead of wedging on it forever (GH#5896). Same body as the server-backed +// store; only the connection differs. +func (s *EmbeddedDoltStore) HistoricalIssueIDs(ctx context.Context, ids []string) (map[string]struct{}, error) { + var present map[string]struct{} + err := s.withConn(ctx, false, func(tx *sql.Tx) error { + var err error + present, err = issueops.HistoricalIssueIDsInTx(ctx, tx, ids) + return err + }) + return present, err +} + +// The auto-export guard reaches this through storage.UnwrapStore. +var _ storage.HistoryPresence = (*EmbeddedDoltStore)(nil) + func (s *EmbeddedDoltStore) Status(ctx context.Context) (*storage.Status, error) { var status *storage.Status err := s.withDBConn(ctx, func(db versioncontrolops.DBConn) error { diff --git a/internal/storage/history_presence.go b/internal/storage/history_presence.go new file mode 100644 index 000000000..457965b5a --- /dev/null +++ b/internal/storage/history_presence.go @@ -0,0 +1,26 @@ +package storage + +import "context" + +// HistoryPresence reports which of the given issue ids appear anywhere in the +// CURRENT branch's committed history of the issues table — that is, in some +// commit reachable from HEAD. A rewound-away past does not count, and neither +// does the uncommitted working set. +// +// That asymmetry is the whole point. "In this store's history but not in this +// store now" is safe to read as "a deletion this store recorded", while "not in +// this store's history and not in this store now" is indistinguishable from a +// torn, replaced, or rewound store — the corruption class GH#4988's auto-export +// orphan guard exists to catch. Auto-export uses the first as proof that a +// JSONL-only record was really deleted, and keeps refusing to overwrite on the +// second (GH#5896). +// +// It is a capability interface: callers should type-assert after UnwrapStore +// and degrade to the conservative path when a store does not implement it. +type HistoryPresence interface { + // HistoricalIssueIDs returns the subset of ids that appear in HEAD's + // committed history. Ids the store has never seen are simply absent from + // the result; an empty or nil ids slice returns an empty set and issues + // no query. + HistoricalIssueIDs(ctx context.Context, ids []string) (map[string]struct{}, error) +} diff --git a/internal/storage/issueops/bulk_ops.go b/internal/storage/issueops/bulk_ops.go index 354cd003a..0077d0463 100644 --- a/internal/storage/issueops/bulk_ops.go +++ b/internal/storage/issueops/bulk_ops.go @@ -205,8 +205,9 @@ func DeleteIssuesBySourceRepoInTx(ctx context.Context, tx *sql.Tx, sourceRepo st } // Edges are journaled before the rows go, while their source snapshots can - // still be read. - if err := RecordDependencyRemovalsForIssuesInTx(ctx, tx, issueIDs); err != nil { + // still be read. The source-repo wipe surface (storage.DeleteIssuesBySourceRepo, + // behind `bd repo remove`) carries no actor, so these record none. + if err := RecordDependencyRemovalsForIssuesInTx(ctx, tx, issueIDs, ""); err != nil { return 0, fmt.Errorf("journal dependency removals for source-repo delete: %w", err) } diff --git a/internal/storage/issueops/create_batch.go b/internal/storage/issueops/create_batch.go index 46f128ca6..4739f470d 100644 --- a/internal/storage/issueops/create_batch.go +++ b/internal/storage/issueops/create_batch.go @@ -181,6 +181,7 @@ func ExecuteCreateBatch(ctx context.Context, tx *sql.Tx, request publicops.Creat if err != nil { return publicops.CreateBatchResult{}, nil, err } + OverlayCreateTimestamps(hydrated, issue) result.Issues[i] = hydrated } return result, tables, nil diff --git a/internal/storage/issueops/delete.go b/internal/storage/issueops/delete.go index e78a2a213..f8ed23ad5 100644 --- a/internal/storage/issueops/delete.go +++ b/internal/storage/issueops/delete.go @@ -19,8 +19,13 @@ const deleteBatchSize = 50 // discovered during recursive dependent traversal. const maxRecursiveResults = 10000 +// DeleteIssueInTx removes one row and everything that hangs off it, journaling +// the delete and its edge removals to actor. Callers with a request behind them +// pass its actor; the actorless system surfaces (storage.DeleteIssue, +// Tx.DeleteIssue) pass "" — see the 0066 contract in journal.go. +// //nolint:gosec // G201: table names come from WispTableRouting (hardcoded constants) -func DeleteIssueInTx(ctx context.Context, tx *sql.Tx, id string) error { +func DeleteIssueInTx(ctx context.Context, tx *sql.Tx, id string, actor string) error { isWisp := IsActiveWispInTx(ctx, tx, id) var deletedIssues, deletedWisps []string @@ -36,10 +41,10 @@ func DeleteIssueInTx(ctx context.Context, tx *sql.Tx, id string) error { // Edges are journaled before the rows go, while their source snapshots can // still be read. - if err := RecordDependencyRemovalsForIssuesInTx(ctx, tx, []string{id}); err != nil { + if err := RecordDependencyRemovalsForIssuesInTx(ctx, tx, []string{id}, actor); err != nil { return fmt.Errorf("journal dependency removals for %s: %w", id, err) } - if err := deleteIssueRowInTx(ctx, tx, id, isWisp); err != nil { + if err := deleteIssueRowInTx(ctx, tx, id, isWisp, actor); err != nil { return err } @@ -51,7 +56,7 @@ func DeleteIssueInTx(ctx context.Context, tx *sql.Tx, id string) error { } //nolint:gosec // G201: table names come from WispTableRouting (hardcoded constants) -func deleteIssueRowInTx(ctx context.Context, tx *sql.Tx, id string, isWisp bool) error { +func deleteIssueRowInTx(ctx context.Context, tx *sql.Tx, id string, isWisp bool, actor string) error { issueTable, _, _, _ := WispTableRouting(isWisp) result, err := tx.ExecContext(ctx, fmt.Sprintf("DELETE FROM %s WHERE id = ?", issueTable), id) if err != nil { @@ -71,9 +76,8 @@ func deleteIssueRowInTx(ctx context.Context, tx *sql.Tx, id string, isWisp bool) // deletes (DeleteIssueInTx) and the per-wisp branch of the bulk delete // (DeleteResolvedSetInTx); the bulk regular-issue branch journals its own // ids directly. The rows==0 return above is what keeps this - // actually-deleted-only. The delete plumbing (storage.DeleteIssue and the - // bulk/cascade resolvers) carries no actor, so the row records none. - if err := RecordDeleteInTx(ctx, tx, id, ""); err != nil { + // actually-deleted-only. + if err := RecordDeleteInTx(ctx, tx, id, actor); err != nil { return err } if isWisp { @@ -134,7 +138,7 @@ func ResolveDeletionSetInTx(ctx context.Context, tx DBTX, ids []string, cascade return DeletionSet{WispIDs: wispIDs, RegularIDs: regularIDs, All: all}, nil } -func DeleteIssuesInTx(ctx context.Context, tx *sql.Tx, ids []string, cascade bool, force bool, dryRun bool) (*types.DeleteIssuesResult, error) { +func DeleteIssuesInTx(ctx context.Context, tx *sql.Tx, ids []string, cascade bool, force bool, dryRun bool, actor string) (*types.DeleteIssuesResult, error) { if len(ids) == 0 { return &types.DeleteIssuesResult{}, nil } @@ -180,7 +184,7 @@ func DeleteIssuesInTx(ctx context.Context, tx *sql.Tx, ids []string, cascade boo } } - result, err := DeleteResolvedSetInTx(ctx, tx, set, dryRun) + result, err := DeleteResolvedSetInTx(ctx, tx, set, dryRun, actor) if err != nil { return nil, err } @@ -195,8 +199,14 @@ func DeleteIssuesInTx(ctx context.Context, tx *sql.Tx, ids []string, cascade boo // neighborhood BEFORE the delete and rewrite it AFTER against the SAME // DeletionSet the delete was handed. // +// EVERY ROW IT JOURNALS — the deletes and the cascade edge removals alike — +// carries actor, the identity whose request resolved this set. That includes +// the rows the cascade pulled in and not just the named ids: the reference +// rewrite already attributes its `update` rows the same way, and a consumer +// reading `”` on a cascade row would take it for a system write. +// //nolint:gosec // G201: inClause contains only ? placeholders -func DeleteResolvedSetInTx(ctx context.Context, tx *sql.Tx, set DeletionSet, dryRun bool) (*types.DeleteIssuesResult, error) { +func DeleteResolvedSetInTx(ctx context.Context, tx *sql.Tx, set DeletionSet, dryRun bool, actor string) (*types.DeleteIssuesResult, error) { result := &types.DeleteIssuesResult{} if len(set.All) == 0 { return result, nil @@ -295,12 +305,12 @@ func DeleteResolvedSetInTx(ctx context.Context, tx *sql.Tx, set DeletionSet, dry } // Edges are journaled before the rows go, while their source snapshots can // still be read. - if err := RecordDependencyRemovalsForIssuesInTx(ctx, tx, set.All); err != nil { + if err := RecordDependencyRemovalsForIssuesInTx(ctx, tx, set.All, actor); err != nil { return nil, fmt.Errorf("journal dependency removals for batch delete: %w", err) } for _, id := range set.WispIDs { - if err := deleteIssueRowInTx(ctx, tx, id, true); err != nil { + if err := deleteIssueRowInTx(ctx, tx, id, true, actor); err != nil { return nil, fmt.Errorf("delete wisp %s: %w", id, err) } } @@ -334,10 +344,9 @@ func DeleteResolvedSetInTx(ctx context.Context, tx *sql.Tx, set DeletionSet, dry // Journal every regular issue this bulk/cascade delete removed. Wisps went // through deleteIssueRowInTx above, which journals each itself; set.All is - // cascade-expanded, so this records cascade deletes too. The delete - // plumbing carries no actor, so the rows record none. + // cascade-expanded, so this records cascade deletes too. for _, id := range journaledDeletes { - if err := RecordDeleteInTx(ctx, tx, id, ""); err != nil { + if err := RecordDeleteInTx(ctx, tx, id, actor); err != nil { return nil, err } } diff --git a/internal/storage/issueops/delete_role.go b/internal/storage/issueops/delete_role.go index cb58fd73d..b219925c3 100644 --- a/internal/storage/issueops/delete_role.go +++ b/internal/storage/issueops/delete_role.go @@ -151,7 +151,10 @@ func DeleteInTx(ctx context.Context, tx *sql.Tx, req publicops.DeleteRequest) (p // No guard argument to pass: this body has ALREADY answered the guard // question above, and DeleteResolvedSetInTx deletes what it is handed. - deleted, err := DeleteResolvedSetInTx(ctx, tx, set, req.DryRun) + // req.Actor goes with it: the journal rows for this delete — including the + // cascade's — name the identity that asked for it, the same identity the + // reference rewrite below is attributed to. + deleted, err := DeleteResolvedSetInTx(ctx, tx, set, req.DryRun, req.Actor) if err != nil { return publicops.DeleteResult{}, err } diff --git a/internal/storage/issueops/dependencies.go b/internal/storage/issueops/dependencies.go index 494831374..d7189157e 100644 --- a/internal/storage/issueops/dependencies.go +++ b/internal/storage/issueops/dependencies.go @@ -765,6 +765,68 @@ func replaceDependencyTargetInTx(ctx context.Context, tx *sql.Tx, table, column, return fmt.Errorf("insert replacement dependency target: %w", err) } } + return rekeyDependencyTargetInTx(ctx, tx, table, column, newID) +} + +// rekeyDependencyTargetInTx re-derives the surrogate primary key of every row +// whose typed target column already carries newID but whose id was derived from +// the pre-rename target. +// +// The typed target columns carry ON UPDATE CASCADE foreign keys +// (fk_dep_issue_target, fk_wisp_dep_issue_target), and updateIssueIDInTx renames +// the issues row FIRST, so by the time replaceDependencyTargetInTx runs the +// cascade has already moved depends_on_issue_id from oldID to newID. Its +// `WHERE = oldID` therefore matches nothing and the row keeps +// id = depid.New(issue_id, oldID) — a stale primary key that re-forks across +// clones (#4259) and, once a later rename hands oldID to a different issue, +// leaves two rows contending for one deterministic id, which is the chain the +// migration-time re-key then has to untangle (#5268). +// +// This is the target-side mirror of rekeyDependencySourceInTx, which already +// matches both the pre- and post-cascade state on the source column. Only rows +// whose id is actually stale are touched, so it is a no-op on a converged table +// and on the rows the loop above just reinserted with the right id. +func rekeyDependencyTargetInTx(ctx context.Context, tx *sql.Tx, table, column, newID string) error { + //nolint:gosec // table and column are hardcoded by callers. + queryRows, err := tx.QueryContext(ctx, fmt.Sprintf(` + SELECT id, issue_id, depends_on_issue_id, depends_on_wisp_id, depends_on_external + FROM %s + WHERE %s = ? + `, table, column), newID) + if err != nil { + return fmt.Errorf("query renamed dependency targets in %s: %w", table, err) + } + type rekey struct{ oldRowID, newRowID string } + var rekeys []rekey + for queryRows.Next() { + var id, issueID string + var issueTarget, wispTarget, external sql.NullString + if err := queryRows.Scan(&id, &issueID, &issueTarget, &wispTarget, &external); err != nil { + _ = queryRows.Close() + return fmt.Errorf("scan renamed dependency target: %w", err) + } + // Resolve rather than assume newID: on a row that somehow holds several + // typed targets, the identity the unique keys and depid see is the first + // non-null in precedence order, which need not be the renamed column. + target, ok := resolveDependencyTarget(issueTarget, wispTarget, external) + if !ok { + continue // ck_dep_one_target guarantees one target; skip defensively + } + if want := depid.New(issueID, target); want != id { + rekeys = append(rekeys, rekey{oldRowID: id, newRowID: want}) + } + } + _ = queryRows.Close() + if err := queryRows.Err(); err != nil { + return fmt.Errorf("iterate renamed dependency targets: %w", err) + } + for _, rk := range rekeys { + //nolint:gosec // table is hardcoded by callers. + if _, err := tx.ExecContext(ctx, fmt.Sprintf("UPDATE %s SET id = ? WHERE id = ?", table), + rk.newRowID, rk.oldRowID); err != nil { + return fmt.Errorf("rekey dependency target id %s -> %s in %s: %w", rk.oldRowID, rk.newRowID, table, err) + } + } return nil } diff --git a/internal/storage/issueops/dependencies_test.go b/internal/storage/issueops/dependencies_test.go index 8abf4b76d..88880eb33 100644 --- a/internal/storage/issueops/dependencies_test.go +++ b/internal/storage/issueops/dependencies_test.go @@ -134,6 +134,12 @@ func TestReplaceDependencyTargetNormalizesTargetColumns(t *testing.T) { mock.ExpectExec(regexp.QuoteMeta("INSERT INTO dependencies (id, issue_id, depends_on_issue_id, depends_on_wisp_id, depends_on_external, type, created_at, created_by, metadata, thread_id)")). WithArgs(depid.New("source", "new-target"), "source", tt.wantIssue, tt.wantWisp, tt.wantExternal, "blocks", nil, "tester", "{}", "thread-1"). WillReturnResult(sqlmock.NewResult(0, 1)) + // The post-cascade sweep: rows whose typed column already carries + // newID because fk_dep_*_target's ON UPDATE CASCADE beat the rewrite + // here get their stale id re-derived. Nothing stale in this fixture. + mock.ExpectQuery(regexp.QuoteMeta("SELECT id, issue_id, depends_on_issue_id, depends_on_wisp_id, depends_on_external")). + WithArgs("new-target"). + WillReturnRows(sqlmock.NewRows([]string{"id", "issue_id", "depends_on_issue_id", "depends_on_wisp_id", "depends_on_external"})) mock.ExpectCommit() tx, err := db.BeginTx(context.Background(), nil) @@ -193,3 +199,63 @@ func TestCycleReachabilityQueryMultipleTablesTraversesUniqueNodes(t *testing.T) t.Fatalf("query does not resolve depends_on_id via DepTargetExpr:\n%s", query) } } + +// TestReplaceDependencyTargetRekeysCascadedRows pins the half of a rename the +// rewrite above cannot see. fk_dep_issue_target carries ON UPDATE CASCADE and +// updateIssueIDInTx renames the issues row first, so depends_on_issue_id already +// reads newID by the time replaceDependencyTargetInTx runs: its +// `WHERE ... = oldID` matches nothing and the row keeps id = depid(issue, oldID). +// That stale primary key re-forks across clones (#4259) and, once a later rename +// hands oldID to another issue, becomes the migration-time re-key chain of +// gastownhall/beads#5268. +func TestReplaceDependencyTargetRekeysCascadedRows(t *testing.T) { + t.Parallel() + + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New: %v", err) + } + defer db.Close() + + mock.ExpectBegin() + mock.ExpectQuery(regexp.QuoteMeta("SELECT 1 FROM dependencies a")). + WithArgs("new-target", "new-target", "new-target"). + WillReturnRows(sqlmock.NewRows([]string{"found"})) + // The cascade already moved the row, so the oldID rewrite finds nothing. + mock.ExpectQuery(regexp.QuoteMeta("SELECT issue_id, depends_on_issue_id, depends_on_wisp_id, depends_on_external, type, created_at, created_by, metadata, thread_id")). + WithArgs("old-target", "old-target"). + WillReturnRows(sqlmock.NewRows([]string{ + "issue_id", "depends_on_issue_id", "depends_on_wisp_id", "depends_on_external", + "type", "created_at", "created_by", "metadata", "thread_id", + })) + mock.ExpectExec(regexp.QuoteMeta("DELETE FROM dependencies")). + WithArgs("old-target", "old-target"). + WillReturnResult(sqlmock.NewResult(0, 0)) + // The sweep finds the cascaded row: right target, id still derived from the + // pre-rename name. + mock.ExpectQuery(regexp.QuoteMeta("SELECT id, issue_id, depends_on_issue_id, depends_on_wisp_id, depends_on_external")). + WithArgs("new-target"). + WillReturnRows(sqlmock.NewRows([]string{"id", "issue_id", "depends_on_issue_id", "depends_on_wisp_id", "depends_on_external"}). + AddRow(depid.New("source", "old-target"), "source", "new-target", nil, nil). + // An already-correct sibling must not be touched. + AddRow(depid.New("other", "new-target"), "other", "new-target", nil, nil)) + mock.ExpectExec(regexp.QuoteMeta("UPDATE dependencies SET id = ? WHERE id = ?")). + WithArgs(depid.New("source", "new-target"), depid.New("source", "old-target")). + WillReturnResult(sqlmock.NewResult(0, 1)) + mock.ExpectCommit() + + tx, err := db.BeginTx(context.Background(), nil) + if err != nil { + t.Fatalf("BeginTx: %v", err) + } + if err := replaceDependencyTargetInTx(context.Background(), tx, "dependencies", "depends_on_issue_id", "old-target", "new-target"); err != nil { + _ = tx.Rollback() + t.Fatalf("replaceDependencyTargetInTx: %v", err) + } + if err := tx.Commit(); err != nil { + t.Fatalf("Commit: %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet sql expectations: %v", err) + } +} diff --git a/internal/storage/issueops/execution.go b/internal/storage/issueops/execution.go index 56a3c5acf..c0c7a621b 100644 --- a/internal/storage/issueops/execution.go +++ b/internal/storage/issueops/execution.go @@ -108,6 +108,7 @@ func ExecuteCreate(ctx context.Context, tx *sql.Tx, request publicops.CreateRequ if err != nil { return publicops.CreateResult{}, nil, err } + OverlayCreateTimestamps(hydrated, issue) return publicops.CreateResult{Issue: hydrated}, tables, nil } diff --git a/internal/storage/issueops/history_presence.go b/internal/storage/issueops/history_presence.go new file mode 100644 index 000000000..0849c3f71 --- /dev/null +++ b/internal/storage/issueops/history_presence.go @@ -0,0 +1,86 @@ +package issueops + +import ( + "context" + "fmt" + "strings" +) + +// historicalIssueIDsChunk caps how many ids go into one IN-list. Dolt's +// history tables fan a row out per commit per id, and very wide IN-lists are +// where its planner starts choosing badly; the callers' own candidate cap is +// far below this, so chunking is a floor, not a hot path. +const historicalIssueIDsChunk = 200 + +// HistoricalIssueIDsInTx returns the subset of ids that appear anywhere in the +// current branch's committed history of the issues table. +// +// dolt_history_issues walks HEAD's ancestry, so an id whose only commits were +// rewound away (DOLT_RESET --hard, a checkout, a force-pushed rewrite) is NOT +// reported, and neither is an id that exists only in the uncommitted working +// set. Both omissions are load-bearing: see storage.HistoryPresence. +// +// The subquery wrapper is the same workaround HistoryInTx uses — Dolt's +// planner assumes a predicate on the PK of a dolt_history_* table matches at +// most one row, which is false there (one row per commit per id). +func HistoricalIssueIDsInTx(ctx context.Context, tx DBTX, ids []string) (map[string]struct{}, error) { + present := make(map[string]struct{}) + if len(ids) == 0 { + return present, nil + } + + // Dedupe up front so a caller's repeated id can't inflate a chunk. + unique := make([]string, 0, len(ids)) + seen := make(map[string]struct{}, len(ids)) + for _, id := range ids { + if id == "" { + continue + } + if _, dup := seen[id]; dup { + continue + } + seen[id] = struct{}{} + unique = append(unique, id) + } + + for start := 0; start < len(unique); start += historicalIssueIDsChunk { + end := start + historicalIssueIDsChunk + if end > len(unique) { + end = len(unique) + } + if err := historicalIssueIDChunkInTx(ctx, tx, unique[start:end], present); err != nil { + return nil, err + } + } + return present, nil +} + +func historicalIssueIDChunkInTx(ctx context.Context, tx DBTX, chunk []string, present map[string]struct{}) error { + args := make([]any, len(chunk)) + for i, id := range chunk { + args[i] = id + } + query := ` + SELECT DISTINCT h.id + FROM ( + SELECT id FROM dolt_history_issues + ) h + WHERE h.id IN (` + strings.TrimSuffix(strings.Repeat("?,", len(chunk)), ",") + `)` + rows, err := tx.QueryContext(ctx, query, args...) + if err != nil { + return fmt.Errorf("query issue history presence: %w", err) + } + defer rows.Close() + + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return fmt.Errorf("scan issue history presence: %w", err) + } + present[id] = struct{}{} + } + if err := rows.Err(); err != nil { + return fmt.Errorf("iterate issue history presence: %w", err) + } + return nil +} diff --git a/internal/storage/issueops/journal.go b/internal/storage/issueops/journal.go index d90855454..a4dc140e3 100644 --- a/internal/storage/issueops/journal.go +++ b/internal/storage/issueops/journal.go @@ -302,10 +302,13 @@ func recordBlockedJournalChanges( // journaling is disabled. // // actor is the acting identity that performed the mutation, as resolved for -// the audit-events table; "" when the mutation path genuinely has none -// (derived maintenance, actorless delete plumbing). It is an explicit -// parameter, not ambient context, so a new call site cannot compile without -// deciding attribution. +// the audit-events table; "" when the mutation path genuinely has none — +// derived is_blocked maintenance, and the system surfaces with no request +// behind them (storage.DeleteIssue, gc and molecule cleanup, `bd repo +// remove`). A user-initiated delete is NOT one of those: its rows, cascade +// included, carry the requesting actor. It is an explicit parameter, not +// ambient context, so a new call site cannot compile without deciding +// attribution. func RecordEventInTx(ctx context.Context, tx DBTX, op EventOp, issueID, actor string) error { if !journalEnabled(ctx, tx) { return nil diff --git a/internal/storage/issueops/journal_dependencies.go b/internal/storage/issueops/journal_dependencies.go index 6ded5d91e..b8b672ca3 100644 --- a/internal/storage/issueops/journal_dependencies.go +++ b/internal/storage/issueops/journal_dependencies.go @@ -16,7 +16,13 @@ type journalDependencyEdge struct { // RecordDependencyRemovalsForIssuesInTx emits one deterministic dep_remove // record for every edge whose source or target is in ids. Callers invoke this // before deleting the edges or nodes so source snapshots are still available. -func RecordDependencyRemovalsForIssuesInTx(ctx context.Context, tx DBTX, ids []string) error { +// +// actor is the identity whose request removed the edges. A cascade edge +// removal takes the REQUESTING actor, the same way the reference-rewrite +// `update` rows a delete emits do; system plumbing with no request behind it +// (gc, source-repo wipe, the actorless storage.DeleteIssue surface) passes "" +// explicitly, which the 0066 contract reads as system/unknown. +func RecordDependencyRemovalsForIssuesInTx(ctx context.Context, tx DBTX, ids []string, actor string) error { if !journalEnabled(ctx, tx) || len(ids) == 0 { return nil } @@ -24,12 +30,13 @@ func RecordDependencyRemovalsForIssuesInTx(ctx context.Context, tx DBTX, ids []s if err != nil { return err } - return recordDependencyRemovalsInTx(ctx, tx, edges) + return recordDependencyRemovalsInTx(ctx, tx, edges, actor) } // RecordDependencyRemovalsForTableInTx is the table-scoped variant used by // the UOW dependency repository immediately before its bulk edge DELETE. -func RecordDependencyRemovalsForTableInTx(ctx context.Context, tx DBTX, table string, ids []string) error { +// actor carries the same meaning as in RecordDependencyRemovalsForIssuesInTx. +func RecordDependencyRemovalsForTableInTx(ctx context.Context, tx DBTX, table string, ids []string, actor string) error { if !journalEnabled(ctx, tx) || len(ids) == 0 { return nil } @@ -37,14 +44,12 @@ func RecordDependencyRemovalsForTableInTx(ctx context.Context, tx DBTX, table st if err != nil { return err } - return recordDependencyRemovalsInTx(ctx, tx, edges) + return recordDependencyRemovalsInTx(ctx, tx, edges, actor) } -func recordDependencyRemovalsInTx(ctx context.Context, tx DBTX, edges []journalDependencyEdge) error { +func recordDependencyRemovalsInTx(ctx context.Context, tx DBTX, edges []journalDependencyEdge, actor string) error { for _, edge := range edges { - // Every caller is bulk/cascade delete plumbing (node deletes, source-repo - // wipes, the UOW bulk edge DELETE), none of which carries an actor. - if err := RecordDepEventInTx(ctx, tx, EventDepRemove, edge.source, edge.kind, edge.target, edge.metadata, ""); err != nil { + if err := RecordDepEventInTx(ctx, tx, EventDepRemove, edge.source, edge.kind, edge.target, edge.metadata, actor); err != nil { return err } } diff --git a/internal/storage/issueops/public_hydration.go b/internal/storage/issueops/public_hydration.go index 18c1f5efe..29dc3db44 100644 --- a/internal/storage/issueops/public_hydration.go +++ b/internal/storage/issueops/public_hydration.go @@ -35,3 +35,24 @@ func HydrateIssueOperationResult(ctx context.Context, tx DBTX, id string, includ } return issue, nil } + +// OverlayCreateTimestamps restores onto a hydrated create result the +// full-precision timestamps the INSERT actually sent. +// +// created_at/updated_at are DATETIME(0) columns, so the re-read a create does +// to build its result snapshot comes back rounded to whole seconds. The create +// echo has carried sub-second RFC3339Nano stamps since before the lifecycle +// facade existed (v1.2.2 returned the caller's own in-memory struct), and +// agents ordering same-second creates by that echo depend on it. Everything +// else on the snapshot stays DB-truth, which is the facade's contract; only +// these three fields are restored, and only for create. +func OverlayCreateTimestamps(hydrated, written *types.Issue) { + if hydrated == nil || written == nil { + return + } + hydrated.CreatedAt = written.CreatedAt + hydrated.UpdatedAt = written.UpdatedAt + if written.ClosedAt != nil { + hydrated.ClosedAt = written.ClosedAt + } +} diff --git a/internal/storage/issueops/sweep.go b/internal/storage/issueops/sweep.go index a99b67474..a609579e6 100644 --- a/internal/storage/issueops/sweep.go +++ b/internal/storage/issueops/sweep.go @@ -62,7 +62,7 @@ func SweepInTx(ctx context.Context, tx *sql.Tx, req publicops.SweepRequest) (pub // dependents outside the selection. The DRY RUN passes the same flags rather // than the force=false the direct route used to pass, so a preview cannot // fail where the real run would succeed. - deleted, err := DeleteIssuesInTx(ctx, tx, ids, false, true, req.DryRun) + deleted, err := DeleteIssuesInTx(ctx, tx, ids, false, true, req.DryRun, req.Actor) if err != nil { return publicops.SweepResult{}, err } diff --git a/internal/storage/metadata.go b/internal/storage/metadata.go index 77096cdf2..eb842d081 100644 --- a/internal/storage/metadata.go +++ b/internal/storage/metadata.go @@ -312,13 +312,33 @@ func ApplyMetadataEdits(existing json.RawMessage, setFlags, unsetFlags []string) return json.RawMessage(result), nil } -// MetadataEditValue converts a --set-metadata string value to JSON. Per the CLI -// contract (GH#4146), --set-metadata values are ALWAYS stored as JSON strings; -// inferring numbers/booleans/null from string content silently broke -// map[string]string round-trips for Go consumers (a numeric-looking id or a -// version like "1e3" came back as a JSON number). Typed values go through the -// explicit --metadata / --metadata-json path (MergeMetadataJSON). +// MetadataEditValue converts a --set-metadata string value to JSON, inferring +// the scalar type from the value's spelling: "null" is JSON null, "true"/"false" +// are booleans, anything that scans as a float AND is valid JSON on its own is +// emitted as that literal (so 5 -> 5, 1e3 -> 1e3, while 05, +5 and NaN stay +// strings because they are not valid JSON), and everything else is a string. +// +// This is the shipped v1.2.2 CLI contract (v1.2.2's cmd/bd/update.go toJSONValue, +// copied body-for-body so the parity claim stays checkable). GH#4146 asked for +// string-always so that map[string]string Go consumers keep numeric-looking ids +// and versions like "1e3" intact; that briefly landed here and silently changed +// the CLI contract, so it is served instead by the explicitly typed routes — +// `--metadata` / `--metadata-json` (MergeMetadataJSON) on the CLI and the typed +// set map on the HTTP/Go path (issueops.applyTypedMetadataEdits). func MetadataEditValue(s string) json.RawMessage { + if s == "null" { + return json.RawMessage("null") + } + if s == "true" || s == "false" { + return json.RawMessage(s) + } + // Numbers (integer or float), but only when the spelling is also valid JSON + // on its own — that rejects NaN, Inf, "+5" and leading-zero forms. + if _, err := fmt.Sscanf(s, "%f", new(float64)); err == nil { + if json.Valid([]byte(s)) { + return json.RawMessage(s) + } + } b, _ := json.Marshal(s) return json.RawMessage(b) } diff --git a/internal/storage/metadata_edit_value_test.go b/internal/storage/metadata_edit_value_test.go new file mode 100644 index 000000000..d9a2f0a95 --- /dev/null +++ b/internal/storage/metadata_edit_value_test.go @@ -0,0 +1,86 @@ +package storage + +import ( + "encoding/json" + "testing" +) + +// TestMetadataEditValuePinsV122Inference pins the shipped v1.2.2 `--set-metadata` +// scalar contract (v1.2.2's cmd/bd/update.go toJSONValue): null/bool/number keep +// their JSON type, and a spelling that is not valid JSON on its own stays a +// string even when it scans as a float. An in-window build stored every value as +// a string; that regression is what this table guards against coming back. +func TestMetadataEditValuePinsV122Inference(t *testing.T) { + t.Parallel() + tests := []struct { + name string + input string + want string + }{ + {"integer", "5", `5`}, + {"negative integer", "-2", `-2`}, + {"trailing zero float", "0.50", `0.50`}, + {"exponent", "1e3", `1e3`}, + {"zero", "0", `0`}, + {"true", "true", `true`}, + {"false", "false", `false`}, + {"null", "null", `null`}, + {"leading zero is not JSON", "05", `"05"`}, + {"unary plus is not JSON", "+5", `"+5"`}, + {"NaN is not JSON", "NaN", `"NaN"`}, + {"version triple", "1.2.3", `"1.2.3"`}, + {"empty", "", `""`}, + {"word", "abc", `"abc"`}, + {"sentence", "hello world", `"hello world"`}, + } + for _, tt := range tests { + tt := tt + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + got := string(MetadataEditValue(tt.input)) + if got != tt.want { + t.Errorf("MetadataEditValue(%q) = %s, want %s", tt.input, got, tt.want) + } + if !json.Valid([]byte(got)) { + t.Errorf("MetadataEditValue(%q) = %s, which is not valid JSON", tt.input, got) + } + }) + } +} + +// TestApplyMetadataEditsTypesScalars proves the inference reaches the merged +// blob every caller writes (embedded CLI, proxied CLI and the update executor's +// []string path all funnel through ApplyMetadataEdits). +func TestApplyMetadataEditsTypesScalars(t *testing.T) { + t.Parallel() + merged, err := ApplyMetadataEdits( + json.RawMessage(`{"existing":"yes"}`), + []string{"score=99", "tier=gold", "ratio=0.5", "done=true", "cleared=null"}, + nil, + ) + if err != nil { + t.Fatalf("ApplyMetadataEdits: %v", err) + } + var got map[string]any + if err := json.Unmarshal(merged, &got); err != nil { + t.Fatalf("unmarshal %s: %v", merged, err) + } + if got["score"] != float64(99) { + t.Errorf("metadata[score] = %#v, want the JSON number 99", got["score"]) + } + if got["ratio"] != 0.5 { + t.Errorf("metadata[ratio] = %#v, want the JSON number 0.5", got["ratio"]) + } + if got["done"] != true { + t.Errorf("metadata[done] = %#v, want the JSON boolean true", got["done"]) + } + if v, present := got["cleared"]; !present || v != nil { + t.Errorf("metadata[cleared] = %#v (present=%v), want JSON null", v, present) + } + if got["tier"] != "gold" { + t.Errorf("metadata[tier] = %#v, want %q", got["tier"], "gold") + } + if got["existing"] != "yes" { + t.Errorf("metadata[existing] = %#v, want %q: pre-existing keys must survive", got["existing"], "yes") + } +} diff --git a/internal/storage/schema/aux_row_id_backfill.go b/internal/storage/schema/aux_row_id_backfill.go index f562e8141..07357bd0c 100644 --- a/internal/storage/schema/aux_row_id_backfill.go +++ b/internal/storage/schema/aux_row_id_backfill.go @@ -4,6 +4,8 @@ import ( "context" "database/sql" "fmt" + "log" + "slices" "sort" "strings" @@ -53,62 +55,174 @@ var auxRekeyPassDerivedInsert = auxRekeyPass{ } // auxRekeyPasses lists every convergence pass, in the order MigrateUp runs -// them. +// them. Every pass here runs the identical rekeyAuxRowTable rewrite over the +// identical auxRekeyTables set (see auxRowRekeyDriftedKey) — a future pass +// that rewrites a different table set or a different derivation must not be +// added to this list without also giving it its own drift record; sharing +// auxRowRekeyDriftedKey across passes with different table sets or +// derivations would let one pass clear a drift skip the other pass never +// actually resolved. var auxRekeyPasses = []auxRekeyPass{auxRekeyPassInitial, auxRekeyPassDerivedInsert} -// auxRekeyResumePending reports whether a previous run of this re-key pass on -// this clone recorded the in-progress sentinel and never cleared it. A missing -// local_metadata table means no sentinel: the table is dolt-ignored and -// therefore clone-local, so a fresh clone lacks it until something recreates -// it — setAuxRekeyInProgress creates it on demand. -func auxRekeyResumePending(ctx context.Context, db DBConn, sentinelKey string) (bool, error) { - var tableCount int - if err := db.QueryRowContext(ctx, - `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES - WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'local_metadata'`, - ).Scan(&tableCount); err != nil { - return false, err - } - if tableCount == 0 { - return false, nil - } - var n int - if err := db.QueryRowContext(ctx, - "SELECT COUNT(*) FROM local_metadata WHERE `key` = ?", - sentinelKey).Scan(&n); err != nil { - return false, err - } - return n > 0, nil +// A pass's sentinel means "a rewrite is in flight", nothing else. MigrateUp +// reads the sentinels to exempt the aux tables from the pre-existing-dirty +// guards, because a crashed pass's own partial UPDATEs are sitting in the +// working set — so a sentinel must not outlive an actual in-flight rewrite. A +// drift skip (#4380) therefore clears it like any completed pass and records +// auxRowRekeyDriftedKey instead. +// +// auxRowRekeyDriftedKey is the clone-local record (local_metadata, +// dolt-ignored) of tables the re-key had to skip because their storage carries +// dolthub/dolt#11131 encoding drift (#4380): a comma-separated table list, +// absent when there is nothing skipped. +// +// It exists because the skip completes the pass, so MigrateUp records the +// clone-local marker in that same pass and the marker gate can never re-admit +// the re-key again. This record is what re-admits it — and it names the +// affected tables so the resumed pass touches only those, leaving tables that +// already converged alone. +// +// The record is clone-local because each clone has to discover, retry and +// retire its own skip; the drift itself is not necessarily clone-local, since +// both halves of it (the column's storage-encoding tag and the row chunks it +// disagrees with) are committed data that travels on push/pull — migration 0057 +// documents bd's own 0048 as one way a lineage acquires it. +// +// This one record is shared by every pass in auxRekeyPasses, which is only +// correct because every pass runs the identical rekeyAuxRowTable rewrite over +// the identical auxRekeyTables set (their gates — markerVersion, +// shippedMainVersion — are all that differ): whichever pass retries a skipped +// table first does the same work any other pass would have done, and clearing +// the record on success correctly makes every other pass's retry a no-op. +const auxRowRekeyDriftedKey = "aux_row_rekey_drifted" + +// auxRekeyState is what this clone still owes the re-key: a rewrite that was in +// flight and never finished, and tables skipped for storage drift. Both live in +// local_metadata, which is dolt-ignored and therefore clone-local — and, per +// migration 0030, ephemeral: it is recreated empty by a working-set reset, so +// "no record" is always a legitimate reading. +type auxRekeyState struct { + resume bool + drifted []string } -// anyAuxRekeyResumePending reports whether ANY pass's crash sentinel is still -// recorded, with one table probe and at most one row query regardless of how -// many passes exist — it feeds MigrateUp's dirty-table exemption, which only -// needs to know that some rekey rewrite is about to resume. -func anyAuxRekeyResumePending(ctx context.Context, db DBConn) (bool, error) { +func (s auxRekeyState) pending() bool { return s.resume || len(s.drifted) > 0 } + +// readAuxRekeyState reads the given crash sentinels and the #4380 drift record +// in one round trip. A missing local_metadata table means nothing is set: the +// table is dolt-ignored and therefore clone-local, so a fresh clone lacks it +// until something recreates it — setAuxRekeyInProgress creates it on demand. +// +// state.drifted is filtered against auxRekeyTables before it is returned: the +// drift record is a free-form comma-separated cell, so this is the one place +// that guarantees every name a caller sees is actually one of the re-keyed +// tables. Callers rely on that — MigrateUp uses state.drifted directly to +// exempt tables from the pre-existing-dirty guard, and an unfiltered name +// there would let a non-aux table bypass those guards and get force-staged +// into the migration commit. +func readAuxRekeyState(ctx context.Context, db DBConn, sentinelKeys ...string) (auxRekeyState, error) { + var state auxRekeyState var tableCount int if err := db.QueryRowContext(ctx, `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'local_metadata'`, ).Scan(&tableCount); err != nil { - return false, err + return state, err } if tableCount == 0 { - return false, nil + return state, nil } - placeholders := make([]string, len(auxRekeyPasses)) - keys := make([]any, len(auxRekeyPasses)) - for i, pass := range auxRekeyPasses { - placeholders[i] = "?" - keys[i] = pass.sentinelKey + placeholders := make([]string, 0, len(sentinelKeys)+1) + args := make([]any, 0, len(sentinelKeys)+1) + for _, key := range sentinelKeys { + placeholders = append(placeholders, "?") + args = append(args, key) } - var n int - if err := db.QueryRowContext(ctx, - fmt.Sprintf("SELECT COUNT(*) FROM local_metadata WHERE `key` IN (%s)", strings.Join(placeholders, ", ")), - keys...).Scan(&n); err != nil { - return false, err + placeholders = append(placeholders, "?") + args = append(args, auxRowRekeyDriftedKey) + //nolint:gosec // G201: only ? placeholders are interpolated; every value is bound. + rows, err := db.QueryContext(ctx, + fmt.Sprintf("SELECT `key`, value FROM local_metadata WHERE `key` IN (%s)", strings.Join(placeholders, ", ")), + args...) + if err != nil { + // This is the one place the re-key reads a TEXT cell of local_metadata, + // so it is the one place a drifted local_metadata could panic the very + // function meant to survive drift. No migration re-encodes that table + // today, but degrade to "nothing recorded" rather than re-break the + // open path if that ever changes. + if isSchemaEncodingDriftErr(err) { + return state, nil + } + return state, err } - return n > 0, nil + defer rows.Close() + for rows.Next() { + var key, value string + if err := rows.Scan(&key, &value); err != nil { + // Same drift degradation as the QueryContext and rows.Err() siblings + // that bracket this loop: this is the one place the re-key reads a + // TEXT cell of local_metadata, so a #11131 decode panic surfacing + // here — were a future migration ever to re-encode the table — must + // degrade to "nothing recorded" rather than re-break the open path + // this defense exists to protect. No reachable input triggers it + // today (a Dolt decode panic surfaces via Next/Err, not the Scan of + // already-streamed values), so this is purely defensive symmetry. + if isSchemaEncodingDriftErr(err) { + return auxRekeyState{}, nil + } + return auxRekeyState{}, err + } + switch key { + case auxRowRekeyDriftedKey: + for _, name := range strings.Split(value, ",") { + if name = strings.TrimSpace(name); name != "" && auxRekeyTableNames[name] { + state.drifted = append(state.drifted, name) + } + } + default: + // The query only asks for the requested sentinel keys and the drift + // record, so any other returned key is a present sentinel. + state.resume = true + } + } + if err := rows.Err(); err != nil { + if isSchemaEncodingDriftErr(err) { + return auxRekeyState{}, nil + } + return auxRekeyState{}, err + } + return state, nil +} + +// auxRekeyExemptTables reports which aux tables MigrateUp must drop from its +// dirtyBefore set before running the re-key: exactly the tables the upcoming +// rekeyAuxRowIDsAllPasses will rewrite, unioned across every pass. +// +// It is deliberately derived from the same per-pass tablesToRekey selection the +// rewrite itself uses, so the exemption can never be wider than the rewrite. +// That matters because a post-marker resume re-keys only the recorded drifted +// subset (bd-578h9 / #4380): exempting all four aux tables there — as a single +// collapsed "some rewrite is in flight" bit would — drops a non-drifted aux +// table's pre-existing user edits out of dirtyBefore, and stageSchemaTables +// then sweeps them into the "schema: apply migrations" commit. Keying the +// exemption off the exact rewrite set closes that asymmetry by construction. +func auxRekeyExemptTables(ctx context.Context, db DBConn, mainVersionBefore int) (map[string]bool, error) { + pending, err := ignoredSource.pendingVersions(ctx, db) + if err != nil { + return nil, fmt.Errorf("reading pending ignored migrations: %w", err) + } + exempt := make(map[string]bool) + for _, pass := range auxRekeyPasses { + state, err := readAuxRekeyState(ctx, db, pass.sentinelKey) + if err != nil { + return nil, fmt.Errorf("reading aux rekey state: %w", err) + } + tables, _ := pass.tablesToRekey(mainVersionBefore, pending, state) + for _, t := range tables { + exempt[t.name] = true + } + } + return exempt, nil } func setAuxRekeyInProgress(ctx context.Context, db DBConn, sentinelKey string) error { @@ -133,6 +247,25 @@ func clearAuxRekeyInProgress(ctx context.Context, db DBConn, sentinelKey string) return err } +func setAuxRekeyDrifted(ctx context.Context, db DBConn, tables []string) error { + // Same on-demand create as the sentinel: local_metadata is dolt-ignored, so + // a clone that arrived past 0029 may not have it yet. + if _, err := db.ExecContext(ctx, "CREATE TABLE IF NOT EXISTS local_metadata (`key` VARCHAR(255) PRIMARY KEY, value TEXT NOT NULL DEFAULT '')"); err != nil { + return fmt.Errorf("ensuring local_metadata: %w", err) + } + _, err := db.ExecContext(ctx, + "REPLACE INTO local_metadata (`key`, value) VALUES (?, ?)", + auxRowRekeyDriftedKey, strings.Join(tables, ",")) + return err +} + +func clearAuxRekeyDrifted(ctx context.Context, db DBConn) error { + _, err := db.ExecContext(ctx, + "DELETE FROM local_metadata WHERE `key` = ?", + auxRowRekeyDriftedKey) + return err +} + // auxRekeyTable describes one table covered by the re-key. columns is the // frozen SELECT list of every non-id column, in creation order, with datetime // columns CAST to CHAR server-side so the scanned text is identical across @@ -173,6 +306,21 @@ var auxRekeyTables = []auxRekeyTable{ }, } +// auxRekeyTableNames is auxRekeyTables' name set, used by readAuxRekeyState to +// filter the local_metadata drift record: that cell is a free-form +// comma-separated string, not validated at write time by anything but this +// package's own writer, so a stale or corrupted entry must not reach a caller +// that trusts every name in state.drifted to be one of the four re-keyed +// tables (schema.go's MigrateUp uses it unfiltered to exempt tables from the +// pre-existing-dirty guard). +var auxRekeyTableNames = func() map[string]bool { + names := make(map[string]bool, len(auxRekeyTables)) + for _, t := range auxRekeyTables { + names[t.name] = true + } + return names +}() + // rekeyAuxRowIDs converges the primary keys that migration 0037 randomized // (bd-6dnrw.2). 0037 backfilled the CHAR(36) ids of events, comments, // issue_snapshots and compaction_snapshots with per-clone-random UUID()s, so @@ -191,6 +339,14 @@ var auxRekeyTables = []auxRekeyTable{ // mainVersionBefore is the main-source cursor as it stood before this pass's // migrations ran; at or past auxRowRekeyShippedMainVersion the rewrite is // skipped (see that constant). +// +// A table whose storage carries dolthub/dolt#11131 encoding drift cannot be +// scanned at all, so it is skipped and recorded (auxRowRekeyDriftedKey) rather +// than failing the pass; a later pass re-keys just that table, and succeeds +// once the drift is repaired. Like the crash-resume path it re-keys the whole +// table, including rows minted since the skip, so the sooner the retry lands +// the fewer of those there are — which is why it is re-attempted on every +// subsequent migration pass rather than waiting to be asked. func rekeyAuxRowIDs(ctx context.Context, db DBConn, mainVersionBefore int, pass auxRekeyPass) (bool, error) { pending, err := ignoredSource.pendingVersions(ctx, db) if err != nil { @@ -217,26 +373,72 @@ func rekeyAuxRowIDsAllPasses(ctx context.Context, db DBConn, mainVersionBefore i return wrote, nil } -func rekeyAuxRowIDsPending(ctx context.Context, db DBConn, mainVersionBefore int, pass auxRekeyPass, pending []int) (bool, error) { - markerPending := false - for _, v := range pending { - if v == pass.markerVersion { - markerPending = true - break +// tablesToRekey reports which aux tables this pass rewrites on the current +// MigrateUp, and whether it runs at all. It is the single source of truth for +// that selection: rekeyAuxRowIDsPending drives its own rewrite from it, and +// MigrateUp's dirtyBefore exemption (auxRekeyExemptTables) unions it across +// passes — so the set of tables exempted from the pre-existing-dirty guards can +// never diverge from the set the rewrite actually touches (#4380). +// +// runs is false only when neither gate admits the pass. It stays true for a +// post-marker resume whose table set is empty — a sentinel left set after the +// drift record was already cleared — so the caller still proceeds to clear that +// stale sentinel instead of leaking it. +func (pass auxRekeyPass) tablesToRekey(mainVersionBefore int, pending []int, state auxRekeyState) ([]auxRekeyTable, bool) { + markerPending := slices.Contains(pending, pass.markerVersion) + + // The marker gate is "once per clone" only for a pass that actually + // converged every table. A pass that skipped one for #11131 drift completed + // — so the marker was recorded in that same MigrateUp — and the marker alone + // would then bar re-entry forever, making the skip permanent. A crash + // sentinel or a drift record (state.pending()) re-admits the pass so it can + // finish once the storage is repaired. + if !markerPending && !state.pending() { + return nil, false + } + // The fresh-clone skip (record the marker, skip the rewrite — bd-578h9.4) + // must not fire on a lineage whose previous pass crashed mid-rekey: that + // pass already advanced the main cursor past the shipped version, but its + // sentinel — or a recorded drift skip — proves the rewrite never finished + // (bd-578h9.16). + if mainVersionBefore >= pass.shippedMainVersion && !state.pending() { + return nil, false + } + + // A markerPending pass is the one-time convergence and covers all four + // tables. Once the marker is recorded, MigrateUp records it + // (ignoredSource.migrate) only after the rewrite returns without error, so a + // clone that still owes work past that point owes it for exactly the tables + // the drift record names. Re-keying any other table there would be wrong — + // those converged in the completed pass, and rows minted since carry + // app-minted ids already consistent across clones, so rewriting them on this + // clone alone manufactures the divergence the re-key exists to remove. This + // also covers a drift-resume pass that itself died on an unrelated error and + // left the sentinel set: still a post-marker pass, so still only the + // recorded tables. + if markerPending { + return auxRekeyTables, true + } + // This is a selection, not a validation filter: state.drifted is already + // guaranteed a subset of auxRekeyTables' names (readAuxRekeyState filters + // it), so slices.Contains here is what maps those names to the full + // auxRekeyTable structs (with their frozen columns) this pass actually needs. + var tables []auxRekeyTable + for _, t := range auxRekeyTables { + if slices.Contains(state.drifted, t.name) { + tables = append(tables, t) } } - if !markerPending { - return false, nil - } - resume, err := auxRekeyResumePending(ctx, db, pass.sentinelKey) + return tables, true +} + +func rekeyAuxRowIDsPending(ctx context.Context, db DBConn, mainVersionBefore int, pass auxRekeyPass, pending []int) (bool, error) { + state, err := readAuxRekeyState(ctx, db, pass.sentinelKey) if err != nil { - return false, fmt.Errorf("reading aux rekey sentinel: %w", err) + return false, fmt.Errorf("reading aux rekey state: %w", err) } - // The fresh-clone skip must not fire on a lineage whose previous pass - // crashed mid-rekey: that pass already advanced the main cursor past the - // shipped version, but its sentinel proves the rewrite never finished - // (bd-578h9.16). - if mainVersionBefore >= pass.shippedMainVersion && !resume { + tables, runs := pass.tablesToRekey(mainVersionBefore, pending, state) + if !runs { return false, nil } @@ -248,19 +450,103 @@ func rekeyAuxRowIDsPending(ctx context.Context, db DBConn, mainVersionBefore int } wrote := false - for _, t := range auxRekeyTables { + var skipped []string + for _, t := range tables { w, err := rekeyAuxRowTable(ctx, db, t) wrote = wrote || w if err != nil { + // #4380: a table carrying dolthub/dolt#11131 schema-encoding drift + // cannot be re-keyed at all — every read of an affected cell panics + // server-side, and no SQL write can repair or remove the row. Before + // this, that aborted the whole MigrateUp pass, which also made the + // database unopenable by any rekey-aware binary: the migration is + // re-attempted on open, so the panic recurred on every start and the + // only build that could read the data was the pre-re-key one. Skip + // the table loudly and let the rest of the pass complete instead. + if isSchemaEncodingDriftErr(err) { + skipped = append(skipped, t.name) + // log, not the TTY-gated progress writer: a piped or CI caller + // discards that writer, and these three lines are the only + // notice that a table's ids stayed divergent. + log.Printf("schema migration: aux row id re-key skipped %q — the table holds rows Dolt cannot decode (schema-encoding drift, gastownhall/beads#4380): %v", + t.name, err) + continue + } return wrote, fmt.Errorf("%s: %w", t.name, err) } } + // The tables this pass covered are exactly the ones the record should now + // name: a full pass covered all four, a post-marker pass covered precisely + // the previously-recorded ones, so in both cases what is still skipped is + // what failed just now. + switch { + case len(skipped) > 0: + if err := setAuxRekeyDrifted(ctx, db, skipped); err != nil { + return wrote, fmt.Errorf("recording aux rekey drift: %w", err) + } + log.Printf("schema migration: %d table(s) kept their old row ids: %s — merges with other clones of this database may duplicate those rows", + len(skipped), strings.Join(skipped, ", ")) + log.Printf("schema migration: repair the storage drift (see gastownhall/beads#4380); the re-key is re-attempted on each later pass that applies schema migrations") + case len(state.drifted) > 0: + if err := clearAuxRekeyDrifted(ctx, db); err != nil { + return wrote, fmt.Errorf("clearing aux rekey drift record: %w", err) + } + // Names what this pass actually covered, which is the recorded set + // minus any entry no longer in auxRekeyTables — a stale name is dropped + // by clearing the record, not by claiming it converged. + if len(tables) > 0 { + covered := make([]string, 0, len(tables)) + for _, t := range tables { + covered = append(covered, t.name) + } + log.Printf("schema migration: aux row id re-key completed for previously skipped table(s): %s", + strings.Join(covered, ", ")) + } + } if err := clearAuxRekeyInProgress(ctx, db, pass.sentinelKey); err != nil { return wrote, fmt.Errorf("clearing aux rekey sentinel: %w", err) } return wrote, nil } +// isSchemaEncodingDriftErr reports whether err carries the dolthub/dolt#11131 +// schema-encoding-drift signature: a TEXT/LONGTEXT column whose on-disk +// storage-encoding tag was re-derived without rewriting rows, so decoding a +// cell reads an address of the wrong width and panics inside the storage +// engine. The engine recovers it per query and surfaces +// "Error 1105 (HY000): panic recovered: invalid hash length: 19". Only this +// class is tolerated by the re-key; every other failure still aborts the pass. +// +// Deliberately matched on the bare hash-length phrase, not on ": 19" and not +// on the "panic recovered" wrapper: +// +// - the width varies with the direction of the tag flip — migration 0057 +// documents this same drift from bd's own side (0048 re-widening an +// already-LONGTEXT column under a pre-#11126 embedded engine) and records +// both "invalid hash length: 19" on read and "invalid hash length: 1" on +// insert/merge; +// - the wrapper is added by the SQL engine, so a path that surfaced the +// panic unwrapped would fall through to the abort that leaves affected +// databases unopenable — the failure this whole change exists to end. +// +// The cost of the wider match is bounded: a non-#11131 "invalid hash length" +// (dolt raises it from hash.New generally) means storage this re-key cannot +// read either, so skipping the table and recording it is the same correct +// answer. The pass still aborts on every error that does not carry the phrase. +// +// What it cannot catch: the same drift also produces cells that decode to +// garbage instead of panicking (#4380 reports ~10% of affected cells returning +// a zero payload). Those scan without error, so their rows are re-keyed from +// corrupt content and converge to an id no healthy clone derives. Nothing here +// can detect that — it is a reason the storage repair is still required, not a +// reason to widen the match further. +func isSchemaEncodingDriftErr(err error) bool { + if err == nil { + return false + } + return strings.Contains(strings.ToLower(err.Error()), "invalid hash length") +} + // rekeyAuxRowTable re-derives the ids of one table. The whole table is grouped // by content digest; each digest's rows take the deterministic ids for // ordinals 0..n-1. A row already holding one of its group's target ids keeps diff --git a/internal/storage/schema/aux_row_id_backfill_test.go b/internal/storage/schema/aux_row_id_backfill_test.go index 84ac7549e..7f6de318d 100644 --- a/internal/storage/schema/aux_row_id_backfill_test.go +++ b/internal/storage/schema/aux_row_id_backfill_test.go @@ -5,6 +5,7 @@ import ( "database/sql" "errors" "regexp" + "strings" "testing" "github.com/DATA-DOG/go-sqlmock" @@ -190,8 +191,9 @@ func TestRekeyAuxRowTableSkipsMissingTable(t *testing.T) { } // TestRekeyAuxRowIDsSkipsWhenMarkerRecorded verifies the clone-local gate: once -// the ignored marker migration is recorded, the re-key never scans a table -// again, so steady-state opens do not churn synced rows. +// the ignored marker migration is recorded and the pass that recorded it left +// no sentinel behind, the re-key never scans a table again, so steady-state +// opens do not churn synced rows. func TestRekeyAuxRowIDsSkipsWhenMarkerRecorded(t *testing.T) { db, mock, err := sqlmock.New() if err != nil { @@ -203,6 +205,7 @@ func TestRekeyAuxRowIDsSkipsWhenMarkerRecorded(t *testing.T) { expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", "version", auxRekeyPassInitial.markerVersion) expectIgnoredSentinelProbes(mock, true) + expectAuxRekeyState(mock, false) // No further expectations: no table may be probed or scanned. wrote, err := rekeyAuxRowIDs(context.Background(), db, auxRekeyPassInitial.shippedMainVersion-1, auxRekeyPassInitial) @@ -230,7 +233,7 @@ func TestRekeyAuxRowIDsRunsAllTablesWhenMarkerPending(t *testing.T) { expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", "version", auxRekeyPassInitial.markerVersion-1) expectIgnoredSentinelProbes(mock, true) - expectAuxRekeySentinel(mock, false) + expectAuxRekeyState(mock, false) expectSetAuxRekeySentinel(mock) // Each of the four tables is probed; this mocked world has none of them, // so each probe returns 0 and the loop completes without scanning. @@ -251,18 +254,37 @@ func TestRekeyAuxRowIDsRunsAllTablesWhenMarkerPending(t *testing.T) { } } -// expectAuxRekeySentinel mocks auxRekeyResumePending: the local_metadata -// table-existence probe, then (when the table exists) the sentinel-row count. -func expectAuxRekeySentinel(mock sqlmock.Sqlmock, pending bool) { +// expectAuxRekeyState mocks readAuxRekeyState for the initial pass: the +// local_metadata table-existence probe, then (when the table exists) the one +// row-read that returns both the pass's in-flight sentinel and the #4380 +// drift record. +func expectAuxRekeyState(mock sqlmock.Sqlmock, resume bool, drifted ...string) { mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.TABLES`). WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(1)) - n := 0 - if pending { - n = 1 + rows := sqlmock.NewRows([]string{"key", "value"}) + if resume { + rows.AddRow(auxRekeyPassInitial.sentinelKey, "1") } - mock.ExpectQuery(regexp.QuoteMeta("SELECT COUNT(*) FROM local_metadata WHERE `key` = ?")). - WithArgs(auxRekeyPassInitial.sentinelKey). - WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(n)) + if len(drifted) > 0 { + rows.AddRow(auxRowRekeyDriftedKey, strings.Join(drifted, ",")) + } + mock.ExpectQuery(regexp.QuoteMeta("SELECT `key`, value FROM local_metadata WHERE `key` IN (?, ?)")). + WithArgs(auxRekeyPassInitial.sentinelKey, auxRowRekeyDriftedKey). + WillReturnRows(rows) +} + +func expectSetAuxRekeyDrifted(mock sqlmock.Sqlmock, tables ...string) { + mock.ExpectExec(`CREATE TABLE IF NOT EXISTS local_metadata`). + WillReturnResult(sqlmock.NewResult(0, 0)) + mock.ExpectExec(regexp.QuoteMeta("REPLACE INTO local_metadata (`key`, value) VALUES (?, ?)")). + WithArgs(auxRowRekeyDriftedKey, strings.Join(tables, ",")). + WillReturnResult(sqlmock.NewResult(0, 1)) +} + +func expectClearAuxRekeyDrifted(mock sqlmock.Sqlmock) { + mock.ExpectExec(regexp.QuoteMeta("DELETE FROM local_metadata WHERE `key` = ?")). + WithArgs(auxRowRekeyDriftedKey). + WillReturnResult(sqlmock.NewResult(0, 1)) } func expectSetAuxRekeySentinel(mock sqlmock.Sqlmock) { @@ -281,6 +303,43 @@ func expectClearAuxRekeySentinel(mock sqlmock.Sqlmock) { WillReturnResult(sqlmock.NewResult(0, 1)) } +// expectAuxRekeyStateForPass is expectAuxRekeyState generalized to name the +// pass explicitly, for tests that exercise more than auxRekeyPassInitial +// (e.g. rekeyAuxRowIDsAllPasses, which runs every pass in auxRekeyPasses off +// the same shared drift record — see auxRowRekeyDriftedKey). +func expectAuxRekeyStateForPass(mock sqlmock.Sqlmock, pass auxRekeyPass, resume bool, drifted ...string) { + mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.TABLES`). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(1)) + rows := sqlmock.NewRows([]string{"key", "value"}) + if resume { + rows.AddRow(pass.sentinelKey, "1") + } + if len(drifted) > 0 { + rows.AddRow(auxRowRekeyDriftedKey, strings.Join(drifted, ",")) + } + mock.ExpectQuery(regexp.QuoteMeta("SELECT `key`, value FROM local_metadata WHERE `key` IN (?, ?)")). + WithArgs(pass.sentinelKey, auxRowRekeyDriftedKey). + WillReturnRows(rows) +} + +// expectSetAuxRekeySentinelForPass is expectSetAuxRekeySentinel generalized to +// name the pass explicitly; see expectAuxRekeyStateForPass. +func expectSetAuxRekeySentinelForPass(mock sqlmock.Sqlmock, pass auxRekeyPass) { + mock.ExpectExec(`CREATE TABLE IF NOT EXISTS local_metadata`). + WillReturnResult(sqlmock.NewResult(0, 0)) + mock.ExpectExec(regexp.QuoteMeta("REPLACE INTO local_metadata (`key`, value) VALUES (?, '1')")). + WithArgs(pass.sentinelKey). + WillReturnResult(sqlmock.NewResult(0, 1)) +} + +// expectClearAuxRekeySentinelForPass is expectClearAuxRekeySentinel +// generalized to name the pass explicitly; see expectAuxRekeyStateForPass. +func expectClearAuxRekeySentinelForPass(mock sqlmock.Sqlmock, pass auxRekeyPass) { + mock.ExpectExec(regexp.QuoteMeta("DELETE FROM local_metadata WHERE `key` = ?")). + WithArgs(pass.sentinelKey). + WillReturnResult(sqlmock.NewResult(0, 1)) +} + // TestRekeyAuxRowIDsSkipsConvergedLineage verifies the bd-578h9.4 gate: when // the main cursor already reached the version that shipped with the re-key // BEFORE this pass ran, the lineage was migrated by a rekey-aware binary and @@ -297,7 +356,7 @@ func TestRekeyAuxRowIDsSkipsConvergedLineage(t *testing.T) { expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", "version", auxRekeyPassInitial.markerVersion-1) expectIgnoredSentinelProbes(mock, true) - expectAuxRekeySentinel(mock, false) + expectAuxRekeyState(mock, false) // No further expectations: marker is pending, but the pre-pass main // cursor at the watershed and no crash sentinel means no table may be // probed or scanned. @@ -331,7 +390,7 @@ func TestRekeyAuxRowIDsResumesAfterCrash(t *testing.T) { expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", "version", auxRekeyPassInitial.markerVersion-1) expectIgnoredSentinelProbes(mock, true) - expectAuxRekeySentinel(mock, true) + expectAuxRekeyState(mock, true) expectSetAuxRekeySentinel(mock) for range auxRekeyTables { expectColumnExists(mock, false) @@ -362,7 +421,7 @@ func TestRekeyAuxRowIDsKeepsSentinelOnFailure(t *testing.T) { expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", "version", auxRekeyPassInitial.markerVersion-1) expectIgnoredSentinelProbes(mock, true) - expectAuxRekeySentinel(mock, false) + expectAuxRekeyState(mock, false) expectSetAuxRekeySentinel(mock) // First table probe fails; no DELETE of the sentinel may follow. mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.COLUMNS`). @@ -375,3 +434,59 @@ func TestRekeyAuxRowIDsKeepsSentinelOnFailure(t *testing.T) { t.Fatalf("unmet sql expectations: %v", err) } } + +// TestRekeyAuxRowIDsAllPassesSharesDriftRecordAcrossPasses verifies the +// auxRowRekeyDriftedKey/auxRekeyPasses invariant documented on those two +// declarations: every pass runs the identical rewrite over the identical +// auxRekeyTables set, so one shared drift record is enough — whichever pass +// retries a skipped table first does the work, and clearing the record +// correctly makes every later pass's own retry a no-op. +// +// Here both passes' markers are already recorded (steady state, not a fresh +// clone) and the shared record still names "events" as skipped. Pass 1 +// (auxRekeyPassInitial, first in auxRekeyPasses) must be the one that reads +// the record as pending and retries exactly that table, then clears it. Pass +// 2 (auxRekeyPassDerivedInsert) must then see nothing pending in its own +// state read and stop there — it must not re-probe or re-scan the table pass +// 1 already resolved. +func TestRekeyAuxRowIDsAllPassesSharesDriftRecordAcrossPasses(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New: %v", err) + } + defer db.Close() + captureLog(t) + + // Both passes' markers already recorded: the ignored cursor is at or past + // the later pass's markerVersion, so rekeyAuxRowIDsAllPasses' single + // pendingVersions read reports neither markerVersion as pending. + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", + "version", auxRekeyPassDerivedInsert.markerVersion) + expectIgnoredSentinelProbes(mock, true) + + // Pass 1: its own state read finds the shared drift record naming + // "events", so it retries just that table (the other three auxRekeyTables + // are left alone — a second table probe here would be an unmet + // expectation) and clears the record. + expectAuxRekeyStateForPass(mock, auxRekeyPassInitial, false, "events") + expectSetAuxRekeySentinelForPass(mock, auxRekeyPassInitial) + expectColumnExists(mock, false) + expectClearAuxRekeyDrifted(mock) + expectClearAuxRekeySentinelForPass(mock, auxRekeyPassInitial) + + // Pass 2: reads its own state after the record is cleared — nothing + // pending, so it stops after this probe with no further queries. + expectAuxRekeyStateForPass(mock, auxRekeyPassDerivedInsert, false) + + wrote, err := rekeyAuxRowIDsAllPasses(context.Background(), db, auxRekeyPassDerivedInsert.shippedMainVersion) + if err != nil { + t.Fatalf("rekeyAuxRowIDsAllPasses: %v", err) + } + if wrote { + t.Error("expected wrote=false: the resumed table had nothing left to re-key") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet sql expectations: %v", err) + } +} diff --git a/internal/storage/schema/aux_row_id_drift_test.go b/internal/storage/schema/aux_row_id_drift_test.go new file mode 100644 index 000000000..10be8fe45 --- /dev/null +++ b/internal/storage/schema/aux_row_id_drift_test.go @@ -0,0 +1,407 @@ +package schema + +import ( + "bytes" + "context" + "errors" + "fmt" + "log" + "regexp" + "slices" + "strings" + "testing" + + "github.com/DATA-DOG/go-sqlmock" +) + +var eventsTable = auxRekeyTables[0] + +// driftErr is the error a drifted table returns: dolt recovers the decode panic +// per query and surfaces it as a 1105. +var driftErr = errors.New("Error 1105 (HY000): panic recovered: invalid hash length: 19") + +func expectEventsSelect(mock sqlmock.Sqlmock) *sqlmock.ExpectedQuery { + return mock.ExpectQuery(regexp.QuoteMeta( + fmt.Sprintf("SELECT id, %s FROM %s", eventsTable.columns, eventsTable.name))) +} + +// captureLog redirects the standard logger, which is where the drift notices +// go: the package's own stderr writer is TTY-gated to io.Discard, and these are +// data-integrity warnings that a piped or CI caller must still see. +func captureLog(t *testing.T) *bytes.Buffer { + t.Helper() + var buf bytes.Buffer + origOut, origFlags := log.Writer(), log.Flags() + log.SetOutput(&buf) + log.SetFlags(0) + t.Cleanup(func() { log.SetOutput(origOut); log.SetFlags(origFlags) }) + return &buf +} + +// The re-key tolerates exactly the dolthub/dolt#11131 schema-encoding-drift +// signature and nothing else: every other failure must still abort the pass. +func TestIsSchemaEncodingDriftErr(t *testing.T) { + cases := []struct { + name string + err error + want bool + }{ + {"nil", nil, false}, + {"server 1105 drift panic", driftErr, true}, + { + "wrapped drift panic", + fmt.Errorf("scan rows of events: %w", driftErr), + true, + }, + { + // Migration 0057 records this width for the opposite tag flip. + "insert/merge side of the flip", + errors.New("Error 1105 (HY000): panic recovered: invalid hash length: 1"), + true, + }, + { + "unwrapped panic text", + errors.New("panic: invalid hash length: 19"), + true, + }, + {"plain sql error", errors.New("Error 1062 (23000): duplicate entry"), false}, + {"connection drop", errors.New("invalid connection"), false}, + {"unrelated panic", errors.New("Error 1105 (HY000): panic recovered: index out of range"), false}, + {"lock timeout", errors.New("Error 1205 (HY000): lock wait timeout exceeded"), false}, + } + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + if got := isSchemaEncodingDriftErr(c.err); got != c.want { + t.Fatalf("isSchemaEncodingDriftErr(%v) = %v, want %v", c.err, got, c.want) + } + }) + } +} + +// TestRekeyAuxRowIDsSkipsDriftedTable covers the #4380 unblock: a table whose +// rows Dolt cannot decode is skipped so the rest of the migration pass +// completes, instead of aborting it — which left affected databases unopenable, +// because the pass is re-attempted on every open. The skipped table is recorded +// so a later pass can finish the job, and the in-progress sentinel is cleared +// like any completed pass: it means "a rewrite is in flight", and MigrateUp +// relaxes its dirty-table guards while it is set. +func TestRekeyAuxRowIDsSkipsDriftedTable(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New: %v", err) + } + defer db.Close() + logged := captureLog(t) + + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", + "version", auxRekeyPassInitial.markerVersion-1) + expectIgnoredSentinelProbes(mock, true) + expectAuxRekeyState(mock, false) + expectSetAuxRekeySentinel(mock) + // events carries the drift: its scan panics server-side. + expectColumnExists(mock, true) + expectEventsSelect(mock).WillReturnError(driftErr) + // The remaining three tables still run. + for range auxRekeyTables[1:] { + expectColumnExists(mock, false) + } + expectSetAuxRekeyDrifted(mock, "events") + expectClearAuxRekeySentinel(mock) + + if _, err := rekeyAuxRowIDs(context.Background(), db, auxRekeyPassInitial.shippedMainVersion-1, auxRekeyPassInitial); err != nil { + t.Fatalf("drift must not abort the pass: %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet sql expectations: %v", err) + } + if got := logged.String(); !strings.Contains(got, `skipped "events"`) || + !strings.Contains(got, "may duplicate those rows") { + t.Errorf("log = %q\nwant a skip warning naming events and its merge consequence", got) + } +} + +// TestRekeyAuxRowIDsSkipsDriftDuringRewrite covers the other half of the drift +// surface: #4380 reports that UPDATE of an affected row panics just like a read, +// so the drift can land mid-rewrite, after some ids have already changed. The +// half-re-keyed table must be recorded and committed rather than failing the +// pass — it stays resumable because a row already holding one of its group's +// target ids keeps it, so a later attempt never swaps ids within a group. +func TestRekeyAuxRowIDsSkipsDriftDuringRewrite(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New: %v", err) + } + defer db.Close() + captureLog(t) + + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", + "version", auxRekeyPassInitial.markerVersion-1) + expectIgnoredSentinelProbes(mock, true) + expectAuxRekeyState(mock, false) + expectSetAuxRekeySentinel(mock) + expectColumnExists(mock, true) + // The scan succeeds — these are the readable-but-drifted rows — and the + // rewrite panics instead. + expectEventsSelect(mock). + WillReturnRows(sqlmock.NewRows([]string{ + "id", "issue_id", "event_type", "actor", "old_value", "new_value", "comment", "created_at", + }).AddRow("random-a", "bd-1", "status", "steve", "open", "closed", "", "2026-06-09 12:00:00")) + mock.ExpectExec(regexp.QuoteMeta("UPDATE events SET id = ? WHERE id = ?")). + WithArgs(sqlmock.AnyArg(), "random-a"). + WillReturnError(driftErr) + for range auxRekeyTables[1:] { + expectColumnExists(mock, false) + } + expectSetAuxRekeyDrifted(mock, "events") + expectClearAuxRekeySentinel(mock) + + wrote, err := rekeyAuxRowIDs(context.Background(), db, auxRekeyPassInitial.shippedMainVersion-1, auxRekeyPassInitial) + if err != nil { + t.Fatalf("drift mid-rewrite must not abort the pass: %v", err) + } + if !wrote { + t.Error("expected wrote=true so MigrateUp commits the partially re-keyed table") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet sql expectations: %v", err) + } +} + +// TestRekeyAuxRowIDsAbortsOnNonDriftError: the tolerance is narrow. An ordinary +// table failure must still propagate and keep the sentinel, exactly as before +// #4380 — otherwise it would swallow real migration bugs. +func TestRekeyAuxRowIDsAbortsOnNonDriftError(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New: %v", err) + } + defer db.Close() + captureLog(t) + + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", + "version", auxRekeyPassInitial.markerVersion-1) + expectIgnoredSentinelProbes(mock, true) + expectAuxRekeyState(mock, false) + expectSetAuxRekeySentinel(mock) + expectColumnExists(mock, true) + expectEventsSelect(mock).WillReturnError(errors.New("Error 1062 (23000): duplicate entry")) + + if _, err := rekeyAuxRowIDs(context.Background(), db, auxRekeyPassInitial.shippedMainVersion-1, auxRekeyPassInitial); err == nil { + t.Fatal("expected a non-drift table failure to propagate") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet sql expectations: %v", err) + } +} + +// TestRekeyAuxRowIDsResumesDriftedTableOnly is the counterpart to the skip. The +// pass that skipped completed, so MigrateUp recorded the clone-local marker and +// the marker gate can no longer re-admit the re-key; the drift record must, or +// the skipped table would keep its 0037 per-clone-random ids forever, even +// after the storage drift is repaired. +// +// It must also re-key ONLY the recorded table: the other three converged in the +// first pass, and rows minted since then carry app-minted ids that are already +// consistent across clones — re-keying those here would manufacture the +// divergence the whole pass exists to remove. +func TestRekeyAuxRowIDsResumesDriftedTableOnly(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New: %v", err) + } + defer db.Close() + captureLog(t) + + // Marker recorded, no crash sentinel — the post-skip steady state. + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", + "version", auxRekeyPassInitial.markerVersion) + expectIgnoredSentinelProbes(mock, true) + expectAuxRekeyState(mock, false, "events") + expectSetAuxRekeySentinel(mock) + // Exactly one table probe: any second one is an unexpected call, which is + // what proves the other three are left alone. + expectColumnExists(mock, false) + expectClearAuxRekeyDrifted(mock) + expectClearAuxRekeySentinel(mock) + + // Pre-pass cursor past the watershed too, so the drift record is overriding + // both the marker gate and the fresh-clone gate. + wrote, err := rekeyAuxRowIDs(context.Background(), db, auxRekeyPassInitial.shippedMainVersion, auxRekeyPassInitial) + if err != nil { + t.Fatalf("rekeyAuxRowIDs: %v", err) + } + if wrote { + t.Error("expected wrote=false when the resumed table has nothing to re-key") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet sql expectations: %v", err) + } +} + +// TestRekeyAuxRowIDsResumeStaysScopedAfterCrash: a drift-resume pass sets the +// in-flight sentinel like any other, so an unrelated failure (Ctrl-C, lock +// timeout, dropped connection) can leave the sentinel set on a clone whose +// marker is already recorded. That state must NOT be read as the bd-578h9.16 +// crash-resume and widened back to all four tables: the other three converged +// in the completed pass, and re-keying rows minted since — on this clone alone — +// is exactly the cross-clone divergence the scoping exists to prevent. +func TestRekeyAuxRowIDsResumeStaysScopedAfterCrash(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New: %v", err) + } + defer db.Close() + captureLog(t) + + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", + "version", auxRekeyPassInitial.markerVersion) + expectIgnoredSentinelProbes(mock, true) + // Marker recorded AND sentinel set: a drift-resume that died partway. + expectAuxRekeyState(mock, true, "events") + expectSetAuxRekeySentinel(mock) + expectColumnExists(mock, false) + expectClearAuxRekeyDrifted(mock) + expectClearAuxRekeySentinel(mock) + + if _, err := rekeyAuxRowIDs(context.Background(), db, auxRekeyPassInitial.shippedMainVersion, auxRekeyPassInitial); err != nil { + t.Fatalf("rekeyAuxRowIDs: %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet sql expectations: %v", err) + } +} + +// TestAuxRekeyExemptTablesScopedToRewrittenTables pins the #4380 dirtyBefore +// fix at its source: MigrateUp drops exactly auxRekeyExemptTables' set from the +// pre-existing-dirty guard before the re-key runs, so a table that is exempt is +// a table whose uncommitted user edits stageSchemaTables is then free to sweep +// into the "schema: apply migrations" commit. The exemption must therefore never +// name a table the re-key will not itself rewrite. +// +// The regression is the post-marker resume: a drift retry whose crash left the +// in-flight sentinel set, with the drift record naming only a subset. The old +// collapsed "some rewrite is in flight" bit exempted all four aux tables there; +// a non-drifted table (comments, say) then lost its dirty protection while the +// rewrite touched only events, carrying the user's comments edits into the +// migration commit. Asserting the exempt set equals the drifted subset — and, on +// a converged database, is empty — is asserting those non-drifted tables stay in +// dirtyBefore and so never reach the commit. +func TestAuxRekeyExemptTablesScopedToRewrittenTables(t *testing.T) { + allFour := []string{"comments", "compaction_snapshots", "events", "issue_snapshots"} + cases := []struct { + name string + mainVersionBefore int + setup func(sqlmock.Sqlmock) + want []string + }{ + { + // The bug's exact state: marker already recorded (nothing ignored + // pending), a drift record for events alone, and pass initial's + // crash sentinel still set. Exemption must be {events}, not all four. + name: "post-marker resume with crashed sentinel exempts only the drifted subset", + mainVersionBefore: auxRekeyPassDerivedInsert.shippedMainVersion, + setup: func(mock sqlmock.Sqlmock) { + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", + "version", LatestIgnoredVersion()) + expectIgnoredSentinelProbes(mock, true) + // Pass initial died mid-resume (sentinel set); the shared drift + // record names events, so pass derived-insert reads it too. + expectAuxRekeyStateForPass(mock, auxRekeyPassInitial, true, "events") + expectAuxRekeyStateForPass(mock, auxRekeyPassDerivedInsert, false, "events") + }, + want: []string{"events"}, + }, + { + // A markerPending pass is the one-time convergence and legitimately + // rewrites — and so exempts — all four. + name: "marker-pending first pass exempts all four", + mainVersionBefore: auxRekeyPassInitial.shippedMainVersion - 1, + setup: func(mock sqlmock.Sqlmock) { + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", + "version", auxRekeyPassInitial.markerVersion-1) + expectIgnoredSentinelProbes(mock, true) + expectAuxRekeyStateForPass(mock, auxRekeyPassInitial, false) + expectAuxRekeyStateForPass(mock, auxRekeyPassDerivedInsert, false) + }, + want: allFour, + }, + { + // Converged and current, nothing owed: no exemption at all, so a + // dirty aux table is fully protected on a healthy database. + name: "converged database exempts nothing", + mainVersionBefore: auxRekeyPassDerivedInsert.shippedMainVersion, + setup: func(mock sqlmock.Sqlmock) { + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", + "version", LatestIgnoredVersion()) + expectIgnoredSentinelProbes(mock, true) + expectAuxRekeyStateForPass(mock, auxRekeyPassInitial, false) + expectAuxRekeyStateForPass(mock, auxRekeyPassDerivedInsert, false) + }, + want: nil, + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New: %v", err) + } + defer db.Close() + tc.setup(mock) + + exempt, err := auxRekeyExemptTables(context.Background(), db, tc.mainVersionBefore) + if err != nil { + t.Fatalf("auxRekeyExemptTables: %v", err) + } + got := make([]string, 0, len(exempt)) + for name := range exempt { + got = append(got, name) + } + slices.Sort(got) + if !slices.Equal(got, tc.want) { + t.Fatalf("exempt = %v, want %v", got, tc.want) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet sql expectations: %v", err) + } + }) + } +} + +// TestRekeyAuxRowIDsKeepsDriftRecordWhileUnrepaired: a resumed pass that finds +// the storage still drifted must re-record the table rather than lose it, so +// the retry survives arbitrarily many passes before the repair happens. +func TestRekeyAuxRowIDsKeepsDriftRecordWhileUnrepaired(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New: %v", err) + } + defer db.Close() + captureLog(t) + + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", + "version", auxRekeyPassInitial.markerVersion) + expectIgnoredSentinelProbes(mock, true) + expectAuxRekeyState(mock, false, "events") + expectSetAuxRekeySentinel(mock) + expectColumnExists(mock, true) + expectEventsSelect(mock).WillReturnError(driftErr) + expectSetAuxRekeyDrifted(mock, "events") + expectClearAuxRekeySentinel(mock) + + if _, err := rekeyAuxRowIDs(context.Background(), db, auxRekeyPassInitial.shippedMainVersion, auxRekeyPassInitial); err != nil { + t.Fatalf("rekeyAuxRowIDs: %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet sql expectations: %v", err) + } +} diff --git a/internal/storage/schema/converged.go b/internal/storage/schema/converged.go index 42d545b61..587220485 100644 --- a/internal/storage/schema/converged.go +++ b/internal/storage/schema/converged.go @@ -84,6 +84,30 @@ func alreadyConverged(ctx context.Context, db DBConn, databaseName string, selec return false, nil } + // The pattern being present does not mean it is in EFFECT. On a legacy + // lineage the ignored-lane cursor table is committed at HEAD, where + // dolt_ignore's add-delta semantics make the pattern inert and every pull + // wedges (gastownhall/beads#4356). MigrateUp reconciles that, and also + // cleans up after a reconcile some earlier open was killed midway + // through, so a database in either shape is not converged no matter how + // at-latest its cursors read. + // + // This asks for the WHOLE gate, not just the legacy-shape half of it. A + // term that MigrateUp acts on but this function does not evaluate is + // silently unreachable in server mode — the fast path returns before + // MigrateUp ever runs — and the leftover it would have cleaned up is a + // deliberately non-ignored table that the next pull's auto-commit puts + // into HEAD and push replicates fleet-wide. + // + // Two always-succeeding reads on the hot path, both bounded to one row. + state, err := readIgnoredCursorState(ctx, db, qualifier) + if err != nil { + return false, err + } + if state.reconcileNeeded() { + return false, nil + } + // LAST, and deliberately so: everything above is the cheap steady-state // question and short-circuits first. This term closes the window where a // peer is midway through a real migration pass. migrationWorkNeeded only diff --git a/internal/storage/schema/converged_test.go b/internal/storage/schema/converged_test.go index 68d3d16d2..8eff9441e 100644 --- a/internal/storage/schema/converged_test.go +++ b/internal/storage/schema/converged_test.go @@ -144,11 +144,13 @@ func expectConvergedProbe(mock sqlmock.Sqlmock, database string) { expectCurrentDatabase(mock, database) expectNoMigrationWorkNeeded(mock) expectDoltIgnoreRead(mock, unqualifiedDoltIgnore, seededIgnorePatterns(LatestVersion())) + expectIgnoredCursorGate(mock, "", false, nil, false) expectMigrationLockProbe(mock, database, 1) } func newMockConn(t *testing.T) (*sql.Conn, sqlmock.Sqlmock, func()) { t.Helper() + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { @@ -167,6 +169,7 @@ func newMockConn(t *testing.T) (*sql.Conn, sqlmock.Sqlmock, func()) { func newMockDB(t *testing.T) (*sql.DB, sqlmock.Sqlmock) { t.Helper() + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { @@ -226,6 +229,7 @@ func TestMigrateUpWithLockSkipsLockOnAnUnselectedSession(t *testing.T) { expectSessionPutOnDatabase(mock, "testdb") expectNoMigrationWorkNeeded(mock) expectDoltIgnoreRead(mock, qualifiedDoltIgnore("testdb"), seededIgnorePatterns(LatestVersion())) + expectIgnoredCursorGate(mock, "`testdb`", false, nil, false) expectMigrationLockProbe(mock, "testdb", 1) prepared := 0 @@ -496,6 +500,7 @@ func TestAlreadyConvergedDeclinesWhileTheMigrationLockIsHeld(t *testing.T) { expectCurrentDatabase(mock, "testdb") expectNoMigrationWorkNeeded(mock) expectDoltIgnoreRead(mock, unqualifiedDoltIgnore, seededIgnorePatterns(LatestVersion())) + expectIgnoredCursorGate(mock, "", false, nil, false) expectMigrationLockProbe(mock, "testdb", tt.free) converged, err := alreadyConverged(context.Background(), db, "testdb", nil) @@ -655,6 +660,7 @@ func TestAlreadyConvergedAcceptsOverriddenIgnorePattern(t *testing.T) { // The probe selects patterns only; the mock never offers the ignored // column, so a query that filtered on it would not match this expectation. expectDoltIgnoreRead(mock, unqualifiedDoltIgnore, seededIgnorePatterns(LatestVersion())) + expectIgnoredCursorGate(mock, "", false, nil, false) expectMigrationLockProbe(mock, "testdb", 1) converged, err := alreadyConverged(context.Background(), db, "testdb", nil) @@ -684,6 +690,7 @@ func TestAlreadyConvergedOnForwardSkew(t *testing.T) { expectCurrentDatabase(mock, "testdb") expectNoMigrationWorkNeededAtVersion(mock, ahead) expectDoltIgnoreRead(mock, unqualifiedDoltIgnore, seededIgnorePatterns(ahead)) + expectIgnoredCursorGate(mock, "", false, nil, false) expectMigrationLockProbe(mock, "testdb", 1) converged, err := alreadyConverged(context.Background(), db, "testdb", nil) @@ -743,6 +750,7 @@ func TestAlreadyConvergedFailsClosedOnUnreadableState(t *testing.T) { expectCurrentDatabase(mock, "testdb") expectNoMigrationWorkNeeded(mock) expectDoltIgnoreRead(mock, unqualifiedDoltIgnore, seededIgnorePatterns(LatestVersion())) + expectIgnoredCursorGate(mock, "", false, nil, false) mock.ExpectQuery(regexp.QuoteMeta("SELECT IS_FREE_LOCK(?)")). WillReturnError(sql.ErrConnDone) diff --git a/internal/storage/schema/cursor_reality_test.go b/internal/storage/schema/cursor_reality_test.go index 10dc010b1..c41144fab 100644 --- a/internal/storage/schema/cursor_reality_test.go +++ b/internal/storage/schema/cursor_reality_test.go @@ -2,6 +2,7 @@ package schema import ( "context" + "database/sql" "errors" "regexp" "strings" @@ -44,41 +45,60 @@ func stubSentinelColumns(t *testing.T, present map[string]bool, probeErr error) return &probed } -// TestCursorContradictedBySchema is the gh 5033 / gh 4356 regression: the -// cursor is a claim about the schema, and a claim the schema contradicts must -// not be believed. Before this, a database whose clone-local wisp tables were -// absent but whose (also clone-local) cursor rows survived reported at-latest, +// allSentinelTables is the "everything the table sentinels ask for is present" +// shape, so column-sentinel cases can say so without repeating the list. +func allSentinelTables() map[string]bool { + present := make(map[string]bool, len(ignoredSource.sentinelTables)) + for _, table := range ignoredSource.sentinelTables { + present[table] = true + } + return present +} + +// TestCursorRealityFloor is the gh 5033 / gh 4356 regression: the cursor is a +// claim about the schema, and a claim the schema contradicts must not be +// believed. Before this, a database whose clone-local wisp tables were absent +// but whose (also clone-local) cursor rows survived reported at-latest, // migrationWorkNeeded() short-circuited, the ignored series never re-ran, and // the damage surfaced much later as "table not found: wisp_dependencies". -func TestCursorContradictedBySchema(t *testing.T) { +// +// A missing sentinel COLUMN is a weaker contradiction than a missing sentinel +// table: it floors the cursor at the sentinel's replayFloor instead of zeroing +// it, so the migrations that ran long before the column existed are not +// replayed. See TestCurrentVersionClampsToSentinelFloor for what that buys. +func TestCursorRealityFloor(t *testing.T) { ctx := context.Background() for _, tc := range []struct { - name string - present map[string]bool - columns map[string]bool - want bool + name string + present map[string]bool + columns map[string]bool + wantFloor int + wantLimited bool }{ { - name: "no wisp tables at all", - present: map[string]bool{}, - columns: map[string]bool{}, - want: true, + name: "no wisp tables at all", + present: map[string]bool{}, + columns: map[string]bool{}, + wantFloor: 0, + wantLimited: true, }, { // Partial materialization must count as contradicted; checking // only the first sentinel would miss exactly gh 5033's shape, // where wisp_dependencies is the missing one. - name: "wisps present, wisp_dependencies absent", - present: map[string]bool{"wisps": true}, - columns: map[string]bool{}, - want: true, + name: "wisps present, wisp_dependencies absent", + present: map[string]bool{"wisps": true}, + columns: map[string]bool{}, + wantFloor: 0, + wantLimited: true, }, { - name: "wisp_dependencies present, wisps absent", - present: map[string]bool{"wisp_dependencies": true}, - columns: map[string]bool{}, - want: true, + name: "wisp_dependencies present, wisps absent", + present: map[string]bool{"wisp_dependencies": true}, + columns: map[string]bool{}, + wantFloor: 0, + wantLimited: true, }, // These two cases document the two real-world shapes the stub seam // collapses: an absent leases table and a present-but-column-less leases @@ -86,68 +106,200 @@ func TestCursorContradictedBySchema(t *testing.T) { // (columns["leases.granted_node"] == false), because the real // schemaColumnExists COUNT(*) is 0 for a missing table and a missing // column alike. They deliberately exercise the same branch — the naming - // records intent, not a distinct seam path. + // records intent, not a distinct seam path. Both floor at 11, which is + // what lets the replay heal both (0012 re-creates leases, 0016 adds the + // column) without reaching back to 0007. { - name: "leases table absent", - present: map[string]bool{"wisps": true, "wisp_dependencies": true}, - columns: map[string]bool{}, - want: true, + name: "leases table absent", + present: allSentinelTables(), + columns: map[string]bool{}, + wantFloor: 11, + wantLimited: true, }, { - name: "leases granted_node absent", - present: map[string]bool{"wisps": true, "wisp_dependencies": true}, - columns: map[string]bool{}, - want: true, + name: "leases granted_node absent", + present: allSentinelTables(), + columns: map[string]bool{}, + wantFloor: 11, + wantLimited: true, }, { - name: "schema corroborates the cursor", - present: map[string]bool{"wisps": true, "wisp_dependencies": true}, - columns: map[string]bool{"leases.granted_node": true}, - want: false, + // A missing sentinel table outranks any column floor, and says so + // without paying for the column probe at all. + name: "wisp tables and leases column both absent", + present: map[string]bool{}, + columns: map[string]bool{}, + wantFloor: 0, + wantLimited: true, + }, + { + name: "schema corroborates the cursor", + present: allSentinelTables(), + columns: map[string]bool{"leases.granted_node": true}, + wantFloor: 0, + wantLimited: false, }, } { t.Run(tc.name, func(t *testing.T) { stubSentinelTables(t, tc.present, nil) stubSentinelColumns(t, tc.columns, nil) - got, err := ignoredSource.cursorContradictedBySchema(ctx, nil) + floor, limited, err := ignoredSource.cursorRealityFloor(ctx, nil) if err != nil { t.Fatalf("unexpected error: %v", err) } - if got != tc.want { - t.Errorf("cursorContradictedBySchema = %v, want %v", got, tc.want) + if limited != tc.wantLimited { + t.Errorf("cursorRealityFloor limited = %v, want %v", limited, tc.wantLimited) + } + if limited && floor != tc.wantFloor { + t.Errorf("cursorRealityFloor floor = %d, want %d", floor, tc.wantFloor) } }) } } -// A probe failure must not be laundered into "contradicted" — that would -// re-run the whole series on a database whose state could not be read. +// mockIgnoredCursorRead stands up a database that answers exactly the two +// queries currentVersion issues for the ignored series before it consults the +// sentinels: the cursor-table existence probe and the MAX(version) read. +func mockIgnoredCursorRead(t *testing.T, raw int) *sql.DB { + t.Helper() + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New: %v", err) + } + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", "version", raw) + t.Cleanup(func() { + if err := mock.ExpectationsWereMet(); err != nil { + t.Errorf("unmet cursor-read expectations: %v", err) + } + db.Close() + }) + return db +} + +// TestCurrentVersionClampsToSentinelFloor is the wisp-restamp regression +// (#5981 harm class, #5366 follow-up). Every released tree — v1.1.0, v1.1.2, +// v1.2.x — tops the ignored series at 0011 and has no leases table, so the +// leases.granted_node sentinel reads absent on the very first open by a 1.3.0 +// binary. Zeroing the cursor there replays 0001–0025, and ignored/0007's +// unguarded `UPDATE wisps SET is_blocked = 0` re-fires wisps.updated_at's +// ON UPDATE CURRENT_TIMESTAMP across a plane with no history to restore from. +// The cursor must be believed up to the floor instead, so only the genuinely +// pending tail applies. +func TestCurrentVersionClampsToSentinelFloor(t *testing.T) { + ctx := context.Background() + latest := LatestIgnoredVersion() + + for _, tc := range []struct { + name string + raw int + present map[string]bool + columns map[string]bool + want int + }{ + { + // THE regression: the release lineage. Believed 11 ⇒ pending set is + // 0012–0025, which is the correct pending set for these stores. + name: "release lineage upgrade, cursor 11, leases absent", + raw: 11, + present: allSentinelTables(), + columns: map[string]bool{}, + want: 11, + }, + { + // The ga-usd3k ordinal collision: leases exists, the column does + // not. Clamped to 11, so 0012–0015 re-run guarded/idempotent and + // 0016 heals — without 0007. + name: "ordinal collision, cursor 17, column absent", + raw: 17, + present: allSentinelTables(), + columns: map[string]bool{}, + want: 11, + }, + { + name: "at-latest cursor, column absent", + raw: latest, + present: allSentinelTables(), + columns: map[string]bool{}, + want: 11, + }, + { + // A cursor already below the floor is believed as read: the floor + // is a ceiling on belief, never a promotion. + name: "cursor below the floor is untouched", + raw: 8, + present: allSentinelTables(), + columns: map[string]bool{}, + want: 8, + }, + { + // gh 5033 is bit-for-bit unchanged: table sentinels floor at 0, so + // the whole series still replays for the shape it was written for. + name: "wisp tables absent, at-latest cursor", + raw: latest, + present: map[string]bool{}, + columns: map[string]bool{}, + want: 0, + }, + { + name: "wisp tables and leases column both absent", + raw: latest, + present: map[string]bool{}, + columns: map[string]bool{}, + want: 0, + }, + { + name: "fully corroborated cursor is believed as read", + raw: latest, + present: allSentinelTables(), + columns: map[string]bool{"leases.granted_node": true}, + want: latest, + }, + } { + t.Run(tc.name, func(t *testing.T) { + stubSentinelTables(t, tc.present, nil) + stubSentinelColumns(t, tc.columns, nil) + db := mockIgnoredCursorRead(t, tc.raw) + + got, err := ignoredSource.currentVersion(ctx, db) + if err != nil { + t.Fatalf("currentVersion: %v", err) + } + if got != tc.want { + t.Errorf("currentVersion = %d, want %d (raw cursor %d)", got, tc.want, tc.raw) + } + }) + } +} + +// A probe failure must not be laundered into a contradiction — that would +// re-run the series on a database whose state could not be read. func TestCursorProbeErrorIsNotTreatedAsContradicted(t *testing.T) { boom := errors.New("information_schema unavailable") stubSentinelTables(t, nil, boom) - got, err := ignoredSource.cursorContradictedBySchema(context.Background(), nil) + _, limited, err := ignoredSource.cursorRealityFloor(context.Background(), nil) if !errors.Is(err, boom) { t.Errorf("probe error was swallowed: err = %v", err) } - if got { + if limited { t.Error("an unreadable probe reported the cursor as contradicted") } } // The main series is deliberately unguarded: its tables are not clone-local, // so it cannot reach the contradicted state, and probing would add queries to -// every store open for nothing. cursorContradictedBySchema must be a no-op for -// it — including never probing. +// every store open for nothing. cursorRealityFloor must be a no-op for it — +// including never probing. func TestMainSourceIsNotProbed(t *testing.T) { probed := stubSentinelTables(t, map[string]bool{}, nil) columnProbed := stubSentinelColumns(t, map[string]bool{}, nil) - got, err := mainSource.cursorContradictedBySchema(context.Background(), nil) + _, limited, err := mainSource.cursorRealityFloor(context.Background(), nil) if err != nil { t.Fatalf("unexpected error: %v", err) } - if got { + if limited { t.Error("mainSource reported contradicted; it has no sentinels and must never be") } if len(*probed) != 0 { @@ -192,39 +344,95 @@ func TestSentinelTablesAreCreatedByTheSeries(t *testing.T) { } // TestSentinelColumnsAreCreatedByTheSeries is the column-sentinel analogue of -// TestSentinelTablesAreCreatedByTheSeries: a sentinel column this series does -// not add could never be repaired by re-running it, so an otherwise at-latest -// cursor would be rejected on every open — turning a silent wrong answer into a -// permanent re-migration loop in the field. Enforce the creating side in CI. +// TestSentinelTablesAreCreatedByTheSeries, plus the floor-honesty check the +// replay clamp depends on. Two things have to hold for every sentinel column: +// +// - The series must ADD the column, and must CREATE the table carrying it. +// A sentinel the series cannot repair would be rejected on every open — +// a permanent re-migration loop in the field. +// - Both of those files must sit strictly ABOVE the sentinel's replayFloor, +// or the clamped replay would skip the very migrations that heal it. That +// is what makes floor 11 correct today (0012 creates leases, 0016 adds +// granted_node) and what makes a future renumbering of either file fail +// here instead of stranding users. +// +// Versions are parsed per file rather than matched against the concatenated +// series precisely so the floor can be checked, not just the existence. func TestSentinelColumnsAreCreatedByTheSeries(t *testing.T) { - entries, err := ignoredSource.files.ReadDir(ignoredSource.dir) - if err != nil { - t.Fatalf("read %s: %v", ignoredSource.dir, err) - } - var all strings.Builder - for _, e := range entries { - blob, err := ignoredSource.files.ReadFile(ignoredSource.dir + "/" + e.Name()) - if err != nil { - t.Fatalf("read %s: %v", e.Name(), err) - } - all.Write(blob) - } - body := all.String() - if len(ignoredSource.sentinelColumns) == 0 { t.Fatal("ignoredSource has no sentinel columns; the granted_node guard is inert") } + + bodies := make(map[int]string) + for _, mf := range ignoredSource.list() { + blob, err := ignoredSource.files.ReadFile(ignoredSource.dir + "/" + mf.name) + if err != nil { + t.Fatalf("read %s: %v", mf.name, err) + } + bodies[mf.version] = string(blob) + } + + // findVersion returns the lowest migration version whose body matches, + // or 0 when nothing does. + findVersion := func(re *regexp.Regexp) int { + found := 0 + for version, body := range bodies { + if !re.MatchString(body) { + continue + } + if found == 0 || version < found { + found = version + } + } + return found + } + + // The floor exists to exclude ignored/0007's unguarded recompute, whose + // bare `UPDATE wisps SET is_blocked = 0` re-fires wisps.updated_at's + // ON UPDATE CURRENT_TIMESTAMP. Its guarded successor 0015 writes + // `is_blocked = 0, updated_at = updated_at` and deliberately does not + // match. Pinning the file rather than a bare literal keeps the floor + // honest if the pair is ever renumbered. + unguarded := findVersion(regexp.MustCompile(`(?i)UPDATE\s+wisps\s+SET\s+is_blocked\s*=\s*0\s*;`)) + if unguarded == 0 { + t.Fatal("the unguarded `UPDATE wisps SET is_blocked = 0` the replay floor exists to exclude is gone; re-derive the floor") + } + for _, sc := range ignoredSource.sentinelColumns { // ignored/0016 adds the column with a guarded, idempotent // `ALTER TABLE ADD COLUMN `, which is also why - // re-running the series repairs rather than clobbers. Bind the table so - // a sentinel naming a column the series only adds to some other table + // re-running it repairs rather than clobbers. Bind the table so a + // sentinel naming a column the series only adds to some other table // (or never adds at all) fails here rather than in the field. - re := regexp.MustCompile(`(?i)ALTER TABLE\s+` + regexp.QuoteMeta(sc.table) + - `\s+ADD COLUMN\s+` + regexp.QuoteMeta(sc.column)) - if !re.MatchString(body) { + adder := findVersion(regexp.MustCompile(`(?i)ALTER TABLE\s+` + regexp.QuoteMeta(sc.table) + + `\s+ADD COLUMN\s+` + regexp.QuoteMeta(sc.column))) + if adder == 0 { t.Errorf("sentinel column %s.%s is never added by the %s series; re-running it could not repair that column", sc.table, sc.column, ignoredSource.dir) + continue + } + // ignored/0012 builds the carrier table as __temp__ and renames + // it into place only when is absent. The single COLUMNS probe + // cannot tell "table missing" from "column missing", so the replay has + // to be able to heal both. + creator := findVersion(regexp.MustCompile(regexp.QuoteMeta("__temp__" + sc.table))) + if creator == 0 { + t.Errorf("carrier table %s for sentinel column %s.%s is never created by the %s series", + sc.table, sc.table, sc.column, ignoredSource.dir) + continue + } + + if adder <= sc.replayFloor { + t.Errorf("sentinel column %s.%s is added by ignored/%04d, at or below its replayFloor %d; the clamped replay would skip the migration that heals it", + sc.table, sc.column, adder, sc.replayFloor) + } + if creator <= sc.replayFloor { + t.Errorf("carrier table %s is created by ignored/%04d, at or below sentinel %s.%s's replayFloor %d; a store missing the table entirely would never be repaired", + sc.table, creator, sc.table, sc.column, sc.replayFloor) + } + if sc.replayFloor < unguarded { + t.Errorf("sentinel %s.%s replayFloor %d does not exclude ignored/%04d, whose unguarded UPDATE restamps wisps.updated_at", + sc.table, sc.column, sc.replayFloor, unguarded) } } } @@ -348,3 +556,100 @@ func TestMigrateAppliesUnderContradictedCursor(t *testing.T) { t.Fatalf("unmet expectations: %v", err) } } + +// TestMigrateStartsAboveTheFloorUnderColumnContradiction is the applier-side +// half of the clamp, and the sibling of TestMigrateAppliesUnderContradictedCursor +// (which keeps covering the table-sentinel shape). Deciding the believed cursor +// correctly is worthless if the applier then starts the replay somewhere else: +// the harm this fix exists to stop is executed BY the applier, when it re-runs +// ignored/0007. +// +// The mock walks migrate() to the first statement it applies and fails it +// distinctively. Attribution to 0012 — not 0001 — is the proof: the applier +// skipped 0001–0011 (0007 among them) and resumed at the leases creator, which +// is exactly the pending set a clamped cursor of 11 describes. +func TestMigrateStartsAboveTheFloorUnderColumnContradiction(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New: %v", err) + } + defer db.Close() + + // migrate() preamble: cursor-table bootstrap, content_hash presence check. + mock.ExpectExec(regexp.QuoteMeta("CREATE TABLE IF NOT EXISTS ignored_schema_migrations")). + WillReturnResult(sqlmock.NewResult(0, 0)) + mock.ExpectQuery(regexp.QuoteMeta("SHOW COLUMNS FROM ignored_schema_migrations LIKE 'content_hash'")). + WillReturnRows(sqlmock.NewRows([]string{"Field", "Type", "Null", "Key", "Default", "Extra"}). + AddRow("content_hash", "char(64)", "YES", "", nil, "")) + + // The guarded read: cursor claims at-latest, both table sentinels + // corroborate it, and only the leases column does not. + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", "version", LatestIgnoredVersion()) + for range ignoredSource.sentinelTables { + mock.ExpectQuery(regexp.QuoteMeta("FROM INFORMATION_SCHEMA.TABLES")). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(1)) + } + mock.ExpectQuery(regexp.QuoteMeta("FROM INFORMATION_SCHEMA.COLUMNS")). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) + + boom := errors.New("stop here: the applier resumed above the floor") + mock.ExpectExec(".*").WillReturnError(boom) + + _, _, err = ignoredSource.migrate(context.Background(), db, 0) + if err == nil { + t.Fatal("migrate returned nil with a column-contradicted at-latest cursor; the heal for ignored 0012/0016 never ran") + } + if !errors.Is(err, boom) { + t.Fatalf("migrate failed for another reason before applying: %v", err) + } + if !strings.Contains(err.Error(), "0012") { + t.Errorf("replay did not resume at the leases creator: %v", err) + } + if strings.Contains(err.Error(), "0001_") { + t.Errorf("replay reached back into the pre-floor range; ignored/0007 would restamp wisps.updated_at: %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet expectations: %v", err) + } +} + +// TestPendingVersionsUnderFloorDoNotReArmAuxMarkers guards the collateral the +// clamp also fixes. rekeyAuxRowIDsAllPasses gates each convergence pass on its +// marker version appearing in ignoredSource.pendingVersions, which reads the +// same guarded cursor. Zeroing put marker 9 back in the pending set on every +// release-lineage upgrade, spuriously re-running the pass-1 aux row-id rewrite +// over the synced events/comments/snapshots planes — a convergent no-op by +// design, but wasted work and needless churn risk. The clamp makes the marker +// gate see the true pending set. +func TestPendingVersionsUnderFloorDoNotReArmAuxMarkers(t *testing.T) { + stubSentinelTables(t, allSentinelTables(), nil) + stubSentinelColumns(t, map[string]bool{}, nil) + db := mockIgnoredCursorRead(t, 11) + + pending, err := ignoredSource.pendingVersions(context.Background(), db) + if err != nil { + t.Fatalf("pendingVersions: %v", err) + } + + pendingSet := make(map[int]bool, len(pending)) + for _, v := range pending { + pendingSet[v] = true + } + + for _, pass := range auxRekeyPasses { + // Marker 9 is below the floor and must stay applied; marker 18 is + // genuinely pending on a cursor-11 store and must stay armed. + want := pass.markerVersion > 11 + if pendingSet[pass.markerVersion] != want { + t.Errorf("aux rekey marker %d pending = %v, want %v (cursor 11 clamped at floor 11)", + pass.markerVersion, pendingSet[pass.markerVersion], want) + } + } + if !pendingSet[12] { + t.Error("ignored/0012 is not pending on a cursor-11 store; the leases heal would never run") + } + if pendingSet[7] { + t.Error("ignored/0007 is pending on a cursor-11 store; its unguarded UPDATE would restamp wisps.updated_at") + } +} diff --git a/internal/storage/schema/dep_id_backfill.go b/internal/storage/schema/dep_id_backfill.go index 4ae4e50c9..c8c02c52e 100644 --- a/internal/storage/schema/dep_id_backfill.go +++ b/internal/storage/schema/dep_id_backfill.go @@ -4,10 +4,47 @@ import ( "context" "database/sql" "fmt" + "log" + "sort" + "strings" "github.com/steveyegge/beads/internal/storage/depid" ) +// depRekeyTables are the two edge tables the re-key covers, in execution order. +var depRekeyTables = []string{"dependencies", "wisp_dependencies"} + +// depTargetColumns is the COALESCE order of the three typed target columns, +// which is also the survivor priority for a duplicated edge: an issue ref beats +// a wisp ref beats an external ref. Changing this order changes both the derived +// target and which twin survives, so it is deliberately the same list for both. +var depTargetColumns = []string{"depends_on_issue_id", "depends_on_wisp_id", "depends_on_external"} + +// depDeleteChunk is how many ids one DELETE ... WHERE id IN (...) carries, +// matching issueops' deleteBatchSize. The victims of #5268 are precisely the +// databases with thousands of divergent rows, and this pass runs at open. +const depDeleteChunk = 50 + +// DependencyRekeyConflictError reports an edge table the re-key cannot converge +// without guessing: a row outside any duplicate group is squatting on an id +// another row must move to, or a set of rows form a rotation with no free id to +// move through. Both are corruption rather than the cross-column duplicate this +// pass merges, so the pass refuses before writing anything. +// +// It is typed because a repair pass must not brick reads: embeddeddolt's +// non-strict opens (read-only commands, working-set reconcile) tolerate it and +// continue, the same way they tolerate DirtyTablesError. Nothing is lost by +// continuing — the 0026 marker stays unrecorded, so the next open retries. +type DependencyRekeyConflictError struct { + Table string + Detail string +} + +func (e *DependencyRekeyConflictError) Error() string { + return fmt.Sprintf("%s: %s; run `bd doctor` to inspect the table (gastownhall/beads#5268)", + e.Table, e.Detail) +} + // rekeyDependencyIDs rewrites the surrogate primary key of every dependencies // and wisp_dependencies row whose id does not already equal // depid.New(issue_id, target). It is the data half of the #4259 fix. @@ -26,71 +63,390 @@ import ( // pass is a cheap no-op. dependencies changes are staged and committed by // MigrateUp; wisp_dependencies is dolt-ignored, so its re-key stays clone-local // (it only escapes on promotion, which copies the id). -func rekeyDependencyIDs(ctx context.Context, db DBConn) (bool, error) { - wroteDeps, err := rekeyDependencyTable(ctx, db, "dependencies") - if err != nil { - return wroteDeps, fmt.Errorf("dependencies: %w", err) +// +// gastownhall/beads#5268: depid keys on (issue_id, resolved target) and +// deliberately not on which typed column holds the target, but the unique keys +// are per-column (uk_dep_issue_target / uk_dep_wisp_target / +// uk_dep_external_target), so a legal table can hold the same logical edge +// twice — e.g. an April wisp→issue conversion that recorded the edge as +// external before the target existed as an issue, then again as an issue ref. +// Both rows derive the same id, so the old row-at-a-time rewrite aborted the +// second UPDATE with "duplicate primary key given" partway through the table. +// planDependencyRekey now merges those duplicates instead, and ignored migration +// 0026 is the completion marker that makes the pass run once on every existing +// clone — including one already at the latest main version that a pre-1.3.0 +// binary left half-rekeyed — and re-run on the next open if it ever aborts. +// +// BOTH tables are planned before EITHER is executed. Planning is read-only, so a +// refusal on wisp_dependencies must not leave the synced dependencies table +// already rewritten: those writes would sit uncommitted (the pass aborts before +// MigrateUp's DOLT_COMMIT) and the recovery pass would then classify them as +// pre-existing dirty and skip them again. +// +// dirtyBefore is MigrateUp's set of committable tables that were already dirty +// when the pass started. Writing the re-key into one of them would entangle +// migration output with uncommitted user data — the hazard changedDirtyTableSignatures +// exists to catch — but that guard runs AFTER ignoredSource.migrate has durably +// recorded the 0026 marker, so it would fail the open once and never retry, +// leaving the heal to ride an unrelated user commit. Refusing here instead, at +// plan time, keeps the contract: nothing written, marker unrecorded, retried on +// the next open once the user commits or discards the working set. +func rekeyDependencyIDs(ctx context.Context, db DBConn, dirtyBefore map[string]dirtyTableState) (bool, error) { + plans := make([]*depPlan, 0, len(depRekeyTables)) + for _, table := range depRekeyTables { + plan, err := planDependencyTableRekey(ctx, db, table) + if err != nil { + return false, err + } + plans = append(plans, plan) } - wroteWisp, err := rekeyDependencyTable(ctx, db, "wisp_dependencies") - if err != nil { - return wroteDeps || wroteWisp, fmt.Errorf("wisp_dependencies: %w", err) + + var blocked []string + for _, plan := range plans { + if _, dirty := dirtyBefore[plan.table]; dirty && plan.writes() { + blocked = append(blocked, plan.table) + } } - return wroteDeps || wroteWisp, nil + if len(blocked) > 0 { + return false, &DirtyTablesError{Tables: blocked} + } + + wrote := false + for _, plan := range plans { + planWrote, err := plan.execute(ctx, db) + wrote = wrote || planWrote + if err != nil { + return wrote, err + } + } + return wrote, nil } -// rekeyDependencyTable re-derives ids for one edge table. table must be a -// hardcoded constant ("dependencies" or "wisp_dependencies"). -func rekeyDependencyTable(ctx context.Context, db DBConn, table string) (bool, error) { +// depRow is one scanned edge: its current primary key, the natural identity +// depid keys on, which typed column carried the target, and the type the merge +// would discard if this row loses. +type depRow struct { + id string + issueID string + target string + depType string + targetCount int // non-null typed target columns; only 1 is a well-formed edge + priority int // index into depTargetColumns; lower wins the merge +} + +// mergeable reports whether the row has exactly one typed target, i.e. whether +// its natural identity is unambiguous enough to group and re-key. Rows with none +// (ck_dep_one_target should prevent them) and rows with several (reachable by +// merging drifted schemas or hand-repair SQL) are both left exactly as they are, +// for `bd doctor` to surface rather than for this to guess about. Guessing is +// what would be destructive now that a group can delete rows: truncating a +// multi-target row to its first non-null column could drop it as a "duplicate" +// and silently destroy the edge its other column recorded. +func (r depRow) mergeable() bool { return r.targetCount == 1 } + +// describe renders the row for a diagnostic, without inventing a target the row +// does not have. +func (r depRow) describe() string { + switch r.targetCount { + case 0: + return fmt.Sprintf("row %s (issue %s, no dependency target)", r.id, r.issueID) + case 1: + return fmt.Sprintf("row %s (issue %s -> %s)", r.id, r.issueID, r.target) + default: + return fmt.Sprintf("row %s (issue %s, %d dependency targets)", r.id, r.issueID, r.targetCount) + } +} + +type depRekey struct{ oldID, newID string } + +// depMerge records one duplicate collapse, for the log line that keeps the +// dropped row auditable. +type depMerge struct { + issueID, target string + survivor, loser depRow +} + +// depPlan is the fully validated statement plan for one edge table. deletes and +// updates are both in execution order, and executing them in that order is the +// only ordering that converges (see planDependencyRekey). +type depPlan struct { + table string + deletes []string + updates []depRekey + merges []depMerge +} + +func (p *depPlan) writes() bool { return len(p.deletes)+len(p.updates) > 0 } + +// execute applies an already-validated plan. Every statement is a final-state +// mutation, so a partially applied plan is benign: the rows it touched are +// already correct, the rest are untouched, and the next pass finishes the job. +// +// Deliberately not wrapped in a SQL transaction. DBConn is satisfied by pooled +// handles as well as pinned connections (lock.go and embeddeddolt/store.go feed +// it both), and BEGIN/COMMIT issued through ExecContext on a pooled handle can +// land on different sessions — which would silently drop the guarantee it was +// added for. Convergence, not atomicity, is what makes partial application safe +// here; chunking the deletes is what keeps the cost down. +func (p *depPlan) execute(ctx context.Context, db DBConn) (bool, error) { + for _, m := range p.merges { + log.Printf("schema: %s: merging duplicate edge %s -> %s: keeping row %s (type %q), dropping row %s (type %q)", + p.table, m.issueID, m.target, m.survivor.id, m.survivor.depType, m.loser.id, m.loser.depType) + } + for start := 0; start < len(p.deletes); start += depDeleteChunk { + end := start + depDeleteChunk + if end > len(p.deletes) { + end = len(p.deletes) + } + chunk := p.deletes[start:end] + args := make([]any, len(chunk)) + for i, id := range chunk { + args[i] = id + } + placeholders := strings.TrimSuffix(strings.Repeat("?,", len(chunk)), ",") + //nolint:gosec // G201: table is a hardcoded constant and the placeholders are generated, never user input. + if _, err := db.ExecContext(ctx, + fmt.Sprintf(`DELETE FROM %s WHERE id IN (%s)`, p.table, placeholders), args...); err != nil { + return true, fmt.Errorf("%s: drop duplicate edge rows: %w", p.table, err) + } + } + for _, u := range p.updates { + //nolint:gosec // G201: table is a hardcoded constant, never user input. + if _, err := db.ExecContext(ctx, fmt.Sprintf(`UPDATE %s SET id = ? WHERE id = ?`, p.table), + u.newID, u.oldID); err != nil { + return true, fmt.Errorf("%s: re-key id %s -> %s: %w", p.table, u.oldID, u.newID, err) + } + } + return p.writes(), nil +} + +// planDependencyTableRekey scans one edge table and returns its validated plan. +// It is read-only: nothing is written by planning, which is what lets both +// tables be planned before either is executed. table must be a hardcoded +// constant ("dependencies" or "wisp_dependencies"). +func planDependencyTableRekey(ctx context.Context, db DBConn, table string) (*depPlan, error) { // Skip cleanly if the table or its id column isn't present (e.g. an older or // partial schema where the surrogate key was never added): nothing to re-key. hasID, err := columnExists(ctx, db, table, "id") if err != nil { - return false, err + return nil, fmt.Errorf("%s: %w", table, err) } if !hasID { - return false, nil + return &depPlan{table: table}, nil } - - // The natural target is the single non-null of the three typed columns — - // exactly what depid keys on and what the uk_dep_* unique keys enforce. - //nolint:gosec // G201: table is a hardcoded constant, never user input. - rows, err := db.QueryContext(ctx, fmt.Sprintf( - `SELECT id, issue_id, COALESCE(depends_on_issue_id, depends_on_wisp_id, depends_on_external) FROM %s`, - table)) + rows, err := scanDependencyRows(ctx, db, table) if err != nil { - return false, err + return nil, fmt.Errorf("%s: %w", table, err) } - type rekey struct{ oldID, newID string } - var todo []rekey + return planDependencyRekey(table, rows) +} + +// scanDependencyRows reads every edge row with its typed target columns exposed +// rather than COALESCEd away: the merge needs to know which column held the +// target, not just the resolved value. Resolution order is unchanged — the first +// non-null in depTargetColumns is exactly what the old COALESCE returned. +func scanDependencyRows(ctx context.Context, db DBConn, table string) ([]depRow, error) { + //nolint:gosec // G201: table and the column list are hardcoded constants, never user input. + rows, err := db.QueryContext(ctx, fmt.Sprintf( + `SELECT id, issue_id, %s, type FROM %s`, strings.Join(depTargetColumns, ", "), table)) + if err != nil { + return nil, err + } + defer func() { _ = rows.Close() }() + + var out []depRow for rows.Next() { var id, issueID string - var target sql.NullString - if err := rows.Scan(&id, &issueID, &target); err != nil { - _ = rows.Close() - return false, err + var depType sql.NullString + targets := make([]sql.NullString, len(depTargetColumns)) + dest := []any{&id, &issueID} + for i := range targets { + dest = append(dest, &targets[i]) } - if !target.Valid { - // Malformed row with no target (ck_dep_one_target should prevent this); - // leave it untouched for `bd doctor` to surface rather than guessing. + dest = append(dest, &depType) + if err := rows.Scan(dest...); err != nil { + return nil, err + } + row := depRow{id: id, issueID: issueID, depType: depType.String, priority: len(depTargetColumns)} + for i, t := range targets { + if !t.Valid { + continue + } + row.targetCount++ + if row.targetCount == 1 { + row.target, row.priority = t.String, i + } + } + out = append(out, row) + } + if err := rows.Err(); err != nil { + return nil, err + } + return out, nil +} + +// planDependencyRekey turns the scanned table into an ordered, validated plan, +// or a DependencyRekeyConflictError if the table cannot be converged without +// guessing. It is a pure function of the scanned rows — group keys and +// statements are emitted in sorted order, never map-iteration order — so two +// clones with the same data produce the same plan and converge to byte-identical +// tables (#4259). +// +// Rows are grouped by their derived id. A group with more than one member is the +// same logical edge recorded in two or three typed columns, which is invalid +// state the per-column unique keys cannot catch. The merge keeps the +// highest-priority typed row (issue > wisp > external, mirroring the COALESCE +// order) and deletes the rest; the loser's type and audit columns go with it, +// since edge identity deliberately excludes them and the resolution has to be a +// pure function of table content. Nothing references dependencies.id, so +// dropping the row is referentially safe. +// +// Ordering has two rules, and both are load-bearing: +// +// - DELETEs run before UPDATEs, because a loser may currently hold exactly the +// id its survivor is moving to (that is what a half-re-keyed database looks +// like), and updating first would manufacture the very duplicate-primary-key +// abort this replaces. +// - UPDATEs run in topological order. A row can legitimately hold the id +// another row needs while itself needing to move — `bd rename A B` followed +// by `bd rename C A` produces exactly that chain — so the occupant is moved +// out of the way first rather than refused. Each id is wanted by at most one +// row and each row vacates at most one id, so the graph is a set of simple +// chains and rotations: chains are walked from their free end, and only a +// true rotation (no free id to move through) is refused. +func planDependencyRekey(table string, rows []depRow) (*depPlan, error) { + groups := make(map[string][]depRow) + byCurrentID := make(map[string]depRow, len(rows)) + for _, r := range rows { + byCurrentID[r.id] = r + if !r.mergeable() { + // Malformed row: not part of any edge group, but it still occupies a + // primary key, so it stays in byCurrentID for the squat check below. continue } - if want := depid.New(issueID, target.String); want != id { - todo = append(todo, rekey{oldID: id, newID: want}) - } - } - _ = rows.Close() - if err := rows.Err(); err != nil { - return false, err + want := depid.New(r.issueID, r.target) + groups[want] = append(groups[want], r) } - for _, r := range todo { - //nolint:gosec // G201: table is a hardcoded constant, never user input. - if _, err := db.ExecContext(ctx, fmt.Sprintf(`UPDATE %s SET id = ? WHERE id = ?`, table), - r.newID, r.oldID); err != nil { - return true, fmt.Errorf("re-key id %s -> %s: %w", r.oldID, r.newID, err) + wantIDs := make([]string, 0, len(groups)) + for want := range groups { + wantIDs = append(wantIDs, want) + } + sort.Strings(wantIDs) + + plan := &depPlan{table: table} + doomed := make(map[string]bool) + var candidates []depRekey + for _, want := range wantIDs { + group := groups[want] + // Highest-priority typed column survives. The id tiebreak is unreachable + // while the uk_dep_* unique keys hold (they forbid two rows with the same + // issue_id and the same typed target) but keeps the plan deterministic on + // a database that lost one. + sort.Slice(group, func(i, j int) bool { + if group[i].priority != group[j].priority { + return group[i].priority < group[j].priority + } + return group[i].id < group[j].id + }) + survivor := group[0] + for _, loser := range group[1:] { + doomed[loser.id] = true + plan.merges = append(plan.merges, depMerge{ + issueID: survivor.issueID, target: survivor.target, + survivor: survivor, loser: loser, + }) + } + if survivor.id != want { + candidates = append(candidates, depRekey{oldID: survivor.id, newID: want}) } } - return len(todo) > 0, nil + + // doomed is the single source of truth for what is being deleted; the + // statement list is derived from it so the two can never disagree. + plan.deletes = make([]string, 0, len(doomed)) + for id := range doomed { + plan.deletes = append(plan.deletes, id) + } + sort.Strings(plan.deletes) + + ordered, err := orderDependencyRekeys(table, candidates, byCurrentID, doomed) + if err != nil { + return nil, err + } + plan.updates = ordered + return plan, nil +} + +// orderDependencyRekeys sequences the re-key UPDATEs so each one runs only once +// the id it is moving to is free, or refuses when no such sequence exists. +// +// candidates arrives sorted by newID, which is what makes the emitted order a +// pure function of table content. Every id is wanted by at most one candidate +// (group keys are unique) and every candidate vacates at most one id (its row's +// current key is unique), so "must run before" is a graph of in- and out-degree +// at most one: disjoint chains and rotations. Walking each chain from its free +// end covers every reachable node; anything left over is a rotation. +func orderDependencyRekeys(table string, candidates []depRekey, byCurrentID map[string]depRow, doomed map[string]bool) ([]depRekey, error) { + byOldID := make(map[string]int, len(candidates)) + for i, c := range candidates { + byOldID[c.oldID] = i + } + + const none = -1 + blockedBy := make([]int, len(candidates)) + unblocks := make([]int, len(candidates)) + for i := range candidates { + blockedBy[i], unblocks[i] = none, none + } + for i, c := range candidates { + occupant, held := byCurrentID[c.newID] + if !held || doomed[occupant.id] { + continue // the id is free, or a DELETE frees it first + } + vacating, planned := byOldID[occupant.id] + if !planned { + // The occupant is staying exactly where it is, so the id will never + // be free. A converged row cannot land here — it would derive the + // same id and therefore be in the same group — so the occupant is a + // malformed row squatting on another edge's key: corruption, not a + // duplicate this can merge. + return nil, &DependencyRekeyConflictError{ + Table: table, + Detail: fmt.Sprintf("cannot re-key %s to %s: that id is already held by %s, which is neither a duplicate of it nor moving", + byCurrentID[c.oldID].describe(), c.newID, occupant.describe()), + } + } + blockedBy[i] = vacating + unblocks[vacating] = i + } + + ordered := make([]depRekey, 0, len(candidates)) + emitted := make([]bool, len(candidates)) + for i := range candidates { + if blockedBy[i] != none { + continue // not the head of a chain + } + for j := i; j != none && !emitted[j]; j = unblocks[j] { + emitted[j] = true + ordered = append(ordered, candidates[j]) + } + } + if len(ordered) != len(candidates) { + var stuck []string + for i, done := range emitted { + if !done { + stuck = append(stuck, byCurrentID[candidates[i].oldID].describe()) + } + } + sort.Strings(stuck) + return nil, &DependencyRekeyConflictError{ + Table: table, + Detail: "cannot re-key a cycle of rows that each hold the id another one needs, with no free id to move through: " + + strings.Join(stuck, "; "), + } + } + return ordered, nil } // columnExists reports whether table.column is present in the current schema. diff --git a/internal/storage/schema/dep_id_backfill_test.go b/internal/storage/schema/dep_id_backfill_test.go index 0b2729329..1faebc279 100644 --- a/internal/storage/schema/dep_id_backfill_test.go +++ b/internal/storage/schema/dep_id_backfill_test.go @@ -2,100 +2,579 @@ package schema import ( "context" + "database/sql/driver" + "errors" + "fmt" "regexp" + "slices" + "strings" "testing" "github.com/DATA-DOG/go-sqlmock" "github.com/steveyegge/beads/internal/storage/depid" ) -// TestRekeyDependencyTableRewritesOnlyDivergentRows verifies the backfill that -// converges existing rows after the #4259 fix: it re-keys a row whose id is not -// the deterministic value, and leaves an already-deterministic row untouched. -func TestRekeyDependencyTableRewritesOnlyDivergentRows(t *testing.T) { +// The re-key scan reads the typed target columns rather than COALESCEing them, +// because the duplicate-edge merge has to know which column held the target and +// which type it would discard (gastownhall/beads#5268). +const depScanPattern = `SELECT id, issue_id, depends_on_issue_id, depends_on_wisp_id, depends_on_external, type FROM ` + +func depScanRows() *sqlmock.Rows { + return sqlmock.NewRows([]string{"id", "issue_id", "depends_on_issue_id", "depends_on_wisp_id", "depends_on_external", "type"}) +} + +// expectDepScan primes the id-column probe (expectColumnExists, shared with +// lock_test.go's under-lock statement sequence) and the table scan. mock is in +// sqlmock's default ordered mode, so the Exec expectations each test adds after +// this also pin the statement ORDER — which is load-bearing here: a DELETE that +// runs after its UPDATE re-creates the duplicate-primary-key abort, and an +// UPDATE that runs before the update vacating its target id does the same. +func expectDepScan(mock sqlmock.Sqlmock, table string, rows *sqlmock.Rows) { + expectColumnExists(mock, true) + mock.ExpectQuery(regexp.QuoteMeta(depScanPattern + table)).WillReturnRows(rows) +} + +func expectDepDelete(mock sqlmock.Sqlmock, table string, ids ...string) { + args := make([]driver.Value, 0, len(ids)) + for _, id := range ids { + args = append(args, id) + } + placeholders := strings.TrimSuffix(strings.Repeat("?,", len(ids)), ",") + mock.ExpectExec(regexp.QuoteMeta(fmt.Sprintf("DELETE FROM %s WHERE id IN (%s)", table, placeholders))). + WithArgs(args...). + WillReturnResult(sqlmock.NewResult(0, int64(len(ids)))) +} + +func expectDepUpdate(mock sqlmock.Sqlmock, table, newID, oldID string) { + mock.ExpectExec(regexp.QuoteMeta(fmt.Sprintf("UPDATE %s SET id = ? WHERE id = ?", table))). + WithArgs(newID, oldID). + WillReturnResult(sqlmock.NewResult(0, 1)) +} + +// rekeyOneTable plans and executes a single table, the shape most of these tests +// exercise. Production code always plans BOTH tables before executing either +// (TestRekeyDependencyIDsPlansBothTablesBeforeWriting covers that). +func rekeyOneTable(db DBConn, table string) (bool, error) { + plan, err := planDependencyTableRekey(context.Background(), db, table) + if err != nil { + return false, err + } + return plan.execute(context.Background(), db) +} + +func newDepMock(t *testing.T) (DBConn, sqlmock.Sqlmock) { + t.Helper() db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) } - defer db.Close() + t.Cleanup(func() { _ = db.Close() }) + t.Cleanup(func() { + if err := mock.ExpectationsWereMet(); err != nil { + t.Errorf("unmet sql expectations: %v", err) + } + }) + return db, mock +} - // id column present. - mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.COLUMNS`). - WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(1)) +// --- statement-shape tests ------------------------------------------------- + +// TestRekeyDependencyTableRewritesOnlyDivergentRows verifies the backfill that +// converges existing rows after the #4259 fix: it re-keys a row whose id is not +// the deterministic value, and leaves an already-deterministic row untouched. +func TestRekeyDependencyTableRewritesOnlyDivergentRows(t *testing.T) { + db, mock := newDepMock(t) - // Two rows: one carrying a legacy random id, one already deterministic. randomRow := "random-uuid-aaaa" deterministicRow := depid.New("c", "d") - mock.ExpectQuery(`SELECT id, issue_id, COALESCE\(.*\) FROM dependencies`). - WillReturnRows(sqlmock.NewRows([]string{"id", "issue_id", "target"}). - AddRow(randomRow, "a", "b"). - AddRow(deterministicRow, "c", "d")) + expectDepScan(mock, "dependencies", depScanRows(). + AddRow(randomRow, "a", "b", nil, nil, "blocks"). + AddRow(deterministicRow, "c", "d", nil, nil, "blocks")) + expectDepUpdate(mock, "dependencies", depid.New("a", "b"), randomRow) - // Only the divergent row is re-keyed, to its deterministic value. - mock.ExpectExec(regexp.QuoteMeta("UPDATE dependencies SET id = ? WHERE id = ?")). - WithArgs(depid.New("a", "b"), randomRow). - WillReturnResult(sqlmock.NewResult(0, 1)) - - wrote, err := rekeyDependencyTable(context.Background(), db, "dependencies") + wrote, err := rekeyOneTable(db, "dependencies") if err != nil { - t.Fatalf("rekeyDependencyTable: %v", err) + t.Fatalf("rekey: %v", err) } if !wrote { t.Error("expected wrote=true when a row was re-keyed") } - if err := mock.ExpectationsWereMet(); err != nil { - t.Fatalf("unmet sql expectations: %v", err) - } } // TestRekeyDependencyTableSkipsMissingTable verifies the backfill no-ops cleanly // when the table/id column is absent (older or partial schema). func TestRekeyDependencyTableSkipsMissingTable(t *testing.T) { - db, mock, err := sqlmock.New() - if err != nil { - t.Fatalf("sqlmock.New: %v", err) - } - defer db.Close() + db, mock := newDepMock(t) + expectColumnExists(mock, false) - mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.COLUMNS`). - WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) - - wrote, err := rekeyDependencyTable(context.Background(), db, "dependencies") + wrote, err := rekeyOneTable(db, "dependencies") if err != nil { - t.Fatalf("rekeyDependencyTable: %v", err) + t.Fatalf("rekey: %v", err) } if wrote { t.Error("expected wrote=false when the id column is absent") } - if err := mock.ExpectationsWereMet(); err != nil { - t.Fatalf("unmet sql expectations: %v", err) - } } // TestRekeyDependencyTableIdempotent verifies that when every row already carries -// its deterministic id, no UPDATE is issued (so re-running is a cheap no-op). +// its deterministic id, no statement is issued at all. func TestRekeyDependencyTableIdempotent(t *testing.T) { - db, mock, err := sqlmock.New() - if err != nil { - t.Fatalf("sqlmock.New: %v", err) - } - defer db.Close() + db, mock := newDepMock(t) + expectDepScan(mock, "dependencies", depScanRows(). + AddRow(depid.New("a", "b"), "a", "b", nil, nil, "blocks"). + AddRow(depid.New("a", "external:e1"), "a", nil, nil, "external:e1", "related"). + AddRow(depid.New("b", "w1"), "b", nil, "w1", nil, "blocks")) + // No ExpectExec: zero writes expected. - mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.COLUMNS`). - WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(1)) - mock.ExpectQuery(`SELECT id, issue_id, COALESCE\(.*\) FROM dependencies`). - WillReturnRows(sqlmock.NewRows([]string{"id", "issue_id", "target"}). - AddRow(depid.New("a", "b"), "a", "b")) - // No ExpectExec: zero UPDATEs expected. - - wrote, err := rekeyDependencyTable(context.Background(), db, "dependencies") + wrote, err := rekeyOneTable(db, "dependencies") if err != nil { - t.Fatalf("rekeyDependencyTable: %v", err) + t.Fatalf("rekey: %v", err) } if wrote { - t.Error("expected wrote=false when all rows already deterministic") + t.Error("expected wrote=false on a converged table") } - if err := mock.ExpectationsWereMet(); err != nil { - t.Fatalf("unmet sql expectations: %v", err) +} + +// TestRekeyDependencyTableMergesFreshDuplicatePair is the reported abort in its +// simplest form: the same logical edge recorded once as an issue ref and once as +// an external ref, both still carrying random ids. Both derive the same +// deterministic id, which is what made the old row-at-a-time rewrite die on the +// second UPDATE. +func TestRekeyDependencyTableMergesFreshDuplicatePair(t *testing.T) { + db, mock := newDepMock(t) + expectDepScan(mock, "dependencies", depScanRows(). + AddRow("random-issue-row", "hq-cv-vvnmq", "ops-w05", nil, nil, "blocks"). + AddRow("random-external-row", "hq-cv-vvnmq", nil, nil, "ops-w05", "blocks")) + expectDepDelete(mock, "dependencies", "random-external-row") + expectDepUpdate(mock, "dependencies", depid.New("hq-cv-vvnmq", "ops-w05"), "random-issue-row") + + wrote, err := rekeyOneTable(db, "dependencies") + if err != nil { + t.Fatalf("rekey: %v", err) + } + if !wrote { + t.Error("expected wrote=true when a duplicate pair was merged") + } +} + +// TestRekeyDependencyTableMergesHalfRekeyedPairLoserHoldsID covers the database +// a pre-1.3.0 binary left half-re-keyed with the LOSER moved first: the external +// twin already sits on the deterministic id and the surviving issue row does not. +// The twin still loses — the survivor rule is the typed column, not who got +// there first — so the DELETE has to run before the UPDATE that reclaims the id. +func TestRekeyDependencyTableMergesHalfRekeyedPairLoserHoldsID(t *testing.T) { + db, mock := newDepMock(t) + want := depid.New("a", "t") + expectDepScan(mock, "dependencies", depScanRows(). + AddRow("random-issue-row", "a", "t", nil, nil, "blocks"). + AddRow(want, "a", nil, nil, "t", "blocks")) + expectDepDelete(mock, "dependencies", want) + expectDepUpdate(mock, "dependencies", want, "random-issue-row") + + if _, err := rekeyOneTable(db, "dependencies"); err != nil { + t.Fatalf("rekey: %v", err) + } +} + +// TestRekeyDependencyTableMergesTripleDuplicate exercises the full survivor +// priority and the delete chunking: the same target in all three typed columns +// collapses to the issue ref with both losers dropped in ONE statement. +func TestRekeyDependencyTableMergesTripleDuplicate(t *testing.T) { + db, mock := newDepMock(t) + expectDepScan(mock, "dependencies", depScanRows(). + AddRow("row-issue", "a", "t", nil, nil, "blocks"). + AddRow("row-wisp", "a", nil, "t", nil, "blocks"). + AddRow("row-external", "a", nil, nil, "t", "blocks")) + expectDepDelete(mock, "dependencies", "row-external", "row-wisp") + expectDepUpdate(mock, "dependencies", depid.New("a", "t"), "row-issue") + + if _, err := rekeyOneTable(db, "dependencies"); err != nil { + t.Fatalf("rekey: %v", err) + } +} + +// TestRekeyDependencyTableChunksDeletes pins that a large merge does not issue +// one working-set flush per row: the victims of #5268 are exactly the databases +// with thousands of divergent rows, and this pass runs at open. +func TestRekeyDependencyTableChunksDeletes(t *testing.T) { + db, mock := newDepMock(t) + + rows := depScanRows() + var losers []string + for i := 0; i < depDeleteChunk+5; i++ { + issue := fmt.Sprintf("i%03d", i) + // Each pair is one logical edge duplicated across two typed columns, so + // each contributes exactly one loser and one already-correct survivor. + rows.AddRow(depid.New(issue, "t"), issue, "t", nil, nil, "blocks") + loser := fmt.Sprintf("loser-%03d", i) + rows.AddRow(loser, issue, nil, nil, "t", "blocks") + losers = append(losers, loser) + } + expectDepScan(mock, "dependencies", rows) + slices.Sort(losers) + expectDepDelete(mock, "dependencies", losers[:depDeleteChunk]...) + expectDepDelete(mock, "dependencies", losers[depDeleteChunk:]...) + + if _, err := rekeyOneTable(db, "dependencies"); err != nil { + t.Fatalf("rekey: %v", err) + } +} + +// TestRekeyDependencyTableRefusalWithPendingDeletesWritesNothing is the +// all-or-nothing contract at its only interesting point: a table that holds BOTH +// a mergeable duplicate (so the plan has deletes) and an unresolvable squat. A +// pass that validated after deleting would drop rows and then abort. +func TestRekeyDependencyTableRefusalWithPendingDeletesWritesNothing(t *testing.T) { + db, mock := newDepMock(t) + expectDepScan(mock, "dependencies", depScanRows(). + // A mergeable duplicate pair: contributes a DELETE and an UPDATE. + AddRow("dup-issue", "a", "t", nil, nil, "blocks"). + AddRow("dup-external", "a", nil, nil, "t", "blocks"). + // A malformed row squatting on the id that b -> u must move to. + AddRow("rand-b", "b", "u", nil, nil, "blocks"). + AddRow(depid.New("b", "u"), "squatter", nil, nil, nil, "blocks")) + // No ExpectExec at all: validation runs before the first statement. + + wrote, err := rekeyOneTable(db, "dependencies") + if err == nil { + t.Fatal("expected a refusal when a malformed row squats a planned id") + } + if wrote { + t.Error("expected wrote=false when the plan was rejected before any write") + } +} + +// TestRekeyDependencyIDsPlansBothTablesBeforeWriting pins the cross-table +// contract: a refusal on wisp_dependencies must not leave the synced +// dependencies table already rewritten, because those writes would sit +// uncommitted (the pass aborts before MigrateUp's DOLT_COMMIT) and the recovery +// pass would classify them as pre-existing dirty and skip them again. +func TestRekeyDependencyIDsPlansBothTablesBeforeWriting(t *testing.T) { + db, mock := newDepMock(t) + expectDepScan(mock, "dependencies", depScanRows(). + AddRow("random-row", "a", "t", nil, nil, "blocks")) + expectDepScan(mock, "wisp_dependencies", depScanRows(). + AddRow("rand-b", "b", "u", nil, nil, "blocks"). + AddRow(depid.New("b", "u"), "squatter", nil, nil, nil, "blocks")) + // No ExpectExec: the dependencies plan is valid but must not execute. + + wrote, err := rekeyDependencyIDs(context.Background(), db, nil) + if err == nil { + t.Fatal("expected the wisp_dependencies refusal to abort the pass") + } + if wrote { + t.Error("expected wrote=false: no table may be written when either plan is refused") + } + var conflict *DependencyRekeyConflictError + if !errors.As(err, &conflict) { + t.Fatalf("error %v is not a *DependencyRekeyConflictError", err) + } + if conflict.Table != "wisp_dependencies" { + t.Errorf("conflict.Table = %q, want wisp_dependencies", conflict.Table) + } +} + +// TestRekeyDependencyIDsRefusesToWriteIntoDirtyTable covers the marker-vs-guard +// hazard: MigrateUp's changed-signature guard runs AFTER ignoredSource.migrate +// has durably recorded the 0026 marker, so a re-key that wrote into a +// pre-existing dirty table would fail the open once and never retry, leaving the +// heal to ride an unrelated user commit. Refusing at plan time keeps the pass +// write-free and retryable, and DirtyTablesError is the type whose documented +// recovery (bd dolt commit) already covers it. +func TestRekeyDependencyIDsRefusesToWriteIntoDirtyTable(t *testing.T) { + db, mock := newDepMock(t) + expectDepScan(mock, "dependencies", depScanRows(). + AddRow("random-row", "a", "t", nil, nil, "blocks")) + expectDepScan(mock, "wisp_dependencies", depScanRows()) + // No ExpectExec: the plan is valid but must not execute. + + dirty := map[string]dirtyTableState{"dependencies": {}} + wrote, err := rekeyDependencyIDs(context.Background(), db, dirty) + if err == nil { + t.Fatal("expected a refusal when the re-key would write into a dirty table") + } + if wrote { + t.Error("expected wrote=false") + } + var dirtyErr *DirtyTablesError + if !errors.As(err, &dirtyErr) { + t.Fatalf("error %v is not a *DirtyTablesError", err) + } + if !slices.Equal(dirtyErr.Tables, []string{"dependencies"}) { + t.Errorf("dirtyErr.Tables = %v, want [dependencies]", dirtyErr.Tables) + } +} + +// TestRekeyDependencyIDsIgnoresDirtyTableWithNothingToDo keeps the refusal +// scoped to passes that actually write: a converged clone whose dependencies +// table happens to be dirty must still open. +func TestRekeyDependencyIDsIgnoresDirtyTableWithNothingToDo(t *testing.T) { + db, mock := newDepMock(t) + expectDepScan(mock, "dependencies", depScanRows(). + AddRow(depid.New("a", "t"), "a", "t", nil, nil, "blocks")) + expectDepScan(mock, "wisp_dependencies", depScanRows()) + + wrote, err := rekeyDependencyIDs(context.Background(), db, map[string]dirtyTableState{"dependencies": {}}) + if err != nil { + t.Fatalf("rekeyDependencyIDs: %v", err) + } + if wrote { + t.Error("expected wrote=false") + } +} + +// --- planner tests --------------------------------------------------------- + +func depIssueRow(id, issueID, target string) depRow { + return depRow{id: id, issueID: issueID, target: target, depType: "blocks", targetCount: 1, priority: 0} +} + +func depWispRow(id, issueID, target string) depRow { + return depRow{id: id, issueID: issueID, target: target, depType: "blocks", targetCount: 1, priority: 1} +} + +func depExternalRow(id, issueID, target string) depRow { + return depRow{id: id, issueID: issueID, target: target, depType: "blocks", targetCount: 1, priority: 2} +} + +func mustPlan(t *testing.T, rows []depRow) *depPlan { + t.Helper() + plan, err := planDependencyRekey("dependencies", rows) + if err != nil { + t.Fatalf("planDependencyRekey: %v", err) + } + return plan +} + +func planUpdatePairs(plan *depPlan) [][2]string { + out := make([][2]string, 0, len(plan.updates)) + for _, u := range plan.updates { + out = append(out, [2]string{u.oldID, u.newID}) + } + return out +} + +// TestPlanDependencyRekeyOrdersRenameChain is the workflow the refusal used to +// brick, reproduced at the planner: `bd rename A B` leaves the edge's id derived +// from A while its target column already reads B (the FK cascade beat the +// rewrite), and a later `bd rename C A` puts a second row on the id the first one +// needs. Neither row is corrupt and the state is mechanically convergible — +// vacate the first, then move the second. +func TestPlanDependencyRekeyOrdersRenameChain(t *testing.T) { + staleAfterFirstRename := depid.New("src", "A") + rows := []depRow{ + // Renamed A -> B: id still derived from A, target column already B. + depIssueRow(staleAfterFirstRename, "src", "B"), + // Renamed C -> A: id still derived from C, target column already A. + depIssueRow(depid.New("src", "C"), "src", "A"), + } + plan := mustPlan(t, rows) + + if len(plan.deletes) != 0 { + t.Errorf("deletes = %v, want none: neither row is a duplicate", plan.deletes) + } + want := [][2]string{ + {staleAfterFirstRename, depid.New("src", "B")}, + {depid.New("src", "C"), depid.New("src", "A")}, + } + if got := planUpdatePairs(plan); !slices.Equal(got, want) { + t.Fatalf("updates = %v, want %v (the occupant must vacate first)", got, want) + } +} + +// TestPlanDependencyRekeyOrdersLongerChain keeps the ordering honest beyond the +// two-row case: a three-link chain must come out head-first, not in the sorted +// order the candidates were built in. +func TestPlanDependencyRekeyOrdersLongerChain(t *testing.T) { + // c holds b's wanted id, b holds a's wanted id, a's wanted id is free. + idA, idB, idC := depid.New("s", "a"), depid.New("s", "b"), depid.New("s", "c") + rows := []depRow{ + depIssueRow(idC, "s", "b"), // wants idB, currently holds idC + depIssueRow(idB, "s", "a"), // wants idA, currently holds idB + depIssueRow("free-random", "s", "c"), + } + plan := mustPlan(t, rows) + + want := [][2]string{ + {idB, idA}, // idA is free + {idC, idB}, // now idB is free + {"free-random", idC}, // now idC is free + } + if got := planUpdatePairs(plan); !slices.Equal(got, want) { + t.Fatalf("updates = %v, want %v", got, want) + } +} + +// TestPlanDependencyRekeyRefusesCycle is the one ordering that has no solution +// without a temporary id: two rows each holding exactly the id the other needs. +func TestPlanDependencyRekeyRefusesCycle(t *testing.T) { + idA, idB := depid.New("s", "a"), depid.New("s", "b") + rows := []depRow{ + depIssueRow(idA, "s", "b"), + depIssueRow(idB, "s", "a"), + } + _, err := planDependencyRekey("dependencies", rows) + if err == nil { + t.Fatal("expected a refusal for a rotation with no free id") + } + var conflict *DependencyRekeyConflictError + if !errors.As(err, &conflict) { + t.Fatalf("error %v is not a *DependencyRekeyConflictError", err) + } + for _, want := range []string{"cycle", idA, idB, "bd doctor"} { + if !strings.Contains(err.Error(), want) { + t.Errorf("error %q does not mention %q", err, want) + } + } +} + +// TestPlanDependencyRekeyRefusesMalformedSquatter pins the one refusal that +// survives the chain ordering. A converged row can never squat another edge's id +// (it would derive the same id and join that group), so the only squatters left +// are malformed rows — and the diagnostic must say so rather than render a +// dangling "issue x -> ". +func TestPlanDependencyRekeyRefusesMalformedSquatter(t *testing.T) { + squatted := depid.New("a", "t") + rows := []depRow{ + depIssueRow("random-row", "a", "t"), + {id: squatted, issueID: "orphan", depType: "blocks", targetCount: 0, priority: 3}, + } + _, err := planDependencyRekey("dependencies", rows) + if err == nil { + t.Fatal("expected a refusal when a malformed row squats a planned id") + } + for _, want := range []string{"random-row", squatted, "no dependency target", "bd doctor"} { + if !strings.Contains(err.Error(), want) { + t.Errorf("error %q does not mention %q", err, want) + } + } + if strings.Contains(err.Error(), "dependencies: dependencies:") { + t.Errorf("error %q double-stamps the table name", err) + } + if strings.Contains(err.Error(), "-> )") { + t.Errorf("error %q renders a dangling target arrow", err) + } +} + +// TestPlanDependencyRekeyLeavesMalformedRows keeps the "surface, don't guess" +// contract symmetric. A row with no target was always skipped; a row with +// SEVERAL non-null targets (reachable by merging drifted schemas or hand-repair +// SQL) must be skipped too, because truncating it to its first non-null column +// could now group it as a duplicate and DELETE it, silently destroying the edge +// its other column recorded. +func TestPlanDependencyRekeyLeavesMalformedRows(t *testing.T) { + rows := []depRow{ + {id: "no-target", issueID: "a", depType: "blocks", targetCount: 0, priority: 3}, + {id: "multi-target", issueID: "a", target: "t", depType: "blocks", targetCount: 2, priority: 0}, + // A well-formed row on the same (issue, first-non-null target) as the + // multi-target row. Without the carve-out the multi-target row joins this + // group and loses on priority, and its second target is destroyed. + depIssueRow(depid.New("a", "t"), "a", "t"), + } + plan := mustPlan(t, rows) + + if len(plan.deletes) != 0 { + t.Errorf("deletes = %v, want none", plan.deletes) + } + if len(plan.updates) != 0 { + t.Errorf("updates = %v, want none", planUpdatePairs(plan)) + } +} + +// TestPlanDependencyRekeyRecordsMergedLosers pins the audit trail for the one +// thing the merge destroys. The twins can legitimately carry different types — +// each insert wrote its own caller's — and type drives readiness, so a dropped +// row has to be nameable after the fact. +func TestPlanDependencyRekeyRecordsMergedLosers(t *testing.T) { + survivor := depIssueRow("issue-row", "a", "t") + survivor.depType = "related" + loser := depExternalRow("external-row", "a", "t") + loser.depType = "blocks" + plan := mustPlan(t, []depRow{survivor, loser}) + + if len(plan.merges) != 1 { + t.Fatalf("merges = %v, want exactly one", plan.merges) + } + m := plan.merges[0] + if m.survivor.id != "issue-row" || m.survivor.depType != "related" { + t.Errorf("survivor = %+v, want the issue-ref row keeping its own type", m.survivor) + } + if m.loser.id != "external-row" || m.loser.depType != "blocks" { + t.Errorf("loser = %+v, want the external row with its dropped type", m.loser) + } + if m.issueID != "a" || m.target != "t" { + t.Errorf("merge edge = %s -> %s, want a -> t", m.issueID, m.target) + } +} + +// TestPlanDependencyRekeySurvivorPriority states the merge rule directly, across +// every pairing, so a reordering of depTargetColumns cannot silently change +// which row survives. +func TestPlanDependencyRekeySurvivorPriority(t *testing.T) { + for _, tc := range []struct { + name string + rows []depRow + wantSurvivor string + wantDeletes []string + }{ + { + name: "issue beats wisp", + rows: []depRow{depWispRow("w", "a", "t"), depIssueRow("i", "a", "t")}, + wantSurvivor: "i", + wantDeletes: []string{"w"}, + }, + { + name: "issue beats external", + rows: []depRow{depExternalRow("e", "a", "t"), depIssueRow("i", "a", "t")}, + wantSurvivor: "i", + wantDeletes: []string{"e"}, + }, + { + name: "wisp beats external", + rows: []depRow{depExternalRow("e", "a", "t"), depWispRow("w", "a", "t")}, + wantSurvivor: "w", + wantDeletes: []string{"e"}, + }, + { + name: "issue beats both", + rows: []depRow{depExternalRow("e", "a", "t"), depWispRow("w", "a", "t"), depIssueRow("i", "a", "t")}, + wantSurvivor: "i", + wantDeletes: []string{"e", "w"}, + }, + } { + t.Run(tc.name, func(t *testing.T) { + plan := mustPlan(t, tc.rows) + if !slices.Equal(plan.deletes, tc.wantDeletes) { + t.Errorf("deletes = %v, want %v", plan.deletes, tc.wantDeletes) + } + want := [][2]string{{tc.wantSurvivor, depid.New("a", "t")}} + if got := planUpdatePairs(plan); !slices.Equal(got, want) { + t.Errorf("updates = %v, want %v", got, want) + } + }) + } +} + +// TestPlanDependencyRekeyIsOrderIndependent is the #4259 contract: the plan must +// be a pure function of table CONTENT, never of scan order, or two clones diverge. +func TestPlanDependencyRekeyIsOrderIndependent(t *testing.T) { + rows := []depRow{ + depIssueRow("r1", "a", "t"), + depExternalRow("r2", "a", "t"), + depWispRow("r3", "b", "w1"), + depIssueRow(depid.New("c", "d"), "c", "d"), + depIssueRow(depid.New("s", "a"), "s", "b"), + depIssueRow(depid.New("s", "c"), "s", "a"), + } + want := mustPlan(t, rows) + reversed := slices.Clone(rows) + slices.Reverse(reversed) + got := mustPlan(t, reversed) + + if !slices.Equal(got.deletes, want.deletes) { + t.Errorf("deletes = %v, want %v", got.deletes, want.deletes) + } + if !slices.Equal(planUpdatePairs(got), planUpdatePairs(want)) { + t.Errorf("updates = %v, want %v", planUpdatePairs(got), planUpdatePairs(want)) } } diff --git a/internal/storage/schema/dirty_tables_error.go b/internal/storage/schema/dirty_tables_error.go index b45431521..80ce173c3 100644 --- a/internal/storage/schema/dirty_tables_error.go +++ b/internal/storage/schema/dirty_tables_error.go @@ -14,10 +14,12 @@ import "strings" // run cleanly. But those commit commands also open the store, and an open // runs MigrateUp - hitting this same guard before the commit that would // clear the dirty state ever gets a chance to run (gastownhall/beads#4566). -// To break that deadlock, working-set-reconcile opens (embeddeddolt. -// OpenForWorkingSetReconcile) detect this error type at open time via -// errors.As and skip the migration instead of failing the open, so the -// commit can proceed and clear the working set. +// To break that deadlock, working-set-reconcile opens detect this error type +// at open time via errors.As and skip the migration instead of failing the +// open, so the commit can proceed and clear the working set. Both storage +// modes do this — embeddeddolt.OpenForWorkingSetReconcile and server mode's +// dolt.Config.LenientOpen — so the recovery this message names is reachable +// wherever the guard fires. type DirtyTablesError struct { Tables []string } diff --git a/internal/storage/schema/ignored_cursor_untrack.go b/internal/storage/schema/ignored_cursor_untrack.go new file mode 100644 index 000000000..4b4d9d725 --- /dev/null +++ b/internal/storage/schema/ignored_cursor_untrack.go @@ -0,0 +1,523 @@ +package schema + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/steveyegge/beads/internal/debug" + "github.com/steveyegge/beads/internal/storage/dberrors" +) + +// The ignored-lane migration cursor is dolt_ignore'd on every database this +// binary opens, but dolt_ignore only exempts tables that have never been +// committed: like git's .gitignore, an ignore entry has no effect on a path +// that is already tracked. On lineages old enough to predate the pattern the +// cursor table WAS committed, and nothing in bd can ever clean it again — +// every staging path anti-joins dolt_ignore, so each migration pass re-dirties +// a tracked table that no commit will ever pick up. Dolt's merge preflight +// refuses to start while a tracked table is dirty, so those databases push +// fine and every single `bd dolt pull` dies with +// +// Error 1105: cannot merge with uncommitted changes +// +// permanently (gastownhall/beads#4356; confirmed on two fleets, 24 and 17 +// databases). +// +// The only way to make dolt_ignore effective again is to turn the table's +// presence back into an ADD delta: commit a deletion of the table into HEAD, +// then recreate it in the working set. That is exactly what migration +// 0062_events_dolt_ignore did for `events`, down to the transaction-pinning +// and force-staging quirks; this file is that same operation for the cursor +// table, in Go and re-entrant. +// +// It is deliberately NOT a numbered migration. A one-shot migration runs only +// while the main cursor is behind, and the affected databases are at-latest +// (their dirt is residue of a COMPLETED pass). Worse, a pull that merges a +// not-yet-healed peer's commits re-introduces the tracked table afterwards, +// and a spent migration never re-runs — the multi-machine fleets that are the +// entire affected population would re-wedge permanently. Re-probing at every +// writable open is what makes the heal converge instead of expire. +const ( + // ignoredCursorUntrackTempTable holds the cursor rows across the drop. + // Dolt persists the working set to disk, so an uncommitted scratch table + // survives a crash: whatever phase is interrupted, the next open finds + // the rows and finishes the job. The name is deliberately not matched by + // any dolt_ignore pattern — a straggler must show up in dolt_status + // rather than hide. + ignoredCursorUntrackTempTable = "__temp__ignored_schema_migrations_untrack" + + ignoredCursorUntrackCommitMessage = "schema: untrack legacy ignored_schema_migrations so dolt_ignore can apply (gastownhall/beads#4356)" + + ignoredCursorTempSweepCommitMessage = "schema: drop stray ignored_schema_migrations untrack scratch table (gastownhall/beads#4356)" +) + +// ignoredCursorScratch exists so the scratch table's DDL is generated by the +// SAME bootstrapSQL that builds the real cursor table. The shape has already +// drifted once out of band (#4259 added content_hash); a hand-copied CREATE +// would silently stop carrying the next column, and this table is the only +// copy of the cursor while the repair runs. +var ignoredCursorScratch = migrationSource{cursorTable: ignoredCursorUntrackTempTable} + +// ignoredCursorAdvisory reports a reconcile step that declined without +// changing anything. Overridable in tests: the whole point of the advisory +// path is that it is invisible in production, which is exactly how a missing +// sqlmock expectation used to pass as a healthy run. +var ignoredCursorAdvisory = func(format string, args ...any) { + debug.Logf(format, args...) +} + +// ignoredCursorState is the reconcile's read-only gate. Both callers evaluate +// it — MigrateUp to decide what to do, alreadyConverged to decide whether the +// locked path has anything to do at all. Keeping it one function is not +// tidiness: a term present here but forgotten in alreadyConverged is silently +// unreachable in server mode, because that fast path short-circuits before +// MigrateUp ever runs. +type ignoredCursorState struct { + // needsUntrack: the legacy shape — cursor table committed at HEAD while + // dolt_ignore genuinely covers it. + needsUntrack bool + // strayScratch: a scratch table survives from an interrupted repair. + // Left alone it is eventually committed into HEAD by an unrelated + // auto-commit and replicated fleet-wide, and it keeps the resurrection + // hazard armed (see resumeIgnoredCursorUntrack). + strayScratch bool +} + +func (s ignoredCursorState) reconcileNeeded() bool { + return s.needsUntrack || s.strayScratch +} + +// readIgnoredCursorState answers both halves of the gate in two +// always-succeeding reads. That property is not incidental: a Dolt session +// that issues a FAILING statement stays pinned to its pre-statement catalog +// snapshot for the rest of its pooled life (be-bv7x), and this runs on every +// writable open and every lock-free fast-path evaluation. +// +// qualifier is the identifier-quoted database name selectTargetDatabase +// returned, or empty when the session is already on the target database. The +// scratch probe needs no qualifier: it reads information_schema against +// DATABASE(), which both callers have already put on the target. +func readIgnoredCursorState(ctx context.Context, db DBConn, qualifier string) (ignoredCursorState, error) { + var state ignoredCursorState + + needsUntrack, err := ignoredCursorNeedsUntrack(ctx, db, qualifier) + if err != nil { + return state, err + } + state.needsUntrack = needsUntrack + + stray, err := schemaTableExists(ctx, db, ignoredCursorUntrackTempTable) + if err != nil { + return state, fmt.Errorf("probing %s: %w", ignoredCursorUntrackTempTable, err) + } + state.strayScratch = stray + return state, nil +} + +// healTrackedIgnoredCursorTable untracks a legacy tracked-at-HEAD +// ignored_schema_migrations table and restores its rows, reporting whether it +// changed anything. It runs on every writable open and costs two reads on a +// healthy database. +// +// Failure policy, straight from the #5816 lesson that a heal must never mint a +// new class of un-openable database: everything up to and including the +// unstage sweep is advisory — a read that fails, a fenced client with no DDL +// or DOLT_RESET grant, a database an operator deliberately opted out of — and +// degrades to "log it and carry on", leaving the caller exactly as well off as +// it was before this function existed (open works, reads/writes/push work, +// pull stays wedged until some privileged open heals it). From the DROP onward +// a failure is returned: the pass must not continue without a cursor table, +// and every intermediate state that can persist is one the next open resumes +// from. +func healTrackedIgnoredCursorTable(ctx context.Context, db DBConn) (bool, error) { + state, err := readIgnoredCursorState(ctx, db, "") + if err != nil { + ignoredCursorAdvisory("schema: cannot read the %s reconcile gate, leaving it alone: %v\n", + ignoredSource.cursorTable, err) + return false, nil + } + if !state.reconcileNeeded() { + return false, nil + } + if !state.needsUntrack { + return resumeIgnoredCursorUntrack(ctx, db) + } + + // Advisory zone. Nothing here is destructive: a partial scratch table is + // harmless, and the next open re-runs from the top. + if err := backupIgnoredCursorRows(ctx, db); err != nil { + ignoredCursorAdvisory("schema: cannot back up %s rows, leaving the tracked table in place: %v\n", + ignoredSource.cursorTable, err) + return false, nil + } + if err := unstageBeforeIgnoredCursorUntrack(ctx, db); err != nil { + ignoredCursorAdvisory("schema: cannot clear the staging area before untracking %s, leaving it in place: %v\n", + ignoredSource.cursorTable, err) + return false, nil + } + + // Announced here and nowhere earlier: every step above can decline, and a + // fleet whose clients cannot run DDL would otherwise be told its database + // was being repaired on every single open, forever, while the only + // truthful record was debug-gated. + log.Printf("schema: %s is tracked at HEAD on this database, which permanently wedges `bd dolt pull`; untracking it and preserving its rows (gastownhall/beads#4356)", + ignoredSource.cursorTable) + + if err := commitIgnoredCursorUntrack(ctx, db); err != nil { + return false, err + } + if err := restoreIgnoredCursorRows(ctx, db); err != nil { + return false, err + } + return true, nil +} + +// resumeIgnoredCursorUntrack finishes a repair some earlier open started and +// did not complete. The cursor table is not in the legacy shape — it may be +// healthy, or missing entirely — and a scratch table survives. +// +// It deliberately does NOT trust that scratch as a source of rows unless the +// cursor table is actually absent. The restore's union semantics exist so no +// recorded migration version is lost across a crash, but pointed at a LIVE +// cursor table they invert the sanctioned bad-release recovery, which is a +// cursor ROLLBACK: the operator deletes cursor rows so a corrected migration +// series re-applies (docs/recovery). Re-inserting exactly those versions, with +// their old applied_at, would silently skip the corrected migrations. When the +// cursor table is present the scratch is stale bookkeeping and the only +// correct action is to remove it. +func resumeIgnoredCursorUntrack(ctx context.Context, db DBConn) (bool, error) { + // The operator veto is re-read here, not inherited: an operator who + // resolved a crashed repair by deliberately versioning the cursor table + // must not have stale rows pushed back into it on the next open. + ignored, err := tableActivelyIgnored(ctx, db, "", ignoredSource.cursorTable) + if err != nil { + ignoredCursorAdvisory("schema: cannot read dolt_ignore, leaving %s alone: %v\n", + ignoredCursorUntrackTempTable, err) + return false, nil + } + cursorPresent, err := schemaTableExists(ctx, db, ignoredSource.cursorTable) + if err != nil { + ignoredCursorAdvisory("schema: cannot probe %s, leaving %s alone: %v\n", + ignoredSource.cursorTable, ignoredCursorUntrackTempTable, err) + return false, nil + } + + log.Printf("schema: cleaning up after an interrupted %s untrack (gastownhall/beads#4356)", + ignoredSource.cursorTable) + + restore := !cursorPresent && ignored + if restore { + err = restoreIgnoredCursorRows(ctx, db) + } else { + err = dropIgnoredCursorScratch(ctx, db) + } + if err != nil { + // A client with no DDL grant can REACH this state without having + // created it — some privileged opener crashed mid-repair — and the + // database is fully usable in it. Bricking every open of that client + // would be a brand-new failure class, which is the one thing #5816 + // says a heal must never do. Everything here is idempotent, so + // declining costs only the cleanup, until a privileged open finishes. + if dberrors.IsAccessDenied(err) { + ignoredCursorAdvisory("schema: not permitted to finish the interrupted %s untrack; continuing without it: %v\n", + ignoredSource.cursorTable, err) + return false, nil + } + return false, err + } + return true, nil +} + +// ignoredCursorNeedsUntrack reports whether this database carries the legacy +// shape: the ignored-lane cursor table committed at HEAD *and* covered by an +// active dolt_ignore pattern. Both terms matter. The first is the wedge +// itself. The second is the operator's veto. +func ignoredCursorNeedsUntrack(ctx context.Context, db DBConn, qualifier string) (bool, error) { + tracked, err := tableTrackedAtHead(ctx, db, qualifier, ignoredSource.cursorTable) + if err != nil || !tracked { + return false, err + } + return tableActivelyIgnored(ctx, db, qualifier, ignoredSource.cursorTable) +} + +// tableTrackedAtHead reports whether table is committed at HEAD, which is the +// only question dolt_ignore's ADD-delta semantics actually turn on. +// +// It asks by LISTING HEAD rather than by selecting from the table itself. The +// direct spelling (`SELECT … AS OF 'HEAD'`, table-not-found means untracked) +// is the one the field diagnosed with and is unambiguous, but as a probe it is +// exactly the mistake be-bv7x cost us: a Dolt session that issues a FAILING +// statement stays pinned to its pre-statement catalog snapshot for the rest of +// its pooled life, and on a healthy database that probe fails EVERY time, on +// EVERY open. The LIKE form always succeeds and returns at most one row, so +// this costs the same as every other steady-state scalar probe. +// +// The returned name is compared exactly rather than trusted from the LIKE: +// '_' is a LIKE single-character wildcard and the cursor table's name is full +// of them. +func tableTrackedAtHead(ctx context.Context, db DBConn, qualifier, table string) (bool, error) { + from := "" + if qualifier != "" { + // The AS OF clause must trail the FROM; `SHOW TABLES AS OF … FROM x` + // is a syntax error. + from = " FROM " + qualifier + } + //nolint:gosec // G201: both the qualifier and the table name are package constants. + query := "SHOW TABLES" + from + " AS OF 'HEAD' LIKE '" + table + "'" + rows, err := db.QueryContext(ctx, query) + if err != nil { + return false, fmt.Errorf("listing %s at HEAD: %w", table, err) + } + defer func() { _ = rows.Close() }() + + for rows.Next() { + var name string + if err := rows.Scan(&name); err != nil { + return false, fmt.Errorf("listing %s at HEAD: %w", table, err) + } + if strings.EqualFold(name, table) { + return true, nil + } + } + if err := rows.Err(); err != nil { + return false, fmt.Errorf("listing %s at HEAD: %w", table, err) + } + return false, nil +} + +// tableActivelyIgnored reports whether dolt_ignore genuinely exempts table. +// +// Dolt does not treat dolt_ignore as "any matching row wins": conflicting +// patterns resolve MOST SPECIFIC FIRST (doltdb's resolveConflictingPatterns). +// Counting any matching ignored=1 row therefore gets the answer backwards on a +// database that carries a broad house pattern next to an exact override — +// verified against the engine: with ('zz%', 1) and ('zzprobe', 0), Dolt +// TRACKS zzprobe while a naive count calls it ignored. Believing the count +// there would make this file drop and commit away a table the operator +// explicitly chose to keep versioned, which is unrecoverable. +// +// Rather than re-implement Dolt's specificity ordering (and its LIKE +// semantics) in Go, this resolves the two cases it can prove and declines +// otherwise: +// +// - an exact-name row is maximally specific, so it always wins outright; +// - with no exact row, any matching ignored=0 pattern means the operator's +// intent cannot be established from a wildcard comparison we are not +// doing — decline. +// +// Declining is always safe: it skips the repair, and the database is exactly +// as it was. Every canonical pattern this file cares about is seeded by +// seedDoltIgnorePatterns as an exact name, so the common paths take the first +// branch. +func tableActivelyIgnored(ctx context.Context, db DBConn, qualifier, table string) (bool, error) { + doltIgnore := "dolt_ignore" + if qualifier != "" { + doltIgnore = qualifier + ".dolt_ignore" + } + rows, err := db.QueryContext(ctx, + "SELECT pattern, ignored FROM "+doltIgnore+" WHERE ? LIKE pattern", table) + if err != nil { + return false, fmt.Errorf("reading dolt_ignore: %w", err) + } + defer func() { _ = rows.Close() }() + + wildcardIgnored, wildcardTracked := false, false + for rows.Next() { + var pattern string + var ignored bool + if err := rows.Scan(&pattern, &ignored); err != nil { + return false, fmt.Errorf("reading dolt_ignore: %w", err) + } + if strings.EqualFold(pattern, table) { + return ignored, nil + } + if ignored { + wildcardIgnored = true + } else { + wildcardTracked = true + } + } + if err := rows.Err(); err != nil { + return false, fmt.Errorf("reading dolt_ignore: %w", err) + } + if wildcardTracked { + return false, nil + } + return wildcardIgnored, nil +} + +// backupIgnoredCursorRows mirrors the cursor rows into the scratch table. +// +// It MIRRORS rather than unions. A scratch table left by an earlier +// interrupted run can hold versions the operator has since deliberately +// deleted (the sanctioned bad-release recovery is a cursor rollback), and +// unioning them back in would silently skip the corrected migrations. The live +// table is the truth right up until the drop, so the scratch is made to match +// it exactly. +// +// A source table that is missing is not an error. It is the crash window +// between the drop and its commit: HEAD still carries the table (which is why +// the gate sent us here), the working set no longer does, and the rows are +// already safe in the scratch table from the interrupted run — which is then +// the only copy, and is left untouched. +func backupIgnoredCursorRows(ctx context.Context, db DBConn) error { + if _, err := db.ExecContext(ctx, ignoredCursorScratch.bootstrapSQL()); err != nil { + return fmt.Errorf("creating %s: %w", ignoredCursorUntrackTempTable, err) + } + present, err := schemaTableExists(ctx, db, ignoredSource.cursorTable) + if err != nil { + return fmt.Errorf("probing %s: %w", ignoredSource.cursorTable, err) + } + if !present { + return nil + } + columns, err := ignoredCursorCopyColumns(ctx, db, ignoredSource.cursorTable) + if err != nil { + return err + } + //nolint:gosec // G201: the table name is a constant. + if _, err := db.ExecContext(ctx, "DELETE FROM "+ignoredCursorUntrackTempTable); err != nil { + return fmt.Errorf("clearing %s: %w", ignoredCursorUntrackTempTable, err) + } + //nolint:gosec // G201: both table names are constants and the column list is a fixed allowlist. + copySQL := "INSERT IGNORE INTO " + ignoredCursorUntrackTempTable + " (" + columns + ") SELECT " + columns + + " FROM " + ignoredSource.cursorTable + if _, err := db.ExecContext(ctx, copySQL); err != nil { + return fmt.Errorf("copying %s rows to %s: %w", ignoredSource.cursorTable, ignoredCursorUntrackTempTable, err) + } + return nil +} + +// unstageBeforeIgnoredCursorUntrack clears the staging area so the scoped +// commit below carries nothing but the table deletion — the hazard 0040/0041's +// commitNonlocalRepair documents. It is the last advisory step: a client whose +// grant covers CREATE and INSERT but not CALL DOLT_RESET must decline here +// rather than fail its open forever. +func unstageBeforeIgnoredCursorUntrack(ctx context.Context, db DBConn) error { + dirty, err := dirtyTables(ctx, db, false) + if err != nil { + return fmt.Errorf("reading working set: %w", err) + } + return unstagePreExistingTables(ctx, db, dirty) +} + +// commitIgnoredCursorUntrack drops the tracked cursor table and commits the +// deletion into HEAD, which is the whole point: after this commit the table's +// presence is an ADD delta again and dolt_ignore genuinely exempts it. +// +// Every statement here is load-bearing, and each one is a lesson 0062 already +// paid for: +// +// - the bare COMMIT, because on the sql-server path migrations run on a +// transaction-pinned connection and Dolt's staging procedures read the +// working set, which an open transaction has not published yet. It is a +// no-op on the autocommit paths (embedded engine, dolt CLI); +// - the '-f' on DOLT_ADD, because a plain add of a dolt_ignore'd table is a +// silent no-op, and the table is ignored by construction here — without +// the force the drop never stages, the recreate below nets it back out, +// and the database stays exactly as wedged as it started; +// - '--skip-empty', because a replay from an intermediate state would +// otherwise die on "nothing to commit" (the 0040/0041 lesson). +func commitIgnoredCursorUntrack(ctx context.Context, db DBConn) error { + //nolint:gosec // G201: the table name is a constant. + if _, err := db.ExecContext(ctx, "DROP TABLE IF EXISTS "+ignoredSource.cursorTable); err != nil { + return fmt.Errorf("dropping tracked %s: %w", ignoredSource.cursorTable, err) + } + if _, err := db.ExecContext(ctx, "COMMIT"); err != nil { + return fmt.Errorf("publishing the %s drop: %w", ignoredSource.cursorTable, err) + } + if err := DrainCall(ctx, db, "CALL DOLT_ADD('-f', ?)", ignoredSource.cursorTable); err != nil { + return fmt.Errorf("staging the %s drop: %w", ignoredSource.cursorTable, err) + } + if err := DrainCall(ctx, db, "CALL DOLT_COMMIT('--skip-empty', '-m', ?)", ignoredCursorUntrackCommitMessage); err != nil { + return fmt.Errorf("committing the %s drop: %w", ignoredSource.cursorTable, err) + } + return nil +} + +// restoreIgnoredCursorRows recreates the cursor table in the working set and +// puts the rows back. The recreated table has never been committed on this +// lineage, so it is an ADD delta — the same shape a fresh clone has, on which +// this wedge is impossible by construction. +// +// Only ever called with the cursor table absent, so the INSERT cannot +// resurrect rows a live table no longer has. +func restoreIgnoredCursorRows(ctx context.Context, db DBConn) error { + if _, err := db.ExecContext(ctx, ignoredSource.bootstrapSQL()); err != nil { + return fmt.Errorf("recreating %s: %w", ignoredSource.cursorTable, err) + } + // The column list is read off the SCRATCH table: it may have been written + // by an older binary whose cursor shape had fewer columns. + columns, err := ignoredCursorCopyColumns(ctx, db, ignoredCursorUntrackTempTable) + if err != nil { + return err + } + //nolint:gosec // G201: both table names are constants and the column list is a fixed allowlist. + restoreSQL := "INSERT IGNORE INTO " + ignoredSource.cursorTable + " (" + columns + ") SELECT " + columns + + " FROM " + ignoredCursorUntrackTempTable + if _, err := db.ExecContext(ctx, restoreSQL); err != nil { + return fmt.Errorf("restoring %s rows: %w", ignoredSource.cursorTable, err) + } + return dropIgnoredCursorScratch(ctx, db) +} + +// dropIgnoredCursorScratch removes the scratch table and cleans up after the +// one window in which it can end up tracked: it carries a perfectly +// committable name, so a concurrent writer's blanket commit can sweep it into +// HEAD during the repair. Dropping it locally would then leave a permanent +// delete delta — the same class of tracked residue this whole fix exists to +// remove — so the deletion is committed, scoped to that table. +func dropIgnoredCursorScratch(ctx context.Context, db DBConn) error { + //nolint:gosec // G201: the table name is a constant. + if _, err := db.ExecContext(ctx, "DROP TABLE IF EXISTS "+ignoredCursorUntrackTempTable); err != nil { + return fmt.Errorf("dropping %s: %w", ignoredCursorUntrackTempTable, err) + } + + // Publish this session's work before asking Dolt what the working set + // looks like, for exactly the reason commitIgnoredCursorUntrack does it: + // on the transaction-pinned server path the CREATE/INSERT/DROP above sit + // in an unpublished transaction, and the staging procedure would see the + // pre-drop scratch still matching HEAD, stage an empty diff, and + // --skip-empty would commit nothing — leaving the tracked residue to ride + // some later unscoped auto-commit instead. + if _, err := db.ExecContext(ctx, "COMMIT"); err != nil { + return fmt.Errorf("publishing the %s drop: %w", ignoredCursorUntrackTempTable, err) + } + + tracked, err := tableTrackedAtHead(ctx, db, "", ignoredCursorUntrackTempTable) + if err != nil || !tracked { + return err + } + // The resume path reaches here without any unstage having run in this + // process, so scope the commit the same way its sibling does or unrelated + // staged tables ride into HEAD under a "drop stray scratch table" message. + if err := unstageBeforeIgnoredCursorUntrack(ctx, db); err != nil { + return fmt.Errorf("unstaging before dropping %s: %w", ignoredCursorUntrackTempTable, err) + } + return commitScopedTableChange(ctx, db, ignoredCursorUntrackTempTable, ignoredCursorTempSweepCommitMessage) +} + +// ignoredCursorCopyColumns is the column list to move out of source, which is +// cursorTableColumns narrowed to what that table actually has. Reading the +// shape instead of assuming it is what lets one code path serve both a +// pre-#4259 lineage (no content_hash) and a scratch table written by an older +// binary — and what stops the next column added to bootstrapSQL from being +// silently dropped on every database this repairs. +func ignoredCursorCopyColumns(ctx context.Context, db DBConn, source string) (string, error) { + present := make([]string, 0, len(cursorTableColumns)) + for _, column := range cursorTableColumns { + has, err := schemaColumnExists(ctx, db, source, column) + if err != nil { + return "", fmt.Errorf("reading %s.%s: %w", source, column, err) + } + if has { + present = append(present, column) + } + } + if len(present) == 0 { + return "", fmt.Errorf("%s carries none of the cursor columns %v", source, cursorTableColumns) + } + return strings.Join(present, ", "), nil +} diff --git a/internal/storage/schema/ignored_cursor_untrack_test.go b/internal/storage/schema/ignored_cursor_untrack_test.go new file mode 100644 index 000000000..eb18b744c --- /dev/null +++ b/internal/storage/schema/ignored_cursor_untrack_test.go @@ -0,0 +1,897 @@ +package schema + +import ( + "context" + "database/sql" + "errors" + "fmt" + "regexp" + "strings" + "testing" + + "github.com/DATA-DOG/go-sqlmock" + mysql "github.com/go-sql-driver/mysql" +) + +// failOnSwallowedAdvisory turns the reconcile's advisory path fatal for the +// duration of a test. Every sqlmock helper installs it, and that is the point: +// in ordered sqlmock a statement nobody primed comes back as "call was not +// expected", which the advisory path demotes to a debug line and swallows — so +// a test missing a heal expectation passed while silently exercising the +// probe-failure fallback instead of the healthy path it claimed to cover. +// Tests that mean to exercise the advisory path opt out with +// allowSwallowedAdvisory. +func failOnSwallowedAdvisory(t *testing.T) { + t.Helper() + saved := ignoredCursorAdvisory + ignoredCursorAdvisory = func(format string, args ...any) { + t.Helper() + t.Errorf("the untrack reconcile swallowed an advisory failure (an unprimed statement?): "+ + strings.TrimRight(format, "\n"), args...) + } + t.Cleanup(func() { ignoredCursorAdvisory = saved }) +} + +// allowSwallowedAdvisory records the advisory message instead of failing, for +// the tests whose subject IS the advisory path. +func allowSwallowedAdvisory(t *testing.T) *string { + t.Helper() + var logged string + saved := ignoredCursorAdvisory + ignoredCursorAdvisory = func(format string, args ...any) { + logged += fmt.Sprintf(strings.TrimRight(format, "\n"), args...) + "\n" + } + t.Cleanup(func() { ignoredCursorAdvisory = saved }) + return &logged +} + +// expectHeadTableProbe mocks the tracked-at-HEAD probe. qualifier is the +// identifier-quoted database name when a selector had to put the session on +// the database, empty when it was already there. +func expectHeadTableProbe(mock sqlmock.Sqlmock, qualifier, table string, tracked bool) { + from := "" + if qualifier != "" { + from = " FROM " + qualifier + } + rows := sqlmock.NewRows([]string{"Tables_in_testdb"}) + if tracked { + rows.AddRow(table) + } + mock.ExpectQuery(regexp.QuoteMeta("SHOW TABLES" + from + " AS OF 'HEAD' LIKE '" + table + "'")). + WillReturnRows(rows) +} + +// doltIgnoreRow is one dolt_ignore row the resolution probe reads back. +type doltIgnoreRow struct { + pattern string + ignored bool +} + +// exactlyIgnored is the shape seedDoltIgnorePatterns leaves on every healthy +// database: the cursor table's own name, switched on. +func exactlyIgnored(ignored bool) []doltIgnoreRow { + return []doltIgnoreRow{{pattern: ignoredSource.cursorTable, ignored: ignored}} +} + +func expectIgnoreResolution(mock sqlmock.Sqlmock, qualifier, table string, matches []doltIgnoreRow) { + doltIgnore := "dolt_ignore" + if qualifier != "" { + doltIgnore = qualifier + ".dolt_ignore" + } + rows := sqlmock.NewRows([]string{"pattern", "ignored"}) + for _, m := range matches { + rows.AddRow(m.pattern, m.ignored) + } + mock.ExpectQuery(regexp.QuoteMeta("SELECT pattern, ignored FROM " + doltIgnore + " WHERE ? LIKE pattern")). + WithArgs(table). + WillReturnRows(rows) +} + +// expectSchemaTableExists mocks the shared be-bv7x existence probe. +func expectSchemaTableExists(mock sqlmock.Sqlmock, table string, exists bool) { + n := 0 + if exists { + n = 1 + } + mock.ExpectQuery(`(?s)SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.TABLES`). + WithArgs(table). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(n)) +} + +// expectCursorCopyColumns mocks the per-column shape read that decides which +// columns the copy moves. present is how many of cursorTableColumns the table +// actually has, counting from the front (a pre-#4259 lineage has 2). +func expectCursorCopyColumns(mock sqlmock.Sqlmock, table string, present int) string { + for i, column := range cursorTableColumns { + n := 0 + if i < present { + n = 1 + } + mock.ExpectQuery(`(?s)SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.COLUMNS`). + WithArgs(table, column). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(n)) + } + return strings.Join(cursorTableColumns[:present], ", ") +} + +// expectIgnoredCursorGate mocks the shared read-only gate. +func expectIgnoredCursorGate(mock sqlmock.Sqlmock, qualifier string, tracked bool, matches []doltIgnoreRow, stray bool) { + expectHeadTableProbe(mock, qualifier, ignoredSource.cursorTable, tracked) + if tracked { + expectIgnoreResolution(mock, qualifier, ignoredSource.cursorTable, matches) + } + expectSchemaTableExists(mock, ignoredCursorUntrackTempTable, stray) +} + +// expectIgnoredCursorHealNoop mocks the whole open-time reconcile on a healthy +// database, as MigrateUp calls it: two reads, no writes — the property that +// keeps this safe to run through a SELECT/DML-only fence. +func expectIgnoredCursorHealNoop(mock sqlmock.Sqlmock) { + expectIgnoredCursorGate(mock, "", false, nil, false) +} + +// expectIgnoredCursorBackup mocks the row-preservation half of Phase A. It +// MIRRORS: the scratch is cleared before the copy, so a stale scratch can +// never re-introduce rows the live cursor no longer has. +func expectIgnoredCursorBackup(mock sqlmock.Sqlmock, columnsPresent int) { + mock.ExpectExec("(?s)^CREATE TABLE IF NOT EXISTS " + ignoredCursorUntrackTempTable). + WillReturnResult(sqlmock.NewResult(0, 0)) + expectSchemaTableExists(mock, ignoredSource.cursorTable, true) + expectCursorCopyColumns(mock, ignoredSource.cursorTable, columnsPresent) + mock.ExpectExec(regexp.QuoteMeta("DELETE FROM " + ignoredCursorUntrackTempTable)). + WillReturnResult(sqlmock.NewResult(0, 25)) + mock.ExpectExec(regexp.QuoteMeta("INSERT IGNORE INTO " + ignoredCursorUntrackTempTable)). + WillReturnResult(sqlmock.NewResult(0, 25)) +} + +// expectIgnoredCursorUnstage mocks the last advisory step. +func expectIgnoredCursorUnstage(mock sqlmock.Sqlmock, staged ...string) { + rows := sqlmock.NewRows([]string{"table_name", "staged"}) + for _, table := range staged { + rows.AddRow(table, true) + } + mock.ExpectQuery("(?s)SELECT s\\.table_name, s\\.staged\\s+FROM dolt_status s").WillReturnRows(rows) + for _, table := range staged { + mock.ExpectQuery(regexp.QuoteMeta("CALL DOLT_RESET(?)")). + WithArgs(table). + WillReturnRows(sqlmock.NewRows([]string{"status"})) + } +} + +// expectIgnoredCursorUntrackCommit mocks the irreversible half of Phase A. +func expectIgnoredCursorUntrackCommit(mock sqlmock.Sqlmock) { + mock.ExpectExec(regexp.QuoteMeta("DROP TABLE IF EXISTS " + ignoredSource.cursorTable)). + WillReturnResult(sqlmock.NewResult(0, 0)) + mock.ExpectExec(regexp.QuoteMeta("COMMIT")). + WillReturnResult(sqlmock.NewResult(0, 0)) + mock.ExpectQuery(regexp.QuoteMeta("CALL DOLT_ADD('-f', ?)")). + WithArgs(ignoredSource.cursorTable). + WillReturnRows(sqlmock.NewRows([]string{"status"})) + mock.ExpectQuery(regexp.QuoteMeta("CALL DOLT_COMMIT('--skip-empty', '-m', ?)")). + WithArgs(ignoredCursorUntrackCommitMessage). + WillReturnRows(sqlmock.NewRows([]string{"hash"})) +} + +// expectIgnoredCursorScratchDrop mocks the cleanup, including the straggler +// sweep that only fires if a concurrent commit swept the scratch into HEAD. +func expectIgnoredCursorScratchDrop(mock sqlmock.Sqlmock, sweptIntoHead bool) { + mock.ExpectExec(regexp.QuoteMeta("DROP TABLE IF EXISTS " + ignoredCursorUntrackTempTable)). + WillReturnResult(sqlmock.NewResult(0, 0)) + mock.ExpectExec(regexp.QuoteMeta("COMMIT")). + WillReturnResult(sqlmock.NewResult(0, 0)) + expectHeadTableProbe(mock, "", ignoredCursorUntrackTempTable, sweptIntoHead) + if !sweptIntoHead { + return + } + expectIgnoredCursorUnstage(mock) + mock.ExpectQuery(regexp.QuoteMeta("CALL DOLT_ADD(?)")). + WithArgs(ignoredCursorUntrackTempTable). + WillReturnRows(sqlmock.NewRows([]string{"status"})) + mock.ExpectQuery(regexp.QuoteMeta("CALL DOLT_COMMIT('-m', ?, '--skip-empty')")). + WithArgs(ignoredCursorTempSweepCommitMessage). + WillReturnRows(sqlmock.NewRows([]string{"hash"})) +} + +// expectIgnoredCursorRestore mocks Phase B. +func expectIgnoredCursorRestore(mock sqlmock.Sqlmock, sweptIntoHead bool) { + mock.ExpectExec("(?s)^CREATE TABLE IF NOT EXISTS " + ignoredSource.cursorTable). + WillReturnResult(sqlmock.NewResult(0, 0)) + expectCursorCopyColumns(mock, ignoredCursorUntrackTempTable, len(cursorTableColumns)) + mock.ExpectExec(regexp.QuoteMeta("INSERT IGNORE INTO " + ignoredSource.cursorTable)). + WillReturnResult(sqlmock.NewResult(0, 25)) + expectIgnoredCursorScratchDrop(mock, sweptIntoHead) +} + +// TestHealSkipsHealthyDatabaseInTwoReads is the hot-path contract. Every bd +// invocation that opens a writable store pays this, so it must be two reads +// and nothing else — no write, no DDL, no commit — and both must be +// statements that SUCCEED, or the pooled Dolt session ends up pinned to a +// stale catalog snapshot for the rest of its life (be-bv7x). +func TestHealSkipsHealthyDatabaseInTwoReads(t *testing.T) { + db, mock := newMockDB(t) + + expectIgnoredCursorHealNoop(mock) + + healed, err := healTrackedIgnoredCursorTable(context.Background(), db) + if err != nil { + t.Fatalf("healTrackedIgnoredCursorTable() error = %v, want nil", err) + } + if healed { + t.Fatal("healTrackedIgnoredCursorTable() reported a heal on a healthy database") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} + +// TestHealResolvesDoltIgnoreLikeDoltDoes is the data-loss guard. Dolt resolves +// conflicting dolt_ignore patterns most-specific-first, so "any matching +// ignored=1 row" is not the same question — verified against the engine, a +// database carrying ('zz%', 1) alongside ('zzprobe', 0) TRACKS zzprobe while a +// naive count calls it ignored. Believing the count there would drop and +// commit away a table the operator explicitly chose to keep versioned. +func TestHealResolvesDoltIgnoreLikeDoltDoes(t *testing.T) { + broad := doltIgnoreRow{pattern: "ignored\\_%", ignored: true} + exactOff := doltIgnoreRow{pattern: ignoredSource.cursorTable, ignored: false} + exactOn := doltIgnoreRow{pattern: ignoredSource.cursorTable, ignored: true} + midOff := doltIgnoreRow{pattern: "ignored\\_schema%", ignored: false} + + for _, tt := range []struct { + name string + matches []doltIgnoreRow + want bool + why string + }{ + { + name: "exact on, the seeded shape", + matches: []doltIgnoreRow{exactOn}, + want: true, + why: "the seed writes the exact name; this is every healthy database", + }, + { + name: "exact off, the documented operator override", + matches: []doltIgnoreRow{exactOff}, + want: false, + }, + { + name: "broad on plus exact off", + matches: []doltIgnoreRow{broad, exactOff}, + want: false, + why: "an exact name is maximally specific, so Dolt keeps the table TRACKED; healing here destroys the operator's lineage", + }, + { + name: "broad off plus exact on", + matches: []doltIgnoreRow{{pattern: "ignored\\_%", ignored: false}, exactOn}, + want: true, + why: "the exact row wins in this direction too", + }, + { + name: "broad on only", + matches: []doltIgnoreRow{broad}, + want: true, + why: "nothing contradicts it", + }, + { + name: "wildcards disagree, no exact row", + matches: []doltIgnoreRow{broad, midOff}, + want: false, + why: "specificity between two wildcards is Dolt's to decide, not ours: decline rather than guess wrong destructively", + }, + { + name: "no pattern covers it", + matches: nil, + want: false, + }, + } { + t.Run(tt.name, func(t *testing.T) { + db, mock := newMockDB(t) + + expectIgnoreResolution(mock, "", ignoredSource.cursorTable, tt.matches) + + got, err := tableActivelyIgnored(context.Background(), db, "", ignoredSource.cursorTable) + if err != nil { + t.Fatalf("tableActivelyIgnored() error = %v", err) + } + if got != tt.want { + t.Fatalf("tableActivelyIgnored() = %v, want %v (%s)", got, tt.want, tt.why) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } + }) + } +} + +// The end-to-end version of the case above: the gate must stop before it +// touches anything. +func TestHealRespectsOperatorIgnoreOverrideUnderABroaderPattern(t *testing.T) { + db, mock := newMockDB(t) + + expectIgnoredCursorGate(mock, "", true, []doltIgnoreRow{ + {pattern: "ignored\\_%", ignored: true}, + {pattern: ignoredSource.cursorTable, ignored: false}, + }, false) + + healed, err := healTrackedIgnoredCursorTable(context.Background(), db) + if err != nil { + t.Fatalf("healTrackedIgnoredCursorTable() error = %v, want nil", err) + } + if healed { + t.Fatal("healTrackedIgnoredCursorTable() untracked a table Dolt keeps tracked for the operator") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} + +// The #5816 lesson: a heal that cannot run must never be the reason a database +// stops opening. A client with no read on the HEAD probe (or a transient +// failure) leaves the caller exactly where it was. +func TestHealIsNonFatalWhenTheProbeFails(t *testing.T) { + db, mock := newMockDB(t) + logged := allowSwallowedAdvisory(t) + + mock.ExpectQuery(regexp.QuoteMeta("SHOW TABLES AS OF 'HEAD'")). + WillReturnError(errors.New("command denied to user 'fenced'@'%'")) + + healed, err := healTrackedIgnoredCursorTable(context.Background(), db) + if err != nil { + t.Fatalf("healTrackedIgnoredCursorTable() error = %v, want nil (a failed probe must not brick the open)", err) + } + if healed { + t.Fatal("healTrackedIgnoredCursorTable() reported a heal after its probe failed") + } + if !strings.Contains(*logged, "command denied") { + t.Fatalf("advisory output = %q, want the discarded probe error reported", *logged) + } +} + +// The advisory zone runs to the END of the unstage sweep, not to the backup. +// A client whose grant covers CREATE and INSERT but not CALL DOLT_RESET would +// otherwise fail every open persistently with nothing destroyed — precisely +// the brick class the policy exists to prevent. +func TestHealIsNonFatalThroughTheWholePreDropZone(t *testing.T) { + for _, tt := range []struct { + name string + expect func(sqlmock.Sqlmock) + }{ + { + name: "scratch table cannot be created", + expect: func(mock sqlmock.Sqlmock) { + mock.ExpectExec("(?s)^CREATE TABLE IF NOT EXISTS " + ignoredCursorUntrackTempTable). + WillReturnError(errors.New("command denied to user 'fenced'@'%'")) + }, + }, + { + name: "working set cannot be read", + expect: func(mock sqlmock.Sqlmock) { + expectIgnoredCursorBackup(mock, len(cursorTableColumns)) + mock.ExpectQuery("(?s)SELECT s\\.table_name, s\\.staged\\s+FROM dolt_status s"). + WillReturnError(errors.New("connection reset")) + }, + }, + { + name: "staging area cannot be cleared", + expect: func(mock sqlmock.Sqlmock) { + expectIgnoredCursorBackup(mock, len(cursorTableColumns)) + mock.ExpectQuery("(?s)SELECT s\\.table_name, s\\.staged\\s+FROM dolt_status s"). + WillReturnRows(sqlmock.NewRows([]string{"table_name", "staged"}).AddRow("issues", true)) + mock.ExpectQuery(regexp.QuoteMeta("CALL DOLT_RESET(?)")). + WithArgs("issues"). + WillReturnError(errors.New("command denied to user 'fenced'@'%'")) + }, + }, + } { + t.Run(tt.name, func(t *testing.T) { + db, mock := newMockDB(t) + allowSwallowedAdvisory(t) + + expectIgnoredCursorGate(mock, "", true, exactlyIgnored(true), false) + tt.expect(mock) + + healed, err := healTrackedIgnoredCursorTable(context.Background(), db) + if err != nil { + t.Fatalf("healTrackedIgnoredCursorTable() error = %v, want nil: nothing is destroyed before the DROP, so this must cost one open, not every open", err) + } + if healed { + t.Fatal("healTrackedIgnoredCursorTable() reported a heal it did not perform") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } + }) + } +} + +// Past the DROP the policy inverts: the pass must not continue without a +// cursor table, so the error is returned and the open fails. It must NOT be a +// *DirtyTablesError — the embedded lenient intents and MigrateUpWithLock's +// bootstrap heal both branch on that type, and a heal failure is neither a +// dirty working set nor something DOLT_RESET('--hard') should be pointed at. +func TestHealIsFatalAfterTheDropAndIsNotADirtyTablesError(t *testing.T) { + db, mock := newMockDB(t) + + expectIgnoredCursorGate(mock, "", true, exactlyIgnored(true), false) + expectIgnoredCursorBackup(mock, len(cursorTableColumns)) + expectIgnoredCursorUnstage(mock) + mock.ExpectExec(regexp.QuoteMeta("DROP TABLE IF EXISTS " + ignoredSource.cursorTable)). + WillReturnResult(sqlmock.NewResult(0, 0)) + mock.ExpectExec(regexp.QuoteMeta("COMMIT")). + WillReturnError(errors.New("connection reset")) + + healed, err := healTrackedIgnoredCursorTable(context.Background(), db) + if err == nil { + t.Fatal("healTrackedIgnoredCursorTable() error = nil after the drop failed to commit, want the failure returned") + } + if healed { + t.Fatal("healTrackedIgnoredCursorTable() reported success on a failed untrack") + } + var dirtyErr *DirtyTablesError + if errors.As(err, &dirtyErr) { + t.Fatalf("heal failure satisfies errors.As(*DirtyTablesError): %v — lenient opens would swallow it and the bootstrap heal would hard-reset on it", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} + +// TestHealUntracksAndRestoresInOrder pins the statement contract of the whole +// repair. The order is not cosmetic: the backup must precede the drop, the +// bare COMMIT must precede each staging call (on the sql-server path Dolt's +// procedures read a working set an open transaction has not published), the +// add must carry '-f' (a plain add of an ignored table is a silent no-op, so +// without it the drop never stages and the recreate nets the whole repair back +// out), and the commit must carry '--skip-empty' so a replay is not fatal. +func TestHealUntracksAndRestoresInOrder(t *testing.T) { + db, mock := newMockDB(t) + + expectIgnoredCursorGate(mock, "", true, exactlyIgnored(true), false) + expectIgnoredCursorBackup(mock, len(cursorTableColumns)) + expectIgnoredCursorUnstage(mock) + expectIgnoredCursorUntrackCommit(mock) + expectIgnoredCursorRestore(mock, false) + + healed, err := healTrackedIgnoredCursorTable(context.Background(), db) + if err != nil { + t.Fatalf("healTrackedIgnoredCursorTable() error = %v", err) + } + if !healed { + t.Fatal("healTrackedIgnoredCursorTable() = false on a legacy tracked database, want true") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} + +// A lineage old enough to be tracked may also predate content_hash (#4259): +// the copy reads the column list off the schema rather than assuming it, or +// the backup dies on an unknown column and the heal never runs. +func TestHealCopiesLegacyShapeWithoutContentHash(t *testing.T) { + db, mock := newMockDB(t) + + expectIgnoredCursorGate(mock, "", true, exactlyIgnored(true), false) + expectIgnoredCursorBackup(mock, len(cursorTableColumns)-1) + expectIgnoredCursorUnstage(mock) + expectIgnoredCursorUntrackCommit(mock) + expectIgnoredCursorRestore(mock, false) + + if _, err := healTrackedIgnoredCursorTable(context.Background(), db); err != nil { + t.Fatalf("healTrackedIgnoredCursorTable() error = %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} + +// The scratch table carries a perfectly committable name, so a concurrent +// writer's blanket commit can sweep it into HEAD during the repair window. +// Dropping it locally would then leave a permanent delete delta — the same +// class of tracked residue this whole fix exists to remove — so the deletion +// is committed, scoped to that table, after the staging area is cleared so +// nothing unrelated rides along under its message. +func TestHealCommitsAStrayScratchTableOutOfHead(t *testing.T) { + db, mock := newMockDB(t) + + expectIgnoredCursorGate(mock, "", true, exactlyIgnored(true), false) + expectIgnoredCursorBackup(mock, len(cursorTableColumns)) + expectIgnoredCursorUnstage(mock) + expectIgnoredCursorUntrackCommit(mock) + expectIgnoredCursorRestore(mock, true) + + if _, err := healTrackedIgnoredCursorTable(context.Background(), db); err != nil { + t.Fatalf("healTrackedIgnoredCursorTable() error = %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} + +// The resume path: a previous open committed the drop and died before putting +// the rows back. The cursor table now reads as untracked, so the gate would +// call the database healthy — the surviving scratch table is the only evidence +// that it is not, and skipping it would lose the migration cursor and replay +// the whole ignored series from zero. +func TestHealResumesFromASurvivingScratchTable(t *testing.T) { + db, mock := newMockDB(t) + + expectIgnoredCursorGate(mock, "", false, nil, true) + expectIgnoreResolution(mock, "", ignoredSource.cursorTable, exactlyIgnored(true)) + expectSchemaTableExists(mock, ignoredSource.cursorTable, false) + expectIgnoredCursorRestore(mock, false) + + healed, err := healTrackedIgnoredCursorTable(context.Background(), db) + if err != nil { + t.Fatalf("healTrackedIgnoredCursorTable() error = %v", err) + } + if !healed { + t.Fatal("healTrackedIgnoredCursorTable() = false with an interrupted run to resume, want true") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} + +// TestHealNeverResurrectsRowsIntoALiveCursorTable is the counterpart, and the +// reason the resume is bounded rather than a blanket union. A scratch left +// behind while the cursor table is present and correct is stale bookkeeping. +// Unioning it back in inverts the sanctioned bad-release recovery — which is a +// cursor ROLLBACK, deleting rows so a corrected migration series re-applies — +// by restoring exactly the versions the operator deleted, silently skipping +// the corrected migrations. Cleanup only: no CREATE, no INSERT. +func TestHealNeverResurrectsRowsIntoALiveCursorTable(t *testing.T) { + db, mock := newMockDB(t) + + expectIgnoredCursorGate(mock, "", false, nil, true) + expectIgnoreResolution(mock, "", ignoredSource.cursorTable, exactlyIgnored(true)) + expectSchemaTableExists(mock, ignoredSource.cursorTable, true) + // Cleanup only. An INSERT here would be an unexpected statement. + expectIgnoredCursorScratchDrop(mock, false) + + healed, err := healTrackedIgnoredCursorTable(context.Background(), db) + if err != nil { + t.Fatalf("healTrackedIgnoredCursorTable() error = %v", err) + } + if !healed { + t.Fatal("healTrackedIgnoredCursorTable() = false with a stray scratch table to clean up, want true") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} + +// The resume re-reads the operator veto rather than inheriting the decision +// from whichever open crashed. An operator who resolved a crashed repair by +// deliberately versioning the cursor table must not get stale rows pushed back +// into it — but the scratch is bd's own junk and is still cleaned up. +func TestHealResumeRespectsTheOperatorOverride(t *testing.T) { + db, mock := newMockDB(t) + + expectIgnoredCursorGate(mock, "", false, nil, true) + expectIgnoreResolution(mock, "", ignoredSource.cursorTable, exactlyIgnored(false)) + expectSchemaTableExists(mock, ignoredSource.cursorTable, false) + expectIgnoredCursorScratchDrop(mock, false) + + if _, err := healTrackedIgnoredCursorTable(context.Background(), db); err != nil { + t.Fatalf("healTrackedIgnoredCursorTable() error = %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations (an override must suppress the restore but not the cleanup): %v", err) + } +} + +// A fenced client can REACH the resume state without having created it — some +// privileged opener crashed mid-repair — and the database is fully usable in +// it. Failing its open would be a brand-new failure class, which is the one +// thing #5816 says a heal must never mint. A privilege refusal therefore +// degrades advisorily; anything else stays fatal so a privileged opener still +// converges. +func TestHealResumeDegradesForClientsThatCannotRunDDL(t *testing.T) { + denied := &mysql.MySQLError{Number: 1142, Message: "CREATE command denied to user 'fenced'@'%'"} + + for _, tt := range []struct { + name string + err error + wantFatal bool + }{ + {name: "privilege refusal", err: denied}, + {name: "anything else", err: errors.New("connection reset"), wantFatal: true}, + } { + t.Run(tt.name, func(t *testing.T) { + db, mock := newMockDB(t) + allowSwallowedAdvisory(t) + + expectIgnoredCursorGate(mock, "", false, nil, true) + expectIgnoreResolution(mock, "", ignoredSource.cursorTable, exactlyIgnored(true)) + expectSchemaTableExists(mock, ignoredSource.cursorTable, false) + mock.ExpectExec("(?s)^CREATE TABLE IF NOT EXISTS " + ignoredSource.cursorTable). + WillReturnError(tt.err) + + _, err := healTrackedIgnoredCursorTable(context.Background(), db) + if tt.wantFatal && err == nil { + t.Fatal("healTrackedIgnoredCursorTable() error = nil, want the failure returned so a privileged opener retries") + } + if !tt.wantFatal && err != nil { + t.Fatalf("healTrackedIgnoredCursorTable() error = %v, want nil: a client that cannot run DDL must open read-degraded, not fail forever", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } + }) + } +} + +// The other crash window: the drop ran but its commit did not, so HEAD still +// carries the table while the working set does not. Phase A re-runs from the +// top, and the copy must treat the missing source as "already saved" rather +// than as a failure — otherwise the pre-mutation policy swallows it and the +// database never converges. +func TestHealResumesWhenTheDroppedTableIsGoneFromTheWorkingSet(t *testing.T) { + db, mock := newMockDB(t) + + expectIgnoredCursorGate(mock, "", true, exactlyIgnored(true), true) + mock.ExpectExec("(?s)^CREATE TABLE IF NOT EXISTS " + ignoredCursorUntrackTempTable). + WillReturnResult(sqlmock.NewResult(0, 0)) + expectSchemaTableExists(mock, ignoredSource.cursorTable, false) + expectIgnoredCursorUnstage(mock) + expectIgnoredCursorUntrackCommit(mock) + expectIgnoredCursorRestore(mock, false) + + healed, err := healTrackedIgnoredCursorTable(context.Background(), db) + if err != nil { + t.Fatalf("healTrackedIgnoredCursorTable() error = %v", err) + } + if !healed { + t.Fatal("healTrackedIgnoredCursorTable() = false resuming a committed-drop crash, want true") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} + +// The probe reads HEAD through a spelling that cannot fail. The direct +// `SELECT … AS OF 'HEAD'` answers the same question, but it errors on every +// healthy database, and a Dolt session that issues a failing statement stays +// pinned to its pre-statement catalog snapshot for the rest of its pooled life +// (be-bv7x). The LIKE form is also bounded to one row, so it costs what every +// other steady-state probe costs. +func TestTrackedAtHeadProbeIssuesNoFailingStatement(t *testing.T) { + for _, tt := range []struct { + name string + qualifier string + }{ + {name: "session already on the database", qualifier: ""}, + {name: "database selected for us", qualifier: "`testdb`"}, + } { + t.Run(tt.name, func(t *testing.T) { + db, mock := newMockDB(t) + + expectHeadTableProbe(mock, tt.qualifier, ignoredSource.cursorTable, false) + + tracked, err := tableTrackedAtHead(context.Background(), db, tt.qualifier, ignoredSource.cursorTable) + if err != nil { + t.Fatalf("tableTrackedAtHead() error = %v", err) + } + if tracked { + t.Fatal("tableTrackedAtHead() = true with the cursor table absent from HEAD") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } + }) + } +} + +// '_' is a LIKE single-character wildcard and the cursor table's name is full +// of them, so the probe must not trust what the LIKE matched. +func TestTrackedAtHeadProbeComparesTheNameExactly(t *testing.T) { + db, mock := newMockDB(t) + + mock.ExpectQuery(regexp.QuoteMeta("SHOW TABLES AS OF 'HEAD' LIKE '" + ignoredSource.cursorTable + "'")). + WillReturnRows(sqlmock.NewRows([]string{"Tables_in_testdb"}).AddRow("ignoredXschemaXmigrations")) + + tracked, err := tableTrackedAtHead(context.Background(), db, "", ignoredSource.cursorTable) + if err != nil { + t.Fatalf("tableTrackedAtHead() error = %v", err) + } + if tracked { + t.Fatal("tableTrackedAtHead() = true on a name the LIKE wildcards matched but that is not the cursor table") + } +} + +// TestCursorTableColumnsMatchBootstrapSQL is the drift guard the untrack +// reconcile depends on: it copies cursor rows out and back BY NAME, so a +// column added to bootstrapSQL and not to cursorTableColumns would be silently +// dropped from every database the reconcile repairs. The shape has already +// changed out of band once (#4259 added content_hash). +func TestCursorTableColumnsMatchBootstrapSQL(t *testing.T) { + ddl := ignoredSource.bootstrapSQL() + open := strings.Index(ddl, "(") + close := strings.LastIndex(ddl, ")") + if open < 0 || close < open { + t.Fatalf("bootstrapSQL() is not a parenthesised CREATE: %q", ddl) + } + + var declared []string + for _, line := range strings.Split(ddl[open+1:close], "\n") { + line = strings.TrimSpace(line) + if line == "" { + continue + } + declared = append(declared, strings.Fields(line)[0]) + } + + if len(declared) != len(cursorTableColumns) { + t.Fatalf("bootstrapSQL() declares %v, cursorTableColumns is %v — the untrack reconcile copies by name and would drop the difference", + declared, cursorTableColumns) + } + for i := range declared { + if declared[i] != cursorTableColumns[i] { + t.Fatalf("bootstrapSQL() column %d = %q, cursorTableColumns has %q", i, declared[i], cursorTableColumns[i]) + } + } +} + +// The scratch table's DDL must come from the same generator as the real cursor +// table's, or the only copy of the cursor during the repair silently stops +// carrying a column. +func TestScratchTableSharesTheCursorBootstrapShape(t *testing.T) { + scratch := ignoredCursorScratch.bootstrapSQL() + cursor := ignoredSource.bootstrapSQL() + + want := strings.Replace(cursor, ignoredSource.cursorTable, ignoredCursorUntrackTempTable, 1) + if scratch != want { + t.Fatalf("scratch DDL diverged from the cursor bootstrap:\n got: %s\nwant: %s", scratch, want) + } +} + +// TestAlreadyConvergedDeclinesOnALegacyTrackedCursor is the server-mode half +// of the fix. A wedged legacy database is at-latest and fully seeded — its +// dirt is the residue of a COMPLETED pass — so every predicate the fast path +// checked before this one says "converged", MigrateUp never runs, and the heal +// placed inside it would be unreachable on exactly the mode that has the most +// of these databases. +func TestAlreadyConvergedDeclinesOnALegacyTrackedCursor(t *testing.T) { + db, mock := newMockDB(t) + + expectCurrentDatabase(mock, "testdb") + expectNoMigrationWorkNeeded(mock) + expectDoltIgnoreRead(mock, unqualifiedDoltIgnore, seededIgnorePatterns(LatestVersion())) + expectHeadTableProbe(mock, "", ignoredSource.cursorTable, true) + expectIgnoreResolution(mock, "", ignoredSource.cursorTable, exactlyIgnored(true)) + expectSchemaTableExists(mock, ignoredCursorUntrackTempTable, false) + + converged, err := alreadyConverged(context.Background(), db, "testdb", nil) + if err != nil { + t.Fatalf("alreadyConverged() error = %v", err) + } + if converged { + t.Fatal("alreadyConverged() = true on a legacy tracked cursor table, want false: the locked path is the only one that heals it") + } + // The lock probe must never be reached — the mock is not primed for it. + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} + +// TestAlreadyConvergedDeclinesOnASurvivingScratchTable is the half that was +// missing. The reconcile also cleans up after an interrupted run, and in that +// state the cursor table itself reads perfectly healthy — so a fast path that +// mirrored only the legacy-shape term would return "converged" forever and the +// cleanup branch would be unreachable in server mode. The scratch is +// deliberately NOT dolt_ignore'd, so the next pull's auto-commit puts it in +// HEAD and push replicates it fleet-wide. +func TestAlreadyConvergedDeclinesOnASurvivingScratchTable(t *testing.T) { + db, mock := newMockDB(t) + + expectCurrentDatabase(mock, "testdb") + expectNoMigrationWorkNeeded(mock) + expectDoltIgnoreRead(mock, unqualifiedDoltIgnore, seededIgnorePatterns(LatestVersion())) + expectHeadTableProbe(mock, "", ignoredSource.cursorTable, false) + expectSchemaTableExists(mock, ignoredCursorUntrackTempTable, true) + + converged, err := alreadyConverged(context.Background(), db, "testdb", nil) + if err != nil { + t.Fatalf("alreadyConverged() error = %v", err) + } + if converged { + t.Fatal("alreadyConverged() = true with an interrupted reconcile to finish, want false: server mode would never clean it up") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} + +// The mirror image, and the reason the tracked probe also reads the ignore +// flag: an operator who un-ignored the cursor table has a legitimately +// tracked, legitimately converged database. Declining it would hand that fleet +// a GET_LOCK on every single invocation, forever — the exact saturation the +// fast path was built to remove. +func TestAlreadyConvergedAcceptsATrackedCursorTheOperatorUnignored(t *testing.T) { + db, mock := newMockDB(t) + + expectCurrentDatabase(mock, "testdb") + expectNoMigrationWorkNeeded(mock) + expectDoltIgnoreRead(mock, unqualifiedDoltIgnore, seededIgnorePatterns(LatestVersion())) + expectHeadTableProbe(mock, "", ignoredSource.cursorTable, true) + expectIgnoreResolution(mock, "", ignoredSource.cursorTable, exactlyIgnored(false)) + expectSchemaTableExists(mock, ignoredCursorUntrackTempTable, false) + expectMigrationLockProbe(mock, "testdb", 1) + + converged, err := alreadyConverged(context.Background(), db, "testdb", nil) + if err != nil { + t.Fatalf("alreadyConverged() error = %v", err) + } + if !converged { + t.Fatal("alreadyConverged() = false on a database whose operator deliberately versions the cursor table, want true") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} + +// The fast path's probes fail closed, and this one is no exception. +func TestAlreadyConvergedFailsClosedOnAnUnreadableHeadProbe(t *testing.T) { + db, mock := newMockDB(t) + + expectCurrentDatabase(mock, "testdb") + expectNoMigrationWorkNeeded(mock) + expectDoltIgnoreRead(mock, unqualifiedDoltIgnore, seededIgnorePatterns(LatestVersion())) + mock.ExpectQuery(regexp.QuoteMeta("SHOW TABLES AS OF 'HEAD'")). + WillReturnError(sql.ErrConnDone) + + converged, err := alreadyConverged(context.Background(), db, "testdb", nil) + if err == nil { + t.Fatal("alreadyConverged() error = nil, want the HEAD probe failure") + } + if converged { + t.Fatal("alreadyConverged() = true on an unreadable HEAD probe, want false") + } +} + +// The lock probe's comment requires it to stay LAST — everything above it is +// the cheap steady-state question, and the reconcile gate is now part of that. +func TestAlreadyConvergedKeepsTheLockProbeLast(t *testing.T) { + db, mock := newMockDB(t) + + expectCurrentDatabase(mock, "testdb") + expectNoMigrationWorkNeeded(mock) + expectDoltIgnoreRead(mock, unqualifiedDoltIgnore, seededIgnorePatterns(LatestVersion())) + expectHeadTableProbe(mock, "", ignoredSource.cursorTable, true) + expectIgnoreResolution(mock, "", ignoredSource.cursorTable, exactlyIgnored(true)) + expectSchemaTableExists(mock, ignoredCursorUntrackTempTable, false) + + if _, err := alreadyConverged(context.Background(), db, "testdb", nil); err != nil { + t.Fatalf("alreadyConverged() error = %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations (IS_FREE_LOCK must not run once a cheaper term has already declined): %v", err) + } +} + +// TestMigrateUpCountsAHealAsWork pins the signal the rest of the system reads. +// A heal-only pass applies no numbered migration, but it runs DDL and moves +// HEAD, so reporting 0 told DoltStore.Open not to rebuild the pool it had +// pinned to the pre-migration session root (be-itm5) and told `bd migrate` to +// print "already at vN" right after minting a fleet-visible commit. +func TestMigrateUpCountsAHealAsWork(t *testing.T) { + db, mock := newMockDB(t) + + expectIgnorePatternSeedNoop(mock, LatestVersion()) + expectIgnoredCursorGate(mock, "", true, exactlyIgnored(true), false) + expectIgnoredCursorBackup(mock, len(cursorTableColumns)) + expectIgnoredCursorUnstage(mock) + expectIgnoredCursorUntrackCommit(mock) + expectIgnoredCursorRestore(mock, false) + expectNoMigrationWorkNeeded(mock) + + applied, err := MigrateUp(context.Background(), db) + if err != nil { + t.Fatalf("MigrateUp() error = %v", err) + } + if applied != 1 { + t.Fatalf("MigrateUp() = %d after a heal-only pass, want 1: callers key pool rebuilds and write reporting on this", applied) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } +} diff --git a/internal/storage/schema/lock.go b/internal/storage/schema/lock.go index a3b89205e..a51f9cdfd 100644 --- a/internal/storage/schema/lock.go +++ b/internal/storage/schema/lock.go @@ -58,6 +58,7 @@ type migrateLockOptions struct { freshBootstrapHeal *freshBootstrapHealRequest lockedPreparation *lockedPreparationRequest databaseSelector DatabaseSelector + migrationGate MigrationGate } type freshBootstrapHealRequest struct { @@ -188,6 +189,34 @@ func WithLockedPreparation(endpoint string, fn LockedPreparation) MigrateLockOpt // without this package depending on it. type DatabaseSelector func(ctx context.Context, conn DBConn, databaseName string) (quotedName string, err error) +// MigrationGate decides whether MigrateUpWithLock may apply the migrations it +// found pending. A non-nil error refuses the migration and is returned to the +// caller unchanged, so a typed refusal (*RemoteMigrateGateError) survives +// errors.As at the CLI boundary. +type MigrationGate func(context.Context, *sql.Conn) error + +// WithMigrationGate installs a pre-migration gate for callers whose migration +// runs entirely inside MigrateUpWithLock — the proxied/`bd serve` provider, +// which has no separate pre-open gate hook of the kind internal/storage/dolt +// runs in its own retry loop. +// +// It runs after the migration lock is acquired and after any locked +// preparation, immediately before MigrateUp. That placement is the whole +// design: +// +// - the steady-state alreadyConverged fast path above returns before the +// lock is ever taken, so a converged open pays the gate zero statements; +// - preparation has already CREATEd and USEd the database, so a fresh +// bootstrap reads CurrentVersion == 0 and passes (creating a database is +// consent for its schema); +// - a refusal propagates out through the deferred lock release, so refusing +// cannot leak the lock. +func WithMigrationGate(fn MigrationGate) MigrateLockOption { + return func(o *migrateLockOptions) { + o.migrationGate = fn + } +} + // WithDatabaseSelector lets the convergence probe put the pinned session on // the target database itself. // @@ -276,6 +305,19 @@ func MigrateUpWithLock(ctx context.Context, conn *sql.Conn, databaseName string, } } + // Fresh-bootstrap heal authority is proof that THIS logical open performed + // the exact bare CREATE DATABASE for the incarnation now being migrated — + // so creating it was consent for its schema, and the gate has nothing to + // protect. Checking the capability rather than re-reading the version is + // what makes that hold across a retry: a first pass that died part-way + // leaves a non-zero cursor behind, and a version-only test would then have + // the init refuse to finish migrating the database it just created. + if o.migrationGate != nil && o.freshBootstrapHeal == nil { + if gateErr := o.migrationGate(ctx, conn); gateErr != nil { + return 0, gateErr + } + } + applied, err = MigrateUp(ctx, conn) var dirtyErr *DirtyTablesError if err != nil && o.freshBootstrapHeal != nil && errors.As(err, &dirtyErr) { diff --git a/internal/storage/schema/lock_test.go b/internal/storage/schema/lock_test.go index 5209578cb..481cbe463 100644 --- a/internal/storage/schema/lock_test.go +++ b/internal/storage/schema/lock_test.go @@ -42,6 +42,7 @@ func TestIsMigrationLockError(t *testing.T) { } func TestMigrateUpRunsWithoutAdvisoryLock(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("create sql mock: %v", err) @@ -63,6 +64,7 @@ func TestMigrateUpRunsWithoutAdvisoryLock(t *testing.T) { } func TestMigrateUpWithLockUsesDatabaseScopedLockOnly(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("create sql mock: %v", err) @@ -99,6 +101,7 @@ func TestMigrateUpWithLockUsesDatabaseScopedLockOnly(t *testing.T) { } func TestMigrateUpWithLockPreparationErrorReleasesAndJoinsReleaseFailure(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("create sql mock: %v", err) @@ -153,6 +156,7 @@ func TestMigrateUpWithLockPreparationErrorReleasesAndJoinsReleaseFailure(t *test // capture (`tail -1` in a triage script) cannot see only the generic release // wrapper. Classification is unchanged from the case above. func TestMigrateUpWithLockMigrationErrorNotMaskedByReleaseFailure(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("create sql mock: %v", err) @@ -227,6 +231,7 @@ func TestMigrateUpWithLockMigrationErrorNotMaskedByReleaseFailure(t *testing.T) // copied database is never healed (1 pattern instead of 5, wisp churn in // dolt_status, dirty-gate block on subsequent migrations). func TestMigrateUpSeedsIgnorePatternsWhenNoWorkNeeded(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("create sql mock: %v", err) @@ -234,6 +239,10 @@ func TestMigrateUpSeedsIgnorePatternsWhenNoWorkNeeded(t *testing.T) { defer db.Close() expectIgnorePatternSeed(mock, LatestVersion()) + // #4356: the open-time untrack reconcile runs right after the seed and + // before the no-work short-circuit. On a healthy database it is two reads + // and no writes. + expectIgnoredCursorHealNoop(mock) // migrationWorkNeeded: both cursors at latest, both content_hash columns // present, no custom backfill pending -> no work, MigrateUp short-circuits. expectCursorProbe(mock, "schema_migrations", true) @@ -269,6 +278,7 @@ func TestMigrateUpSeedsIgnorePatternsWhenNoWorkNeeded(t *testing.T) { // the no-work short-circuit must NOT stage or commit dolt_ignore — sqlmock // fails the test on any unexpected DOLT_ADD/DOLT_COMMIT call. func TestMigrateUpSkipsSeedCommitWhenNothingChanged(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("create sql mock: %v", err) @@ -276,6 +286,10 @@ func TestMigrateUpSkipsSeedCommitWhenNothingChanged(t *testing.T) { defer db.Close() expectIgnorePatternSeedNoop(mock, LatestVersion()) + // #4356: the open-time untrack reconcile runs right after the seed and + // before the no-work short-circuit. On a healthy database it is two reads + // and no writes. + expectIgnoredCursorHealNoop(mock) // migrationWorkNeeded: no work, MigrateUp short-circuits. expectCursorProbe(mock, "schema_migrations", true) expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM schema_migrations", "version", LatestVersion()) @@ -360,6 +374,10 @@ func expectOnePendingMigration(t *testing.T, mock sqlmock.Sqlmock) { latestIgnored := LatestIgnoredVersion() expectIgnorePatternSeed(mock, latest-1) + // #4356: the open-time untrack reconcile runs right after the seed and + // before the no-work short-circuit. On a healthy database it is two reads + // and no writes. + expectIgnoredCursorHealNoop(mock) expectCursorProbe(mock, "schema_migrations", true) expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM schema_migrations", "version", latest-1) expectDoltStatusRows(mock) @@ -371,14 +389,23 @@ func expectOnePendingMigration(t *testing.T, mock sqlmock.Sqlmock) { mock.ExpectQuery(regexp.QuoteMeta("CALL DOLT_COMMIT('-m', 'schema: seed dolt_ignore patterns')")). WillReturnRows(sqlmock.NewRows([]string{"hash"})) expectDoltStatusRows(mock) - // MigrateUp probes the aux-rekey crash sentinel (bd-578h9.16); this - // mocked world has no local_metadata table, so no crashed pass. - mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.TABLES`). - WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) - // MigrateUp captures the pre-pass main cursor for the aux re-key - // watershed (bd-578h9.4) before the main migrations run. + // MigrateUp captures the pre-pass main cursor for the aux re-key watershed + // (bd-578h9.4) before the main migrations run — read up front now because the + // dirtyBefore exemption below is derived from it. expectCursorProbe(mock, "schema_migrations", true) expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM schema_migrations", "version", latest-1) + // auxRekeyExemptTables scopes the aux-table dirtyBefore exemption to exactly + // the tables the upcoming re-key rewrites: it reads the ignored cursor to see + // which passes' markers are pending, then each pass's clone-local state. This + // mocked world has no local_metadata table, so each per-pass read stops at + // the existence probe and nothing is exempted. + expectCursorProbe(mock, "ignored_schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", "version", latestIgnored) + expectIgnoredSentinelProbes(mock, true) + for range auxRekeyPasses { + mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.TABLES`). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) + } mock.ExpectExec("(?s)^CREATE TABLE IF NOT EXISTS schema_migrations"). WillReturnResult(sqlmock.NewResult(0, 0)) expectContentHashColumnExists(mock) @@ -424,11 +451,19 @@ func expectOnePendingMigration(t *testing.T, mock sqlmock.Sqlmock) { // no-ops without scanning/updating rows. expectColumnExists(mock, false) expectColumnExists(mock, false) - // rekeyAuxRowIDs reads the ignored cursor to see whether its clone-local - // marker is pending; at latest it is not, so the re-key no-ops. + // rekeyAuxRowIDsAllPasses reads the ignored cursor to see whether any + // pass's clone-local marker is pending; at latest none is. Each pass then + // reads the clone-local re-key state — its crash sentinel and the #4380 + // drift record, either of which would re-admit it; this mocked world has no + // local_metadata table, so each read stops at the table-existence probe and + // the re-key no-ops. expectCursorProbe(mock, "ignored_schema_migrations", true) expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM ignored_schema_migrations", "version", latestIgnored) expectIgnoredSentinelProbes(mock, true) + for range auxRekeyPasses { + mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.TABLES`). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) + } mock.ExpectExec("(?s)^CREATE TABLE IF NOT EXISTS ignored_schema_migrations"). WillReturnResult(sqlmock.NewResult(0, 0)) expectContentHashColumnExists(mock) @@ -517,6 +552,10 @@ func expectDirtyGuardRefusal(t *testing.T, mock sqlmock.Sqlmock) { cursor := eventsFlipVersion - 1 expectIgnorePatternSeedNoop(mock, cursor) + // #4356: the open-time untrack reconcile runs right after the seed and + // before the no-work short-circuit. On a healthy database it is two reads + // and no writes. + expectIgnoredCursorHealNoop(mock) // migrationWorkNeeded: main cursor behind -> work needed (short-circuits). expectCursorProbe(mock, "schema_migrations", true) expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM schema_migrations", "version", cursor) @@ -525,9 +564,20 @@ func expectDirtyGuardRefusal(t *testing.T, mock sqlmock.Sqlmock) { // Nothing staged -> no unstage exec; seed was a no-op -> no seed commit. // committableDirtyTables re-reads dolt_status (ignored tables excluded). expectDoltStatusDirtyEvents(mock) - // auxRekeyResumePending: no local_metadata table, no crashed rekey pass. - mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.TABLES`). - WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) + // MigrateUp captures the pre-pass main cursor up front now (it drives the + // aux-rekey dirtyBefore exemption); the guard refusal is still reached + // before the main migrations run. + expectCursorProbe(mock, "schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM schema_migrations", "version", cursor) + // auxRekeyExemptTables: read the ignored cursor, then each pass's clone-local + // re-key state. No ignored cursor table and no local_metadata here, so + // nothing is exempted — in particular the dirty `events` aux table stays in + // dirtyBefore and still trips the pending-0062 guard below. + expectCursorProbe(mock, "ignored_schema_migrations", false) + for range auxRekeyPasses { + mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.TABLES`). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) + } // pendingMigrationDirtyTables: cursor read, then pending 0062's SQL // touches `events` -> DirtyTablesError. expectCursorProbe(mock, "schema_migrations", true) @@ -568,6 +618,7 @@ func expectFreshBootstrapIdentityMatch(mock sqlmock.Sqlmock) { // as *DirtyTablesError and no DOLT_RESET runs (sqlmock's ordered expectations // fail the test on any unexpected reset call). func TestMigrateUpWithLockDirtyGuardStaysFatalWithoutHeal(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("create sql mock: %v", err) @@ -611,6 +662,7 @@ func TestMigrateUpWithLockDirtyGuardStaysFatalWithoutHeal(t *testing.T) { // interrupted bootstrap's working-set debris and the pass re-runs to // completion on the same session. func TestMigrateUpWithLockFreshBootstrapHealResetsAndRetries(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("create sql mock: %v", err) @@ -788,6 +840,7 @@ func TestMigrateUpWithLockFreshBootstrapHealProbeFailuresStayFatal(t *testing.T) } func TestMigrateUpWithLockFreshBootstrapHealCapabilityIsOneShot(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("create sql mock: %v", err) @@ -815,9 +868,11 @@ func TestMigrateUpWithLockFreshBootstrapHealCapabilityIsOneShot(t *testing.T) { mock.ExpectQuery(regexp.QuoteMeta("CALL DOLT_RESET('--hard')")). WillReturnRows(sqlmock.NewRows([]string{"status"})) // The reset returns to the v60 HEAD used by expectDirtyGuardRefusal. The - // rerun repeats main's unconditional ignore-pattern seed before reaching - // migrationWorkNeeded, where the injected transient failure occurs. + // rerun repeats main's unconditional ignore-pattern seed and the #4356 + // reconcile gate before reaching migrationWorkNeeded, where the injected + // transient failure occurs. expectIgnorePatternSeedNoop(mock, LatestVersion()-2) + expectIgnoredCursorHealNoop(mock) expectCursorProbe(mock, "schema_migrations", true) expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM schema_migrations", "version", LatestVersion()-2) mock.ExpectQuery("(?s)SELECT s\\.table_name, s\\.staged\\s+FROM dolt_status s"). @@ -858,3 +913,154 @@ func TestMigrateUpWithLockFreshBootstrapHealCapabilityIsOneShot(t *testing.T) { t.Fatalf("unmet SQL expectations: %v", err) } } + +// TestMigrateUpWithLockMigrationGate pins where WithMigrationGate's callback +// sits: after the lock and after locked preparation (so the gate reads a +// prepared, selected database), before MigrateUp (so a refusal applies no +// migration), and inside the deferred release (so refusing cannot leak the +// lock). +func TestMigrateUpWithLockMigrationGate(t *testing.T) { + t.Run("refusal stops before MigrateUp and releases the lock", func(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("create sql mock: %v", err) + } + defer db.Close() + + ctx := context.Background() + conn, err := db.Conn(ctx) + if err != nil { + t.Fatalf("pin mock connection: %v", err) + } + defer conn.Close() + + lockName := MigrationLockName("testdb") + expectConvergedFastPathMiss(mock, "testdb") + mock.ExpectQuery(regexp.QuoteMeta("SELECT GET_LOCK(?, ?)")). + WithArgs(lockName, migrationLockAcquireTimeoutSeconds). + WillReturnRows(sqlmock.NewRows([]string{"locked"}).AddRow(1)) + // No migration statements between here and the release: the refusal + // must land before MigrateUp issues its first one. + mock.ExpectQuery(regexp.QuoteMeta("SELECT RELEASE_LOCK(?)")). + WithArgs(lockName). + WillReturnRows(sqlmock.NewRows([]string{"released"}).AddRow(1)) + + refusal := &RemoteMigrateGateError{CurrentVersion: 1, LatestVersion: 2, Pending: 1, Decision: gateDecisionSharedNoRemote} + prepared := 0 + gated := 0 + applied, err := MigrateUpWithLock(ctx, conn, "testdb", + WithDatabaseSelector(testDatabaseSelector), + WithLockedPreparation("tcp:test", func(context.Context, *sql.Conn) (*FreshBootstrapHealCapability, error) { + prepared++ + if gated != 0 { + t.Error("the gate ran before locked preparation; it must read a prepared database") + } + return nil, nil + }), + WithMigrationGate(func(context.Context, *sql.Conn) error { + gated++ + return refusal + })) + if applied != 0 { + t.Fatalf("MigrateUpWithLock() applied = %d, want 0", applied) + } + if prepared != 1 || gated != 1 { + t.Fatalf("preparation calls = %d, gate calls = %d, want 1 and 1", prepared, gated) + } + var gateErr *RemoteMigrateGateError + if !errors.As(err, &gateErr) || gateErr != refusal { + t.Fatalf("MigrateUpWithLock() error = %v, want the gate refusal unwrapped", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } + }) + + // Regression: the gate must not fire on an init that CREATED this + // database. Gating on the version alone was not enough — a first pass that + // died part-way leaves a non-zero cursor, so the retry read "existing + // database, migrations pending" and the init refused to finish migrating + // the database it had just created (caught by uow's #5012 self-heal test). + // Heal authority is the durable proof of creation, so it is what the skip + // keys on. + t.Run("fresh-bootstrap heal authority skips the gate", func(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("create sql mock: %v", err) + } + defer db.Close() + + ctx := context.Background() + conn, err := db.Conn(ctx) + if err != nil { + t.Fatalf("pin mock connection: %v", err) + } + defer conn.Close() + + lockName := MigrationLockName("testdb") + mock.ExpectQuery(regexp.QuoteMeta("SELECT GET_LOCK(?, ?)")). + WithArgs(lockName, migrationLockAcquireTimeoutSeconds). + WillReturnRows(sqlmock.NewRows([]string{"locked"}).AddRow(1)) + expectOnePendingMigration(t, mock) + mock.ExpectQuery(regexp.QuoteMeta("SELECT RELEASE_LOCK(?)")). + WithArgs(lockName). + WillReturnRows(sqlmock.NewRows([]string{"released"}).AddRow(1)) + + gated := 0 + applied, err := MigrateUpWithLock(ctx, conn, "testdb", + WithFreshBootstrapHeal(testFreshBootstrapHealCapability(), testBootstrapEndpoint), + WithMigrationGate(func(context.Context, *sql.Conn) error { + gated++ + return errors.New("the gate must not run on a database this init created") + })) + if err != nil { + t.Fatalf("MigrateUpWithLock() error = %v", err) + } + if applied != 1 { + t.Fatalf("MigrateUpWithLock() applied = %d, want 1", applied) + } + if gated != 0 { + t.Fatalf("gate calls = %d, want 0 — creating a database is consent for its schema", gated) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } + }) + + t.Run("converged fast path never reaches the gate", func(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("create sql mock: %v", err) + } + defer db.Close() + + ctx := context.Background() + conn, err := db.Conn(ctx) + if err != nil { + t.Fatalf("pin mock connection: %v", err) + } + defer conn.Close() + + expectConvergedProbe(mock, "testdb") + + gated := 0 + applied, err := MigrateUpWithLock(ctx, conn, "testdb", + WithDatabaseSelector(testDatabaseSelector), + WithMigrationGate(func(context.Context, *sql.Conn) error { + gated++ + return errors.New("the gate must not run on a converged database") + })) + if err != nil { + t.Fatalf("MigrateUpWithLock() error = %v", err) + } + if applied != 0 { + t.Fatalf("MigrateUpWithLock() applied = %d, want 0", applied) + } + if gated != 0 { + t.Fatalf("gate calls = %d, want 0 — the steady-state open must cost the gate nothing", gated) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } + }) +} diff --git a/internal/storage/schema/migration_0067_versioned_beads_test.go b/internal/storage/schema/migration_0067_versioned_beads_test.go index c4f95c6d0..eb32c7378 100644 --- a/internal/storage/schema/migration_0067_versioned_beads_test.go +++ b/internal/storage/schema/migration_0067_versioned_beads_test.go @@ -67,7 +67,7 @@ func TestMigration0067AddsVersionedBeadsSchema(t *testing.T) { "ALTER TABLE issues ADD COLUMN current_revision BIGINT NOT NULL DEFAULT 1", // Shape parity with issues, identical type. Nothing reads or writes // this column in any phase — see the migration header's asymmetry - // note and ignored/0026. + // note and ignored/0027. "ALTER TABLE wisps ADD COLUMN current_revision BIGINT NOT NULL DEFAULT 1", // Both ALTERs are INFORMATION_SCHEMA-guarded so a raw replay no-ops. "COLUMN_NAME = 'current_revision'", @@ -184,7 +184,7 @@ func TestMigration0067AddsVersionedBeadsSchemaThroughDoltCLI(t *testing.T) { // current_revision on BOTH planes. issues.current_revision is the // fast-path CAS column later phases read and write; wisps.current_revision // is shape parity only (nothing ever reads or writes it — see the - // migration header and ignored/0026), and it is asserted here for exactly + // migration header and ignored/0027), and it is asserted here for exactly // the reason the parity oracle exists: the two planes share // column-list-shaped code paths, so the shape obligation is real even // where the semantics are not. Same type on both, or diff --git a/internal/storage/schema/migration_repairs.go b/internal/storage/schema/migration_repairs.go index 742c17845..40b463ba0 100644 --- a/internal/storage/schema/migration_repairs.go +++ b/internal/storage/schema/migration_repairs.go @@ -80,8 +80,22 @@ const nonlocalFrozenRowsValues = "('wisps', 'main', 'immediate'), ('wisp_*', 'ma // as the pass expects to find it. --skip-empty keeps the commit a clean no-op // if the edit staged nothing. func commitNonlocalRepair(ctx context.Context, db DBConn, message string) error { - if err := DrainCall(ctx, db, "CALL DOLT_ADD(?)", nonlocalTablesName); err != nil { - return fmt.Errorf("staging %s: %w", nonlocalTablesName, err) + return commitScopedTableChange(ctx, db, nonlocalTablesName, message) +} + +// commitScopedTableChange stages exactly one table by name and commits it. +// Both the version-40/41 repairs and the #4356 untrack reconcile need the same +// thing — a labeled commit that carries their table and nothing else — for the +// same two reasons, so the recipe lives here rather than in each of them: +// DOLT_COMMIT('-Am', …) would sweep an unrelated working set into a +// repair-labeled commit, and --skip-empty keeps a replay a clean no-op instead +// of dying on "nothing to commit". +// +// It does NOT clear the staging area; a caller with anything possibly staged +// must unstage first (see unstagePreExistingTables). +func commitScopedTableChange(ctx context.Context, db DBConn, table, message string) error { + if err := DrainCall(ctx, db, "CALL DOLT_ADD(?)", table); err != nil { + return fmt.Errorf("staging %s: %w", table, err) } return DrainCall(ctx, db, "CALL DOLT_COMMIT('-m', ?, '--skip-empty')", message) } diff --git a/internal/storage/schema/migrations/ignored/0026_dep_rekey_dedup_marker.up.sql b/internal/storage/schema/migrations/ignored/0026_dep_rekey_dedup_marker.up.sql new file mode 100644 index 000000000..b3600afb5 --- /dev/null +++ b/internal/storage/schema/migrations/ignored/0026_dep_rekey_dedup_marker.up.sql @@ -0,0 +1,36 @@ +-- Ignored migration 0026: clone-local marker that forces one dependency-id +-- re-key pass with the duplicate-edge merge (gastownhall/beads#5268). +-- +-- rekeyDependencyIDs (internal/storage/schema/dep_id_backfill.go) converges the +-- per-clone-random dependency ids that migration 0043's DEFAULT (UUID()) minted, +-- the data half of the #4259 fix. Until 1.3.0 it rewrote ids one row at a time +-- with no awareness of the ids already in the table, so a database holding the +-- same logical edge in two typed target columns -- legal, because depid keys on +-- (issue_id, resolved target) while uk_dep_issue_target / uk_dep_wisp_target / +-- uk_dep_external_target are per-column -- aborted mid-table with "duplicate +-- primary key given". The numbered migrations and their cursor rows commit +-- per-step, before the re-key tail runs, so the abort left the main cursor +-- durably at latest with only part of the table re-keyed: migrationWorkNeeded +-- then reported no work and the re-key never ran again. +-- +-- While this version is still pending, migrationWorkNeeded returns true, so +-- every existing clone runs exactly one more MigrateUp pass and the fixed +-- (merge-aware) re-key heals it, including the clones that a pre-1.3.0 binary +-- left half-re-keyed at the latest main version. The pass is cheap on a +-- converged database: the re-key scan finds nothing to change and writes +-- nothing, which is why this marker needs none of the shipped-main-version +-- gating the aux-row-id passes carry (ignored 0009 / 0018) -- the dependency +-- re-key already ran on every migration pass before this change. +-- +-- Recording the marker AFTER the re-key step is the other half of the fix: +-- ignoredSource.migrate runs later in MigrateUp than rekeyDependencyIDs, so a +-- re-key that fails for any reason leaves this version unrecorded and the pass +-- is retried on the next open instead of a database claiming it migrated. +-- +-- The cursor table is dolt-ignored, so the marker is clone-local by +-- construction: every clone performs its own convergence pass, which is safe +-- precisely because the derivation and the duplicate-merge rule are both +-- deterministic functions of table content. +-- +-- The marker itself changes nothing. +SELECT 1; diff --git a/internal/storage/schema/migrations/ignored/0026_add_wisps_current_revision.up.sql b/internal/storage/schema/migrations/ignored/0027_add_wisps_current_revision.up.sql similarity index 77% rename from internal/storage/schema/migrations/ignored/0026_add_wisps_current_revision.up.sql rename to internal/storage/schema/migrations/ignored/0027_add_wisps_current_revision.up.sql index 4f8eac35e..2468f789f 100644 --- a/internal/storage/schema/migrations/ignored/0026_add_wisps_current_revision.up.sql +++ b/internal/storage/schema/migrations/ignored/0027_add_wisps_current_revision.up.sql @@ -1,6 +1,14 @@ --- Ignored migration 0026: ensure wisps.current_revision exists on every clone +-- Ignored migration 0027: ensure wisps.current_revision exists on every clone -- (be-hs42e.2 / gastownhall/beads#6134). -- +-- Numbered 0026 on main until the v1.3.0 forward-port merge, which brought in +-- release/1.3.0's own 0026 (dep_rekey_dedup_marker). That one is in the +-- shipped v1.3.0 tag, so field stores have already recorded it at ordinal 26 +-- and it can never move; this one had not shipped in any release, so it moved +-- here. Clones that applied it at 26 from a main build re-run it at 27, which +-- the guard below makes a no-op, and the pending-27 pass is also what keeps +-- 0026's forced re-key pass reaching them. +-- -- Synced migration 0067 adds current_revision to issues and wisps — but wisps -- is dolt-ignored (migration 0019), so its schema is clone-local, and a -- workspace that bootstraps or re-clones from a remote whose diff --git a/internal/storage/schema/remote_migrate_gate.go b/internal/storage/schema/remote_migrate_gate.go index dcff8ef2a..15848928b 100644 --- a/internal/storage/schema/remote_migrate_gate.go +++ b/internal/storage/schema/remote_migrate_gate.go @@ -17,6 +17,13 @@ import ( // otherwise fire, so exporting it permanently does not warn on every store open. // The CLI-flag twin `bd migrate --force` is the preferred interactive form; // this env var remains supported for scripted/CI use. +// +// It also unlocks the shared-store arm below, where a shared database has NO +// remote at all — "REMOTE" in the name is then a wart. It is deliberate: this +// is the single knob operators and CI already export for exactly this +// semantic ("I am the designated migrator; apply pending migrations to a +// database other clients depend on"), and a second variable would multiply +// the escape-hatch surface for no new meaning. const AllowRemoteMigrateEnv = "BD_ALLOW_REMOTE_MIGRATE" // forceAllowRemoteMigrate is the programmatic (in-process) twin of @@ -32,6 +39,22 @@ var forceAllowRemoteMigrate bool // open. External test packages may reset it to false after each test case. func SetForceAllowRemoteMigrate(v bool) { forceAllowRemoteMigrate = v } +// sharedMigrateConsent records that the operator typed the migrate verb +// itself. It unlocks ONLY the shared-store-without-a-remote arm of the gate: +// with no remote there is no cross-clone fork to risk, so the single hazard is +// locking out co-resident clients of the same server — a hazard the operator +// accepts by asking for a migration by name. A remote-backed database still +// needs --force / AllowRemoteMigrateEnv, because #4259 coordination is a +// stronger, different contract. +var sharedMigrateConsent bool + +// SetSharedMigrateConsent sets (or clears) the verb consent above. Like +// SetForceAllowRemoteMigrate it is set unconditionally (set-or-clear) in the +// root PersistentPreRunE, before both autoMigrateOnVersionBump and the store +// open, and is process-local so it cannot leak into child processes. External +// test packages may reset it to false after each test case. +func SetSharedMigrateConsent(v bool) { sharedMigrateConsent = v } + // RemoteMigrateGateError is returned when bd is about to auto-apply pending // schema migrations to an existing database that has a remote configured. // @@ -43,6 +66,14 @@ func SetForceAllowRemoteMigrate(v bool) { forceAllowRemoteMigrate = v } // migrated database from the remote". This gate refuses the silent in-place // migration and makes the operator choose migrate vs. adopt. It applies to both // server mode and embedded mode (the mode the original report was filed against). +// +// The type also carries the shared-store refusal (Decision "shared-no-remote", +// gastownhall/beads#5920), where there is no remote at all and the hazard is +// co-resident clients of one server rather than forked clones. The name is +// imperfect for that arm; every consumer — the server retry loop's permanence +// classification, embedded's lenient handling, the CLI text and JSON +// rendering, the AgentDirective/Options contract — already handles this type, +// and a parallel error universe would cost far more than the imprecise name. type RemoteMigrateGateError struct { CurrentVersion int LatestVersion int @@ -73,6 +104,13 @@ type RemoteMigrateGateError struct { // for the recognized values. Always empty when Decision is "adopt", // "adopt-ff", or "fork-skew" — those stops already explain themselves. FallbackReason string + // Shared marks a refusal that came from a database served to co-resident + // bd clients (gastownhall/beads#5920). It is set on EVERY arm of the + // shared gate, not just "shared-no-remote": the remote-backed arms keep + // their #4259 decisions, but their remedies carry an extra consequence + // there — adopting or migrating promotes the schema for every client of + // the server at once — so the guidance has to say so. + Shared bool // UnrecognizedSmartGateEnv carries a BD_SMART_GATE value that was set but // not understood (only boolean values are recognized), mirroring // UnrecognizedEnv above but for the smart gate's own opt-out variable, so @@ -90,6 +128,13 @@ const ( // working set — adopting is loss-free, unlike a plain adopt. gateDecisionAdoptFastForward = "adopt-ff" gateDecisionForkSkew = "fork-skew" + // gateDecisionSharedNoRemote (gastownhall/beads#5920): the database is + // shared with co-resident bd clients (a dolt sql-server, directly or + // through proxied-server mode) and has NO remote, so there is no fork to + // reason about — but migrating still promotes the schema cursor for every + // client at once and locks out each one still on an older binary. Unlocked + // by the migrate verb, --force, or AllowRemoteMigrateEnv. + gateDecisionSharedNoRemote = "shared-no-remote" ) // fallbackReason* enumerates why the smart gate (#4516) fell back to the @@ -111,6 +156,11 @@ const ( // recognized boolean, so the gate stayed enabled by default (same as // unset) but still could not resolve this particular stop. fallbackReasonUnparseableEnv = "unparseable-env" + // fallbackReasonSharedStore (gastownhall/beads#5920): the smart gate + // resolved a safe first-mover migrate, but this store is shared, so + // auto-executing it would promote the schema for every co-resident client. + // Structural, not a routing outcome — it outranks the other reasons. + fallbackReasonSharedStore = "shared-store" ) func (e *RemoteMigrateGateError) Error() string { @@ -128,6 +178,9 @@ func (e *RemoteMigrateGateError) Error() string { case gateDecisionForkSkew: return fmt.Sprintf("refusing to migrate a remote-backed database (v%d -> v%d): this clone and the remote applied different content for migration(s) %s — the schema has already forked (#4259)", e.CurrentVersion, e.LatestVersion, FormatMigrationVersions(e.SkewVersions)) + case gateDecisionSharedNoRemote: + return fmt.Sprintf("refusing to auto-apply %d pending schema %s to a shared server database (v%d -> v%d): migrating would lock out every co-resident bd client still on the old schema (#5920)", + e.Pending, unit, e.CurrentVersion, e.LatestVersion) default: return fmt.Sprintf("refusing to auto-apply %d pending schema %s to a remote-backed database (v%d -> v%d): migrating clones independently forks the schema (#4259)", e.Pending, unit, e.CurrentVersion, e.LatestVersion) @@ -174,6 +227,8 @@ func (e *RemoteMigrateGateError) fallbackReasonNote() string { why = "it is disabled (" + SmartGateEnv + "=0)" case fallbackReasonUnparseableEnv: why = SmartGateEnv + "=" + e.UnrecognizedSmartGateEnv + " is set but was not recognized (only boolean values enable/disable it), so it stayed enabled by default but still could not resolve this stop" + case fallbackReasonSharedStore: + why = "this store is shared (dolt sql-server); the first-mover auto-migrate is disabled here because it would lock out co-resident clients (#5920)" default: return "" } @@ -200,6 +255,28 @@ func (e *RemoteMigrateGateError) userBody() string { " bd bootstrap\n" + " Unlike the usual re-clone, this clone has no unpushed commits and no\n" + " uncommitted local changes to discard.\n" + case gateDecisionSharedNoRemote: + return "\n" + + " This database is served to multiple clients (dolt sql-server /\n" + + " proxied-server mode). Applying schema migrations promotes the schema\n" + + " version for EVERY client at once: bd clients still running an older\n" + + " version will refuse this database until they are upgraded.\n" + + "\n" + + " To migrate (explicit consent):\n" + + " 1. Upgrade bd on every client of this server first (or accept that\n" + + " older clients refuse until they are upgraded).\n" + + " 2. Then run, once, from a workspace already set up against this\n" + + " server:\n" + + " " + SharedConsentCommand + "\n" + + " (" + SharedConsentCommandGlobal + " for the shared global database;\n" + + " " + AllowRemoteMigrateEnv + "=1 bd in scripted/CI use)\n" + + "\n" + + " Read commands keep working against the current schema in the meantime;\n" + + " writes stay refused until the schema is migrated.\n" + + "\n" + + " If the migration then reports dirty tables, that working set has to be\n" + + " committed first — see the recovery the dirty-table error names; do not\n" + + " re-run this command in a loop.\n" case gateDecisionForkSkew: return "\n" + " This clone and the remote already applied DIFFERENT content for migration(s) " + @@ -239,6 +316,11 @@ func (e *RemoteMigrateGateError) userBody() string { // EscapeHint returns the escape-hatch string for JSON error output. func (e *RemoteMigrateGateError) EscapeHint() string { + if e.Decision == gateDecisionSharedNoRemote { + // No remote, so there is no designated-migrator coordination to force + // past: typing the verb IS the consent. + return SharedConsentCommand + } return "bd migrate --force" } @@ -266,6 +348,12 @@ func (e *RemoteMigrateGateError) AgentDirective() string { FormatMigrationVersions(e.SkewVersions) + " — the schema has forked (#4259) and migrating cannot un-fork it. " + "Resolving requires picking a canonical clone and re-bootstrapping the others, discarding their unpushed " + "work — a data-loss decision. Surface remote_migrate_gate.options to the operator; do NOT auto-run anything." + case gateDecisionSharedNoRemote: + return "Coordination decision required: this database is shared with co-resident bd clients, and migrating " + + "promotes the schema for all of them at once — every client still on an older bd refuses the database " + + "until it is upgraded (#5920). Other clients' binary versions are not observable from this process, so " + + "do NOT auto-run the migration: surface remote_migrate_gate.options to the operator and let them confirm " + + "the fleet is upgraded first. Reads keep working on the current schema meanwhile." default: return "Coordination decision required: only ONE clone may migrate a shared remote; " + "a second clone migrating independently forks the schema unrecoverably (#4259). " + @@ -289,11 +377,20 @@ type GateOption struct { // present but reachable only through its "single designated migrator" condition, // never as a top-level hint. func (e *RemoteMigrateGateError) Options() []GateOption { + // On a shared store every remedy below lands on the database the whole + // server is serving, so each one's risk gains a consequence that has + // nothing to do with local data (gastownhall/beads#5920). Adopting is the + // case that reads most wrong without it: its risk is otherwise annotated + // purely in terms of what this machine loses. + sharedRisk := "" + if e.Shared { + sharedRisk = "; on this shared server it also promotes the schema for every co-resident client, and clients still on an older bd will refuse the database until upgraded" + } adopt := GateOption{ ID: "adopt", When: "another machine has already migrated and pushed", Commands: []string{"bd bootstrap"}, - Risk: "re-clones and replaces the local database; push or export unpushed work first or it is lost", + Risk: "re-clones and replaces the local database; push or export unpushed work first or it is lost" + sharedRisk, } switch e.Decision { case gateDecisionAdopt: @@ -303,11 +400,18 @@ func (e *RemoteMigrateGateError) Options() []GateOption { case gateDecisionAdoptFastForward: // Remote is confirmed ahead AND this clone is a strict ancestor with a // clean working set: adopting is loss-free, unlike the plain-adopt case. + // "Risk: none" is a statement about LOCAL data, and it stays true — + // but on a shared store it is not the whole risk, and an agent reading + // only this field would treat the adopt as free. + ffRisk := "none — this clone's local history is a strict ancestor of the remote's, so nothing local is discarded" + if e.Shared { + ffRisk = "nothing local is discarded (this clone's history is a strict ancestor of the remote's), but on this shared server the adopted schema is promoted for every co-resident client, and clients still on an older bd will refuse the database until upgraded" + } return []GateOption{{ ID: "adopt-fast-forward", When: "the remote is already migrated and this clone can fast-forward to it losslessly (no unpushed commits, clean working set)", Commands: []string{"bd bootstrap"}, - Risk: "none — this clone's local history is a strict ancestor of the remote's, so nothing local is discarded", + Risk: ffRisk, }} case gateDecisionForkSkew: // Already forked: neither migrate nor a plain adopt is unconditionally @@ -318,6 +422,15 @@ func (e *RemoteMigrateGateError) Options() []GateOption { Commands: []string{"bd export --all -o backup.jsonl", "bd bootstrap"}, Risk: "re-bootstrapping the non-canonical clones discards their unpushed work; export it first", }} + case gateDecisionSharedNoRemote: + // No remote means no adopt path — the database is the single copy every + // client shares. The only question is whether the fleet is ready. + return []GateOption{{ + ID: "migrate-shared", + When: "every co-resident bd client of this server is upgraded to this binary (confirmed with the operator), run from a workspace already set up against this server", + Commands: []string{SharedConsentCommand}, + Risk: "co-resident clients still on an older bd will refuse this database until upgraded", + }} default: return []GateOption{ { @@ -346,7 +459,7 @@ func IsRemoteMigrateGateError(err error) bool { // store open. Embedded mode uses this form: its dolt_remotes table already // reflects remotes persisted in .dolt/config on a fresh open. func CheckRemoteMigrateGate(ctx context.Context, db DBConn) error { - return checkRemoteMigrateGate(ctx, db, "", nil, nil) + return checkRemoteMigrateGate(ctx, db, "", nil, nil, false) } // CheckRemoteMigrateGateWithAdopt is CheckRemoteMigrateGate plus the injected @@ -357,46 +470,55 @@ func CheckRemoteMigrateGate(ctx context.Context, db DBConn) error { // behaves exactly as CheckRemoteMigrateGate. Embedded mode uses this form // alongside CheckRemoteMigrateGate's no-remote-name default. func CheckRemoteMigrateGateWithAdopt(ctx context.Context, db DBConn, adopt *FastForwardAdopter) error { - return checkRemoteMigrateGate(ctx, db, "", nil, adopt) -} - -// CheckRemoteMigrateGateWithRemoteCheck is CheckRemoteMigrateGate plus an on-disk -// fallback remote probe. When the dolt_remotes SQL table reports no remote, -// extraHasRemote is consulted and a true result still trips the gate. -// -// Server mode needs this: a freshly (auto-)started dolt sql-server starts with an -// empty dolt_remotes table and only re-registers CLI remotes from .dolt/config -// later, during the post-open sync (GH#2315). Because this gate runs before that -// sync, the SQL-only check would see no remote on the first write open after an -// upgrade and silently migrate the shared database in place — exactly the -// cross-clone fork #4259 is meant to prevent. extraHasRemote (a probe of the -// persisted CLI remotes) closes that window. -// -// extraHasRemote is only invoked when the database has a pending migration AND the -// SQL table shows no remote, so the (subprocess-backed) filesystem probe stays off -// the common open path. A nil extraHasRemote disables the fallback. -func CheckRemoteMigrateGateWithRemoteCheck(ctx context.Context, db DBConn, extraHasRemote func() bool) error { - return checkRemoteMigrateGate(ctx, db, "", extraHasRemote, nil) -} - -// CheckRemoteMigrateGateForRemoteWithRemoteCheck is CheckRemoteMigrateGate plus -// an explicit sync remote name for the smart gate's cached remote-ref read. -// The blunt gate still trips when any Dolt remote exists; the remote name only -// chooses which remote-tracking ref the opt-in smart router compares against. -func CheckRemoteMigrateGateForRemoteWithRemoteCheck(ctx context.Context, db DBConn, remoteName string, extraHasRemote func() bool) error { - return checkRemoteMigrateGate(ctx, db, remoteName, extraHasRemote, nil) + return checkRemoteMigrateGate(ctx, db, "", nil, adopt, false) } // CheckRemoteMigrateGateForRemoteWithRemoteCheckAndAdopt is -// CheckRemoteMigrateGateForRemoteWithRemoteCheck plus the injected -// fast-forward ancestry callbacks (mybd-ae1i piece 2); see -// CheckRemoteMigrateGateWithAdopt. Server mode uses this form: it already has -// both a configured sync remote and the on-disk remote-check fallback. +// CheckRemoteMigrateGateWithAdopt plus an explicit sync remote name for the +// smart gate's cached remote-ref read and an on-disk fallback remote probe. +// +// The remote name only chooses which remote-tracking ref the opt-in smart +// router compares against; the blunt gate still trips when any Dolt remote +// exists. extraHasRemote covers the window where dolt_remotes reads empty +// even though a remote is configured: a freshly (auto-)started dolt +// sql-server re-registers CLI remotes from .dolt/config only later, during the +// post-open sync (GH#2315), so an SQL-only check would see no remote on the +// first write open after an upgrade. It is consulted only when the database +// has a pending migration AND the SQL table shows no remote, so the +// (subprocess-backed) filesystem probe stays off the common open path; a nil +// extraHasRemote disables the fallback. +// +// This is the non-shared form of what server mode now calls through +// CheckSharedStoreMigrateGate, and it is what internal/storage/dolt's +// smart-gate tests exercise to pin the embedded-semantics routing that the +// shared form deliberately narrows. Two thinner wrappers of the same shape +// were deleted with the swap to the shared gate: they had no callers left. func CheckRemoteMigrateGateForRemoteWithRemoteCheckAndAdopt(ctx context.Context, db DBConn, remoteName string, extraHasRemote func() bool, adopt *FastForwardAdopter) error { - return checkRemoteMigrateGate(ctx, db, remoteName, extraHasRemote, adopt) + return checkRemoteMigrateGate(ctx, db, remoteName, extraHasRemote, adopt, false) } -func checkRemoteMigrateGate(ctx context.Context, db DBConn, remoteName string, extraHasRemote func() bool, adopt *FastForwardAdopter) error { +// CheckSharedStoreMigrateGate is the gate for a database that is served to +// co-resident bd clients — an internal/storage/dolt sql-server store, or the +// proxied/`bd serve` unit-of-work provider. It adds two refusals on top of the +// remote-backed #4259 flow (gastownhall/beads#5920): +// +// - With NO remote, where the ordinary gate allows a silent in-place +// migration, it refuses unless the operator consented (the migrate verb, +// --force, or AllowRemoteMigrateEnv). Promoting the schema cursor on a +// shared server locks out every co-resident client still on an older bd. +// - With a remote, it suppresses the smart gate's two auto-EXECUTE arms +// (first-mover auto-migrate and auto-fast-forward). Both were written for +// a clone this process owns; on a shared server neither can observe the +// other clients, and the first-mover arm firing is exactly the #5920 +// mechanism. The refusal directives are unchanged. +// +// A fresh database (current == 0) still migrates: creating a database is +// consent for its schema. +func CheckSharedStoreMigrateGate(ctx context.Context, db DBConn, remoteName string, extraHasRemote func() bool, adopt *FastForwardAdopter) error { + return checkRemoteMigrateGate(ctx, db, remoteName, extraHasRemote, adopt, true) +} + +func checkRemoteMigrateGate(ctx context.Context, db DBConn, remoteName string, extraHasRemote func() bool, adopt *FastForwardAdopter, shared bool) error { // CurrentVersion treats a missing schema_migrations table as version 0, so a // brand-new database falls through the current==0 check below — nothing to fork. current, err := CurrentVersion(ctx, db) @@ -426,40 +548,23 @@ func checkRemoteMigrateGate(ctx context.Context, db DBConn, remoteName string, e hasRemote = extraHasRemote() } if !hasRemote { - return nil // no remote — no cross-clone fork risk + if !shared { + return nil // no remote — no cross-clone fork risk + } + // A shared store has co-resident clients whether or not it has a + // remote, and migrating promotes the schema cursor for all of them at + // once (gastownhall/beads#5920). + return sharedNoRemoteGate(current, len(pending)) } - // Programmatic override — set by `bd migrate --force` / `bd migrate schema - // --force` in the root PersistentPreRunE before both - // autoMigrateOnVersionBump and the main store open. Process-local by - // design: unlike os.Setenv(AllowRemoteMigrateEnv), it cannot leak into - // child processes (git hooks, dolt subprocesses). Consulted here — only - // once the gate would otherwise fire — so normal opens produce no noise. - if forceAllowRemoteMigrate { + consent := forceOrEnvConsent() + if consent.allowed { fmt.Fprintf(os.Stderr, - "Warning: applying %d pending schema migration(s) to a remote-backed database (bd migrate --force); only one clone should migrate, then `bd dolt push`\n", - len(pending)) + "Warning: applying %d pending schema migration(s) to a remote-backed database (%s); only one clone should migrate, then `bd dolt push`\n", + len(pending), consent.how) return nil } - - // Escape hatch — consulted only once the gate would actually fire, so an - // operator who exports it in a shell profile is not warned on every store - // open with nothing pending or no remote (bd-6dnrw.34). Any boolean true - // ("1", "true", "TRUE", ...) unlocks; a set-but-unparseable value is - // surfaced in the gate error instead of silently staying locked. - unrecognizedEnv := "" - if v := os.Getenv(AllowRemoteMigrateEnv); v != "" { - if allowed, perr := strconv.ParseBool(v); perr == nil { - if allowed { - fmt.Fprintf(os.Stderr, - "Warning: applying %d pending schema migration(s) to a remote-backed database (%s=%s); only one clone should migrate, then `bd dolt push`\n", - len(pending), AllowRemoteMigrateEnv, v) - return nil - } - } else { - unrecognizedEnv = v - } - } + unrecognizedEnv := consent.unrecognizedEnv latest := LatestVersion() @@ -483,6 +588,14 @@ func checkRemoteMigrateGate(ctx context.Context, db DBConn, remoteName string, e decision, skew, ref, atLatest := routeSmartGate(ctx, db, current, latest, remoteName, adopt) switch decision { case smartAutoMigrate: + // The safe-first-mover argument is about clones, not clients: it + // proves nothing about the co-resident bd processes attached to + // this same server, and auto-executing it here IS the #5920 + // mechanism. Fall through to the blunt stop, naming why. + if shared { + fallbackReason = fallbackReasonSharedStore + break + } smartGateAllowMigrate(len(pending), current) return nil case smartAdopt: @@ -491,6 +604,7 @@ func checkRemoteMigrateGate(ctx context.Context, db DBConn, remoteName string, e LatestVersion: latest, Pending: len(pending), UnrecognizedEnv: unrecognizedEnv, + Shared: shared, Decision: gateDecisionAdopt, } case smartAdoptFastForward: @@ -503,7 +617,11 @@ func checkRemoteMigrateGate(ctx context.Context, db DBConn, remoteName string, e // #4259 fork risk this gate exists to prevent. Landing past // latest would mean a newer binary already migrated the remote // further than this one understands (#4135/#4137 class). - if atLatest && canAutoFastForward(adopt) { + // Suppressed on a shared store for the same reason as the + // first-mover arm above: the fast-forward is a WRITE that promotes + // the schema for every co-resident client. The adopt-ff refusal + // directive below is still accurate and still offered. + if !shared && atLatest && canAutoFastForward(adopt) { // attemptFastForward re-verifies the ancestry/clean/ // remoteMax-at-latest preconditions in this SAME db session // immediately before the write (TOCTOU guard) and performs @@ -522,6 +640,7 @@ func checkRemoteMigrateGate(ctx context.Context, db DBConn, remoteName string, e LatestVersion: latest, Pending: len(pending), UnrecognizedEnv: unrecognizedEnv, + Shared: shared, Decision: gateDecisionAdopt, } } @@ -537,6 +656,7 @@ func checkRemoteMigrateGate(ctx context.Context, db DBConn, remoteName string, e LatestVersion: latest, Pending: len(pending), UnrecognizedEnv: unrecognizedEnv, + Shared: shared, Decision: gateDecisionAdoptFastForward, } case smartForkSkew: @@ -545,6 +665,7 @@ func checkRemoteMigrateGate(ctx context.Context, db DBConn, remoteName string, e LatestVersion: latest, Pending: len(pending), UnrecognizedEnv: unrecognizedEnv, + Shared: shared, Decision: gateDecisionForkSkew, SkewVersions: skew, } @@ -556,8 +677,11 @@ func checkRemoteMigrateGate(ctx context.Context, db DBConn, remoteName string, e // An unparseable BD_SMART_GATE value defaults to enabled (same as // unset), so routing above still ran — but it is a more actionable // fact for the operator than the technical routing outcome, so it - // takes priority as the surfaced reason. - if envState, envValue := smartGateEnvValue(); envState == smartGateEnvUnparseable { + // takes priority as the surfaced reason. Not over shared-store: that + // one is structural (the gate WOULD have resolved, and was overruled), + // so fixing the env value would not change the outcome. + envState, envValue := smartGateEnvValue() + if envState == smartGateEnvUnparseable && fallbackReason != fallbackReasonSharedStore { fallbackReason = fallbackReasonUnparseableEnv unrecognizedSmartGateEnv = envValue } @@ -571,10 +695,102 @@ func checkRemoteMigrateGate(ctx context.Context, db DBConn, remoteName string, e Pending: len(pending), UnrecognizedEnv: unrecognizedEnv, FallbackReason: fallbackReason, + Shared: shared, UnrecognizedSmartGateEnv: unrecognizedSmartGateEnv, } } +// migrateConsent is the outcome of the consent ladder. how names the surface +// that granted it, so each arm's warning can attribute itself accurately +// instead of hardcoding one command. +type migrateConsent struct { + allowed bool + how string + // unrecognizedEnv carries an AllowRemoteMigrateEnv value that was set but + // is not a boolean, so a typo'd escape hatch fails with a hint rather than + // silently staying locked (bd-6dnrw.34). + unrecognizedEnv string +} + +// forceOrEnvConsent runs the two consent surfaces BOTH arms share: the +// programmatic `--force` twin and AllowRemoteMigrateEnv. +// +// It exists so the parsing lives in one place. The two arms had hand-copied +// ladders that could drift, which is a real hazard for a variable whose own +// doc comment insists it is "the single knob" with one semantic. +// +// Both are consulted only once the gate would otherwise fire, so an operator +// who exports the env var in a shell profile is never warned on an open with +// nothing pending. +func forceOrEnvConsent() migrateConsent { + // Process-local by design: unlike os.Setenv(AllowRemoteMigrateEnv), the + // programmatic twin cannot leak into child processes (git hooks, dolt + // subprocesses). Set by `bd migrate --force` in the root PersistentPreRunE + // before both autoMigrateOnVersionBump and the main store open. + if forceAllowRemoteMigrate { + return migrateConsent{allowed: true, how: "bd migrate --force"} + } + v := os.Getenv(AllowRemoteMigrateEnv) + if v == "" { + return migrateConsent{} + } + // Any boolean true ("1", "true", "TRUE", ...) unlocks; a set-but- + // unparseable value is surfaced in the gate error instead of silently + // staying locked. + allowed, err := strconv.ParseBool(v) + if err != nil { + return migrateConsent{unrecognizedEnv: v} + } + if !allowed { + return migrateConsent{} + } + return migrateConsent{allowed: true, how: AllowRemoteMigrateEnv + "=" + v} +} + +// SharedConsentCommand is the command that consents to migrating a shared +// database that has no remote. It is the single source for the gate's escape +// hint, its remediation option, and the warning it prints once consent is +// given, so those three can never name different commands. +// +// On the shared GLOBAL database (`beads_global`) the same command needs +// `--global` to route there; see SharedConsentCommandGlobal. +const SharedConsentCommand = "bd migrate schema" + +// SharedConsentCommandGlobal is SharedConsentCommand aimed at the shared +// global database. `bd init` and any `--global` invocation refuse against +// their own database, so the remedy they print must carry the flag or it +// migrates the wrong one. +const SharedConsentCommandGlobal = SharedConsentCommand + " --global" + +// sharedNoRemoteGate decides the shared-store-without-a-remote arm +// (gastownhall/beads#5920). There is no remote, so none of the #4259 +// migrate-vs-adopt machinery applies: the only question is whether the +// operator consented to promoting the schema for every co-resident client. +func sharedNoRemoteGate(current, pending int) error { + consent := forceOrEnvConsent() + // The migrate verb is the third surface, and unlike the other two it + // unlocks ONLY here: with a remote configured, #4259's cross-clone fork + // risk still demands the stronger designated-migrator confirmation. + if !consent.allowed && sharedMigrateConsent { + consent.allowed, consent.how = true, SharedConsentCommand + } + if consent.allowed { + fmt.Fprintf(os.Stderr, + "Warning: applying %d pending schema migration(s) to a shared server database (%s); co-resident bd clients still on an older binary will refuse this database until they are upgraded (#5920)\n", + pending, consent.how) + return nil + } + + return &RemoteMigrateGateError{ + CurrentVersion: current, + LatestVersion: LatestVersion(), + Pending: pending, + UnrecognizedEnv: consent.unrecognizedEnv, + Decision: gateDecisionSharedNoRemote, + Shared: true, + } +} + // anyDoltRemoteConfigured reports whether the database has any Dolt remote // registered. dolt_remotes is always present in a Dolt database; a // "table not found" is treated as "no remotes" so a missing system table can diff --git a/internal/storage/schema/remote_migrate_gate_test.go b/internal/storage/schema/remote_migrate_gate_test.go index d11e4c753..7e2f1c8e7 100644 --- a/internal/storage/schema/remote_migrate_gate_test.go +++ b/internal/storage/schema/remote_migrate_gate_test.go @@ -199,7 +199,7 @@ func TestCheckRemoteMigrateGateWithRemoteCheck(t *testing.T) { mock.ExpectQuery(`SELECT COUNT\(\*\) FROM dolt_remotes`). WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) - err := CheckRemoteMigrateGateWithRemoteCheck(context.Background(), db, func() bool { return true }) + err := checkRemoteMigrateGate(context.Background(), db, "", func() bool { return true }, nil, false) var gateErr *RemoteMigrateGateError if !errors.As(err, &gateErr) { t.Fatalf("expected *RemoteMigrateGateError when the disk fallback reports a remote, got %v", err) @@ -218,7 +218,7 @@ func TestCheckRemoteMigrateGateWithRemoteCheck(t *testing.T) { mock.ExpectQuery(`SELECT COUNT\(\*\) FROM dolt_remotes`). WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) - if err := CheckRemoteMigrateGateWithRemoteCheck(context.Background(), db, func() bool { return false }); err != nil { + if err := checkRemoteMigrateGate(context.Background(), db, "", func() bool { return false }, nil, false); err != nil { t.Fatalf("no remote anywhere should be allowed, got %v", err) } if err := mock.ExpectationsWereMet(); err != nil { @@ -236,10 +236,10 @@ func TestCheckRemoteMigrateGateWithRemoteCheck(t *testing.T) { WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(1)) called := false - err := CheckRemoteMigrateGateWithRemoteCheck(context.Background(), db, func() bool { + err := checkRemoteMigrateGate(context.Background(), db, "", func() bool { called = true return false - }) + }, nil, false) if !IsRemoteMigrateGateError(err) { t.Fatalf("expected gate error when dolt_remotes already shows a remote, got %v", err) } @@ -260,10 +260,10 @@ func TestCheckRemoteMigrateGateWithRemoteCheck(t *testing.T) { expectGateCurrentVersion(mock, latest) // PendingVersions -> none called := false - err := CheckRemoteMigrateGateWithRemoteCheck(context.Background(), db, func() bool { + err := checkRemoteMigrateGate(context.Background(), db, "", func() bool { called = true return true - }) + }, nil, false) if err != nil { t.Fatalf("at-latest DB should be allowed, got %v", err) } diff --git a/internal/storage/schema/schema.go b/internal/storage/schema/schema.go index 4ba45f30d..5ee2df65a 100644 --- a/internal/storage/schema/schema.go +++ b/internal/storage/schema/schema.go @@ -228,7 +228,7 @@ type migrationSource struct { // sentinelTables are tables this series is responsible for creating. A // non-zero cursor is only believed while they all exist: the cursor is a // claim about the schema, and a claim contradicted by the schema is worth - // less than no claim at all. See cursorContradictedBySchema. + // less than no claim at all. See cursorRealityFloor. // // INVARIANT: no future migration in this series may DROP or RENAME a // sentinel. Older binaries in the field check their own sentinel list @@ -238,13 +238,16 @@ type migrationSource struct { // the dropping side is this comment. sentinelTables []string // sentinelColumns are clone-local columns whose absence contradicts an - // otherwise at-latest cursor just as strongly as an absent sentinel table. + // otherwise at-latest cursor. Unlike a missing sentinel table, a missing + // column disbelieves the cursor only back to the column's replayFloor: it + // says nothing about the migrations that ran long before the column + // existed, and replaying those is not free (see schemaSentinelColumn). // // INVARIANT: no future migration in this series may DROP or RENAME a // sentinel column (or the table carrying it). Older binaries in the field // check their own sentinel list against the live schema, so removing one // would make every healthy newer database read as "contradicted" to them - // and re-run their whole series. TestSentinelColumnsAreCreatedByTheSeries + // and replay the series from their floor. TestSentinelColumnsAreCreatedByTheSeries // enforces the creating side only; the dropping side is this comment. sentinelColumns []schemaSentinelColumn } @@ -252,6 +255,30 @@ type migrationSource struct { type schemaSentinelColumn struct { table string column string + // replayFloor is the highest cursor value this sentinel's absence still + // leaves believable. When the column is missing, currentVersion returns + // min(cursor, replayFloor) rather than 0, so only migrations above the + // floor replay. Two constraints fix it: + // + // (i) Every migration at or below the floor must stay OUT of the replay. + // The column's absence is no evidence at all about migrations that + // predate it, and replaying them is destructive: ignored/0007's + // unguarded `UPDATE wisps SET is_blocked = 0` re-fires the + // ON UPDATE CURRENT_TIMESTAMP on wisps.updated_at, silently + // restamping every wisp on a plane with no history to restore from + // (#5981 harm class). ignored/0015 is the guarded successor and is + // genuinely pending on those stores, so the recompute still happens + // — just without the timestamp damage. + // (ii) The migration that creates the column AND the migration that + // creates the table carrying it must both be ABOVE the floor, so the + // replay can still heal both shapes the single INFORMATION_SCHEMA + // COUNT(*) probe collapses: table absent entirely, and table present + // but column-less. A floor above the table's creator would strand + // the table-absent shape in a permanent re-migration loop. + // + // TestSentinelColumnsAreCreatedByTheSeries pins the floor to those two + // files, so a future renumbering breaks CI rather than users. + replayFloor int } var ( @@ -270,8 +297,20 @@ var ( // is caught by whichever is absent. sentinelTables: []string{"wisps", "wisp_dependencies"}, // A historical ignored-v16 ordinal collision can leave the local - // leases table present but without the column frozen 0016 adds. - sentinelColumns: []schemaSentinelColumn{{table: "leases", column: "granted_node"}}, + // leases table present but without the column frozen 0016 adds; a + // database materialized out of band can be missing the leases table + // altogether. The single COLUMNS probe reads both shapes as absent and + // the replay heals both: 0012 re-creates the table, 0016 adds the + // column. + // + // The floor of 11 is what keeps that heal from also being a data loss. + // Every released tree (v1.1.0, v1.1.2, v1.2.x) tops the ignored series + // at 0011 and has no leases table, so on the first open by a binary + // carrying this sentinel the probe fails and — unclamped — the whole + // 0001–0025 series replays, dragging in ignored/0007 and restamping + // wisps.updated_at across the plane. Believing the cursor up to 11 + // applies exactly the pending tail 0012–0025 instead. + sentinelColumns: []schemaSentinelColumn{{table: "leases", column: "granted_node", replayFloor: 11}}, } ) @@ -572,6 +611,43 @@ func MigrateUp(ctx context.Context, db DBConn) (int, error) { return 0, err } + // Asserting the pattern is not enough on a lineage old enough to have + // COMMITTED the ignored-lane cursor table: dolt_ignore only exempts + // tables that were never tracked, so the pattern above is inert there and + // the table stays permanently dirty, wedging every pull + // (gastownhall/beads#4356). Untracking it is a one-time repair, but it + // belongs here rather than in a numbered migration for the same reason + // the seed does — the affected databases are at-latest, so the + // short-circuit below would skip it — plus one the seed does not have: a + // pull from a not-yet-healed peer can re-introduce the tracked table, + // which only a probe that runs at EVERY open can catch. + healed, err := healTrackedIgnoredCursorTable(ctx, db) + if err != nil { + return 0, fmt.Errorf("untracking legacy %s: %w", ignoredSource.cursorTable, err) + } + + // A heal counts toward the returned total because every caller of this + // function asks the same question of it — did this pass change the + // database? — and a heal answers yes emphatically: it runs DDL and moves + // HEAD. Reporting 0 told DoltStore.Open not to rebuild the pool it had + // already pinned to the pre-migration session root (be-itm5: that + // connection serves stale reads and does not self-heal on retry), and + // told `bd migrate` to print "already at vN" and skip commandDidWrite + // immediately after minting a fleet-visible commit. The heal's own log + // line, not this counter, is what tells an operator WHAT happened. + reconciled := 0 + if healed { + reconciled = 1 + } + + applied, err := migrateUpAfterReconcile(ctx, db, seedChanged) + return applied + reconciled, err +} + +// migrateUpAfterReconcile is MigrateUp's migration pass proper, split out so +// the open-time reconciles above it have exactly one place to contribute to +// the reported total. +func migrateUpAfterReconcile(ctx context.Context, db DBConn, seedChanged bool) (int, error) { needed, err := migrationWorkNeeded(ctx, db) if err != nil { return 0, fmt.Errorf("checking schema migration work: %w", err) @@ -619,18 +695,42 @@ func MigrateUp(ctx context.Context, db DBConn) (int, error) { return 0, fmt.Errorf("reading pre-migration status: %w", err) } delete(dirtyBefore, "dolt_ignore") + // Captured before the main migrations run: the aux re-key uses it to + // distinguish the lineage's first rekey-aware migration (run the pass) from + // a fresh clone of an already-converged lineage (record the marker only, + // bd-578h9.4). Read up front because the dirtyBefore exemption just below is + // derived from it (auxRekeyExemptTables). + mainVersionBefore, err := mainSource.currentVersion(ctx, db) + if err != nil { + return 0, fmt.Errorf("reading pre-migration schema version: %w", err) + } // A previous pass that crashed mid-aux-rekey left its partial UPDATEs // dirty in the working set with the in-progress sentinel still recorded // (bd-578h9.16). Those tables are this pass's own migration state, not // pre-existing user writes: dropping them from dirtyBefore exempts them // from the changed-signature guard (the resumed rekey is about to change // them) and lets stageSchemaTables commit them with the rest of the pass. - if resuming, err := anyAuxRekeyResumePending(ctx, db); err != nil { - return 0, fmt.Errorf("reading aux rekey sentinel: %w", err) - } else if resuming { - for _, t := range auxRekeyTables { - delete(dirtyBefore, t.name) - } + // + // A table skipped for #11131 encoding drift (#4380) needs the same + // exemption on the pass that retries it, and needs it more: the + // changed-signature guard below reads dirty tables through dolt_diff, which + // decodes exactly the cells that panic — so leaving a drifted table in + // dirtyBefore would fail the pass on the read, re-creating the unopenable + // database this exemption path exists to rescue. + // + // auxRekeyExemptTables returns exactly the tables the upcoming + // rekeyAuxRowIDsAllPasses will rewrite, computed from the same per-pass + // selection the rewrite uses. Scoping the exemption to that set — rather + // than blanket-exempting all four aux tables whenever any rewrite is in + // flight — keeps a post-marker resume, which touches only the recorded + // drifted subset, from dropping a non-drifted aux table's pre-existing user + // edits out of dirtyBefore and into the migration commit (#4380). + auxRekeyExempt, err := auxRekeyExemptTables(ctx, db, mainVersionBefore) + if err != nil { + return 0, err + } + for name := range auxRekeyExempt { + delete(dirtyBefore, name) } touchedDirtyTables, err := mainSource.pendingMigrationDirtyTables(ctx, db, dirtyBefore) if err != nil { @@ -643,14 +743,6 @@ func MigrateUp(ctx context.Context, db DBConn) (int, error) { if err != nil { return 0, fmt.Errorf("reading pre-migration dirty table diffs: %w", err) } - // Captured before the main migrations run: the aux re-key uses it to - // distinguish the lineage's first rekey-aware migration (run the pass) - // from a fresh clone of an already-converged lineage (record the marker - // only, bd-578h9.4). - mainVersionBefore, err := mainSource.currentVersion(ctx, db) - if err != nil { - return 0, fmt.Errorf("reading pre-migration schema version: %w", err) - } applied, mainColumnAdded, err := mainSource.migrate(ctx, db, 0) if err != nil { @@ -667,8 +759,29 @@ func MigrateUp(ctx context.Context, db DBConn) (int, error) { // migrated clones converge to byte-identical, merge-safe dependencies. Runs // here, after the schema migrations (0050 has asserted the canonical schema), // and only on a pass where migration work was needed. - rekeyed, err := rekeyDependencyIDs(ctx, db) + // + // #5268: ignored migration 0026 is what makes "migration work was needed" + // true one more time on every existing clone, so the now merge-aware re-key + // reaches the databases a pre-1.3.0 binary left half-re-keyed at the latest + // main version. It is also why this call sits ABOVE ignoredSource.migrate: + // the marker records only if the re-key returned, so an aborted re-key is + // retried on the next open instead of the database claiming it migrated. + // + // dirtyBefore goes in because that same ordering means the changed-signature + // guard below runs AFTER the marker is durably recorded: a re-key that wrote + // into a pre-existing dirty table would fail the pass once and then never + // retry. The re-key refuses at plan time instead, before any write. + rekeyed, err := rekeyDependencyIDs(ctx, db, dirtyBefore) if err != nil { + // The two refusals the re-key raises deliberately carry their own + // user-facing recovery text and are matched with errors.As by the + // callers that must stay open (embeddeddolt's non-strict intents), so + // they travel unwrapped rather than under a mechanical prefix. + var dirtyErr *DirtyTablesError + var conflictErr *DependencyRekeyConflictError + if errors.As(err, &dirtyErr) || errors.As(err, &conflictErr) { + return applied, err + } return applied, fmt.Errorf("rekey dependency ids: %w", err) } backfilled = backfilled || rekeyed @@ -743,6 +856,15 @@ func MigrateUp(ctx context.Context, db DBConn) (int, error) { return applied, nil } +// migrationWorkNeeded deliberately does NOT consult the aux-rekey drift record +// (auxRowRekeyDriftedKey): the #4380 retry is opportunistic, not eager. A +// database that is otherwise fully current re-enters the rekey path only on the +// next pass that has other migration work to do, so a table left divergent by +// repaired-but-not-yet-reconverged drift converges then rather than on the very +// next open. This keeps steady-state opens free of a local_metadata probe; the +// skip log already tells the user convergence is deferred to a later migration +// pass (see rekeyAuxRowIDsPending). Making a repaired DB re-converge immediately +// would mean folding that drift record in here — a deliberate non-goal for now. func migrationWorkNeeded(ctx context.Context, db DBConn) (bool, error) { if !mainSource.atLatest(ctx, db) || !ignoredSource.atLatest(ctx, db) { return true, nil @@ -1076,6 +1198,13 @@ type migrationFile struct { name string } +// cursorTableColumns are the columns bootstrapSQL creates, in order. The +// #4356 untrack reconcile copies cursor rows out to a scratch table and back +// by NAME, so a column added to bootstrapSQL without being added here would be +// silently dropped from every database that reconcile repairs. +// TestCursorTableColumnsMatchBootstrapSQL is what keeps the two together. +var cursorTableColumns = []string{"version", "applied_at", "content_hash"} + func (m migrationSource) bootstrapSQL() string { return fmt.Sprintf(`CREATE TABLE IF NOT EXISTS %s ( version INT PRIMARY KEY, @@ -1243,47 +1372,65 @@ func (m migrationSource) currentVersion(ctx context.Context, db DBConn) (int, er // no wisps tables. atLatest() then short-circuits migrationWorkNeeded() // and the series never re-runs, surfacing much later and much further away // as "table not found: wisp_dependencies" on `bd close`. - contradicted, cerr := m.cursorContradictedBySchema(ctx, db) - if cerr != nil { - return 0, cerr + // + // A contradicted cursor is disbelieved only back to the floor of whatever + // sentinel is missing, not all the way to zero: the absence of a sentinel + // is evidence about the migration that creates it and everything after, + // and nothing at all about what ran before. Zeroing anyway replays the + // whole series, which is not a no-op (see schemaSentinelColumn.replayFloor). + floor, limited, ferr := m.cursorRealityFloor(ctx, db) + if ferr != nil { + return 0, ferr } - if contradicted { - return 0, nil + if limited && floor < current { + current = floor } return current, nil } -// cursorContradictedBySchema reports whether this series' cursor claims work -// that the schema does not corroborate. +// cursorRealityFloor reports how much of this series' cursor the live schema +// corroborates. limited is false when nothing is missing (believe the cursor as +// read); otherwise floor is the highest version still believable — 0 for a +// missing sentinel table, and the sentinel's replayFloor for a missing sentinel +// column. // -// Returning "cursor is 0" rather than an error is deliberate: the series is -// written to be re-runnable against a database that already has some of it. +// Clamping rather than erroring is deliberate: the series is written to be +// re-runnable against a database that already has some of it. // migrations/ignored/0001 builds each table as __temp__ and then // `RENAME TABLE __temp__x TO x` only when x does not already exist, DROPping // the temp otherwise; later migrations gate their ALTERs on -// INFORMATION_SCHEMA lookups. So re-running the series repairs the missing -// tables and leaves existing data untouched — which is why this can heal +// INFORMATION_SCHEMA lookups. So re-running that range repairs the missing +// objects and leaves existing data untouched — which is why this can heal // rather than merely diagnose. -func (m migrationSource) cursorContradictedBySchema(ctx context.Context, db DBConn) (bool, error) { +// +// Sentinel tables are probed first and short-circuit the whole check: they +// floor at 0, so no column probe could lower the answer, and skipping it keeps +// this cheap on the path every store open takes. +func (m migrationSource) cursorRealityFloor(ctx context.Context, db DBConn) (int, bool, error) { for _, table := range m.sentinelTables { present, err := sentinelTableExists(ctx, db, table) if err != nil { - return false, fmt.Errorf("checking %s sentinel table %s: %w", m.cursorTable, table, err) + return 0, false, fmt.Errorf("checking %s sentinel table %s: %w", m.cursorTable, table, err) } if !present { - return true, nil + return 0, true, nil } } + floor, limited := 0, false for _, column := range m.sentinelColumns { present, err := sentinelColumnExists(ctx, db, column.table, column.column) if err != nil { - return false, fmt.Errorf("checking %s sentinel column %s.%s: %w", m.cursorTable, column.table, column.column, err) + return 0, false, fmt.Errorf("checking %s sentinel column %s.%s: %w", m.cursorTable, column.table, column.column, err) } - if !present { - return true, nil + if present { + continue } + if !limited || column.replayFloor < floor { + floor = column.replayFloor + } + limited = true } - return false, nil + return floor, limited, nil } // sentinelTableExists is a function variable for the same reason diff --git a/internal/storage/schema/schema_test.go b/internal/storage/schema/schema_test.go index df1198a99..4e1167ab1 100644 --- a/internal/storage/schema/schema_test.go +++ b/internal/storage/schema/schema_test.go @@ -23,6 +23,7 @@ import ( ) func TestPendingMigrationDirtyTablesDetectsMigration0043Dependencies(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -56,6 +57,7 @@ func TestPendingMigrationDirtyTablesDetectsMigration0043Dependencies(t *testing. // working-set-reconcile opens can detect it via errors.As and skip the // migration instead of failing outright. func TestMigrateUpReturnsDirtyTablesErrorForPreExistingDirtyTable(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -66,6 +68,10 @@ func TestMigrateUpReturnsDirtyTablesErrorForPreExistingDirtyTable(t *testing.T) // else (GH#4378); the rows changed, so a scoped commit lands before the // pass runs (#4566: the seed must not ride the per-step pass commits). expectIgnorePatternSeed(mock, 42) + // #4356: the open-time untrack reconcile runs right after the seed and + // before the no-work short-circuit. On a healthy database it is two reads + // and no writes. + expectIgnoredCursorHealNoop(mock) // migrationWorkNeeded: mainSource.atLatest reads the current cursor; v42 // is behind LatestVersion(), so the || short-circuits before checking // ignoredSource.atLatest or the content-hash/backfill probes. @@ -84,9 +90,20 @@ func TestMigrateUpReturnsDirtyTablesErrorForPreExistingDirtyTable(t *testing.T) // committableDirtyTables -> dirtyTables(ctx, db, true): same dirty state. expectDirtyDoltStatusRow(mock, "dependencies", false) - // auxRekeyResumePending: no local_metadata table, so no resume in flight. - mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.TABLES`). - WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) + // MigrateUp now captures the pre-pass main cursor up front (it drives the + // aux-rekey dirtyBefore exemption); v42 (behind latest) is read here. + expectCursorProbe(mock, "schema_migrations", true) + expectScalar(mock, "SELECT COALESCE(MAX(version), 0) FROM schema_migrations", "version", 42) + // auxRekeyExemptTables reads the ignored cursor to see which passes' markers + // are pending, then each pass's clone-local re-key state. This mocked world + // has no ignored cursor table and no local_metadata, so every read stops at + // its existence probe and nothing aux is exempted — and `dependencies` is + // not an aux table anyway, so it stays in dirtyBefore. + expectCursorProbe(mock, "ignored_schema_migrations", false) + for range auxRekeyPasses { + mock.ExpectQuery(`SELECT COUNT\(\*\) FROM INFORMATION_SCHEMA\.TABLES`). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) + } // pendingMigrationDirtyTables re-reads the current version and finds // migration 0043 touches the dirty `dependencies` table. @@ -118,6 +135,7 @@ func expectDirtyDoltStatusRow(mock sqlmock.Sqlmock, table string, staged bool) { } func TestIgnoredPendingMigrationDirtyTablesDetectsWispDependencies(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -311,6 +329,7 @@ func TestMigration0053RepairsRigWispsShape(t *testing.T) { } func TestEnsureIssuesRigColumnsAddsOnlyMissing(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -344,6 +363,7 @@ func TestEnsureIssuesRigColumnsAddsOnlyMissing(t *testing.T) { } func TestEnsureWispDependenciesSplitTargetsAddsMissingAndBackfills(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -406,6 +426,7 @@ func TestPreMigrationRepairScopedToMain0047(t *testing.T) { } func TestPreMigrationRepairDispatchesMain47ToWispTableRepair(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -450,6 +471,7 @@ func TestPreMigrationRepairDispatchesMain47ToWispTableRepair(t *testing.T) { // commit -- that end-to-end proof belongs in // internal/storage/embeddeddolt (cgo-gated, see TestEmbeddedMigrateRepairedDependenciesIDColumnCommitsAtomicallyWithVersion53_4690). func TestRunMigrationsSnapshotsDirtyTablesBeforeRepairSoRepairMutationsCommitAtomically(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -524,6 +546,7 @@ func TestRunMigrationsSnapshotsDirtyTablesBeforeRepairSoRepairMutationsCommitAto } func TestEnsureWispTablesForMigration0047CreatesMissingTables(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -550,6 +573,7 @@ func TestEnsureWispTablesForMigration0047CreatesMissingTables(t *testing.T) { } func TestEnsureWispTablesForMigration0047DelegatesSplitTargetRepairWhenWispDependenciesExists(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -597,6 +621,7 @@ func TestPreMigrationRepairScopedToIgnored15(t *testing.T) { } func TestPreMigrationRepairDispatchesIgnored15ToWispIsBlockedRepair(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -629,6 +654,7 @@ func TestPreMigrationRepairDispatchesIgnored15ToWispIsBlockedRepair(t *testing.T } func TestEnsureWispIsBlockedForRecomputeNoopsWhenWispsAbsent(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -643,7 +669,7 @@ func TestEnsureWispIsBlockedForRecomputeNoopsWhenWispsAbsent(t *testing.T) { // with a table-not-found error if wisps is genuinely missing when they // run. The no-op is safe here only because it is never reached with // wisps absent in a real pass: ignored/0001 (or the cursor-reality - // repair, cursorContradictedBySchema, when the cursor and schema + // repair, cursorRealityFloor, when the cursor and schema // disagree) always materializes wisps before the pass advances this far. // This test exercises the repair function in isolation and is not a // claim that 0007/0015 tolerate a missing wisps table. @@ -660,6 +686,7 @@ func TestEnsureWispIsBlockedForRecomputeNoopsWhenWispsAbsent(t *testing.T) { } func TestEnsureWispIsBlockedForRecomputeNoopsWhenAlreadyPresent(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -747,6 +774,7 @@ const ( // expectations" failure on top of the real one. func newWispIsBlockedDriftDB(t *testing.T, migrationFile string, wantCursorVersion int) *wispIsBlockedDriftDB { t.Helper() + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -922,6 +950,7 @@ func TestIgnored7RecomputeHardFailsWithoutIsBlockedRepair(t *testing.T) { } func TestEnsureDependenciesIDColumnNoopWhenAlreadyFullyBackfilledAndKeyed(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -952,6 +981,7 @@ func TestEnsureDependenciesIDColumnNoopWhenAlreadyFullyBackfilledAndKeyed(t *tes } func TestEnsureDependenciesIDColumnBackfillsMissingIDsDeterministically(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -1009,6 +1039,7 @@ func TestEnsureDependenciesIDColumnBackfillsMissingIDsDeterministically(t *testi } func TestEnsureDependenciesIDColumnDropsExistingPrimaryKeyBeforeAddingID(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -1049,6 +1080,7 @@ func TestEnsureDependenciesIDColumnDropsExistingPrimaryKeyBeforeAddingID(t *test } func TestEnsureDependenciesIDColumnFailsClearlyOnTargetlessRowInsteadOfBrickingNotNullModify(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -2131,6 +2163,7 @@ func doltSQLString(value string) string { } func TestStageSchemaTablesSkipsIgnoredTables(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -2160,6 +2193,7 @@ func TestStageSchemaTablesSkipsIgnoredTables(t *testing.T) { } func TestUnstageIgnoredTablesResetsExistingIgnoredTables(t *testing.T) { + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) @@ -2367,6 +2401,7 @@ type wispsAbsentDB struct { func newWispsAbsentDB(t *testing.T) *wispsAbsentDB { t.Helper() + failOnSwallowedAdvisory(t) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("sqlmock.New: %v", err) diff --git a/internal/storage/schema/shared_store_migrate_gate_test.go b/internal/storage/schema/shared_store_migrate_gate_test.go new file mode 100644 index 000000000..5ea6ad04d --- /dev/null +++ b/internal/storage/schema/shared_store_migrate_gate_test.go @@ -0,0 +1,393 @@ +package schema + +import ( + "context" + "errors" + "strings" + "testing" + + "github.com/DATA-DOG/go-sqlmock" +) + +// expectSharedGateProbe mocks the probe sequence every gate invocation issues +// before it can decide anything: CurrentVersion, PendingVersions, and the +// dolt_remotes count. +func expectSharedGateProbe(mock sqlmock.Sqlmock, current int, remotes int) { + expectGateCurrentVersion(mock, current) // CurrentVersion + expectGateCurrentVersion(mock, current) // PendingVersions -> pending exists + mock.ExpectQuery(`SELECT COUNT\(\*\) FROM dolt_remotes`). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(remotes)) +} + +func sharedGate(t *testing.T, mock sqlmock.Sqlmock, db DBConn) error { + t.Helper() + err := CheckSharedStoreMigrateGate(context.Background(), db, "", nil, nil) + if merr := mock.ExpectationsWereMet(); merr != nil { + t.Fatalf("unmet expectations: %v", merr) + } + return err +} + +// resetConsent clears both process-local consent flags around a test case. +// They are package-level by design (set once in the root pre-run), so a test +// that leaves one set silently unlocks every later case. +func resetConsent(t *testing.T) { + t.Helper() + t.Cleanup(func() { + SetForceAllowRemoteMigrate(false) + SetSharedMigrateConsent(false) + }) +} + +// TestSharedStoreGateNoRemote covers the gastownhall/beads#5920 arm: a shared +// database with NO remote, where the ordinary (embedded) gate allows a silent +// in-place migration. On a shared store that promotes the schema cursor for +// every co-resident client at once, so it refuses without explicit consent. +func TestSharedStoreGateNoRemote(t *testing.T) { + t.Setenv(SmartGateEnv, "0") // no remote, so the smart router never runs anyway + latest := LatestVersion() + + t.Run("pending migrations, no remote, no consent → refused", func(t *testing.T) { + resetConsent(t) + t.Setenv(AllowRemoteMigrateEnv, "0") + db, mock, _ := sqlmock.New() + defer db.Close() + expectSharedGateProbe(mock, 1, 0) + + var gateErr *RemoteMigrateGateError + if err := sharedGate(t, mock, db); !errors.As(err, &gateErr) { + t.Fatalf("expected *RemoteMigrateGateError, got %v", err) + } + if gateErr.Decision != gateDecisionSharedNoRemote { + t.Fatalf("Decision = %q, want %q", gateErr.Decision, gateDecisionSharedNoRemote) + } + if gateErr.CurrentVersion != 1 || gateErr.LatestVersion != latest || gateErr.Pending <= 0 { + t.Errorf("gate error = %+v, want current 1, latest %d, pending > 0", gateErr, latest) + } + + msg := gateErr.UserMessage() + for _, want := range []string{ + "lock out every co-resident bd client", + "bd migrate schema", + "Read commands keep working", + AllowRemoteMigrateEnv + "=1", + } { + if !strings.Contains(msg, want) { + t.Errorf("UserMessage missing %q:\n%s", want, msg) + } + } + // The #4259 remedies do not apply with no remote: there is one copy of + // the database, so there is nothing to adopt and nothing to push. + for _, absent := range []string{"bd bootstrap", "bd dolt push"} { + if strings.Contains(msg, absent) { + t.Errorf("UserMessage must not offer %q with no remote:\n%s", absent, msg) + } + } + + if hint := gateErr.EscapeHint(); hint != "bd migrate schema" { + t.Errorf("EscapeHint = %q, want %q", hint, "bd migrate schema") + } + opts := gateErr.Options() + if len(opts) != 1 || opts[0].ID != "migrate-shared" { + t.Fatalf("Options = %+v, want a single migrate-shared option", opts) + } + if opts[0].When == "" || opts[0].Risk == "" { + t.Errorf("migrate-shared option must carry its precondition and risk: %+v", opts[0]) + } + if directive := gateErr.AgentDirective(); !strings.Contains(directive, "do NOT auto-run") { + t.Errorf("AgentDirective must forbid auto-running the migration: %q", directive) + } + }) + + t.Run("fresh database still migrates — creating a database is consent", func(t *testing.T) { + resetConsent(t) + t.Setenv(AllowRemoteMigrateEnv, "0") + db, mock, _ := sqlmock.New() + defer db.Close() + expectGateCurrentVersion(mock, 0) + + if err := sharedGate(t, mock, db); err != nil { + t.Fatalf("fresh shared database must be allowed, got %v", err) + } + }) + + t.Run("nothing pending is allowed", func(t *testing.T) { + resetConsent(t) + t.Setenv(AllowRemoteMigrateEnv, "0") + db, mock, _ := sqlmock.New() + defer db.Close() + expectGateCurrentVersion(mock, latest) // CurrentVersion + expectGateCurrentVersion(mock, latest) // PendingVersions -> none + + if err := sharedGate(t, mock, db); err != nil { + t.Fatalf("converged shared database must be allowed, got %v", err) + } + }) + + t.Run("verb consent unlocks with a warning", func(t *testing.T) { + resetConsent(t) + t.Setenv(AllowRemoteMigrateEnv, "0") + db, mock, _ := sqlmock.New() + defer db.Close() + expectSharedGateProbe(mock, 1, 0) + SetSharedMigrateConsent(true) + + var err error + stderr := captureStderr(t, func() { err = sharedGate(t, mock, db) }) + if err != nil { + t.Fatalf("bd migrate schema consent must unlock, got %v", err) + } + if !strings.Contains(stderr, "bd migrate schema") || !strings.Contains(stderr, "#5920") { + t.Errorf("expected a shared-store warning naming the verb, got %q", stderr) + } + }) + + t.Run("--force unlocks with a warning", func(t *testing.T) { + resetConsent(t) + t.Setenv(AllowRemoteMigrateEnv, "0") + db, mock, _ := sqlmock.New() + defer db.Close() + expectSharedGateProbe(mock, 1, 0) + SetForceAllowRemoteMigrate(true) + + var err error + stderr := captureStderr(t, func() { err = sharedGate(t, mock, db) }) + if err != nil { + t.Fatalf("--force must unlock, got %v", err) + } + if !strings.Contains(stderr, "bd migrate --force") { + t.Errorf("expected a warning naming --force, got %q", stderr) + } + }) + + t.Run("env unlocks with a warning", func(t *testing.T) { + for _, v := range []string{"1", "true", "TRUE"} { + resetConsent(t) + t.Setenv(AllowRemoteMigrateEnv, v) + db, mock, _ := sqlmock.New() + expectSharedGateProbe(mock, 1, 0) + + var err error + stderr := captureStderr(t, func() { err = sharedGate(t, mock, db) }) + if err != nil { + t.Fatalf("%s=%s must unlock, got %v", AllowRemoteMigrateEnv, v, err) + } + if !strings.Contains(stderr, AllowRemoteMigrateEnv+"="+v) { + t.Errorf("%s=%s: expected a warning naming the variable, got %q", AllowRemoteMigrateEnv, v, stderr) + } + db.Close() + } + }) + + t.Run("unparseable env stays locked with a hint", func(t *testing.T) { + resetConsent(t) + t.Setenv(AllowRemoteMigrateEnv, "yes") + db, mock, _ := sqlmock.New() + defer db.Close() + expectSharedGateProbe(mock, 1, 0) + + var gateErr *RemoteMigrateGateError + if err := sharedGate(t, mock, db); !errors.As(err, &gateErr) { + t.Fatalf("expected *RemoteMigrateGateError, got %v", err) + } + if gateErr.UnrecognizedEnv != "yes" { + t.Errorf("UnrecognizedEnv = %q, want %q", gateErr.UnrecognizedEnv, "yes") + } + if !strings.Contains(gateErr.UserMessage(), "not recognized") { + t.Errorf("UserMessage missing the unrecognized-value hint:\n%s", gateErr.UserMessage()) + } + }) + + // Invariant 1 of the decision: embedded/local databases keep auto-migrating + // on a version bump. Same state, non-shared caller, no refusal. + t.Run("embedded (non-shared) caller is unaffected", func(t *testing.T) { + resetConsent(t) + t.Setenv(AllowRemoteMigrateEnv, "0") + db, mock, _ := sqlmock.New() + defer db.Close() + expectSharedGateProbe(mock, 1, 0) + + if err := CheckRemoteMigrateGate(context.Background(), db); err != nil { + t.Fatalf("embedded no-remote open must still auto-migrate, got %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet expectations: %v", err) + } + }) +} + +// TestSharedStoreGateSuppressesSmartAutoArms covers the remote-configured half: +// the #4259 flow is unchanged except that the smart gate's two auto-EXECUTE +// arms never fire on a shared store. The first-mover arm firing here IS the +// #5920 mechanism. +func TestSharedStoreGateSuppressesSmartAutoArms(t *testing.T) { + floor := LastNonDeterministicMigration + latest := LatestVersion() + + t.Run("first-mover auto-migrate is suppressed to a blunt stop", func(t *testing.T) { + resetConsent(t) + t.Setenv(SmartGateEnv, "1") + t.Setenv(AllowRemoteMigrateEnv, "0") + db, mock, _ := sqlmock.New() + defer db.Close() + expectSmartFiringGate(mock, floor) + hashes := map[int]string{floor - 1: "h1", floor: "h2"} + expectSmartRemoteRead(mock, hashes, hashes) + + err := CheckSharedStoreMigrateGate(context.Background(), db, "", nil, nil) + var gateErr *RemoteMigrateGateError + if !errors.As(err, &gateErr) { + t.Fatalf("shared store must refuse the first-mover migrate, got %v", err) + } + if gateErr.Decision != "" { + t.Errorf("Decision = %q, want the blunt stop", gateErr.Decision) + } + if gateErr.FallbackReason != fallbackReasonSharedStore { + t.Errorf("FallbackReason = %q, want %q", gateErr.FallbackReason, fallbackReasonSharedStore) + } + if !strings.Contains(gateErr.UserMessage(), "lock out co-resident clients") { + t.Errorf("UserMessage should explain the shared-store suppression:\n%s", gateErr.UserMessage()) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet expectations: %v", err) + } + }) + + t.Run("embedded caller in the same state still auto-migrates", func(t *testing.T) { + resetConsent(t) + t.Setenv(SmartGateEnv, "1") + t.Setenv(AllowRemoteMigrateEnv, "0") + db, mock, _ := sqlmock.New() + defer db.Close() + expectSmartFiringGate(mock, floor) + hashes := map[int]string{floor - 1: "h1", floor: "h2"} + expectSmartRemoteRead(mock, hashes, hashes) + + if err := CheckRemoteMigrateGate(context.Background(), db); err != nil { + t.Fatalf("embedded safe first-mover must still be allowed, got %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet expectations: %v", err) + } + }) + + // A refusal that came from a shared store carries consequences its #4259 + // decisions were never annotated for: every remedy lands on the database + // the whole server is serving. adopt-ff is the sharp case — its risk is + // otherwise literally "none", which an agent would read as free. + t.Run("shared refusals annotate the fleet-wide risk", func(t *testing.T) { + for _, decision := range []string{gateDecisionAdopt, gateDecisionAdoptFastForward} { + shared := (&RemoteMigrateGateError{Decision: decision, Shared: true}).Options() + if len(shared) != 1 { + t.Fatalf("%s: expected one option, got %+v", decision, shared) + } + if !strings.Contains(shared[0].Risk, "co-resident") { + t.Errorf("%s: shared risk must name the co-resident consequence, got %q", decision, shared[0].Risk) + } + local := (&RemoteMigrateGateError{Decision: decision}).Options() + if strings.Contains(local[0].Risk, "co-resident") { + t.Errorf("%s: a non-shared refusal must keep its original risk, got %q", decision, local[0].Risk) + } + } + // "Risk: none" is only ever correct off a shared store. + ff := (&RemoteMigrateGateError{Decision: gateDecisionAdoptFastForward, Shared: true}).Options() + if strings.HasPrefix(ff[0].Risk, "none") { + t.Errorf("adopt-ff on a shared store must not report no risk, got %q", ff[0].Risk) + } + }) + + t.Run("shared is set on the remote-backed arms too", func(t *testing.T) { + resetConsent(t) + t.Setenv(SmartGateEnv, "0") + t.Setenv(AllowRemoteMigrateEnv, "0") + db, mock, _ := sqlmock.New() + defer db.Close() + expectSharedGateProbe(mock, 1, 1) + + err := CheckSharedStoreMigrateGate(context.Background(), db, "", nil, nil) + var gateErr *RemoteMigrateGateError + if !errors.As(err, &gateErr) { + t.Fatalf("expected a gate error, got %v", err) + } + if !gateErr.Shared { + t.Error("a refusal from the shared gate must be marked Shared, whatever its decision") + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet expectations: %v", err) + } + }) + + t.Run("auto fast-forward is never executed", func(t *testing.T) { + resetConsent(t) + t.Setenv(SmartGateEnv, "1") + t.Setenv(AllowRemoteMigrateEnv, "0") + db, mock, _ := sqlmock.New() + defer db.Close() + expectSmartFiringGate(mock, floor) + local := map[int]string{floor: "h1"} + // Exactly the fixture that DOES auto-execute on an embedded clone + // (remote at latest, strict ancestor, clean working set) — no TOCTOU + // re-read is expected here because the write never happens. + remote := map[int]string{floor: "h1", latest: "h2"} + expectSmartRemoteRead(mock, local, remote) + + fa := &fakeAdopter{ancestorResult: true, cleanResult: true, withFastForward: true} + err := CheckSharedStoreMigrateGate(context.Background(), db, "", nil, fa.adopter()) + var gateErr *RemoteMigrateGateError + if !errors.As(err, &gateErr) { + t.Fatalf("shared store must refuse rather than fast-forward, got %v", err) + } + if gateErr.Decision != gateDecisionAdoptFastForward { + t.Errorf("Decision = %q, want %q (the directive stays accurate, only the write is suppressed)", + gateErr.Decision, gateDecisionAdoptFastForward) + } + if fa.ffCalls != 0 { + t.Errorf("FastForward calls = %d, want 0 on a shared store", fa.ffCalls) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet expectations: %v", err) + } + }) + + // Verb consent is scoped to the no-remote arm on purpose: with a remote, + // #4259's cross-clone fork risk still demands the designated-migrator + // confirmation. + t.Run("verb consent does not unlock the remote-backed arm", func(t *testing.T) { + resetConsent(t) + t.Setenv(SmartGateEnv, "0") + t.Setenv(AllowRemoteMigrateEnv, "0") + db, mock, _ := sqlmock.New() + defer db.Close() + expectSharedGateProbe(mock, 1, 1) + SetSharedMigrateConsent(true) + + err := CheckSharedStoreMigrateGate(context.Background(), db, "", nil, nil) + if !IsRemoteMigrateGateError(err) { + t.Fatalf("verb consent must not unlock a remote-backed database, got %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet expectations: %v", err) + } + }) + + t.Run("--force still unlocks the remote-backed arm", func(t *testing.T) { + resetConsent(t) + t.Setenv(SmartGateEnv, "0") + t.Setenv(AllowRemoteMigrateEnv, "0") + db, mock, _ := sqlmock.New() + defer db.Close() + expectSharedGateProbe(mock, 1, 1) + SetForceAllowRemoteMigrate(true) + + var err error + _ = captureStderr(t, func() { + err = CheckSharedStoreMigrateGate(context.Background(), db, "", nil, nil) + }) + if err != nil { + t.Fatalf("--force must unlock a remote-backed shared database, got %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet expectations: %v", err) + } + }) +} diff --git a/internal/storage/schema/smart_remote_migrate_gate_test.go b/internal/storage/schema/smart_remote_migrate_gate_test.go index acdfde63c..98a3e8c41 100644 --- a/internal/storage/schema/smart_remote_migrate_gate_test.go +++ b/internal/storage/schema/smart_remote_migrate_gate_test.go @@ -168,7 +168,7 @@ func TestSmartGateRouting(t *testing.T) { hashes := map[int]string{floor: "h"} expectSmartRemoteReadForRemote(mock, "upstream", hashes, hashes) - if err := CheckRemoteMigrateGateForRemoteWithRemoteCheck(context.Background(), db, "upstream", nil); err != nil { + if err := checkRemoteMigrateGate(context.Background(), db, "upstream", nil, nil, false); err != nil { t.Fatalf("safe first-mover on configured remote should be allowed, got %v", err) } if err := mock.ExpectationsWereMet(); err != nil { diff --git a/internal/storage/storage.go b/internal/storage/storage.go index f8768dcdb..5f0f4321e 100644 --- a/internal/storage/storage.go +++ b/internal/storage/storage.go @@ -691,6 +691,19 @@ type GarbageCollector interface { DoltGC(ctx context.Context) error } +// FullGarbageCollector provides a full Dolt garbage collection, which collects +// the old generation as well as the new one. +// +// Dolt GC is generational: each pass promotes the chunks reachable at that +// moment into the old generation, and DoltGC only visits the new generation. +// After a history rewrite (Flatten, Compact) the orphaned commit chain usually +// lives in the old generation, so DoltGC reclaims nothing and callers must use +// DoltGCFull. Prefer DoltGC for periodic hygiene, where a full pass costs +// minutes on large stores for no extra reclaim. +type FullGarbageCollector interface { + DoltGCFull(ctx context.Context) error +} + // Flattener squashes all Dolt commit history into a single commit. // Callers should type-assert to this interface for history compaction. type Flattener interface { diff --git a/internal/storage/storagecontract/history_presence.go b/internal/storage/storagecontract/history_presence.go new file mode 100644 index 000000000..928bdc1dc --- /dev/null +++ b/internal/storage/storagecontract/history_presence.go @@ -0,0 +1,210 @@ +// Package storagecontract holds cross-store contracts for storage CAPABILITY +// interfaces — the narrow optional interfaces a store may implement and that +// callers reach by type-asserting after storage.UnwrapStore. +// +// It is deliberately not backend/conformance. That package is the ROLE tier: +// its Run*(t, ctx, Fixture) entrypoints are enumerated by a drift gate +// that demands a RoleContractBundle field and a wiring on every registered leg +// (internal/storage/contract_leg_registry_test.go). A capability that only two +// of those legs can implement — HistoryPresence needs Dolt history, which the +// unit-of-work leg has none of — would have to be waived there rather than +// described. Here the wiring list IS the claim. +package storagecontract + +import ( + "context" + "testing" + + "github.com/steveyegge/beads/internal/storage" +) + +// HistoryPresenceFixture supplies the store-specific hooks the contract needs. +// Every hook must act on the SAME store as Presence. +type HistoryPresenceFixture struct { + // Prefix namespaces the ids each case seeds so several suites can share + // one database. + Prefix string + // Presence is the capability under test. + Presence storage.HistoryPresence + // CreateIssue seeds one durable issue. + CreateIssue func(ctx context.Context, id, title string) error + // DeleteIssue hard-deletes one issue. + DeleteIssue func(ctx context.Context, id string) error + // Commit makes a Dolt commit of whatever is staged. + Commit func(ctx context.Context, msg string) error + // CurrentCommit returns HEAD. + CurrentCommit func(ctx context.Context) (string, error) + // ResetHard rewinds the branch to commit, discarding the working set. A + // nil hook means the leg cannot rewind its own history, and the rewind + // case SKIPS rather than passing quietly. + ResetHard func(ctx context.Context, commit string) error +} + +// RunHistoryPresenceContract runs every case in order against one fixture. +// +// The cases share a store and run sequentially on purpose: the last one +// rewinds the branch, which would pull the ground out from under any case +// still running. Each case names the exact ids it seeded. +func RunHistoryPresenceContract(t *testing.T, ctx context.Context, fx HistoryPresenceFixture) { + t.Helper() + t.Run("ReportsALiveCommittedID", func(t *testing.T) { + RunHistoryPresenceReportsALiveCommittedID(t, ctx, fx) + }) + t.Run("ReportsADeletedID", func(t *testing.T) { + RunHistoryPresenceReportsADeletedID(t, ctx, fx) + }) + t.Run("OmitsAnIDThatNeverExisted", func(t *testing.T) { + RunHistoryPresenceOmitsAnIDThatNeverExisted(t, ctx, fx) + }) + t.Run("OmitsAnUncommittedCreateAndDelete", func(t *testing.T) { + RunHistoryPresenceOmitsAnUncommittedCreateAndDelete(t, ctx, fx) + }) + t.Run("AnswersAnEmptyRequest", func(t *testing.T) { + RunHistoryPresenceAnswersAnEmptyRequest(t, ctx, fx) + }) + t.Run("OmitsARewoundAwayID", func(t *testing.T) { + RunHistoryPresenceOmitsARewoundAwayID(t, ctx, fx) + }) +} + +// RunHistoryPresenceReportsALiveCommittedID: an id that is committed and still +// in the store is in its history. The auto-export guard never asks about one — +// a live id is not a candidate — but a capability that answered "absent" here +// would be reporting deletions, not history. +func RunHistoryPresenceReportsALiveCommittedID(t *testing.T, ctx context.Context, fx HistoryPresenceFixture) { + t.Helper() + id := fx.Prefix + "-live" + mustCreate(t, ctx, fx, id, "Live") + mustCommit(t, ctx, fx, "seed live") + + assertPresence(t, ctx, fx, []string{id}, map[string]bool{id: true}) +} + +// RunHistoryPresenceReportsADeletedID is the proof auto-export depends on: an +// id whose creation was committed and which has since been deleted is in +// history and absent from the store — the signature of a real deletion. +func RunHistoryPresenceReportsADeletedID(t *testing.T, ctx context.Context, fx HistoryPresenceFixture) { + t.Helper() + id := fx.Prefix + "-gone" + mustCreate(t, ctx, fx, id, "Doomed") + mustCommit(t, ctx, fx, "seed doomed") + if err := fx.DeleteIssue(ctx, id); err != nil { + t.Fatalf("DeleteIssue(%s): %v", id, err) + } + mustCommit(t, ctx, fx, "delete doomed") + + assertPresence(t, ctx, fx, []string{id}, map[string]bool{id: true}) +} + +// RunHistoryPresenceOmitsAnIDThatNeverExisted is the fail-safe half: a JSONL +// line naming an id this store has never held is exactly GH#4988's torn-store +// signal, and must stay unproven. +func RunHistoryPresenceOmitsAnIDThatNeverExisted(t *testing.T, ctx context.Context, fx HistoryPresenceFixture) { + t.Helper() + id := fx.Prefix + "-neverexisted" + + assertPresence(t, ctx, fx, []string{id}, map[string]bool{id: false}) +} + +// RunHistoryPresenceOmitsAnUncommittedCreateAndDelete pins that history +// presence follows COMMITS, not the working set. This shape — created and +// deleted without either write reaching a commit — is the one no store-side +// proof can ever cover, which is why auto-export also carries an in-process +// delete handoff. +func RunHistoryPresenceOmitsAnUncommittedCreateAndDelete(t *testing.T, ctx context.Context, fx HistoryPresenceFixture) { + t.Helper() + id := fx.Prefix + "-working" + + before, err := fx.CurrentCommit(ctx) + if err != nil { + t.Fatalf("CurrentCommit before: %v", err) + } + mustCreate(t, ctx, fx, id, "Working set only") + if err := fx.DeleteIssue(ctx, id); err != nil { + t.Fatalf("DeleteIssue(%s): %v", id, err) + } + after, err := fx.CurrentCommit(ctx) + if err != nil { + t.Fatalf("CurrentCommit after: %v", err) + } + if before != after { + t.Skipf("this store commits its own writes (HEAD moved %s → %s), so it has no uncommitted-create shape to assert about", before, after) + } + + assertPresence(t, ctx, fx, []string{id}, map[string]bool{id: false}) +} + +// RunHistoryPresenceAnswersAnEmptyRequest: no ids in, no ids out, no error. +// The guard calls this only when it has candidates, but a capability that +// errored on an empty slice would push that precondition onto every caller. +func RunHistoryPresenceAnswersAnEmptyRequest(t *testing.T, ctx context.Context, fx HistoryPresenceFixture) { + t.Helper() + present, err := fx.Presence.HistoricalIssueIDs(ctx, nil) + if err != nil { + t.Fatalf("HistoricalIssueIDs(nil): %v", err) + } + if len(present) != 0 { + t.Errorf("HistoricalIssueIDs(nil) = %v, want an empty set", present) + } +} + +// RunHistoryPresenceOmitsARewoundAwayID is the asymmetry that makes the whole +// capability safe to read as proof of deletion. dolt_history_issues walks +// HEAD's ancestry, so a hard reset to before an id's creation makes its +// commits unreachable and the id unproven — the store looks like it lost data, +// which is precisely what it did, and auto-export must keep refusing. +// +// Runs last: it rewinds the branch the earlier cases seeded. +func RunHistoryPresenceOmitsARewoundAwayID(t *testing.T, ctx context.Context, fx HistoryPresenceFixture) { + t.Helper() + if fx.ResetHard == nil { + t.Skip("fixture cannot rewind history") + } + id := fx.Prefix + "-rewound" + + anchor, err := fx.CurrentCommit(ctx) + if err != nil { + t.Fatalf("CurrentCommit: %v", err) + } + mustCreate(t, ctx, fx, id, "Rewound") + mustCommit(t, ctx, fx, "seed rewound") + assertPresence(t, ctx, fx, []string{id}, map[string]bool{id: true}) + + if err := fx.ResetHard(ctx, anchor); err != nil { + t.Fatalf("ResetHard(%s): %v", anchor, err) + } + assertPresence(t, ctx, fx, []string{id}, map[string]bool{id: false}) +} + +func assertPresence(t *testing.T, ctx context.Context, fx HistoryPresenceFixture, ask []string, want map[string]bool) { + t.Helper() + present, err := fx.Presence.HistoricalIssueIDs(ctx, ask) + if err != nil { + t.Fatalf("HistoricalIssueIDs(%v): %v", ask, err) + } + for id, wantPresent := range want { + _, got := present[id] + if got != wantPresent { + t.Errorf("HistoricalIssueIDs(%v): %s present=%v, want %v", ask, id, got, wantPresent) + } + } + for id := range present { + if _, asked := want[id]; !asked { + t.Errorf("HistoricalIssueIDs(%v) returned %s, which was not asked about", ask, id) + } + } +} + +func mustCreate(t *testing.T, ctx context.Context, fx HistoryPresenceFixture, id, title string) { + t.Helper() + if err := fx.CreateIssue(ctx, id, title); err != nil { + t.Fatalf("CreateIssue(%s): %v", id, err) + } +} + +func mustCommit(t *testing.T, ctx context.Context, fx HistoryPresenceFixture, msg string) { + t.Helper() + if err := fx.Commit(ctx, msg); err != nil { + t.Fatalf("Commit(%q): %v", msg, err) + } +} diff --git a/internal/storage/uow/batch_applier.go b/internal/storage/uow/batch_applier.go index 66b9a8dfd..927b36a96 100644 --- a/internal/storage/uow/batch_applier.go +++ b/internal/storage/uow/batch_applier.go @@ -192,6 +192,7 @@ func (r *uowApplyRun) applyCreate(ctx context.Context, index int, item *publicop if err != nil { return err } + storageissueops.OverlayCreateTimestamps(issue, created.Issue) if item.Key != "" { r.keys[item.Key] = issue.ID r.result.Keys[item.Key] = issue.ID diff --git a/internal/storage/uow/batch_creator.go b/internal/storage/uow/batch_creator.go index e00bf3bcb..6a9321522 100644 --- a/internal/storage/uow/batch_creator.go +++ b/internal/storage/uow/batch_creator.go @@ -115,5 +115,10 @@ func createBatchItem(ctx context.Context, uw UnitOfWork, request publicops.Creat if err != nil { return nil, storageissueops.ClassifyPublicCreateError(err) } - return hydrateIssueOperation(ctx, uw, created.Issue, false, false) + hydrated, err := hydrateIssueOperation(ctx, uw, created.Issue, false, false) + if err != nil { + return nil, err + } + storageissueops.OverlayCreateTimestamps(hydrated, created.Issue) + return hydrated, nil } diff --git a/internal/storage/uow/batch_creator_contract_test.go b/internal/storage/uow/batch_creator_contract_test.go index dec119da0..0bc5f74fb 100644 --- a/internal/storage/uow/batch_creator_contract_test.go +++ b/internal/storage/uow/batch_creator_contract_test.go @@ -58,6 +58,9 @@ func TestBatchCreatorContract(t *testing.T) { t.Run("DoesNotMutateTheCallerRequest", func(t *testing.T) { conformance.RunBatchCreatorDoesNotMutateTheCallerRequest(t, ctx, fixture) }) + t.Run("EchoesSubSecondTimestamps", func(t *testing.T) { + conformance.RunBatchCreatorEchoesSubSecondTimestamps(t, ctx, fixture) + }) } func newUOWBatchCreatorFixture(t *testing.T, ctx context.Context, prefix string) conformance.BatchCreatorFixture { diff --git a/internal/storage/uow/dolt_sql_provider.go b/internal/storage/uow/dolt_sql_provider.go index 922f47aae..74b780123 100644 --- a/internal/storage/uow/dolt_sql_provider.go +++ b/internal/storage/uow/dolt_sql_provider.go @@ -8,6 +8,8 @@ import ( "fmt" "io" "net" + "os" + "strings" "sync/atomic" "time" @@ -47,6 +49,10 @@ type doltSQLProvider struct { // non-mutating preview (--dry-run, --inspect). The open creates no // database and applies no migration; see providerOptions.preview. preview bool + // readOnly: the command that opened this provider only reads. Unlike + // preview it still bootstraps and migrates normally — it only changes what + // happens when the migration gate REFUSES; see providerOptions.readOnly. + readOnly bool // eventsJournalEnabled activates the durable events journal for THIS // provider instance only. See SetEventsJournalEnabled. eventsJournalEnabled atomic.Bool @@ -108,6 +114,15 @@ type providerOptions struct { // the same contract embeddeddolt.OpenForPreviewCommand gives the embedded // path. preview bool + // readOnly opens for a command that only reads (bd list, show, …). It is + // deliberately weaker than preview: the open still creates and migrates as + // usual, because a read command on a fresh or behind workspace has always + // been served by the ordinary open. It changes exactly one thing — when + // the shared-store migration gate refuses, the open warns and attaches to + // the database at its current schema instead of failing, so reads keep + // working through the upgrade window. That is the same warn-and-continue + // contract embeddeddolt gives its read-only-command intent. + readOnly bool } // WithPreview opens the provider for a non-mutating preview command. @@ -115,6 +130,11 @@ func WithPreview() ProviderOption { return func(o *providerOptions) { o.preview = true } } +// WithReadOnly opens the provider for a command that only reads. +func WithReadOnly() ProviderOption { + return func(o *providerOptions) { o.readOnly = true } +} + func applyProviderOptions(opts []ProviderOption) providerOptions { var resolved providerOptions for _, opt := range opts { @@ -238,12 +258,68 @@ func (p *doltSQLProvider) initSchemaAttempt(ctx context.Context, database string } if _, err := schema.MigrateUpWithLock(ctx, conn, database, schema.WithDatabaseSelector(selectProbeDatabase), - schema.WithLockedPreparation(p.serverEndpoint, preparer.prepare)); err != nil { + schema.WithLockedPreparation(p.serverEndpoint, preparer.prepare), + // This provider serves a shared database by definition — an external + // or proxied sql-server, or `bd serve`'s own daemon — so the same + // refusal server mode gets applies here (gastownhall/beads#5920, + // #5043). Passing it as a lock option rather than calling the gate + // before MigrateUpWithLock is what keeps the steady-state open free: + // the converged fast path returns before the lock, and the gate, are + // ever reached. Preparation has already CREATEd and USEd the + // database by the time it runs, so a fresh bootstrap reads version 0 + // and passes. + schema.WithMigrationGate(func(ctx context.Context, c *sql.Conn) error { + return schema.CheckSharedStoreMigrateGate(ctx, c, "", nil, nil) + })); err != nil { + var gateErr *schema.RemoteMigrateGateError + if errors.As(err, &gateErr) { + if p.readOnly { + return readThroughRefusedMigration(ctx, conn, database, gateErr) + } + // Explicit, though classifyInitSchemaError would reach the same + // verdict: a refusal must never be retried, because the retry + // would be an attempt to perform the migration it just refused. + return backoff.Permanent(gateErr) + } return classifyInitSchemaError(err) } return nil } +// readThroughRefusedMigration serves a read command from a database the +// migration gate refused to migrate: warn, attach at the current schema, and +// carry on. Writes remain refused (they open without WithReadOnly), so the +// database cannot be quietly written at a schema this binary believes is +// behind. +// +// This mirrors what embedded mode has done since bd-578h9.5 for its +// read-only-command intent. Without it, extending the gate to the proxied path +// would newly brick every read on a workspace waiting for its operator to +// consent — which is the opposite of the contract the gate's own message +// promises ("read commands keep working against the current schema"). +// It is a free function rather than a provider method on purpose: it needs no +// provider state, and the parity test that enumerates doltSQLProvider's method +// set as the capability surface a caller can reach through a +// UnitOfWorkProvider would otherwise demand the notifying wrapper answer a +// startup helper. +func readThroughRefusedMigration(ctx context.Context, conn *sql.Conn, database string, gateErr *schema.RemoteMigrateGateError) error { + if err := db.NewDDLSQLRepository(conn).UseDatabase(ctx, database); err != nil { + if isSerializationError(err) { + return fmt.Errorf("uow: switching to database: %w", err) + } + // The gate refused AND the database cannot even be attached: report + // the refusal, which is the actionable half. + return backoff.Permanent(gateErr) + } + fmt.Fprintf(os.Stderr, + "Warning: %[1]v\n"+ + " Read-only command: continuing on schema v%[2]d without migrating.\n"+ + " Writes are blocked until the schema is reconciled. Run '%[3]s'\n"+ + " once every client of this server is upgraded.\n", + gateErr, gateErr.CurrentVersion, schema.SharedConsentCommand) + return nil +} + // verifyTeamServerSchema is the team-server open path: the schema is owned by // beads-team-server (bts), so bd never creates the database or migrates. It // attaches to the existing database and verifies the schema version, then the @@ -255,9 +331,15 @@ func (p *doltSQLProvider) verifyTeamServerSchema(ctx context.Context, conn *sql. if isSerializationError(err) { return fmt.Errorf("uow: switching to database: %w", err) } - return backoff.Permanent(fmt.Errorf( - "uow: database %q not found — the schema is managed by beads-team-server; ask your operator to run 'bts init' first: %w", - database, err)) + return backoff.Permanent(classifyUseDatabaseError(err, database, teamServerUseDatabaseRemedy)) + } + // A USE that returns no error is not proof the session moved: see + // assertSessionDatabase. + if err := assertSessionDatabase(ctx, conn, database); err != nil { + if isSerializationError(err) { + return err + } + return backoff.Permanent(err) } if err := checkTeamServerSchema(ctx, conn, database); err != nil { if isSerializationError(err) { @@ -284,13 +366,104 @@ func (p *doltSQLProvider) attachPreviewDatabase(ctx context.Context, conn *sql.C if isSerializationError(err) { return fmt.Errorf("uow: switching to database: %w", err) } - return backoff.Permanent(fmt.Errorf( - "uow: database %q not found — preview commands (--dry-run, --inspect) never create or migrate a database; run the command without the preview flag first: %w", - database, err)) + return backoff.Permanent(classifyUseDatabaseError(err, database, previewUseDatabaseRemedy)) } return nil } +// useDatabaseRemedy carries the advice classifyUseDatabaseError appends to the +// two failure shapes whose remedy depends on which open path asked: a database +// the server says is absent, and a failure it could not classify at all. Denial +// needs no variant — a refused credential is refused the same way everywhere, +// and only the server administrator can change that. +type useDatabaseRemedy struct { + // missing is appended when the server reports the database does not exist. + missing string + // unclassified is appended when the driver error is neither a denial nor an + // absence, so the message must not claim to know which. + unclassified string +} + +var ( + // teamServerUseDatabaseRemedy: the schema on this path is owned by the team + // server, so bd never creates the database — an absent one is a + // provisioning request, not something a retry can fix. + teamServerUseDatabaseRemedy = useDatabaseRemedy{ + missing: "it must be provisioned on the server; ask the server administrator to create it, then re-run init", + unclassified: "the schema is managed by beads-team-server; ask your operator to run 'bts init' first", + } + // previewUseDatabaseRemedy: a preview open promised not to mutate anything, + // so it neither creates nor migrates where the ordinary open would. That + // answers both shapes, so both fields carry it. + previewUseDatabaseRemedy = useDatabaseRemedy{ + missing: previewRemedyText, + unclassified: previewRemedyText, + } +) + +const previewRemedyText = "preview commands (--dry-run, --inspect) never create or migrate a database; run the command without the preview flag first" + +// classifyUseDatabaseError describes a failed USE using only what the server +// actually said. The old wording called every failure "database %q not found", +// including the access-denied errors a scoped credential gets — which sent +// operators off to provision a database that already existed and only needed a +// grant. A server hides existence from a credential it has not granted the +// database (see isDatabaseNotFoundError), so on a denial bd must name both +// possibilities instead of picking one. +func classifyUseDatabaseError(err error, database string, remedy useDatabaseRemedy) error { + switch { + case isAccessDeniedError(err): + return fmt.Errorf( + "uow: access to database %q was denied for this credential — either the database is not provisioned on the server or this credential has not been granted access to it; ask the server administrator to provision the database and grant access: %w", + database, err) + case isDatabaseNotFoundError(err): + return fmt.Errorf("uow: database %q does not exist on the server — %s: %w", database, remedy.missing, err) + default: + return fmt.Errorf("uow: could not switch to database %q — %s: %w", database, remedy.unclassified, err) + } +} + +// rowQuerier is the subset of *sql.Conn, *sql.DB, and *sql.Tx that +// assertSessionDatabase needs, so the assertion can be tested against a stub. +type rowQuerier interface { + QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row +} + +// assertSessionDatabase verifies the server actually placed this session on the +// database bd asked for. +// +// A front door that scopes connections by credential — a gateway, a proxy that +// rewrites routing — can accept a foreign database name in the handshake or a +// USE for it and serve its own database anyway. Nothing later on the open path +// notices: bd's identity reads are unqualified, so they return the SESSION's +// database while bd attributes them to the REQUESTED one. That is how +// `bd init --database=` ends up reporting a prefix conflict against a +// database it never reached, and — with no --prefix to disagree — how a +// workspace silently adopts another project's identity and then reads and +// writes that project's data. +// +// Schema names compare case-insensitively, matching MySQL. A NULL or empty +// answer means the session is on no database at all, which is the same +// not-provisioned-or-not-granted situation classifyUseDatabaseError describes. +func assertSessionDatabase(ctx context.Context, q rowQuerier, want string) error { + var current sql.NullString + if err := q.QueryRowContext(ctx, "SELECT DATABASE()").Scan(¤t); err != nil { + return fmt.Errorf("uow: reading the session database after selecting %q: %w", want, err) + } + switch { + case !current.Valid || current.String == "": + return fmt.Errorf( + "uow: the server left this session on no database after selecting %q — either the database is not provisioned on the server or this credential has not been granted access to it; ask the server administrator to provision the database and grant access", + want) + case strings.EqualFold(current.String, want): + return nil + default: + return fmt.Errorf( + "uow: the server connected this session to database %q, not the requested %q — this credential appears to be scoped to %q. The requested database is not provisioned for this credential; ask the server administrator to provision it on the server (and grant this credential access), or re-run init without --database to use the provisioned one", + current.String, want, current.String) + } +} + // bootstrapPreparer carries the sticky fresh-bootstrap state across the backoff // retry attempts of a single initSchema call and runs as MigrateUpWithLock's // locked-preparation callback (see prepare). @@ -351,6 +524,14 @@ func (b *bootstrapPreparer) prepare(ctx context.Context, conn *sql.Conn) (*schem err: fmt.Errorf("uow: creating database: %w", err), retryable: true, } + case isAccessDeniedError(err): + // A server that provisions databases itself denies CREATE to the + // credentials it hands out. Say so instead of surfacing the raw + // driver error, and do not retry or fall back: bd must not go + // looking for another way to create a database it was refused. + return nil, &bootstrapPreparationError{err: fmt.Errorf( + "uow: creating database %q was denied for this credential — this server provisions databases server-side; ask the server administrator to provision it, then re-run init: %w", + b.database, err)} default: return nil, &bootstrapPreparationError{err: fmt.Errorf("uow: creating database: %w", err)} } @@ -471,6 +652,18 @@ func pingWithRetry(ctx context.Context, p pinger, bo *backoff.ExponentialBackOff }, backoff.WithContext(bo, ctx)) } +// assertSessionDatabaseOnPool runs assertSessionDatabase on a connection pinned +// out of pool. A pool hands out a different connection per call, so the +// assertion has to name the connection it is asserting about. +func assertSessionDatabaseOnPool(ctx context.Context, pool *sql.DB, want string) error { + conn, err := pool.Conn(ctx) + if err != nil { + return fmt.Errorf("uow: pin connection: %w", err) + } + defer func() { _ = conn.Close() }() + return assertSessionDatabase(ctx, conn, want) +} + // openDB opens dsn and waits out a server that is still coming up, retrying // transient ping failures for up to 30s (#6003). func openDB(ctx context.Context, dsn string) (*sql.DB, error) { @@ -527,6 +720,7 @@ func openAndInitSchema(ctx context.Context, ep proxy.Endpoint, database, rootUse teamServer: teamServer, expectedProjectID: expectedProjectID, preview: opts.preview, + readOnly: opts.readOnly, } } @@ -611,5 +805,14 @@ func openAndInitSchema(ctx context.Context, ep proxy.Endpoint, database, rootUse return nil, err } + // This pool names the database in the MySQL handshake and never issues a + // USE, so nothing has yet checked that the server honored the name. Every + // unqualified read the caller makes — project identity above all — belongs + // to whatever database this session actually landed on, so assert it once + // here, on a pinned connection, before handing the pool out. + if err := assertSessionDatabaseOnPool(ctx, dbConn, database); err != nil { + return nil, errors.Join(err, dbConn.Close()) + } + return newProvider(dbConn), nil } diff --git a/internal/storage/uow/dolt_sql_provider_lock_test.go b/internal/storage/uow/dolt_sql_provider_lock_test.go index aca6a198e..d276cbe57 100644 --- a/internal/storage/uow/dolt_sql_provider_lock_test.go +++ b/internal/storage/uow/dolt_sql_provider_lock_test.go @@ -116,6 +116,11 @@ func TestInitSchemaAcquiresMigrationLockBeforeBootstrapDDL(t *testing.T) { WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(1)) mock.ExpectQuery(regexp.QuoteMeta("SELECT COUNT(*) FROM dolt_status")). WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) + // The shared-store migration gate, between preparation and MigrateUp. This + // init just created the database, so the cursor table does not exist yet, + // the gate reads version 0, and it allows: creating a database is consent + // for its schema. + expectCursorProbe(mock, "schema_migrations", false) mock.ExpectExec(regexp.QuoteMeta("INSERT IGNORE INTO dolt_ignore VALUES (?, true)")). WithArgs(sqlmock.AnyArg()). WillReturnError(errors.New("first migration statement failed")) @@ -152,6 +157,8 @@ func TestInitSchemaAcquiresMigrationLockBeforeBootstrapDDL(t *testing.T) { // probe correctly declines and the ordinary locked pass follows — GET_LOCK // first, bootstrap DDL after. func TestInitSchemaConvergenceProbeRunsWithNoSessionDatabase(t *testing.T) { + schema.SetSharedMigrateConsent(true) + defer schema.SetSharedMigrateConsent(false) db, mock, err := sqlmock.New() if err != nil { t.Fatalf("create sql mock: %v", err) @@ -181,6 +188,11 @@ func TestInitSchemaConvergenceProbeRunsWithNoSessionDatabase(t *testing.T) { WillReturnError(&mysql.MySQLError{Number: 1007, Message: "database exists"}) mock.ExpectExec(regexp.QuoteMeta("USE `beads`")). WillReturnResult(sqlmock.NewResult(0, 0)) + // The shared-store migration gate, between preparation and MigrateUp. This + // database is pre-existing and behind, so the gate would refuse — the + // consent below keeps this test about the lock/probe ordering it exists to + // pin. See TestInitSchemaSharedStoreGate for the gate's own behavior. + expectSharedGateProbe(mock, 1, 0) mock.ExpectExec(regexp.QuoteMeta("INSERT IGNORE INTO dolt_ignore VALUES (?, true)")). WithArgs(sqlmock.AnyArg()). WillReturnError(errors.New("first migration statement failed")) diff --git a/internal/storage/uow/errors.go b/internal/storage/uow/errors.go index a7c0fee61..217d5904e 100644 --- a/internal/storage/uow/errors.go +++ b/internal/storage/uow/errors.go @@ -50,3 +50,41 @@ func isDatabaseExistsError(err error) bool { errLower := strings.ToLower(err.Error()) return strings.Contains(errLower, "database exists") || strings.Contains(errLower, "1007") } + +// isAccessDeniedError reports whether err is the server refusing an operation +// because the connected credential is not allowed to perform it. MySQL numbers +// these 1044 (ER_DBACCESS_DENIED_ERROR) and 1045 (ER_ACCESS_DENIED_ERROR); Dolt +// reports the same refusals under the generic 1105 with the wording intact, so +// the text fallback is what classifies them there. +func isAccessDeniedError(err error) bool { + if err == nil { + return false + } + var mysqlErr *mysql.MySQLError + if errors.As(err, &mysqlErr) && (mysqlErr.Number == 1044 || mysqlErr.Number == 1045) { + return true + } + errLower := strings.ToLower(err.Error()) + return strings.Contains(errLower, "access denied") || strings.Contains(errLower, "command denied") +} + +// isDatabaseNotFoundError reports whether the server said the database does not +// exist: MySQL 1049 (ER_BAD_DB_ERROR, "Unknown database"), or Dolt's "database +// not found: ". +// +// A false answer is NOT evidence the database exists. A server deliberately +// hides existence from a credential that has not been granted the database, +// answering access-denied for present and absent names alike, so only a +// privileged credential can tell the two apart. Callers must report the denial +// as a denial rather than guessing absence from it. +func isDatabaseNotFoundError(err error) bool { + if err == nil { + return false + } + var mysqlErr *mysql.MySQLError + if errors.As(err, &mysqlErr) && mysqlErr.Number == 1049 { + return true + } + errLower := strings.ToLower(err.Error()) + return strings.Contains(errLower, "database not found") || strings.Contains(errLower, "unknown database") +} diff --git a/internal/storage/uow/errors_test.go b/internal/storage/uow/errors_test.go new file mode 100644 index 000000000..0796af0ac --- /dev/null +++ b/internal/storage/uow/errors_test.go @@ -0,0 +1,143 @@ +package uow + +import ( + "errors" + "fmt" + "strings" + "testing" + + mysql "github.com/go-sql-driver/mysql" +) + +func TestIsAccessDeniedError(t *testing.T) { + for _, tt := range []struct { + name string + err error + want bool + }{ + {name: "nil", err: nil, want: false}, + {name: "mysql 1044 db access denied", err: &mysql.MySQLError{Number: 1044, Message: "Access denied for user"}, want: true}, + {name: "mysql 1045 access denied", err: &mysql.MySQLError{Number: 1045, Message: "Access denied for user"}, want: true}, + // Dolt reports both refusals under the generic 1105, so only the text + // classifies them. + {name: "dolt 1105 access denied", err: &mysql.MySQLError{Number: 1105, Message: "Access denied for user 'scoped'@'%' to database 'team_b'"}, want: true}, + {name: "dolt 1105 command denied", err: &mysql.MySQLError{Number: 1105, Message: "command denied to user 'scoped'@'%'"}, want: true}, + {name: "dolt 1105 unrelated", err: &mysql.MySQLError{Number: 1105, Message: "unexpected internal error"}, want: false}, + {name: "not found is not a denial", err: &mysql.MySQLError{Number: 1049, Message: "database not found: team_b"}, want: false}, + {name: "plain error with the wording", err: errors.New("db: UseDatabase: Access denied for user"), want: true}, + {name: "plain unrelated error", err: errors.New("connection reset by peer"), want: false}, + {name: "wrapped", err: fmt.Errorf("db: UseDatabase: %w", &mysql.MySQLError{Number: 1044}), want: true}, + } { + t.Run(tt.name, func(t *testing.T) { + if got := isAccessDeniedError(tt.err); got != tt.want { + t.Fatalf("isAccessDeniedError(%v) = %t, want %t", tt.err, got, tt.want) + } + }) + } +} + +func TestIsDatabaseNotFoundError(t *testing.T) { + for _, tt := range []struct { + name string + err error + want bool + }{ + {name: "nil", err: nil, want: false}, + {name: "mysql 1049", err: &mysql.MySQLError{Number: 1049, Message: "Unknown database 'team_b'"}, want: true}, + {name: "dolt text", err: errors.New("db: UseDatabase: database not found: team_b"), want: true}, + {name: "mysql text", err: errors.New("Error 1049 (42000): Unknown database 'team_b'"), want: true}, + // The load-bearing negative: a denial must never be reported as absence. + {name: "access denied is not absence", err: &mysql.MySQLError{Number: 1105, Message: "Access denied for user 'scoped'@'%' to database 'team_b'"}, want: false}, + {name: "plain unrelated error", err: errors.New("connection reset by peer"), want: false}, + {name: "wrapped", err: fmt.Errorf("db: UseDatabase: %w", &mysql.MySQLError{Number: 1049}), want: true}, + } { + t.Run(tt.name, func(t *testing.T) { + if got := isDatabaseNotFoundError(tt.err); got != tt.want { + t.Fatalf("isDatabaseNotFoundError(%v) = %t, want %t", tt.err, got, tt.want) + } + }) + } +} + +func TestClassifyUseDatabaseError(t *testing.T) { + // The exact server errors observed from dolt 2.1.8 against a credential + // granted only one database. + denied := fmt.Errorf("db: UseDatabase: %w", + &mysql.MySQLError{Number: 1105, Message: "Access denied for user 'scoped'@'%' to database 'team_b'"}) + missing := fmt.Errorf("db: UseDatabase: %w", + &mysql.MySQLError{Number: 1049, Message: "database not found: team_b"}) + other := fmt.Errorf("db: UseDatabase: %w", errors.New("connection reset by peer")) + + t.Run("denied reports a denial, never absence", func(t *testing.T) { + err := classifyUseDatabaseError(denied, "team_b", teamServerUseDatabaseRemedy) + assertContainsAll(t, err.Error(), + `access to database "team_b" was denied`, + "not provisioned on the server", + "has not been granted access", + "ask the server administrator", + // The wrapped driver error must survive for diagnosis. + "Access denied for user 'scoped'", + ) + if strings.Contains(err.Error(), "not found") || strings.Contains(err.Error(), "does not exist") { + t.Fatalf("denial must not claim the database is absent: %v", err) + } + if !errors.Is(err, denied) { + t.Fatalf("classifyUseDatabaseError() dropped the cause: %v", err) + } + }) + + t.Run("missing reports absence with the caller's remedy", func(t *testing.T) { + err := classifyUseDatabaseError(missing, "team_b", teamServerUseDatabaseRemedy) + assertContainsAll(t, err.Error(), + `database "team_b" does not exist on the server`, + "ask the server administrator to create it", + "database not found: team_b", + ) + }) + + t.Run("missing under preview keeps the preview remedy", func(t *testing.T) { + err := classifyUseDatabaseError(missing, "team_b", previewUseDatabaseRemedy) + assertContainsAll(t, err.Error(), + `database "team_b" does not exist on the server`, + "--dry-run", + "without the preview flag first", + ) + }) + + t.Run("unclassified claims neither absence nor denial", func(t *testing.T) { + err := classifyUseDatabaseError(other, "team_b", teamServerUseDatabaseRemedy) + assertContainsAll(t, err.Error(), + `could not switch to database "team_b"`, + "connection reset by peer", + ) + if strings.Contains(err.Error(), "does not exist") || strings.Contains(err.Error(), "was denied") { + t.Fatalf("unclassified failure must not guess a cause: %v", err) + } + }) + + // Vendor neutrality: the classified branches speak of "the server + // administrator", never a product. Only the untouched unclassified remedy + // still carries the historical product wording (tracked as a separate + // naming sweep). + t.Run("classified messages name no product", func(t *testing.T) { + for _, err := range []error{ + classifyUseDatabaseError(denied, "team_b", teamServerUseDatabaseRemedy), + classifyUseDatabaseError(missing, "team_b", teamServerUseDatabaseRemedy), + } { + for _, banned := range []string{"beads-team-server", "bts "} { + if strings.Contains(err.Error(), banned) { + t.Fatalf("message must not name a product (%q): %v", banned, err) + } + } + } + }) +} + +func assertContainsAll(t *testing.T, got string, wants ...string) { + t.Helper() + for _, want := range wants { + if !strings.Contains(got, want) { + t.Fatalf("message %q missing %q", got, want) + } + } +} diff --git a/internal/storage/uow/issue_operations.go b/internal/storage/uow/issue_operations.go index 708284dd9..ee8ca59f7 100644 --- a/internal/storage/uow/issue_operations.go +++ b/internal/storage/uow/issue_operations.go @@ -112,6 +112,7 @@ func (o *issueOperations) Create(ctx context.Context, request publicops.CreateRe if err != nil { return publicops.CreateResult{}, "", err } + storageissueops.OverlayCreateTimestamps(issue, created.Issue) return publicops.CreateResult{Issue: issue}, "create issue", nil }) } diff --git a/internal/storage/uow/journal_delete_actor_test.go b/internal/storage/uow/journal_delete_actor_test.go new file mode 100644 index 000000000..ad9f34645 --- /dev/null +++ b/internal/storage/uow/journal_delete_actor_test.go @@ -0,0 +1,91 @@ +package uow + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/steveyegge/beads/internal/storage" + "github.com/steveyegge/beads/internal/types" + publicops "github.com/steveyegge/beads/issueops" +) + +// TestDeleterAttributesTheRequesterInTheJournal is the #5985 regression on the +// SECOND write plumbing: a delete through the unit-of-work Deleter — the route +// proxied-server `bd delete` and the HTTP API's deleteIssues both take — must +// journal its delete row and the cascade dep_remove rows under the request's +// actor. +// +// It is a real second vote and not an engine check. This leg does not run +// issueops.DeleteInTx: it reaches domain.deleteMany and the repository seam, +// which is a DIFFERENT set of journal call sites from the store body's. That +// seam is exactly where #5908's review caught the actor going missing once +// already (IssueRepository.MovePersistence), and where it went missing again +// here. +// +// One provider, no t.Parallel: this backend has no per-test copy-on-write +// branch and the journal table is database-global (see +// newUOWRoleFixtureProvider). +func TestDeleterAttributesTheRequesterInTheJournal(t *testing.T) { + ctx := context.Background() + provider := newUOWRoleFixtureProvider(t, ctx, "dja") + + configurer, ok := provider.(storage.EventsJournalConfigurer) + require.Truef(t, ok, "provider %T does not implement storage.EventsJournalConfigurer", provider) + configurer.SetEventsJournalEnabled(true) + t.Cleanup(func() { configurer.SetEventsJournalEnabled(false) }) + + cursorSource, ok := provider.(EventsJournalCursorSource) + require.Truef(t, ok, "provider %T does not offer the EventsJournalCursor accessor", provider) + cursor, err := cursorSource.EventsJournalCursor() + require.NoError(t, err) + + kit := newUOWRoleFixtureKit(provider, "dja") + const target = "dja-target" + const dependent = "dja-dependent" + for _, id := range []string{target, dependent} { + require.NoError(t, kit.CreateIssue(ctx, &types.Issue{ + ID: id, Title: "t-" + id, IssueType: types.TypeTask, Status: types.StatusOpen, + }, "creator-1")) + } + // An inbound edge, so the forced delete orphans a survivor and has an edge + // to cascade off — the shape #5985 reported. + require.NoError(t, kit.AddDependency(ctx, &types.Dependency{ + IssueID: dependent, DependsOnID: target, Type: types.DepBlocks, + }, "linker-1")) + + // Baseline AFTER the seeds, so the assertions read only this delete's rows. + base, err := cursor.ReadEventsJournalPage(ctx, 0, 0) + require.NoError(t, err) + + source, ok := provider.(DeleterSource) + require.Truef(t, ok, "provider %T does not offer the Deleter accessor", provider) + deleter, err := source.Deleter() + require.NoError(t, err) + _, err = deleter.Delete(ctx, publicops.DeleteRequest{ + IDs: []string{target}, Force: true, Actor: "deleter-1", + }) + require.NoError(t, err) + + page, err := cursor.ReadEventsJournalPage(ctx, base.Head, 0) + require.NoError(t, err) + + var sawDelete, sawDepRemove bool + for _, row := range page.Rows { + switch row.Op { + case "delete": + require.Equalf(t, "deleter-1", row.Actor, + "delete row for %s must carry the requesting actor", row.IssueID) + sawDelete = true + case "dep_remove": + // The cascade edge removal belongs to the identity whose delete + // removed it, not to whoever created the edge. + require.Equalf(t, "deleter-1", row.Actor, + "cascade dep_remove row for %s must carry the requesting actor", row.IssueID) + sawDepRemove = true + } + } + require.Truef(t, sawDelete, "no delete row journaled: %+v", page.Rows) + require.Truef(t, sawDepRemove, "no cascade dep_remove row journaled: %+v", page.Rows) +} diff --git a/internal/storage/uow/lifecycle_create_contract_test.go b/internal/storage/uow/lifecycle_create_contract_test.go index fd4609dc1..19e1d16b5 100644 --- a/internal/storage/uow/lifecycle_create_contract_test.go +++ b/internal/storage/uow/lifecycle_create_contract_test.go @@ -37,6 +37,9 @@ func TestLifecycleCreateContract(t *testing.T) { t.Run("WritesEveryScalarField", func(t *testing.T) { conformance.RunLifecycleCreateWritesEveryScalarField(t, ctx, fixture) }) + t.Run("EchoesSubSecondTimestamps", func(t *testing.T) { + conformance.RunLifecycleCreateEchoesSubSecondTimestamps(t, ctx, fixture) + }) } func newUOWLifecycleCreateFixture(t *testing.T, ctx context.Context, prefix string) conformance.LifecycleCreateFixture { diff --git a/internal/storage/uow/session_database_test.go b/internal/storage/uow/session_database_test.go new file mode 100644 index 000000000..37e17dbe5 --- /dev/null +++ b/internal/storage/uow/session_database_test.go @@ -0,0 +1,113 @@ +package uow + +import ( + "context" + "database/sql" + "errors" + "regexp" + "strings" + "testing" + + "github.com/DATA-DOG/go-sqlmock" +) + +// sessionDatabaseMock stands in for a front door that answers SELECT DATABASE() +// with whatever it actually put the session on, which may not be what bd asked +// for. +func sessionDatabaseMock(t *testing.T, answer any) (*sql.DB, sqlmock.Sqlmock) { + t.Helper() + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New(): %v", err) + } + t.Cleanup(func() { _ = db.Close() }) + mock.ExpectQuery(regexp.QuoteMeta("SELECT DATABASE()")). + WillReturnRows(sqlmock.NewRows([]string{"DATABASE()"}).AddRow(answer)) + return db, mock +} + +func TestAssertSessionDatabase(t *testing.T) { + ctx := context.Background() + + t.Run("session on the requested database passes", func(t *testing.T) { + db, mock := sessionDatabaseMock(t, "team_b") + if err := assertSessionDatabase(ctx, db, "team_b"); err != nil { + t.Fatalf("assertSessionDatabase() = %v, want nil", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatal(err) + } + }) + + // MySQL schema names are case-insensitive, so a server that normalizes the + // name is not a mismatch. + t.Run("case-folded match passes", func(t *testing.T) { + db, _ := sessionDatabaseMock(t, "TEAM_B") + if err := assertSessionDatabase(ctx, db, "team_b"); err != nil { + t.Fatalf("assertSessionDatabase() = %v, want nil", err) + } + }) + + // The field bug: a credential scoped to team_a asks for team_b, the front + // door accepts the name and serves team_a. Before the assertion, every + // later unqualified read was attributed to team_b. + t.Run("scoped front door is caught and both databases are named", func(t *testing.T) { + db, _ := sessionDatabaseMock(t, "team_a") + err := assertSessionDatabase(ctx, db, "team_b") + if err == nil { + t.Fatal("assertSessionDatabase() = nil, want a mismatch error") + } + for _, want := range []string{ + `connected this session to database "team_a"`, + `not the requested "team_b"`, + "scoped", + "ask the server administrator", + "re-run init without --database", + } { + if !strings.Contains(err.Error(), want) { + t.Fatalf("mismatch message %q missing %q", err.Error(), want) + } + } + }) + + t.Run("no session database is reported as not provisioned or not granted", func(t *testing.T) { + for _, answer := range []any{nil, ""} { + db, _ := sessionDatabaseMock(t, answer) + err := assertSessionDatabase(ctx, db, "team_b") + if err == nil { + t.Fatalf("assertSessionDatabase(%v) = nil, want an error", answer) + } + for _, want := range []string{"no database", "not provisioned", "has not been granted access"} { + if !strings.Contains(err.Error(), want) { + t.Fatalf("message %q missing %q", err.Error(), want) + } + } + } + }) + + t.Run("query failure surfaces the driver error", func(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New(): %v", err) + } + t.Cleanup(func() { _ = db.Close() }) + cause := errors.New("connection reset by peer") + mock.ExpectQuery(regexp.QuoteMeta("SELECT DATABASE()")).WillReturnError(cause) + + got := assertSessionDatabase(ctx, db, "team_b") + if !errors.Is(got, cause) { + t.Fatalf("assertSessionDatabase() = %v, want it to wrap %v", got, cause) + } + }) + + // Vendor neutrality for the new strings. + t.Run("messages name no product", func(t *testing.T) { + db, _ := sessionDatabaseMock(t, "team_a") + err := assertSessionDatabase(ctx, db, "team_b") + for _, banned := range []string{"beads-team-server", "bts "} { + if strings.Contains(err.Error(), banned) { + t.Fatalf("message must not name a product (%q): %v", banned, err) + } + } + }) +} diff --git a/internal/storage/uow/shared_store_migrate_gate_test.go b/internal/storage/uow/shared_store_migrate_gate_test.go new file mode 100644 index 000000000..bceb40249 --- /dev/null +++ b/internal/storage/uow/shared_store_migrate_gate_test.go @@ -0,0 +1,238 @@ +package uow + +import ( + "context" + "errors" + "regexp" + "strings" + "testing" + + "github.com/DATA-DOG/go-sqlmock" + mysql "github.com/go-sql-driver/mysql" + "github.com/steveyegge/beads/internal/storage/schema" +) + +// expectSharedGateProbe mocks the shared-store gate's read sequence on an +// existing database: CurrentVersion, PendingVersions, and the remote count. +func expectSharedGateProbe(mock sqlmock.Sqlmock, current, remotes int) { + for i := 0; i < 2; i++ { // CurrentVersion, then PendingVersions + expectCursorProbe(mock, "schema_migrations", true) + mock.ExpectQuery(regexp.QuoteMeta("SELECT COALESCE(MAX(version), 0) FROM schema_migrations")). + WillReturnRows(sqlmock.NewRows([]string{"version"}).AddRow(current)) + } + mock.ExpectQuery(`SELECT COUNT\(\*\) FROM dolt_remotes`). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(remotes)) +} + +// expectBehindDatabaseThroughPreparation walks every statement of a proxied +// open against a pre-existing database that is one migration behind, up to and +// including the locked preparation — the point at which the migration gate +// runs. Returns the lock name so callers can expect its release. +func expectBehindDatabaseThroughPreparation(mock sqlmock.Sqlmock, database string, current int) string { + // Pre-lock convergence probe: the database exists, the session is put on + // it, and the cursor turns out to be behind — so the probe declines and + // the locked path runs. + expectNoSessionDatabase(mock) + expectDatabaseExistsProbe(mock, database, true) + mock.ExpectExec(regexp.QuoteMeta("USE `" + database + "`")). + WillReturnResult(sqlmock.NewResult(0, 0)) + expectCursorProbe(mock, "schema_migrations", true) + mock.ExpectQuery(regexp.QuoteMeta("SELECT COALESCE(MAX(version), 0) FROM schema_migrations")). + WillReturnRows(sqlmock.NewRows([]string{"version"}).AddRow(current)) + + lockName := schema.MigrationLockName(database) + mock.ExpectQuery(regexp.QuoteMeta("SELECT GET_LOCK(?, ?)")). + WithArgs(lockName, 5). + WillReturnRows(sqlmock.NewRows([]string{"locked"}).AddRow(1)) + // Locked preparation on a pre-existing database: the bare CREATE loses, so + // this init captures no fresh-bootstrap heal authority, and the USE is all + // it contributes. + mock.ExpectExec(regexp.QuoteMeta("CREATE DATABASE `" + database + "`")). + WillReturnError(&mysql.MySQLError{Number: 1007, Message: "database exists"}) + mock.ExpectExec(regexp.QuoteMeta("USE `" + database + "`")). + WillReturnResult(sqlmock.NewResult(0, 0)) + return lockName +} + +func expectLockRelease(mock sqlmock.Sqlmock, lockName string) { + mock.ExpectQuery(regexp.QuoteMeta("SELECT RELEASE_LOCK(?)")). + WithArgs(lockName). + WillReturnRows(sqlmock.NewRows([]string{"released"}).AddRow(1)) +} + +// TestInitSchemaSharedStoreGate covers the proxied/`bd serve` open path's half +// of gastownhall/beads#5920 — and closes the gate leg of #5043, where this +// path ran MigrateUpWithLock with no CheckRemoteMigrateGate variant at all and +// so migrated a shared database on every open, silently, since v1.2.2. +func TestInitSchemaSharedStoreGate(t *testing.T) { + resetConsent := func(t *testing.T) { + t.Helper() + t.Cleanup(func() { + schema.SetSharedMigrateConsent(false) + schema.SetForceAllowRemoteMigrate(false) + }) + } + + t.Run("behind database is refused, permanently", func(t *testing.T) { + resetConsent(t) + t.Setenv(schema.AllowRemoteMigrateEnv, "0") + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("create sql mock: %v", err) + } + defer db.Close() + + lockName := expectBehindDatabaseThroughPreparation(mock, "beads", 1) + expectSharedGateProbe(mock, 1, 0) + // No migration statement between the gate and the release: the refusal + // must land before MigrateUp issues its first one. + expectLockRelease(mock, lockName) + + p := &doltSQLProvider{defaultBranch: defaultBranch, db: db, serverEndpoint: "tcp:127.0.0.1:3306"} + err = p.initSchema(context.Background(), "beads") + var gateErr *schema.RemoteMigrateGateError + if !errors.As(err, &gateErr) { + t.Fatalf("initSchema() error = %T (%v), want *schema.RemoteMigrateGateError", err, err) + } + if gateErr.Decision != "shared-no-remote" { + t.Errorf("Decision = %q, want %q", gateErr.Decision, "shared-no-remote") + } + // The backoff budget is 60s; the mock scripts exactly one attempt. + // Reaching here at all proves the refusal was not retried — a retry + // would have hit unexpected-query errors and a different failure. + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } + }) + + t.Run("read-only open warns and serves the current schema", func(t *testing.T) { + resetConsent(t) + t.Setenv(schema.AllowRemoteMigrateEnv, "0") + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("create sql mock: %v", err) + } + defer db.Close() + + lockName := expectBehindDatabaseThroughPreparation(mock, "beads", 1) + expectSharedGateProbe(mock, 1, 0) + expectLockRelease(mock, lockName) + // The read-through: attach at the current schema and carry on. Still + // no migration statement anywhere. + mock.ExpectExec(regexp.QuoteMeta("USE `beads`")). + WillReturnResult(sqlmock.NewResult(0, 0)) + + p := &doltSQLProvider{defaultBranch: defaultBranch, db: db, serverEndpoint: "tcp:127.0.0.1:3306", readOnly: true} + var initErr error + stderr := captureStderr(t, func() { + initErr = p.initSchema(context.Background(), "beads") + }) + if initErr != nil { + t.Fatalf("initSchema() error = %v, want nil — reads must keep working on the old schema", initErr) + } + for _, want := range []string{"Read-only command", "without migrating", "bd migrate schema"} { + if !strings.Contains(stderr, want) { + t.Errorf("warning missing %q:\n%s", want, stderr) + } + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } + }) + + t.Run("fresh database is created and migrated — creation is consent", func(t *testing.T) { + resetConsent(t) + t.Setenv(schema.AllowRemoteMigrateEnv, "0") + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("create sql mock: %v", err) + } + defer db.Close() + + lockName := schema.MigrationLockName("beads") + expectNoSessionDatabase(mock) + expectDatabaseExistsProbe(mock, "beads", false) + mock.ExpectQuery(regexp.QuoteMeta("SELECT GET_LOCK(?, ?)")). + WithArgs(lockName, 5). + WillReturnRows(sqlmock.NewRows([]string{"locked"}).AddRow(1)) + mock.ExpectExec(regexp.QuoteMeta("CREATE DATABASE `beads`")). + WillReturnResult(sqlmock.NewResult(0, 0)) + mock.ExpectExec(regexp.QuoteMeta("USE `beads`")). + WillReturnResult(sqlmock.NewResult(0, 0)) + mock.ExpectQuery(regexp.QuoteMeta("SELECT DATABASE(), @@server_uuid, DOLT_HASHOF('HEAD')")). + WillReturnRows(sqlmock.NewRows([]string{"database", "server_uuid", "head"}).AddRow("beads", "server-uuid", "initial-head")) + mock.ExpectQuery(regexp.QuoteMeta("SELECT COUNT(*) FROM dolt_log")). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(1)) + mock.ExpectQuery(regexp.QuoteMeta("SELECT COUNT(*) FROM dolt_status")). + WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) + // The gate on a database this init just created: no cursor table, so + // version 0, so allow — and MigrateUp proceeds to its first statement. + expectCursorProbe(mock, "schema_migrations", false) + mock.ExpectExec(regexp.QuoteMeta("INSERT IGNORE INTO dolt_ignore VALUES (?, true)")). + WithArgs(sqlmock.AnyArg()). + WillReturnError(errors.New("reached the first migration statement")) + expectLockRelease(mock, lockName) + + p := &doltSQLProvider{defaultBranch: defaultBranch, db: db, serverEndpoint: "tcp:127.0.0.1:3306"} + err = p.initSchema(context.Background(), "beads") + if err == nil || !strings.Contains(err.Error(), "reached the first migration statement") { + t.Fatalf("initSchema() error = %v, want the fresh bootstrap to migrate", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } + }) + + t.Run("env consent migrates", func(t *testing.T) { + resetConsent(t) + t.Setenv(schema.AllowRemoteMigrateEnv, "1") + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("create sql mock: %v", err) + } + defer db.Close() + + lockName := expectBehindDatabaseThroughPreparation(mock, "beads", 1) + expectSharedGateProbe(mock, 1, 0) + mock.ExpectExec(regexp.QuoteMeta("INSERT IGNORE INTO dolt_ignore VALUES (?, true)")). + WithArgs(sqlmock.AnyArg()). + WillReturnError(errors.New("reached the first migration statement")) + expectLockRelease(mock, lockName) + + p := &doltSQLProvider{defaultBranch: defaultBranch, db: db, serverEndpoint: "tcp:127.0.0.1:3306"} + var initErr error + _ = captureStderr(t, func() { + initErr = p.initSchema(context.Background(), "beads") + }) + if initErr == nil || !strings.Contains(initErr.Error(), "reached the first migration statement") { + t.Fatalf("initSchema() error = %v, want the consented open to migrate", initErr) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } + }) + + // Preview never reaches MigrateUpWithLock at all, so it cannot reach the + // gate either — pinned so a future refactor cannot route preview through + // the migrating path and start refusing --dry-run on a behind workspace. + t.Run("preview open is unchanged", func(t *testing.T) { + resetConsent(t) + t.Setenv(schema.AllowRemoteMigrateEnv, "0") + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("create sql mock: %v", err) + } + defer db.Close() + + mock.ExpectExec(regexp.QuoteMeta("USE `beads`")). + WillReturnResult(sqlmock.NewResult(0, 0)) + + p := &doltSQLProvider{defaultBranch: defaultBranch, db: db, serverEndpoint: "tcp:127.0.0.1:3306", preview: true} + if err := p.initSchema(context.Background(), "beads"); err != nil { + t.Fatalf("initSchema() error = %v, want the attach-only preview open", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatalf("unmet SQL expectations: %v", err) + } + }) +} diff --git a/internal/storage/uow/team_server_integration_test.go b/internal/storage/uow/team_server_integration_test.go index a660f4230..5ce079653 100644 --- a/internal/storage/uow/team_server_integration_test.go +++ b/internal/storage/uow/team_server_integration_test.go @@ -53,14 +53,18 @@ func newTeamServerHarness(t *testing.T) *teamServerHarness { } func (h *teamServerHarness) openProvider(ctx context.Context, database string, teamServer bool, expectedProjectID string) (UnitOfWorkProvider, error) { + return h.openProviderAs(ctx, database, "root", "", teamServer, expectedProjectID) +} + +func (h *teamServerHarness) openProviderAs(ctx context.Context, database, user, password string, teamServer bool, expectedProjectID string) (UnitOfWorkProvider, error) { return NewExternalDoltServerUOWProvider( ctx, h.storeRootDir, database, h.logPath, configfile.ExternalDoltConfig{Host: "127.0.0.1", Port: h.port}, - "root", - "", + user, + password, 0, 0, teamServer, @@ -98,11 +102,15 @@ func TestTeamServerMode_Integration(t *testing.T) { const database = "beads_ts" - t.Run("missing database refused with bts init", func(t *testing.T) { + // A privileged credential CAN see that the database is absent, so the + // refusal says exactly that and asks for provisioning. It must not repeat + // the old blanket "not found" for failures it did not classify. + t.Run("missing database refused as absent, with provisioning guidance", func(t *testing.T) { p, err := h.openProvider(ctx, "beads_ts_missing", true, "") require.Error(t, err) assert.Nil(t, p) - assert.Contains(t, err.Error(), "bts init") + assert.Contains(t, err.Error(), `database "beads_ts_missing" does not exist on the server`) + assert.Contains(t, err.Error(), "ask the server administrator to create it") }) t.Run("existing empty database refused with bts init", func(t *testing.T) { @@ -136,6 +144,51 @@ func TestTeamServerMode_Integration(t *testing.T) { "team-server open must not modify schema_migrations") }) + // A credential granted only its own database is what a gateway front door + // hands out, and the server deliberately answers "access denied" for both + // absent and merely ungranted names — so bd cannot tell them apart and must + // stop claiming it can. + t.Run("scoped credential", func(t *testing.T) { + admin := h.directDB(t, "") + _, err := admin.ExecContext(ctx, "CREATE USER IF NOT EXISTS 'scoped'@'%' IDENTIFIED BY 'pw'") + require.NoError(t, err) + t.Cleanup(func() { + _, err := admin.ExecContext(ctx, "DROP USER IF EXISTS 'scoped'@'%'") + assert.NoError(t, err) + }) + _, err = admin.ExecContext(ctx, "GRANT ALL ON `"+database+"`.* TO 'scoped'@'%'") + require.NoError(t, err) + + t.Run("granted database still opens", func(t *testing.T) { + p, err := h.openProviderAs(ctx, database, "scoped", "pw", true, "") + require.NoError(t, err) + t.Cleanup(func() { _ = p.Close(ctx) }) + }) + + // beads_test exists on the server; the scoped credential has no grant + // for it. Both this and the absent name below must produce the SAME + // honest message, because the server gives bd the same error. + for _, tc := range []struct { + name string + database string + }{ + {name: "ungranted existing database", database: "beads_test"}, + {name: "absent database", database: "beads_ts_absent"}, + } { + t.Run(tc.name+" is reported as denied, not as absent", func(t *testing.T) { + p, err := h.openProviderAs(ctx, tc.database, "scoped", "pw", true, "") + require.Error(t, err) + assert.Nil(t, p) + assert.Contains(t, err.Error(), "access to database "+strconv.Quote(tc.database)+" was denied") + assert.Contains(t, err.Error(), "ask the server administrator to provision the database and grant access") + assert.NotContains(t, err.Error(), "does not exist on the server", + "a denial hides existence — bd must not claim the database is absent") + assert.NotContains(t, err.Error(), "bts init", + "the remedy for a denial is a grant, not provisioning by a named product") + }) + } + }) + t.Run("project identity is verified on every open, not just at init", func(t *testing.T) { // bts provisions the shared database with a project identity; bd // adopts it at init and, before this guard existed, never looked at diff --git a/internal/storage/versioncontrolops/gc.go b/internal/storage/versioncontrolops/gc.go index f0885afa6..c0e584e25 100644 --- a/internal/storage/versioncontrolops/gc.go +++ b/internal/storage/versioncontrolops/gc.go @@ -5,12 +5,45 @@ import ( "fmt" ) -// DoltGC runs Dolt garbage collection to reclaim disk space. Archive level 0 -// writes classic Snappy table files instead of zstd archives. +// DoltGC runs Dolt's default, generational garbage collection to reclaim disk +// space. Archive level 0 writes classic Snappy table files instead of zstd +// archives. +// +// Dolt storage is generational: every GC promotes the chunks reachable at that +// moment into the old generation, and a default pass only visits the new +// generation. Data that survived an earlier GC is therefore never revisited, +// so this pass reclaims only what was written since the last one. Use +// DoltGCFull after a history rewrite, which orphans chunks an earlier GC +// already promoted. +// // conn must be a non-transactional database connection since // DOLT_GC cannot run inside an explicit transaction. func DoltGC(ctx context.Context, conn DBConn) error { - if _, err := conn.ExecContext(ctx, "CALL DOLT_GC('--archive-level', '0')"); err != nil { + return doltGC(ctx, conn, false) +} + +// DoltGCFull runs a full Dolt garbage collection, collecting both the old and +// the new generation. Its reclaim set is a strict superset of DoltGC's: it +// frees everything a default pass frees, plus data an earlier GC promoted to +// the old generation. If a full pass frees nothing, the remaining bytes are +// still referenced. +// +// Full collections rewrite the old generation, so they cost more than a +// default pass — minutes on multi-gigabyte stores. Callers should reserve it +// for history rewrites (flatten, compact) and explicit opt-in. +// +// conn must be a non-transactional database connection since +// DOLT_GC cannot run inside an explicit transaction. +func DoltGCFull(ctx context.Context, conn DBConn) error { + return doltGC(ctx, conn, true) +} + +func doltGC(ctx context.Context, conn DBConn, full bool) error { + stmt := "CALL DOLT_GC('--archive-level', '0')" + if full { + stmt = "CALL DOLT_GC('--full', '--archive-level', '0')" + } + if _, err := conn.ExecContext(ctx, stmt); err != nil { return fmt.Errorf("dolt gc: %w", err) } return nil diff --git a/internal/storage/versioncontrolops/gc_test.go b/internal/storage/versioncontrolops/gc_test.go index 803b92ecd..66fb9ce29 100644 --- a/internal/storage/versioncontrolops/gc_test.go +++ b/internal/storage/versioncontrolops/gc_test.go @@ -25,3 +25,21 @@ func TestDoltGCDisablesArchiveCompression(t *testing.T) { t.Fatal(err) } } + +func TestDoltGCFullCollectsAllGenerations(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + t.Fatalf("sqlmock.New: %v", err) + } + defer db.Close() + + mock.ExpectExec(regexp.QuoteMeta("CALL DOLT_GC('--full', '--archive-level', '0')")). + WillReturnResult(sqlmock.NewResult(0, 1)) + + if err := DoltGCFull(context.Background(), db); err != nil { + t.Fatalf("DoltGCFull: %v", err) + } + if err := mock.ExpectationsWereMet(); err != nil { + t.Fatal(err) + } +} diff --git a/internal/testutil/testdoltserver.go b/internal/testutil/testdoltserver.go index c40d19ba4..647aefa59 100644 --- a/internal/testutil/testdoltserver.go +++ b/internal/testutil/testdoltserver.go @@ -243,6 +243,35 @@ type IsolatedDoltContainer struct { ctr *dolt.DoltContainer } +// Stop pauses the container while retaining its data volume. +func (c *IsolatedDoltContainer) Stop(ctx context.Context) error { + if c == nil || c.ctr == nil { + return fmt.Errorf("no Dolt container running") + } + return c.ctr.Stop(ctx, nil) +} + +// Start resumes a container previously stopped with Stop. +func (c *IsolatedDoltContainer) Start(ctx context.Context) error { + if c == nil || c.ctr == nil { + return fmt.Errorf("no Dolt container running") + } + return c.ctr.Start(ctx) +} + +// CurrentPort returns the container's currently mapped SQL port. Container +// runtimes may assign a new host port after Stop/Start. +func (c *IsolatedDoltContainer) CurrentPort(ctx context.Context) (string, error) { + if c == nil || c.ctr == nil { + return "", fmt.Errorf("no Dolt container running") + } + p, err := c.ctr.MappedPort(ctx, "3306/tcp") + if err != nil { + return "", err + } + return p.Port(), nil +} + // Exec runs cmd inside the container and returns its exit code and combined // output, demultiplexed (see containerExec). func (c *IsolatedDoltContainer) Exec(ctx context.Context, cmd []string) (int, string, error) { diff --git a/internal/tracker/conformance/conformance_test.go b/internal/tracker/conformance/conformance_test.go new file mode 100644 index 000000000..c2d03bbba --- /dev/null +++ b/internal/tracker/conformance/conformance_test.go @@ -0,0 +1,109 @@ +package conformance + +import ( + "context" + "net/http" + "strings" + "testing" + "time" + + "github.com/steveyegge/beads/internal/storage" + "github.com/steveyegge/beads/internal/tracker" + "github.com/steveyegge/beads/internal/types" +) + +func TestRunWithEngineAndUOWFixture(t *testing.T) { + Run(t, func(_ *testing.T, f *Fixture) Setup { + store := f.StoreFactory.Open().(*Store) + store.Config["test.project"] = "PROJ" + ref := "https://tracker.test/EXT-1" + store.Issues["bd-1"] = &types.Issue{ID: "bd-1", Title: "local", Status: types.StatusOpen, IssueType: types.TypeTask, Priority: 2, Labels: []string{"old"}, ExternalRef: &ref, UpdatedAt: time.Date(2026, 9, 3, 0, 0, 0, 0, time.UTC)} + remote := &mockTracker{} + return Setup{ + Engine: tracker.NewEngine(remote, store, "conformance"), + Store: store, + Expected: Expected{ExternalRef: ref, ConfigKey: "test.project", MetadataKey: "test.last_sync"}, + Refusal: func(context.Context) (*tracker.SyncResult, error) { + return nil, &storage.ErrUnsupported{Op: "proxy-only operation", Backend: "conformance"} + }, + APIOnly: func(ctx context.Context, _ func() tracker.Store) error { + f.HTTP.Enqueue(Response{Status: http.StatusOK, Body: `{"teams":[]}`}) + _, err := f.HTTP.Client().Get("https://tracker.test/teams") + return err + }, + } + }) +} + +func TestHTTPDoubleRecordsBodyAndTransportError(t *testing.T) { + d := NewHTTPDouble() + d.Enqueue(Response{Status: http.StatusCreated, Body: `{"id":"1"}`}) + resp, err := d.Client().Post("https://tracker.test/issues", "application/json", strings.NewReader(`{"title":"x"}`)) + if err != nil || resp.StatusCode != http.StatusCreated { + t.Fatalf("response=(%v,%v)", resp, err) + } + d.Enqueue(Response{Err: context.DeadlineExceeded}) + if _, err := d.Client().Get("https://tracker.test/issues"); err == nil { + t.Fatal("transport error was swallowed") + } + requests := d.Requests() + if len(requests) != 2 || string(requests[0].Body) != `{"title":"x"}` { + t.Fatalf("requests=%+v", requests) + } + if _, err := d.Client().Get("https://tracker.test/underflow"); err == nil { + t.Fatal("response queue underflow succeeded") + } + + d.Enqueue(Response{Status: http.StatusOK}) + req, err := http.NewRequest(http.MethodGet, "https://tracker.test/copied", nil) + if err != nil { + t.Fatal(err) + } + if _, err := d.RoundTrip(req); err != nil { + t.Fatal(err) + } + req.URL.Path = "/mutated" + if got := d.Requests()[3].URL.Path; got != "/copied" { + t.Fatalf("recorded URL aliases request: %q", got) + } +} + +type mockTracker struct{} + +func (*mockTracker) Name() string { return "test" } +func (*mockTracker) DisplayName() string { return "Test" } +func (*mockTracker) ConfigPrefix() string { return "test" } +func (*mockTracker) Init(context.Context, tracker.Store) error { return nil } +func (*mockTracker) Validate() error { return nil } +func (*mockTracker) Close() error { return nil } +func (*mockTracker) FetchIssues(context.Context, tracker.FetchOptions) ([]tracker.TrackerIssue, error) { + return []tracker.TrackerIssue{{ID: "EXT-1", Identifier: "EXT-1", URL: "https://tracker.test/EXT-1", Title: "remote", UpdatedAt: time.Date(2026, 9, 3, 1, 0, 0, 0, time.UTC), Labels: []string{"bug"}}}, nil +} +func (*mockTracker) FetchIssue(context.Context, string) (*tracker.TrackerIssue, error) { + return nil, nil +} +func (*mockTracker) CreateIssue(context.Context, *types.Issue) (*tracker.TrackerIssue, error) { + return &tracker.TrackerIssue{ID: "EXT-3", Identifier: "EXT-3", URL: "https://tracker.test/EXT-3"}, nil +} +func (*mockTracker) UpdateIssue(context.Context, string, *types.Issue) (*tracker.TrackerIssue, error) { + return &tracker.TrackerIssue{ID: "EXT-1", Identifier: "EXT-1", URL: "https://tracker.test/EXT-1"}, nil +} +func (*mockTracker) FieldMapper() tracker.FieldMapper { return mockMapper{} } +func (*mockTracker) IsExternalRef(string) bool { return true } +func (*mockTracker) ExtractIdentifier(ref string) string { return ref[strings.LastIndex(ref, "/")+1:] } +func (*mockTracker) BuildExternalRef(issue *tracker.TrackerIssue) string { return issue.URL } + +type mockMapper struct{} + +func (mockMapper) PriorityToBeads(interface{}) int { return 2 } +func (mockMapper) PriorityToTracker(int) interface{} { return 2 } +func (mockMapper) StatusToBeads(interface{}) types.Status { return types.StatusOpen } +func (mockMapper) StatusToTracker(types.Status) interface{} { return "open" } +func (mockMapper) TypeToBeads(interface{}) types.IssueType { return types.TypeTask } +func (mockMapper) TypeToTracker(types.IssueType) interface{} { return "task" } +func (mockMapper) IssueToBeads(issue *tracker.TrackerIssue) *tracker.IssueConversion { + return &tracker.IssueConversion{Issue: &types.Issue{ID: "bd-2", Title: issue.Title, Status: types.StatusOpen, IssueType: types.TypeTask, Priority: 2, Labels: issue.Labels}} +} +func (mockMapper) IssueToTracker(issue *types.Issue) map[string]interface{} { + return map[string]interface{}{"title": issue.Title} +} diff --git a/internal/tracker/conformance/http.go b/internal/tracker/conformance/http.go new file mode 100644 index 000000000..7f99d838e --- /dev/null +++ b/internal/tracker/conformance/http.go @@ -0,0 +1,96 @@ +// Package conformance contains reusable tracker adapter test fixtures. +package conformance + +import ( + "errors" + "fmt" + "io" + "net/http" + "net/url" + "strings" + "sync" +) + +// Request records one outbound tracker request. +type Request struct { + Method string + URL *url.URL + Body []byte +} + +// Response is one deterministic HTTP response. Err simulates transport +// failure; Status and Body are returned otherwise. +type Response struct { + Status int + Body string + Err error +} + +// HTTPDouble is a deterministic, FIFO HTTP RoundTripper. It records every +// request and returns queued responses, making API mapping tests independent of +// network services. +type HTTPDouble struct { + mu sync.Mutex + requests []Request + responses []Response +} + +// NewHTTPDouble returns an empty deterministic transport. +func NewHTTPDouble() *HTTPDouble { return &HTTPDouble{} } + +// Enqueue adds a response to the FIFO queue. +func (d *HTTPDouble) Enqueue(response Response) { + d.mu.Lock() + d.responses = append(d.responses, response) + d.mu.Unlock() +} + +// Requests returns a copy of all observed requests. +func (d *HTTPDouble) Requests() []Request { + d.mu.Lock() + defer d.mu.Unlock() + out := make([]Request, len(d.requests)) + copy(out, d.requests) + return out +} + +// Client returns an HTTP client using this transport. +func (d *HTTPDouble) Client() *http.Client { return &http.Client{Transport: d} } + +// RoundTrip implements http.RoundTripper. +func (d *HTTPDouble) RoundTrip(req *http.Request) (*http.Response, error) { + var body []byte + if req.Body != nil { + var err error + body, err = io.ReadAll(req.Body) + if err != nil { + return nil, err + } + } + d.mu.Lock() + urlCopy := *req.URL + d.requests = append(d.requests, Request{Method: req.Method, URL: &urlCopy, Body: body}) + var response Response + queued := false + if len(d.responses) > 0 { + response, d.responses = d.responses[0], d.responses[1:] + queued = true + } + d.mu.Unlock() + if response.Err != nil { + return nil, response.Err + } + if !queued { + return nil, errors.New("conformance HTTPDouble: no queued response") + } + if response.Status == 0 { + response.Status = http.StatusOK + } + return &http.Response{ + StatusCode: response.Status, + Status: fmt.Sprintf("%d", response.Status), + Header: make(http.Header), + Body: io.NopCloser(strings.NewReader(response.Body)), + Request: req, + }, nil +} diff --git a/internal/tracker/conformance/run.go b/internal/tracker/conformance/run.go new file mode 100644 index 000000000..895c27b4c --- /dev/null +++ b/internal/tracker/conformance/run.go @@ -0,0 +1,202 @@ +package conformance + +import ( + "context" + "errors" + "reflect" + "testing" + + "github.com/steveyegge/beads/internal/storage" + "github.com/steveyegge/beads/internal/tracker" + "github.com/steveyegge/beads/internal/types" +) + +// Snapshot is the normalized local state inspected by the shared suite. +type Snapshot struct { + Issues map[string]types.Issue + Config map[string]string + Metadata map[string]string + LastSync string +} + +// Fixture contains deterministic HTTP and local-store dependencies for one +// adapter test. StoreFactory counts opens so API-only operations can prove +// that they do not initialize local persistence. +type Fixture struct { + HTTP *HTTPDouble + StoreFactory *Factory +} + +// Factory is a fake UOW factory. Each Open returns the same map-backed store, +// while OpenCount records initialization attempts. +type Factory struct { + Store *Store + opens int +} + +// NewFactory returns a fixture factory with an empty store. +func NewFactory() *Factory { return &Factory{Store: NewStore()} } + +// Open returns the tracker store and records one UOW open. +func (f *Factory) Open() tracker.Store { f.opens++; return f.Store } + +// OpenCount reports the number of UOW opens. +func (f *Factory) OpenCount() int { return f.opens } + +// Setup binds an existing tracker.Engine to fixture assertions. Refusal and +// APIOnly are adapter-specific front doors; keeping them callbacks avoids +// inventing a backend-neutral command API. +type Setup struct { + Engine *tracker.Engine + Store *Store + Expected Expected + Refusal func(context.Context) (*tracker.SyncResult, error) + APIOnly func(context.Context, func() tracker.Store) error +} + +// Expected identifies adapter-specific values that the generic suite must +// observe without baking a provider's naming conventions into the harness. +type Expected struct { + ExternalRef string + ConfigKey string + MetadataKey string +} + +// Run executes the common tracker Engine/UOW contract. +func Run(t *testing.T, build func(*testing.T, *Fixture) Setup) { + t.Helper() + ctx := context.Background() + newSetup := func(t *testing.T) Setup { + fixture := &Fixture{HTTP: NewHTTPDouble(), StoreFactory: NewFactory()} + setup := build(t, fixture) + if setup.Engine == nil || setup.Store == nil || setup.Refusal == nil || setup.APIOnly == nil || setup.Expected.ExternalRef == "" || setup.Expected.ConfigKey == "" || setup.Expected.MetadataKey == "" { + t.Fatal("setup must provide Engine, Store, Expected refs/config/metadata, Refusal, and APIOnly") + } + return setup + } + + t.Run("pull_persists_normalized_fields_and_last_sync", func(t *testing.T) { + s := newSetup(t) + result, err := s.Engine.Sync(ctx, tracker.SyncOptions{Pull: true}) + if err != nil { + t.Fatalf("pull: %v", err) + } + if result == nil || !result.Success { + t.Fatalf("pull result = %+v", result) + } + snapshot := s.Store.Snapshot() + if len(snapshot.Issues) == 0 { + t.Fatal("pull created no local issue") + } + for _, issue := range snapshot.Issues { + if issue.ExternalRef == nil || *issue.ExternalRef != s.Expected.ExternalRef || len(issue.Labels) == 0 { + t.Fatalf("pull lost external ref/labels: %+v", issue) + } + } + if result.LastSync == "" || snapshot.LastSync != result.LastSync { + t.Fatalf("pull last_sync result=%q snapshot=%q", result.LastSync, snapshot.LastSync) + } + }) + + t.Run("push_persists_config_and_metadata", func(t *testing.T) { + s := newSetup(t) + result, err := s.Engine.Sync(ctx, tracker.SyncOptions{Push: true}) + if err != nil { + t.Fatalf("push: %v", err) + } + if result == nil || !result.Success { + t.Fatalf("push result = %+v", result) + } + snapshot := s.Store.Snapshot() + if snapshot.Config[s.Expected.ConfigKey] == "" || snapshot.Metadata[s.Expected.MetadataKey] == "" { + t.Fatalf("push did not persist config/metadata: %+v", snapshot) + } + }) + + t.Run("dry_run_does_not_mutate", func(t *testing.T) { + s := newSetup(t) + before, writes := s.Store.Snapshot(), s.Store.MutationCount() + for name, opts := range map[string]tracker.SyncOptions{"pull": {Pull: true, DryRun: true}, "push": {Push: true, DryRun: true}} { + result, err := s.Engine.Sync(ctx, opts) + if err != nil { + t.Fatalf("%s dry-run: %v", name, err) + } + if result == nil || !result.Success { + t.Fatalf("%s dry-run result = %+v", name, result) + } + } + if !reflect.DeepEqual(before, s.Store.Snapshot()) || writes != s.Store.MutationCount() { + t.Fatal("dry-run changed local state") + } + }) + + t.Run("refusal_is_explicit_and_does_not_mutate", func(t *testing.T) { + s := newSetup(t) + before, writes := s.Store.Snapshot(), s.Store.MutationCount() + _, err := s.Refusal(ctx) + if err == nil { + t.Fatal("refused operation succeeded") + } + var refusal *storage.ErrUnsupported + if !errors.As(err, &refusal) { + t.Fatalf("refusal is not typed: %v", err) + } + if !reflect.DeepEqual(before, s.Store.Snapshot()) || writes != s.Store.MutationCount() { + t.Fatal("refusal changed local state") + } + }) + + t.Run("external_ref_resolution_prefers_issue_plane", func(t *testing.T) { + s := newSetup(t) + // The setup seeded Expected.ExternalRef on the issues plane. Put the + // SAME ref on the wisps plane — the state a push-then-pull produces + // once a wisp has been pushed under a ref the durable bead also + // carries — and give the wisp the ID that sorts first, so a resolver + // with no plane preference returns it. + var want string + for id, issue := range s.Store.Issues { + if issue.ExternalRef != nil && *issue.ExternalRef == s.Expected.ExternalRef { + want = id + break + } + } + if want == "" { + t.Fatalf("setup seeded no issues-plane row for %q", s.Expected.ExternalRef) + } + ref := s.Expected.ExternalRef + wispID := "aaa-wisp-" + want + s.Store.Wisps[wispID] = &types.Issue{ID: wispID, Title: "pushed wisp", Status: types.StatusOpen, IssueType: types.TypeTask, Priority: 2, Ephemeral: true, ExternalRef: &ref} + + got, err := s.Store.GetIssueByExternalRef(ctx, ref) + if err != nil { + t.Fatalf("resolve %q: %v", ref, err) + } + // Resolving to the wisp would make the pull dedup update the ephemeral + // row instead of the durable bead — a silent write to the wrong issue. + if got == nil || got.ID != want { + t.Fatalf("external_ref %q resolved to %v, want issues-plane %q: the issues plane must win over the wisp plane", ref, got, want) + } + + // And the wisp plane is still reachable when the issues plane has no + // match, so plane preference did not become plane exclusion. + otherRef := ref + "-wisp-only" + onlyID := "wisp-only" + s.Store.Wisps[onlyID] = &types.Issue{ID: onlyID, Title: "wisp only", Status: types.StatusOpen, IssueType: types.TypeTask, Priority: 2, Ephemeral: true, ExternalRef: &otherRef} + got, err = s.Store.GetIssueByExternalRef(ctx, otherRef) + if err != nil || got == nil || got.ID != onlyID { + t.Fatalf("wisp-only external_ref %q resolved to (%v, %v), want %q", otherRef, got, err, onlyID) + } + }) + + t.Run("api_only_does_not_open_uow", func(t *testing.T) { + fixture := &Fixture{HTTP: NewHTTPDouble(), StoreFactory: NewFactory()} + s := build(t, fixture) + before := fixture.StoreFactory.OpenCount() + if err := s.APIOnly(ctx, fixture.StoreFactory.Open); err != nil { + t.Fatalf("api-only: %v", err) + } + if got := fixture.StoreFactory.OpenCount(); got != before { + t.Fatalf("api-only opened UOW: %d -> %d", before, got) + } + }) +} diff --git a/internal/tracker/conformance/store.go b/internal/tracker/conformance/store.go new file mode 100644 index 000000000..99f47b0fc --- /dev/null +++ b/internal/tracker/conformance/store.go @@ -0,0 +1,213 @@ +package conformance + +import ( + "context" + "strings" + "sync" + + "github.com/steveyegge/beads/internal/storage" + "github.com/steveyegge/beads/internal/tracker" + "github.com/steveyegge/beads/internal/types" +) + +// Store is a small tracker.Store implementation backed by maps. It is useful +// for adapter contract tests that need to observe local mutations without +// opening a real Dolt server. +type Store struct { + mu sync.Mutex + Issues map[string]*types.Issue + Config map[string]string + Metadata map[string]string + + // Wisps is the second storage plane. It exists so the shared suite can + // state the external_ref resolution contract — issues win over wisps — + // which is unrepresentable in a single-plane fixture and which a merged + // search silently gets wrong. Empty unless a test seeds it, so every + // other assertion is unaffected. + Wisps map[string]*types.Issue + + LastSync string + Mutations int +} + +// Snapshot returns a copy of the normalized state. +func (s *Store) Snapshot() Snapshot { + s.mu.Lock() + defer s.mu.Unlock() + out := Snapshot{Issues: make(map[string]types.Issue, len(s.Issues)), Config: cloneMap(s.Config), Metadata: cloneMap(s.Metadata), LastSync: s.LastSync} + for id, issue := range s.Issues { + out.Issues[id] = *cloneIssue(issue) + } + return out +} + +// MutationCount reports committed local writes. +func (s *Store) MutationCount() int { s.mu.Lock(); defer s.mu.Unlock(); return s.Mutations } + +var _ tracker.Store = (*Store)(nil) + +// ApplyIssueUpdate applies an issue update and replaces labels atomically. +func (s *Store) ApplyIssueUpdate(ctx context.Context, id string, updates map[string]interface{}, labels []string, actor string) error { + if err := s.UpdateIssue(ctx, id, updates, actor); err != nil { + return err + } + s.mu.Lock() + defer s.mu.Unlock() + if issue := s.Issues[id]; issue != nil && labels != nil { + issue.Labels = append([]string(nil), labels...) + } + return nil +} + +// NewStore returns an empty fake tracker store. +func NewStore() *Store { + return &Store{Issues: map[string]*types.Issue{}, Wisps: map[string]*types.Issue{}, Config: map[string]string{}, Metadata: map[string]string{}} +} + +// Open returns the store as a unit-of-work target. The call is intentionally +// side-effect free; callers count UOW opens in their factory when needed. +func (s *Store) Open() tracker.Store { return s } + +// GetConfig reads one config value. +func (s *Store) GetConfig(_ context.Context, key string) (string, error) { + s.mu.Lock() + defer s.mu.Unlock() + return s.Config[key], nil +} + +// GetAllConfig returns a copy of config. +func (s *Store) GetAllConfig(context.Context) (map[string]string, error) { + s.mu.Lock() + defer s.mu.Unlock() + return cloneMap(s.Config), nil +} + +// GetLocalMetadata reads one local metadata value. +func (s *Store) GetLocalMetadata(_ context.Context, key string) (string, error) { + s.mu.Lock() + defer s.mu.Unlock() + return s.Metadata[key], nil +} + +// SetLocalMetadata stores one local metadata value. +func (s *Store) SetLocalMetadata(_ context.Context, key, value string) error { + s.mu.Lock() + defer s.mu.Unlock() + s.Metadata[key] = value + if strings.HasSuffix(key, ".last_sync") { + s.LastSync = value + } + s.Mutations++ + return nil +} + +// SearchIssues returns a copy of all local issues. +func (s *Store) SearchIssues(_ context.Context, _ string, _ types.IssueFilter) ([]*types.Issue, error) { + s.mu.Lock() + defer s.mu.Unlock() + out := make([]*types.Issue, 0, len(s.Issues)) + for _, issue := range s.Issues { + out = append(out, cloneIssue(issue)) + } + return out, nil +} + +// GetIssueByExternalRef finds one local issue by external reference, issues +// plane first and wisps only as a fallback. The order is the contract, not an +// implementation detail: the direct backend resolves `issues` before `wisps` +// so pull dedup updates the durable bead rather than a pushed ephemeral one, +// and Run asserts it (see external_ref_resolution_prefers_issue_plane). +func (s *Store) GetIssueByExternalRef(_ context.Context, ref string) (*types.Issue, error) { + s.mu.Lock() + defer s.mu.Unlock() + for _, plane := range []map[string]*types.Issue{s.Issues, s.Wisps} { + if issue := matchExternalRef(plane, ref); issue != nil { + return cloneIssue(issue), nil + } + } + return nil, storage.ErrNotFound +} + +// matchExternalRef returns the lowest-ID row in one plane carrying ref, or nil. +// Go map iteration is randomized, so picking by ID keeps a plane with several +// matching rows from making the harness flaky. +func matchExternalRef(plane map[string]*types.Issue, ref string) *types.Issue { + var found *types.Issue + for _, issue := range plane { + if issue.ExternalRef == nil || *issue.ExternalRef != ref { + continue + } + if found == nil || issue.ID < found.ID { + found = issue + } + } + return found +} + +// GetDependentsWithMetadata returns no dependents in the minimal fixture. +func (s *Store) GetDependentsWithMetadata(context.Context, string) ([]*types.IssueWithDependencyMetadata, error) { + return nil, nil +} + +// GetDependenciesWithMetadata returns no dependencies in the minimal fixture. +func (s *Store) GetDependenciesWithMetadata(context.Context, string) ([]*types.IssueWithDependencyMetadata, error) { + return nil, nil +} + +// CreateIssue inserts one local issue. +func (s *Store) CreateIssue(_ context.Context, issue *types.Issue, _ string) error { + s.mu.Lock() + defer s.mu.Unlock() + s.Issues[issue.ID] = cloneIssue(issue) + s.Mutations++ + return nil +} + +// UpdateIssue applies the common tracker fields. +func (s *Store) UpdateIssue(_ context.Context, id string, updates map[string]interface{}, _ string) error { + s.mu.Lock() + defer s.mu.Unlock() + issue := s.Issues[id] + if issue == nil { + return storage.ErrNotFound + } + if v, ok := updates["title"].(string); ok { + issue.Title = v + } + if v, ok := updates["description"].(string); ok { + issue.Description = v + } + if v, ok := updates["external_ref"].(string); ok { + issue.ExternalRef = &v + } + s.Mutations++ + return nil +} + +// AddDependency is a no-op in the minimal fixture. +func (s *Store) AddDependency(context.Context, *types.Dependency, string) error { + s.mu.Lock() + s.Mutations++ + s.mu.Unlock() + return nil +} + +func cloneMap(in map[string]string) map[string]string { + out := make(map[string]string, len(in)) + for k, v := range in { + out[k] = v + } + return out +} +func cloneIssue(in *types.Issue) *types.Issue { + if in == nil { + return nil + } + out := *in + out.Labels = append([]string(nil), in.Labels...) + if in.ExternalRef != nil { + ref := *in.ExternalRef + out.ExternalRef = &ref + } + return &out +} diff --git a/internal/tracker/engine.go b/internal/tracker/engine.go index f6a5dadcb..9f8fc87e2 100644 --- a/internal/tracker/engine.go +++ b/internal/tracker/engine.go @@ -114,7 +114,7 @@ type PushHooks struct { // integrations follow, eliminating duplication between Linear, GitLab, etc. type Engine struct { Tracker IssueTracker - Store lifecycleStorage + Store Store Actor string PullHooks *PullHooks PushHooks *PushHooks @@ -131,22 +131,25 @@ type Engine struct { warnings []string } -type lifecycleStorage interface { - storage.Storage - storage.IssueLifecycleStore -} - // NewEngine creates a new sync engine for the given tracker and storage. -func NewEngine(tracker IssueTracker, store lifecycleStorage, actor string) *Engine { +// +// store is typed rather than interface{} so the seam names its contract: a +// storage.Storage satisfies Store and is adapted here, while a caller that +// already adapted its store (trackerStoreForCommand) passes the adapter +// straight through. NewStore is idempotent, so adapting twice is a no-op. +func NewEngine(tracker IssueTracker, store Store, actor string) *Engine { return &Engine{ Tracker: tracker, - Store: store, + Store: NewStore(store), Actor: actor, } } // Sync performs a complete synchronization operation based on the given options. func (e *Engine) Sync(ctx context.Context, opts SyncOptions) (*SyncResult, error) { + if e == nil || e.Store == nil { + return nil, fmt.Errorf("tracker sync store is not initialized") + } ctx, span := syncTracer.Start(ctx, "tracker.sync", trace.WithAttributes( attribute.String("sync.tracker", e.Tracker.DisplayName()), @@ -528,9 +531,14 @@ func (e *Engine) doPull(ctx context.Context, opts SyncOptions, allowOverwriteIDs updates["metadata"] = raw } - if err := e.Store.RunInIssueLifecycleTransaction(ctx, fmt.Sprintf("bd: pull update %s", existing.ID), func(tx storage.IssueLifecycleTransaction) error { - return applyPullIssueUpdate(ctx, tx, existing.ID, updates, conv.Issue.Labels, e.Actor) - }); err != nil { + markPullIssueFields(updates) + updater, ok := e.Store.(IssueUpdater) + if !ok { + e.warn("tracker store does not support atomic issue updates") + stats.Errors++ + continue + } + if err := updater.ApplyIssueUpdate(ctx, existing.ID, updates, conv.Issue.Labels, e.Actor); err != nil { e.warn("Failed to update %s: %v", existing.ID, err) stats.Errors++ if pulledIDs != nil { @@ -576,26 +584,15 @@ func (e *Engine) doPull(ctx context.Context, opts SyncOptions, allowOverwriteIDs return stats, nil } -// applyPullIssueUpdate keeps a pulled update atomic with its labels. -func applyPullIssueUpdate(ctx context.Context, tx storage.IssueLifecycleTransaction, id string, updates map[string]interface{}, labels []string, actor string) error { - if err := applyPullIssueFields(ctx, tx, id, updates, actor); err != nil { - return err - } - return syncIssueLabels(ctx, tx, id, labels, actor) +func applyPullIssueFields(ctx context.Context, tx storage.IssueLifecycleTransaction, id string, updates map[string]interface{}, actor string) error { + markPullIssueFields(updates) + return tx.UpdateIssue(ctx, id, updates, actor) } -// applyPullIssueFields applies a pulled issue's fields while preserving the -// caller's control over related collections such as labels. -// -// A pull always forces close policy. The remote tracker is authoritative for -// the status it reports, and it knows nothing about local-only children or -// local-only blockers — refusing an upstream close because of them would wedge -// sync on state the remote cannot see and the operator did not create. Both the -// pull and the conflict reimport route through here, so this is the one place -// that decision lives. -func applyPullIssueFields(ctx context.Context, tx storage.IssueLifecycleTransaction, id string, updates map[string]interface{}, actor string) error { +// markPullIssueFields adds the external-authority close policy marker shared +// by direct and proxied store adapters. +func markPullIssueFields(updates map[string]interface{}) { updates[issueops.OpForceClosePolicy] = true - return tx.UpdateIssue(ctx, id, updates, actor) } func pullIssueEqual(local *types.Issue, remote *types.Issue, ref string) bool { @@ -778,7 +775,21 @@ func (e *Engine) externalRefChangedAfter(ctx context.Context, local *types.Issue // never see this optional capability even when the concrete store underneath // implements it — the same reason cmd/bd type-asserts through // storage.UnwrapStore for RawDBAccessor, StoreLocator, and friends. -func externalRefHistoryQuerier(store storage.Storage) (storage.ExternalRefHistoryQuerier, bool) { +func externalRefHistoryQuerier(store Store) (ExternalRefHistoryStore, bool) { + if q, ok := store.(ExternalRefHistoryStore); ok { + return q, true + } + if direct, ok := store.(*directStore); ok { + if q, ok := direct.Storage.(ExternalRefHistoryStore); ok { + return q, true + } + if dolt, ok := direct.Storage.(storage.DoltStorage); ok { + if q, ok := storage.UnwrapStore(dolt).(ExternalRefHistoryStore); ok { + return q, true + } + } + return nil, false + } if q, ok := store.(storage.ExternalRefHistoryQuerier); ok { return q, true } @@ -1303,9 +1314,13 @@ func (e *Engine) reimportIssue(ctx context.Context, c Conflict) { } } - if err := e.Store.RunInIssueLifecycleTransaction(ctx, fmt.Sprintf("bd: reimport update %s", c.IssueID), func(tx storage.IssueLifecycleTransaction) error { - return applyPullIssueFields(ctx, tx, c.IssueID, updates, e.Actor) - }); err != nil { + markPullIssueFields(updates) + updater, ok := e.Store.(IssueUpdater) + if !ok { + e.warn("tracker store does not support atomic issue updates") + return + } + if err := updater.ApplyIssueUpdate(ctx, c.IssueID, updates, nil, e.Actor); err != nil { e.warn("Failed to update %s during reimport: %v", c.IssueID, err) } } @@ -1475,7 +1490,7 @@ func (e *Engine) dependencyIssueResolver(ctx context.Context, extraIssues []*typ }, nil } -func dependencyExists(ctx context.Context, store storage.Storage, issueID, dependsOnID string, depType types.DependencyType) bool { +func dependencyExists(ctx context.Context, store Store, issueID, dependsOnID string, depType types.DependencyType) bool { if strings.TrimSpace(issueID) == "" || strings.TrimSpace(dependsOnID) == "" { return false } diff --git a/internal/tracker/store.go b/internal/tracker/store.go new file mode 100644 index 000000000..61c8a610f --- /dev/null +++ b/internal/tracker/store.go @@ -0,0 +1,103 @@ +package tracker + +import ( + "context" + "time" + + "github.com/steveyegge/beads/internal/storage" + "github.com/steveyegge/beads/internal/types" +) + +// Store is the persistence contract required by the tracker synchronization +// engine. It deliberately names only tracker operations; direct stores and +// unit-of-work providers can each adapt to this seam without pretending to +// implement the other backend's full storage surface. +type Store interface { + GetConfig(context.Context, string) (string, error) + GetAllConfig(context.Context) (map[string]string, error) + GetLocalMetadata(context.Context, string) (string, error) + SetLocalMetadata(context.Context, string, string) error + SearchIssues(context.Context, string, types.IssueFilter) ([]*types.Issue, error) + GetIssueByExternalRef(context.Context, string) (*types.Issue, error) + GetDependentsWithMetadata(context.Context, string) ([]*types.IssueWithDependencyMetadata, error) + GetDependenciesWithMetadata(context.Context, string) ([]*types.IssueWithDependencyMetadata, error) + CreateIssue(context.Context, *types.Issue, string) error + UpdateIssue(context.Context, string, map[string]interface{}, string) error + AddDependency(context.Context, *types.Dependency, string) error +} + +// IssueUpdater is the optional atomic lifecycle-plus-label update capability. +type IssueUpdater interface { + ApplyIssueUpdate(context.Context, string, map[string]interface{}, []string, string) error +} + +// ExternalRefHistoryStore is an optional capability used for precise +// relink/conflict detection. +type ExternalRefHistoryStore interface { + PreviousExternalRef(context.Context, string, time.Time) (string, bool, error) +} + +// NewStore adapts a classic storage.Storage to the tracker contract. Values +// already implementing Store are returned unchanged, so NewStore is idempotent +// and safe to call on a value that a caller has already adapted. +// +// Branch order is load-bearing, and neither interface alone can discriminate: +// +// - storage.Storage is a strict superset of Store, so a raw direct store also +// satisfies Store. Testing Store first would return it un-adapted and drop +// ApplyIssueUpdate entirely. +// - directStore embeds the storage.Storage interface, so *directStore +// satisfies storage.Storage too. Testing storage.Storage first re-wraps an +// already-adapted value as &directStore{Storage: &directStore{...}}, and +// the inner *directStore can never satisfy storage.IssueLifecycleStore +// (RunInIssueLifecycleTransaction is not part of storage.Storage). That +// silently degrades ApplyIssueUpdate to UpdateIssue — no labels, no +// lifecycle transaction. +// +// The tracker's own adapters are therefore matched by concrete type first: no +// storage backend can accidentally satisfy that check. +func NewStore(value interface{}) Store { + switch store := value.(type) { + case *directStore: + return store + case *uowStore: + return store + } + if store, ok := value.(storage.Storage); ok { + return &directStore{Storage: store} + } + if store, ok := value.(Store); ok { + return store + } + return nil +} + +type directStore struct{ storage.Storage } + +var _ Store = (*directStore)(nil) +var _ IssueUpdater = (*directStore)(nil) + +func (s *directStore) ApplyIssueUpdate(ctx context.Context, id string, updates map[string]interface{}, labels []string, actor string) error { + dolt, ok := s.Storage.(storage.IssueLifecycleStore) + if !ok { + return s.Storage.UpdateIssue(ctx, id, updates, actor) + } + return dolt.RunInIssueLifecycleTransaction(ctx, "bd: tracker update "+id, func(tx storage.IssueLifecycleTransaction) error { + if err := tx.UpdateIssue(ctx, id, updates, actor); err != nil { + return err + } + if labels == nil { + return nil + } + // syncIssueLabels, not a local copy: it normalizes both label sets + // (trim + drop empty), which is the semantics the pull path had before + // this seam moved behind ApplyIssueUpdate. Comparing raw strings makes + // a whitespace-only difference churn remove+add on every sync and lets + // an empty label reach AddLabel. + return syncIssueLabels(ctx, tx, id, labels, actor) + }) +} + +func (s *directStore) GetDependenciesWithMetadata(ctx context.Context, id string) ([]*types.IssueWithDependencyMetadata, error) { + return s.Storage.GetDependenciesWithMetadata(ctx, id) +} diff --git a/internal/tracker/store_test.go b/internal/tracker/store_test.go new file mode 100644 index 000000000..7c6b75c56 --- /dev/null +++ b/internal/tracker/store_test.go @@ -0,0 +1,206 @@ +package tracker + +import ( + "context" + "errors" + "testing" + + "github.com/steveyegge/beads/internal/storage" + "github.com/steveyegge/beads/internal/storage/uow" + "github.com/steveyegge/beads/internal/types" +) + +type contractStoreStub struct{} + +func (contractStoreStub) GetConfig(context.Context, string) (string, error) { return "", nil } +func (contractStoreStub) GetAllConfig(context.Context) (map[string]string, error) { return nil, nil } +func (contractStoreStub) GetLocalMetadata(context.Context, string) (string, error) { return "", nil } +func (contractStoreStub) SetLocalMetadata(context.Context, string, string) error { return nil } +func (contractStoreStub) SearchIssues(context.Context, string, types.IssueFilter) ([]*types.Issue, error) { + return nil, nil +} +func (contractStoreStub) GetIssueByExternalRef(context.Context, string) (*types.Issue, error) { + return nil, nil +} +func (contractStoreStub) GetDependentsWithMetadata(context.Context, string) ([]*types.IssueWithDependencyMetadata, error) { + return nil, nil +} +func (contractStoreStub) GetDependenciesWithMetadata(context.Context, string) ([]*types.IssueWithDependencyMetadata, error) { + return nil, nil +} +func (contractStoreStub) CreateIssue(context.Context, *types.Issue, string) error { return nil } +func (contractStoreStub) UpdateIssue(context.Context, string, map[string]interface{}, string) error { + return nil +} +func (contractStoreStub) AddDependency(context.Context, *types.Dependency, string) error { return nil } + +func TestNewStoreNilIsSafe(t *testing.T) { + if got := NewStore(nil); got != nil { + t.Fatalf("NewStore(nil) = %T, want nil", got) + } +} + +func TestNewStorePreservesNarrowStore(t *testing.T) { + stub := contractStoreStub{} + if got := NewStore(stub); got == nil { + t.Fatal("NewStore returned nil for a Store implementation") + } +} + +type failingUOWProvider struct{ err error } + +func (p failingUOWProvider) NewUOW(context.Context) (uow.UnitOfWork, error) { return nil, p.err } +func (p failingUOWProvider) Close(context.Context) error { return nil } + +func TestUOWStorePropagatesProviderFailure(t *testing.T) { + want := errors.New("provider unavailable") + store := NewUOWStore(failingUOWProvider{err: want}) + _, err := store.GetConfig(context.Background(), "linear.team_id") + if !errors.Is(err, want) { + t.Fatalf("GetConfig error = %v, want %v", err, want) + } +} + +func TestNewUOWStoreTypedNilIsSafe(t *testing.T) { + var provider *failingUOWProvider + if got := NewUOWStore(provider); got != nil { + t.Fatalf("typed nil provider returned %T", got) + } +} + +type lifecycleStoreFake struct { + storage.Storage + labels []string + updateErr error + // degraded records a direct UpdateIssue that bypassed the lifecycle + // transaction. That is the label-dropping fallback ApplyIssueUpdate takes + // when its inner value is not a storage.IssueLifecycleStore. + degraded bool +} + +func (s *lifecycleStoreFake) RunInIssueLifecycleTransaction(ctx context.Context, _ string, fn func(storage.IssueLifecycleTransaction) error) error { + return fn(&lifecycleTxFake{store: s}) +} + +func (s *lifecycleStoreFake) UpdateIssue(context.Context, string, map[string]interface{}, string) error { + s.degraded = true + return s.updateErr +} + +type lifecycleTxFake struct { + storage.Transaction + store *lifecycleStoreFake +} + +func (tx *lifecycleTxFake) UpdateIssue(context.Context, string, map[string]interface{}, string) error { + return tx.store.updateErr +} +func (tx *lifecycleTxFake) GetLabels(context.Context, string) ([]string, error) { + return append([]string(nil), tx.store.labels...), nil +} +func (tx *lifecycleTxFake) AddLabel(_ context.Context, _, label, _ string) error { + tx.store.labels = append(tx.store.labels, label) + return nil +} +func (tx *lifecycleTxFake) RemoveLabel(_ context.Context, _, label, _ string) error { + filtered := tx.store.labels[:0] + for _, existing := range tx.store.labels { + if existing != label { + filtered = append(filtered, existing) + } + } + tx.store.labels = filtered + return nil +} +func (tx *lifecycleTxFake) ReopenIssueWithResult(context.Context, string, string, string) (bool, error) { + return false, nil +} + +func TestDirectStoreApplyIssueUpdateDistinguishesOmittedAndEmptyLabels(t *testing.T) { + underlying := &lifecycleStoreFake{labels: []string{"keep"}} + store := NewStore(underlying).(*directStore) + if err := store.ApplyIssueUpdate(context.Background(), "bd-1", nil, nil, "actor"); err != nil { + t.Fatal(err) + } + if len(underlying.labels) != 1 || underlying.labels[0] != "keep" { + t.Fatalf("nil labels changed state: %v", underlying.labels) + } + if err := store.ApplyIssueUpdate(context.Background(), "bd-1", nil, []string{}, "actor"); err != nil { + t.Fatal(err) + } + if len(underlying.labels) != 0 { + t.Fatalf("empty labels did not clear state: %v", underlying.labels) + } +} + +func TestDirectStoreApplyIssueUpdateFailureDoesNotTouchLabels(t *testing.T) { + underlying := &lifecycleStoreFake{labels: []string{"keep"}, updateErr: errors.New("update failed")} + store := NewStore(underlying).(*directStore) + if err := store.ApplyIssueUpdate(context.Background(), "bd-1", nil, []string{}, "actor"); !errors.Is(err, underlying.updateErr) { + t.Fatalf("error = %v", err) + } + if len(underlying.labels) != 1 || underlying.labels[0] != "keep" { + t.Fatalf("failed update changed labels: %v", underlying.labels) + } +} + +// TestNewEngineKeepsDirectStoreAdaptationIntact pins the production wiring that +// no other test covers: trackerStoreForCommand adapts the direct store itself +// and hands the adapter to NewEngine, which adapts again. Re-wrapping produces +// &directStore{Storage: &directStore{...}}, whose inner value can never satisfy +// storage.IssueLifecycleStore, so ApplyIssueUpdate silently degrades to a +// label-less, transaction-less UpdateIssue. The conformance harness cannot see +// this: its store implements tracker.Store directly, which is the one shape +// direct mode never produces. +func TestNewEngineKeepsDirectStoreAdaptationIntact(t *testing.T) { + underlying := &lifecycleStoreFake{labels: []string{"stale"}} + adapted := NewStore(underlying) // what trackerStoreForCommand returns in direct mode + + engine := NewEngine(nil, adapted, "actor") + + if engine.Store != adapted { + t.Fatalf("NewEngine re-adapted an already-adapted store: %T", engine.Store) + } + updater, ok := engine.Store.(IssueUpdater) + if !ok { + t.Fatalf("engine store %T lost the IssueUpdater capability", engine.Store) + } + if err := updater.ApplyIssueUpdate(context.Background(), "bd-1", nil, []string{"fresh"}, "actor"); err != nil { + t.Fatal(err) + } + if underlying.degraded { + t.Fatal("ApplyIssueUpdate bypassed the lifecycle transaction") + } + if len(underlying.labels) != 1 || underlying.labels[0] != "fresh" { + t.Fatalf("labels did not survive the pull: %v", underlying.labels) + } +} + +func TestNewStoreIsIdempotent(t *testing.T) { + direct := NewStore(&lifecycleStoreFake{}) + if got := NewStore(direct); got != direct { + t.Fatalf("NewStore(directStore) = %T, want the same value", got) + } + uowBacked := NewUOWStore(failingUOWProvider{err: errors.New("unused")}) + if got := NewStore(uowBacked); got != uowBacked { + t.Fatalf("NewStore(uowStore) = %T, want the same value", got) + } + stub := contractStoreStub{} + if got := NewStore(NewStore(stub)); got != Store(stub) { + t.Fatalf("NewStore(narrow Store) = %T, want the same value", got) + } +} + +func TestDirectStoreApplyIssueUpdateNormalizesLabels(t *testing.T) { + underlying := &lifecycleStoreFake{labels: []string{"keep"}} + store := NewStore(underlying).(*directStore) + + // " keep " differs from "keep" only in whitespace and must not churn; + // the empty label must be dropped rather than reaching AddLabel. + if err := store.ApplyIssueUpdate(context.Background(), "bd-1", nil, []string{" keep ", ""}, "actor"); err != nil { + t.Fatal(err) + } + if len(underlying.labels) != 1 || underlying.labels[0] != "keep" { + t.Fatalf("labels churned or admitted an empty value: %v", underlying.labels) + } +} diff --git a/internal/tracker/test_helpers_pure_test.go b/internal/tracker/test_helpers_pure_test.go index 719180833..c2e2072a0 100644 --- a/internal/tracker/test_helpers_pure_test.go +++ b/internal/tracker/test_helpers_pure_test.go @@ -79,14 +79,14 @@ func (m *mockExternalRefTracker) BuildExternalRef(issue *TrackerIssue) string { return m.mockTracker.BuildExternalRef(issue) } -func (m *mockTracker) Name() string { return m.name } -func (m *mockTracker) DisplayName() string { return m.name } -func (m *mockTracker) ConfigPrefix() string { return m.name } -func (m *mockTracker) Init(_ context.Context, _ storage.Storage) error { return nil } -func (m *mockTracker) Validate() error { return nil } -func (m *mockTracker) Close() error { return nil } -func (m *mockTracker) FieldMapper() FieldMapper { return m.fieldMapper } -func (m *mockTracker) IsExternalRef(ref string) bool { return len(ref) > 0 } +func (m *mockTracker) Name() string { return m.name } +func (m *mockTracker) DisplayName() string { return m.name } +func (m *mockTracker) ConfigPrefix() string { return m.name } +func (m *mockTracker) Init(_ context.Context, _ Store) error { return nil } +func (m *mockTracker) Validate() error { return nil } +func (m *mockTracker) Close() error { return nil } +func (m *mockTracker) FieldMapper() FieldMapper { return m.fieldMapper } +func (m *mockTracker) IsExternalRef(ref string) bool { return len(ref) > 0 } func (m *mockTracker) ExtractIdentifier(ref string) string { if i := strings.LastIndex(ref, "/"); i >= 0 { return ref[i+1:] diff --git a/internal/tracker/tracker.go b/internal/tracker/tracker.go index a84f2622f..1517e20e6 100644 --- a/internal/tracker/tracker.go +++ b/internal/tracker/tracker.go @@ -3,7 +3,6 @@ package tracker import ( "context" - "github.com/steveyegge/beads/internal/storage" "github.com/steveyegge/beads/internal/types" ) @@ -22,7 +21,7 @@ type IssueTracker interface { // Init initializes the tracker with configuration from the beads config store. // Called once before any sync operations. - Init(ctx context.Context, store storage.Storage) error + Init(ctx context.Context, store Store) error // Validate checks that the tracker is properly configured and can connect. Validate() error diff --git a/internal/tracker/uow_store.go b/internal/tracker/uow_store.go new file mode 100644 index 000000000..de99fc453 --- /dev/null +++ b/internal/tracker/uow_store.go @@ -0,0 +1,174 @@ +package tracker + +import ( + "context" + "reflect" + + "github.com/steveyegge/beads/internal/storage" + "github.com/steveyegge/beads/internal/storage/domain" + "github.com/steveyegge/beads/internal/storage/uow" + "github.com/steveyegge/beads/internal/types" +) + +// NewUOWStore adapts a proxied unit-of-work provider to the tracker Store +// contract. Every operation uses a request-scoped unit of work; lifecycle +// updates and label replacement remain one atomic transaction. +func NewUOWStore(provider uow.UnitOfWorkProvider) Store { + if provider == nil { + return nil + } + v := reflect.ValueOf(provider) + switch v.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + if v.IsNil() { + return nil + } + } + if v.IsValid() == false { + return nil + } + return &uowStore{provider: provider} +} + +type uowStore struct{ provider uow.UnitOfWorkProvider } + +var _ Store = (*uowStore)(nil) +var _ IssueUpdater = (*uowStore)(nil) + +func (s *uowStore) GetConfig(ctx context.Context, key string) (string, error) { + return uow.RunTxRead(ctx, s.provider, func(ctx context.Context, uw uow.UnitOfWork) (string, error) { + return uw.ConfigUseCase().GetConfig(ctx, key) + }) +} + +func (s *uowStore) GetAllConfig(ctx context.Context) (map[string]string, error) { + return uow.RunTxRead(ctx, s.provider, func(ctx context.Context, uw uow.UnitOfWork) (map[string]string, error) { + return uw.ConfigUseCase().GetAllConfig(ctx) + }) +} + +func (s *uowStore) GetLocalMetadata(ctx context.Context, key string) (string, error) { + return uow.RunTxRead(ctx, s.provider, func(ctx context.Context, uw uow.UnitOfWork) (string, error) { + return uw.ConfigUseCase().GetLocalMetadata(ctx, key) + }) +} + +func (s *uowStore) SetLocalMetadata(ctx context.Context, key, value string) error { + _, err := uow.RunTxEphemeral(ctx, s.provider, func(ctx context.Context, uw uow.UnitOfWork) (struct{}, error) { + return struct{}{}, uw.ConfigUseCase().SetLocalMetadata(ctx, key, value) + }) + return err +} + +func (s *uowStore) SearchIssues(ctx context.Context, query string, filter types.IssueFilter) ([]*types.Issue, error) { + page, err := uow.RunTxRead(ctx, s.provider, func(ctx context.Context, uw uow.UnitOfWork) (domain.SearchPage, error) { + return uw.IssueUseCase().SearchIssues(ctx, query, filter) + }) + return page.Items, err +} + +// GetIssueByExternalRef resolves the ISSUES PLANE FIRST and only then falls +// back to the wisp plane, because that ordering is the direct backend's +// deliberate contract, not an accident of its implementation: +// issueops.GetIssueByExternalRefInTx queries `issues` and only falls through to +// `wisps` on sql.ErrNoRows, and says why ("so that pushed ephemeral beads are +// found during pull dedup"). +// +// A single merged search cannot express that. SearchIssues with neither plane +// flag set routes to searchUnion, a UNION ALL over the two legs ordered by +// content and terminating in `id ASC` — no plane preference. So for an +// external_ref present on BOTH planes, direct mode returns the issue and a +// merged search returns whichever row happens to sort first. The consumer is +// the pull dedup in engine.go, which then UPDATES the returned row with remote +// content, making the divergence a silent write to the wrong local bead in +// proxied mode only. +// +// Both plane reads share ONE unit of work. They must: uow.RunTxRead opens a +// fresh UOW per call, so issuing them as two s.SearchIssues calls would split +// one logical lookup across two read transactions, and the fallback's premise +// ("the issues plane is already known empty") would no longer be +// snapshot-guaranteed. A concurrent same-ref insert into the issues plane +// landing between the two reads would let the merged fallback return the wisp, +// re-creating exactly the wrong-row write this ordering exists to prevent. +// The direct backend resolves both planes inside a single withReadTx, so the +// shared snapshot is also the parity-preserving shape. +func (s *uowStore) GetIssueByExternalRef(ctx context.Context, ref string) (*types.Issue, error) { + return uow.RunTxRead(ctx, s.provider, func(ctx context.Context, uw uow.UnitOfWork) (*types.Issue, error) { + // Issues plane. SkipWisps selects the plane without contributing a WHERE + // clause, so this is the exact analog of the direct backend's + // `SELECT id FROM issues WHERE external_ref = ?`. + page, err := uw.IssueUseCase().SearchIssues(ctx, "", types.IssueFilter{ExternalRef: &ref, Limit: 1, SkipWisps: true}) + if err != nil { + return nil, err + } + if len(page.Items) > 0 { + return page.Items[0], nil + } + + // Wisp fallback, expressed as the merged search rather than Ephemeral=true. + // Ephemeral is the only flag that routes to the wisps plane alone, but it + // ALSO contributes `ephemeral = 1`, a predicate the direct backend's + // `SELECT id FROM wisps WHERE external_ref = ?` does not have — it would + // drop wisp-plane rows carrying ephemeral=0 (NoHistory beads, and typed + // wisps minted without the flag; see types.IssueFilter.EphemeralTier), + // trading this divergence for a narrower one. The merged search adds no + // predicate, and its issues leg is already known empty from the search + // above — in the same snapshot, now that both reads share this UOW — so a + // hit here can only be a wisp, which is the fallback the direct backend + // performs. + page, err = uw.IssueUseCase().SearchIssues(ctx, "", types.IssueFilter{ExternalRef: &ref, Limit: 1}) + if err != nil { + return nil, err + } + if len(page.Items) == 0 { + return nil, storage.ErrNotFound + } + return page.Items[0], nil + }) +} + +func (s *uowStore) GetDependentsWithMetadata(ctx context.Context, id string) ([]*types.IssueWithDependencyMetadata, error) { + return uow.RunTxRead(ctx, s.provider, func(ctx context.Context, uw uow.UnitOfWork) ([]*types.IssueWithDependencyMetadata, error) { + return uw.DependencyUseCase().ListWithIssueMetadata(ctx, id, domain.DepListFilter{Direction: domain.DepDirectionIn}) + }) +} + +func (s *uowStore) GetDependenciesWithMetadata(ctx context.Context, id string) ([]*types.IssueWithDependencyMetadata, error) { + return uow.RunTxRead(ctx, s.provider, func(ctx context.Context, uw uow.UnitOfWork) ([]*types.IssueWithDependencyMetadata, error) { + return uw.DependencyUseCase().ListWithIssueMetadata(ctx, id, domain.DepListFilter{Direction: domain.DepDirectionOut}) + }) +} + +func (s *uowStore) CreateIssue(ctx context.Context, issue *types.Issue, actor string) error { + return uow.RunTx(ctx, s.provider, func(ctx context.Context, uw uow.UnitOfWork) (string, error) { + _, err := uw.IssueUseCase().CreateIssue(ctx, domain.CreateIssueParams{Issue: issue}, actor) + return "bd: tracker create", err + }) +} + +func (s *uowStore) UpdateIssue(ctx context.Context, id string, updates map[string]interface{}, actor string) error { + return s.ApplyIssueUpdate(ctx, id, updates, nil, actor) +} + +func (s *uowStore) ApplyIssueUpdate(ctx context.Context, id string, updates map[string]interface{}, labels []string, actor string) error { + fields := make(map[string]any, len(updates)) + for key, value := range updates { + fields[key] = value + } + var setLabels *[]string + if labels != nil { + copy := append([]string(nil), labels...) + setLabels = © + } + return uow.RunTx(ctx, s.provider, func(ctx context.Context, uw uow.UnitOfWork) (string, error) { + _, err := uw.IssueUseCase().ApplyUpdate(ctx, id, domain.UpdateSpec{Fields: fields, SetLabels: setLabels}, actor) + return "bd: tracker update", err + }) +} + +func (s *uowStore) AddDependency(ctx context.Context, dep *types.Dependency, actor string) error { + return uow.RunTx(ctx, s.provider, func(ctx context.Context, uw uow.UnitOfWork) (string, error) { + _, err := uw.DependencyUseCase().AddDependencies(ctx, []*types.Dependency{dep}, actor, domain.BulkAddDepsOpts{}) + return "bd: tracker dependency", err + }) +} diff --git a/internal/tracker/uow_store_engine_test.go b/internal/tracker/uow_store_engine_test.go new file mode 100644 index 000000000..6377abafb --- /dev/null +++ b/internal/tracker/uow_store_engine_test.go @@ -0,0 +1,281 @@ +package tracker + +import ( + "context" + "errors" + "sort" + "testing" + + "github.com/steveyegge/beads/internal/storage" + "github.com/steveyegge/beads/internal/storage/domain" + "github.com/steveyegge/beads/internal/storage/uow" + "github.com/steveyegge/beads/internal/types" +) + +type engineUOWState struct { + issues map[string]*types.Issue + wisps map[string]*types.Issue + configs map[string]string + commits int + // uows counts units of work handed out by the provider, so a test can pin + // how many read transactions one logical lookup is allowed to span. + uows int +} + +type engineIssueUC struct { + domain.IssueUseCase + s *engineUOWState +} + +// searchPlane returns the rows in one plane matching filter, lowest ID first. +// ephemeralOnly models the `ephemeral = 1` predicate that IssueFilter.Ephemeral +// contributes on top of routing the search to the wisps plane. +func searchPlane(plane map[string]*types.Issue, filter types.IssueFilter, ephemeralOnly bool) []*types.Issue { + items := make([]*types.Issue, 0, len(plane)) + for _, issue := range plane { + if filter.ExternalRef != nil && (issue.ExternalRef == nil || *issue.ExternalRef != *filter.ExternalRef) { + continue + } + if ephemeralOnly && !issue.Ephemeral { + continue + } + items = append(items, issue) + } + sort.Slice(items, func(i, j int) bool { return items[i].ID < items[j].ID }) + return items +} + +// SearchIssues models the repository's plane routing, which is the mechanism +// GetIssueByExternalRef parity depends on: SkipWisps searches the issues plane +// alone, Ephemeral routes to the wisps plane alone (and narrows it to +// ephemeral=1 rows), and neither flag merges both with NO plane preference. +// +// The merged branch deliberately yields the wisp BEFORE the issue. The real +// merged path is a UNION ALL ordered by content and terminating in `id ASC`, so +// a wisp whose id sorts first is returned first — the adversarial ordering is +// the whole reason the plane preference has to be explicit rather than implied. +func (u *engineIssueUC) SearchIssues(_ context.Context, _ string, filter types.IssueFilter) (domain.SearchPage, error) { + var items []*types.Issue + switch { + case filter.SkipWisps: + items = searchPlane(u.s.issues, filter, false) + case filter.Ephemeral != nil && *filter.Ephemeral: + items = searchPlane(u.s.wisps, filter, true) + default: + items = append(searchPlane(u.s.wisps, filter, false), searchPlane(u.s.issues, filter, false)...) + } + if filter.Limit > 0 && len(items) > filter.Limit { + items = items[:filter.Limit] + } + return domain.SearchPage{Items: items}, nil +} +func (u *engineIssueUC) GetIssue(_ context.Context, id string) (*types.Issue, error) { + return u.s.issues[id], nil +} +func (u *engineIssueUC) CreateIssue(_ context.Context, p domain.CreateIssueParams, _ string) (domain.CreateIssueResult, error) { + u.s.issues[p.Issue.ID] = p.Issue + return domain.CreateIssueResult{Issue: p.Issue}, nil +} +func (u *engineIssueUC) UpdateIssue(_ context.Context, id string, fields map[string]any, _ string) error { + if issue := u.s.issues[id]; issue != nil { + if title, ok := fields["title"].(string); ok { + issue.Title = title + } + } + return nil +} +func (u *engineIssueUC) ApplyUpdate(ctx context.Context, id string, spec domain.UpdateSpec, actor string) (*types.Issue, error) { + if err := u.UpdateIssue(ctx, id, spec.Fields, actor); err != nil { + return nil, err + } + return u.s.issues[id], nil +} + +type engineConfigUC struct { + domain.ConfigUseCase + s *engineUOWState +} + +func (u *engineConfigUC) GetConfig(_ context.Context, key string) (string, error) { + return u.s.configs[key], nil +} +func (u *engineConfigUC) GetAllConfig(context.Context) (map[string]string, error) { + return u.s.configs, nil +} +func (u *engineConfigUC) GetLocalMetadata(context.Context, string) (string, error) { return "", nil } +func (u *engineConfigUC) SetLocalMetadata(context.Context, string, string) error { return nil } + +type engineDepUC struct{ domain.DependencyUseCase } + +func (engineDepUC) ListWithIssueMetadata(context.Context, string, domain.DepListFilter) ([]*types.IssueWithDependencyMetadata, error) { + return nil, nil +} +func (engineDepUC) AddDependencies(context.Context, []*types.Dependency, string, domain.BulkAddDepsOpts) (domain.BulkAddDepsResult, error) { + return domain.BulkAddDepsResult{}, nil +} + +type engineUOW struct{ state *engineUOWState } + +func (u *engineUOW) Close(context.Context) {} +func (u *engineUOW) Commit(context.Context, string) error { u.state.commits++; return nil } +func (u *engineUOW) SwitchDatabase(context.Context, string) error { return nil } +func (u *engineUOW) ConfigUseCase() domain.ConfigUseCase { return &engineConfigUC{s: u.state} } +func (u *engineUOW) DoltRemoteUseCase() domain.DoltRemoteUseCase { return nil } +func (u *engineUOW) IssueUseCase() domain.IssueUseCase { return &engineIssueUC{s: u.state} } +func (u *engineUOW) DependencyUseCase() domain.DependencyUseCase { return engineDepUC{} } +func (u *engineUOW) LabelUseCase() domain.LabelUseCase { return nil } +func (u *engineUOW) CommentUseCase() domain.CommentUseCase { return nil } +func (u *engineUOW) RawSQLUseCase() domain.RawSQLUseCase { return nil } +func (u *engineUOW) EventsJournalUseCase() domain.EventsJournalUseCase { return nil } + +type engineUOWProvider struct{ state *engineUOWState } + +func (p *engineUOWProvider) NewUOW(context.Context) (uow.UnitOfWork, error) { + p.state.uows++ + return &engineUOW{state: p.state}, nil +} +func (*engineUOWProvider) Close(context.Context) error { return nil } + +func TestUOWStoreEngineMutationsCommitThroughProvider(t *testing.T) { + state := &engineUOWState{issues: map[string]*types.Issue{}, configs: map[string]string{"issue_prefix": "bd"}} + st := NewUOWStore(&engineUOWProvider{state: state}) + issue := &types.Issue{ID: "bd-new", Title: "new"} + if err := st.CreateIssue(context.Background(), issue, "test"); err != nil { + t.Fatalf("create: %v", err) + } + if err := st.UpdateIssue(context.Background(), issue.ID, map[string]interface{}{"title": "updated"}, "test"); err != nil { + t.Fatalf("update: %v", err) + } + got, err := st.GetIssueByExternalRef(context.Background(), "missing") + if got != nil || err == nil { + t.Fatalf("missing external ref: got=%v err=%v", got, err) + } + if state.issues[issue.ID].Title != "updated" || state.commits != 2 { + t.Fatalf("state=%+v commits=%d", state.issues[issue.ID], state.commits) + } +} + +// TestUOWStoreGetIssueByExternalRefPrefersIssuePlane pins the proxied adapter to +// the direct backend's resolution order. issueops.GetIssueByExternalRefInTx +// queries `issues` and falls through to `wisps` only on no rows, so one +// external_ref present on both planes must resolve to the ISSUE on both routes. +// A merged search has no plane preference, and the consumer is the pull dedup, +// which updates whatever row comes back — so a divergence here is a silent +// write to the wrong local bead in proxied mode only. +func TestUOWStoreGetIssueByExternalRefPrefersIssuePlane(t *testing.T) { + ctx := context.Background() + ref := "https://tracker.test/EXT-1" + + // The wisp's ID sorts before the issue's, so the merged search returns it + // first: resolving by "first merged hit" fails this test. + issue := &types.Issue{ID: "bd-durable", Title: "durable", ExternalRef: &ref} + wisp := &types.Issue{ID: "bd-aaa-wisp", Title: "pushed wisp", Ephemeral: true, ExternalRef: &ref} + state := &engineUOWState{ + issues: map[string]*types.Issue{issue.ID: issue}, + wisps: map[string]*types.Issue{wisp.ID: wisp}, + configs: map[string]string{}, + } + st := NewUOWStore(&engineUOWProvider{state: state}) + + got, err := st.GetIssueByExternalRef(ctx, ref) + if err != nil { + t.Fatalf("resolve collided external_ref: %v", err) + } + if got == nil || got.ID != issue.ID { + t.Fatalf("external_ref on both planes resolved to %v, want issues-plane %q", got, issue.ID) + } +} + +// TestUOWStoreGetIssueByExternalRefFallsBackToWispPlane is the other half of the +// contract: preferring the issues plane must not stop resolving wisp-only refs, +// which is the case the direct backend's fall-through exists to serve. +// +// The ephemeral=0 subtest is why the fallback is the merged search rather than +// Ephemeral=true: that flag contributes an `ephemeral = 1` predicate the direct +// backend's `SELECT id FROM wisps WHERE external_ref = ?` does not have, and +// wisp-plane rows legitimately carry ephemeral=0 (NoHistory beads, and typed +// wisps minted without the flag — see types.IssueFilter.EphemeralTier). +func TestUOWStoreGetIssueByExternalRefFallsBackToWispPlane(t *testing.T) { + ctx := context.Background() + for _, tc := range []struct { + name string + ephemeral bool + }{ + {name: "ephemeral_flag_set", ephemeral: true}, + {name: "ephemeral_flag_clear", ephemeral: false}, + } { + t.Run(tc.name, func(t *testing.T) { + ref := "https://tracker.test/EXT-WISP" + wisp := &types.Issue{ID: "bd-wisp", Title: "wisp only", Ephemeral: tc.ephemeral, ExternalRef: &ref} + state := &engineUOWState{ + issues: map[string]*types.Issue{}, + wisps: map[string]*types.Issue{wisp.ID: wisp}, + configs: map[string]string{}, + } + st := NewUOWStore(&engineUOWProvider{state: state}) + + got, err := st.GetIssueByExternalRef(ctx, ref) + if err != nil { + t.Fatalf("resolve wisp-only external_ref: %v", err) + } + if got == nil || got.ID != wisp.ID { + t.Fatalf("wisp-only external_ref resolved to %v, want %q", got, wisp.ID) + } + }) + } +} + +// TestUOWStoreGetIssueByExternalRefUsesOneReadTransaction pins both plane reads +// to a SINGLE unit of work. uow.RunTxRead opens a fresh UOW per call, so +// resolving through two s.SearchIssues calls would split one logical lookup +// across two read transactions, and the wisp fallback's premise ("the issues +// plane is already known empty") would stop being snapshot-guaranteed: a +// concurrent same-ref insert into the issues plane landing between the reads +// would let the merged fallback return the wisp, re-creating the wrong-row +// write TestUOWStoreGetIssueByExternalRefPrefersIssuePlane exists to prevent. +// The direct backend resolves both planes inside one withReadTx, so this is +// also the parity-preserving shape. +// +// Only the paths that actually perform both reads can pin this, so the cases +// are the wisp fallback and the miss; an issues-plane hit short-circuits after +// one read and would pass either way. +func TestUOWStoreGetIssueByExternalRefUsesOneReadTransaction(t *testing.T) { + ctx := context.Background() + for _, tc := range []struct { + name string + wispRef bool + }{ + {name: "wisp_fallback", wispRef: true}, + {name: "no_match_on_either_plane", wispRef: false}, + } { + t.Run(tc.name, func(t *testing.T) { + ref := "https://tracker.test/EXT-SNAPSHOT" + wisps := map[string]*types.Issue{} + if tc.wispRef { + wisps["bd-wisp"] = &types.Issue{ID: "bd-wisp", Title: "wisp only", Ephemeral: true, ExternalRef: &ref} + } + state := &engineUOWState{ + issues: map[string]*types.Issue{}, + wisps: wisps, + configs: map[string]string{}, + } + st := NewUOWStore(&engineUOWProvider{state: state}) + + got, err := st.GetIssueByExternalRef(ctx, ref) + if tc.wispRef { + if err != nil { + t.Fatalf("resolve wisp-only external_ref: %v", err) + } + if got == nil || got.ID != "bd-wisp" { + t.Fatalf("resolved to %v, want %q", got, "bd-wisp") + } + } else if got != nil || !errors.Is(err, storage.ErrNotFound) { + t.Fatalf("unmatched external_ref: got=%v err=%v, want ErrNotFound", got, err) + } + + if state.uows != 1 { + t.Fatalf("both plane reads must share one unit of work: opened %d, want 1", state.uows) + } + }) + } +} diff --git a/internal/types/types.go b/internal/types/types.go index 5fa0e06b5..df0f85263 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -9,6 +9,7 @@ import ( "hash" "regexp" "slices" + "strconv" "strings" "time" "unicode/utf8" @@ -80,8 +81,10 @@ type Issue struct { // row_lock is random per write, so generic Issue serialization would break // stable list/export round-trips. The detail-view DTO projects it explicitly // as `revision` for guarded clients (IssueDetails.Revision, set by - // NewIssueDetails, and on the wire at GET /v0/beads/issues/{id}); Go - // consumers read RowVersion directly. + // NewIssueDetails, and on the wire at GET /v0/beads/issues/{id}) — as a + // decimal STRING, via RevisionToken, because the full int64 range does not + // survive a JSON number in a JavaScript consumer. Go consumers read + // RowVersion directly and never see the string. // // Coverage is deliberately partial: it changes on claim/close/unclaim and the // generic update path, but NOT on direct-UPDATE paths that rewrite text @@ -1186,12 +1189,44 @@ type IssueDetails struct { // from a legacy migration-0054 row, so the projection lives beside the // field and not at each caller. // - // NO omitempty. A guarded write that expects 0 matches an un-mutated + // IT IS A STRING ON THE WIRE, holding the token's decimal spelling + // (RevisionToken). The token is drawn from the FULL int64 range, and a JSON + // number past 2^53 does not survive a JavaScript consumer: it reads back a + // rounded value, echoes that as its guard, and earns a 409 for a row nobody + // touched. A string round-trips exactly in every JSON consumer, which is + // what an equality-only opaque token needs, and it leaves a future backend + // free to mint a token that is not an int64 at all. + // + // NO omitempty. A guarded write that expects "0" matches an un-mutated // legacy row and misses any current one, which is correct CAS; omitting // the member would leave that client unable to read the value it must // send, and would make an absent field mean either "legacy-zero" or "this - // producer has no token". - Revision int64 `json:"revision"` + // producer has no token". The legacy migration-0054 value is the string + // "0", not the empty string. + Revision string `json:"revision"` +} + +// RevisionToken renders an optimistic-concurrency token for the wire. +// +// This and ParseRevisionToken are the ONE spelling of the encoding. The token +// is int64 everywhere inside bd — the row_lock column, Issue.RowVersion, the +// ExpectedVersion guard on the issueops requests — and a decimal string +// everywhere on the wire, because it is opaque and equality-only and a JSON +// number loses the top bits in a JavaScript consumer. Keeping the conversion in +// one pair of functions is what keeps "0" meaning the legacy row rather than +// an absent value. +func RevisionToken(v int64) string { + return strconv.FormatInt(v, 10) +} + +// ParseRevisionToken reads a wire revision token back to the internal int64. +// +// It accepts exactly what RevisionToken emits. A caller must echo the token a +// response carried rather than compose one, so anything else is a client that +// invented a value, and reporting that as a parse failure is more useful than +// guessing at it. +func ParseRevisionToken(s string) (int64, error) { + return strconv.ParseInt(s, 10, 64) } // NewIssueDetails starts a detail view of issue with the wire-visible revision @@ -1202,7 +1237,7 @@ type IssueDetails struct { // literal would publish a silently wrong token that nothing can distinguish // from a right one. The caller fills in labels, edges and counts afterwards. func NewIssueDetails(issue Issue) *IssueDetails { - return &IssueDetails{Issue: issue, Revision: issue.RowVersion} + return &IssueDetails{Issue: issue, Revision: RevisionToken(issue.RowVersion)} } // DependencyType categorizes the relationship diff --git a/internal/types/types_test.go b/internal/types/types_test.go index cf0edb2ba..538874def 100644 --- a/internal/types/types_test.go +++ b/internal/types/types_test.go @@ -4,6 +4,8 @@ import ( "encoding/json" "errors" "fmt" + "math" + "regexp" "strings" "testing" "time" @@ -995,13 +997,15 @@ func TestNewIssueDetailsProjectsTheRevisionToken(t *testing.T) { token int64 want string }{ - {"a mutated row", 123456789, `"revision":123456789`}, - {"a legacy un-mutated row", 0, `"revision":0`}, + {"a mutated row", 123456789, `"revision":"123456789"`}, + {"a legacy un-mutated row", 0, `"revision":"0"`}, + {"a negative token", -3819021935081927, `"revision":"-3819021935081927"`}, + {"a token past 2^53", 9007199254740993, `"revision":"9007199254740993"`}, } { t.Run(tc.name, func(t *testing.T) { details := NewIssueDetails(Issue{ID: "test-1", Title: "Versioned", RowVersion: tc.token}) - if details.Revision != tc.token { - t.Errorf("Revision = %d, want %d", details.Revision, tc.token) + if details.Revision != RevisionToken(tc.token) { + t.Errorf("Revision = %q, want %q", details.Revision, RevisionToken(tc.token)) } b, err := json.Marshal(details) @@ -1021,6 +1025,79 @@ func TestNewIssueDetailsProjectsTheRevisionToken(t *testing.T) { } } +// TestRevisionTokenIsAJSONString is the JS-safety pin: whatever the token, the +// marshaled member is a QUOTED decimal, so no consumer that decodes JSON numbers +// as IEEE-754 doubles can round it. +// +// It matches the bytes with a regexp rather than comparing a decoded value, +// because a decoded value is exactly what the defect hides behind — Go's own +// `any` decode of a JSON number is a float64 too, so a test that unmarshaled and +// compared would agree with the broken wire shape for small tokens and disagree +// with it for large ones for the wrong reason. +func TestRevisionTokenIsAJSONString(t *testing.T) { + member := regexp.MustCompile(`"revision":"-?\d+"`) + for _, token := range []int64{0, 1, -1, 123456789, math.MaxInt64, math.MinInt64, 1 << 53, (1 << 53) + 1} { + b, err := json.Marshal(NewIssueDetails(Issue{ID: "test-1", Title: "Versioned", RowVersion: token})) + if err != nil { + t.Fatalf("marshal with token %d: %v", token, err) + } + if !member.Match(b) { + t.Errorf("token %d marshaled to %s, want a quoted decimal `revision` member", token, b) + } + } +} + +// TestRevisionTokenRoundTrips pins that the wire spelling is lossless across the +// whole int64 range — the property the string exists for. A JSON number would +// fail this above 2^53 in any double-based consumer. +func TestRevisionTokenRoundTrips(t *testing.T) { + for _, token := range []int64{ + math.MinInt64, -3819021935081927, -(1 << 53) - 1, -1, 0, 1, + 1 << 53, (1 << 53) + 1, 9007199254740993, math.MaxInt64, + } { + got, err := ParseRevisionToken(RevisionToken(token)) + if err != nil { + t.Errorf("ParseRevisionToken(RevisionToken(%d)): %v", token, err) + continue + } + if got != token { + t.Errorf("ParseRevisionToken(RevisionToken(%d)) = %d, want %d", token, got, token) + } + } +} + +// TestRevisionTokenSurvivesAJavaScriptRealisticParse walks the round trip a +// browser client actually performs — marshal, decode the member as the string it +// is, parse it back — and proves the token that motivated this shape survives it. +// +// The float64 leg is the control: it is what a consumer got when the member was +// a JSON number, and it is WRONG by 1 for this token. Without it the test would +// pass on a broken wire shape too. +func TestRevisionTokenSurvivesAJavaScriptRealisticParse(t *testing.T) { + const token = int64(9007199254740993) // 2^53 + 1, the smallest int64 a double cannot hold + + b, err := json.Marshal(NewIssueDetails(Issue{ID: "test-1", Title: "Versioned", RowVersion: token})) + if err != nil { + t.Fatalf("marshal: %v", err) + } + var decoded struct { + Revision string `json:"revision"` + } + if err := json.Unmarshal(b, &decoded); err != nil { + t.Fatalf("decode revision as a string: %v (a number-typed member would fail here): %s", err, b) + } + got, err := ParseRevisionToken(decoded.Revision) + if err != nil { + t.Fatalf("ParseRevisionToken(%q): %v", decoded.Revision, err) + } + if got != token { + t.Errorf("round trip gave %d, want %d", got, token) + } + if lossy := int64(float64(token)); lossy == token { + t.Fatalf("the control is broken: %d survives a float64 round trip, so this test proves nothing", token) + } +} + func TestReclaimedLeaseJSONSerialization(t *testing.T) { b, err := json.Marshal(ReclaimedLease{ID: "bd-1", PreviousOwner: "worker-a"}) if err != nil { diff --git a/internal/workapi/detail_test.go b/internal/workapi/detail_test.go index ee92887a2..d42de56c0 100644 --- a/internal/workapi/detail_test.go +++ b/internal/workapi/detail_test.go @@ -754,11 +754,11 @@ func TestBuildIssueDetailsProjectsTheRevisionToken(t *testing.T) { if err != nil { t.Fatalf("BuildIssueDetails: %v", err) } - if details.Revision != 987654321 { - t.Errorf("Revision = %d, want the row's token 987654321", details.Revision) + if details.Revision != "987654321" { + t.Errorf("Revision = %q, want the row's token %q", details.Revision, "987654321") } - if details.Revision != details.RowVersion { - t.Errorf("Revision = %d but RowVersion = %d; the published token must be the row's", + if details.Revision != types.RevisionToken(details.RowVersion) { + t.Errorf("Revision = %q but RowVersion = %d; the published token must be the row's", details.Revision, details.RowVersion) } }) diff --git a/issueops/issueops.go b/issueops/issueops.go index 8784bc24d..fa0f5544a 100644 --- a/issueops/issueops.go +++ b/issueops/issueops.go @@ -1,4 +1,9 @@ // Package issueops declares the public values used for guarded issue mutations. +// +// # Stability +// +// EXPERIMENTAL. This package is not yet covered by the project's compatibility +// promise and may change in a minor release. Pin an exact beads version. package issueops import ( diff --git a/journalops/doc.go b/journalops/doc.go index 02087d7c0..6f77fa636 100644 --- a/journalops/doc.go +++ b/journalops/doc.go @@ -64,4 +64,10 @@ // matches by identity. If a validation refusal ever appears here it aliases // beadserrors.ErrValidation rather than minting a twin, for the reasons // memoryops/errors.go gives. +// +// # Stability +// +// EXPERIMENTAL. This package is not yet covered by the project's compatibility +// promise and may change in a minor release. A consumer replaying the feed +// should pin an exact beads version. package journalops diff --git a/journalops/journal.go b/journalops/journal.go index db60f4b46..1a8f7423f 100644 --- a/journalops/journal.go +++ b/journalops/journal.go @@ -16,9 +16,10 @@ import "context" // bound rather than a per-row age test, for exactly this reason. // // Actor is the acting identity that performed the mutation, as resolved for -// the audit-events table; empty when the mutation path has no actor (derived -// maintenance, actorless delete plumbing, and rows written before the column -// existed). +// the audit-events table. A delete, and the dep_remove rows a cascading delete +// produces, carry the identity that REQUESTED the delete. It is empty only +// when the path genuinely has no actor: derived maintenance, system cleanup +// with no request behind it, and rows written before the column existed. type Row struct { Seq int64 TS string diff --git a/memoryops/doc.go b/memoryops/doc.go index 688c55464..15675d47f 100644 --- a/memoryops/doc.go +++ b/memoryops/doc.go @@ -45,4 +45,9 @@ // cursor. A front door that prints them sorts the keys, and both do today. If // this plane ever grows to thousands of rows, a paged reader is a new role // conversation and not a retrofit of this one. +// +// # Stability +// +// EXPERIMENTAL. This package is not yet covered by the project's compatibility +// promise and may change in a minor release. Pin an exact beads version. package memoryops diff --git a/npm-package/package.json b/npm-package/package.json index b32f897bd..eedd8c5da 100644 --- a/npm-package/package.json +++ b/npm-package/package.json @@ -1,6 +1,6 @@ { "name": "@beads/bd", - "version": "1.2.2", + "version": "1.3.0", "description": "Beads issue tracker - lightweight memory system for coding agents with native binary support", "main": "bin/bd.js", "bin": { diff --git a/open_backend_selection_test.go b/open_backend_selection_test.go index af03aaa24..1ffbaa449 100644 --- a/open_backend_selection_test.go +++ b/open_backend_selection_test.go @@ -102,6 +102,47 @@ func TestOpenBestAvailableRejectsRemovedBackends(t *testing.T) { } } +// TestOpenBestAvailableOffersHealWhenDoltDataExists covers the public open path +// for the case D-8 exists for: metadata names a removed backend, but the +// workspace holds a Dolt database that bd v1.2.x opened happily. The library +// error must carry the same metadata heal the CLI gives — proving beadsDir and +// the config reach configuredBackendUnavailable in both the cgo and non-cgo +// builds — instead of the export/reinitialize path that destroys the database. +func TestOpenBestAvailableOffersHealWhenDoltDataExists(t *testing.T) { + for _, backend := range []string{"postgres", "mysql", "sqlite"} { + t.Run(backend, func(t *testing.T) { + beadsDir := writeBackendMetadata(t, backend) + doltDir := filepath.Join(beadsDir, "embeddeddolt", "beads") + if err := os.MkdirAll(filepath.Join(doltDir, ".dolt"), 0o750); err != nil { + t.Fatalf("plant dolt database: %v", err) + } + + store, err := beads.OpenBestAvailable(context.Background(), beadsDir) + if store != nil { + _ = store.Close() + t.Fatalf("removed backend %q returned a store", backend) + } + if err == nil { + t.Fatal("removed backend with live Dolt data unexpectedly opened") + } + for _, want := range []string{ + "no longer supported", + filepath.Join(beadsDir, "metadata.json"), + `"backend": "dolt"`, + doltDir, + "no storage database was opened or modified", + } { + if !strings.Contains(err.Error(), want) { + t.Errorf("public open error missing %q: %v", want, err) + } + } + if strings.Contains(strings.ToLower(err.Error()), "export") { + t.Errorf("public open error offered the destructive export path despite live Dolt data: %v", err) + } + }) + } +} + func TestOpenBestAvailableRejectsUnknownBackend(t *testing.T) { beadsDir := writeBackendMetadata(t, "mystery") store, err := beads.OpenBestAvailable(context.Background(), beadsDir) diff --git a/plugins/beads/.claude-plugin/plugin.json b/plugins/beads/.claude-plugin/plugin.json index 78a7e8052..f861043e2 100644 --- a/plugins/beads/.claude-plugin/plugin.json +++ b/plugins/beads/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "beads", "description": "AI-supervised issue tracker for coding workflows. Manage tasks, discover work, and maintain context with simple CLI commands.", - "version": "1.2.2", + "version": "1.3.0", "author": { "name": "Steve Yegge", "url": "https://github.com/steveyegge" diff --git a/plugins/beads/.codex-plugin/plugin.json b/plugins/beads/.codex-plugin/plugin.json index e059be0a8..bf76223b3 100644 --- a/plugins/beads/.codex-plugin/plugin.json +++ b/plugins/beads/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "beads", - "version": "1.2.2", + "version": "1.3.0", "description": "AI-supervised issue tracking for coding workflows with agent skills.", "author": { "name": "Steve Yegge", diff --git a/plugins/beads/.copilot-plugin/plugin.json b/plugins/beads/.copilot-plugin/plugin.json index 2a217ac6b..90a496a43 100644 --- a/plugins/beads/.copilot-plugin/plugin.json +++ b/plugins/beads/.copilot-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "beads", "description": "AI-supervised issue tracker for coding workflows. Manage tasks, discover work, and maintain context with simple CLI commands.", - "version": "1.2.2", + "version": "1.3.0", "author": { "name": "Steve Yegge", "url": "https://github.com/steveyegge" diff --git a/schema/schema.go b/schema/schema.go index aabd521da..f65a23d81 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -1,6 +1,12 @@ // Package schema is the public wrapper around bd's schema migration engine, // re-exporting the minimal surface external tools need to create or upgrade a // beads database over a standard database/sql connection. +// +// # Stability +// +// EXPERIMENTAL. This package is not yet covered by the project's compatibility +// promise and may change in a minor release. The migration set it wraps grows +// every release; pin an exact beads version. package schema import ( diff --git a/scripts/check-versions.sh b/scripts/check-versions.sh index e8550f3db..90b515d7e 100755 --- a/scripts/check-versions.sh +++ b/scripts/check-versions.sh @@ -21,19 +21,28 @@ echo "" MISMATCH=0 -check_version() { +# Base (prerelease-stripped) form. The Windows PE numeric fields must be purely +# numeric, so they carry this rather than $CANONICAL. +BASE_VERSION="${CANONICAL%%-*}" + +check_expected() { local _file=$1 local version=$2 - local description=$3 + local expected=$3 + local description=$4 - if [ "$version" != "$CANONICAL" ]; then - echo -e "${RED}❌ $description: $version (expected $CANONICAL)${NC}" + if [ "$version" != "$expected" ]; then + echo -e "${RED}❌ $description: ${version:-missing} (expected $expected)${NC}" MISMATCH=1 else echo -e "${GREEN}✓ $description: $version${NC}" fi } +check_version() { + check_expected "$1" "$2" "$CANONICAL" "$3" +} + # Check all version files check_version "integrations/beads-mcp/pyproject.toml" \ "$(grep '^version = ' integrations/beads-mcp/pyproject.toml 2>/dev/null | sed 's/.*"\(.*\)".*/\1/')" \ @@ -51,6 +60,15 @@ check_version "plugins/beads/.codex-plugin/plugin.json" \ "$(jq -r '.version' plugins/beads/.codex-plugin/plugin.json 2>/dev/null)" \ "Codex plugin.json" +# update-versions.sh bumps this one too, but it was never gated here — so a +# drifted copilot manifest (the same drift class that carried stale .githooks +# markers through v1.2.0) would silently no-op the bump's old->new sed, pass +# this script, pass the pre-push hook and CI, and ship advertising the previous +# version. +check_version "plugins/beads/.copilot-plugin/plugin.json" \ + "$(jq -r '.version' plugins/beads/.copilot-plugin/plugin.json 2>/dev/null)" \ + "Copilot plugin.json" + check_version ".claude-plugin/marketplace.json" \ "$(jq -r '.plugins[0].version' .claude-plugin/marketplace.json 2>/dev/null)" \ "Claude marketplace.json" @@ -107,17 +125,58 @@ for hook in .githooks/*; do done done -echo "" +# Windows PE resource metadata. gen-winres.sh re-derives winres.json's numeric +# fields from version.go at build time, so those self-heal — but +# manifest.xml's version is embedded verbatim with no +# backstop, and update-versions.sh rewrites both with a sed anchored on the OLD +# value, so a drifted file is a silent no-op. Gate them. +# +# The numeric fields (file_version/product_version, and the manifest's +# four-part version) must be purely numeric, so they carry the base version: +# for 1.1.0-rc.1 they read 1.1.0 while FileVersion/ProductVersion read the full +# prerelease string. +WINRES_JSON="cmd/bd/winres/winres.json" +for field in file_version product_version; do + check_expected "$WINRES_JSON" \ + "$(jq -r ".RT_VERSION.\"#1\".\"0000\".fixed.$field" "$WINRES_JSON" 2>/dev/null)" \ + "$BASE_VERSION" "winres.json $field" +done +for field in FileVersion ProductVersion; do + check_expected "$WINRES_JSON" \ + "$(jq -r ".RT_VERSION.\"#1\".\"0000\".info.\"0409\".$field" "$WINRES_JSON" 2>/dev/null)" \ + "$CANONICAL" "winres.json $field" +done +# Anchor on line start: the XML declaration on line 1 also carries a +# version="1.0" attribute. +check_expected "cmd/bd/winres/manifest.xml" \ + "$(grep -oE '^[[:space:]]*version="[0-9][^"]*"' cmd/bd/winres/manifest.xml 2>/dev/null | head -1 | sed -E 's/.*"(.*)"/\1/')" \ + "$BASE_VERSION.0" "manifest.xml assemblyIdentity version" echo "" if [ $MISMATCH -eq 1 ]; then echo -e "${RED}❌ Version mismatch detected!${NC}" echo "" - echo "Run: scripts/update-versions.sh $CANONICAL" - echo "Or manually update the mismatched files." + echo "Note: re-running 'scripts/update-versions.sh $CANONICAL' will NOT fix" + echo "most of these. It derives the OLD version from cmd/bd/version.go, which" + echo "already reads $CANONICAL, so its old->new substitutions rewrite" + echo "$CANONICAL -> $CANONICAL and no-op on a file that drifted. Only the" + echo ".githooks markers (rewritten wholesale) and uv.lock (regenerated) heal" + echo "on a re-run." + echo "" + echo "Fix whichever applies:" + echo " • cmd/bd/version.go itself is wrong (you meant another version):" + echo " scripts/update-versions.sh " + echo " • one gated file drifted: edit that file to $CANONICAL and re-run" + echo " this script." + echo " • several drifted: set cmd/bd/version.go back to the previous" + echo " version, then scripts/update-versions.sh $CANONICAL to replay the" + echo " whole bump." exit 1 else - echo -e "${GREEN}✓ Version files and released-docs policy pass for: $CANONICAL${NC}" + echo -e "${GREEN}✓ Version files in sync at: $CANONICAL${NC}" + echo " (Version files only — this script does not check docs. The docs" + echo " release line and docs/cli-docs.pin are manual release steps; see" + echo " RELEASING.md.)" fi diff --git a/scripts/ci/pr-core.sh b/scripts/ci/pr-core.sh index 42c230d3f..d4475239c 100755 --- a/scripts/ci/pr-core.sh +++ b/scripts/ci/pr-core.sh @@ -20,5 +20,15 @@ beads_test_env_enter GO_TEST_PKG_PARALLEL="${GO_TEST_PKG_PARALLEL:-4}" GO_TEST_PARALLEL="${GO_TEST_PARALLEL:-4}" +# Without an explicit -timeout every package gets Go's 10m default, and ./cmd/bd +# has outgrown it: measured through this wrapper it takes 572s, which leaves 28s +# — under 5% — of margin. Runner variance eats that, and the package then dies on +# the alarm at 600.3s/600.7s (two consecutive runs on #6090; #6038 squeaked in +# just under). No single test is at fault, so the panic names whichever one was +# in flight and reads like a hang when it is really the whole package running out +# of clock. 30m is what every other -race lane here already gives this same code: +# main.yml's integration package and cmd/bd shards, ci-measurements.yml, +# nightly.yml. Splitting or de-slowing cmd/bd is the real fix and belongs on main +# — this only stops the clock from being the thing that fails. ci_time "pr-core go test" -- \ - go test -p "$GO_TEST_PKG_PARALLEL" -parallel "$GO_TEST_PARALLEL" -race -short -skip '^TestEmbedded' ./... + go test -p "$GO_TEST_PKG_PARALLEL" -parallel "$GO_TEST_PARALLEL" -race -short -timeout=30m -skip '^TestEmbedded' ./... diff --git a/scripts/ci_workflow_test.go b/scripts/ci_workflow_test.go index b7570361a..4f3009c5c 100644 --- a/scripts/ci_workflow_test.go +++ b/scripts/ci_workflow_test.go @@ -298,13 +298,18 @@ func TestMacOSTestJobsReuseWorkspaceBDBinary(t *testing.T) { const ( workspaceBDBinary = "${{ github.workspace }}/bd" buildCommand = "go build -v -tags gms_pure_go ./cmd/bd" - prTestCommand = "go test -tags gms_pure_go -v -race -short -skip '^TestEmbedded' ./..." - mainTestCommand = "go test -tags gms_pure_go ${{ matrix.test-flags }} -skip '^TestEmbedded' ./..." - // The macOS leg is the only consumer of main.yml's matrix test-flags (the - // ubuntu leg's coverage step hardcodes its own), and it carries an explicit - // per-package -timeout because go test's 10m default is what made the ubuntu - // leg flaky (wy-5b5fbl). Keep the two legs' deadlines in step when either moves. - mainMacOSTestFlags = "-v -race -short -timeout=25m" + // -timeout=30m is pinned on both lanes because ./cmd/bd has outgrown + // `go test`'s 10m per-package default (#6091, and wy-5b5fbl before it — + // that default is what made these legs flaky). In main.yml it sits on + // the invocation rather than in matrix.test-flags, so editing the + // matrix cannot silently drop it, and so the macOS leg cannot drift + // away from the ubuntu -race lanes' deadline. + prTestCommand = "go test -tags gms_pure_go -v -race -short -timeout=30m -skip '^TestEmbedded' ./..." + mainTestCommand = "go test -tags gms_pure_go ${{ matrix.test-flags }} -timeout=30m -skip '^TestEmbedded' ./..." + // The macOS leg is the only consumer of main.yml's matrix test-flags + // (the ubuntu leg's coverage step hardcodes its own). The deadline is + // deliberately NOT here — see mainTestCommand. + mainMacOSTestFlags = "-v -race -short" ) workflows := map[string]ciWorkflow{ diff --git a/scripts/migration-test/historical-dolt-upgrade-test.sh b/scripts/migration-test/historical-dolt-upgrade-test.sh index 4490628f4..c87a2a886 100755 --- a/scripts/migration-test/historical-dolt-upgrade-test.sh +++ b/scripts/migration-test/historical-dolt-upgrade-test.sh @@ -26,7 +26,9 @@ Usage: historical-dolt-upgrade-test.sh [--version VERSION] Runs the authentic historical SQLite bridges (v0.9.1, v0.17.0, v0.49.6, v0.50.3), historical server-Dolt corpus (v0.55.4, v0.56.1, v0.57.0, v0.62.0), and direct embedded-Dolt corpus -(v0.63.3, v1.0.0, v1.0.1, v1.1.0, v1.1.2) against CANDIDATE_BIN. Every release archive is pinned and verified. +(v0.63.3, v1.0.0, v1.0.1, v1.1.0, v1.1.2, v1.2.2) against CANDIDATE_BIN. Every release archive is pinned and verified. +The wisp-capable sources (v1.0.1, v1.1.0, v1.1.2, v1.2.2) additionally run a wisp-plane lane in a fresh workspace, +which needs the pinned external Dolt runtime as a read-only oracle. EOF } @@ -92,8 +94,10 @@ case "$(uname -s)-$(uname -m)" in *) die 'the pinned authentic-binary corpus supports linux/amd64 or darwin/arm64 only' ;; esac [[ "$OP_TIMEOUT" =~ ^[1-9][0-9]*$ ]] || die 'HISTORICAL_DOLT_E2E_TIMEOUT must be a positive number of seconds' +# The server-Dolt lanes need the pinned runtime to host their fixture; the +# wisp-plane lanes need the same binary as a read-only plane oracle. for version in "${SELECTED_VERSIONS[@]}"; do - case " ${HISTORICAL_DOLT_VERSIONS[*]} " in + case " ${HISTORICAL_DOLT_VERSIONS[*]} ${WISP_PLANE_VERSIONS[*]} " in *" $version "*) verify_dolt_runtime; break ;; esac done @@ -1120,6 +1124,663 @@ run_v0554_default_embedded_dolt_upgrade() { verify_post_bridge_semantics "$version" legacy } +# --------------------------------------------------------------------------- +# Wisp-plane upgrade corpus +# --------------------------------------------------------------------------- +# +# create_historical_fixture/verify_surviving_fixture assert exact `length == 3` +# list shapes and are shared by thirteen version lanes, so wisp coverage gets +# its own workspace and its own lane instead of widening assertions every other +# version depends on. 1.3.0's chain is dominated by the plane those fixtures +# never touch: main 0054-0066 plus ignored 0012-0025 rewrite wisps, +# wisp_dependencies, wisp_comments, leases and events over rows no existing +# upgrade test creates. +# +# There is no `bd dolt sql`, so plane state (updated_at, is_blocked, +# leases.granted_node, dolt_ignore, dolt_status, row counts) is read with the +# pinned external Dolt CLI as a read-only oracle, the way #5816's field repro +# inspected a real store. `dolt sql -q` can exit 0 on failure +# (migrations/README.md), so every oracle read is decided by its payload and +# never by an exit status, and no oracle read ever runs DML. + +# Old-binary capabilities, probed against each pinned release rather than +# assumed, so the lane can stay one shape across both regimes: +# +# v1.0.1 v1.1.0 v1.1.2 +# yes yes yes bd create --ephemeral +# yes yes yes dep add: wisp->issue, wisp->wisp, conditional-blocks +# yes yes yes dep add: issue->wisp (main dependencies table) +# yes yes yes comments add / label add on a wisp +# yes yes yes bd mol wisp list --all --json +# yes yes yes bd dolt remote add / push over file:// +# no yes yes a pre-upgrade remote the candidate will still migrate +# no yes yes wisps.is_blocked column +# no yes yes post-split wisp_dependencies target columns +# no yes yes ignored_schema_migrations cursor +# +# The two "no" rows in the last block are the point of keeping v1.0.1: it is the +# only regime that makes the candidate perform the split and bootstrap the +# ignored cursor over populated rows instead of finding both already done. +is_wisp_plane_version() { + case " ${WISP_PLANE_VERSIONS[*]} " in + *" $1 "*) return 0 ;; + esac + return 1 +} + +is_embedded_dolt_version() { + case " ${EMBEDDED_DOLT_VERSIONS[*]} " in + *" $1 "*) return 0 ;; + esac + return 1 +} + +# A pre-upgrade Dolt remote is authentic input only where the candidate will +# still migrate the clone. Probed at implementation time: at v1.0.1 a configured +# remote trips the #4259 designated-migrator refusal (main cursor 32 -> 66 is +# not a same-version first mover), so `bd list` refuses and nothing migrates. At +# v1.1.x the smart gate admits the upgrade as a safe first mover (#4516), so the +# remote is seeded there and the version-control checks run against it. +wisp_lane_has_remote() { + [ "$1" != v1.0.1 ] +} + +wisp_embedded_db_dir() { + local version="$1" root="$workspace/.beads/embeddeddolt" dir + dir=$(find "$root" -mindepth 2 -maxdepth 2 -type d -name .dolt -printf '%h\n' 2>/dev/null | head -1) + [ -n "$dir" ] || die "$version: could not locate the embedded Dolt database under $root" + printf '%s\n' "$dir" +} + +# Raw oracle read. Returns the CSV payload on success and non-zero when Dolt +# reported an error, including the cases where it still exits 0. +oracle_try() { + local version="$1" query="$2" db output + db=$(wisp_embedded_db_dir "$version") || return 1 + output=$( (cd "$db" && isolated_env timeout --kill-after=5s "$OP_TIMEOUT" \ + "$DOLT_BIN" sql -r csv -q "$query") 2>&1 ) || true + case "$output" in + ''|*'error on line'*|*'Error '*|*'error:'*|*panic:*) return 1 ;; + esac + printf '%s\n' "$output" +} + +oracle_sql() { + local version="$1" query="$2" output + output=$(oracle_try "$version" "$query") || + die "$version: oracle query failed: $query" + printf '%s\n' "$output" +} + +# Header row plus exactly one value row. +oracle_scalar() { + local version="$1" query="$2" output + output=$(oracle_sql "$version" "$query") + [ "$(wc -l <<< "$output")" -eq 2 ] || + die "$version: oracle query did not return exactly one row: $query" + sed -n '2p' <<< "$output" +} + +# Value rows only, with the CSV header stripped. +oracle_rows() { + local version="$1" query="$2" + oracle_sql "$version" "$query" | tail -n +2 +} + +oracle_count() { + local version="$1" query="$2" value + value=$(oracle_scalar "$version" "$query") + [[ "$value" =~ ^[0-9]+$ ]] || + die "$version: oracle count is not a number: $query -> $value" + printf '%s\n' "$value" +} + +# Existence probes must not die when the answer is legitimately "no", so they +# read through oracle_try and treat every failure as absent. +oracle_table_exists() { + local version="$1" table="$2" value + value=$(oracle_try "$version" \ + "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '$table'" | + sed -n '2p') || true + [ "$value" = 1 ] +} + +oracle_column_exists() { + local version="$1" table="$2" column="$3" value + value=$(oracle_try "$version" \ + "SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$column'" | + sed -n '2p') || true + [ "$value" = 1 ] +} + +create_wisp_lane_issue() { + local source="$1" title="$2" type="$3" priority="$4" + shift 4 + local output id + output=$(run_in_workspace "$source" create --title "$title" --type "$type" \ + --priority "$priority" --description 'Wisp-plane upgrade fixture' "$@") || return 1 + id=$(sed -n 's/.*Created issue: \([^[:space:]]*\).*/\1/p' <<< "$output" | head -1) + [ -n "$id" ] || return 1 + printf '%s\n' "$id" +} + +wisp_id() { + sed -n "$1p" "$workspace/wisp-ids" +} + +create_wisp_fixture() { + local version="$1" source="$2" i1 i2 w1 w2 w3 w4 w5 listing + i1=$(create_wisp_lane_issue "$source" 'Wisp lane blocker issue' task 1) || + die "$version: could not create the wisp-lane blocker issue" + i2=$(create_wisp_lane_issue "$source" 'Wisp-gated issue' task 2) || + die "$version: could not create the wisp-gated issue" + w1=$(create_wisp_lane_issue "$source" 'wisp open plain' task 2 --ephemeral) || + die "$version: could not create the plain wisp" + w2=$(create_wisp_lane_issue "$source" 'wisp blocked by issue' task 2 --ephemeral) || + die "$version: could not create the issue-blocked wisp" + w3=$(create_wisp_lane_issue "$source" 'wisp blocked by wisp' task 2 --ephemeral) || + die "$version: could not create the wisp-blocked wisp" + w4=$(create_wisp_lane_issue "$source" 'wisp conditionally blocked' task 2 --ephemeral) || + die "$version: could not create the conditionally blocked wisp" + w5=$(create_wisp_lane_issue "$source" 'wisp closed' task 3 --ephemeral) || + die "$version: could not create the closed wisp" + printf '%s\n%s\n%s\n%s\n%s\n%s\n%s\n' "$i1" "$i2" "$w1" "$w2" "$w3" "$w4" "$w5" \ + > "$workspace/wisp-ids" + + # Wisp-source dependencies route into wisp_dependencies; the issue-source + # dependency on a wisp target lands in the main dependencies table, which is + # the depends_on_wisp_id column 0059's stand-in recompute reads. + run_in_workspace "$source" dep add "$w2" "$i1" >/dev/null || + die "$version: could not block a wisp on an issue" + run_in_workspace "$source" dep add "$w3" "$w1" >/dev/null || + die "$version: could not block a wisp on a wisp" + run_in_workspace "$source" dep add "$w4" "$i1" --type conditional-blocks >/dev/null || + die "$version: could not conditionally block a wisp" + run_in_workspace "$source" dep add "$i2" "$w1" >/dev/null || + die "$version: could not block an issue on a wisp" + run_in_workspace "$source" comments add "$w1" 'Wisp comment must survive the upgrade.' \ + --author historical-upgrade >/dev/null || + die "$version: could not comment on a wisp" + run_in_workspace "$source" label add "$w1" historical-upgrade >/dev/null || + die "$version: could not label a wisp" + # Closed but minutes old. Wisp gc's OldThreshold is 24h, so the candidate + # must not collect it; the survival count asserts that it did not. + run_in_workspace "$source" close "$w5" >/dev/null || + die "$version: could not close the closed-wisp fixture" + + listing=$(run_in_workspace "$source" mol wisp list --all --json) || + die "$version: source could not list its own wisps" + jq -e --arg w1 "$w1" --arg w5 "$w5" ' + (.wisps // []) as $wisps | + ($wisps | length) == 5 and + ($wisps | any(.id == $w1 and .status == "open")) and + ($wisps | any(.id == $w5 and .status == "closed")) + ' <<< "$listing" >/dev/null || die "$version: source wisp fixture is incomplete" + + if wisp_lane_has_remote "$version"; then + mkdir -p "$workspace/dolt-remote" + run_in_workspace "$source" dolt remote add origin "file://$workspace/dolt-remote" >/dev/null || + die "$version: could not configure the file:// Dolt remote" + run_in_workspace "$source" dolt push >/dev/null || + die "$version: could not publish the pre-upgrade remote state" + fi +} + +# Deliberately selects only columns that exist in every seeded regime: v1.0.1 +# has no wisps.is_blocked and no ignored_schema_migrations, so the shared +# projection is id/status/updated_at and the split-shape assertions live in the +# post-upgrade checks instead. +snapshot_wisp_plane() { + local version="$1" label="$2" + oracle_sql "$version" 'SELECT id, status, updated_at FROM wisps ORDER BY id' \ + > "$workspace/oracle-wisps-$label.csv" + oracle_sql "$version" 'SELECT id, updated_at FROM issues ORDER BY id' \ + > "$workspace/oracle-issues-$label.csv" + oracle_sql "$version" 'SELECT pattern FROM dolt_ignore ORDER BY pattern' \ + > "$workspace/oracle-ignore-$label.csv" + oracle_count "$version" 'SELECT COUNT(*) FROM wisps' > "$workspace/oracle-wisps-$label.count" + oracle_count "$version" 'SELECT COUNT(*) FROM wisp_comments' > "$workspace/oracle-wispcomments-$label.count" + oracle_count "$version" 'SELECT COUNT(*) FROM wisp_dependencies' > "$workspace/oracle-wispdeps-$label.count" + oracle_count "$version" 'SELECT COUNT(*) FROM events' > "$workspace/oracle-events-$label.count" +} + +verify_wisp_survival() { + local version="$1" listing detail w1 w2 w3 w4 w5 file + w1=$(wisp_id 3); w2=$(wisp_id 4); w3=$(wisp_id 5); w4=$(wisp_id 6); w5=$(wisp_id 7) + # --all: the default listing hides closed wisps, so the closed seed is only + # visible here (probed at implementation time, v1.0.1 and v1.1.x alike). + listing=$(run_in_workspace "$candidate" mol wisp list --all --json) || + die "$version: candidate could not list wisps after the upgrade" + jq -e --arg w1 "$w1" --arg w2 "$w2" --arg w3 "$w3" --arg w4 "$w4" --arg w5 "$w5" ' + (.wisps // []) as $wisps | + ($wisps | length) == 5 and + ([$w1, $w2, $w3, $w4] | all(. as $id | ($wisps | any(.id == $id and .status == "open")))) and + ($wisps | any(.id == $w5 and .status == "closed")) + ' <<< "$listing" >/dev/null || + die "$version: candidate did not preserve the seeded wisp set and statuses" + + for file in wisps wispcomments wispdeps; do + [ "$(cat "$workspace/oracle-$file-after.count")" = "$(cat "$workspace/oracle-$file-before.count")" ] || + die "$version: upgrade changed the $file row count on the wisp plane" + done + + detail=$(run_in_workspace "$candidate" show "$w1" --json --include-comments) || + die "$version: candidate could not read the commented wisp" + jq -e '(if type == "array" then .[0] else . end) | + .title == "wisp open plain" and + ((.labels // []) | index("historical-upgrade") != null) and + ((.comments // []) | any(.author == "historical-upgrade" and .text == "Wisp comment must survive the upgrade.")) + ' <<< "$detail" >/dev/null || + die "$version: candidate did not preserve the wisp title, label, and comment body" +} + +# updated_at is derived-state-sensitive: 0059 and its ignored/0015 twin both +# self-assign `updated_at = updated_at` precisely so an is_blocked repair cannot +# look like a user edit to staleness and TTL consumers. Their predecessors do +# not: 0046, 0047 and ignored/0007 all recompute without the guard, so replaying +# any of them restamps every row they touch. +# +# Which of them replay is a property of the source cursor, so the tolerance is +# too: +# +# v1.0.1 main cursor 32, no ignored cursor. 0046/0047 and the whole ignored +# series re-run, so every non-closed row in both tables legitimately +# moves. Only the closed rows are provably untouched, because every +# recompute is scoped `WHERE status NOT IN ('closed', 'pinned')`. +# v1.1.x main cursor 53, so 0046/0047 are behind it and issues must not move +# at all. The ignored cursor says 0011, but `leases.granted_node` does +# not exist yet, the sentinel disbelieves the cursor, and the ignored +# series replays anyway (#5366) — dragging in ignored/0007 and +# restamping the wisps whose is_blocked it toggles. +# +# Closed rows must be byte-stable in every regime; that is what bites when a +# migration forgets its status scope. The strongest guard on the rest is +# verify_ignored_track_idempotence, which requires a second open to move +# nothing at all. +# +# TODO(wisp-restamp): once ignored/0007 carries the same `updated_at = +# updated_at` guard as ignored/0015, drop the is_blocked tolerance and require +# the v1.1.x wisp projection to be byte-identical too. +verify_no_restamp() { + local version="$1" table file moved tolerated stray closed_moved + + for table in issues wisps; do + file="$workspace/oracle-$table" + closed_moved=$(wisp_moved_rows "$file-before.csv" "$file-after.csv" \ + "$(oracle_rows "$version" "SELECT id FROM $table WHERE status IN ('closed', 'pinned')")") + [ -z "$closed_moved" ] || + die "$version: upgrade restamped closed $table rows, so a recompute lost its status scope: $closed_moved" + done + + is_wisp_plane_split_source "$version" || return 0 + + cmp -s "$workspace/oracle-issues-before.csv" "$workspace/oracle-issues-after.csv" || + die "$version: upgrade restamped issues.updated_at with the main cursor already past 0059" + + moved=$(wisp_updated_at_moves "$workspace/oracle-wisps-before.csv" "$workspace/oracle-wisps-after.csv") + tolerated=$(oracle_rows "$version" 'SELECT id FROM wisps WHERE is_blocked = 1 ORDER BY id' | LC_ALL=C sort) + stray=$(LC_ALL=C comm -23 <(printf '%s\n' "$moved") <(printf '%s\n' "$tolerated") | tr -d '[:space:]') + [ -z "$stray" ] || + die "$version: upgrade restamped wisps the is_blocked recompute never toggled: $stray" +} + +# Sources whose cursors already cover the guarded recomputes, so only the +# ignored-track replay can move a timestamp. +is_wisp_plane_split_source() { + [ "$1" != v1.0.1 ] +} + +# ids whose updated_at differs between two `id,...,updated_at` projections. +wisp_updated_at_moves() { + local before="$1" after="$2" + join -t, -j 1 \ + <(tail -n +2 "$before" | awk -F, '{print $1 "," $NF}' | LC_ALL=C sort) \ + <(tail -n +2 "$after" | awk -F, '{print $1 "," $NF}' | LC_ALL=C sort) | + awk -F, '$2 != $3 {print $1}' | LC_ALL=C sort +} + +# Of the given ids, those whose updated_at moved. +wisp_moved_rows() { + local before="$1" after="$2" candidates="$3" + [ -n "$(tr -d '[:space:]' <<< "$candidates")" ] || return 0 + LC_ALL=C comm -12 \ + <(wisp_updated_at_moves "$before" "$after") \ + <(printf '%s\n' "$candidates" | LC_ALL=C sort) | tr '\n' ' ' | sed 's/ *$//' +} + +# W2 blocks-on-issue, W3 blocks-on-wisp and W4 conditional-blocks-on-issue must +# all be blocked; the plain and closed wisps must not be. I2 carries the +# issue-blocked-by-wisp edge through dependencies.depends_on_wisp_id. +# +# `bd ready` never lists wisps, so the CLI cross-check is `bd blocked`, which +# does cover them (probed at implementation time). +verify_is_blocked() { + local version="$1" actual expected blocked w1 w2 w3 w4 w5 i1 i2 + i1=$(wisp_id 1); i2=$(wisp_id 2) + w1=$(wisp_id 3); w2=$(wisp_id 4); w3=$(wisp_id 5); w4=$(wisp_id 6); w5=$(wisp_id 7) + + actual=$(oracle_rows "$version" 'SELECT id, is_blocked FROM wisps ORDER BY id') + expected=$(printf '%s,1\n%s,1\n%s,1\n%s,0\n%s,0\n' "$w2" "$w3" "$w4" "$w1" "$w5" | LC_ALL=C sort) + [ "$(LC_ALL=C sort <<< "$actual")" = "$expected" ] || + die "$version: wisps.is_blocked truth table is wrong after the upgrade: $(tr '\n' ' ' <<< "$actual")" + + actual=$(oracle_rows "$version" 'SELECT id, is_blocked FROM issues ORDER BY id') + expected=$(printf '%s,0\n%s,1\n' "$i1" "$i2" | LC_ALL=C sort) + [ "$(LC_ALL=C sort <<< "$actual")" = "$expected" ] || + die "$version: issues.is_blocked is wrong after the upgrade (issue blocked by wisp): $(tr '\n' ' ' <<< "$actual")" + + blocked=$(run_in_workspace "$candidate" blocked --json) || + die "$version: candidate blocked query failed on the migrated wisp plane" + jq -e --arg w3 "$w3" --arg i2 "$i2" ' + type == "array" and any(.[]; .id == $w3) and any(.[]; .id == $i2) + ' <<< "$blocked" >/dev/null || + die "$version: bd blocked did not report the blocked wisp and the wisp-gated issue" +} + +# 0055, 0062 and 0064 each register new ignored tables. Registration reads the +# existing dolt_ignore before writing it (#5947), so every pre-upgrade pattern +# must still be there afterwards alongside the new ones. +verify_ignore_superset_and_clean_status() { + local version="$1" pattern missing="" dirty + while IFS= read -r pattern; do + [ -n "$pattern" ] || continue + grep -Fxq "$pattern" <(tail -n +2 "$workspace/oracle-ignore-after.csv") || + missing="$missing $pattern" + done < <(tail -n +2 "$workspace/oracle-ignore-before.csv") + [ -z "$missing" ] || + die "$version: upgrade clobbered pre-existing dolt_ignore patterns:$missing" + + for pattern in leases events bd_events_journal bd_events_seq; do + grep -Fxq "$pattern" <(tail -n +2 "$workspace/oracle-ignore-after.csv") || + die "$version: upgrade did not register '$pattern' in dolt_ignore" + done + + dirty=$(oracle_count "$version" 'SELECT COUNT(*) FROM dolt_status') + [ "$dirty" = 0 ] || + die "$version: upgrade left $dirty dirty tracked table(s): $(oracle_rows "$version" 'SELECT table_name FROM dolt_status' | tr '\n' ' ')" + run_in_workspace "$candidate" dolt status >/dev/null || + die "$version: bd dolt status failed after the upgrade" +} + +# 0062 drops, commits and recreates events as an ignored table. Every row has to +# survive that flip, so this runs before the lane makes any candidate mutation. +verify_events_flip() { + local version="$1" before after + before=$(cat "$workspace/oracle-events-before.count") + after=$(cat "$workspace/oracle-events-after.count") + [ "$before" -gt 0 ] || + die "$version: the events fixture is empty, so the flip assertion would be vacuous" + [ "$after" = "$before" ] || + die "$version: the 0062 events flip changed the audit row count ($before -> $after)" +} + +# The lease plane is born in the candidate chain (0054/0055 and ignored +# 0012/0016), so it is post-upgrade behavior rather than seedable history. +# granted_node is the column a contradicted-cursor replay loses (#5366). +verify_lease_plane() { + local version="$1" i1 rows holder detail + i1=$(wisp_id 1) + oracle_table_exists "$version" leases || + die "$version: the upgrade did not create the leases table" + oracle_column_exists "$version" leases granted_node || + die "$version: leases.granted_node is missing after the upgrade (contradicted-cursor replay)" + [ "$(oracle_count "$version" 'SELECT COUNT(*) FROM leases')" = 0 ] || + die "$version: the upgrade invented lease rows" + + run_in_workspace "$candidate" update "$i1" --claim >/dev/null || + die "$version: candidate could not claim an issue on the migrated store" + [ "$(oracle_count "$version" 'SELECT COUNT(*) FROM leases')" = 1 ] || + die "$version: a candidate claim did not write exactly one lease row" + rows=$(oracle_rows "$version" 'SELECT issue_id, holder FROM leases') + holder=$(cut -d, -f2 <<< "$rows") + [ "$(cut -d, -f1 <<< "$rows")" = "$i1" ] || + die "$version: the lease row does not belong to the claimed issue" + [ -n "$(tr -d '[:space:]"' <<< "$holder")" ] || + die "$version: the lease row has an empty holder" + # TODO(lease-granted-node): `bd update --claim` currently leaves + # granted_node empty and `bd show --json` exposes no lease_granted_node + # field, so the column's presence is asserted above and its population is + # not yet gated. Tighten once the claim path writes the node identity. + detail=$(run_in_workspace "$candidate" show "$i1" --json) || + die "$version: candidate could not read the claimed issue" + jq -e '(if type == "array" then .[0] else . end) | + (.lease_expires_at // "") != "" and (.heartbeat_at // "") != "" + ' <<< "$detail" >/dev/null || + die "$version: the claimed issue exposes no lease projection" +} + +# Closing the blocker must release the plain-blocks and conditional-blocks +# wisps; the wisp-blocked wisp stays blocked because its blocker is still open. +verify_unblock_path() { + local version="$1" i1 w2 w3 w4 actual expected + i1=$(wisp_id 1); w2=$(wisp_id 4); w3=$(wisp_id 5); w4=$(wisp_id 6) + run_in_workspace "$candidate" close "$i1" >/dev/null || + die "$version: candidate could not close the blocker while holding its own claim" + actual=$(oracle_rows "$version" "SELECT id, is_blocked FROM wisps WHERE id IN ('$w2', '$w3', '$w4') ORDER BY id") + expected=$(printf '%s,0\n%s,1\n%s,0\n' "$w2" "$w3" "$w4" | LC_ALL=C sort) + [ "$(LC_ALL=C sort <<< "$actual")" = "$expected" ] || + die "$version: closing the blocker did not release the blocked wisps: $(tr '\n' ' ' <<< "$actual")" +} + +# The 0058 contract, and the reason v1.0.1 is in this lane at all. +# +# v1.0.1 stores wisp dependencies in the legacy single-target shape +# (issue_id, depends_on_id) with no way to tell an issue target from a wisp +# target except by looking the id up. The candidate's ignored/0003-0005 split +# plus the 0047 delegate and the 0058 heal have to re-home those rows into +# depends_on_issue_id / depends_on_wisp_id / depends_on_external. Getting that +# wrong on populated rows is the "duplicate primary key given" hazard class in +# migrations/README.md. +# +# At v1.1.x the rows are already split, so the same assertion is a preservation +# check. Both regimes must end with identical, correctly-homed targets. +verify_wisp_dependency_split() { + local version="$1" column actual expected i1 i2 w1 w2 w3 w4 + i1=$(wisp_id 1); i2=$(wisp_id 2) + w1=$(wisp_id 3); w2=$(wisp_id 4); w3=$(wisp_id 5); w4=$(wisp_id 6) + for column in depends_on_issue_id depends_on_wisp_id depends_on_external; do + oracle_column_exists "$version" wisp_dependencies "$column" || + die "$version: wisp_dependencies.$column is missing after the split migrations" + done + if oracle_column_exists "$version" wisp_dependencies depends_on_id; then + die "$version: wisp_dependencies still carries the legacy depends_on_id column" + fi + + actual=$(oracle_rows "$version" 'SELECT issue_id, depends_on_issue_id, depends_on_wisp_id, type FROM wisp_dependencies ORDER BY issue_id' | LC_ALL=C sort) + expected=$(printf '%s,%s,,blocks\n%s,,%s,blocks\n%s,%s,,conditional-blocks\n' \ + "$w2" "$i1" "$w3" "$w1" "$w4" "$i1" | LC_ALL=C sort) + [ "$actual" = "$expected" ] || + die "$version: wisp dependencies did not land on the right split targets: $(tr '\n' ' ' <<< "$actual")" + + # The issue-source edge on a wisp target lives in the main dependencies + # table, which is the column 0059's stand-in recompute reads. + actual=$(oracle_rows "$version" 'SELECT issue_id, depends_on_issue_id, depends_on_wisp_id, type FROM dependencies ORDER BY issue_id' | LC_ALL=C sort) + expected=$(printf '%s,,%s,blocks\n' "$i2" "$w1") + [ "$actual" = "$expected" ] || + die "$version: the issue-blocked-by-wisp edge did not survive the dependencies split: $(tr '\n' ' ' <<< "$actual")" +} + +# 0064/0066 and ignored 0022/0025 must land on an upgraded store, not just on a +# fresh clone, and wisps must stay writable through the 0060/ignored-0020 +# storage_class default. +verify_events_journal_and_wisp_write() { + local version="$1" w1 detail + w1=$(wisp_id 3) + oracle_table_exists "$version" bd_events_journal || + die "$version: the upgrade did not create bd_events_journal" + oracle_column_exists "$version" bd_events_journal actor || + die "$version: bd_events_journal has no actor column after the upgrade (0066/ignored-0025)" + oracle_table_exists "$version" bd_events_seq || + die "$version: the upgrade did not create bd_events_seq" + + run_in_workspace "$candidate" update "$w1" --notes 'post-upgrade wisp mutation' >/dev/null || + die "$version: candidate could not mutate a wisp after the upgrade" + detail=$(run_in_workspace "$candidate" show "$w1" --json) || + die "$version: candidate could not reopen the mutated wisp" + jq -e '(if type == "array" then .[0] else . end) | .notes == "post-upgrade wisp mutation"' \ + <<< "$detail" >/dev/null || + die "$version: the post-upgrade wisp mutation did not persist across a reopen" + + # TODO(events-journal-rows): the journal stays empty under this harness's + # no-daemon isolation, so the shape is gated here and the row-level actor + # assertion is not. These must still run clean on a migrated store. + run_in_workspace "$candidate" events export >/dev/null || + die "$version: bd events export failed on the migrated store" + run_in_workspace "$candidate" events tail >/dev/null || + die "$version: bd events tail failed on the migrated store" +} + +# Push before pull: the 0062 flip leaves the local events table diverged from +# the pre-upgrade remote's tracked copy, so pulling first is refused with +# "local changes would be stomped by merge: events". Publishing the migration +# commits first is the order that works, and the wisp plane must survive both. +verify_wisp_vc_ops() { + local version="$1" listing + wisp_lane_has_remote "$version" || return 0 + run_in_workspace "$candidate" dolt push >/dev/null || + die "$version: candidate could not publish migration commits to the file:// remote" + run_in_workspace "$candidate" dolt pull >/dev/null || + die "$version: candidate could not pull from the file:// remote after the upgrade" + listing=$(run_in_workspace "$candidate" mol wisp list --all --json) || + die "$version: candidate could not list wisps after a pull" + jq -e '(.wisps // []) | length == 5' <<< "$listing" >/dev/null || + die "$version: a pull disturbed the ignored-plane wisp rows" +} + +# MigrateUp reports `applied` from the main track only and never adds +# appliedIgnored, so `✓ Schema already at vN` is blind to an ignored-track +# replay. This fingerprint is the only guard: a contradicted-cursor replay that +# restamps a row, moves the cursor, or re-runs non-idempotent DDL trips it even +# though the main-track no-op check stays green. +fingerprint_wisp_plane() { + local version="$1" + oracle_sql "$version" 'SELECT id, status, is_blocked, updated_at FROM wisps ORDER BY id' + oracle_sql "$version" 'SELECT id, is_blocked, updated_at FROM issues ORDER BY id' + oracle_sql "$version" 'SELECT id, issue_id, depends_on_issue_id, depends_on_wisp_id, type FROM wisp_dependencies ORDER BY id' + oracle_sql "$version" 'SELECT issue_id, holder FROM leases ORDER BY issue_id' + oracle_sql "$version" 'SELECT pattern FROM dolt_ignore ORDER BY pattern' + oracle_sql "$version" 'SELECT MAX(version) FROM ignored_schema_migrations' + oracle_sql "$version" 'SELECT MAX(version) FROM schema_migrations' + oracle_sql "$version" 'SELECT COUNT(*) FROM events' + oracle_sql "$version" 'SELECT COUNT(*) FROM wisp_comments' +} + +verify_ignored_track_idempotence() { + local version="$1" + fingerprint_wisp_plane "$version" > "$workspace/wisp-fingerprint-first" + run_in_workspace "$candidate" list --json -n 0 --all >/dev/null || + die "$version: candidate could not reopen the migrated wisp workspace" + migrate_schema_current "$version" wisp-second + fingerprint_wisp_plane "$version" > "$workspace/wisp-fingerprint-second" + cmp -s "$workspace/wisp-fingerprint-first" "$workspace/wisp-fingerprint-second" || + die "$version: a second open changed ignored-plane state that the main-track no-op check cannot see" +} + +run_wisp_plane_upgrade() { + local version="$1" source + printf '\n● Wisp-plane upgrade: %s → candidate\n' "$version" + source=$(download_verified_release_binary "$version") || die "$version: verified release is unavailable" + run_in_workspace "$source" init --quiet --prefix histwisp --skip-hooks --skip-agents || + die "$version: wisp-plane source init failed" + [ -d "$workspace/.beads/embeddeddolt" ] || + die "$version: wisp-plane source did not create embedded Dolt data" + create_wisp_fixture "$version" "$source" + snapshot_wisp_plane "$version" before + + # First candidate touch runs the full MigrateUp under the standard per-op + # timeout. A dirty-table refusal or a migration error here is the headline + # failure class for this lane. + run_in_workspace "$candidate" list --json -n 0 --all > "$workspace/wisp-first-open.json" || + die "$version: candidate could not open the seeded wisp workspace" + migrate_schema_current "$version" wisp-first + snapshot_wisp_plane "$version" after + + # Read-only assertions first: the events count must be observed before any + # candidate mutation, and the is_blocked truth table before the unblock. + verify_wisp_survival "$version" + verify_no_restamp "$version" + verify_is_blocked "$version" + verify_wisp_dependency_split "$version" + verify_ignore_superset_and_clean_status "$version" + verify_events_flip "$version" + + verify_lease_plane "$version" + verify_unblock_path "$version" + verify_events_journal_and_wisp_write "$version" + verify_ignored_track_idempotence "$version" + verify_wisp_vc_ops "$version" + # 'bd doctor' has no embedded-mode JSON report; quick is the supported + # health surface here (probed at implementation time). + run_in_workspace "$candidate" doctor quick >/dev/null || + die "$version: bd doctor quick failed after the upgrade" +} + +# #5816: an ignored-named table that is tracked at HEAD *and* dirty, with +# ignored migrations still pending, hard-locks the open. +# +# This state is not constructible from clean OSS lineage — every release since +# v0.63.3 registers the dolt_ignore patterns before creating the tables — which +# is exactly why it needs synthetic surgery here, and why it still matters: +# clones from forks and from older-behavior lineages arrive in it. The surgery +# is the only place this file runs DML through the oracle, and it runs it +# against a throwaway workspace. +# +# #5816 is still open, so this does NOT gate on whether the candidate accepts or +# refuses. It gates on the two things that must hold either way: the command +# terminates, and no wisp rows are lost. If it refuses, the refusal has to name +# the dirty tables rather than failing opaquely. +# +# TODO(#5816): once the fix lands, tighten this to "the open must succeed and +# `bd dolt commit` must clear the dirty state". +run_dirty_tracked_wisp_scenario() { + local version="$1" source i1 w1 w2 before after output table + printf '\n● Dirty tracked wisp tables (#5816): %s → candidate\n' "$version" + source=$(download_verified_release_binary "$version") || die "$version: verified release is unavailable" + run_in_workspace "$source" init --quiet --prefix histwispdirty --skip-hooks --skip-agents || + die "$version: dirty-table source init failed" + i1=$(create_wisp_lane_issue "$source" 'Dirty-table blocker issue' task 1) || + die "$version: could not create the dirty-table blocker issue" + w1=$(create_wisp_lane_issue "$source" 'dirty-table wisp' task 2 --ephemeral) || + die "$version: could not create the dirty-table wisp" + w2=$(create_wisp_lane_issue "$source" 'dirty-table blocked wisp' task 2 --ephemeral) || + die "$version: could not create the dirty-table blocked wisp" + run_in_workspace "$source" dep add "$w2" "$i1" >/dev/null || + die "$version: could not block the dirty-table wisp" + + # Track the ignored-named tables at HEAD, then dirty one of them again with + # a normal old-binary write. dolt_add/dolt_commit are the only DML the + # oracle ever issues. + for table in wisps wisp_comments wisp_dependencies; do + oracle_sql "$version" "CALL DOLT_ADD('-f', '$table')" >/dev/null + done + oracle_sql "$version" "CALL DOLT_COMMIT('-m', 'baseline: wisp tables tracked at HEAD', '--author', 'historical-upgrade ')" >/dev/null + [ "$(oracle_count "$version" 'SELECT COUNT(*) FROM dolt_status')" = 0 ] || + die "$version: the dirty-table baseline commit did not leave a clean status" + run_in_workspace "$source" update "$w1" --notes 'dirty the tracked wisp table' >/dev/null || + die "$version: could not dirty the tracked wisp table" + [ "$(oracle_count "$version" 'SELECT COUNT(*) FROM dolt_status')" -gt 0 ] || + die "$version: the tracked wisp table did not become dirty, so the scenario would be vacuous" + + before=$(oracle_count "$version" 'SELECT COUNT(*) FROM wisps') + output="$workspace/dirty-tracked-open.out" + # run_in_workspace already wraps every call in `timeout`, so a hard-lock + # surfaces as a timeout kill rather than hanging the job. + if run_in_workspace "$candidate" list --json -n 0 --all > "$output" 2>&1; then + printf ' · candidate accepted the dirty tracked wisp tables\n' + else + grep -Fq 'dirty tables' "$output" || + die "$version: candidate refused the dirty tracked wisp tables without naming them: $(head -c 300 "$output")" + for table in wisps wisp_comments; do + grep -Fq "$table" "$output" || continue + printf ' · candidate refused cleanly, naming %s\n' "$table" + break + done + fi + after=$(oracle_count "$version" 'SELECT COUNT(*) FROM wisps') + [ "$after" = "$before" ] || + die "$version: the dirty-table open lost wisp rows ($before -> $after)" +} + prepare_workspace() { workspace=$(mktemp -d "$RUN_ROOT/bd-historical-upgrade.XXXXXX") || die 'could not create isolated workspace' public_bridge_destination="" @@ -1148,8 +1809,17 @@ for version in "${SELECTED_VERSIONS[@]}"; do "$SOURCE_TAG_SQLITE_VERSION") run_v091_upgrade ;; "$PRE_CANONICAL_SQLITE_VERSION") run_v017_upgrade ;; "$CLASSIC_SQLITE_VERSION"|"$CONFIGURED_SQLITE_VERSION") run_classic_sqlite_upgrade "$version" ;; - v0.63.3|v1.0.0|v1.0.1|v1.1.0|v1.1.2) run_embedded_dolt_upgrade "$version" ;; - *) run_dolt_upgrade "$version" ;; + *) + # Membership rather than a second hardcoded list: the embedded + # corpus is already declared once in lib/versions.sh, and a copy + # here silently routes any newly added version into the server-Dolt + # bridge instead. + if is_embedded_dolt_version "$version"; then + run_embedded_dolt_upgrade "$version" + else + run_dolt_upgrade "$version" + fi + ;; esac printf ' ✓ historical upgrade preserved representative data and schema migration was idempotent\n' cleanup @@ -1161,6 +1831,24 @@ for version in "${SELECTED_VERSIONS[@]}"; do cleanup workspace="" fi + # Second lane, fresh workspace: the shared three-issue fixture never carries + # wisps, so the ignored plane the 1.3.0 chain rewrites gets its own corpus. + if is_wisp_plane_version "$version"; then + prepare_workspace + run_wisp_plane_upgrade "$version" + printf ' ✓ wisp-plane upgrade preserved the ignored plane and the ignored track was idempotent\n' + cleanup + workspace="" + fi + # One version carries the synthetic #5816 state; it is a containment check, + # not a regime check, so it does not need repeating across the corpus. + if [ "$version" = v1.1.2 ]; then + prepare_workspace + run_dirty_tracked_wisp_scenario "$version" + printf ' ✓ dirty tracked wisp tables terminated without losing wisp rows\n' + cleanup + workspace="" + fi done printf '\n✓ historical upgrade corpus passed\n' diff --git a/scripts/migration-test/lib/versions.sh b/scripts/migration-test/lib/versions.sh index e1c9eefbb..7b3176cd7 100755 --- a/scripts/migration-test/lib/versions.sh +++ b/scripts/migration-test/lib/versions.sh @@ -39,6 +39,23 @@ declare -ar EMBEDDED_DOLT_VERSIONS=( "v1.0.1" "v1.1.0" "v1.1.2" + "v1.2.2" +) + +# Embedded-Dolt sources whose wisp plane is close enough to the 1.3.0 input +# regimes to be worth seeding: v1.0.1 is the legacy single-target +# wisp_dependencies shape with no ignored-migration cursor, while v1.1.0, +# v1.1.2 and v1.2.2 are the post-split shape with the cursor parked at +# ignored-0011. Both regimes are replayed over populated rows by the candidate's +# main 0054-0066 + ignored 0012-0025 chain. v1.2.2 is the v1.1.2 tree re-tagged +# by the recovery release, so it adds no new regime — it is here because it is +# the tag people in the field actually upgrade from. Also gates the external +# Dolt oracle download in migration-test.yml. +declare -ar WISP_PLANE_VERSIONS=( + "v1.0.1" + "v1.1.0" + "v1.1.2" + "v1.2.2" ) # The test server is an external compatibility fixture, not the runner's @@ -84,6 +101,7 @@ declare -Ar STRICT_RELEASE_ASSETS=( ["v1.0.1|linux|amd64"]="beads_1.0.1_linux_amd64.tar.gz" ["v1.1.0|linux|amd64"]="beads_1.1.0_linux_amd64.tar.gz" ["v1.1.2|linux|amd64"]="beads_1.1.2_linux_amd64.tar.gz" + ["v1.2.2|linux|amd64"]="beads_1.2.2_linux_amd64.tar.gz" # darwin/arm64: reviewed 2026-08-29 (ga-9sghx) so the corpus can run # natively on Apple Silicon. Every asset below was confirmed to exist via # `gh release view -R gastownhall/beads`, and every checksum was @@ -115,6 +133,7 @@ declare -Ar STRICT_RELEASE_SHA256=( ["v1.0.1|linux|amd64"]="1d2364d5d7083a4634a9e734ca87822fb79c2b6625988f9f791e3376313b1b77" ["v1.1.0|linux|amd64"]="b0f3dd607c3fb989ee08d0a6854fba80d0402971eb108f9af6170bc14d491a34" ["v1.1.2|linux|amd64"]="a72d71ed374955dc9f83a0f90b54bd7b6a0016709dd1676ae2e368651ed401c2" + ["v1.2.2|linux|amd64"]="8140098a51d3b81d5548d1c5e6db1a2d9930e5d141efe2a4bff7d079c4d321e8" # darwin/arm64 — see provenance note on STRICT_RELEASE_ASSETS above. ["v0.17.0|darwin|arm64"]="41479fabf76ff76912096bf2e9c1988a9b0d0dd673c7e693342f711770f6d763" ["v0.49.6|darwin|arm64"]="007dacd919eeac48a3a0ecb6aad305ef04e903de02c43a8163d2fd6a63d9ab7d" diff --git a/scripts/upgrade-smoke-test.sh b/scripts/upgrade-smoke-test.sh index 0861d9144..46f249c8b 100755 --- a/scripts/upgrade-smoke-test.sh +++ b/scripts/upgrade-smoke-test.sh @@ -511,6 +511,104 @@ else finish_scenario fi +# --------------------------------------------------------------------------- +# Scenario 7: Wisp plane must survive upgrade +# --------------------------------------------------------------------------- +# +# Release gate for the wisp-plane migrations (0054-0066 and ignored 0012-0025). +# Every earlier scenario works entirely in the versioned plane, so the wisp +# tables reach the candidate empty and those migrations only ever run as DDL +# over zero rows. This seeds a wisp with the OLD binary — including a dependency +# edge, which is what makes the is_blocked recompute do real work — then +# upgrades and exercises the surfaces that break when the replay is wrong: +# listing wisps, the blocker queries that now have to be wisp-aware, and writing +# to a wisp through the migrated storage_class default. +# +# This matrix reaches back thirty releases on a tag push, so anything the old +# binary cannot do has to SKIP rather than fail. + +scenario "Wisp plane survives upgrade (list/ready/blocked/update on migrated wisps)" + +WS=$(new_workspace) + +prev_init 2>/dev/null || true +git -C "$WS" config beads.role maintainer + +_CREATED_ID="" +prev_create --ephemeral --title "Smoke wisp" --type task || true +WISP_ID="${_CREATED_ID}" + +if [ -z "${WISP_ID:-}" ] || [ "$WISP_ID" = "created" ]; then + # Pre-wisp release, or one whose create output we cannot parse for an id. + pass "Wisp check skipped (old binary has no parseable wisp support)" + rm -rf "$WS" + finish_scenario +else + pass "Wisp created with previous binary ($WISP_ID)" + + # A blocker edge makes the migrated is_blocked recompute meaningful. Older + # binaries may not route wisp-source dependencies, so tolerate failure. + _CREATED_ID="" + prev_create --title "Wisp blocker task" --type task --priority 1 || true + WISP_BLOCKER="${_CREATED_ID}" + WISP_DEP=false + if [ -n "${WISP_BLOCKER:-}" ] && [ "$WISP_BLOCKER" != "created" ]; then + if prev dep add "$WISP_ID" "$WISP_BLOCKER" >/dev/null 2>&1; then + WISP_DEP=true + pass "Wisp blocked on a task with previous binary" + fi + fi + if ! $WISP_DEP; then + pass "Wisp dependency skipped (old binary could not block a wisp on a task)" + fi + + # Upgrade. + cand_init 2>/dev/null || true + + # 1. The wisp survived the 0054-0066 + ignored 0012-0025 replay. --all + # because the default listing hides closed wisps. + WISP_OUT=$(cand mol wisp list --all 2>/dev/null || echo "") + if echo "$WISP_OUT" | grep -q "Smoke wisp"; then + pass "Wisp visible after upgrade" + else + fail "Wisp 'Smoke wisp' NOT visible after upgrade (ignored-plane replay dropped it)" + fi + + # 2. Blocker queries must not error on the migrated wisp plane. These read + # wisps and wisp_dependencies through views the chain rewrites. + if cand ready >/dev/null 2>&1; then + pass "bd ready succeeds on the migrated wisp plane" + else + fail "bd ready errors after upgrade (migrated wisp schema regression)" + fi + if cand blocked >/dev/null 2>&1; then + pass "bd blocked succeeds on the migrated wisp plane" + else + fail "bd blocked errors after upgrade (migrated wisp schema regression)" + fi + + # 3. Wisps must stay writable — this is the storage_class default path. + if cand update "$WISP_ID" --notes "smoke wisp mutation" >/dev/null 2>&1; then + SHOW_OUT=$(cand show "$WISP_ID" 2>/dev/null || echo "") + if echo "$SHOW_OUT" | grep -q "smoke wisp mutation"; then + pass "Wisp writable after upgrade (mutation persisted)" + else + fail "Wisp mutation did not persist after upgrade" + fi + else + fail "bd update on a migrated wisp errors after upgrade" + fi + + if cand doctor quick >/dev/null 2>&1; then + pass "bd doctor quick passes on the migrated wisp plane" + else + fail "bd doctor quick fails after the wisp upgrade" + fi + + rm -rf "$WS" + finish_scenario +fi + # --------------------------------------------------------------------------- # Summary # --------------------------------------------------------------------------- diff --git a/test/conformance/profiles.go b/test/conformance/profiles.go index 1e2a2433d..0ca3b320d 100644 --- a/test/conformance/profiles.go +++ b/test/conformance/profiles.go @@ -8,6 +8,12 @@ // isolated workspace for each backend. Adding a backend is one Profiles entry; the // runner and scripts/conformance.sh pick it up automatically. The suite is behind // the `e2e` build tag because it shells out to a freshly built bd. +// +// # Stability +// +// EXPERIMENTAL, same terms as the backend package: this harness tracks the +// evolving storage contract and its registry may change in a minor release. +// Pin an exact beads version. package conformance // Workspace is one isolated place a backend can be `bd init`-ed. Dir is the working