Skip to content

[EPAC-2286]: IngestBillVersionText - persist clause-level version and diff payloads#810

Merged
riddim-developer-bot[bot] merged 1 commit into
mainfrom
symphony/epac-2286-ingestbillversiontext-persist-clause-level-versi
Jun 14, 2026
Merged

[EPAC-2286]: IngestBillVersionText - persist clause-level version and diff payloads#810
riddim-developer-bot[bot] merged 1 commit into
mainfrom
symphony/epac-2286-ingestbillversiontext-persist-clause-level-versi

Conversation

@riddim-developer-bot

Copy link
Copy Markdown
Contributor

Scope

Implement the producer-side data contract for IngestBillVersionText and ComputeBillVersionDiff in backend/bills-indexer to fetch and parse version text from LEGISinfo XML and compute/persist clause-level diff payloads in the SQLite database.

This includes:

  • Updating domain.BillVersion to track TextHash (SHA-256 of XML content) and TextSourceURL (provenance link).
  • Parsing <Section> tags (corresponding to clauses) recursively from LEGISinfo bill XMLs.
  • Computing clause-level differences (additions, deletions, modifications, and unchanged clauses) using a Longest Common Subsequence (LCS) alignment algorithm.
  • Storing calculated diff records in a new bill_clause_diffs table with composite foreign keys.
  • Deterministically recording text absence (via NULL database fields) for one-version bills or bills with missing/unfetchable version text.
  • Updating docs/architecture/use-case-catalog.md.

Testing notes

  • Automated tests run:
    • Ran go test -v ./... in backend/bills-indexer to check all tests (including new legisinfo parsing/diffing tests and sqlite database schema tests).
    • Added XML parser unit tests (TestParseBillXML), clause alignment diffing unit tests (TestDiffClauses), and use case case-coverage tests (TestBuildDiffsCases for multi-version, one-version, and missing-text).
    • Added schema and insertion assertions in TestWriterCreatesBillsRelationalSchema to check text_hash, text_source_url, and bill_clause_diffs table constraints and columns.
  • Manual verification: Checked local Go test output execution, which successfully passed all database and fetcher tests.

Related issue

@riddim-developer-bot riddim-developer-bot Bot enabled auto-merge (squash) June 14, 2026 17:01
@riddim-developer-bot riddim-developer-bot Bot merged commit d6c3bad into main Jun 14, 2026
61 of 62 checks passed
@riddim-developer-bot riddim-developer-bot Bot deleted the symphony/epac-2286-ingestbillversiontext-persist-clause-level-versi branch June 14, 2026 17:06
riddim-developer-bot Bot added a commit that referenced this pull request Jun 14, 2026
## What & why

Post-implementation **architecture verification** of the *Bill diff
backend completion* Project
([EPAC-2293](https://linear.app/riddimsoftware/issue/EPAC-2293/architecture-verification-for-bill-diff-backend-completion)).
This is an `arch-team` Project Verification gate — not a PR review and
not an implementation change. It scores the *merged* Project state on
`origin/main` and records the result as a checked-in scorecard, mirrored
to a Linear comment on EPAC-2293.

Docs-only: adds
`docs/architecture/bill-diff-backend-completion-verification-epac2293.md`.
No application/backend code is touched (the issue's "no implementation
PR / no code patching" constraint is preserved).

## Verdict

**7.5 / 10.0 — Healthy (high pass).** No Cardinal Sin, no Hidden
Dependency.

What holds:
- Dependency direction holds in both Go services (`domain` imports no
use case/adapter/SDK; use cases depend on ports; `main.go` is the
composition root).
- Serving split is correct: `LoadBillVersionDiff` owns the 204-vs-404
policy, the handler is thin, the repository owns SQLite.
- **Civic-content provenance is clean** — verbatim XML→clause text
end-to-end, structural `change_type` only, honest `nil` Hansard anchors;
no generated/summarized parliamentary text.
- Deployment smoke distinguishes API Gateway 404 from app-level 404 —
directly targeting the original regression.
- OpenAPI + use-case catalog updated by the implementing PRs.

Deductions (−2.5): Behavioral Leakage −1.0 + Catalog Drift −1.0
(clause-diff policy lives in the LEGISinfo source adapter, not the
cataloged indexer use case) → **EPAC-2303**; Enforcement Gap −0.5 (bills
SQLite artifact schema is an unverified cross-adapter contract; sparse
served version metadata) → **EPAC-2304**.

## Reconstructed inputs

Originally-named siblings EPAC-2283/2284 were re-scoped (still in
Backlog). Actual merged work scored: EPAC-2286 (#810), EPAC-2298 (#814),
EPAC-2287 (#811), EPAC-2299 (#815), EPAC-2288 (#812), EPAC-2285 (#817),
EPAC-2289 (#818), via `git fetch origin main` + merged commits.

## Follow-ups filed (non-blocking, `arch`, est. 4)

- [EPAC-2303](https://linear.app/riddimsoftware/issue/EPAC-2303) —
Implement `ComputeBillVersionDiff` use case in the bills-indexer
application layer.
- [EPAC-2304](https://linear.app/riddimsoftware/issue/EPAC-2304) — Lock
the bills SQLite artifact schema with a producer-to-consumer seam test.

## Verification evidence

- Scope is docs-only (`git diff origin/main..HEAD --stat`: 1 file,
+117). No Go/Swift/CI code changed, so no build or simulator run
applies; `pr-build` covers the change.
- EPAC-2293 attached to the *Bill diff backend completion* Project;
scorecard comment posted on the issue.

Release-Note: none (docs-only architecture verification record).

Co-authored-by: riddim-developer-bot <developer-bot@riddimsoftware.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.

0 participants