Skip to content

Commit 9e09381

Browse files
fix(server): restrict usage evidence seeding to linked worktrees
1 parent 33c1b0b commit 9e09381

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • apps/server/src/provider/testFixtures/usageEvidence

‎apps/server/src/provider/testFixtures/usageEvidence/seed.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#!/usr/bin/env python3
22
"""Seed an initialized, stopped, disposable worktree .t3; never use production userdata."""
3-
import json, pathlib, sqlite3, sys
3+
import json, pathlib, sqlite3, subprocess, sys
44
root=pathlib.Path.cwd().resolve()
55
base=root/'.t3/userdata'
6-
if not (root/'.git').exists() or base.resolve()==(pathlib.Path.home()/'.t3/userdata').resolve():
6+
if not (root/'.git').is_file() or base.resolve()!=base or base.resolve()==(pathlib.Path.home()/'.t3/userdata').resolve():
7+
raise SystemExit('Run from an isolated worktree with its server stopped')
8+
git=subprocess.run(['git','rev-parse','--path-format=absolute','--show-toplevel','--git-dir','--git-common-dir'],capture_output=True,text=True)
9+
paths=git.stdout.splitlines()
10+
if git.returncode or len(paths)!=3 or pathlib.Path(paths[0]).resolve()!=root or paths[1]==paths[2]:
711
raise SystemExit('Run from an isolated worktree with its server stopped')
812
scenario=sys.argv[1]
913
if scenario not in ['S1','S2','S3','R1','R2','R3']: raise SystemExit('Unknown scenario')

0 commit comments

Comments
 (0)