Skip to content

fix(cli): support equals-syntax and safe float validation for provider pricing flags - #5031

Closed
Adityakk9031 wants to merge 1 commit into
Graphify-Labs:v8from
Adityakk9031:fix/cli-provider-pricing-args
Closed

Adityakk9031 wants to merge 1 commit into
Graphify-Labs:v8from
Adityakk9031:fix/cli-provider-pricing-args

Conversation

@Adityakk9031

Copy link
Copy Markdown
Contributor

Summary

In graphify/cli.py under graphify provider add:

  • Flags --base-url=, --default-model=, and --env-key= supported --flag=val syntax, but --pricing-input and --pricing-output only supported --pricing-input <val> and silently ignored --pricing-input=<val>.
  • Non-float values passed to --pricing-input or --pricing-output raised an unhandled ValueError traceback instead of an informative error message on stderr with exit code 1.

Changes

  • In graphify/cli.py (dispatch_command):
    • Added support for --pricing-input= and --pricing-output=.
    • Added safe try/except ValueError parsing with clean error messages printed to sys.stderr and sys.exit(1).
  • In tests/test_provider_registry.py:
    • Added test_dispatch_command_provider_add_with_pricing_equals.
    • Added test_dispatch_command_provider_add_invalid_pricing_float.

Test Plan

  • pytest tests/test_provider_registry.py -> 10 passed.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Thanks for the pull request, @Adityakk9031. A maintainer will review it soon.

Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions.

A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic.

@github-actions github-actions Bot added the contributor Pull request from a returning community contributor label Nov 5, 2026

@graphify-labs graphify-labs 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.

Graphify reviewed this change.

No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.

Not checked: tests were not run; formal verification proved 0 of 1 changed function(s) (1 not verified).

Formal verification. PR-changed functions: 0/1 verified (0 proven, 0 may-equivalent, 0 distinguished) · 1 not verified (1 vacuous).

Not verified on this run: dispatch\_command (vacuous: never exercised).


Graphify review — findings

Fixes graphify provider add so --pricing-input and --pricing-output also accept the --flag=VALUE form, which was previously ignored. A non-numeric value now prints a clear error and exits 1 instead of crashing with a ValueError traceback. The parsing only rejects unparseable floats, so values like nan, inf and negatives still pass through into the stored pricing.

No blocking issues surfaced.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 481 functions depend on the 114 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: dispatch_command() — 7 callers, 146 callees

Verification — 481 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 421 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

45 of 526 test file(s) selected (9%) via static blast radius.

  • tests/test_affected_cli.py — impact
  • tests/test_affected_seed_reference_forms.py — impact
  • tests/test_agents_platform.py — impact
  • tests/test_cli_export.py — impact
  • tests/test_cloud_cta.py — impact
  • tests/test_codebuddy.py — impact
  • tests/test_compact_graph_json.py — impact
  • tests/test_confidence_score_output.py — impact
  • tests/test_dedup_shrink_refuses_force_write.py — impact
  • tests/test_devin.py — impact
  • tests/test_edge_also_seen.py — impact
  • tests/test_explain_cli.py — impact
  • tests/test_explain_same_file_tie.py — impact
  • tests/test_extract_cli.py — impact
  • tests/test_extract_cost_ledger.py — impact
  • tests/test_global_add_tag_inference.py — impact
  • tests/test_god_nodes_cli.py — impact
  • tests/test_hollow_chunks_arm_shrink_guard.py — impact
  • tests/test_hook_content_freshness.py — impact
  • tests/test_hook_guard_token_match.py — impact
  • tests/test_hook_nudge_wording.py — impact
  • tests/test_hook_out_of_project_paths.py — impact
  • tests/test_hook_strict.py — impact
  • tests/test_hook_strict_grep.py — impact
  • tests/test_incomplete_build_guard.py — impact
  • tests/test_install.py — impact
  • tests/test_install_references.py — impact
  • tests/test_lookup_exit_codes.py — impact
  • tests/test_merge_chunks_validation.py — impact
  • tests/test_multigraph_diagnostics.py — impact
  • tests/test_no_dedup_flag.py — impact
  • tests/test_opencode_plugin_refresh.py — impact
  • tests/test_partial_cache.py — impact
  • tests/test_path_cli.py — impact
  • tests/test_path_confidence.py — impact
  • tests/test_path_type_member.py — impact
  • tests/test_provider_registry.py — impact, changed-test
  • tests/test_query_cli.py — impact
  • tests/test_query_induced_edges.py — impact
  • tests/test_query_seeds.py — impact
  • tests/test_search_hook_scope.py — impact
  • tests/test_skill_auto_refresh.py — impact
  • tests/test_stale_prune.py — impact
  • tests/test_truncation_full_answer.py — impact
  • tests/test_unverified_semantic_shrink.py — impact

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

Formal verification

Could not verify: Could not verify dispatch\_command.

The verifier did not have enough to check dispatch\_command, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: no capturable inputs from the test suite; property tier: not verifiable: all 40 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly SystemExit — names the real obstacle, not a sampling gap)

· 1 more finding(s) on lines outside this diff (see the check run).

safishamsi added a commit that referenced this pull request Nov 8, 2026
…w-up)

The landed fix caught a non-numeric price but still accepted nan, inf and
negative values, which parse as floats and then flow into cost estimation as
NaN/inf/negative. Validate each --pricing-input/--pricing-output through
_valid_price (finite and >= 0) with the same clean error + exit(1), and test
that nan/inf/-inf/1e999/-5 are rejected.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@safishamsi

Copy link
Copy Markdown
Member

Landed on v8 and shipped in 0.9.104 (now on PyPI), cherry-picked with -x. Follow-up: the parse accepted nan/inf/negative values (they parse as floats and then flow into cost estimation); I added a finite-and-non-negative guard with the same clean error + exit(1), plus a test. Thanks @Adityakk9031.

@safishamsi safishamsi closed this Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor Pull request from a returning community contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants