[EPAC-2307]: Use numeric LEGISinfo id as Bill.id for backend bill-depth calls#829
Merged
riddim-developer-bot[bot] merged 1 commit intoJun 15, 2026
Conversation
…th calls
BillsService mapped Bill(id: number), so bill-detail backend calls
(versions, diff, committee, amendments, lobbying, and PBO's
/pbo/by-bill/{legisinfo_id}) used the display bill number (e.g. "C-11")
as the path id. The backend bill-depth routes are keyed by the numeric
LEGISinfo id (e.g. 13608745 for C-11), so those calls 404'd, the
versions list came back nil, and the "Compare versions" action row
stayed hidden.
Decode the LEGISinfo BillId and use it as Bill.id, keeping Bill.number
as the display value. Fall back to the number when LEGISinfo omits a
usable id (leaving backend depth unavailable rather than mis-keyed).
Follow/unfollow (BillFollowStore) and list/selection identity remain
keyed to bill.number, so they are unaffected.
Adds BillsServiceTests covering the numeric-id mapping and the fallback.
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.
Scope
iOS bill identity boundary fix.
BillsServicemappedBill(id: number), so every bill-detail backend call sent the display bill number (e.g.C-11) as the path id. The backend bill-depth routes are keyed by the numeric LEGISinfo id (e.g.13608745for C-11), so the versions call 404'd, the versions list came backnil, and the Compare versions action row stayed hidden.This decodes the LEGISinfo
BillIdand uses it asBill.id, keepingBill.numberas the display value. It falls back to the number when LEGISinfo omits a usable id (so backend depth is unavailable rather than mis-keyed). The samebill.idfeeds versions, diff, committee, amendments, lobbying, and PBO (/pbo/by-bill/{legisinfo_id}), so those all resolve now.Follow/unfollow (
BillFollowStore) and list/selection identity are keyed tobill.number, notbill.id, so they are unchanged — no duplicate followed-bill records.Release-Note: Bill detail now shows the Compare versions action for bills that have multiple published versions.Bugfix SPEC
scripts/intake/bugfix_spec.py(under.factory/intake/, which is gitignored).Testing notes
BillsServiceTestsasserts C-11 maps toid == "13608745"whilenumber == "C-11", and that a missing or<= 0BillIdfalls back to the number. Re-ranBillVersionsRepositoryTestsandBillsSelectionTestsfor regressions — 12 tests across 3 suites passed. SwiftLint clean on changed files.GET /api/v1/bills/13608745→200, C-11 with 3 versions.GET /api/v1/bills/C-11→404(the old display-number path — the bug).GET /api/v1/bills/13608745/diff?from=c-11-13615955-first-reading&to=c-11-13896514-as-amended-by-committee→200with 82 clause rows (the AC's First Reading → As amended by committee pair).Acceptance criteria
nil/204), and the diff sheet's single-version empty state is untouched.BillFollowStoreunchanged).Note / possible follow-up
The diff sheet defaults its pickers to First Reading → last version (here "As passed by the House of Commons"). On current staging data that specific pair returns
204(no diff record), so the sheet opens on the coherent "unavailable" state until the user picks an available pair (e.g. As amended by committee, which returns 82 clause rows). This is the diff sheet's pre-existing default-selection behavior and is unchanged by this PR; defaulting to a pair that has diff data could be a small follow-up.Screenshots
Captured on simulator: C-11 bill detail Actions section showing Write to MP / Compare versions / View on LEGISinfo (the Compare versions row is the fix). Inline image upload isn't available from the CLI; the screenshot was reviewed during verification.
Related issue