feat(api): consolidate project-history retrieval GET and CLI - #431
Conversation
LineageWeave operators can GET /v1/project-histories/{idempotency_key} on
tepp-loopback to recover one stored cutoff-safe projection without replaying
POST. inference_status remains temporal_association_only.
tepp.scientific_acceptance.v1 never appears. Does not infer causality.
Not collection GET. Not collection CLI. Stacked on #424.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
LineageWeave operators can run tepp-project-history-get get against tepp-loopback to recover one stored cutoff-safe projection without replaying POST. inference_status remains temporal_association_only. tepp.scientific_acceptance.v1 never appears. Does not infer causality. Not collection CLI. Not GET-by-id HTTP. Stacked on #429.
da2dc2d to
6b2fd2f
Compare
| pub fn to_json(&self) -> Result<String, ApiError> { | ||
| self.validate()?; | ||
| to_json_with_limit(self, DEFAULT_PROJECT_HISTORY_BYTE_LIMIT) |
There was a problem hiding this comment.
🟡 Large stored histories become unreadable
When a stored projection approaches 256 KiB, to_json_with_limit applies that same limit after adding receipt fields. Retrieval then returns 413.
Prompt for agents
ProjectHistoryRetrievalReceipt::to_json and from_json currently reuse DEFAULT_PROJECT_HISTORY_BYTE_LIMIT, although the nested ProjectHistoryProjection can itself validly consume that entire limit. The receipt adds tenant_workspace_id, idempotency_key, field names, and JSON framing, so AnalysisRunLiveService::get_project_history can fail with LimitExceeded for an accepted stored projection. Define a bounded receipt/response limit that includes the maximum projection plus bounded receipt overhead, and use it consistently in ProjectHistoryRetrievalReceipt serialization/deserialization and the CLI TCP response reader/parser in crates/tepp_api/src/project_history_retrieval_cli.rs. Add a boundary test with a valid near-limit stored projection.
Was this helpful? React with 👍 or 👎 to provide feedback.
| let stdout = render_project_history_retrieval_cli_stdout(&invocation, &response)?; | ||
| println!("{stdout}"); | ||
| if (200..300).contains(&response.status_code) { | ||
| Ok(()) | ||
| } else { | ||
| Err(ApiError::InvalidWirePayload) |
There was a problem hiding this comment.
🟡 Failed retrievals pollute standard output
On non-2xx responses, render_project_history_retrieval_cli_stdout returns an error envelope and println! writes it to stdout. Automation receives failure JSON instead of projections.
Prompt for agents
The binary renders every response and prints it to stdout before checking status. For non-2xx responses, rendering returns the validated redacted ErrorEnvelope, so failures write JSON to stdout and then main writes a second generic error to stderr. Keep stdout exclusive to successful ProjectHistoryProjection output. Route validated error envelopes to stderr and return failure without emitting the generic duplicate, while preserving nonzero exit status. Update the binary contract test to assert empty stdout and the redacted envelope on stderr for a missing history.
Was this helpful? React with 👍 or 👎 to provide feedback.
Consolidated landing vehicle
This PR folds predecessor #429 into one LineageWeave-facing Analysis Run / project-history retrieval application-adapter vehicle. The current head contains #429 as its direct ancestor, so retargeting to #429's former base preserves the GET-by-id implementation/tests while eliminating one open micro-PR. #429 remains immutable review/history evidence; stored-request vehicle #456 also retains this ancestry.
Preserved GET behavior from #429:
GET /v1/project-histories/{idempotency_key}, LineageWeave-only consumer boundary, empty body, cutoff-safeProjectHistoryProjection,inference_status=temporal_association_only, pagination/naruon/body/extra-segment/unknown-key/decoded-slash/NUL refusals, and exclusion of scientific-acceptance metrics and causal score.CLI behavior on this head: published
tepp-project-history-get get, typed retrieval exchange, empty-stdin admission, non-loopback/localhost/credential/nonempty-stdin/unpublished-consumer/non-HTTPS/pagination/hostile-identity refusals, and the same temporal-association-only projection boundary.This is one Analysis Run application/adapter landing vehicle, not a bounded context. ADR 0066/0067 are implementation lineage pending #437 normalization. Merge only after fresh exact-head required workflows, resolved conversations, and qualifying independent approval under live ruleset 18156473. No predecessor-head evidence transfer or bypass.