Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,22 @@ jobs:
uv run --all-packages make html
working-directory: docs/

# Pins the measurement_id hash that scripts/post-ingest.py uses as the primary key of every
# benchmarks-database fact row. The golden vectors are a frozen artifact (see the note inside
# the JSON); this job fails if a change to scripts/_measurement_id.py drifts the hash, which
# would break ON CONFLICT idempotency against the rows already in production.
measurement-id-golden:
name: "measurement_id golden vectors"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: spiraldb/actions/.github/actions/setup-uv@a746510eafaa926484c354541cfc49b2ec06cc63 # 0.18.6
- name: Pytest - measurement_id golden vectors
run: |
uv run --no-project --with pytest --with xxhash \
pytest scripts/tests/test_measurement_id.py

python-cuda-test:
name: "Python CUDA (test)"
if: github.repository == 'vortex-data/vortex'
Expand Down
5 changes: 4 additions & 1 deletion _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ extend-ignore-re = [
]

[files]
extend-exclude = ["/vortex-bench/**", "/docs/references.bib", "benchmarks/**", "vortex-sqllogictest/slt/**", "encodings/fsst/src/dfa/tests.rs", "encodings/fsst/src/dfa/flat_contains.rs", "benchmarks-website/server/static/**", "benchmarks-website/server/tests/snapshots/**"]
# scripts/measurement_id_golden.json is a frozen hash-pin artifact whose vectors include
# deliberate Unicode edge cases (JSON-escaped, so "café" reads as the token "caf"); its bytes
# must never change, so it is excluded rather than "fixed".
extend-exclude = ["/vortex-bench/**", "/docs/references.bib", "benchmarks/**", "vortex-sqllogictest/slt/**", "encodings/fsst/src/dfa/tests.rs", "encodings/fsst/src/dfa/flat_contains.rs", "benchmarks-website/server/static/**", "benchmarks-website/server/tests/snapshots/**", "scripts/measurement_id_golden.json"]

[type.py]
extend-ignore-identifiers-re = [
Expand Down
28 changes: 14 additions & 14 deletions scripts/_measurement_id.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright the Vortex contributors

"""Python port of the server-internal `measurement_id` xxhash64 functions.

This is a byte-for-byte port of the `vortex-data/benchmarks-website` repo's
`server/src/db.rs` (`measurement_id_*`, `hasher_for`,
`write_str`, `write_opt_str`, `write_i32`, `write_f64`, `finish`). The v4 ingest
writer computes the same `measurement_id` the v3 Rust server computes, so
re-ingesting an existing `(commit, dim-tuple)` upserts the existing row via
`ON CONFLICT (measurement_id) DO UPDATE` instead of inserting a duplicate.

The equivalence is NOT assumed -- it is pinned by golden vectors generated from
the Rust source of truth (the `measurement_id_golden_vectors` test in the
`vortex-data/benchmarks-website` repo's `server/src/db.rs`). The Python port is
checked against those vectors; any drift in either implementation fails that
check.
"""The `measurement_id` xxhash64 functions -- the primary-key hash of the benchmarks database.

This began as a byte-for-byte port of the Rust implementation in the `vortex-data/
benchmarks-website` repo's `server/src/db.rs` (`measurement_id_*`, `hasher_for`, `write_str`,
`write_opt_str`, `write_i32`, `write_f64`, `finish`); with that server crate retired, this module
is now the only implementation. Re-ingesting an existing `(commit, dim-tuple)` upserts the
existing row via `ON CONFLICT (measurement_id) DO UPDATE` instead of inserting a duplicate, so
the hash is frozen forever: every row already in the production Postgres carries an id computed
this way.

The freeze is NOT assumed -- it is pinned by `scripts/measurement_id_golden.json`, whose vectors
were generated by the original Rust source of truth and must never be regenerated.
`scripts/tests/test_measurement_id.py` asserts this module reproduces every vector; any drift
fails that check.

## The hash, precisely

Expand Down
Loading
Loading