Skip to content

feat(dash): remove the history import - #736

Merged
vz-ibm merged 1 commit into
mainfrom
feat/remove-history-import
Oct 28, 2026
Merged

vz-ibm merged 1 commit into
mainfrom
feat/remove-history-import

Conversation

@vz-ibm

@vz-ibm vz-ibm commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Data dependence: Context Guru stores less. The dashboard no longer copies rows from Claude Code's session files on the user's disk, and old imported rows are deleted when the database opens. No row in docs/data-dependence.md changes its Kind or a level: the import was never listed there. The Dashboard database row now states what it still reads from disk (the working folder, for the project picker; skill descriptions), and that it stores neither.

Summary

This PR removes the history import (import-history), which copied Claude Code's old session transcripts into the dashboard database. With the History tab gone (#731), nothing used that data in a way that helps the user.

What we found

Every remaining reader of imported rows was only a workaround for the import itself:

Reader What it did Needed without the import?
Cleanup "Nothing measured for this selection" Explained that a project was imported No. The case cannot happen.
Cleanup picker (measured=1) Hid imported-only projects No. It only filtered the import out.
Call counts Would count use from before install Never worked. scopedUses keeps only sessions with tools > 0, and every imported session has tools = 0.

The import also cost something:

  • It ran on every install.
  • It mixed transcript spend into the Overview and Requests totals.
  • It never expired: the retention prune skipped imported rows on purpose.

What changed

Removed:

  • The importer (importhistory.go), its command (importhistorycmd.go, cmd/cg-import-history), and the imported-invocation folder repair (backfilluseproject.go).
  • install.sh's route_import_history step, the install skill's history_import= bullet, and the line cap that was raised for it (242 → 238).
  • Cleanup's workarounds: the empty state, the insights Coverage field, CoverageFor, and the measured=1 filter (Filter.Source, Filter.SourceMeasured).
  • The retention prune's exception for imported rows.
  • TranscriptFiles, whose only callers were the importer and the backfill. projectgroups.go keeps its own symlink guard.

Kept:

  • context-guru-proxy import-history as a no-op that exits 0. An older install.sh still runs it during a plugin and proxy version mismatch. Without the name, it would fall through to the proxy's flag parsing and start serving, which hangs the install.
  • The transcript reader (ReadTranscript), which projectgroups.go uses for the project picker.
  • cg-backfill-project. It fills the project of measured rows and never reads imported ones.
  • The requests.source column. Old databases have it.
  • The empty-timeline crash guards (renamed emptytimeline_test.go, re-seeded without an import), and the tool_uses.project migration tests (seeded through the table's real key, so a collapse would still show).

Added: delete old imported rows, once.

  • purgeImportedHistory runs after additiveDDL2 on both open paths, so trg_tool_inventory_gc exists and clears an imported-only session's declarations and uses. request_components cascades.
  • It never fails Open. An error is logged and retried on the next open, because a failed Open would send the recorder to an in-memory dashboard. The marker is INSERT OR IGNORE, so two processes that open one old database do not collide.
  • It runs once, recorded in meta. As a plain statement it would scan requests on every open (about 60 ms on 500,000 rows; there is no index on source).
  • Limit: a session that began before the proxy and continued through it keeps the import's calls. They were merged into the same tool_uses rows as measured calls (MAX(calls, …)), with no marker, so they cannot be told apart. They can only make a tool look more used, never cause bad removal advice.

How it was tested

Test first. Each of these failed before the change, for the intended reason:

  • TestOpeningADatabaseDeletesImportedRows, TestDeletingImportedRowsIsIdempotent: imported rows survived. Both also fail if the purge deletes nothing.
  • TestThePurgeRunsOnlyOnce: proves a later open skips the scan.
  • TestImportHistoryIsANoOpThatExits: the command imported rows.

Suites (after rebasing onto main with #728 and #733):

  • go build ./..., go vet ./... and make lint: clean.
  • go test ./dash/... ./proxy/... ./cmd/... ./components/...: all pass except two that also fail on clean main on this Mac: TestCalculatorPricesFromTheRowsModelNotABlend (passes on Linux) and TestALateFirstByteOnTheRealTransportNeverReachesTheClient (a 5 ms timing test, flaky on main).
  • go test -timeout 20m ./context-guru-plugin/ (the whole package, with ANTHROPIC_DEFAULT_*_MODEL unset): only the 10 host-dependent install and setup tests that also fail on main on this Mac.

Live, on a copy of a real old database (v0.4.2, opened by this build):

Table Before After
requests 9,410 4,031 (−5,379, exactly the imported rows)
measured requests 4,031 4,031 (none lost)
tool_uses 144 41
tool_declarations 56,318 56,239
request_components 36,072 36,072

The run-once marker is set. There were no errors.

Data dependence

  • Metadata only / Content: it keeps less of both. It no longer writes transcript-derived request rows or invocations, and it deletes those already written.

What it does at each level (see docs/data-dependence.md):

  • Off: no change. No dashboard, no import.
  • Metadata only: works. Only rows the proxy measured.
  • Everything: works. Only rows the proxy measured.

Decided by: the user, in the session that removed the History tab (#731). That decision is now the reason for this change. The import was never a listed row, so there is no row owner to confirm. Please say if you think it should have had one.

Open questions

  1. Left for later, on purpose: Event.Source / sourceOf / SourceImported, and TranscriptTurn.Called / transcriptCalled, are now written and never read. Removing them changes how every request row is written and read, and reshapes ReadTranscript, which projectgroups uses. A small follow-up can drop them.
  2. Release note: an older /context-guru:dashboard probes /api/history (see feat(dash): remove the History tab #731), and an older install.sh runs import-history, which now does nothing. The plugin and proxy update together, so the window is short.

Assisted-By: Claude (Anthropic AI) [email protected]

@vz-ibm vz-ibm left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (claude, user of @vz-ibm) Claude Code 2.1.310 offload-review skill, @vz-ibm's session fresh 2 of 2 1 of 2 2cea2930562b blocking

Verdict: blocking

Findings

  1. docs/data-dependence.md:219 — The new text says the dashboard "reads no file on your disk". That is false.

    • What fails: A user or reviewer reads the data-dependence row and believes the dashboard never reads local files. The dashboard still reads two local trees on every non-hosted install:
      • ~/.claude/projects/*/*.jsonl (Claude Code session transcripts). API.projectGroups() → CachedProjectGroups(a.diskHome()) → ProjectGroups → readCwdCounts reads each transcript (dash/api.go:684, dash/projectgroups.go:62-72, :164). The project facet (dash/query.go:1732) and ExpandProjectFilter (dash/api.go:674) use the result.
      • ~/.claude/plugins (SKILL.md files). skillDescriptions (dash/insightsapi.go:133-141) reads it.
    • Proof: diskHome() returns noHome only when a.auth != nil (dash/api.go:692-697). A local proxy has no auth, so it reads both trees. cg-backfill-project also reads the transcripts (dash/backfillproject.go:110).
    • Fix: State it correctly. For example: "Every request row comes from traffic the proxy saw itself. To group folders into projects, the local dashboard reads the working folder recorded in Claude Code's session files. It stores none of their text." This doc is the data-dependence record that CLAUDE.md requires, so it must be exact.
  2. dash/schema.go:799-817, 932, 940 — When the one-time purge fails, Open fails. The proxy then runs with an in-memory dashboard. This is not fail-open for an optional cleanup.

    • What fails: migrate returns any error from purgeImportedHistory. openDSN closes the DB (dash/store.go:280-283). NewRecorder then falls back to Open(":memory:") (dash/capture.go:223-227). The dashboard comes up empty, and the proxy records nothing to disk for that run. The comment at dash/schema.go:880-883 names this exact symptom as a past real incident.
    • One concrete trigger: two processes open the same old database at the same time. Examples are a proxy restart that overlaps the old process, or cg-backfill-project beside a starting proxy. Trace:
      1. Both read meta and get sql.ErrNoRows (:801). This read is outside the transaction.
      2. Process A deletes, inserts the marker, and commits.
      3. Process B's DELETE waits on busy_timeout, then runs and deletes 0 rows.
      4. Process B's plain INSERT INTO meta(...) (:814) fails with UNIQUE constraint failed: meta.key, and B's Open fails.
    • Other triggers: SQLITE_BUSY past 5 s, because a long trigger-driven delete holds the write lock, or a disk-full error during the delete.
    • Proof: read of the lines above. Not run, because live tests are not approved.
    • Fix:
      • Use INSERT OR IGNORE for the marker. This removes the race.
      • Make a purge error non-fatal in migrate: log it with slog.Warn and continue. The next open retries, because no marker is written.
      • Add a test that gives the purge a failure and checks that Open still returns a file-backed DB.

Non-blocking

  • The "Kept" reason for the transcript reader is wrong, and the change leaves dead code. The PR body and the new header at dash/transcript.go:13-15 say projectgroups.go uses ReadTranscript. It does not. projectgroups.go has its own readCwdCounts and uses only the constant transcriptMaxLine from transcript.go (dash/projectgroups.go:162-174). After this PR, ReadTranscript, ReadTranscriptChecked, TranscriptTurn, transcriptEntry, transcriptCalled and containsStr have no non-test caller (I grepped the whole repo). Either remove them with their tests, or keep them and correct the header. ReadTranscriptChecked's comment (:96-98) also still says "lets the importer say…".
  • A comment is now in the wrong place. The purgeImportedHistory doc was put inside the migrateToolUsesProject doc block (dash/schema.go:776-797). There is no blank line between them. As a result, godoc attaches the whole block, starting with "migrateToolUsesProject adds…", to purgeImportedHistory. migrateToolUsesProject is left with only "Idempotent: …". Move the new comment so it sits directly above func purgeImportedHistory, after migrateToolUsesProject's complete doc.
  • Some comments still describe the import as current.
    • dash/schema.go:785-787: "the thousands of invocations imported from the user's own history -- which is the data this whole surface exists to show".
    • dash/event.go:205-213, the Event.Source doc.
    • dash/redact.go:86-93: sourceOf says "a report decides whether it may show a waste verdict by asking whether the window contains imported rows". No report does this now.
  • The version-mismatch case gives misleading output. An older install.sh runs import-history -apply, gets exit 0, writes its marker, and emits history_import=done with the summary "import-history was removed; it does nothing now". The older install skill then tells the user that the history "was imported once". This happens only during a mismatch, so it is acceptable. You could mention it in the PR body.
  • TestImportHistoryIsANoOpThatExits (cmd/context-guru-proxy/importhistory_test.go:34): the condition strings.Contains(out,"imported") && strings.Contains(out,"APPLIED") is weak. The !strings.Contains(out, "removed") and no-DB-file checks do the real work. That is acceptable.

What I checked

  • I read the full diff (33 files, +268/−2656) and the PR body, with the code around each change. I did this before I read any other review or comment.
  • tenant_spend: I checked that the purge does not need to adjust it. importedEvent (old dash/importhistory.go:321-339) never called Price, so CostUSD and CGLLMCostUSD were 0, and insertBatch added 0 to the rollup (dash/store.go:583).
  • trg_tool_inventory_gc (dash/schema.go:651-659):
    • It removes tool_declarations and tool_uses only for sessions with no requests left.
    • A mixed session keeps its measured rows and the merged MAX(calls, …) counts. The PR documents this limit.
    • The importer wrote tenant_id '' on both tables, so the trigger's tenant match holds. request_components cascades because foreign_keys(1) is in both DSNs.
  • Purge order: the purge runs after additiveDDL2 on both the at-version path and the fresh path. On the fresh path meta exists, because ddl ran first. The version-mismatch path re-opens a fresh file, and carryNonDerived does not carry requests.
  • Writers of source='imported': only capture.go's recorder calls insertBatch, and no JSON ingest of Event exists. So the run-once marker cannot miss later imported rows.
  • Prune: removing the source = '' exemption is correct now that no imported rows exist.
  • Cleanup UI: without the coverage empty state, an empty timeline is still handled.
    • insChart returns null when buckets is empty (dash/ui/insights.js:1355).
    • insRangeBanner reads buckets[0] only when a range is set.
    • emptytimeline_test.go still guards the null-to-[] marshal.
    • The facets call without measured: 1 matches the removed Filter.SourceMeasured.
  • Leftovers: I grepped the whole repo for import-history, ImportHistory, history_import, cg-import-history, RunImportHistory, CoverageFor, SourceMeasured, measured=1, TranscriptFiles and history-imported. Only the intended no-op and its test remain. The Makefile and the release config do not name cg-import-history.
  • Plugin: I checked the install.sh removal, the SKILL.md bullet removal and the line cap lowered to 238.
  • Rewritten tests: in tooluseproject_test.go, insertUse goes through the real key with calls + 1, so a collapse of two folders would still show.
  • Not run: I ran no Go builds or tests, because live tests are not approved and Go is not installed.

Data dependence: Context Guru stores less. The dashboard no longer copies
request rows from Claude Code's session files on the user's disk; old
imported rows are deleted when the database opens. No row of
docs/data-dependence.md changes Kind or level: the import was never listed
there. The Dashboard database row now states what it still reads from disk
(the working folder, for the project picker; skill descriptions) and that
it stores neither.

With the History tab gone (#731), nothing read imported history for the
user's benefit. Every remaining reader worked around the import itself,
and the one that would have helped (call counts) never worked: scopedUses
drops sessions with tools = 0, which every imported session has. The
import cost install time, mixed transcript spend into the Overview and
Requests totals, and never expired.

Removed:
- The importer (importhistory.go), its command (importhistorycmd.go,
  cmd/cg-import-history) and the imported-invocation folder repair
  (backfilluseproject.go).
- install.sh's route_import_history step, the install skill's
  history_import bullet, and the line cap raised for it (242 -> 238).
- Cleanup's workarounds: the "Nothing measured" empty state, the
  insights Coverage field, CoverageFor, and the measured=1 picker filter
  (Filter.Source, Filter.SourceMeasured).
- The retention prune's exception for imported rows.
- TranscriptFiles, whose only callers were the importer and backfill.

Kept:
- `context-guru-proxy import-history` as a no-op that exits 0: an older
  install.sh still runs it, and the name must not fall through and start
  serving.
- The transcript reader (projectgroups uses it for the project picker),
  cg-backfill-project (fills the project of measured rows), and the
  requests.source column (old databases have it).
- The empty-timeline crash guards, re-seeded without an import, and the
  tool_uses.project migration tests, seeded through the table's key.

Added:
- purgeImportedHistory: once, recorded in meta, after additiveDDL2 on
  both open paths, so trg_tool_inventory_gc clears an imported-only
  session's declarations and uses. It never fails Open: an error is
  logged and retried on the next open (a failed Open would send the
  recorder to an in-memory dashboard), and the marker is INSERT OR IGNORE
  so two processes opening one old database do not collide. A session that began before the proxy
  keeps the import's calls, which were merged into the same tool_uses
  rows with no marker.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Vitaly Zabershinsky <[email protected]>

Signed-off-by: Vitaly Zabershinsky <[email protected]>
Signed-off-by: Vitaly Zabershinsky <[email protected]>
@vz-ibm
vz-ibm force-pushed the feat/remove-history-import branch from 2cea293 to a10df46 Compare October 28, 2026 07:43
@vz-ibm

vz-ibm commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

Reply to review round 1, and conflicts resolved

Rebased onto main (ccb62c7, 17 new commits). Head is now a10df46. The PR is mergeable again.

Conflicts

There was one real conflict, in skills/install/SKILL.md. main reworded the statusline=on line ("only with --statusline" and "off is the default"), and this PR removes the history_import= bullet. I kept main's new line and dropped the bullet. The skill is 238 lines, at its cap.

Git merged the other 5 overlapping files (plugin_test.go, install.sh, insightsapi.go, store.go, data-dependence.md) by itself. I checked the result:

  • build, vet and lint are clean;
  • no new code on main uses anything this PR removes.

Finding 1 (reviewer 2): "reads no file on your disk" is false

Correct, and fixed. It contradicted this PR's own "Kept" list, which keeps the transcript reader for the project picker. The Dashboard database row now says:

Every request row comes from traffic the proxy saw itself. On a local install the dashboard also reads two things from your disk, and stores neither: the working folder recorded in Claude Code's session files, to group folders into projects for the project picker, and each installed skill's description from its SKILL.md.

The commit message and the PR description are corrected to match.

Finding 2 (reviewer 2): a failed purge fails Open, so the dashboard goes in-memory

Correct, and fixed with both of your suggestions.

  • The marker is INSERT OR IGNORE. Two processes that open the same old database do not collide on meta.key.
  • A purge error never fails Open. warnPurge logs it with slog.Warn, and migrate goes on. No marker is written on failure, so the next open retries.

Tests, both failed first with the exact errors you named:

  • TestThePurgeNeverFailsOpenWhenTheMarkerAlreadyExists: it was UNIQUE constraint failed: meta.key.
  • TestAFailedPurgeStillOpensTheDatabase: a trigger makes the delete fail. Open used to fail, and now it returns the file-backed database, with no marker written.

Checks

  • go build ./..., go vet ./... and make lint: clean.
  • go test ./dash/... ./proxy/... ./cmd/... ./components/...: all pass except 3 tests that also fail on main (ccb62c7) on this Mac:
    • TestCalculatorPricesFromTheRowsModelNotABlend (it passes on Linux).
    • TestTheTimelineBucketsUseAndCarriageByDay and TestTheTimelineNeverInventsResolutionItDoesNotHave. These are new on main. They use time.Now(), and they bucket by local day. This PR does not change insightstimeline.go or toolapi.go (0 diff lines against main). Someone should look at them on main.
  • go test -timeout 20m ./context-guru-plugin/ (the whole package, with ANTHROPIC_DEFAULT_*_MODEL unset): only 8 host-dependent install and setup tests fail, and all 8 also fail on main here. That is down from 10, since main fixed two.

Reviewer 1 posted no verdict in round 1.

This now needs one approving review before it can merge.

@vz-ibm
vz-ibm merged commit e9ae8d9 into main Oct 28, 2026
6 checks passed

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 offload-review skill, @amiddavid's session fresh 2 of 2 2 of 2 a10df46ac987 approve

Verdict: approve

Both round-1 findings are fixed, and the fix is correct. The rebase onto main broke nothing that I can find. No new blocking finding.

Note: the PR shows as merged (merge commit e9ae8d9, 2026-10-28T08:52:11Z), before this round was posted. I reviewed the merged head a10df46a as asked.

Earlier findings

  1. Finding 1 (round 1): "reads no file on your disk" was false — fixed.

    • docs/data-dependence.md:219 now names both disk reads: the working folder from Claude Code's session files, and each skill's SKILL.md description. It says the dashboard stores neither.
    • I checked the claim against the code again. diskHome() (dash/api.go:692) still guards the hosted case, and the text matches what the local install reads. The commit message and the PR description carry the same correction.
  2. Finding 2 (round 1): a failed purge failed Open — fixed, with both suggested changes.

    • The marker is INSERT OR IGNORE (dash/schema.go:831), so two processes that open one old database cannot collide on meta.key.
    • A purge error no longer fails Open. warnPurge (dash/schema.go:813) logs it, and migrate continues on both open paths (dash/schema.go:949, :958). No marker is written on failure, so the next open retries.
    • Two new tests cover it (dash/purgeimported_test.go:124, :142). I read both in full. The second one makes the DELETE fail through a trigger, then checks that Open still returns the file-backed database with no marker. This is the test I asked for.

Non-blocking

Not fixed from round 1, all comment-level. The author's reply covered only the two findings, which was the right order.

  • dash/transcript.go: ReadTranscript, ReadTranscriptChecked, TranscriptTurn, transcriptCalled and containsStr still have no non-test caller. projectgroups.go:162 uses only transcriptMaxLine. The header at dash/transcript.go:13 and the PR's "Kept" list still say projectgroups.go uses the reader.
  • dash/schema.go:786-789: migrateToolUsesProject's doc block is now separated from the purge doc by a blank line (good), but it still sits above purgeImportedHistory, detached from its own function. It also still calls the imported rows "the data this whole surface exists to show", which this PR's purge now deletes.
  • dash/event.go:205-213 and dash/redact.go:86-93 still describe the import as a live distinction.
  • The commit message now carries three Signed-off-by lines for the same person, one a duplicate. Harmless for DCO.

What I checked

  • Last review: round 1, 2cea2930562b5f4a5013a12cf83c88c6b701177d, 2026-10-26T14:58:03Z
  • New commits read: 18 in git log 2cea2930..HEAD. The branch was rebased: my round-1 head is not an ancestor of the new head. 17 commits are main's own (ccb62c7c #757, f136c37a #758, 50af4d3c #756, d6edaad0 #755, f234587e #753, 245982d7 #751, 514b8be4 #747, 387664ea #749, d08eff8b #746, 1bd627d1 #743, 4f9f5d2d #744, 70bd6c88 #741, ab7868aa #742, 161076c6 #740, 3befbfb2 #739, 8ff7f6aa #735, 00cd7fd6 #732). One is the PR's own: a10df46a "feat(dash): remove the history import", the round-1 patch rebased plus the fixes below.
  • Read in full: 1 review (my round 1), 1 comment (the author's reply), 0 inline comments (from the three files). Reviewer 1 posted nothing in round 1.
  • New items since my last review:
    • The author's comment (2026-10-28T07:44:52Z). I checked each claim: the rebase, the SKILL.md conflict resolution, both fixes, and the test list. All check out. I could not re-run their build and tests (live runs not approved, no Go here), so I verified by reading.
    • The patch delta since round 1. git range-diff ad87e369..2cea2930 ccb62c7c..a10df46a shows the whole PR changed in six places only: the commit message, the SKILL.md conflict line, dash/insightsapi.go (main's diskHome change, merged around the PR's Coverage removal), dash/purgeimported_test.go (the two new tests), dash/schema.go (warnPurge, runImportedHistoryPurge, INSERT OR IGNORE, both call sites), and docs/data-dependence.md. Everything else is byte-identical to the patch I read in full in round 1.
    • The rebase merge results in the six overlapping files. I read plugin_test.go (cap 238), install.sh (route_import_history gone, no dangling calls), dash/store.go (prune exemption gone; main's checkpoint change intact), dash/insightsapi.go, docs/data-dependence.md, and SKILL.md (238 lines, main's reworded statusline= line kept, history_import= bullet gone).
  • Leftovers: I grepped the whole tree for every removed name (TranscriptFiles, CoverageFor, SourceMeasured, RunImportHistory, import-history, history_import). Only the intended no-op in cmd/context-guru-proxy/main.go:67, its test, and comments remain.
  • Purge safety, re-checked at the new head: OpenReadOnly does not call migrate, so a read-only handle never runs the purge. The :memory: fallback takes the fresh path, deletes nothing, and writes its marker in memory. A crash between DELETE and COMMIT rolls back with no marker, so the next open retries.
  • I ran no builds or tests. Live tests are not approved, and Go is not installed on this machine.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by offload-review skill, @amiddavid's session Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 offload-review skill, @amiddavid's session fresh 1 of 2 2 of 2 a10df46ac987 approve

Verdict: approve

Earlier findings

  • Reviewer 2, finding 1 (data-dependence "reads no file on your disk" was false): fixed. I verified the new text against the code. CachedProjectGroups(a.diskHome()) reads the working folders from Claude Code's session files (dash/projectgroups.go:164, readCwdCounts). skillDescriptions reads each skill's SKILL.md under ~/.claude/plugins (dash/insightsapi.go:141). diskHome() returns noHome only for a hosted proxy (dash/api.go:692). The doc now says the dashboard reads both and stores neither. That matches the code.
  • Reviewer 2, finding 2 (a failed purge failed Open, so the dashboard went in-memory): fixed, both ways.
    • The marker is INSERT OR IGNORE inside the purge transaction (dash/schema.go:831).
    • warnPurge logs the error and migrate continues (dash/schema.go:813, :949, :958). No marker is written on failure, so the next open retries.
    • Two new tests cover it: TestThePurgeNeverFailsOpenWhenTheMarkerAlreadyExists and TestAFailedPurgeStillOpensTheDatabase (dash/purgeimported_test.go). The second one makes the delete fail with a trigger and checks Open still returns the file-backed database.
    • I checked the stakes myself: NewRecorder falls back to Open(":memory:") (dash/capture.go:227), so a failed Open really would lose all disk recording.
  • Reviewer 2, non-blocking items: partly rejected, partly not fixed. See Non-blocking below. The author deferred the dead code and the stale comments to a follow-up, on purpose (PR body, Open question 1). I accept the deferral for Event.Source / sourceOf / TranscriptTurn.Called: removing them changes how every row is written and read. I do not accept the stated reason for keeping ReadTranscript — see Non-blocking 1.

Findings

None. I found no wrong behavior, no data loss, no broken fail-open path, and no missing test for the new behavior.

Non-blocking

  1. The PR body's "Kept" reason for ReadTranscript is false, and round 1 already said so. The PR body says: "The transcript reader (ReadTranscript), which projectgroups.go uses for the project picker." It does not. projectgroups.go has its own reader, readCwdCounts, and shares only the constant transcriptMaxLine (dash/projectgroups.go:162-174). ReadTranscript and ReadTranscriptChecked now have no production caller; only tests use them. The new header at dash/transcript.go:10-12 also says the project picker is this file's "one use", which a reader will take the same way. Fix the PR body and the header: say the reader is unused and left for the follow-up. Reviewer 2 raised this in round 1; the body was edited after that and the claim stayed.
  2. The purgeImportedHistory doc sits inside migrateToolUsesProject's doc block (dash/schema.go:778-799). There is no blank line between them, so godoc attaches both blocks to purgeImportedHistory, and migrateToolUsesProject keeps only "Idempotent: …" (dash/schema.go:837). Reviewer 2 raised this in round 1; not fixed. Move the new comment below migrateToolUsesProject's complete doc. The sentence at :788-789 ("the data this whole surface exists to show") also still describes the import as current data.
  3. Stale comments that present the import as current: dash/event.go:205-215 (Event.Source doc) and dash/redact.go:88-93 (sourceOf says a report asks whether the window holds imported rows; no report does now). Deferred on purpose in the PR body. Acceptable for this PR; the follow-up should take them.
  4. An old install.sh during a version mismatch gets a misleading "done". The no-op prints "import-history was removed; it does nothing now" and exits 0. The old script writes its marker and reports history_import=done, and the old skill then says the history "was imported once". This only happens in the short mismatch window. The PR body names the no-op but not this summary text. Consider one sentence in the PR body.

What I checked

  • Last review: none. No review on the PR starts with <!-- offload-review reviewer=1 . The lookup command returned empty output. I posted no round-1 verdict; the author's comment says the same. So I reviewed the whole PR as if it were a first review.
  • New commits read: 1. The PR is one commit after the rebase: a10df46a "feat(dash): remove the history import", base ccb62c7c. Reviewer 2 reviewed 2cea2930562b before the rebase; that commit is gone from the branch history.
  • Read in full: 1 review (reviewer 2, round 1), 1 issue comment (the author's reply and rebase note, 2026-10-28), 0 inline comments. Files: .review-in-reviews.txt, .review-in-comments.txt, .review-in-inline.txt.
  • New items since my last review: all of them, since I have no last review. What I did about each:
    • Reviewer 2's two findings: re-verified the fixes in the code, not only the author's reply. Details under "Earlier findings".
    • The rebase onto main (ccb62c7c, 17 commits): I reviewed the final diff against that base, which contains the merged conflict results. I grepped the repo for every removed name (RunImportHistory, ImportHistory, BackfillUseProjects, importedUse, insertImportedUses, TranscriptFiles, CoverageFor, SourceMeasured, InsightsCoverage, measured=1, cg-import-history, history_import). Only the intended no-op, its test, and the deferred SourceImported constant remain.
    • The author's test claims: not run. Live tests are not approved and Go is not installed on this machine. I read the new tests instead: purgeimported_test.go (5 tests), sourcecolumn_test.go, emptytimeline_test.go, importhistory_test.go, and the rewritten tooluseproject_test.go seeding through the table's real key.
    • The two Mac-only test failures the author names: they say these fail on main too and this PR does not touch insightstimeline.go or toolapi.go. I confirmed with git diff ccb62c7c..HEAD --stat: neither file is in the diff. Someone should still look at them on main.
  • The diff: all 33 files, +341/−2656, read in full, plus the code around each change (schema.go migrate paths, store.go open paths, insights.js render path, projectgroups.go, redact.go, event.go, transcript.go, install.sh, SKILL.md).
  • The purge, on my own trace: marker read outside the transaction, delete and marker in one transaction, busy_timeout(5000) with WAL covers the two-process race, and the fresh and at-version paths in migrate both run it after additiveDDL2, so trg_tool_inventory_gc exists (dash/schema.go:652). tenant_spend needs no adjustment: imported rows never carried a price, so the rollup added 0 for them.
  • The UI after the empty state's removal: insChart returns null on empty buckets (dash/ui/insights.js:1355) and the render skips a null chart; insRangeBanner reads buckets[0] only when a range is set, and a range cannot be set without a chart. emptytimeline_test.go still guards the null-to-[] marshal through the real endpoint.
  • The no-op command: fmt is already imported in cmd/context-guru-proxy/main.go, the dispatch happens before flag parsing, so -db is ignored and no database is created. The test checks exactly that.
  • The install skill is 238 lines, at its cap (plugin_test.go lowered 242 → 238).
  • Test helpers orphaned by the deletions: none. writeJSONL, turnLine, msgLine and jsStringLiterals are defined in files that remain; stripComments moved to testhelpers_test.go and still has a user (uicalls_test.go).

amiddavid added a commit that referenced this pull request Oct 28, 2026
chore(plugin): bump the Claude Code plugin for v0.6.3 (0.6.3)

The Claude Code plugin changed since v0.6.2: #736 removed the history
import step from install.sh and the install skill. The Codex plugin did
not change, so it stays at 0.2.7.

Assisted-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants