Skip to content

fix(api): expose conclusion provenance#847

Open
twistedgrim wants to merge 1 commit into
plastic-labs:mainfrom
twistedgrim:codex/expose-conclusion-provenance
Open

fix(api): expose conclusion provenance#847
twistedgrim wants to merge 1 commit into
plastic-labs:mainfrom
twistedgrim:codex/expose-conclusion-provenance

Conversation

@twistedgrim

@twistedgrim twistedgrim commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Expose conclusion provenance through the public conclusions API by serializing existing Document fields on the Conclusion response schema:

  • Document.level as conclusion_type
  • Document.source_ids as premises

This lets API clients such as OpenConcho distinguish explicit, deductive, and inductive conclusions without coupling to Honcho's database schema or guessing missing types as explicit.

Fixes #846.

Root cause

The database already stores conclusion derivation metadata, but /v3/workspaces/{workspace_id}/conclusions/list omitted that metadata from its response schema. Clients using the supported public API therefore could not render derived conclusion types accurately.

Testing

Validated on the fork branch with:

uv run ruff check src/schemas/api.py tests/routes/test_conclusions.py
uv run ruff format --check src/schemas/api.py tests/routes/test_conclusions.py
uv run basedpyright src/schemas/api.py
uv run pytest tests/routes/test_conclusions.py -q

Also deployed this patch in a self-hosted environment and verified the live OpenAPI schema exposes conclusion_type and premises.

Summary by CodeRabbit

  • New Features

    • Conclusion responses now include the conclusion type and associated premises in the API output.
    • These fields are now consistently returned in the serialized response for conclusion lists.
  • Bug Fixes

    • Improved response coverage to ensure conclusion details are mapped and displayed correctly.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fe5a15a2-61c6-4ccc-8edf-ada36908e4b7

📥 Commits

Reviewing files that changed from the base of the PR and between 60a15e6 and bd0c852.

📒 Files selected for processing (2)
  • src/schemas/api.py
  • tests/routes/test_conclusions.py

Walkthrough

The public Conclusion schema now serializes level as conclusion_type and source_ids as premises. The conclusions list test now seeds those fields and asserts the mapped response values.

Changes

Conclusion provenance in list responses

Layer / File(s) Summary
Conclusion schema contract
src/schemas/api.py
The Conclusion schema adds conclusion_type and premises serialization for level and source_ids.
List response test
tests/routes/test_conclusions.py
The list test constructs documents with provenance fields and asserts the returned conclusion_type and premises values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hopped through schemas bright and neat,
With premises and type to greet.
My lettuce says the list looks fine,
Provenance now marches in line.
Hoppity-hop, the fields align!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately describes the main change: exposing conclusion provenance in the API.
Linked Issues check ✅ Passed The schema and test updates map Document.level to conclusion_type and Document.source_ids to premises, matching issue #846.
Out of Scope Changes check ✅ Passed The changes stay focused on the public conclusions API schema and its test coverage, with no unrelated additions evident.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

[Bug] conclusions/list omits conclusion provenance

1 participant