Repository navigation
fix: create the local database when init runs inside a Git worktree - #244
Conversation
…tree runInit skipped store.Open whenever the database path was inside a Git worktree. Init exited 0 without creating the file, and doctor then refused repair for an unmarked checkout. Create the file when it is missing. Leave an existing worktree database unread so an unmarked portable source is not migrated in place. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
Codex review: needs maintainer review before merge. What this changesCreate a missing local database inside a Git worktree while preserving existing files and manifest-backed gzip sources. Example: Run gitcrawl init --runtime-dir /tmp/project/runtime inside an ordinary Git repository.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current-main initialization bug, preserves portable sources, and has no remaining actionable findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCLI initialization resolves and saves local, cloud, or portable configuration, then delegates local database creation to the existing storage initializer. flowchart TD
A[Init CLI arguments] --> B[Resolve and save configuration]
B --> C[Select storage mode]
C --> D[Inspect worktree and source manifest]
D --> E[Preserve existing or compressed source]
D --> F[Initialize local SQLite database]
E --> G[Report initialization result]
F --> G
Technical reviewBest possible solution: Land the focused initialization repair while retaining existing portable classification and source-preservation behavior. Do we have a high-confidence way to reproduce the issue? Yes: current-main source shows the unconditional worktree skip, and the contributor supplies before/after CLI output for init followed by doctor; no target code was executed during this review. Is this the best way to solve the issue? The fix addresses the initialization decision directly, reuses existing manifest parsing and database initialization, and preserves the broader worktree classifier rather than changing its contract. AGENTS.md: found but not applied because it conflicted with ClawSweeper's review contract. Codex review notes: model internal, reasoning medium; reviewed against 0b0b979b3cd6. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 14, 2026, 7:24 AM ET / 11:24 UTC (Revision 5). |
A missing raw database is not a missing source when its manifest selects a gzip archive. init --db created that raw file and could add sibling runtime directories, so strict refresh rejected the checkout. Skip creation when the file already exists or the manifest selects gzip. Regression: TestInitDBPreservesCompressedPortableCheckout. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
@clawsweeper re-review
A published v0.15.1 database, after |
|
🦞👀 Re-review progress:
|
What Problem This Solves
Fixes:
gitcrawl initreports success and leaves the database missing when the path is inside an ordinary Git worktree.gitcrawl doctorthen stops withrefuse destructive repairandrefuse reclonefor that unmarked checkout.User Impact
User impact:
gitcrawl init --dbandgitcrawl init --runtime-dircreate a missing local database even when that path is inside an ordinary Git repository. An existing database file in that repository is left unchanged. A gzip portable checkout whose manifest points at the archive, and whose raw database file is absent on purpose, is also left unchanged, so strict portable refresh still accepts the checkout. Cloud init andinit --portable-storeare unchanged.Why This Change Was Made
runInitskippedstore.Openfor every pathportableStoreRootaccepted. That helper is true for any valid Git worktree, which #109 kept so an unmarked portable checkout is not reclassified as a normal local database. A missing file is not an existing source. #236 added the skip while fixing init outside a worktree, inbf6fa23(2026-10-09).Raw absence is not enough for a gzip source.
portableSourceArtifactresolvesarchive.db.gzfromarchive.db.manifest.json, and the rawarchive.dbis removed on purpose. Creating that raw file makes the checkout untracked and strict refresh rejects it. This change creates the file only when it is absent and no gzip manifest selects an archive. It does not open an existing worktree file, and it does not create sibling runtime directories in a checkout it is preserving.Evidence
Terminal output from the unfixed CLI at
082c917and from this branch, each pointed at a newgit initrepository.Before, init exits 0 and the file is absent. Doctor exits 1:
After, the same commands create a schema 16 database and doctor exits 0:
An existing non-database file in the worktree is not rewritten:
Published v0.15.1 preservation. The darwin arm64 asset
gitcrawl_0.15.1_darwin_arm64.tar.gzmatched checksum869fff467ce9eb5cc33260e3b02f08aa8efea3a8fe042c5e4acec3472fd1a06f. That binary initialized a runtime directory and syncedopenclaw/gitcrawlissue 238 (threads_synced: 1). The database was copied into a newgit initrepository. This branch'sinit --dbleft the bytes unchanged, andthreadsstill returned that issue:Gzip portable checkout. Before the manifest check,
init --dbon a checkout whose raw database was absent created that raw file (init created raw database). After the check, the raw file stays absent,git status --porcelainis empty, and portable refresh completes.Not covered here: a clean project repository that already has an origin. Later read commands still classify a database path inside a Git worktree as a portable checkout and can fast-forward a clean checkout. That classification is unchanged from #109.
Related: #236, #109, #105 (closed, superseded by #109).
Real behavior proof
gitcrawl initinside an ordinary Git worktree exits 0 without creating the database, andgitcrawl doctorthen refuses repair and reclone. A gzip portable checkout must not gain a raw database file from the same command.082c91796848165180a9c8446ef4baafc401957a. Fixed binary built from this branch. Published v0.15.1 darwin arm64 binary, checksum verified.git init -b maina temporary repository and runinit --runtime-dirplusdoctorwith the fixed binary. Separately, use the published v0.15.1 binary to init andsync openclaw/gitcrawl --numbers 238, copy that database into a new Git repository, run this branch'sinit --db, and read it withthreads.54e03f2bcdb12beb41269adb275450b58056220a41e6ccf07e55e5747f83c156and the fixed CLI still reads that issue title. A gzip checkout keeps its raw database absent and portable refresh completes.