Skip to content

Give special-session bills their own research IDs from 2027 - #252

Merged
DTrim99 merged 3 commits into
mainfrom
special-session-research-ids
Dec 4, 2026
Merged

DTrim99 merged 3 commits into
mainfrom
special-session-research-ids

Conversation

@DTrim99

@DTrim99 DTrim99 commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • KY HB 1 in 2027S1 and in 2027RS were both ky-hb1-2027;
  • Texas 901 and 2027 First Special Session both gave tx-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_session reads the marker from the session label, and session_suffix adds it to the session year:

    Session label Research ID
    KY 2027RS ky-hb1-2027 (unchanged)
    KY 2027S1 ky-hb1-2027s1
    TX 901, TX 2027 First Special Session tx-hb1-2027s1
    TX 902 tx-hb1-2027s2
    KY 2027SS (no number) ky-hb1-2027s
    AR 2026S1 ar-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".

    • The new forms are KY 2027SS, GA 2027_ss, IN/VT 2027ss1, OK 2027SS1, MS 20271E, WV 20271S, NC 2027E1, NM/SD 2027S, ID 2027spcl and Texas "Called Session".
    • Before this, a bill from one of these sessions was read as a regular-session bill and dropped as a duplicate of the regular bill with its number.
    • Checked against all 1,040 sessions in the OpenStates scrapers' metadata, the rule marks no regular session as special.
    • Florida and Colorado stay out, because their special-session bill numbers carry the session letter (HB 1A, HB27B-1001).
  • Deduplication keeps special sessions apart.

    • same_session separates special sessions with different markers (2027S1 vs 2027S2).
    • Before 2027, same_session still 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. KY 2026SS vs 2026RS and UT 2026S1 vs 2026S2 therefore still drop as duplicates, as on main. From 2027 the new rule and its markers apply.
    • session_years no longer widens a special session to the two-year term. Virginia 2027S1 now reads as 2027 (it read as 2026 and got no suffix), and Wisconsin 2027S1 and 2028S1 stay apart.
    • Mississippi 20271E and West Virginia 20271S now read as 2027.
  • The UI mirrors it.

    • researchId.js adds specialSession and sessionSuffix. billKey, processedBillKey and researchBillKey key a special-session bill as KY:HB1:2027S1.
    • parseResearchId returns the suffix as sessionSuffix. It still reads one only for 2027–2099, so co-hb26-1062 is unchanged.
    • StatePanel passes the full suffix to its fallback key.
  • Pre-rendered pages. prerender.mjs reads a bill number from the research ID through parseResearchId, as DataContext does, so ky-hb1-2027s1 gives HB1. That path runs only when the title has no bill number.

  • Deploy. APP_VERSION goes to v44, so the front-end changes and prerender.mjs deploy. The front end rebuilds only when it changes.

  • Docs. encode-bill, triage-bills and db-writer describe the marker. They also drop the va-hb979-2027 example, which the code never produces (Virginia 2027 gives va-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-]*$) accepts bill/ky-hb1-2027s1.

Not used: session_classification

The marker comes from the label, not from processed_bills.session_classification:

  • OpenStates classifies some special sessions as "primary" (Minnesota 2025s1, Missouri 2025S1);
  • the column is empty on current rows;
  • neither the UI nor the encode commands read it, so an ID that depended on it could differ between callers.

Effects on draft #245

  • No conflict: Auto-encode bills in the top triage band (p452) #245's bill_identity.py is identical to main's, and its suite passes with this branch's module (328 tests).
  • Branch names: its review branches become names like bill/ky-hb1-2027s1.
  • The year filter: Virginia 2027S1 and Mississippi 20271E now start in 2027, so they pass its 2027 filter. Before, they were skipped.

Tests

  • pytest scripts/ (without test_compute_impacts_datasets.py, which needs numpy): 368 passed after merging main on 4 December.
    • New tests cover special_session, session_suffix, research_id for each special-session form, is_encoded in both directions, and ProcessedBills with 2027S1 and 2027S2, and the pre-2027 rule (same_session cases and a ProcessedBills test with KY 2026SS).
    • The 901 case in test_research_id now expects tx-hb1-2027s1. The old expectation was the bug.
  • bunx vitest run: 190 passed in 10 files (131 on main). New tests cover:
    • specialSession, sessionSuffix, billKey and parseResearchId;
    • findBillResearch across sessions;
    • two BillActivityFeed tests that fail on main.
  • Parity probe, bill_identity.py against researchId.js: 983 labels in 19 states (18,677 cases), 0 mismatches. It compares:
    • session years, marker and suffix;
    • processedBillKey against researchBillKey(research_id(...));
    • the parseResearchId round trip.
  • ruff check and eslint on the changed files: clean.

🤖 Generated with Claude Code

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 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 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

  1. 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_bills has KY HB 1 from 2026RS. At main, the monitor drops HB 1 from 2026SS as a duplicate. At d067da9, ProcessedBills.contains returns False, so the monitor adds the row. Its research ID is ky-hb1, the same as the regular bill. If ky-hb1 exists, is_encoded returns True, and the UI key KY:HB1 opens 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, MS 20261E, WV 20262S, NC 2025E1, NM 2025S, SD 2025s, ID spcl, IN ss1, OK SS1). 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 2026S1 as 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.
  2. scripts/prerender.mjs:51-52 does not remove the session suffix when it reads a bill number from the ID. For ky-hb1-2027s1 it gives HB1-2027S1. src/context/DataContext.jsx:166 uses parseResearchId and gives HB1. 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): use parseResearchId(id).billParts in prerender.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 with main alone, 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, DataContext and prerender.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", Texas 90/90R/901/902 and "Called Session", Colorado 2027A/2027B, Virginia, Wisconsin, Congress, and empty labels. For each of the 1,188 labels, I compared session_years, special_session, session_suffix, processedBillKey against researchBillKey(research_id(...)), and the parseResearchId round trip. There were 0 mismatches.
  • IDs before 2027 and existing IDs. Against main, research_id changes for 156 label and bill cases. All of them are 2027 or later special sessions. 18 of them had no suffix at main: Virginia 2027S1, Mississippi 20271E and West Virginia 20271S, 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), parseResearchId and researchBillKey give the same result as at main.
  • findBillResearch. With only ky-hb1-2027 (with or without legiscan_bill_id), the 2027S1 and 2027SS bills are now unanalyzed. At main they opened ky-hb1-2027. With both rows, each session opens its own analysis. tx-hb1-2027s1 matches the 901 bill only. ky-hb1 matches the 2026RS bill only. A row that names a legiscan_bill_id still wins over the key, as before.
  • Deduplication. Against main, same_session changes for 319 label pairs. Each change keeps two special sessions apart (2027S1 vs 2027S2, 2027 vs 2027SS), except two pairs that now match: KY "2027 Special Session" with 2027SS, 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 (164 test_bill_identity.py, 43 test_openstates_monitor.py, 31 test_readiness_lookup.py, 29 test_compute_impacts_datasets.py, 8 test_refresh_bill_status.py, 8 test_publish_analysis.py, 6 test_auto_triage.py). bunx vitest run: 190 passed in 10 files. bun run build: passes. With the main versions of researchId.js and StatePanel.jsx, the 2 new BillActivityFeed special-session tests fail, as the PR body says.
  • Lint. eslint on the 4 changed JS files: 0 errors, 0 warnings. ruff check --select F,E9 on 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.

DTrim99 and others added 2 commits December 4, 2026 11:09
…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>
@DTrim99

DTrim99 commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks, Pavel. Both suggestions are in bbb4a1b, after merging main (the triage-bills.md conflict with #244 resolved to main's version, since #244 replaced that block).

  1. Pre-2027 special sessions. I made the code change rather than only documenting it. same_session compares two labels from before 2027 with the earlier rule (_LEGACY_SPECIAL_RE, main's pattern), as a special/regular flag. So KY 2026SS vs 2026RS (and GA 2026_ss, MS 20261E, WV 20262S, NC 2025E1, NM 2025S, ID 2026spcl, IN 2026ss1, UT 2026S1 vs 2026S2) drop as duplicates again instead of taking the regular bill's ID. From 2027 the new rule and markers apply. New same_session cases plus a ProcessedBills test with your KY case.
  2. prerender.mjs now uses parseResearchId(id).billParts, so ky-hb1-2027s1 gives HB1. I checked the function under Node 22 (the Modal image) and Node 26.

Also: APP_VERSION goes to v44, so the researchId.js, StatePanel.jsx and prerender.mjs changes actually deploy. pytest scripts/: 368 passed; vitest 190; bun run build passes.

@DTrim99
DTrim99 merged commit 25cee88 into main Dec 4, 2026
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