Skip to content

fix(watcher): accept .zip, .json, .ndjson in inbox watch source - #1692

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/inbox-watch-zip-suffixes
May 28, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/inbox-watch-zip-suffixes

Conversation

@Sinity

@Sinity Sinity commented May 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fix the inbox WatchSource to accept .zip, .json, and .ndjson in addition to .jsonl. Without this, GDPR exports dropped in inbox are silently ignored despite POST /api/ingest returning 202.

Problem

POST /api/ingest (and polylogue ingest CLI) returns HTTP 202 for any staged file, but the live watcher's inbox WatchSource defaulted to suffixes=(".jsonl",). A .zip dropped in inbox/ was silently ignored forever — the operator sees "202 accepted" but the file is never observed. GDPR exports from ChatGPT and claude.ai are typically .zip archives.

The pipeline already handles .zip/.json/.ndjson — source_walk.py declares all four as _SUPPORTED_EXTENSIONS, and source_parsing.py/source_acquisition.py have zipfile handling. The gap was only in the watcher's suffix filter.

Solution

polylogue/sources/live/watcher.py: inbox WatchSource now uses suffixes=(".jsonl", ".zip", ".json", ".ndjson").

Verification

  • nix develop -c pytest tests/unit/sources/test_live_watcher.py -k "suffix or inbox" -q → 3 passed
  • nix develop -c devtools verify --quick → exit_code 0

Closes #1683

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • The inbox source now accepts additional file formats: .zip, .json, .jsonl, and .ndjson.
  • Tests

    • Added verification that the inbox source correctly declares support for the new file formats.

Review Change Stack

Closes #1683

Problem: POST /api/ingest returns 202 for any staged file, but the
live watcher's inbox WatchSource defaulted to suffixes=(".jsonl",).
A .zip (GDPR export from ChatGPT/Claude) or .json dropped in inbox
was silently ignored forever — the operator saw "202 accepted" but
the file was never observed.

The pipeline already handles .zip/.json/.ndjson (source_walk.py
_SUPPORTED_EXTENSIONS includes all four). The gap was only in the
watcher's suffix filter.

Fix: inbox WatchSource now accepts .jsonl, .zip, .json, .ndjson.

Verification:
  nix develop -c pytest tests/unit/sources/test_live_watcher.py -k "suffix or inbox" -q
  -> 3 passed
  nix develop -c devtools verify --quick -> exit_code: 0

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented May 28, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR extends the inbox watch source to accept additional archive and data formats (.zip, .json, .ndjson) in addition to the existing .jsonl suffix. A new unit test validates the format acceptance, and the test file size budget is adjusted to reflect the test's growth.

Changes

Inbox format acceptance for live watcher

Layer / File(s) Summary
Inbox source format suffixes
polylogue/sources/live/watcher.py
default_sources() updates the inbox WatchSource to explicitly declare .jsonl, .zip, .json, and .ndjson suffixes, replacing the prior default-suffix behavior.
Test validation and file size budget
tests/unit/sources/test_live_watcher.py, docs/plans/file-size-budgets.yaml
A new unit test test_inbox_source_accepts_zip_and_archive_formats verifies that the inbox source accepts the declared formats, and the test file size budget ceiling is increased from 1600 to 1620 bytes to accommodate the new test.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 The inbox grows wise, now it knows the zip,
.json and .ndjson no longer slip,
Archive formats dance where silence once fell,
A test keeps watch — all formats fare well! 📦✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main change: adding support for .zip, .json, and .ndjson file formats in the inbox watch source, directly matching the primary code change in watcher.py.
Description check ✅ Passed The PR description follows the template with all major sections completed: Summary, Problem, Solution, Verification, and Risks/Follow-ups (deleted as none apply); all required information is present and clear.
Linked Issues check ✅ Passed The PR successfully addresses the primary objective from #1683: updating the inbox WatchSource to accept .zip, .json, .ndjson, and .jsonl suffixes to prevent silent data loss when GDPR exports are staged via /api/ingest.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the linked issue #1683: watcher.py suffix update, test addition, and budget adjustment are all in-scope; no secondary modifications to /api/ingest validation (Option B) are included, which is acceptable as noted in issue discussion.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/fix/inbox-watch-zip-suffixes

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

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/plans/file-size-budgets.yaml`:
- Line 79: The YAML entry for the exception "reason" contains an issue reference
"(`#1683`)"; update the reason value used in the reason: field to remove any
issue/PR references and leave a plain descriptive message (e.g., keep
"kitchen-sink live-ingest test file (cursor, watcher, batch, debounce,
bootstrap) + inbox suffix coverage; split candidate: per-subject suites under
tests/unit/sources/live/") so the reason string contains no "(#...)" markers and
remains policy-compliant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 33e4af2d-ea46-4d73-abca-eab4d32219b1

📥 Commits

Reviewing files that changed from the base of the PR and between 7f417d0 and 6a52b00.

📒 Files selected for processing (3)
  • docs/plans/file-size-budgets.yaml
  • polylogue/sources/live/watcher.py
  • tests/unit/sources/test_live_watcher.py

ceiling: 1600
reason: "kitchen-sink live-ingest test file (cursor, watcher, batch, debounce, bootstrap); split candidate: per-subject suites under tests/unit/sources/live/"
ceiling: 1620
reason: "kitchen-sink live-ingest test file (cursor, watcher, batch, debounce, bootstrap) + inbox suffix coverage (#1683); split candidate: per-subject suites under tests/unit/sources/live/"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Keep exception reason free of issue references.

This reason now includes (#1683), which conflicts with this file’s policy that exception reasons should not point at closed issues.

Suggested edit
-    reason: "kitchen-sink live-ingest test file (cursor, watcher, batch, debounce, bootstrap) + inbox suffix coverage (`#1683`); split candidate: per-subject suites under tests/unit/sources/live/"
+    reason: "kitchen-sink live-ingest test file (cursor, watcher, batch, debounce, bootstrap) + inbox suffix coverage; split candidate: per-subject suites under tests/unit/sources/live/"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
reason: "kitchen-sink live-ingest test file (cursor, watcher, batch, debounce, bootstrap) + inbox suffix coverage (#1683); split candidate: per-subject suites under tests/unit/sources/live/"
reason: "kitchen-sink live-ingest test file (cursor, watcher, batch, debounce, bootstrap) + inbox suffix coverage; split candidate: per-subject suites under tests/unit/sources/live/"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/plans/file-size-budgets.yaml` at line 79, The YAML entry for the
exception "reason" contains an issue reference "(`#1683`)"; update the reason
value used in the reason: field to remove any issue/PR references and leave a
plain descriptive message (e.g., keep "kitchen-sink live-ingest test file
(cursor, watcher, batch, debounce, bootstrap) + inbox suffix coverage; split
candidate: per-subject suites under tests/unit/sources/live/") so the reason
string contains no "(#...)" markers and remains policy-compliant.

@Sinity
Sinity merged commit 9038e09 into master May 28, 2026
7 checks passed
@Sinity
Sinity deleted the feature/fix/inbox-watch-zip-suffixes branch May 28, 2026 00:32
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.

Daemon silently drops inbox zips: /api/ingest returns 202 but watcher rejects .zip suffix

1 participant