Skip to content

Conversation

nabil-Tounarti
Copy link
Contributor

No description provided.

@nabil-Tounarti nabil-Tounarti requested a review from Copilot August 26, 2025 09:33
@nabil-Tounarti nabil-Tounarti self-assigned this Aug 26, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the PreComputeApp struct to remove unnecessary Option fields and improve the API design by requiring essential parameters at construction time rather than during execution.

  • Removes Option<> wrappers from chain_task_id and pre_compute_args fields in PreComputeApp
  • Updates the constructor to accept required parameters directly instead of using a parameterless new() method
  • Moves initialization logic from the run() method to the application startup in app_runner.rs

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/compute/pre_compute_app.rs Refactors struct fields from Optional to required, updates constructor signature, simplifies field access throughout implementation
src/compute/app_runner.rs Moves initialization logic from PreComputeApp to the runner, updates function signatures to pass chain_task_id as parameter

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@nabil-Tounarti nabil-Tounarti marked this pull request as ready for review August 29, 2025 09:35
let pre_compute_args = match PreComputeArgs::read_args() {
Ok(pre_compute_args) => pre_compute_args,
Err(_) => {
return ExitMode::InitializationFailure;
Copy link
Contributor

Choose a reason for hiding this comment

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

This exit mode is specific to missing task ID. Using it here will provoke breaking changes in the API and the loss of information in the protocol.
On read_args error, we still need to call the send_exit_cause API to send to worker the error.
This can not be done as is and should bi discussed in another refactoring operations at a later time

@@ -5,7 +5,7 @@ use crate::compute::utils::env_utils::{TeeSessionEnvironmentVariable, get_env_va
///
/// This structure aggregates configuration parameters from environment variables and task context,
/// providing a validated interface for subsequent computation phases.
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Default)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not forget advice from the training

Suggested change
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]

Copy link
Contributor

Choose a reason for hiding this comment

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

Are all the derive required for production code or are some only used for tests ?

Comment on lines 36 to 40
/// let chain_task_id = "0x123456789abcdef";
/// let pre_compute_args = PreComputeArgs::read_args()?;
///
/// let pre_compute_app = PreComputeApp::new(pre_compute_args, chain_task_id);
/// let exit_code = start_with_app(&pre_compute_app, &chain_task_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be fixed to reflect current state of the code

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.

2 participants