Skip to content

Fix Camera keyword search with HTML entities#64

Merged
aborruso merged 1 commit into
mainfrom
fix/bills-keyword-html-entities
Jul 13, 2026
Merged

Fix Camera keyword search with HTML entities#64
aborruso merged 1 commit into
mainfrom
fix/bills-keyword-html-entities

Conversation

@aborruso

Copy link
Copy Markdown
Member

Summary

  • Add a shared helper to search both decoded keywords and their HTML-entity encoded variant.
  • Fix bills --keyword for Camera titles/labels stored as HTML entities (e.g. criminalità vs criminalità).
  • Apply the same fix to bill-progress keyword filters, including Camera timeline mode.
  • Add regression tests on ac19_2696.

Verification

  • node dist/cli.js bills list --legislature 19 --keyword "criminalità" --limit 1 --format jsonl
  • node dist/cli.js bill-progress list --uri http://dati.camera.it/ocd/attocamera.rdf/ac19_2696 --keyword "criminalità" --limit 1 --format jsonl
  • npx vitest run --pool forks
  • npx tsc --noEmit

Copilot AI review requested due to automatic review settings July 13, 2026 15:59
@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes Camera keyword searches when source titles contain HTML entities. The main changes are:

  • Added a shared helper for decoded and HTML-encoded keyword variants.
  • Applied the variant search to bills keyword filters.
  • Applied the same search behavior to bill-progress keyword filters.
  • Added regression tests for criminalità matching ac19_2696.

Important Files Changed

Filename Overview
src/core/html-entity-variants.ts Adds a keyword variant helper that keeps the original input and adds a named-entity encoded form.
src/tools/bills.ts Expands Camera bills keyword filtering to check both original and HTML-entity keyword forms.
src/tools/bill-progress.ts Expands bill-progress keyword filtering to check both original and HTML-entity keyword forms.
src/tools/tools.test.ts Adds regression tests for decoded Camera keyword searches against ac19_2696.
LOG.md Documents the Camera HTML-entity keyword search fix.

Reviews (1): Last reviewed commit: "fix camera keyword html entities" | Re-trigger Greptile

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

This PR fixes Camera keyword searches when the underlying LOD literals contain HTML entities (e.g. criminalità) by searching both the user-provided keyword and an HTML-entity-encoded variant, and adds integration regressions to prevent the issue from returning.

Changes:

  • Add htmlEntityKeywordVariants() helper to generate decoded + HTML-entity encoded keyword variants for SPARQL filters.
  • Update Camera keyword filtering in bills and in bill-progress (including Camera timeline mode) to match either variant.
  • Add regression tests targeting Camera act ac19_2696, plus a LOG entry documenting the fix.

Reviewed changes

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

Show a summary per file
File Description
src/tools/tools.test.ts Adds regression coverage for keyword searches against Camera HTML-entity titles.
src/tools/bills.ts Updates Camera bills keyword SPARQL filter to match both decoded and HTML-entity variants.
src/tools/bill-progress.ts Extends keyword filtering to handle HTML-entity variants in both Senato list and Camera timeline paths.
src/core/html-entity-variants.ts Introduces shared helper to generate HTML-entity keyword variants.
LOG.md Documents the fix and verification steps/results.

Comment on lines +17 to +26
"\u00e0": "à",
"\u00e8": "è",
"\u00e9": "é",
"\u00ec": "ì",
"\u00f2": "ò",
"\u00f9": "ù",
};

const HTML_ENTITY_CHARS = /["'&<>\u2018\u2019\u201c\u201d\u2013\u2014\u2026\u20ac\u00ab\u00bb\u00e0\u00e8\u00e9\u00ec\u00f2\u00f9]/g;

Comment thread src/tools/tools.test.ts
const result = await billsTool.execute({
legislature: 19,
keyword: "criminalità",
limit: 10,
@aborruso
aborruso merged commit 7da8335 into main Jul 13, 2026
3 checks passed
@aborruso
aborruso deleted the fix/bills-keyword-html-entities branch July 13, 2026 16:03
aborruso added a commit that referenced this pull request Jul 13, 2026
…65)

Recepiti due rilievi Copilot sulla PR #64:
- htmlEntityKeywordVariants ora mappa anche À/È/É/Ì/Ò/Ù → la variante
  encoded viene generata pure con keyword maiuscola (es. CRIMINALITÀ)
- test di regressione keyword: limit 10 → 100 (fragile all'ordinamento,
  19 atti matchano) + nuovo caso maiuscolo

Bump versione 0.25.2 nei 5 punti.

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