|
| 1 | +// SPDX-License-Identifier: PMPL-1.0-or-later |
| 2 | +// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
| 3 | += Estate Organization: one aggregator, threads off it |
| 4 | +:toc: preamble |
| 5 | + |
| 6 | +== The rule |
| 7 | + |
| 8 | +There are three layers and exactly one is the source of truth. |
| 9 | + |
| 10 | +[cols="1,3,3",options="header"] |
| 11 | +|=== |
| 12 | +| Layer | Path | Role |
| 13 | +| Flat clone root | `$REPOS_DIR` (default `~/dev/repos/<repo>`) | *Single source of truth.* All work and branches happen here, in ordinary independent clones. Per-repo PRs/issues unchanged. |
| 14 | +| Aggregator | `reposystem` (this repo) | Coordination layer over the clones: the `repos.toml` index + the `thread` runner. Owns no code history; pins nothing. |
| 15 | +| Published artifact | `repos-monorepo` | *Generated output.* Submodule pointers are an auto-bumped index that keeps GitHub Pages, the GitLab/Bitbucket mirror, and the governance workflows working. |
| 16 | +|=== |
| 17 | + |
| 18 | +Never `cd` into `repos-monorepo` to edit code. Never hand-resolve a submodule |
| 19 | +there. It is regenerated, not maintained. |
| 20 | + |
| 21 | +== Files |
| 22 | + |
| 23 | +* `repos.toml` — *generated* from `repos-monorepo/.gitmodules` by |
| 24 | + `scripts/gen-repos-manifest.sh`. Regenerate with `just repos-manifest`. |
| 25 | + NOTE: `0-AI-MANIFEST.a2ml` prefers generated files out of source control; |
| 26 | + `repos.toml` is a *deliberate exception* — it is the coordination index and |
| 27 | + must be present on a fresh clone / in CI without a regeneration step. It |
| 28 | + carries an SPDX header and is fully reproducible from the documented command. |
| 29 | +* `repos.groups.toml` — *hand-maintained*. Names the repo sets a cross-repo |
| 30 | + thread spans (epics). Survives manifest regeneration. |
| 31 | + |
| 32 | +== Cross-repo threads (the merge model) |
| 33 | + |
| 34 | +A thread is one logical change across N repos. Each repo still merges through |
| 35 | +its *own normal PR* — the runner only orchestrates the fan-out. |
| 36 | + |
| 37 | +[source,sh] |
| 38 | +---- |
| 39 | +just thread resolve --kind julia # who is in scope |
| 40 | +just thread start standards-130 --repos echo-types,affinescript # branch per clone |
| 41 | +just thread pr standards-130 --refs standards#130 # one PR per repo |
| 42 | +just thread status standards-130 --repos echo-types,affinescript # CI/merge state |
| 43 | +just thread land standards-130 --repos echo-types,affinescript --yes |
| 44 | +---- |
| 45 | + |
| 46 | +Selectors: `--group <name>` (from `repos.groups.toml`), `--kind <kind>` (from |
| 47 | +`repos.toml`), or `--repos a,b,c`. `start` skips dirty worktrees; `land` |
| 48 | +refuses without `--yes` and only merges PRs GitHub reports `MERGEABLE`. |
| 49 | + |
| 50 | +== Keeping the published artifact current |
| 51 | + |
| 52 | +[source,sh] |
| 53 | +---- |
| 54 | +just sync-aggregator # DRY-RUN: show pointers that would bump |
| 55 | +just sync-aggregator --commit # record the bump |
| 56 | +just sync-aggregator --push # record + trigger Pages deploy + mirror |
| 57 | +---- |
| 58 | + |
| 59 | +Submodules are updated one at a time (a single `git submodule update |
| 60 | +--recursive` aborts on the URL-less `.git-private-farm` entry — see |
| 61 | +`scripts/gitlink-drift.jl`). Run after `thread land`, or on a schedule, so the |
| 62 | +artifact never drifts. |
| 63 | + |
| 64 | +== Drift alarm |
| 65 | + |
| 66 | +[source,sh] |
| 67 | +---- |
| 68 | +just aggregator-drift # classify gitlink drift across the estate (A2ML) |
| 69 | +---- |
| 70 | + |
| 71 | +== Warned submodules after a sync |
| 72 | + |
| 73 | +`sync-aggregator` leaves un-fetchable submodules as `warn ... (left as-is)` |
| 74 | +rather than aborting. `scripts/fix-stale-submodule-urls.sh` classifies them |
| 75 | +into four classes and remediates only on explicit, separately-gated flags: |
| 76 | + |
| 77 | +[cols="1,3,2",options="header"] |
| 78 | +|=== |
| 79 | +| Class | Cause | Remediation |
| 80 | +| `RENAMED` | Repo renamed; `.gitmodules` URL stale (API redirect resolves elsewhere). | `--apply-renames` rewrites the URL. |
| 81 | +| `NONEXISTENT` | `.gitmodules` over-declares a repo that was never created (API 404). URL is already basename-correct, so a rewrite cannot help. | `--prune-nonexistent` removes the declaration (*destructive*). |
| 82 | +| `WIKI` | `.wikis/<repo>.wiki` entry with no enabled wiki — not tracked content. | `--prune-nonexistent` (labelled `WIKI`). |
| 83 | +| `TRANSIENT` | Repo exists and URL is canonical — a fetch blip. | Re-run `just sync-aggregator`. |
| 84 | +|=== |
| 85 | + |
| 86 | +[source,sh] |
| 87 | +---- |
| 88 | +sh scripts/fix-stale-submodule-urls.sh # classify (dry-run) |
| 89 | +sh scripts/fix-stale-submodule-urls.sh --apply-renames # safe: URL rewrites |
| 90 | +sh scripts/fix-stale-submodule-urls.sh --prune-nonexistent # destructive: prune |
| 91 | +---- |
| 92 | + |
| 93 | +It refuses to run while `sync-aggregator` holds the aggregator git lock, and |
| 94 | +never commits/pushes — re-run `just sync-aggregator --push` afterwards. |
| 95 | + |
| 96 | +== Migration status |
| 97 | + |
| 98 | +. [x] Rule declared (this document). |
| 99 | +. [ ] One-shot pointer reconcile: `just sync-aggregator --push` (fixes every |
| 100 | + stale/empty gitlink — incl. `echo-types` — in one commit). *Run deliberately; |
| 101 | + it fetches ~300 repos.* |
| 102 | +. [x] `repos.toml` generated from `.gitmodules` (297 repos). |
| 103 | +. [x] `repos.groups.toml` stub + `thread` / `sync-aggregator` / |
| 104 | + `aggregator-drift` recipes. |
| 105 | +. [ ] Schedule `sync-aggregator --push` (cron/CI) so the artifact self-heals. |
| 106 | +. [ ] Optional: have `reposystem scan` assert manifest⇔clone parity. |
0 commit comments