fix(config): address PR #154 review — gitattributes glob + script roots

Tyre (architecture review):
- .gitattributes: `.pql/changelog/*.sql` matched nothing (files are one level
  deeper at .pql/changelog/<table>/<YYYY-MM>.sql), so the union-merge driver never
  applied — `git check-attr merge` returned `unspecified`. Fixed to
  `.pql/changelog/**/*.sql`; now resolves to `merge: union` for monthly + schema
  files. Restores the changelog's conflict-free merge guarantee.
- Migration scripts: the re-runnable ones (seed_tickets.py, add_workshop_provenance.py)
  now derive the repo root from `git rev-parse --show-toplevel` instead of a hardcoded
  /main path, so re-running from a worktree/clone targets the right checkout. The three
  one-shot transforms (restructure_decisions, repath_references, retag_ticket_refs)
  get a comment noting they're already-applied and unsafe to re-run (git mv on moved
  sources) — keeping the path honest rather than implying re-runnability.

Hoshe approved (all QA checks passed). ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-06 21:05:31 +02:00
co-authored by Claude Opus 4.8
parent c03a75e4c0
commit f8d9b777b0
6 changed files with 17 additions and 4 deletions
+1 -1
View File
@@ -1 +1 @@
.pql/changelog/*.sql merge=union
.pql/changelog/**/*.sql merge=union
@@ -16,10 +16,12 @@ import glob
import os
import re
import sqlite3
import subprocess
import sys
APPLY = "--apply" in sys.argv
REPO = "/var/mnt/data/projects/settled-reach/main"
# Derive the repo root from git so the script targets the checkout it's run from.
REPO = subprocess.check_output(["git", "rev-parse", "--show-toplevel"], text=True).strip()
DB = f"{REPO}/.pql/pql.db"
D_IDS = set(r[0] for r in sqlite3.connect(DB).execute(
@@ -48,7 +50,7 @@ def main():
text = open(f, encoding="utf-8").read()
fm, body = split_frontmatter(text)
refs = refs_in(body if fm is not None else text)
rel = f.split("/main/", 1)[-1]
rel = os.path.relpath(f, REPO)
wname = os.path.basename(os.path.dirname(f))
refs_yaml = "[" + ", ".join(refs) + "]"
+3
View File
@@ -35,6 +35,9 @@ REPLACEMENTS = [
(re.compile(r"(?<!governance/)decisions/"), "governance/"), # bare dir — must be last
]
# One-shot transform, already applied (decisions/ path refs -> governance/). The
# absolute paths below are the canonical main checkout where it was run; kept
# committed for provenance.
TARGETS = sorted(set(
glob.glob("/var/mnt/data/projects/settled-reach/main/.claude/agents/*.md")
+ glob.glob("/var/mnt/data/projects/settled-reach/main/.claude/skills/**/*.md", recursive=True)
@@ -17,6 +17,9 @@ import subprocess
import sys
from pathlib import Path
# One-shot transform, already applied (decisions/ -> governance/). Re-running is
# unsupported: the git mv calls would fail on already-moved sources. The path below
# is the canonical main checkout where it was run; kept committed for provenance.
ROOT = Path("/var/mnt/data/projects/settled-reach/main")
APPLY = "--apply" in sys.argv
+2
View File
@@ -23,6 +23,8 @@ import sqlite3
import sys
APPLY = "--apply" in sys.argv
# One-shot transform, already applied (#N -> T-N). The path below is the canonical
# main checkout where it was run; kept committed for provenance.
REPO = "/var/mnt/data/projects/settled-reach/main"
SRC = os.environ.get("SR_DB_PATH", "/var/home/jeroenschweitzer/Projects/settled-reach/settledreach.db")
+4 -1
View File
@@ -25,10 +25,13 @@ import hashlib
import os
import re
import sqlite3
import subprocess
import sys
APPLY = "--apply" in sys.argv
REPO = "/var/mnt/data/projects/settled-reach/main"
# Derive the repo root from git so the script targets the checkout it's run from
# (a worktree, a fresh clone, or main) rather than a hardcoded path.
REPO = subprocess.check_output(["git", "rev-parse", "--show-toplevel"], text=True).strip()
SRC = os.environ.get("SR_DB_PATH", "/var/home/jeroenschweitzer/Projects/settled-reach/settledreach.db")
DST = f"{REPO}/.pql/pql.db"
SEED_TS = "2026-06-06 00:00:00" # well-formed stamp for rows the legacy schema didn't timestamp