Skip to content

feat(cli): polylogue ingest truthful or rejects (#1264) - #1383

Merged
Sinity merged 3 commits into
masterfrom
feature/feat/ingest-path-truthful-1264
May 19, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/feat/ingest-path-truthful-1264

Conversation

@Sinity

@Sinity Sinity commented May 19, 2026

Copy link
Copy Markdown
Owner

Summary

Make polylogue ingest PATH satisfy the three observable outcomes called for by #869 slice C (#1264): accepted+observable, rejected (input), or rejected (daemon). Eliminates the case where the daemon returns HTTP 202 and the CLI prints success without anything observable.

Problem

The previous ingest implementation staged the file into archive_root()/inbox, POSTed /api/ingest, and printed Scheduled: ... as long as ImportOperation.status was not literally failed or error. That violated the issue's anti-trap "Do not trust polylogue ingest just because the daemon returns 202":

  • an unrecognized daemon status (e.g. mystery_status) was silently treated as success;
  • a daemon HTTP 4xx/5xx (HTTPError) escaped as a raw traceback rather than an actionable message;
  • the success output did not reveal the staged inbox path or point at polylogue status, so the user had no observable handle on the scheduled work.

Solution

polylogue/cli/commands/ingest.py:

  • Catch HTTPError explicitly and report status code + staged path so operators know the file landed on disk and which contract failed.
  • Catch URLError separately so "connection refused" produces an actionable "is polylogued running?" message that names the daemon URL and the polylogued binary.
  • Treat only an explicit accepted / pending / scheduled / queued status as success; any other status fails loudly instead of fabricating a green line.
  • Success output now lists the staged path, operation id, daemon URL, and the polylogue status next-step pointer so the work is observable.

tests/unit/cli/test_ingest.py: extended to cover the AC matrix — accept+observable, missing path, daemon-unreachable, daemon HTTP error, unrecognized status, daemon-reported failure.

Inherited baseline cleanup per CLAUDE.md §19a: regenerated docs/cli-reference.md, docs/test-quality-workflows.md, docs/verification-catalog.md, docs/topology-status.md (drifted on master) and added tutorial to test_all_subcommands_registered plus the help snapshot (the #1263 / PR #1376 merge missed both regenerations and left master with two failing tests).

No polylogue run resurrection. No new daemon endpoints — the CLI consumes the existing /api/ingest contract from #861/#1247.

Verification

nix develop -c pytest tests/unit/cli/test_ingest.py -x
  → 8 passed in 9.22s

nix develop -c devtools verify --quick
  → exit_code: 0, total_duration_s: 37.31

nix develop -c pytest tests/unit/cli/test_click_app.py::TestCliMetadata::test_all_subcommands_registered tests/unit/cli/test_help_snapshots.py::test_root_help_snapshot
  → 2 passed in 9.15s

Ref #869
Closes #1264

Sinity added 3 commits May 19, 2026 18:02
Make 'polylogue ingest PATH' satisfy the three observable outcomes
called for by #869 slice C: accepted+observable, rejected (input), or
rejected (daemon). Eliminates the case where the daemon returns 202
and the CLI prints success without anything observable.

Problem

The previous ingest implementation staged the file into
archive_root()/inbox, POSTed to /api/ingest, and printed
'Scheduled: ...' as long as ImportOperation.status was not literally
'failed' or 'error'. That meant:

* an unrecognized daemon status was silently treated as success;
* a daemon HTTP 4xx/5xx (HTTPError) was not caught and surfaced as a
  raw traceback rather than an actionable message;
* the success output did not reveal the staged inbox path or point at
  'polylogue status', so the user had no observable handle on the
  scheduled work.

Solution

* Catch HTTPError explicitly and report status code + staged path so
  operators know the file is on disk and which contract failed.
* Catch URLError separately so 'connection refused' produces an
  actionable 'is polylogued running?' message naming the daemon URL.
* Treat only an explicit accepted/pending/scheduled/queued status as
  success; any other status fails loudly instead of fabricating a
  green line.
* Success output now lists the staged path, operation id, daemon URL,
  and the 'polylogue status' next-step pointer.

Verification

nix develop -c pytest tests/unit/cli/test_ingest.py -x
  → 8 passed in 9.22s
Regenerate cli-reference, test-quality-workflows, verification-catalog,
and topology-status. These were drifted on master prior to this PR
(unrelated content); refreshing so 'devtools verify --quick' passes.
The 'tutorial' subcommand was added in PR #1376 (#1263) but the
test_all_subcommands_registered expected set and the root help snapshot
were not regenerated, leaving master with two failing tests. Inherited
baseline cleanup per CLAUDE.md \xa719a.
@coderabbitai

coderabbitai Bot commented May 19, 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 47 minutes and 35 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ 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: abf11afd-7036-42ec-9661-277b472339ed

📥 Commits

Reviewing files that changed from the base of the PR and between 694e271 and 89d3bf7.

📒 Files selected for processing (8)
  • docs/cli-reference.md
  • docs/test-quality-workflows.md
  • docs/topology-status.md
  • docs/verification-catalog.md
  • polylogue/cli/commands/ingest.py
  • tests/unit/cli/__snapshots__/test_help_snapshots.ambr
  • tests/unit/cli/test_click_app.py
  • tests/unit/cli/test_ingest.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/feat/ingest-path-truthful-1264

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 8382b18 into master May 19, 2026
3 of 5 checks passed
@Sinity
Sinity deleted the feature/feat/ingest-path-truthful-1264 branch May 19, 2026 16:10
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.

feat(cli): polylogue ingest PATH truthful or rejects (#869 slice C)

1 participant