Add units to reachability timeout/memory-limit flags#236
Open
Martin Torp (mtorp) wants to merge 1 commit into
Open
Add units to reachability timeout/memory-limit flags#236Martin Torp (mtorp) wants to merge 1 commit into
Martin Torp (mtorp) wants to merge 1 commit into
Conversation
--reach-analysis-timeout now accepts an optional duration unit (s/m/h, e.g. 90s, 10m, 1h) and --reach-analysis-memory-limit an optional size unit (MB/GB, case-insensitive, e.g. 512MB, 8GB). Values are forwarded verbatim to the reachability engine (@coana-tech/cli), which owns parsing and validation, so the unit grammar and error messages live in a single source of truth. To pass values through unchanged, the four flags (incl. the hidden --reach-timeout/--reach-memory-limit aliases) drop type=int and accept raw strings; the dataclass fields become Optional[str]. A defensive str() is kept at the coana forward point so config-file JSON numbers (which bypass argparse's type converter via set_defaults) still reach subprocess as strings, and the guard uses `is not None` so an explicit empty string flows through and triggers coana's own error rather than being silently dropped. Bare numbers remain accepted for backward compatibility (seconds for the timeout, MB for the memory limit) but are no longer documented. Bumped the pinned @coana-tech/cli version to 15.5.0, which ships the unit parser. Docs (cli-reference) and CHANGELOG updated; unit tests cover unit-bearing values, bare-int back-compat, and int coercion.
|
🚀 Preview package published! Install with: pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==2.4.11.dev1Docker image: |
Benjamin Barslev Nielsen (barslev)
approved these changes
Jun 18, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds optional units to the reachability resource flags. The reachability engine (
@coana-tech/cli) owns the unit grammar, parsing, and validation; the Python CLI passes the value through verbatim, so there is a single source of truth.--reach-analysis-timeout(alias--reach-timeout): optional duration units/m/h— e.g.90s,10m,1h.--reach-analysis-memory-limit(alias--reach-memory-limit): optional size unitMB/GB, case-insensitive — e.g.512MB,8GB.--reach-concurrencyis unchanged (unitless,>= 1).How
type=inton the four flags → accept raw strings; dataclass fieldsreach_analysis_timeout/reach_analysis_memory_limitbecomeOptional[str]. Values forward verbatim to coana--analysis-timeout/--memory-limit.str()is kept at the coana forward point: config-file values bypass argparse'stype=converter viaset_defaults, so a JSON number can arrive as anint;str()is idempotent for unit strings ("10m"→"10m") and just guaranteessubprocessreceives a string. This is not unit parsing.if x is not None(instead of truthiness) so an explicit empty string flows through and triggers coana's own error, rather than being silently dropped.DEFAULT_COANA_CLI_VERSION15.3.24→15.5.0, which ships the unit parser.Backward compatibility
Bare numbers still work exactly as before — seconds for the timeout, MB for the memory limit. This legacy form is no longer documented but continues to function.
Docs / tests
docs/cli-reference.mdtable rows updated (units + new pin); help text mirrors coana's wording.CHANGELOG.mdentry added.