88Manages fixture versions in S3 (or local directories) by calling the thin
99`vortex-compat` Rust binary for generation and checking. The Rust binary
1010handles only two things: generating .vortex files and comparing them.
11- Everything else (versioning, S3 upload/download, manifest merging, worktree
12- management) lives here.
11+ Everything else (versioning, S3 upload/download, manifest merging) lives here.
1312
1413Quick start:
1514 # Generate + publish for HEAD (version auto-detected from latest tag)
6564 uv run compat.py publish
6665 uv run compat.py publish --dry-run
6766
68- # Publish from an older tag via worktree
67+ # Publish using an older tag for version detection
6968 uv run compat.py publish --git-ref v0.62.0
7069
7170 # Generate locally without publishing
@@ -309,54 +308,6 @@ def _merge_manifest(
309308 }
310309
311310
312- # ---------------------------------------------------------------------------
313- # Worktree helpers
314- # ---------------------------------------------------------------------------
315-
316-
317- def _worktree_generate (git_ref : str , output_dir : Path ) -> None :
318- """Create a git worktree at `git_ref`, build vortex-compat, and generate fixtures."""
319- repo_root = Path (
320- subprocess .run (
321- ["git" , "rev-parse" , "--show-toplevel" ],
322- capture_output = True ,
323- text = True ,
324- check = True ,
325- ).stdout .strip ()
326- )
327-
328- worktree_dir = Path (tempfile .mkdtemp (prefix = f"vortex-compat-wt-{ git_ref } -" ))
329- try :
330- _info (f"creating worktree at { git_ref } in { worktree_dir } " )
331- _run_cmd (
332- ["git" , "-C" , str (repo_root ), "worktree" , "add" , str (worktree_dir ), git_ref ],
333- check = True ,
334- )
335-
336- _info (f"building vortex-compat at { git_ref } ..." )
337- _run_cmd (
338- ["cargo" , "build" , "-p" , CARGO_BIN , "--release" ],
339- check = True ,
340- cwd = worktree_dir ,
341- )
342-
343- bin_path = worktree_dir / "target" / "release" / CARGO_BIN
344- if not bin_path .exists ():
345- print (f"error: binary not found at { bin_path } " , file = sys .stderr )
346- sys .exit (1 )
347-
348- _info (f"generating fixtures with { git_ref } binary..." )
349- _run_cmd ([str (bin_path ), "generate" , "--output" , str (output_dir )], check = True )
350-
351- finally :
352- _run_cmd (
353- ["git" , "-C" , str (repo_root ), "worktree" , "remove" , "--force" , str (worktree_dir )],
354- check = False ,
355- )
356- if worktree_dir .exists ():
357- shutil .rmtree (worktree_dir , ignore_errors = True )
358-
359-
360311# ---------------------------------------------------------------------------
361312# Commands
362313# ---------------------------------------------------------------------------
@@ -365,14 +316,10 @@ def _worktree_generate(git_ref: str, output_dir: Path) -> None:
365316def cmd_generate (args : argparse .Namespace ) -> None :
366317 """Generate fixtures locally, then write a proper manifest."""
367318 output = Path (args .output )
368- git_ref = args .git_ref
369319 exclude = _parse_exclude (args )
370- version = _version_from_ref (git_ref )
320+ version = _version_from_ref (args . git_ref )
371321
372- if git_ref :
373- _worktree_generate (git_ref , output )
374- else :
375- _run_rust_generate (output , exclude = exclude )
322+ _run_rust_generate (output , exclude = exclude )
376323
377324 # Read fixtures.json and write a versioned manifest.
378325 fixtures_json = json .loads ((output / "fixtures.json" ).read_text ())
@@ -399,10 +346,7 @@ def cmd_publish(args: argparse.Namespace) -> None:
399346 output = Path (tmpdir ) / "fixtures"
400347
401348 _info ("generating fixtures..." )
402- if git_ref :
403- _worktree_generate (git_ref , output )
404- else :
405- _run_rust_generate (output , exclude = exclude )
349+ _run_rust_generate (output , exclude = exclude )
406350
407351 fixtures_json = json .loads ((output / "fixtures.json" ).read_text ())
408352
@@ -674,9 +618,9 @@ def main() -> None:
674618 "generate" ,
675619 help = "Generate fixtures locally" ,
676620 description = (
677- "Build all fixture .vortex files and write them to a directory. \n "
678- "Version is auto-detected from the nearest git tag at HEAD \n "
679- "(or at --git-ref if specified)."
621+ "Build all fixture .vortex files using the current binary and write \n "
622+ "them to a directory. Version is auto-detected from the nearest git\n "
623+ "tag at HEAD (or at --git-ref if specified)."
680624 ),
681625 epilog = (
682626 "examples:\n "
@@ -688,8 +632,9 @@ def main() -> None:
688632 p .add_argument ("--output" , required = True , help = "Output directory" )
689633 p .add_argument (
690634 "--git-ref" ,
691- help = "Git ref (tag/branch/SHA) to build from via worktree. "
692- "Version is derived from the nearest tag at this ref." ,
635+ help = "Git ref for version detection (e.g. v0.62.0). "
636+ "Version is derived from the nearest tag at this ref. "
637+ "Fixtures are always built with the current binary." ,
693638 )
694639 p .add_argument (
695640 "--exclude" ,
@@ -719,8 +664,9 @@ def main() -> None:
719664 )
720665 p .add_argument (
721666 "--git-ref" ,
722- help = "Git ref to build from via worktree (e.g. v0.62.0). "
723- "Version is derived from the nearest tag at this ref." ,
667+ help = "Git ref for version detection (e.g. v0.62.0). "
668+ "Version is derived from the nearest tag at this ref. "
669+ "Fixtures are always built with the current binary." ,
724670 )
725671 p .add_argument (
726672 "--dry-run" ,
0 commit comments