Skip to content

feat(storage): cursor schema expansion and stat-based fast path (#736, #719) - #758

Merged
Sinity merged 1 commit into
masterfrom
feature/feat/cursor-schema-mtime-fastpath
May 3, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/feat/cursor-schema-mtime-fastpath

Conversation

@Sinity

@Sinity Sinity commented May 3, 2026

Copy link
Copy Markdown
Owner

Cursor schema with st_dev/st_ino/st_size/mtime_ns/byte_offset/failure_count/excluded. Stat fast path. Bug fix: cursor persistence during planning.

Problem: The mtime-only fast path relies on ISO-format TEXT comparison
from raw_conversations.file_mtime, which provides only second-level
precision and no device/inode identity check. A file replaced between
runs (same path, new content) is undetected if the timestamp rounds
to the same second. Additionally each source scan stats every file
even when cursor data would prove it unchanged.

Solution:
- Add source_file_cursor table (15 columns, DDL via SchemaScriptExtensionDescriptor
  — no SCHEMA_VERSION bump) tracking st_dev, st_ino, st_size, mtime_ns
  plus future fields (byte_offset, content_fingerprint, parser_fingerprint, etc.)
- Add get_known_source_cursors() / upsert_source_file_cursor() queries
  in repository layer
- Add _stat_matches_cursor() to sources/cursor.py — compares all 4 stat
  fields (dev, ino, size, mtime_ns) against live os.stat_result
- Insert cursor fast path in _select_paths_for_processing() before the
  mtime comparison; cursor match skips file without further I/O
- Hook cursor persistence into visit_sources() with a persist_cursors
  flag (disabled during planning scans to avoid poisoning subsequent
  acquire passes)
- 7 breaker tests verifying: full match skips, size mismatch processes,
  inode mismatch processes, cursor overrides mtime, sparse dict fails

Verification:
- pytest unit suites: 1949 passed (pipeline, CLI, storage, sources)
- devtools verify: all checks passed (format, lint, mypy, render-all,
  topology, layering, budgets, ownership, manifests, tests)
- topology-target.yaml updated for 4 new/missing files, 3 stale
  entries removed

Co-Authored-By: Claude <[email protected]>
Copilot AI review requested due to automatic review settings May 3, 2026 12:06
@coderabbitai

coderabbitai Bot commented May 3, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 10 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 08009f9a-8326-42d5-87ed-492922981f24

📥 Commits

Reviewing files that changed from the base of the PR and between 26f766f and a77aa46.

📒 Files selected for processing (14)
  • docs/topology-status.md
  • docs/verification-catalog.md
  • polylogue/pipeline/services/acquisition.py
  • polylogue/pipeline/services/acquisition_streams.py
  • polylogue/pipeline/services/planning_runtime.py
  • polylogue/sources/cursor.py
  • polylogue/sources/source_acquisition.py
  • polylogue/sources/source_walk.py
  • polylogue/storage/sqlite/queries/cursor.py
  • polylogue/storage/sqlite/schema_bootstrap.py
  • polylogue/storage/sqlite/schema_ddl.py
  • polylogue/storage/sqlite/schema_ddl_cursor.py
  • tests/unit/pipeline/test_acquisition_fast_path.py
  • tests/unit/storage/test_backend.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/feat/cursor-schema-mtime-fastpath

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 15 minutes and 10 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sinity
Sinity merged commit 1b1666d into master May 3, 2026
3 checks passed
@Sinity
Sinity deleted the feature/feat/cursor-schema-mtime-fastpath branch May 3, 2026 12:07

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a77aa46243

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Sinity
Sinity removed the request for review from Copilot May 3, 2026 12:30
Sinity added a commit that referenced this pull request May 7, 2026
…#719) (#758)

Cursor schema with
st_dev/st_ino/st_size/mtime_ns/byte_offset/failure_count/excluded. Stat
fast path. Bug fix: cursor persistence during planning.

Co-authored-by: Claude <[email protected]>
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 68.F065 / P1: fixed-already at the checked revision: polylogue/storage/repository/raw/repository_raw.py:116-120 implements get_known_source_cursors on the repository mixin, and line 131 implements upsert_source_file_cursor. Acquisition no longer calls a missing repository method.
  • 68.F066 / P1: fixed-already at the checked revision: polylogue/pipeline/services/acquisition.py:223 records a source-scan exception in error_count; lines 143-146 then withhold all cursors for an unscoped failed scan. Per-file failures also exclude their source paths, so an interrupted scan does not mark unprocessed files current.

Only the rows listed above are dispositioned. Held findings remain open.

@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 77.F049 / P2: fixed-already at the checked revision: Bootstrap imports its DDL and version from the existing archive_tiers.index module; the nonexistent storage.backends.schema_ddl import is no longer used. See polylogue/storage/sqlite/schema_bootstrap.py:28.

Only the rows listed above are dispositioned. Held findings remain open.

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