-
Notifications
You must be signed in to change notification settings - Fork 0
feat(api): consolidate interpretation-run create and collection adapters #436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
seonghobae
wants to merge
3
commits into
main
Choose a base branch
from
feat/interpretation-run-collection-cli-gap-003a
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - `orchestrator_live` `tepp-interpretation-runs create` mints a typed contextual-orchestrator `POST /v1/interpretation-runs` onto spawned `tepp-orchestrator-loopback` TCP (ADR 0064). Metric-free hypothetical JSON only. `tepp.scientific_acceptance.v1` never appears. Does not infer causality. Naruon and LineageWeave are refused. Not analysis-run CLI, not export CLI, not persistence. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - `orchestrator_live` publishes `tepp-interpretation-runs list` minting typed contextual-orchestrator `GET /v1/interpretation-runs` onto spawned `tepp-orchestrator-loopback` TCP (ADR 0070). Metric-free identities only (`claim_status=hypothetical`, `scientific_authority=false`). Empty stdin admitted. `tepp.scientific_acceptance.v1` never appears. Does not infer causality. Naruon and LineageWeave are refused. Not interpretation-run create CLI, not collection GET, not project-history collection CLI, not persistence. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - `orchestrator_live` loopback `GET /v1/interpretation-runs` enumerates accepted hypothetical interpretation runs on `tepp-orchestrator-loopback` (ADR 0069). Metric-free identities only (`claim_status=hypothetical`, `scientific_authority=false`). `tepp.scientific_acceptance.v1` never appears. Does not infer causality. Naruon and LineageWeave are refused. Not interpretation-run CLI, not project-history collection GET, not persistence. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
crates/orchestrator_live/src/bin/tepp_interpretation_runs.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| //! Operator CLI for loopback contextual-orchestrator interpretation-run POST and collection GET. | ||
|
|
||
| use std::io::{self, IsTerminal}; | ||
| use std::process::ExitCode; | ||
|
|
||
| use orchestrator_live::{ | ||
| execute_interpretation_run_cli, execute_interpretation_run_collection_cli, | ||
| read_interpretation_run_cli_stdin, read_interpretation_run_collection_cli_stdin, | ||
| render_interpretation_run_cli_stdout, render_interpretation_run_collection_cli_stdout, | ||
| InterpretationRunCliInvocation, InterpretationRunCollectionCliInvocation, | ||
| OrchestratorLiveError, | ||
| }; | ||
|
|
||
| fn main() -> ExitCode { | ||
| match run() { | ||
| Ok(()) => ExitCode::SUCCESS, | ||
| Err(_) => ExitCode::FAILURE, | ||
| } | ||
| } | ||
|
|
||
| fn run() -> Result<(), OrchestratorLiveError> { | ||
| let args: Vec<String> = std::env::args().skip(1).collect(); | ||
| match args.first().map(String::as_str) { | ||
| Some("create") => run_create(&args), | ||
| Some("list") => run_list(&args), | ||
| _ => Err(OrchestratorLiveError::InvalidWirePayload), | ||
| } | ||
| } | ||
|
|
||
| fn run_create(args: &[String]) -> Result<(), OrchestratorLiveError> { | ||
| let body = read_interpretation_run_cli_stdin(io::stdin().is_terminal(), io::stdin())?; | ||
| let invocation = InterpretationRunCliInvocation::from_args(args, body)?; | ||
| let response = execute_interpretation_run_cli(&invocation)?; | ||
| let stdout = render_interpretation_run_cli_stdout(&invocation, &response)?; | ||
| println!("{stdout}"); | ||
| if (200..300).contains(&response.status_code) { | ||
| Ok(()) | ||
| } else { | ||
| Err(OrchestratorLiveError::InvalidWirePayload) | ||
| } | ||
| } | ||
|
|
||
| fn run_list(args: &[String]) -> Result<(), OrchestratorLiveError> { | ||
| let body = | ||
| read_interpretation_run_collection_cli_stdin(io::stdin().is_terminal(), io::stdin())?; | ||
| let invocation = InterpretationRunCollectionCliInvocation::from_args(args, body)?; | ||
| let response = execute_interpretation_run_collection_cli(&invocation)?; | ||
| let stdout = render_interpretation_run_collection_cli_stdout(&invocation, &response)?; | ||
| println!("{stdout}"); | ||
| Ok(()) | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
crates/orchestrator_live/src/bin/tepp_orchestrator_loopback.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||||||
| //! Runnable loopback ingress for trusted same-host contextual-orchestrator. | ||||||||||
|
|
||||||||||
| use std::net::SocketAddr; | ||||||||||
|
|
||||||||||
| use orchestrator_live::OrchestratorLiveService; | ||||||||||
|
|
||||||||||
| const DEFAULT_BIND_ADDR: &str = "127.0.0.1:18082"; | ||||||||||
|
|
||||||||||
| fn main() -> Result<(), Box<dyn std::error::Error>> { | ||||||||||
| let mut arguments = std::env::args().skip(1); | ||||||||||
| let bind_addr = arguments | ||||||||||
| .next() | ||||||||||
| .unwrap_or(DEFAULT_BIND_ADDR.to_owned()) | ||||||||||
| .parse::<SocketAddr>()?; | ||||||||||
| let request_limit = arguments | ||||||||||
| .next() | ||||||||||
| .map(|value| value.parse::<usize>()) | ||||||||||
| .transpose()? | ||||||||||
| .unwrap_or(usize::MAX); | ||||||||||
| let mut service = OrchestratorLiveService::bind(bind_addr)?; | ||||||||||
| println!("{}", service.local_addr()?); | ||||||||||
| (0..request_limit).for_each(|_| drop(service.serve_one())); | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Server failures exit successfully
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||||||
| Ok(()) | ||||||||||
| } | ||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 CLI failures expose inconsistent output
Create prints server error bodies before failing, while list suppresses every non-200 body. Operators receive different diagnostics from one consolidated command.
Was this helpful? React with 👍 or 👎 to provide feedback.