Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e7af91c
plan: initial spine draft from Phase 1 sweep
connortsui20 Jun 19, 2026
3fa2fcb
plan: spine updated with brainstorming design output
connortsui20 Jun 19, 2026
865bd00
plan: spine updated after grill-me stress-test
connortsui20 Jun 19, 2026
74a8242
plan: Phase Map decomposition
connortsui20 Jun 19, 2026
a3ffeee
plan: transition to Phase 2 — begin execution
connortsui20 Jun 19, 2026
e5a0caf
plan: record phase_entry_sha for phase 1
connortsui20 Jun 19, 2026
a84975a
plan: task-plan for sub-phase 1.1 (measurement_id contract)
connortsui20 Jun 19, 2026
ec31812
scripts: add measurement_id Python port + golden-vector test
connortsui20 Jun 19, 2026
766f58f
scripts: ruff-format measurement_id test to repo line-length
connortsui20 Jun 19, 2026
2145722
plan: set status reviewing — sub-phase 1.1 gauntlet checkpoint
connortsui20 Jun 19, 2026
878a17d
plan: sub-phase 1.1 ledger entry + deferred carry-forward
connortsui20 Jun 19, 2026
ad6f76f
plan: advance to sub-phase 1.2 (Postgres writer)
connortsui20 Jun 19, 2026
74667a6
plan: amend sub-phase 1.2 — self-contained schema fixture (migrations…
connortsui20 Jun 19, 2026
1d73170
plan: task-plan for sub-phase 1.2 (Postgres writer)
connortsui20 Jun 19, 2026
5a4d8ae
scripts: add v4 --postgres IAM-auth upsert writer to post-ingest.py
connortsui20 Jun 19, 2026
d6d8a8e
scripts: add revalidate test + python-writer cross-check utility
connortsui20 Jun 19, 2026
3ef63fd
scripts: add adapted testcontainer writer test + self-contained schem…
connortsui20 Jun 19, 2026
96418dd
plan: set status reviewing — sub-phase 1.2 gauntlet checkpoint
connortsui20 Jun 19, 2026
23dd355
plan: sub-phase 1.2 ledger entry + deferred carry-forward
connortsui20 Jun 19, 2026
dd4e812
plan: advance to sub-phase 1.3 (CI + workflow wiring)
connortsui20 Jun 19, 2026
e4957e7
plan: task-plan for sub-phase 1.3 (CI + workflow wiring)
connortsui20 Jun 19, 2026
0e28483
ci: run the v4 emitter scripts/ tests
connortsui20 Jun 19, 2026
0b54e55
ci: add best-effort v4 Postgres dual-write step to the emitter workflows
connortsui20 Jun 19, 2026
6dba6e4
plan: set status reviewing — sub-phase 1.3 gauntlet checkpoint
connortsui20 Jun 19, 2026
38c52eb
plan: sub-phase 1.3 ledger entry + deferred carry-forward
connortsui20 Jun 19, 2026
4da50e1
plan: all Phase 1 sub-phases complete — enter Phase 3 (phase boundary)
connortsui20 Jun 19, 2026
6fdd727
fix: phase-D finalization polish (gauntlet should-fixes)
connortsui20 Jun 19, 2026
c35badc
plan: Phase 1 gate — phase-4 gauntlet accepted
connortsui20 Jun 19, 2026
9c4607b
plan: session handoff — Phase 1 done, open decision = phase-D PR form
connortsui20 Jun 19, 2026
3301626
plan: phase PR opened — #8512
connortsui20 Jun 19, 2026
bd2b10b
plan: set status awaiting-human-gate — phase 1 gate
connortsui20 Jun 19, 2026
05b6b79
ci: green the phase-D PR checks (REUSE + typos)
connortsui20 Jun 19, 2026
9e601fb
plan: note post-PR-open CI fixes at the phase 1 gate
connortsui20 Jun 19, 2026
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
132 changes: 132 additions & 0 deletions .big-plans/ct__bench-v4-emitters--1-1-measurement-id.plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Sub-phase 1.1 — measurement_id contract Implementation Plan

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** Port the three `measurement_id` contract files verbatim from branch ref `f9b36ae3f` into the monorepo working tree, repoint the cross-repo doc references, and verify byte-parity against the golden vectors.

**Architecture:** This is an EXTRACT-FROM-BRANCH + ADJUST + VERIFY unit, not a from-scratch implementation. The files already exist on the unmerged branch and apply cleanly (mainline has never touched these paths). `scripts/_measurement_id.py` reproduces the Rust server's `measurement_id` xxhash64 hash; `scripts/test_measurement_id.py` pins it against `scripts/measurement_id_golden.json` (63 cross-language golden vectors over 5 fact tables).

**Tech Stack:** Python 3.11+, the `xxhash` package (XXH64), pytest, `uv run --no-project --with ...`, ruff.

## Global Constraints

- Extract files VERBATIM from `f9b36ae3f` via `git show f9b36ae3f:<path> > <path>`. Do NOT re-author or alter any hash logic, field order, or golden value.
- Repoint ONLY the cross-repo documentation references in the two `.py` docstrings (paths that no longer exist in this monorepo). No logic changes.
- Both `.py` files MUST keep the two SPDX header lines: `# SPDX-License-Identifier: Apache-2.0` and `# SPDX-FileCopyrightText: Copyright the Vortex contributors` (already present on the branch).
- Python lint: ruff `F,E,W,UP,I` clean; line-length 120. Comments use `--`, never em dashes; full sentences.
- This sub-phase touches ONLY: `scripts/_measurement_id.py`, `scripts/measurement_id_golden.json`, `scripts/test_measurement_id.py`. Do NOT touch `ci.yml`, any workflow, or `post-ingest.py` (those are sub-phase 1.3 / 1.2).
- Commits: DCO trailer `Signed-off-by: Connor Tsui <connor@spiraldb.com>`. Never put backticks or a `---` scissors line in a `git commit -m` message; use `git commit -F` with a heredoc.

---

### Task 1: Port the measurement_id contract files and verify golden parity

**Files:**
- Create: `scripts/_measurement_id.py` (extracted from `f9b36ae3f`)
- Create: `scripts/measurement_id_golden.json` (extracted from `f9b36ae3f`)
- Create/Test: `scripts/test_measurement_id.py` (extracted from `f9b36ae3f`)

**Interfaces:**
- Produces (relied on by sub-phases 1.2/1.3): `scripts/_measurement_id.py` exposing the dispatch dict `MEASUREMENT_ID_BY_TABLE` keyed by the five table names (`query_measurements`, `compression_times`, `compression_sizes`, `random_access_times`, `vector_search_runs`), each value a callable taking the table's dimensional fields as keyword args and returning a signed-i64 `measurement_id`. Sub-phase 1.2's Postgres writer imports this module to compute upsert keys.
- Consumes: nothing from earlier tasks (this is the first sub-phase).

- [ ] **Step 1: Extract the golden vectors and the test from the branch (the "test" half first, for a real red->green)**

```bash
cd "$(git rev-parse --show-toplevel)"
git show f9b36ae3f:scripts/measurement_id_golden.json > scripts/measurement_id_golden.json
git show f9b36ae3f:scripts/test_measurement_id.py > scripts/test_measurement_id.py
```

Do NOT edit `measurement_id_golden.json` at all (not even its `note` field): it is a Rust-generated artifact (regenerated by `REGEN_GOLDEN_VECTORS=1 cargo test -p vortex-bench-server --test measurement_id_golden` in the `vortex-data/benchmarks-website` repo). Editing it would drift the monorepo copy from the generator. Porting it byte-identical is what lets the test pin cross-language parity.

- [ ] **Step 2: Run the test to verify it fails (the implementation module does not exist yet)**

```bash
uv run --no-project --with pytest --with xxhash pytest scripts/test_measurement_id.py -q
```

Expected: an ERROR during collection — `scripts/test_measurement_id.py` executes `port = _load_port()` at import time, which tries to load `scripts/_measurement_id.py`; that file does not exist yet, so collection fails (FileNotFoundError / module load error). This confirms the test is wired to the implementation.

- [ ] **Step 3: Extract the implementation module from the branch**

```bash
git show f9b36ae3f:scripts/_measurement_id.py > scripts/_measurement_id.py
```

- [ ] **Step 4: Run the test to verify it passes (all 63 vectors + the 3 meta tests)**

```bash
uv run --no-project --with pytest --with xxhash pytest scripts/test_measurement_id.py -q
```

Expected: PASS — 63 parametrized `test_python_port_matches_golden` cases plus `test_all_tables_covered` and `test_multibyte_fixture_present`, all green (66 passed). If any vector mismatches, the port and the golden file disagree — STOP and report; do not edit values to force a pass.

- [ ] **Step 5: Repoint the cross-repo doc references in `_measurement_id.py` (cosmetic; no logic change)**

In `scripts/_measurement_id.py`, replace the single occurrence of the path token:

- old: `` `benchmarks-website/server/src/db.rs` `` (in the module docstring, the "byte-for-byte port of" line)
- new: ``the `vortex-data/benchmarks-website` repo's `server/src/db.rs` ``

so the sentence reads "This is a byte-for-byte port of the `vortex-data/benchmarks-website` repo's `server/src/db.rs` (`measurement_id_*`, `hasher_for`, ...)". This is the only `benchmarks-website` reference in this file.

- [ ] **Step 6: Repoint the cross-repo doc references in `test_measurement_id.py` (cosmetic; no logic change)**

In `scripts/test_measurement_id.py` docstring, repoint both references:

- `` `benchmarks-website/server/src/db.rs` `` -> ``the `vortex-data/benchmarks-website` repo's `server/src/db.rs` ``
- `` `benchmarks-website/server/tests/measurement_id_golden.rs` `` -> ``the `vortex-data/benchmarks-website` repo's `server/tests/measurement_id_golden.rs` ``

Do NOT alter the `import`s, the loader, or any assertion.

- [ ] **Step 7: Re-run the test after the docstring edits (guard against an accidental code edit)**

```bash
uv run --no-project --with pytest --with xxhash pytest scripts/test_measurement_id.py -q
```

Expected: PASS (still 66 passed). The docstring edits must not change behavior.

- [ ] **Step 8: Lint and format-check the two new Python files**

```bash
uvx ruff check scripts/_measurement_id.py scripts/test_measurement_id.py
uvx ruff format --check scripts/_measurement_id.py scripts/test_measurement_id.py
```

Expected: both exit 0 (no diagnostics, already-formatted). If `ruff format --check` reports a diff, run `uvx ruff format scripts/_measurement_id.py scripts/test_measurement_id.py` and re-run Step 7 to confirm the test still passes.

- [ ] **Step 9: Confirm SPDX headers are present on both `.py` files**

```bash
head -2 scripts/_measurement_id.py
head -2 scripts/test_measurement_id.py
```

Expected: each begins with `# SPDX-License-Identifier: Apache-2.0` then `# SPDX-FileCopyrightText: Copyright the Vortex contributors`. (They are present on the branch; this is a guard.)

- [ ] **Step 10: Commit**

```bash
git add scripts/_measurement_id.py scripts/measurement_id_golden.json scripts/test_measurement_id.py
git commit -F - <<'EOF'
scripts: add measurement_id Python port + golden-vector test

Port the server-internal measurement_id xxhash64 hash to Python
(scripts/_measurement_id.py) with its 63-vector cross-language golden test
(scripts/test_measurement_id.py, scripts/measurement_id_golden.json), extracted
verbatim from the v4 emitter branch. Repoint the docstrings to the extracted
vortex-data/benchmarks-website repo. The golden vectors pin Rust == Python.

Signed-off-by: Connor Tsui <connor@spiraldb.com>
EOF
```

---

## Self-Review

- **Spec coverage:** all three files (`_measurement_id.py`, `measurement_id_golden.json`, `test_measurement_id.py`) are created (Steps 1, 3); docstrings repointed (Steps 5-6); SPDX verified (Step 9); parity verified (Steps 4, 7); lint clean (Step 8). Out-of-scope items (ci.yml, workflows, post-ingest.py) are untouched.
- **Placeholder scan:** none — every step has an exact command or an exact old->new string.
- **Type consistency:** the `MEASUREMENT_ID_BY_TABLE` dispatch and the five table names match the golden file's `table` values and what sub-phase 1.2 will import.
Loading
Loading