Repository navigation
Stop ignoring mistyped transition thresholds - #836
Merged
Merged
Conversation
The transition assets read quality-gate thresholds with _env_float and _env_int. Both caught every parse error and returned the default, so a value such as "0,8" or "abc" was dropped without a trace and the run used a different threshold than the operator set. Add env_float and env_int to sbir_etl/config/loader.py. An unset, empty, or blank variable still returns the default. A set value that does not parse raises ValueError naming the variable and the value. env_float also rejects nan and inf, because a non-finite threshold makes every comparison pass or fail. The transition utils now re-export these readers under their old names, so the 19 call sites keep working unchanged. Tests cover the helpers and one real asset check (contracts_sample_quality_check). The three bad-value check tests fail on main with "DID NOT RAISE". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012JfLFUjobV2gCR9fEoypYT
3 tasks done
transformed_transition_evidence read the contracts-sample and vendor-resolution thresholds inside best-effort try/except blocks. A bad value such as "0,8" raised ValueError, the block swallowed it, and the gate entry vanished from reports/validation/transition_mvp.json. The reads now happen before those blocks, so a bad value stops the asset. The blocks still guard reading the optional checks JSON files. scripts/ci/gate_check.py kept its own _env_float that returned the default on any parse error. It now uses sbir_etl.config.loader.env_float, so MIN_AWARD_RATE and MIN_COMPANY_RATE fail the same way. ruff format also reflowed one print call in that file. New tests: the evidence asset and the analytics gate raise on "0,8"-style values. All three fail on the previous commit with "DID NOT RAISE". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012JfLFUjobV2gCR9fEoypYT
hollomancer
pushed a commit
that referenced
this pull request
Nov 21, 2026
Resolve the conflict in assets/transition/utils.py: #836 replaced the local error-swallowing _env_float/_env_int with imports from sbir_etl.config.loader, and this branch removed the _norm_name wrapper. Keep neither local block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012JfLFUjobV2gCR9fEoypYT
This was referenced Nov 21, 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.
Description
Problem. The transition assets read their quality-gate thresholds through
_env_floatand_env_intinpackages/sbir-analytics/sbir_analytics/assets/transition/utils.py. Both helpers caught every exception and returned the default. If an operator setSBIR_ETL__TRANSITION__CONTRACTS__DATE_COVERAGE_MIN=0,8orabc, the run quietly used 0.90 and left no trace.Change.
env_float(key, default)andenv_int(key, default)tosbir_etl/config/loader.py.sbir_etl/config/had no numeric env reader before this, so these are new. (The existing_convert_env_valueguesses a type for generic overrides and falls back to a string. It does not do this job.)" 0.8 "gives 0.8).ValueErrornaming the variable and the value, for exampleEnvironment variable SBIR_ETL__...=' 0,8' is not a valid number.env_floatalso rejectsnanandinf. Every threshold comparison against a non-finite value fails, or every one passes, so a non-finite threshold is never what the operator meant.env_intrejects"5.0"and"1e3". It does not round.transition/utils.pynow re-exports these as_env_float/_env_int. The two copies that swallowed errors are deleted.Call sites touched. All 28
_env_float/_env_intcalls intransition/(analytics, checks, contracts, detections, evidence, scoring, vendor_resolution). None of them changed. They now pick up the strict behavior through the re-export. (The commit message says 19. The correct count is 28.)What was not changed.
packages/andsbir_etl/for env reads wrapped in try/except. I found no other numeric parser that swallows errors.uspto/utils.py(TRANSFORM_SUCCESS_THRESHOLD,LINKAGE_TARGET) andcet/validation.pycallfloat(os.environ.get(...))directly. A bad value there already raises, although the message does not name the variable.uspto/ai_extraction.pyreads only paths and table names._env_boolstill treats any value it does not recognize as false. This PR covers numeric parsing only.phase_transition/utils.parse_data_cut_datelogs a warning on a bad date and falls back to today. This is a date read, not a numeric one, so I left it out of scope. It may deserve its own fix.SBIR_ETL__*reads through the loader is not part of this PR.Type of Change
A run that used to continue with a mistyped threshold will now stop with an error. That is the intended fix.
Versioning Impact
Testing
tests/unit/config/test_env_numbers.py(31 cases): unset and empty/blank values return the default; valid int and float values parse, with whitespace; these must fail:abc,0,8,1e,nan,NaN,inf,-inf,80%for float, andabc,0,8,1e,5.0,1e3,10,000for int.tests/unit/assets/test_transition_env_thresholds.py: calls the realcontracts_sample_quality_check. A badDATE_COVERAGE_MIN(0,8,abc) orSAMPLE_SIZE_MIN(1e3) must raise. A valid" 0.5 "must show up in the check metadata.On main: the 3 bad-value asset-check tests fail with
DID NOT RAISE. The helper tests fail at import because the helper did not exist yet.Passed locally: ruff check and ruff format --check on the changed files,
uv run mypy sbir_etl,make lint-boundaries,Definitions.validate_loadable(defs), andpytest -n auto -m "not slow" tests/unit(7102 passed, 7 skipped).Unit tests added/updated
All tests pass locally
Generated by Claude Code