Skip to content

fix(daemon): preserve inbox import suffixes (#1843) - #1953

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/demo-daemon-handoff-1843
Jun 15, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/demo-daemon-handoff-1843

Conversation

@Sinity

@Sinity Sinity commented Jun 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes the live-daemon demo convergence gap by preserving the inbox import suffix set for explicit archive inbox roots.

Problem

The #1950 harness proved polylogue import --demo could schedule through the live daemon, but full convergence stopped at 2 of 3 demo sessions. The daemon was watching the explicit inbox root with the default WatchSource suffix set of only .jsonl, so the staged ChatGPT demo-00.json fixture was ignored while the two .jsonl demo fixtures converged.

Solution

polylogue/sources/live/watcher.py now exposes the inbox import suffix tuple, and polylogue/daemon/cli.py uses it when an explicit root resolves to the active archive inbox. The demo daemon integration test is promoted to assert all 3 sessions, 19 messages, and searchable demo content. A daemon CLI unit test pins the explicit-inbox suffix behavior.

Verification

  • devtools test tests/integration/test_demo_daemon_convergence.py -> 1 passed
  • devtools test tests/unit/daemon/test_daemon_cli.py -k 'explicit_archive_inbox_root or polylogued_watch_builds_sources_from_roots' -> 2 passed, 31 deselected
  • devtools verify --quick -> exit_code 0

Closes the live daemon convergence gap in #1843.

Summary by CodeRabbit

  • Refactor

    • Improved daemon file watching configuration to more efficiently handle multiple file formats (.jsonl, .zip, .json, .ndjson)
  • Tests

    • Enhanced integration tests to verify complete end-to-end daemon convergence and archive searchability
    • Expanded unit test coverage for daemon configuration and source handling

Problem: #1843's live demo import path accepted the staged demo directory but an isolated daemon started with --root <archive>/inbox watched only .jsonl files. The approved demo world includes a ChatGPT .json fixture, so the live watcher materialized only the two JSONL sessions.

What changed: share the inbox suffix contract from the live watcher, build explicit daemon/watch roots through a helper that preserves the archive inbox formats, and promote the demo daemon integration harness to assert 3 sessions, 19 messages, and a searchable pytest hit through the live daemon path.

Verification: devtools test tests/integration/test_demo_daemon_convergence.py; devtools test tests/unit/daemon/test_daemon_cli.py -k 'explicit_archive_inbox_root or polylogued_watch_builds_sources_from_roots'; devtools verify --quick.
@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0a9d64d2-5c4f-411d-9794-918d2916d139

📥 Commits

Reviewing files that changed from the base of the PR and between 8703692 and 8eaa837.

📒 Files selected for processing (4)
  • polylogue/daemon/cli.py
  • polylogue/sources/live/watcher.py
  • tests/integration/test_demo_daemon_convergence.py
  • tests/unit/daemon/test_daemon_cli.py

📝 Walkthrough

Walkthrough

Extracts inbox file-extension suffixes into a shared INBOX_SOURCE_SUFFIXES constant in watcher.py, adds a _watch_sources_from_roots helper in cli.py that special-cases the archive inbox root and defaults other roots to .jsonl, wires both run_command and watch_command to use it, and upgrades the integration test to verify full DB convergence and searchability.

Changes

Root-aware WatchSource wiring and convergence testing

Layer / File(s) Summary
INBOX_SOURCE_SUFFIXES constant in watcher
polylogue/sources/live/watcher.py
Adds a INBOX_SOURCE_SUFFIXES module-level constant and updates the inbox WatchSource in default_sources() to reference it instead of an inline tuple.
_watch_sources_from_roots helper and CLI wiring
polylogue/daemon/cli.py
Imports INBOX_SOURCE_SUFFIXES, implements _watch_sources_from_roots with inbox-root special-casing and .jsonl fallback for other roots, and replaces source-construction logic in both run_command and watch_command with calls to this helper.
Unit test for inbox root suffix preservation
tests/unit/daemon/test_daemon_cli.py
Adds test_explicit_archive_inbox_root_keeps_import_suffixes to assert _watch_sources_from_roots assigns INBOX_SOURCE_SUFFIXES to the inbox root and (".jsonl",) to an ordinary root.
Integration test upgraded to DB convergence and searchability
tests/integration/test_demo_daemon_convergence.py
Adds sqlite3 import, EXPECTED_DEMO_SESSIONS constant, SQLite-backed session/message readers, a polling wait helper with diagnostic failure output, an archive search assertion helper, renames the test, and adds DB convergence and search_summaries assertions after import completion.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Sinity/polylogue#541: Introduced the live watcher and polylogue watch surface that this PR's WatchSource/default_sources changes are directly built on.
  • Sinity/polylogue#680: Moved watcher handling into polylogued watch in the same cli.py watch_command/run_command path that this PR modifies.
  • Sinity/polylogue#1692: Extended the inbox WatchSource to accept additional file suffixes beyond .jsonl, the same inbox-format acceptance logic this PR formalises into INBOX_SOURCE_SUFFIXES.

Poem

🐇 A suffix list, no longer inline,
Now INBOX_SOURCE_SUFFIXES does shine!
The inbox root gets all its types,
While other roots just .jsonl gripes.
DB convergence confirmed in test —
This bunny hops on, thoroughly blessed! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% 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 title concisely and accurately describes the main change: preserving inbox import suffixes in the daemon to fix a convergence issue.
Description check ✅ Passed The description follows the template with all required sections: Summary, Problem, Solution, Verification, and Changelog. All sections are well-populated with specific details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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/demo-daemon-handoff-1843

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.

@Sinity
Sinity merged commit 23d9ae7 into master Jun 15, 2026
13 checks passed
@Sinity
Sinity deleted the feature/fix/demo-daemon-handoff-1843 branch June 15, 2026 21:18
Sinity added a commit that referenced this pull request Jun 16, 2026
## Summary
Complete #1843's README-ready demo transcript by adding the missing
`analyze` example alongside the existing demo import, status, stats,
search, and read commands.

## Problem
The #1843 acceptance criteria require the demo archive to support
search/read/analyze examples. The current README and `docs/generate.md`
transcript showed search and read after daemon convergence, but not an
analyze command. Closing the issue without this would leave a literal AC
gap.

## Solution
Add `polylogue find "pytest" then analyze --facets` to both the README
quick transcript and the detailed generate/demo page. Update the async
import caveat so it consistently says search/read/analyze examples
become meaningful after daemon convergence.

### AC matrix

| AC | Current state |
| --- | --- |
| A new user can run demo import from a clean checkout. | Satisfied by
`polylogue import --demo` in `polylogue/cli/commands/import_command.py`;
tested by `tests/unit/cli/test_import.py`; documented in `README.md` and
`docs/generate.md`. |
| Demo archive supports search/read/analyze examples. | Satisfied here:
README/docs now show `polylogue "pytest" list`, `polylogue find "pytest"
then read --view messages`, and `polylogue find "pytest" then analyze
--facets`. The archive-level `pytest` search/read evidence is pinned by
`tests/unit/scenarios/test_demo_archive_convergence.py`; analyze is the
registered aggregate verb over the matched result set. |
| Fixture world is committed and documented. | Satisfied by
`build_demo_corpus_specs()` and docs in `docs/generate.md`; prior PRs
#1934, #1935, #1936, #1937, #1940, #1943, #1950, #1953, and #1975
recorded the fixture, live daemon path, convergence proof, and overlay
evidence. |
| Tests validate demo output without relying on dev machine state. |
Satisfied by isolated archive/config roots in the demo import and
convergence tests; #1975 additionally proves deterministic user overlays
and private-path hygiene. |
| No private data / no host-specific absolute paths. | Satisfied by the
relative fixture-path tests and convergence assertions in
`tests/unit/scenarios/test_corpus.py` and
`tests/unit/scenarios/test_demo_archive_convergence.py`. |
| Known tags/notes/KV once #1883 lands. | Satisfied by #1975:
`seed_demo_user_overlays()` stores the `pytest-triage` tag, mark,
blackboard note, saved query, and typed tag/decision assertions in
`user.db` after convergence. |

### Explicit decisions

`polylogue import --demo` remains asynchronous daemon scheduling. It
does not synchronously seed user overlays because the target sessions
may not exist yet. Overlay seeding stays as deterministic
repository/release evidence after convergence, as documented by #1975.

## Verification
- `nix develop --command devtools verify-doc-commands` -> `99 doc files
scanned, no stale commands`.
- `nix develop --command devtools verify --quick` -> `exit_code 0`.
- Pre-push `devtools verify --quick` -> `exit_code 0`.

Closes #1843
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