Skip to content

Contract doc follow-ups from the #241 review - #249

Merged
DTrim99 merged 1 commit into
mainfrom
contract-doc-followups
Dec 4, 2026
Merged

DTrim99 merged 1 commit into
mainfrom
contract-doc-followups

Conversation

@DTrim99

@DTrim99 DTrim99 commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #241 (Pavel's review suggestions 1, 2 and 4). This PR changes only docs/APP_V3_BILL_CONTRACT.md.

What changes

  • The ratio example (suggestion 1). −697,798,094 / −680,000,000 rounded to four places is 1.0262, not 1.03. Both the JSON example and the sentence now say 1.0262. That is the value compare_estimates.py stores.
  • Band edges (suggestion 2). The text now says that ratios of 0.9 and 1.1 both go to 10_to_25, and that band_of rounds the gap to four places before comparing. Score bills through the Public API App v3 uses (p451 groundwork) #246 makes that code change (56eb57d); before it, floating-point error put a ratio of exactly 0.9 in under_10.
  • Fields App v3 does not read yet (suggestion 4). The rows for session_start_date, session_end_date and session_classification, and for calibration_check, now mark their App v3 use as planned. App v3's fixed processed_bills list in policyengine-app-v2#1658 leaves out the session columns, and no App v3 PR reads calibration_check yet.

Suggestion 3, the stale comment in publish-bill.yml, is fixed in #248, which rewrites that workflow.

Tests

Text only. I recomputed the example ratio: round(-697798094 / -680000000, 4) = 1.0262.

🤖 Generated with Claude Code

Follow-up to Pavel's review of #241.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@PavelMakarchuk PavelMakarchuk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review at 78b6d16

This PR applies the text fixes from the #241 review to docs/APP_V3_BILL_CONTRACT.md. It corrects the ratio example to 1.0262, states that ratios of 0.9 and 1.1 both go to 10_to_25, and marks the session-date fields and calibration_check as planned in App v3. The stale workflow comment moves to #248.

Verdict: APPROVE

Earlier items from the #241 review

  1. SUGGESTION 1, ratio example: fixed. Line 48 and line 57 now say 1.0262. round(-697798094 / -680000000, 4) gives 1.0262. comparison_row in #246 stores round(ratio, 4), so the example matches what the script writes.
  2. SUGGESTION 2, band edge at 0.9: fixed. Line 58 now says that 0.9 and 1.1 both go to 10_to_25, and that band_of rounds the gap first. band_of in #246 (head d1dd247) does gap = round(abs(ratio - 1), 4). I ran it for ratios 0.9, 1.1, 0.75, 1.25, 0.5 and 1.5. Each goes to the wider band, as the text says. band_of gets the unrounded ratio, but the rounded gap and the stored 4-place ratio always give the same band.
  3. SUGGESTION 3, stale comment in publish-bill.yml: moved to #248. #248 replaces the comment with "approved_at (the merge time) and the review PR." That is correct.
  4. SUGGESTION 4, fields App v3 does not read: fixed. Lines 24 and 29 now say "planned". The fixed processed_bills list in policyengine-app-v2#1658 (head 59a897c) is bill_id,state,bill_number,status,legiscan_url,last_action_date, so it leaves out the session columns. No App v3 PR reads calibration_check.

SUGGESTION

  1. scripts/sql/010_add_app_v3_bill_fields.sql:8: the column comment still calls session_name a "session label". The contract (line 23) now says that session_name is the OpenStates session identifier (for example 2027_28), not a display name. The migration comment can make a later author use it as a display name. Fix: change the comment to "OpenStates session identifier, as in processed_bills". The migration uses ADD COLUMN IF NOT EXISTS, so a comment change has no effect on a database where 010 is applied.
  2. docs/APP_V3_BILL_CONTRACT.md:58: the text describes band_of as it is in #246, which is not merged. scripts/compare_estimates.py does not exist on main yet. The line cites "tracker #246", so the text is not wrong, but it is correct only after #246 merges. Fix: merge #246 first, or merge both together.
  3. docs/APP_V3_BILL_CONTRACT.md:24: "its fixed processed_bills list (below)". The paragraph below (line 31) says that App v3 uses fixed column lists, but it does not give the list. Fix: give the list inline, or write "the fixed processed_bills list in policyengine-app-v2#1658".

What I checked

  • The full diff of this PR, and the full contract file at 78b6d16.
  • band_of and comparison_row in scripts/compare_estimates.py at #246 head d1dd247. I ran the example ratio and six band edges in Python.
  • The fixed column list in policyengine-app-v2#1658 at 59a897c. I searched policyengine-app-v2 PRs for calibration_check and found none.
  • scripts/sql/010_add_app_v3_bill_fields.sql on main.
  • The branch starts from fe43e9c (#241's merge). main is now 53aaa7d, and the branch merges cleanly. No CI checks run on this branch. The PR changes only text, so I ran no tests.
  • The head was 78b6d16 at the start and at the end of this review.

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.

2 participants