Skip to content

fix(verify): restore reliable local checks - #102

Merged
barad1tos merged 1 commit into
mainfrom
fix/local-verification-compatibility
Sep 28, 2026
Merged

barad1tos merged 1 commit into
mainfrom
fix/local-verification-compatibility

Conversation

@barad1tos

@barad1tos barad1tos commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

── Summary ─────────────────────────────────

SQLite 3.54 can exit after the setup commands when -bail is present, leaving the note change query unexecuted. Two end-to-end verification tests also read the operator's daemon log, which makes the suite depend on host log size. This restores semantic change detection and makes local verification repeatable.

── Changes ─────────────────────────────────

  • Fix: sqlite_token.go:24 — Let the positional query run while retaining read-only access and nonzero exits for SQL errors.
  • Test: sqlite_token_test.go:13 — Reject a database without Bear tables instead of hashing a successful setup command.
  • Test: run_endtoend_test.go:262 — Give the two affected verification scenarios temporary daemon logs.

── Validation ──────────────────────────────

  • go test -p=1 -count=1 -race -coverpkg=./... -coverprofile=/private/tmp/noxctl-compatibility-coverage.out -covermode=atomic ./... — passed; total statement coverage 83.9%.
  • go build ./... and go vet ./... — passed.
  • golangci-lint v2.12.2 run ./... — 0 issues.
  • Pre-commit and commit-message hooks — passed.
  • IDE inspections for all three changed files — 0 warnings or errors.

── Notes ───────────────────────────────────

No live Bear apply was run. The Go 1.27 toolchain update is a separate follow-up.

Summary by Sourcery

Restore reliable local verification by fixing SQLite change detection and isolating verification tests from host daemon logs.

Bug Fixes:

  • Restore reliable SQLite note-change detection by ensuring the query executes while preserving read-only access and SQL error reporting.

Enhancements:

  • Make verification end-to-end tests independent of the host daemon log by using isolated temporary logs.

Tests:

  • Add coverage for rejecting SQLite databases without the expected Bear schema.

- SQLite 3.54 can exit after pre-commands with -bail, hiding note updates and SQL errors
- Let sqlite3 report query failures and cover invalid schemas with a regression test
- Give end-to-end verify tests temporary daemon logs instead of scanning the host log

Impact: note changes stay detectable and verification completes regardless of host log size
@sourcery-ai

sourcery-ai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR restores reliable SQLite-based semantic change detection by allowing the query to execute under read-only mode, adds invalid-schema regression coverage, and makes affected verification tests deterministic by using temporary daemon logs.

Sequence diagram for SQLite note-change token verification

sequenceDiagram
    participant Verify as Verification
    participant Token as SQLiteNoteChangeToken
    participant SQLite as sqlite3
    participant DB as SQLiteDatabase

    Verify->>Token: SQLiteNoteChangeToken(dbPath)
    Token->>SQLite: execute -batch -readonly query
    SQLite->>DB: read Bear schema and note data
    alt valid Bear database
        DB-->>SQLite: semantic note result
        SQLite-->>Token: query output
        Token-->>Verify: change token
    else missing Bear tables
        SQLite-->>Token: SQL error
        Token-->>Verify: nonzero error
    end
Loading

File-Level Changes

Change Details Files
Restore SQLite note-change execution while preserving read-only behavior and SQL failure propagation.
  • Remove the SQLite CLI flag that can terminate after setup commands.
  • Retain batch, read-only, and nonzero SQL-error handling for the positional query.
bear/engine/sqlite_token.go
Add regression coverage for invalid SQLite schemas.
  • Create a database containing only an unrelated table.
  • Verify token generation rejects databases missing the Bear schema.
tests/bear/engine/sqlite_token_test.go
Isolate verification end-to-end tests from host daemon log state.
  • Create temporary daemon logs for the bad-output-format and nil-stdout scenarios.
  • Pass those logs through verification options instead of relying on the operator log.
tests/bear/cli/verify/run_endtoend_test.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@barad1tos
barad1tos marked this pull request as ready for review September 28, 2026 18:58
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T19:00:53.967616Z 71494a8 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@barad1tos
barad1tos merged commit adddb7d into main Sep 28, 2026
11 checks passed
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