Skip to content

feat(api): consolidate project-history retrieval GET and CLI - #431

Draft
seonghobae wants to merge 5 commits into
feat/project-history-collection-get-gap-003afrom
feat/project-history-retrieval-cli-gap-003a
Draft

feat(api): consolidate project-history retrieval GET and CLI#431
seonghobae wants to merge 5 commits into
feat/project-history-collection-get-gap-003afrom
feat/project-history-retrieval-cli-gap-003a

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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-safe ProjectHistoryProjection, 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.

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.
devin-ai-integration[bot]

This comment was marked as resolved.

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 92b56eb6-c30e-4b17-a0aa-4b005dd4ced9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

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.
@seonghobae
seonghobae force-pushed the feat/project-history-retrieval-cli-gap-003a branch from da2dc2d to 6b2fd2f Compare September 1, 2026 05:29

@devin-ai-integration devin-ai-integration 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.

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

Devin Review found 1 new potential issue.

Devin Review

Comment on lines +76 to +78
pub fn to_json(&self) -> Result<String, ApiError> {
self.validate()?;
to_json_with_limit(self, DEFAULT_PROJECT_HISTORY_BYTE_LIMIT)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@seonghobae seonghobae changed the title feat(api): retrieve project history via loopback GET-by-id CLI feat(api): consolidate project-history retrieval GET and CLI Sep 1, 2026
@seonghobae
seonghobae changed the base branch from feat/project-history-retrieval-get-gap-003a to feat/project-history-collection-get-gap-003a September 1, 2026 16:07

@devin-ai-integration devin-ai-integration 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.

Devin Review found 2 new potential issues.

Devin Review

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Exact-head verification still required

The local environment lacks cargo, so focused tests and mandatory quality gates could not run. Exact-head CI must supply fresh verification before merge.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +26 to +31
let stdout = render_project_history_retrieval_cli_stdout(&invocation, &response)?;
println!("{stdout}");
if (200..300).contains(&response.status_code) {
Ok(())
} else {
Err(ApiError::InvalidWirePayload)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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