Skip to content

test(senato-votes): blinda l'anti-refuso di bill_number + wiki#52

Merged
aborruso merged 3 commits into
mainfrom
test/senato-votes-refuso-billnumber
Jul 11, 2026
Merged

test(senato-votes): blinda l'anti-refuso di bill_number + wiki#52
aborruso merged 3 commits into
mainfrom
test/senato-votes-refuso-billnumber

Conversation

@aborruso

Copy link
Copy Markdown
Member

Contesto (punto C della gap analysis)

Il rdfs:label delle votazioni di fiducia del Senato può contenere un refuso nel numero del DDL alla fonte: es. la fiducia Piano Casa (19-434-2) ha label "DDL n. 1994. Votazione questione di fiducia" per il DDL S.1944. Rischio: chi legge il numero dal testo del label citerebbe 1994 invece di 1944.

Cosa emerge dall'analisi

Il codice già gestisce correttamente il caso, a più strati (senato-votes.ts):

  1. il numero del label (1994) non risolve ad alcun osr:fasebill_number azzerato per difesa;
  2. la propagazione intra-seduta risolve ddl_uri (→ ddl/60233) dai voti sorelli della stessa seduta;
  3. un backfill finale rilegge il numero vero dalla osr:fase del DDL risolto → bill_number = "1944".

Esito: label resta verbatim (col refuso), ma bill_number/ddl_uri sono autoritativi e corretti. Il tool non emette mai il refuso come bill_number: o è il numero verificato, o è vuoto. Il consumatore primario (MCP/LLM) legge il campo strutturato, già giusto.

Cosa cambia questo PR

Nessuna modifica al comportamento runtime — il fix era già in produzione. Questo PR:

  • Aggiunge un test di regressione (senato-votes: refuso nel numero del label non intacca bill_number) che blinda: label contiene 1994 verbatim, bill_number === "1944", ddl_uri === ddl/60233.
  • Aggiorna fiducia-fallback.md, che era stale: documentava l'azzeramento di bill_number ma non il recupero finale del numero corretto via backfill. Aggiunta la regola pratica: non fidarsi del numero nel testo del label, usare bill_number.

Verifica

  • tsc --noEmit pulito.
  • Nuovo test verde sull'endpoint live.

🤖 Generated with Claude Code

Punto C dalla gap analysis: il label delle fiducie Senato può contenere
un refuso nel numero DDL (es. "DDL n. 1994" per S.1944 / Piano Casa). Il
codice già lo gestisce: numero non risolvibile → bill_number azzerato →
propagazione intra-seduta risolve ddl_uri → backfill rilegge il numero
vero (1944) dalla osr:fase. Il label resta verbatim, bill_number è
autoritativo. Nessun refuso viene mai emesso come bill_number.

Aggiunge un test di regressione (Piano Casa 19-434-2) che blinda questo
comportamento, e aggiorna fiducia-fallback.md che era stale: descriveva
l'azzeramento ma non il recupero finale del numero corretto via backfill.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 11, 2026 07:18
@greptile-apps

greptile-apps Bot commented Jul 11, 2026

Copy link
Copy Markdown

Greptile Summary

This PR documents and tests the Senato fiducia fallback for a typo in the source label.

  • Adds coverage for the Piano Casa vote keeping the verbatim label separate from structured bill_number.
  • Checks that ddl_uri resolves to the authoritative DDL.
  • Updates the wiki page to describe the final bill_number backfill.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
src/tools/tools.test.ts Adds focused Senato vote assertions for the resolved DDL URI and corrected bill number.
docs/lod-wiki/senato/fiducia-fallback.md Documents that consumers should use the structured bill_number and ddl_uri fields instead of the label text.

Reviews (3): Last reviewed commit: "test(senato-votes): non-null assertion +..." | Re-trigger Greptile

Comment thread src/tools/tools.test.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Questo PR aggiunge una regressione test e aggiorna la documentazione per “blindare” il caso Senato in cui il rdfs:label di una fiducia contiene un refuso nel numero DDL (es. 1994 vs S.1944), garantendo che i campi strutturati (bill_number, ddl_uri) restino autoritativi.

Changes:

  • Aggiunge un test d’integrazione per verificare che, a parità di label (anche con refuso), bill_number e ddl_uri risultino corretti per la fiducia “Piano Casa” (19-434-2).
  • Aggiorna la wiki LOD Senato per documentare esplicitamente il backfill finale di bill_number dal DDL risolto (blocco missingNum).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/tools/tools.test.ts Nuovo test di regressione live su senato-votes per il refuso nel label e il backfill di bill_number.
docs/lod-wiki/senato/fiducia-fallback.md Documentazione aggiornata per includere il recupero di bill_number dopo la propagazione intra-seduta.

Comment thread src/tools/tools.test.ts Outdated
Comment thread src/tools/tools.test.ts Outdated
Rimuove il test separato che duplicava una live call già coperta dal test
--ddl-uri (Copilot). Sposta l'asserzione bill_number=1944 e il commento sul
refuso nel test esistente + aggiunge toBeDefined() sul row fiducia (evita
match silenziosi su undefined).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread docs/lod-wiki/senato/fiducia-fallback.md Outdated
Comment thread src/tools/tools.test.ts Outdated
Comment thread src/tools/tools.test.ts Outdated
…la wiki

- Sostituito optional chaining con non-null assertion dopo toBeDefined()
  (row garantita presente, asserzioni più esplicite) — Copilot.
- fiducia-fallback.md: il riferimento al test rimosso ora punta al test
  --ddl-uri che copre la regressione Piano Casa — Copilot.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@aborruso
aborruso merged commit 019ca1f into main Jul 11, 2026
2 checks passed
@aborruso
aborruso deleted the test/senato-votes-refuso-billnumber branch July 11, 2026 07:32
aborruso added a commit that referenced this pull request Jul 11, 2026
… ricetta aic

Patch: raccoglie #49 (emptyHint via CLI), #52 (anti-refuso bill_number),
#53 (senato-vote-detail per tipo voto), ricetta sede question time aic, #50.
43 tool invariati, 137/137 test verdi.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.

2 participants