From 2a73e018b09da4623ce3e663a403f7980e1bf6d8 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Tue, 11 Aug 2026 17:27:53 +0200 Subject: [PATCH] docs: add domain glossary for shared vocabulary Establishes plain-language definitions for the codebase's core concepts so that architecture reviews, ADRs, and module naming stay consistent as the project evolves. --- CONTEXT.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 CONTEXT.md diff --git a/CONTEXT.md b/CONTEXT.md new file mode 100644 index 0000000..651bc1e --- /dev/null +++ b/CONTEXT.md @@ -0,0 +1,43 @@ +# Domain glossary + +Plain-language names for the concepts the codebase is built around. Architecture +reviews and ADRs should use these terms; new modules should be named after a +concept here (add the term when one is missing). + +## The migration + +A one-shot **cutover** of a single repository from a source forge (Codeberg, +Forgejo API) to a target forge (self-hosted Gitea). Both forges share one REST +API lineage, so one `ApiClient` is instantiated twice — once to read the source, +once to write the target. The model is populate-a-fresh-target-once, then freeze +the source; there is no incremental/delta sync. + +## Migration (the bound context) + +The bound context for one repo's transfer: the source and target `ApiClient`s, +the `owner` and `name`, and the source→target `NumberMap`. The conceptually-one +thing the phase functions (`migrate_labels`, `migrate_issues_and_prs`, +`migrate_releases`) previously received as five separate parameters. A +`Migration` is pure bound context — the phases stay as free functions in their +per-concern modules (no monolith). It subsumes the retired `RefCtx` (the web +roots live on the clients; the number map lives here). Lives in `migration.py`, +and is the test surface for the phase layer (two mock-transport clients + a +number map). + +## GitRunner + +**The git-op seam.** The deep module that is the only way `git` is invoked. +Owns execution (subprocess), per-op timeout, error redaction, and auth delivery +(bearer token via a non-persisted `git -c http..extraHeader`, so the token +never enters a remote URL, the command line's persisted form, or `.git/config`). +Lives in `git.py`. Production uses the real subprocess adapter; tests inject a +recording fake and assert on the command sequence. + +## The mirror + +**The git-mirror procedure.** `mirror_repo` and its steps (capture pull-heads → +prune forge-internal refs → `push --mirror` → recreate deleted-branch PR heads as +`refs/heads/_pr/` → LFS fetch+push). Drives git exclusively through a +`GitRunner` and owns the workdir lifecycle (per-user `0700`). The procedure's +value is its ordering invariants; those are what its tests lock. Lives in +`mirror.py`.