Repository navigation
feat(reader): provenance view with bounded raw access (#1125) - #1172
Conversation
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7d5a315f6
ℹ️ 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".
Per-conversation provenance read surface plus inspector panel.
- New module polylogue/daemon/provenance.py exposes
build_provenance_payload(): joins conversations + raw_conversations,
surfaces content_hash, source path (home-sanitized), acquisition
timestamp, blob size, validation/quarantine state.
- New endpoint GET /api/conversations/{id}/provenance returns the
metadata envelope. include_raw=1 attaches a bounded raw payload
preview; the server cap RAW_PREVIEW_MAX_BYTES is enforced regardless
of client-supplied bytes parameter.
- Web reader Raw inspector tab loads provenance on conversation
selection; raw preview button is opt-in (no auto-load).
- PROVENANCE_JS extracted to web_shell_provenance.py to keep
web_shell.py under its file-size budget.
- 16 new tests pin the bounded-payload contract, quarantine surfacing,
home-path sanitization, and base64 fallback for binary blobs.
Closes #1125
a7d5a31 to
e78ec37
Compare
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Adds a per-conversation provenance read surface (#1125) so the web
reader can show the source artifact and ingest metadata that produced a
conversation, plus an opt-in, server-bounded raw payload preview.
Problem
Operators inspecting an archived conversation had no surfaced answer to
"where did this row come from" — the existing
/api/conversations/{id}/rawendpoint returned provider_meta and a flat raw_artifacts list with no
content hash, no acquisition timestamp, no validation state, and no way
to peek at the actual source bytes safely. The reader's "Raw" inspector
tab repeated provider/branch/parent fields already present elsewhere
without any provenance value.
Solution
polylogue/daemon/provenance.py: new module owning the joinedread from
conversations+raw_conversationsand the boundedraw-payload assembly.
RAW_PREVIEW_MAX_BYTESis the hard cap.Source paths under
$HOMEare rendered as~so absolutefilesystem locations do not leak unnecessarily.
polylogue/daemon/http.py: new routeGET /api/conversations/{id}/provenance.include_raw=1optsin to the preview;
bytes=Nonly narrows the window (a clientasking for 1e9 bytes is clamped to the server cap).
quarantined+quarantine_reason(parse_error, validation_failed, no_raw_artifact,blob_missing, blob_unreadable) instead of silently omitting fields.
text; non-UTF-8 prefixes fall back tobase64so binary artifacts are still inspectable safely.polylogue/daemon/web_shell.py+web_shell_provenance.py:inspector "Raw" tab now loads provenance on selection. The raw
preview button is an explicit opt-in click, not auto-loaded.
Provenance JS moved to a sibling module so
web_shell.pystaysunder its file-size budget.
Alternative considered: a separate
/api/conversations/{id}/provenance/rawendpoint for the preview. Rejected — one endpoint with an explicit
opt-in query parameter keeps the metadata + preview ordering visible
and matches the existing reader pattern.
Verification
nix develop -c pytest tests/unit/daemon/test_provenance_endpoint.py→ 16 passed in 10.45s. Tests pin: bounded-payload contract (clamp
on huge
bytesrequest), quarantine surfacing for each cause,home-path sanitization (no raw home path appears in the serialized
payload), base64 fallback for binary blobs, 404 for missing
conversations, and default-omission of the raw preview.
nix develop -c pytest tests/unit/daemon/→ 447 passed in 15.46s(no regressions in adjacent daemon contract / security tests).
nix develop -c devtools verify --quick→ exit_code 0 (format,lint, mypy --strict, render-all --check, every manifest lint).
Acceptance criteria status (issue #1125)
known source artifact —
renderInspectorRawloads provenanceon selection.
action —
include_raw=1is opt-in and clamped toRAW_PREVIEW_MAX_BYTES.with
~;source_path_contains_homeadvertised so the UIshows a "home prefix sanitized" hint.
quarantinedflag +quarantine_reasonenum, no silent gap.no direct raw-table SQL in the reader JS; everything goes through
/api/conversations/{id}/provenance.payloads —
TestProvenanceEndpoint::test_client_cannot_widen_raw_preview_capsends
bytes=999999999against an 8×-cap blob and assertsmax_bytes == RAW_PREVIEW_MAX_BYTESandbytes_returned <= cap.harness is separate infrastructure; this PR ships the bounded
contract the harness will exercise).
Closes #1125