#!/usr/bin/env bash # Refreshes the vendored copy of the official atproto interop test vectors. # # The vectors are CC-0, so they are copied into this repository outright rather # than fetched at test time: a conformance suite that only runs when GitHub is # reachable is a suite that stops running. The cost of vendoring is that the # copy rots silently, which is what this script exists to prevent — run it, # read the diff, and commit it as its own change. # # Everything upstream ships is vendored. `firehose/` was skipped for a while # on the reading that it tested a frame format this server does not speak; it # does not — its one file is a set of Merkle search tree commit proofs, which # is a claim about the tree rather than about a wire format. Adding a # directory is a line in VENDORED_DIRS plus a runner. # # `mst/` is vendored even though there is no Merkle search tree here. Two of # its four files ask only about pure functions — a key's height and a common # prefix length — and those exist. The directory is copied whole, so # `example_keys.txt` comes with them and is run as well. set -euo pipefail UPSTREAM="https://github.com/bluesky-social/atproto-interop-tests.git" VENDORED_DIRS=(syntax lexicon crypto data-model mst firehose) cd "$(dirname "$0")/.." dest="vendor/atproto-interop-tests" # A pinned ref can be passed as the first argument; otherwise take the tip of # the default branch. Pinning is for reproducing an older run, not for normal # refreshes — the whole point is to move forward deliberately. ref="${1:-HEAD}" work="$(mktemp -d)" trap 'rm -rf "$work"' EXIT echo "fetching $UPSTREAM at $ref" git init --quiet "$work" git -C "$work" remote add origin "$UPSTREAM" git -C "$work" fetch --quiet --depth 1 origin "$ref" git -C "$work" checkout --quiet FETCH_HEAD commit="$(git -C "$work" rev-parse HEAD)" committed="$(git -C "$work" log -1 --format=%cI)" rm -rf "$dest" mkdir -p "$dest" cp "$work/LICENSE-CC0" "$dest/LICENSE-CC0" for dir in "${VENDORED_DIRS[@]}"; do cp -R "$work/$dir" "$dest/$dir" done cat > "$dest/PROVENANCE.md" < | | Commit | \`$commit\` | | Committed | $committed | | Fetched | $(date -u +%Y-%m-%dT%H:%M:%SZ) | | Licence | CC0 1.0 Universal, see \`LICENSE-CC0\` | | Vendored | ${VENDORED_DIRS[*]} | CC0 waives copyright entirely, so this copy carries no attribution requirement. The licence text is kept anyway, because a vendored tree with no licence file beside it is one nobody can audit without knowing where it came from. ## Whitespace is significant Several vectors are exactly a trailing space, a leading space, or an empty line away from valid — \`one.two.three \` is in \`nsid_syntax_invalid.txt\` for that reason alone. The file-hygiene hooks in \`prek.toml\` exclude this directory so that they cannot quietly repair a test case into passing, and the runner in \`crates/didbot/tests/conformance/\` never trims a candidate. EOF echo "vendored $commit into $dest"