Skip to content

Review follow-ups from #244 and #248–#251 - #253

Open
DTrim99 wants to merge 5 commits into
mainfrom
review-followups-1204
Open

DTrim99 wants to merge 5 commits into
mainfrom
review-followups-1204

Conversation

@DTrim99

@DTrim99 DTrim99 commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Pavel's suggestions from the reviews of #244 and #248–#251, which merged before they could go in. One commit per source PR. #250's suggestion 2 (omnibus bills dropped by older exclusions) predates #250 and has its own PR, stacked on this one.

#244: triage

  • A text that can't be read is retried weekly (suggestion 11). record_fetch_failure stores the date of the last try. After two failed tries, a link waits 7 days (RETRIAGE_RETRY_DAYS) and is tried once more; a failed retry restarts the wait. Each run prints how many bills are waiting. A row from before this change has no date, so it counts as due and gets one retry, which then records a date.
  • VT and RI enacting clauses (suggestion 12). _BILL_TEXT_MARKERS matches "It is (hereby) enacted". "Enacted: 2025-05-01" and "Enacted Legislation" still don't match.

#248: publishing

  • One deploy at a time (suggestion 1). The checkout and modal deploy steps move to a deploy job (needs: publish, concurrency group publish-bill-deploy, no cancelling). The publish job has no group, so no Supabase write is cancelled. A cancelled pending deploy is safe, since the newest deploy reads every published row.
  • Whole-value checks (suggestion 2). The PR number and reform ID checks use bash [[ =~ ]] under LC_ALL=C, so a value with one good line no longer passes.
  • Fork PRs in the contract (suggestion 4). The doc says a fork PR needs gh workflow run publish-bill.yml -f pr=N.
  • Suggestion 3 (the fork count in Publish bills on pull_request; GitHub now blocks pull_request_target #248's description) is corrected there.

#249: contract doc

#250: relevance filter

  • Overtime before film (suggestion 1). "No tax on overtime; film production credit" and the overtime-deduction abstract now pass. Also drops an unused import json.
  • Suggestion 3 (New York local property tax credits): no change, as the review says.

#251: readiness lookup

  • C. The line reads "Not moved in TX in the 2026 trace: …" and names only outcome variables the map has (TX no longer names tx_income_tax). The sources line gives the trace year. resolve() returns unreached_variables; older saved JSON still renders.
  • D. A bad, empty, non-UTF-8 or missing --reform-json file exits 1 with <path>: <error>, not a traceback.
  • E. Reform-dict tests: TX with the homestead path (outcome dropped), and GA with a homestead path plus main.flat_rate (outcome kept). Neither the live trace nor the fixture has a Georgia homestead parameter, so the GA test adds one to a copy of the map inside the test; the fixture files are unchanged.

Checks

  • pytest scripts/ (without test_compute_impacts_datasets.py): 288 passed (278 on main).
  • ruff check on every changed file: clean. ruff check scripts/ as a whole still reports 8 errors in files this PR doesn't touch (9 on main).
  • actionlint on publish-bill.yml: clean. The "Read the review PR" step, run locally with a fake gh: bill/ga-sb168 passes; bill/x + newline + y, bill/, feature/x, bill/ga$(id), uppercase and leading-dash IDs are refused, as are PR numbers with text, newlines or non-ASCII digits.

🤖 Generated with Claude Code

DTrim99 and others added 5 commits December 4, 2026 11:15
Follow-ups from the #244 review (suggestions 11 and 12).

11. A link whose text could not be read on RETRIAGE_FETCH_TRIES runs was
skipped until the link changed, so a site that was down on two daily
runs hid each new version from it for good, and the skipped bills left
the log. record_fetch_failure now stores the date of the failed try in
priority_signals.text_fetch_failed.last_try, and retriage_candidates
makes the bill a candidate again once RETRIAGE_RETRY_DAYS (7) days have
passed since that try. A retry that fails again counts a try and starts
the wait over; a link tried on fewer than RETRIAGE_FETCH_TRIES runs is
retried on the next run, as before. Each --retriage-changed run prints
how many bills it leaves out this way.

Records written before this change hold {url, tries} with no date. They
are treated as due: the link is tried once more on the next run, and a
failure then records the date. #244 merged on 3 December, so such rows
are at most a day or two old and few; the alternative (skip until 7
days from now) would need the candidate filter to write a date, or a
hard-coded deploy date. An unreadable date counts as no date.

12. _BILL_TEXT_MARKERS also matches "It is hereby enacted" (VT) and "It
is enacted" (RI), with both added to the parametrized clause cases.
Status text such as "Enacted: 2025-05-01" still does not match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-ups from the #248 review (suggestions 1, 2 and 4).

1. Two publish runs could deploy at once, and modal_app.py pre-renders
the pages from Supabase at deploy time, so an older deploy that
finished last left the later bill off the live pages. The checkout,
Modal install and redeploy steps move to a new `deploy` job with
`needs: publish` and the concurrency group publish-bill-deploy
(cancel-in-progress: false). The group is on the deploy job only:
GitHub keeps one pending run per group, so on the publish job a third
run would cancel the second before it wrote its Supabase row, while a
cancelled pending deploy is safe because the newest deploy reads every
published row. The deploy job has `contents: read`, the Modal secrets
and its own Python 3.11 setup, and runs only when publish succeeds
(the default for `needs`).

2. The reform id and the manual PR number are checked as whole strings
with bash's [[ =~ ]] in place of `printf | grep -Eq`, which passed a
value with one matching line. The step sets `shell: bash` and
LC_ALL=C, so [a-z] means ASCII a to z.

4. The contract says that a review PR from a fork does not publish on
merge, with the command to publish it.

Checked with actionlint, and by running the step locally with a stub gh
(no secrets, no API calls): bill/ga-sb168 gives ga-sb168; bill/x +
newline + y (which the grep check passed), bill/, feature/x,
bill/ga$(id), bill/GA-SB168 and bill/-ga are refused; a manual run for
a stubbed merged PR passes, and "1; echo pwned", 219 + newline + x, an
empty value and non-ASCII digits are refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-ups from the #249 review (suggestions 1 to 3).

1. Migration 010's column comment called research.session_name "the
bill's session label"; it now says "OpenStates session identifier, as
in processed_bills", as the contract does. Comment only: 010 is applied
in production, and no DDL changes.

2. The band_of text describes scripts/compare_estimates.py from #246,
which is not merged, so it is marked "Planned (#246)", as the doc marks
other planned items.

3. "its fixed processed_bills list (below)" pointed at a list the doc
does not give. It now names the list in policyengine-app-v2#1658 and
gives it inline: bill_id,state,bill_number,status,legiscan_url,
last_action_date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up from the #250 review (suggestion 1). The rule from #250 is
that a film or TV production credit drops a bill only when nothing more
specific than broad income tax wording matches. The overtime phrases
name a household provision, but they ran after the production-credit
check, so "No tax on overtime; film production credit" and an omnibus
abstract with an overtime deduction and a film credit dropped. The
overtime check (both the phrases and bare "overtime" with income tax
context) now runs before the production-credit check; the broad
keywords still come after it.

Both examples are added as True cases, the title to test_relevance and
the abstract next to the omnibus film-credit case. Suggestion 3 (New
York local real property tax credits) needs no change.

Also drops the unused `import json` (ruff F401) from this file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-ups from the #251 review (suggestions C, D and E).

C. The reach test runs on one year of the trace (the map's model.year),
so a credit that joins the income tax in a later year shows as "not
moved", and the markdown did not say which year. The line now reads
"Not moved in RI in the 2026 trace: ...", and the sources line adds
"trace year 2026". The line also named tx_income_tax, which the map
does not have: resolve() now returns unreached_variables, the outcome
variables the map names for each unreached outcome, and the line names
only those (with its own wording when the map has none). JSON saved
before this field still renders, naming both variables as before.

D. A --reform-json file that cannot be read or parsed (bad JSON, an
empty file, a missing path) exits 1 with "<path>: <error>", as the
other reform-file checks do, in place of a traceback. A file that is not
UTF-8 is caught the same way.

E. Tests for the reform-dict path of the outcome check: the Texas
homestead exemption as a reform dict drops state_income_tax, as the
kind does. The trace records no Georgia homestead parameter, so the
Georgia case adds a made-up one (whose reader reaches nothing) to a
copy of the fixture map in the test; the fixture files are unchanged,
so they still match --save-fixtures. Alone it drops the outcome; with
main.flat_rate the readers of both paths are checked together and the
outcome stays.

Checked offline on a copy of the 3 December downloads: TX homestead (as
a kind and as a reform dict) and an RI child tax credit dict give the
new lines, and the three bad files exit 1 with one line each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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