boot: reconcile fast-forward does not re-open the store snapshot, so in-memory state is built from the pre-reconcile tree
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- git, typescript
Research direction
Start with buildApp's store → reconcile → services registration and compare it with reloadInMemoryStateAndFts. Read apps/api/tests/internal-reload.test.ts, especially the re-import test and its pre-boot fetch workaround. Done means a reused clone produces in-memory state and FTS containing records introduced by the reconcile before services initialize.
Written by the indexing model from the issue text.
Description
What
buildApp registers the plugins in this order: store (opens the gitsheets public store; each Sheet caches a dataTree snapshot at open time) → reconcile (fetch + fast-forward/rebase against origin/<CFP_DATA_BRANCH>) → services (builds InMemoryState + FTS from fastify.store.public).
When the local bare clone is behind origin at boot, reconcile fast-forwards the branch, but nothing calls Store.swapPublic afterwards. services then builds the in-memory state from the Sheet snapshots captured before the fast-forward. Records that arrived in the fast-forward are invisible until the next hot-reload webhook or a restart.
The hot-reload path (reloadInMemoryStateAndFts) already handles this correctly by re-opening the public store after reconcile. The boot path skips that step.
Why it hasn't bitten
Production pods bare-clone the data repo on every boot (emptyDir volume), so the clone is in sync with origin by the time reconcile runs and the outcome is in-sync. The gap only shows when a clone is reused across boots: local dev, and tests that seed the remote after creating the rig (see the re-import test in apps/api/tests/internal-reload.test.ts, which works around it with an explicit git fetch origin main:main before boot).
Fix sketch
In the reconcile plugin (or a small step between it and services), when the outcome is anything other than in-sync/fetch-failed, re-open the public store and fastify.store.swapPublic(freshPublic) before services reads it. Or reorder so the store opens after reconcile; reconcile only needs the repo path and the lock, not the Sheet handles.
Found while working on the hot-reload stale-indices fix (fix/hot-reload-stale-indices); out of scope there.
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 1
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CodeForPhilly/codeforphilly-ng
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
MarkdownEditor toolbar: use Radix Toolbar from radix-ui instead of the hand-rolled roving tabindex Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
All issues in CodeForPhilly/codeforphilly-ng
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug v2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/inspector#2458 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
carbon-design-system/ibm-products#9907 ·