feat: aggiungi flag --no-notes per escludere blocchi AGGIORNAMENTO#25
Merged
Conversation
Aggiunge opzione --no-notes alla CLI e no_notes=False all'API per filtrare le note storiche AGGIORNAMENTO dall'output Markdown, utile per pipeline RAG su testi normativi. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Questo PR introduce un’opzione per escludere dall’output Markdown i blocchi di note “AGGIORNAMENTO”, utile per ridurre rumore nelle pipeline RAG, mantenendo intatti i marker di modifiche inline (( ... )).
Changes:
- Aggiunge il flag CLI
--no-notese lo propaga fino alla conversione Markdown. - Espone
no_notes: bool = Falsenell’API pubblica (convert_url,convert_xml) e lo inoltra nella call chain. - Aggiunge una nuova suite di test dedicata e aggiorna test esistenti; bump versione a
2.1.11e aggiorna documentazione/spec OpenSpec.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_no_notes.py | Nuovi test per verificare esclusione “AGGIORNAMENTO” e preservazione (( ... )). |
| tests/test_cli_validation.py | Aggiorna il mock del Namespace per includere no_notes. |
| src/normattiva2md/markdown_converter.py | Implementa filtro no_notes in process_content_with_paragraphs e propaga il parametro lungo la conversione. |
| src/normattiva2md/cli.py | Aggiunge --no-notes alla CLI (argparse + help) e lo passa alla conversione. |
| src/normattiva2md/api.py | Aggiunge no_notes a convert_url/convert_xml e lo passa a generate_markdown_text. |
| setup.py | Bump versione package a 2.1.11. |
| pyproject.toml | Bump versione progetto a 2.1.11. |
| openspec/changes/add-no-notes-flag/tasks.md | Task list per implementazione/validazione. |
| openspec/changes/add-no-notes-flag/specs/markdown-conversion/spec.md | Delta spec per il comportamento di conversione Markdown. |
| openspec/changes/add-no-notes-flag/specs/cli-interface/spec.md | Delta spec per interfaccia CLI. |
| openspec/changes/add-no-notes-flag/proposal.md | Proposal/architettura della modifica e catena di propagazione. |
| LOG.md | Log di progetto aggiornato con la feature --no-notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+31
to
+34
| #### Scenario: Filtering scope limited to AGGIORNAMENTO paragraphs | ||
| - **WHEN** `no_notes=True` and an article contains both normal paragraphs and AGGIORNAMENTO blocks | ||
| - **THEN** only paragraphs whose text starts with `AGGIORNAMENTO` SHALL be omitted | ||
| - **AND** all other paragraph text SHALL appear in the output unchanged |
|
|
||
| ## Implementation | ||
|
|
||
| - [ ] **1. markdown_converter.py** — aggiunge `no_notes=False` a `process_content_with_paragraphs()`: salta i paragrafi che iniziano con `"AGGIORNAMENTO"` quando `no_notes=True` |
| → process_content_with_paragraphs(no_notes=...) | ||
| ``` | ||
|
|
||
| Punto di filtraggio: in `process_content_with_paragraphs()` (markdown_converter.py:222), quando `no_notes=True`, i paragrafi che iniziano con `"AGGIORNAMENTO"` vengono saltati. |
Comment on lines
58
to
62
| with_urls: bool = False, | ||
| force_opendata: bool = False, | ||
| quiet: bool = False, | ||
| no_notes: bool = False, | ||
| ) -> Optional[ConversionResult]: |
Comment on lines
184
to
188
| with_urls: bool = False, | ||
| metadata: Optional[Dict] = None, | ||
| quiet: bool = False, | ||
| no_notes: bool = False, | ||
| ) -> Optional[ConversionResult]: |
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.
Summary
--no-notesalla CLI per escludere i blocchi AGGIORNAMENTO (note storiche delle modifiche normative) dall'output Markdownno_notes=Falsealle funzioniconvert_url()econvert_xml()dell'API pubblica(( ))(modifiche inline al testo vigente) non vengono toccatiMotivazione
Chiude #24. I blocchi AGGIORNAMENTO introducono rumore nelle pipeline RAG su testi normativi.
Utilizzo
Test plan
tests/test_no_notes.pytests/test_cli_validation.py(aggiuntono_notes=Falseal Namespace mock)--no-notes, 34 senzaVersione
2.1.10→2.1.11