fix: respect zero policy sample thresholds#3
Merged
Gsbreddy merged 1 commit intoMay 1, 2026
Conversation
Co-authored-by: Gottam Sai Bharath <Gsbreddy@users.noreply.github.com>
Gsbreddy
added a commit
that referenced
this pull request
May 1, 2026
…cstrings (#4) - CHANGELOG.md: add Fixed entry under Unreleased for PR #3 (zero policy sample thresholds were silently ignored due to falsy 'or' fallback; now uses 'is not None' checks) - ledger.py: add docstrings to confidence_label, evaluate_policy, and diff_releases explaining threshold semantics (None vs 0 vs config default), confidence label tiers, constraint fields, and agent-id invariant - models.py: add Policy class docstring explaining the None/0 distinction for min_* threshold fields versus constraint (max_*) fields - schemas/v1/policy.schema.json: regenerated to pick up Policy docstring Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Gottam Sai Bharath <Gsbreddy@users.noreply.github.com>
Gsbreddy
added a commit
that referenced
this pull request
May 1, 2026
* feat: FlightDeck 1.0.1 package and v1 rollout readiness Ship the local-first CLI, schemas, tests, and CI. Slim-repo docs link to canonical flightdeckdev/flightdeck main. OpenTelemetry is optional-only. Also: pytest basetemp under .tmp/pytest for Windows, Python 3.13–3.14 in CI, ruff 0.15.12 aligned with ruff-pre-commit, pre-commit-hooks v5, .gitattributes LF for golden bundle, CHANGELOG 1.0.1 section and empty Unreleased, RELEASE_NOTES v1.0.1 patch notes, README quickstart_smoke first. Co-authored-by: Cursor <cursoragent@cursor.com> * adds pypi fixes * adds ci fixes * fix: respect zero policy sample thresholds (#3) Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Gottam Sai Bharath <Gsbreddy@users.noreply.github.com> * Fix promotion audit sequencing (#5) Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Gottam Sai Bharath <Gsbreddy@users.noreply.github.com> * docs: document zero-threshold policy fix and improve ledger/policy docstrings (#4) - CHANGELOG.md: add Fixed entry under Unreleased for PR #3 (zero policy sample thresholds were silently ignored due to falsy 'or' fallback; now uses 'is not None' checks) - ledger.py: add docstrings to confidence_label, evaluate_policy, and diff_releases explaining threshold semantics (None vs 0 vs config default), confidence label tiers, constraint fields, and agent-id invariant - models.py: add Policy class docstring explaining the None/0 distinction for min_* threshold fields versus constraint (max_*) fields - schemas/v1/policy.schema.json: regenerated to pick up Policy docstring Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Gottam Sai Bharath <Gsbreddy@users.noreply.github.com> --------- Co-authored-by: zendaya <zendaya@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Gottam Sai Bharath <Gsbreddy@users.noreply.github.com> Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com>
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.
Summary
Fix policy sample-threshold overrides so explicit zero values are honored instead of falling back to workspace defaults.
Why
Policypermitsmin_baseline_runs,min_candidate_runs, andmin_low_runsto be0, but the diff logic used truthiness fallback. That made0behave like unset and could incorrectly block promotion on sample-confidence policy.Changes
is not Nonechecks indiff_releases.Validation
uv run python -c "from flightdeck.ledger import diff_releases; from flightdeck.models import Policy, PricingTable, WorkspaceConfig; policy=Policy(require_high_diff_confidence=True,min_candidate_runs=0,min_baseline_runs=0,min_low_runs=0); table=PricingTable(provider='openai', pricing_version='p', entries=[]); result=diff_releases(cfg=WorkspaceConfig(), policy=policy, baseline_events=[], candidate_events=[], baseline_pricing_table=table, candidate_pricing_table=table, window='7d'); print(result.confidence); print(result.policy.passed); print(result.policy.reasons)"uv run python -m pytest tests/test_ledger.pyuv run python -m ruff check src testsuv run python -m pytestuv run python scripts/quickstart_smoke.pySchema / Storage Impact
Risk
Low. The change only distinguishes explicit zero thresholds from omitted thresholds.
Notes
Bug was reproduced before the fix: explicit zero thresholds returned
LOW,False, and a default-threshold policy failure. After the fix, the same repro returnsHIGH,True, and no policy reasons.