11---
2- status : planned
2+ status : done
33depends : [gitsheets-scripts, gitsheets-2.9]
44specs :
55 - specs/behaviors/storage.md
66upstream-specs :
77 - gitsheets:specs/api/repository.md
88 - gitsheets:specs/api/transaction.md
9+ pr :
910---
1011
1112# Plan: retire the scripts' git workarounds on gitsheets 2.9
@@ -79,18 +80,18 @@ One commit per script.
7980
8081## Validation
8182
82- - [ ] prune-spam reads machine + human verdicts through ref-pinned sheets;
83+ - [x ] prune-spam reads machine + human verdicts through ref-pinned sheets;
8384 no ` transact ` is used for reads
84- - [ ] prune-spam on a fresh clone with only ` origin/<branch> ` commits the
85+ - [x ] prune-spam on a fresh clone with only ` origin/<branch> ` commits the
8586 prune onto a newly created local branch, with no ` update-ref ` (test)
86- - [ ] importer reads existing ids through a pinned store, and creates
87+ - [x ] importer reads existing ids through a pinned store, and creates
8788 ` legacy-import ` through ` transact ` on first run (existing tests)
88- - [ ] scrub-data writes configs and contracts with ` tx.writeFile ` ; the
89+ - [x ] scrub-data writes configs and contracts with ` tx.writeFile ` ; the
8990 snapshot is a parentless commit holding configs + contracts +
9091 records; a verification failure leaves no commit and no ref (tests)
91- - [ ] Every remaining raw ` git ` call in ` apps/api/scripts ` is listed in
92+ - [x ] Every remaining raw ` git ` call in ` apps/api/scripts ` is listed in
9293 Notes with its reason, and commented in code
93- - [ ] ` type-check ` + ` lint ` + full test suite green
94+ - [x ] ` type-check ` + ` lint ` + full test suite green
9495
9596## Risks / unknowns
9697
@@ -101,4 +102,75 @@ One commit per script.
101102
102103## Notes
103104
105+ - ** scrub-data couldn't go to one transaction.** The Approach planned a
106+ single ` transact({ parent: null, branch }) ` that writes the configs with
107+ ` tx.writeFile ` and then upserts records. gitsheets 2.9 can't do that: a
108+ transaction's ` tx.sheet() ` loads its config from the transaction's
109+ parent commit, and from ` HEAD ` for an orphan (` #configTreeRef ` in
110+ ` sheet.js ` ). It never reads files staged with ` tx.writeFile ` in the same
111+ transaction. Every upsert failed with ` config_missing ` .
112+ - What shipped: ` writeConfigRootCommit ` is now one detached orphan
113+ ` transact({ parent: null }) ` that writes each ` .gitsheets/ ` file with
114+ ` tx.writeFile ` . The hash-object, temp index, write-tree and commit-tree
115+ plumbing is gone.
116+ - Records stage in a transaction on that hash, as before. The staged tree
117+ is still re-committed as the parentless snapshot with raw
118+ ` commit-tree ` + ` update-ref ` .
119+ - Using the ` HEAD ` fallback was rejected. It would read the target's
120+ previous snapshot configs, or need HEAD detached mid-run.
121+ - ** "No commit" on a failed scrub** means no referenced commit. The detached
122+ config-root and staging commits are left as unreferenced objects, as they
123+ were before.
124+ - ** Branch creation.** ` transact({ parent, branch }) ` creates the branch only
125+ when it commits. A no-op transaction leaves a missing branch missing
126+ (probed against 2.9). So a dry-run or no-change prune on a fresh clone no
127+ longer creates the local branch. The importer's first run always commits.
128+ - ** Pinned reads.** A missing ref raises ` RefError(ref_not_found) ` ;
129+ prune-spam rethrows its old ` ref '<ref>' not found in <repo> ` message
130+ (test). Pinned sheets resolve ` HEAD ` (via ` rev-parse ` ), so
131+ ` --evaluations-ref=HEAD ` keeps working. The importer now reads ids at the
132+ commit it parents on, which on first run is ` origin/<branch> ` or
133+ ` initialParent ` (test).
134+ - ** Raw ` git ` left in ` apps/api/scripts ` :**
135+ - ` scrub-data.ts `
136+ - ` init ` , ` config ` , ` rev-parse --git-dir ` : init the target. gitsheets
137+ has no init.
138+ - ` rev-parse --absolute-git-dir ` / ` --is-bare-repository ` : locate the
139+ target's git dir and detect a working tree.
140+ - ` ls-tree -r --name-only <ref> .gitsheets/ ` : list config and contract
141+ files. gitsheets reads a blob by path but has no subtree listing.
142+ - ` rev-parse HEAD^{tree} ` : the no-change check. gitsheets doesn't expose
143+ a ref's tree.
144+ - ` commit-tree ` : re-commit the staged tree as an orphan (see above).
145+ - ` update-ref ` : point the snapshot branch at that commit. gitsheets
146+ can't point a branch at an existing commit, and same-seed re-runs
147+ overwrite.
148+ - ` symbolic-ref HEAD ` : the snapshot workflow pushes HEAD's branch.
149+ gitsheets never moves HEAD.
150+ - ` tag -f ` : gitsheets has no tag API.
151+ - ` reset --hard ` : sync a non-bare target's working tree. gitsheets is
152+ bare-style.
153+ - ` check-sheet-configs.ts ` : ` init --bare ` , ` fetch --depth=1 ` , ` ls-tree ` ,
154+ ` show ` , run against a throwaway clone of a remote ref. gitsheets has no
155+ fetch.
156+ - ` backfill-laddr-events.ts ` , ` backfill-meetup-hack-nights.ts ` : one
157+ create-only ` update-ref ` each, plus the same no-op ` transact ` read
158+ pattern. Outside this plan's three scripts and untested. See
159+ Follow-ups.
160+ - ` prune-spam.ts ` and ` import-laddr/importer.ts ` have no raw git left.
161+
104162## Follow-ups
163+
164+ - Tracked as: gitsheets gap. ` tx.sheet() ` ignores configs staged with
165+ ` tx.writeFile ` in the same transaction, and an orphan transaction's
166+ sheets read configs from ` HEAD ` . Raise it upstream. When it's fixed,
167+ scrub-data's config root, staging transaction and ` commit-tree ` +
168+ ` update-ref ` collapse into one ` transact({ parent: null, branch }) `
169+ (with a detached fallback for a same-seed re-run).
170+ - Tracked as: ` backfill-laddr-events.ts ` and
171+ ` backfill-meetup-hack-nights.ts ` still use the no-op-transact read and
172+ the create-only ` update-ref ` . Swap them to ` openStore(repo, { ref }) ` and
173+ ` transact({ parent, branch }) ` if they're run again.
174+ - Tracked as: the open ` gitsheets-scripts ` follow-ups (old-vs-new prune on
175+ real data, scrub-data real-data blockers, credentials-importer ` --ref ` )
176+ are unchanged.
0 commit comments