Skip to content

Decouple wait_for_readiness from CLI parsing && fix minor typos#26

Open
S0nee wants to merge 2 commits intotempoxyz:mainfrom
S0nee:S0nee-patch-1
Open

Decouple wait_for_readiness from CLI parsing && fix minor typos#26
S0nee wants to merge 2 commits intotempoxyz:mainfrom
S0nee:S0nee-patch-1

Conversation

@S0nee
Copy link

@S0nee S0nee commented Feb 25, 2026

This PR removes the direct CliArgs::parse() call from wait_for_readiness and instead passes timeout as a parameter from main.

Previously, wait_for_readiness re-parsed CLI arguments internally to access the timeout value. This created tight coupling between the function and the CLI layer.

Although this worked for the current binary use case, it has several architectural drawbacks:

  • The function depended directly on CLI parsing.
  • It could not be reused programmatically without CLI context.
  • CLI parsing was executed twice.

wait_for_readiness is business logic and should not depend on how configuration is obtained.

What Changed:

  • Added timeout: Duration parameter to wait_for_readiness
  • Removed internal CliArgs::parse() call
  • Passed Duration::from_secs(args.timeout) from main
  • Updated timeout error message to use timeout.as_secs()

Fixed syntactic errors: transacion > transaction in main.rs and in the root README.


Notes:
These changes are primarily architectural improvements and are not critical fixes.

Removed the direct CliArgs::parse() call from `wait_for_readiness` and instead passes `timeout` as a parameter from `main`.

Previously, `wait_for_readiness` re-parsed CLI arguments internally to access the `timeout` value. This created tight coupling between the function and the CLI layer.

Although this worked for the current binary use case, it introduced several architectural drawbacks:
- The function depended directly on CLI parsing.
- It could not be reused programmatically without CLI context.
- CLI parsing was executed twice.

`wait_for_readiness` is business logic and should not depend on how configuration is obtained.

What Changed:
- Added `timeout`: Duration parameter to `wait_for_readiness`
- Removed internal `CliArgs::parse()` call
- Passed `Duration::from_secs(args.timeout)` from `main`
- Updated timeout error message to use `timeout.as_secs()`
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