refactor(migrator): own _pr/N PR-head contract
CI / test (push) Canceled after 0s

Extract the duplicated `_pr/<n>` deleted-branch PR-head branch name
into a single pure helper `refs.pr_head_branch(n)`, now the only
definition. The git-mirror layer (mirror.py) and the REST/entity
layer (issues.py) both call it instead of spelling the pattern, so
the two can no longer diverge — editing one side previously broke
the other silently and late (404/500 on PR create for deleted-branch
PRs only).

Behavior-preserving string round-trip. refs.py widens from
"cross-reference rewriting" to "reference-namespace knowledge"
(branch-name patterns + cross-ref rewriting), still pure stdlib. No
new test — a shared symbol prevents divergence by construction
(issue #3 testing decision); the deleted-branch round-trip stays
covered by the existing phase test seam.

Closes #3
This commit is contained in:
AlexKucera committed 2026-08-11 17:26:46 +02:00
1 parent 9d585f601a
commit 8ec9ce49db
8 files changed
+107 -13

No files matched your search

+2 -1
View File
@@ -106,7 +106,7 @@ When the user requests a durable behavior change, record it here or in the relev
<!-- gitnexus:start -->
# GitNexus — Code Intelligence
This project is indexed by GitNexus as **codeberg-to-gitea-migrator** (434 symbols, 884 relationships, 31 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
This project is indexed by GitNexus as **codeberg-to-gitea-migrator** (444 symbols, 901 relationships, 31 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
> Index stale? Run `node .gitnexus/run.cjs analyze` from the project root — it auto-selects an available runner. No `.gitnexus/run.cjs` yet? `npx gitnexus analyze` (npm 11 crash → `npm i -g gitnexus`; #1939).
@@ -154,6 +154,7 @@ Session logs live in `docs/devlog/` (one per completed task/issue/milestone). Fu
<!-- write-log: window-start -->
| Date | Type | File | Summary |
|------|------|------|---------|
| 2026-08-11 | issue | [20260811-issue3-pr-head-branch-helper-in-refs_log.md](docs/devlog/20260811-issue3-pr-head-branch-helper-in-refs_log.md) | Extract the duplicated `_pr/<n>` deleted-branch PR-head name into one shared pure helper `refs.pr_head_branch`; `mirror.py` + `issues.py` route through it instead of spelling the literal. Closes #3. |
| 2026-08-11 | issue | [20260811-issue2-bind-migration-context-retire-refctx-path_log.md](docs/devlog/20260811-issue2-bind-migration-context-retire-refctx-path_log.md) | Introduce frozen `Migration` bound context; rewrite the four entity phases to take the handle; retire `RefCtx`/`_path`; add the phase test seam (`test_phases.py`). Closes #2. |
| 2026-08-11 | issue | [20260811-issue1-gitrunner-sole-git-op-seam_log.md](docs/devlog/20260811-issue1-gitrunner-sole-git-op-seam_log.md) | Introduce `git.GitRunner` as the sole git-op seam; rewrite mirror to drive it; retire URL-token helpers; closes audit HIGH A09 + MEDIUM A02 at the root. |
<!-- write-log: window-end -->