Skip to content

[EPAC-2307]: Use numeric LEGISinfo id as Bill.id for backend bill-depth calls#829

Merged
riddim-developer-bot[bot] merged 1 commit into
mainfrom
symphony/epac-2307-fix-bill-diff-entry-point-hidden-by-display-numb
Jun 15, 2026
Merged

[EPAC-2307]: Use numeric LEGISinfo id as Bill.id for backend bill-depth calls#829
riddim-developer-bot[bot] merged 1 commit into
mainfrom
symphony/epac-2307-fix-bill-diff-entry-point-hidden-by-display-numb

Conversation

@riddim-developer-bot

Copy link
Copy Markdown
Contributor

Scope

iOS bill identity boundary fix. BillsService mapped Bill(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. 13608745 for C-11), so the versions call 404'd, the versions list came back nil, and the Compare versions action row stayed hidden.

This decodes the LEGISinfo BillId and uses it as Bill.id, keeping Bill.number as 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 same bill.id feeds 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 to bill.number, not bill.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

  • Spec: EPAC-2307 — intake SPEC generated and validated locally via scripts/intake/bugfix_spec.py (under .factory/intake/, which is gitignored).
  • Trace ID: EPAC-2307

Testing notes

  • Automated tests run: New BillsServiceTests asserts C-11 maps to id == "13608745" while number == "C-11", and that a missing or <= 0 BillId falls back to the number. Re-ran BillVersionsRepositoryTests and BillsSelectionTests for regressions — 12 tests across 3 suites passed. SwiftLint clean on changed files.
  • Manual verification (iPhone 17 Pro simulator, iOS 26.5, Debug → staging):
    • Navigated Accountability → Bills → C-11. The action section now shows Write to MP → Compare versions → View on LEGISinfo (screenshot captured during the run; the Compare versions row was previously absent — see issue). Tapping the row opens the diff sheet.
    • Staging data behind the UI:
      • GET /api/v1/bills/13608745200, C-11 with 3 versions.
      • GET /api/v1/bills/C-11404 (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-committee200 with 82 clause rows (the AC's First Reading → As amended by committee pair).

Acceptance criteria

  • ✅ C-11 shows the Compare versions action row (simulator screenshot).
  • ✅ Tapping it opens the existing diff sheet.
  • ✅ First Reading → As amended by committee loads clause-level changes (82 clause rows on staging).
  • ✅ One-version / no-version bills don't regress: the row still hides when the backend has no versions record (nil/204), and the diff sheet's single-version empty state is untouched.
  • ✅ Follow/unfollow stays keyed to the displayed bill number (BillFollowStore unchanged).
  • ✅ Added focused mapping tests.

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

…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.
@riddim-developer-bot riddim-developer-bot Bot enabled auto-merge (squash) June 15, 2026 13:02
@riddim-developer-bot riddim-developer-bot Bot merged commit 04e0510 into main Jun 15, 2026
7 of 8 checks passed
@riddim-developer-bot riddim-developer-bot Bot deleted the symphony/epac-2307-fix-bill-diff-entry-point-hidden-by-display-numb branch June 15, 2026 13:07
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.

0 participants