Repository navigation
Give special-session bills their own research IDs from 2027 - #252
Conversation
From the 2027 sessions on, a special-session bill got the same research ID and UI key as the regular-session bill with its number (KY HB 1 in 2027S1 and 2027RS were both ky-hb1-2027), so triage treated it as encoded and the UI opened the regular session's analysis. Follow-up to #239 (Pavel's review suggestion 1). - bill_identity.special_session gives a special session's marker: "s1" for "2027S1", Texas "901" or "2027 First Special Session", "s" when the label gives no number. session_suffix adds it to the session year, so research IDs become ky-hb1-2027s1 / ky-hb1-2027s. Regular-session and pre-2027 IDs are unchanged. - Special-session detection now also reads the OpenStates identifiers that don't say "special" (KY 2027SS, GA 2027_ss, IN/OK/VT ss1, MS 20271E, WV 20271S, NC 2027E1, NM/SD 2027S, ID 2027spcl, Texas "Called"); checked against every session in the OpenStates scrapers' metadata with no regular session flagged. - same_session keeps special sessions with different markers apart (2027S1 vs 2027S2), and session_years no longer widens a special session to the regular term (Virginia 2027S1 is 2027, not 2026). - researchId.js mirrors all of this: specialSession, sessionSuffix, billKey/processedBillKey with the marker (KY:HB1:2027S1), and parseResearchId reads it back (sessionSuffix). StatePanel's fallback key passes the full suffix. - encode-bill, triage-bills and db-writer describe the new suffix (and drop the va-hb979-2027 example, which the code never produces). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PavelMakarchuk
left a comment
There was a problem hiding this comment.
Review at d067da9
This PR gives a special-session bill its own research ID from the 2027 sessions on. bill_identity.special_session reads a marker (s1, s2, or a bare s) from the session label, and session_suffix adds it to the session year: KY 2027S1 gives ky-hb1-2027s1, and Texas 901 gives tx-hb1-2027s1. The rule now also finds OpenStates special-session forms that do not say "special" (2027SS, 2027_ss, 20271E, 20271S, 2027E1, 2027S, 2027spcl). same_session keeps special sessions with different markers apart. researchId.js mirrors the rules, so the tracker UI keys a special-session bill as KY:HB1:2027S1.
Verdict: APPROVE
Thanks, David. This fixes the suggestion from the #239 review. I found no blocking problem. Python and JS agree on every label that I tried, and no research ID before 2027 changes. I have two small suggestions.
SUGGESTION
- Special sessions before 2027 that the rule now detects pass deduplication, but they keep the research ID of the regular bill.
scripts/bill_identity.py:99-103,scripts/bill_identity.py:257,scripts/bill_identity.py:282.- Case:
processed_billshas KY HB 1 from2026RS. At main, the monitor drops HB 1 from2026SSas a duplicate. At d067da9,ProcessedBills.containsreturns False, so the monitor adds the row. Its research ID isky-hb1, the same as the regular bill. Ifky-hb1exists,is_encodedreturns True, and the UI keyKY:HB1opens the regular-session analysis. I confirmed this with a probe. - The same applies to the other forms that are new in this PR (GA
2026_ss, MS20261E, WV20262S, NC2025E1, NM2025S, SD2025s, IDspcl, INss1, OKSS1). Only a few such bills are likely before January 2027, because the monitor looks at recent bills. - This is the known limit before 2027 (the PR body lists AR
2026S1as unchanged). Fix: add one line about it under "Not used" in the PR body, or keep these labels out of the special-session rule before 2027. I do not ask for a code change.
- Case:
scripts/prerender.mjs:51-52does not remove the session suffix when it reads a bill number from the ID. Forky-hb1-2027s1it givesHB1-2027S1.src/context/DataContext.jsx:166usesparseResearchIdand givesHB1. This path runs only when the title has no bill number, and the year suffix from #239 has the same behavior. Fix (optional, or as follow-up work): useparseResearchId(id).billPartsinprerender.mjs.
Dependencies
- The branch merges cleanly with the current
main(53aaa7d). - #244 and #245 each have a text conflict with this branch in
.claude/commands/triage-bills.md(the "already-encoded" comment). Both merge cleanly withmainalone, so the second PR to merge must resolve it. #246 merges cleanly.
What I checked
- Diff.
fe43e9c..d067da9: 1 commit, 9 files, all read. I also read the callers:openstates_monitor.py(dedup),auto_triage.py(is_encoded),refresh_bill_status.py(session check),StatePanel,RedesignHome,DataContextandprerender.mjs. - Parity probe, Python against JS. I read the session identifiers from the OpenStates scrapers' metadata for 55 jurisdictions (1,068 labels). I added 120 written labels: regular,
S1,2027S1, "1st Special Session", "First Special Session", "Extraordinary", Texas90/90R/901/902and "Called Session", Colorado2027A/2027B, Virginia, Wisconsin, Congress, and empty labels. For each of the 1,188 labels, I comparedsession_years,special_session,session_suffix,processedBillKeyagainstresearchBillKey(research_id(...)), and theparseResearchIdround trip. There were 0 mismatches. - IDs before 2027 and existing IDs. Against main,
research_idchanges for 156 label and bill cases. All of them are 2027 or later special sessions. 18 of them had no suffix at main: Virginia2027S1, Mississippi20271Eand West Virginia20271S, which read as 2026 or had no year before. No label before 2027 gets a new ID. For 1,080 research IDs in the existing shapes (co-hb26-1062,ga-hb463-2026,ct-sb00078,us-hr1425, plain IDs),parseResearchIdandresearchBillKeygive the same result as at main. findBillResearch. With onlyky-hb1-2027(with or withoutlegiscan_bill_id), the2027S1and2027SSbills are now unanalyzed. At main they openedky-hb1-2027. With both rows, each session opens its own analysis.tx-hb1-2027s1matches the901bill only.ky-hb1matches the2026RSbill only. A row that names alegiscan_bill_idstill wins over the key, as before.- Deduplication. Against main,
same_sessionchanges for 319 label pairs. Each change keeps two special sessions apart (2027S1vs2027S2,2027vs2027SS), except two pairs that now match: KY "2027 Special Session" with2027SS, and TX "2027 First Special Session" with "90th Legislature 1st Called Session". Florida and Colorado lettered sessions are not special, and no regular OpenStates label is marked special. - Tests.
pytest scripts/: 289 passed (164test_bill_identity.py, 43test_openstates_monitor.py, 31test_readiness_lookup.py, 29test_compute_impacts_datasets.py, 8test_refresh_bill_status.py, 8test_publish_analysis.py, 6test_auto_triage.py).bunx vitest run: 190 passed in 10 files.bun run build: passes. With the main versions ofresearchId.jsandStatePanel.jsx, the 2 newBillActivityFeedspecial-session tests fail, as the PR body says. - Lint.
eslinton the 4 changed JS files: 0 errors, 0 warnings.ruff check --select F,E9on the 2 changed Python files: no findings. - CI. The repository has no workflow that runs on pull requests.
- Not checked. I did not read the live Supabase tables, so I did not confirm that no live research row has a 2027 suffix.
…rch-ids # Conflicts: # .claude/commands/triage-bills.md
…ps the session suffix From Pavel's #252 review: 1. Before 2027 a research ID carries no session, so a special-session bill the wider rule now admits as new would take the regular bill's ID ("ky-hb1") and open its analysis. same_session now compares two labels from before 2027 with the earlier rule (_LEGACY_SPECIAL_RE), so those bills drop as duplicates, as they did on main. From 2027 the new rule and its markers apply. 2. prerender.mjs reads a bill number from the research ID through parseResearchId, as DataContext does, so "ky-hb1-2027s1" gives "HB1". Also bumps APP_VERSION to v44 so the front-end changes (researchId.js, StatePanel.jsx) and prerender.mjs deploy, and applies ruff format to bill_identity.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, Pavel. Both suggestions are in bbb4a1b, after merging
Also: |
Follow-up to #239 (Pavel's review suggestion 1).
From the 2027 sessions on, a special-session bill got the same research ID as the regular-session bill with its number:
2027S1and in2027RSwere bothky-hb1-2027;901and2027 First Special Sessionboth gavetx-hb1-2027, the same as the regular session.Triage then treated the special-session bill as already encoded, and the tracker UI opened the regular session's analysis for it.
What changes
Research IDs carry a special-session marker.
bill_identity.special_sessionreads the marker from the session label, andsession_suffixadds it to the session year:2027RSky-hb1-2027(unchanged)2027S1ky-hb1-2027s1901, TX2027 First Special Sessiontx-hb1-2027s1902tx-hb1-2027s22027SS(no number)ky-hb1-2027s2026S1ar-hb1(unchanged, before 2027)A label that gives no number gets a bare
s. That keeps it apart from a numbered session.Detection covers OpenStates identifiers that don't say "special".
2027SS, GA2027_ss, IN/VT2027ss1, OK2027SS1, MS20271E, WV20271S, NC2027E1, NM/SD2027S, ID2027spcland Texas "Called Session".HB 1A,HB27B-1001).Deduplication keeps special sessions apart.
same_sessionseparates special sessions with different markers (2027S1vs2027S2).same_sessionstill uses the earlier, narrower rule. A research ID then carries no session, so a special-session bill admitted as new would take the regular bill's ID (ky-hb1) and open its analysis. KY2026SSvs2026RSand UT2026S1vs2026S2therefore still drop as duplicates, as onmain. From 2027 the new rule and its markers apply.session_yearsno longer widens a special session to the two-year term. Virginia2027S1now reads as 2027 (it read as 2026 and got no suffix), and Wisconsin2027S1and2028S1stay apart.20271Eand West Virginia20271Snow read as 2027.The UI mirrors it.
researchId.jsaddsspecialSessionandsessionSuffix.billKey,processedBillKeyandresearchBillKeykey a special-session bill asKY:HB1:2027S1.parseResearchIdreturns the suffix assessionSuffix. It still reads one only for 2027–2099, soco-hb26-1062is unchanged.StatePanelpasses the full suffix to its fallback key.Pre-rendered pages.
prerender.mjsreads a bill number from the research ID throughparseResearchId, asDataContextdoes, soky-hb1-2027s1givesHB1. That path runs only when the title has no bill number.Deploy.
APP_VERSIONgoes to v44, so the front-end changes andprerender.mjsdeploy. The front end rebuilds only when it changes.Docs.
encode-bill,triage-billsanddb-writerdescribe the marker. They also drop theva-hb979-2027example, which the code never produces (Virginia2027givesva-hb979).No research row uses a 2027 suffix yet, so nothing needs migrating. Across 1,123 real session labels (the OpenStates list plus
processed_bills), no research ID changes.publish-bill.yml's branch check (^[a-z0-9][a-z0-9-]*$) acceptsbill/ky-hb1-2027s1.Not used:
session_classificationThe marker comes from the label, not from
processed_bills.session_classification:2025s1, Missouri2025S1);Effects on draft #245
bill_identity.pyis identical tomain's, and its suite passes with this branch's module (328 tests).bill/ky-hb1-2027s1.2027S1and Mississippi20271Enow start in 2027, so they pass its 2027 filter. Before, they were skipped.Tests
pytest scripts/(withouttest_compute_impacts_datasets.py, which needs numpy): 368 passed after mergingmainon 4 December.special_session,session_suffix,research_idfor each special-session form,is_encodedin both directions, andProcessedBillswith2027S1and2027S2, and the pre-2027 rule (same_sessioncases and aProcessedBillstest with KY2026SS).901case intest_research_idnow expectstx-hb1-2027s1. The old expectation was the bug.bunx vitest run: 190 passed in 10 files (131 onmain). New tests cover:specialSession,sessionSuffix,billKeyandparseResearchId;findBillResearchacross sessions;BillActivityFeedtests that fail onmain.bill_identity.pyagainstresearchId.js: 983 labels in 19 states (18,677 cases), 0 mismatches. It compares:processedBillKeyagainstresearchBillKey(research_id(...));parseResearchIdround trip.ruff checkandeslinton the changed files: clean.🤖 Generated with Claude Code