Skip to content

Commit 2c79750

Browse files
Merge pull request #249 from CodeForPhilly/docs/import-merge-gitsheets
docs(ops): merge the import with gitsheets' sheet-aware merge
2 parents b35dbc5 + 4f1eee5 commit 2c79750

2 files changed

Lines changed: 66 additions & 16 deletions

File tree

‎docs/operations/cutover.md‎

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -174,26 +174,34 @@ those as the order-of-magnitude sanity check for your counts.
174174
not.
175175
4. Run the importer **without `--dry-run`**. This creates one snapshot
176176
commit on `legacy-import`. Push it.
177-
5. **Merge `legacy-import` into `published`.** This needs a working tree
178-
(clone from your bare clone). Expect **thousands of conflicts** of the
179-
form `deleted by us / modified by them`: every previously-pruned spam
180-
person is absent on `published` and present (possibly modified) in the
181-
fresh snapshot. Resolve them all by **taking the import's version** —
182-
the prune step in the next step removes them again:
177+
5. **Merge `legacy-import` into `published`** with gitsheets' sheet-aware
178+
merge (gitsheets ≥ 2.8). It merges *records*, not lines: a person
179+
changed on both sides is field-merged and written canonically, so the
180+
merged branch never mixes serializations. It runs directly against the
181+
bare clone, so no working tree is needed. Expect **thousands of
182+
delete/modify conflicts**: every previously-pruned spam person is absent
183+
on `published` and present in the fresh snapshot. `--prefer theirs`
184+
takes the import's version of each one, and the prune step next removes
185+
them again. Run it from a codeforphilly-ng checkout (the CLI ships with
186+
the `gitsheets` dependency):
183187

184188
```bash
185-
git clone /scratch/codeforphilly-data.git /scratch/codeforphilly-data-wt
186-
cd /scratch/codeforphilly-data-wt
187-
git checkout published
188-
git merge origin/legacy-import || true
189-
git diff --name-only --diff-filter=U | xargs git checkout --theirs --
190-
git add -A people/ # the conflicts are person records
191-
git commit --no-edit
192-
git push origin published:published # back to the bare clone only — don't push to GitHub yet
189+
D=/scratch/codeforphilly-data.git
190+
# Preview: lists every conflict by path and kind, writes nothing
191+
npx gitsheets merge legacy-import --into published --dry-run --git-dir $D
192+
# Merge, taking the import's side of every conflict
193+
npx gitsheets merge legacy-import --into published --prefer theirs --git-dir $D \
194+
--author-name "<you>" --author-email "<you>@users.noreply.codeforphilly.org"
195+
# The merge doesn't validate contracts; check every record before going on
196+
npx gitsheets contracts verify --git-dir $D --ref published
193197
```
194198

195-
Review `git status` before the `git add`; if conflicts show up outside
196-
`people/`, look at them individually rather than bulk-resolving.
199+
Read the preview before merging. `--prefer` resolves record-field,
200+
delete/modify and blob conflicts, but rename/directory conflicts are
201+
always reported and stop the merge: look at those individually. If
202+
conflicts show up outside `people/`, look at them individually rather
203+
than relying on `--prefer`. The merge stays local to the bare clone
204+
(don't push to GitHub yet).
197205

198206
6. **Prune confident-spam** from `published` before it goes anywhere. The
199207
merge re-added the full raw import (spam included); the deployed pod

‎plans/import-merge-gitsheets.md‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
status: done
3+
depends: [gitsheets-2.9]
4+
specs: []
5+
---
6+
7+
# Plan: the import merge uses gitsheets' sheet-aware merge
8+
9+
## Scope
10+
11+
The cutover runbook merged `legacy-import` into `published` with a plain
12+
`git merge`, then bulk-resolved thousands of `deleted by us / modified by
13+
them` conflicts with `git checkout --theirs`. A line-wise merge of TOML
14+
records left records in a mix of serializations no gitsheets version
15+
writes. gitsheets 2.8 shipped a record-level merge (gitsheets#307). This
16+
switches the runbook step to `gitsheets merge --prefer theirs`, which runs
17+
on the bare clone, adds a `--dry-run` preview, and follows with a
18+
`contracts verify`. It's an operator-doc change only; no app code and no
19+
spec behavior changes.
20+
21+
## Implements
22+
23+
- `docs/operations/cutover.md` step 5 (operator runbook; not a spec).
24+
25+
## Validation
26+
27+
- [x] Dry-run merge of `legacy-import` into a copy of `published` runs on
28+
real data (6s; 0 field merges, since 09-08's import is already merged)
29+
- [x] `contracts verify --ref <branch>` works as the runbook uses it
30+
- [x] `--prefer theirs` semantics match the old policy: a delete/modify
31+
conflict takes the import's record (gitsheets specs/behaviors/merge.md)
32+
33+
## Notes
34+
35+
- The merge doesn't validate contracts, so the runbook verifies after it.
36+
Rename/directory conflicts are always reported and stop the merge.
37+
- The first real exercise of `--prefer theirs` on conflicts comes with the
38+
next fresh laddr import; this repo has no import scheduled.
39+
40+
## Follow-ups
41+
42+
None.

0 commit comments

Comments
 (0)