Skip to content

feat(daemon): stabilize evidence read API routes (#1847) - #2169

Merged
Sinity merged 1 commit into
masterfrom
feature/feat/stable-evidence-api-1847
Jun 19, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/feat/stable-evidence-api-1847

Conversation

@Sinity

@Sinity Sinity commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

Promotes the assertion and recovery evidence helper routes to stable local API routes, publishes them in generated OpenAPI, and updates the daemon/workbench docs around the stable read surface.

Problem

/api/assertions and /api/sessions/:id/recovery already returned shared DTOs and powered the web workbench, but the route contract still classified them as shell-only and generated OpenAPI omitted them. That left part of #1847's local API boundary implicit even though the implementation was already reusable.

Solution

  • mark /api/assertions and /api/sessions/:id/recovery as stable route contracts with typed response payloads
  • publish RecoveryReadPayload and AssertionClaimListPayload through the generated OpenAPI document
  • document the stable read/recovery/assertion endpoints in docs/daemon.md
  • update the workbench plan to reflect which routes are now stable and which remain shell-supported
  • add focused route-contract and OpenAPI renderer tests

Verification

  • devtools test tests/unit/daemon/test_route_contracts.py tests/unit/devtools/test_render_openapi.py (83 passed)
  • devtools test tests/unit/daemon/test_web_reader.py -k 'RecoveryEndpoint or AssertionEndpoint or shared_surface_dtos' (16 passed)
  • devtools verify --quick (exit_code 0, run 20260619T152613Z-quick-1454498-b524cb34)
  • pre-push devtools verify --quick (exit_code 0, run 20260619T152829Z-quick-1464809-c8cf66d9)

Ref #1847

Problem: /api/assertions and /api/sessions/:id/recovery already return shared DTOs and power the web workbench, but route metadata and generated API docs still marked them as shell-only. That left the #1847 local API boundary partly implicit.

What changed: promote both routes to stable route contracts, publish their RecoveryReadPayload and AssertionClaimListPayload schemas in generated OpenAPI, and update daemon/workbench docs plus route/OpenAPI tests.

Verification:

- devtools test tests/unit/daemon/test_route_contracts.py tests/unit/devtools/test_render_openapi.py (83 passed)

- devtools test tests/unit/daemon/test_web_reader.py -k 'RecoveryEndpoint or AssertionEndpoint or shared_surface_dtos' (16 passed)

- devtools verify --quick (exit_code 0, run 20260619T152613Z-quick-1454498-b524cb34)

Ref #1847
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

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 18 minutes and 42 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: 0272da4e-fca2-43be-af33-7b6a1e4fa5d2

📥 Commits

Reviewing files that changed from the base of the PR and between 232ab92 and b66c0d5.

📒 Files selected for processing (8)
  • devtools/render_openapi.py
  • docs/daemon.md
  • docs/openapi/search.yaml
  • docs/plans/web-workbench-1846-v0-plan.md
  • polylogue/daemon/http.py
  • polylogue/daemon/route_contracts.py
  • tests/unit/daemon/test_route_contracts.py
  • tests/unit/devtools/test_render_openapi.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/feat/stable-evidence-api-1847

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 19, 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: b66c0d5685

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

"in": "query",
"description": "Maximum claims returned.",
"required": False,
"schema": {"type": "integer", "minimum": 1, "default": 50},

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 Align assertion limit default with handler

When clients omit limit, the published OpenAPI contract says /api/assertions defaults to 50 rows, but the handler actually calls clamp_query_limit(self._get_int(params, "limit", 20), default=20) and returns limit: 20. Since this route is being promoted as a stable generated API surface, generated clients and docs will overstate the default page size for unbounded assertion reads unless the schema is changed to 20 or the handler default is raised.

Useful? React with 👍 / 👎.

@Sinity
Sinity merged commit 69b6368 into master Jun 19, 2026
14 checks passed
@Sinity
Sinity deleted the feature/feat/stable-evidence-api-1847 branch June 19, 2026 15:40
Sinity added a commit that referenced this pull request Jun 19, 2026
## Summary

Bounds the verification harness paths that were still capable of turning
broad pytest-testmon selections into multi-GiB, single-process runs.
Selection artifacts now preserve exact selected/deselected counts while
sampling node IDs, default affected-test verification runs through a
bounded xdist pool, run metadata records managed basetemp cleanup, and
resource summary parsing streams the resource log instead of loading it
wholesale.

## Problem

Local verify evidence showed two distinct failure shapes:

- `devtools verify --seed-testmon --skip-slow` selected about 11.5k
tests with `-n 4`, peaked around 3.1 GiB PSS, and wrote about 3.0 GiB of
pytest basetemp data.
- A default `devtools verify` selected about 11.3k tests with `-n 0`,
kept one Python process around 2.8 GiB PSS, and hit the 45-minute
supervisor timeout.

Focused `devtools test ...` runs stayed around 100-140 MiB RSS, so the
implicated surface was broad/default harness behavior, not the ordinary
inner loop. A fresh `ps` sample of the installed `polylogued` during
this work was about 216 MiB RSS after 6h25m, so this PR does not claim a
daemon retention fix.

## Solution

- `devtools.pytest_progress_plugin` now samples selected/deselected node
IDs (`POLYLOGUE_PYTEST_SELECTION_NODEID_LIMIT`, default 500) while
retaining exact counts and omitted-count metadata.
- `devtools verify` now defaults the affected pytest-testmon lane to `-n
4`, matching seed/full broad lanes, while focused `devtools test`
remains single-process by default.
- Pytest step metadata now records `basetemp_cleanup`, making post-run
temp-tree reclamation visible in verify history.
- Resource-summary projection streams `resources.jsonl` rather than
materializing all samples in memory.
- `polylogue ops status` facade-route catalog was updated for
`neighbor_candidate_payloads` and `session_correlation_payload`; the
broad verify run found this real drift after #2169.
- Testing docs and generated `AGENTS.md` describe the new worker and
selection-artifact behavior.

## Verification

- `devtools test
tests/unit/cli/test_status.py::test_archive_facade_route_catalog_covers_public_async_facade
tests/unit/cli/test_plain_cli_snapshots.py::test_json_status_snapshot
tests/unit/devtools/test_pytest_progress_plugin.py
tests/unit/devtools/test_verify.py
tests/unit/devtools/test_run_tests.py` -> 74 passed.
- `devtools verify --quick` -> exit 0, run
`20260619T162135Z-quick-1620666-9bbe9eae`.
- Initial broad-path proof: `devtools verify` selected 11,544 tests with
`-n 4`, completed in 36:03 instead of timing out, recorded
`basetemp_cleanup`, and peaked at 4.38 GiB PSS; it failed one status
route-catalog test, which this PR fixes.
- Final `devtools verify` after the catalog/snapshot fix -> exit 0, run
`20260619T162202Z-testmon-1622183-8c640aa0`; pytest step selected 10,
ran 1 affected test, passed, and recorded `basetemp_cleanup` plus peak
PSS 553.1 MiB.

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