Skip to content

feat(demo): let daemon demo import wait for readiness (#2196) - #2210

Merged
Sinity merged 2 commits into
masterfrom
feature/refactor/import-demo-wait-2196
Jun 20, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/refactor/import-demo-wait-2196

Conversation

@Sinity

@Sinity Sinity commented Jun 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds a truthful polylogue import --demo --wait path that schedules the deterministic demo fixture through the running daemon, blocks until the daemon-built archive passes semantic demo readiness checks, and optionally seeds deterministic user overlays after the target sessions exist.

Problem

polylogue import --demo previously proved only daemon scheduling. The README/demo transcript then had to tell users to wait manually before search/read/analyze commands were meaningful, while the semantic verifier lived on the in-process polylogue demo seed path. That left the realistic daemon demo path weaker than the direct seed path.

Solution

  • Added --wait, --timeout, and --with-overlays to polylogue import for the demo path.
  • Reused the demo verifier for daemon readiness while keeping direct polylogue demo verify stricter about raw source path leak posture.
  • Seeded deterministic user overlays only after daemon convergence, so overlay target refs exist first.
  • Updated README and docs/generate.md to document the daemon-backed ready-now command.
  • Covered command contracts, daemon-style provenance, and the live daemon import path in tests.

Verification

  • nix develop --command devtools test tests/unit/cli/test_import.py -q -> 16 passed.
  • nix develop --command devtools test tests/unit/cli/test_import.py tests/unit/demo/test_demo_seed_verify.py tests/integration/test_demo_daemon_convergence.py -q -> 20 passed.
  • nix develop --command devtools render all --check -> sync OK.
  • nix develop --command devtools verify --quick -> exit 0.
  • nix develop --command devtools verify --seed-testmon --skip-slow -> 11633 passed, exit 0, peak pytest tree RSS 3369.6 MiB.

Closes #2196 for the daemon demo wait/overlay slice; the broader showcase/visual cleanup remains in the issue.

Summary by CodeRabbit

  • New Features

    • Added --wait, --timeout, and --with-overlays CLI options to demo import for blocking verification and deterministic overlay attachment.
  • Documentation

    • Updated README and Quick Start guides to reflect new blocking demo import workflow with semantic verification.
  • Tests

    • Added integration and unit tests validating demo import convergence, verification, and overlay seeding behavior.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Sinity, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 51 minutes and 15 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 847efc70-f3a2-4f28-a758-4979a97cc3f7

📥 Commits

Reviewing files that changed from the base of the PR and between fc63354 and 7acb130.

📒 Files selected for processing (1)
  • tests/baselines/showcase/help-import.txt
📝 Walkthrough

Walkthrough

Adds --wait, --timeout, and --with-overlays options to polylogue import --demo. The command now polls verify_demo_archive until the daemon-built archive passes semantic verification, then optionally seeds user-tier overlays. verify_demo_archive gains a check_source_path_leaks toggle to accommodate the daemon path's stricter raw-provenance handling. Tests and documentation are updated throughout.

Changes

Blocking demo import with overlays and verify leak-check toggle

Layer / File(s) Summary
verify_demo_archive: check_source_path_leaks parameter
polylogue/demo/verify.py
Adds check_source_path_leaks: bool = True keyword argument and guards the absolute-path leak collection loop behind it, so the daemon-backed polling path can call verification without the strict direct-verify posture.
import_command: wait/timeout/with-overlays CLI and polling helpers
polylogue/cli/commands/import_command.py
Introduces _DEMO_WAIT_POLL_INTERVAL_S, _wait_for_demo_archive_ready() (timeout-driven polling loop), and _verify_demo_now() (single-shot verifier); extends the Click surface with --wait, --timeout, and --with-overlays; adds parameter validation enforcing demo-only and wait-dependency rules; adds post-scheduling blocking control flow that optionally seeds overlays and re-verifies.
Unit tests: CLI wait/overlay behavior and verify leak-check toggle
tests/unit/cli/test_import.py, tests/unit/demo/test_demo_seed_verify.py
Four new CLI tests covering --wait output, --with-overlays call ordering and overlay seeding, and two negative validation tests. One new verify test confirms check_source_path_leaks=False bypasses the absolute-path failure when a raw path is mutated to absolute.
Integration test and documentation
tests/integration/test_demo_daemon_convergence.py, README.md, docs/generate.md
Integration test subprocess call updated to --wait --timeout 20 --with-overlays with a 30s outer timeout; two new stdout assertions added. README and docs/generate.md updated to document the blocking command and daemon-backed evidence split.

Sequence Diagram

sequenceDiagram
    participant User
    participant ImportCmd as import_command
    participant Daemon as daemon ingest
    participant PollLoop as _wait_for_demo_archive_ready
    participant Verifier as verify_demo_archive
    participant OverlaySeed as seed_demo_user_overlays

    User->>ImportCmd: polylogue import --demo --wait --timeout 30 --with-overlays
    ImportCmd->>Daemon: schedule demo import
    Daemon-->>ImportCmd: Scheduled
    ImportCmd->>PollLoop: start polling (timeout=30s)
    loop every _DEMO_WAIT_POLL_INTERVAL_S
        PollLoop->>Verifier: verify_demo_archive(check_source_path_leaks=False)
        Verifier-->>PollLoop: ok / not yet
    end
    PollLoop-->>ImportCmd: archive ready
    ImportCmd->>OverlaySeed: seed_demo_user_overlays()
    ImportCmd->>Verifier: verify_demo_archive(require_overlays=True)
    Verifier-->>ImportCmd: ok
    ImportCmd-->>User: Demo archive verified overlays=yes
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Sinity/polylogue#2208: Directly related — introduces the verify_demo_archive function and its existing raw-path leak logic that this PR extends with the check_source_path_leaks toggle.

Poem

🐇 Hop, hop, the daemon spins its wheel,
No longer fire-and-forget — now blocking, real.
With --wait I pause and poll the night,
Till overlays bloom and the archive is right.
overlays=yes the rabbit cries with glee,
Semantic proof at last, for all to see! 🎉

🚥 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 title clearly and concisely describes the main feature addition: daemon demo import wait functionality with readiness support.
Description check ✅ Passed The description comprehensively covers all required sections: Summary, Problem, Solution, Verification with specific test commands and results, and acknowledges the changelog requirement.
Linked Issues check ✅ Passed The PR implements core objectives from #2196: adds explicit demo CLI commands (--wait, --timeout, --with-overlays), reuses demo verifier for daemon readiness, and includes comprehensive testing of the daemon-backed import path.
Out of Scope Changes check ✅ Passed All changes directly support the daemon demo import waiting feature: CLI options, verification logic, documentation updates, and targeted test coverage remain focused on the wait/overlay objectives.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/import-demo-wait-2196

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.

github-actions Bot pushed a commit that referenced this pull request Jun 20, 2026

@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: fc63354ad7

ℹ️ 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 on lines +98 to +102
result = verify_demo_archive(
archive_root(),
require_overlays=require_overlays,
check_source_path_leaks=False,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid exact-archive verification for import wait

When polylogue import --demo --wait is run in an archive that already contains any non-demo sessions, this call polls verify_demo_archive(), whose checks require the entire archive to contain exactly the three demo sessions and 19 messages. The daemon can successfully ingest the demo source, but the wait path will still time out because unrelated existing sessions remain present; either the wait check needs to verify demo readiness as a subset, or the command should reject non-empty archives before scheduling.

Useful? React with 👍 / 👎.

@Sinity
Sinity merged commit 3b99bbd into master Jun 20, 2026
14 checks passed
@Sinity
Sinity deleted the feature/refactor/import-demo-wait-2196 branch June 20, 2026 06:08
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.

refactor(verifiability): replace showcase QA with demo-driven CLI and visual tests

1 participant