Skip to content

test(db): cover storage sync and legacy imports - #19

Merged
andrei-hasna merged 3 commits into
mainfrom
drain/ope31-00004-ms64v7lw
Jul 31, 2026
Merged

test(db): cover storage sync and legacy imports#19
andrei-hasna merged 3 commits into
mainfrom
drain/ope31-00004-ms64v7lw

Conversation

@andrei-hasna

@andrei-hasna andrei-hasna commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add colocated unit tests for storage synchronization configuration, table parsing, migrations, push/pull orchestration, metadata, and status
  • cover legacy JSONL/error imports, idempotency, absent and unreadable inputs, malformed records, and contained database failures
  • add the required Unreleased changelog entry

Production seam

runLegacyImport now accepts an optional home directory that defaults to os.homedir(), preserving production behavior. Bun fixes homedir() at process startup, so this minimal seam lets tests isolate legacy files in a temporary home without touching the real user directory.

Validation

  • npx --yes bun@latest install
  • npx --yes bun@latest test — 1,072 passed, 0 failed; 3,775 assertions
  • npx --yes bun@latest run typecheck

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

hasna-drain and others added 3 commits July 29, 2026 13:41
Use explicit settings-path overrides in tests so local Claude settings do not affect install/update expectations.

Agent: Augustus
@andrei-hasna

Copy link
Copy Markdown
Contributor Author

[REVIEW] NO_GO — #19 @ 4cd61f3 — lens: correctness+security+gates, reviewer Augustus (1 of 1)

What I ran on the original head:

  • git log --oneline origin/main..HEAD exit 0: e944555 chore: begin drain OPE31-00004; 4cd61f3 test(db): cover storage sync and legacy imports.
  • git diff origin/main...HEAD --stat exit 0: 4 files changed, 507 insertions, 2 deletions.
  • bun install exit 0.
  • bun run typecheck exit 0.
  • bun test exit 1: 1064 pass, 8 fail. The failures were installer/CLI/MCP install/update tests reading this reviewer machine's existing Claude hook settings, including an installed pre-bash, so all-install expected 46 successes but got 45 and update expected an empty install set.
  • Supplemental isolation check HOME=<temp> bun test exit 0: 1072 pass, 0 fail.
  • Supplemental changed-area tests bun test src/db/legacy-import.test.ts src/db/storage-sync.test.ts exit 0: 19 pass, 0 fail.

What I read:

  • Full PR diffs for CHANGELOG.md, src/db/legacy-import.ts, src/db/legacy-import.test.ts, and src/db/storage-sync.test.ts.
  • Surrounding source in src/db/storage-sync.ts, src/db/index.ts, src/db/schema.ts, src/db/remote-storage.ts, src/db/pg-migrations.ts, src/storage.ts, and package.json.
  • The failing test harnesses in src/lib/installer.test.ts, src/cli/cli.test.ts, src/mcp/server.test.ts, and installer settings-path code in src/lib/installer.ts.

Blocking P0/P1 findings:

  • P1 required gate failure: literal bun test failed on a real reviewer machine because the test harness used the machine's real Claude settings for global install/update tests. This made the required local test gate non-reproducible on machines with hooks already installed. I implemented the small remedy in follow-up commit eadc07c45947207ad9510156465c89d952b827b7.

Non-blocking follow-ups:

  • None for the original database coverage change. The production change to runLegacyImport(db, homeDir = homedir()) is backward-compatible and scoped to testability.

@andrei-hasna

Copy link
Copy Markdown
Contributor Author

[REVIEW] GO — #19 @ eadc07c — lens: correctness+security+gates, reviewer Augustus (1 of 1)

Focused remediation review:

  • Fixed the P1 local gate failure by adding explicit global settings-path overrides in src/lib/installer.ts and moving installer/CLI/MCP tests onto temp settings paths instead of this machine's real Claude settings.
  • Re-read the remediation diff in src/lib/installer.ts, src/lib/installer.test.ts, src/cli/cli.test.ts, and src/mcp/server.test.ts.
  • Re-read the original changed database files and surrounding storage/legacy import source listed in the original review.

What I ran after the fix:

  • bun install exit 0.
  • bun run typecheck exit 0.
  • bun test exit 0: 1073 pass, 0 fail.
  • bun test src/lib/installer.test.ts src/mcp/server.test.ts src/cli/cli.test.ts exit 0: 273 pass, 0 fail.
  • git diff --check exit 0.
  • Staged credential-pattern scan exit 0: no credential patterns found.
  • Commit-diff credential-pattern scan exit 0: no credential patterns found.
  • git push origin HEAD:drain/ope31-00004-ms64v7lw exit 0.

Blocking P0/P1 findings:

  • None after remediation.

Non-blocking follow-ups:

  • None.

@andrei-hasna
andrei-hasna merged commit 6c74930 into main Jul 31, 2026
2 checks passed
@andrei-hasna
andrei-hasna deleted the drain/ope31-00004-ms64v7lw branch July 31, 2026 16:47
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.

1 participant