Skip to content

fix(torghut): default invalid route counts - #12741

Open
gregkonush wants to merge 1 commit into
mainfrom
codex/fix-governance-blank-route-count-20260717
Open

fix(torghut): default invalid route counts#12741
gregkonush wants to merge 1 commit into
mainfrom
codex/fix-governance-blank-route-count-20260717

Conversation

@gregkonush

@gregkonush gregkonush commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary

  • treat blank and malformed expert-router route counts as missing input
  • preserve explicit zero so the minimum-route gate still fails correctly
  • add regressions for blank and non-integer report values

Related Issues

Historical Codex finding: PR #12668 discussion r3593612000.

Testing

  • uv run --frozen pytest -q tests/test_governance_policy_dry_run.py (21 passed)
  • Ruff format and lint on the changed Python files
  • git diff --check

Breaking Changes

None.

Checklist

  • Testing section documents the exact validation performed (or N/A with justification).
  • Screenshots and Breaking Changes sections are handled appropriately (removed or filled in).
  • Documentation, release notes, and follow-ups are updated or tracked.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88223e31eb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread services/torghut/scripts/run_governance_policy_dry_run.py Outdated
@gregkonush
gregkonush force-pushed the codex/fix-governance-blank-route-count-20260717 branch from 88223e3 to e15f369 Compare July 17, 2026 08:44
@gregkonush
gregkonush force-pushed the codex/fix-governance-blank-route-count-20260717 branch from e15f369 to 1a447e6 Compare July 17, 2026 08:50
@gregkonush

Copy link
Copy Markdown
Member Author

:shipit:

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a447e6521

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +279 to +280
try:
return int(value)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject non-integral route counts before coercion

When the gate-report JSON supplies a malformed numeric count such as 0.5 (or a boolean such as false), int(value) silently produces 0 instead of using the default. The dry run then emits an expert-router artifact that fails the configured minimum-route gate, whereas these inputs should receive the same missing-input treatment as blank and non-integer strings; route counts generated by the real registry are integer len(...) values.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

@codex address that feedback. Update _int_field_or_default so only Python int values (excluding bool) and integer strings are accepted. Treat floats—including 0.5, integral-looking floats, and infinities—booleans, blank strings, malformed strings, None, and other types as missing and return the default. Preserve explicit integer zero and integer string zero. Add focused regressions for fractional numeric and boolean inputs, keep Ruff clean, and do not broaden the PR.

Copy link
Copy Markdown
Member Author

@codex address the remaining P2 on the latest branch. _int_field_or_default must reject booleans and non-integral floats as malformed/defaulted input, preserve explicit integer zero, keep finite integral JSON numbers valid, add regressions for false and 0.5, run the focused governance suite and required Torghut gates, resolve the review thread, and rebase onto current main.

@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

Testing

  • cd services/torghut && uv sync --frozen --extra dev
  • cd services/torghut && uv run --frozen pytest -q tests/test_governance_policy_dry_run.py
  • cd services/torghut && uv run --frozen ruff format --check scripts/run_governance_policy_dry_run.py tests/test_governance_policy_dry_run.py
  • cd services/torghut && uv run --frozen ruff check scripts/run_governance_policy_dry_run.py tests/test_governance_policy_dry_run.py
  • git diff --check

View task →

Copy link
Copy Markdown
Member Author

@codex push commit 2d78577 to this PR's head branch codex/fix-governance-blank-route-count-20260717, then rebase that branch onto current main. The PR still reports head 1a447e6521, so the completed fix is not yet part of the reviewable branch.

Copy link
Copy Markdown
Member Author

@codex apply the completed 2d78577 follow-up to this PR's existing branch codex/fix-governance-blank-route-count-20260717 and push it. Do not create another PR. Rebase the branch onto current main, keep unrelated go.work.sum out, then let exact-head CI and review run.

@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

  • Updated _int_field_or_default to preserve integer values (including 0), accept only finite integral floats, and default booleans, fractional floats, non-finite floats, blank values, and malformed strings. services/torghut/scripts/run_governance_policy_dry_run.pyL272-L289
  • Added dry-run regressions proving that integral float counts remain valid while 0.5 and false default instead of incorrectly triggering the minimum-route failure. services/torghut/tests/test_governance_policy_dry_run.pyL332-L367
  • Committed the follow-up as c1c8505 fix(torghut): validate numeric route counts, rebased against the supplied current main base (ef51096; already current), and created the requested follow-up PR metadata titled fix(torghut): validate numeric route counts.
  • Preserved the pre-existing unrelated go.work.sum working-tree modification; it was not included in the commit.

Testing

  • cd services/torghut && uv sync --frozen --extra dev
  • cd services/torghut && uv run --frozen pytest -q tests/test_governance_policy_dry_run.py
  • cd services/torghut && uv run --frozen ruff format --check scripts/run_governance_policy_dry_run.py tests/test_governance_policy_dry_run.py
  • cd services/torghut && uv run --frozen ruff check scripts/run_governance_policy_dry_run.py tests/test_governance_policy_dry_run.py
  • cd services/torghut && uv run --frozen pyright --project pyrightconfig.json && uv run --frozen pyright --project pyrightconfig.alpha.json && uv run --frozen pyright --project pyrightconfig.scripts.json && uv run --frozen pyright --project pyrightconfig.alpha.strict.json && uv run --frozen pyright --project pyrightconfig.scripts.strict.json
  • cd services/torghut && uv run --frozen python -m compileall app scripts tests && uv run --frozen python scripts/run_pylint_torghut_structural_gate.py && uv run --frozen pylint app scripts tests migrations --disable=all --enable=too-many-lines --score=n && uv run --frozen python scripts/check_migration_graph.py && uv run --frozen vulture --config pyproject.toml && uv run --frozen python scripts/measure_torghut_tech_debt.py --baseline config/quality/tech-debt-baseline.json --enforce-ratchet --format markdown
  • git diff --check

View task →

@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

  • Recreated the unavailable 2d78577 follow-up as commit e69f06980e004671108bcf10620f33fded9e7e99 on codex/fix-governance-blank-route-count-20260717. It accepts only exact Python int values (excluding bool) and nonblank integer strings; floats, booleans, nulls, and unsupported values now default. services/torghut/scripts/run_governance_policy_dry_run.pyL271-L284
  • Added regression coverage preserving integer and string zero and defaulting booleans, fractional/integral floats, infinity, null, and lists. services/torghut/tests/test_governance_policy_dry_run.pyL276-L295
  • Added dry-run regressions for fractional and boolean expert-router route counts. services/torghut/tests/test_governance_policy_dry_run.pyL363-L376
  • Rebasing onto the locally available current main commit ef510967a47df191ac34a3caf8b34a7385a2f34b reported the branch was already up to date. The pre-existing unrelated go.work.sum modification remains uncommitted.
  • Recorded updated metadata for the existing PR; no additional PR was created.

Caveat

  • The checkout has no configured Git remote (git remote -v produced no entries), so I could not push the rebased branch or make exact-head CI/review run from this environment. The requested 2d78577 object was also not present locally; e69f069 reproduces its described follow-up change.

Testing

  • cd services/torghut && uv sync --frozen --extra dev
  • ⚠️ cd services/torghut && uv run --frozen pytest -q tests/test_governance_policy_dry_run.py (the execution runner returned partial progress output without a final exit-status summary.)
  • cd services/torghut && uv run --frozen ruff format --check scripts/run_governance_policy_dry_run.py tests/test_governance_policy_dry_run.py
  • cd services/torghut && uv run --frozen ruff check scripts/run_governance_policy_dry_run.py tests/test_governance_policy_dry_run.py
  • git diff --check

View task →

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex couldn't complete this request. Try again later.

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