Skip to content

feat(cursor): stat metadata, failure quarantine, adversary tests (#620) - #762

Merged
Sinity merged 1 commit into
masterfrom
feature/feat/cursor-adversary-tests
May 3, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/feat/cursor-adversary-tests

Conversation

@Sinity

@Sinity Sinity commented May 3, 2026 •

Copy link
Copy Markdown
Owner

Added st_dev/st_ino/mtime_ns to cursor records. Failure count + exponential backoff + excluded quarantine. Mark_failed on parse errors, reset_failures on success. 10 adversary tests.

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced file state tracking now captures additional filesystem metadata for improved change detection
    • Added failure tracking with exponential backoff retry scheduling for sources
    • Introduced file exclusion and quarantine mechanism to manage problematic sources
  • Tests

    • Added comprehensive test coverage for cursor persistence, state management, and failure handling

Copilot AI review requested due to automatic review settings May 3, 2026 12:52
@coderabbitai

coderabbitai Bot commented May 3, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 948014cc-b194-4c60-ad60-088c7377eac0

📥 Commits

Reviewing files that changed from the base of the PR and between c1c27a5 and 33e7ebc.

📒 Files selected for processing (3)
  • polylogue/sources/live/cursor.py
  • polylogue/sources/live/watcher.py
  • tests/unit/sources/test_cursor_adversary.py

📝 Walkthrough

Walkthrough

The live cursor tracking system is extended to store filesystem metadata (st_dev, st_ino, mtime_ns), manage ingestion failures with exponential retry backoff, and support quarantine/exclusion of problematic files. The SQLite schema gains new columns; CursorStore methods handle failure recording and retry scheduling; and the watcher integrates failure tracking on parse errors.

Changes

Cursor Failure & Quarantine Tracking

Layer / File(s) Summary
Data Shape
polylogue/sources/live/cursor.py
CursorRecord dataclass adds filesystem metadata (st_dev, st_ino, mtime_ns) and ingestion control fields (source_generation, failure_count, next_retry_at, excluded).
SQLite Schema & Migrations
polylogue/sources/live/cursor.py
live_cursor table DDL and _ensure_columns() migration logic updated to add new columns with appropriate defaults.
Core Cursor Store Operations
polylogue/sources/live/cursor.py
get_record() expands SQL SELECT and row mapping to populate new fields from database; set() signature and upsert logic updated to accept and persist the new keyword-only parameters.
Failure & Quarantine Management
polylogue/sources/live/cursor.py
New public methods: mark_failed() (increments failure_count and sets next_retry_at with capped exponential backoff), reset_failures(), mark_excluded(), list_excluded(), and list_failed_with_retry() (filters by retry eligibility).
Watcher Integration
polylogue/sources/live/watcher.py
On parse failure, calls mark_failed(path); on successful ingestion, stores file metadata via set() and clears failure state with reset_failures(path).
Tests
tests/unit/sources/test_cursor_adversary.py
Comprehensive test module with fixtures and test classes covering persistence of metadata, failure counting, exclusion/quarantine flag handling, fingerprint-based skip decisions, rename detection via stat fields, and quarantined file listing.

Sequence Diagram

sequenceDiagram
    participant LW as LiveWatcher
    participant CS as CursorStore
    participant DB as SQLite DB
    participant FS as Filesystem

    LW->>FS: stat() & read() file
    LW->>LW: parse JSONL
    alt Parse Succeeds
        LW->>CS: set(path, st_dev, st_ino, mtime_ns, ...)
        CS->>DB: INSERT...ON CONFLICT UPDATE
        LW->>CS: reset_failures(path)
        CS->>DB: UPDATE failure_count=0, next_retry_at=NULL
    else Parse Fails
        LW->>CS: mark_failed(path)
        CS->>DB: UPDATE failure_count++, next_retry_at=BACKOFF_TIME
    end
    
    LW->>CS: list_failed_with_retry()
    CS->>DB: SELECT * WHERE retry_eligible
    CS-->>LW: paths ready for retry
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

Possibly related PRs


🐰 A cursor now remembers all, both big and small,
stat fields and failures tracked by the hall,
With backoff it waits, retries with care,
No file lost—excluded files declare their rare! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/feat/cursor-adversary-tests

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 60 minutes.

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

@Sinity
Sinity merged commit 3c4b23f into master May 3, 2026
2 of 3 checks passed
@Sinity
Sinity deleted the feature/feat/cursor-adversary-tests branch May 3, 2026 12:52

@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: 33e7ebce14

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

Comment thread polylogue/sources/live/cursor.py Resolved
Comment thread polylogue/sources/live/watcher.py Resolved
@Sinity
Sinity removed the request for review from Copilot May 3, 2026 13:15
Sinity added a commit that referenced this pull request May 7, 2026
… (#762)

Added st_dev/st_ino/mtime_ns to cursor records. Failure count +
exponential backoff + excluded quarantine. Mark_failed on parse errors,
reset_failures on success. 10 adversary tests.
@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.

  • 70.F069 / P1: fixed-already at the checked revision: CursorStore.mark_failed now creates a CursorRecord for an unseen path at polylogue/sources/live/cursor.py:1682 and continues to increment its failure count at line 1693. The first parse failure therefore enters the same persisted backoff path instead of returning without a row.

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.

  • 71.F066 / P2: fixed-already at the checked revision: The current freshness decision enforces unchanged quarantine at polylogue/sources/live/watcher.py:721 and consults next_retry_at for failed cursors at line 738. A failed file is not reparsed solely because it appears again in a discovery page or filesystem event.

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