2026-11-27 16:22 UTC

OpenNorme puts Italian legislation into Git history

state: expiredheat: lowuncertainty: mediumrelevance: mediumlegal-datasets legislation-history open-datadej611

What is this?

OpenNorme is an individual project by GitHub user dej611, described in its repository as a Rust tool and site built around Normattiva, Italy’s legislative open-data API. It records each detected modification as a Git commit, gives certain provisional acts separate branches while their legal status is unresolved, and describes a daily scrape and website publishing workflow. The project’s README says the law texts come from Normattiva/IPZS under CC BY 4.0, while noting that its copied texts are not authoritative legal texts. Evidence here is the repository description and a Show HN post; independent validation of coverage, accuracy, continuity, or research utility is not supplied.

Why it matters

The notable idea is treating a national legislative corpus as version-controlled data: commits could make changes easier to inspect, compare, cite, and reuse in tools such as legal search or analysis systems. Branches for provisional acts also encode an aspect of legal status in the data workflow. That could lower barriers for developers and researchers, but the supplied evidence does not establish completeness or reliability, and the README explicitly cautions that the texts are not official legal authority.

Current assessment

Newly surfaced through a Show HN post dated 2026-11-01, OpenNorme’s repository describes a Git-based history of Italian legislation sourced from the Normattiva API. The README says each modification is committed; its scheduled workflow is described as running daily, and provisional act types can be tracked on dedicated branches until resolution. It also describes a published site and an assistant named Digesto. These are project documentation claims, not independently verified operating results. The web results corroborate the repository description and separately point to IPZS announcements about Normattiva open-data infrastructure, but provide no evaluation of OpenNorme itself. Its actual coverage from 1861, fidelity to source records, uptime, usability, and utility for legal research remain unestablished. Normattiva/IPZS attribution and CC BY 4.0 are specified; the README warns that the reproduced text is non-authentic and the official text is the one published in the Gazzetta Ufficiale.

Measured heat

no measured readings yet — the hourly heat pass fills this in

How the heat travelled

10-20 13:00⭐ origin echo-reconstructedThe repository is the original project artifact (not a report relaying another creator's post): its description says, “Italian law as git hi
dej611 on github (echo) · attributed from hn.story.50323586
—
11-01 08:12first on hacker news · published · +283.2hShow HN: OpenNorme – every law in Italy from 1861 in Git. One law per file
dej611_1
—
11-01 08:12amplified on hacker news 👑hn.story.50323586
dej611_1
peak 1 · 0 comments · 105% of case engagement
11-01 08:26our radar first saw it · +283.4hdiscovery anchor: hn.story.50323586—

Evidence (2) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnShow HN: OpenNorme – every law in Italy from 1861 in Git. One law per file
Retrieved article excerpt

Open article · Retrieved 2026-11-01T08:27:35.377187+00:00

# italian-laws-history

Tracks Italian law changes via the [Normattiva](https://www.normattiva.it/) API
and records each modification as a git commit.

## Layout

| Concern | Location |
| --- | --- |
| Source code branch | `main` |
| Data branch | `history` |
| OpenNorme source | `explore` |
| OpenNorme site | `gh-pages` |
| Provisional DL | `dl/<codice>` |
| Provisional RDL | `rdl/<codice>` |
| Provisional DLL | `dll/<codice>` |
| Provisional DLCPS | `dlcps/<codice>` |
| Checkpoint file | `progress-rs.json` |

## One-time setup

Install Rust (skip if already present):

```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
```

Then check out this branch:

```
cd /path/to/italian-laws-history
git checkout main
```

## Build

```
cargo build --release
# Binary: ./target/release/italian-laws-history
```

For iteration, `cargo build` produces a debug build that compiles faster.

## Run modes

The binary writes data to the `history` and `dl/<codice>` (and friends)
branches in `OUTPUT_REPO` (defaults to the current directory), and persists
state to `progress-rs.json`.

### Resume from checkpoint (default)

```
./target/release/italian-laws-history --ci
```

### Start from a specific date

```
./target/release/italian-laws-history --ci 2024-12-01
```

### Reprocess everything from scratch

```
./target/release/italian-laws-history --ci --force 1861-01-01
```

### Interactive TUI dashboard (no `--ci`)

```
./target/release/italian-laws-history 2024-12-01
# q or Ctrl-C to quit
```

The TUI shows a list of recently-discovered acts, a decade chart, a
reference-count distribution, a type-share gauge, a scrolling log, and a
status line. Falls back to the plain stdout logger automatically when the
terminal is too small (< 40×10).

### With Chrome trace profiling

```
./target/release/italian-laws-history --ci --perf 2024-12-01
# Produces trace-<timestamp>.json — open in chrome://tracing
```

## Output to a separate directory (recommended for testing)

The binary's writes land on `history` / `dl/...` branches, which by
default live in the same repo as your `main` source code. To keep them
isolated, point `OUTPUT_REPO` at a separate directory:

```
mkdir -p /tmp/laws-data && cd /tmp/laws-data && git init -q
git config user.email "[email protected]"
git config user.name "Your Name"

cd /path/to/italian-laws-history
OUTPUT_REPO=/tmp/laws-data ./target/release/italian-laws-history --ci 2024-12-01
```

Inspect:

```
cd /tmp/laws-data
git branch -a
git log history --oneline | head
```

## All flags

```
./target/release/italian-laws-history --help
```

- `[SINCE_DATE]` — optional `YYYY-MM-DD`, overrides the checkpoint
- `--force` — ignore checkpoint, reprocess everything
- `--ci` / `--headless` — no TUI, plain stdout logger
- `--perf` — emit `trace-*.json`
- `-V` / `--version`, `-h` / `--help`

## Environment overrides

| Variable | Default |
| --- | --- |
| `OUTPUT_REPO` | `./` |
| `NORMATTIVA_API_BASE` | `https://api.normattiva.it/t/normattiva.api/bff-opendata/v1` |
| `NORMATTIVA_API_TOKEN` | *(empty — most endpoints are public)* |
| `GIT_AUTHOR_NAME` | `GU Bot` |
| `GIT_AUTHOR_EMAIL` | `[email protected]` |
| `BATCH_SIZE` | `10` |
| `CONCURRENCY` | `3` |
| `MIN_TIME_MS` | `300` |
| `MAX_RETRIES` | `5` |
| `CACHE_TTL_SEC` | `3600` |
| `CHECKPOINT_FILE` | `progress-rs.json` |
| `GITHUB_REPO` | `$GITHUB_REPOSITORY` (Actions) or unset — skip PRs |

## Stopping safely

`Ctrl-C` is safe at any time. The checkpoint is written atomically after
each search page (and on interrupt or month end), so the next run resumes
from where it stopped (use the same command without `--force`). A kill
mid-page may re-fetch up to one page of acts.

## Provisional-act handling

Italian law has several act types that are *provisional* — they enter into
force immediately but only become permanent after a separate ratification.
The binary commits each one to a dedicated branch, opens a GitHub PR
into `history` (when `GITHUB_REPO`/`GITHUB_REPOSITORY` and `GH_TOKEN`
are set), and merges the branch into `history` once its lifecycle
resolves. Conversion and sanatoria leave the PR merged; decadenza still
merges, then comments the due date that expired:

| Type | Namespace | Decadenza window | Notes |
| --- | --- | --- | --- |
| `dl` | `dl/<codice>` | 60 days | Modern Decreto-Legge (post-1948, art. 77 Cost.) |
| `rdl` | `rdl/<codice>` | 730 days *or* none | Regio decreto-legge: 730d post-L. 100/1926 (≥ 1926-02-09); pre-1926 has no automatic decadenza |
| `dll` | `dll/<codice>` | none | Decreto-legge luogotenenziale **1944–46 only** (`data_gu` 1944-06-25 … 1947-12-31); WWI same denomination → `history` |
| `dlcps` | `dlcps/<codice>` | none | Decreto legislativo del Capo provvisorio dello Stato (1946–47), ratified en bloc by L. 561/1956 |

Acts with no automatic decadenza wait indefinitely on their branch until
either a ratifying law is published or Normattiva flags them as abrogated.

## Architecture (one-liner per module)

- [src/main.rs](https://github.com/dej611/italian-laws-history/blob/main/src/main.rs) — CLI parsing, runtime bootstrap, monthly-window loop
- [src/config.rs](https://github.com/dej611/italian-laws-history/blob/main/src/config.rs) — env-var-driven `Config`
- [src/types.rs](https://github.com/dej611/italian-laws-history/blob/main/src/types.rs) — DTOs, `Checkpoint`, `BranchableShort`, `PendingAct`
- [src/http.rs](https://github.com/dej611/italian-laws-history/blob/main/src/http.rs) — `safe_fetch`: `governor` rate limiter + `Semaphore` + `moka` TTL cache + recursive backoff (`Retry-After` seconds *and* HTTP-date) + 30s timeout
- [src/api/text.rs](https://github.com/dej611/italian-laws-history/blob/main/src/api/text.rs) — pure helpers: HTML→plaintext, URN extraction, denomination map, filename builders, `resolve_branchable_type`
- [src/api/windows.rs](https://github.com/dej611/italian-laws-history/blob/main/src/api/windows.rs) — `monthly_windows` iterator
- [src/api/search.rs](https://github.com/dej611/italian-laws-history/blob/main/src/api/search.rs) — `ricerca/avanzata`, `ricerca/aggiornati`; `scrape_month` async stream
- [src/api/detail.rs](https://github.com/dej611/italian-laws-history/blob/main/src/api/detail.rs) — `dettaglio-atto-urn`, conversion-law search, status lookup
- [src/processor.rs](https://github.com/dej611/italian-laws-history/blob/main/src/processor.rs) — Phase A (`process_batches`), Phase B (`process_modified_acts`), `reconcile_pending_acts`
- [src/checkpoint.rs](https://github.com/dej611/italian-laws-history/blob/main/src/checkpoint.rs) — atomic JSON I/O via `tempfile`
- [src/git.rs](https://github.com/dej611/italian-laws-history/blob/main/src/git.rs) — shell-out git wrapper, branch constants, history-branch bootstrap
- [src/github.rs](https://github.com/dej611/italian-laws-history/blob/main/src/github.rs) — `gh` PR create/comment into `history` (no-op without token/repo)
- [src/logger/](https://github.com/dej611/italian-laws-history/blob/main/src/logger) — `Logger` trait + `CiLogger` + `FileLogWrapper` + `ratatui` TUI
- [src/tracing\_setup.rs](https://github.com/dej611/italian-laws-history/blob/main/src/tracing_setup.rs) — `tracing-subscriber` + `tracing-chrome` on `--perf`

## Development

```
cargo build              # debug build
cargo test               # unit tests
cargo clippy --all-targets
cargo build --release    # optimized binary
```

## CI

`main` is the repository's default branch. Scheduled workflows are read
from there. The scrape job checks out `main` for this source tree.

[.github/workflows/daily-scrape.yml](https://github.com/dej611/italian-laws-history/blob/main/.github/workflows/daily-scrape.yml) runs
the binary daily at 12:00 UTC with `--ci`. It fetches only the tip of
`history`. The `progress-rs.json` checkpoint is committed back to `main`.

[.github/workflows/pages.yml](https://github.com/dej611/italian-laws-history/blob/main/.github/workflows/pages.yml) checks out
`explore`, reads that checkpoint from `main`, and reads the tip of
`history` (`commit-index.tsv` plus the current texts). It publishes
`dist/` to `gh-pages`.

## Digesto

Digesto, the assistant in OpenNorme (`explore`), is inspired by
[ClippyJS](https://github.com/pi0/clippyjs) (`clippyjs`), a rewrite of
[Clippy.JS](https://github.com/clippyjs/clippy.js). The sprite animator,
action queue, and speech balloon follow that agent model. Digesto's drawings
and copy are original to this project. Clippy and the other Office assistants
remain Microsoft's.

## License

The scraper and the other source on `main`, and OpenNorme on `explore`,
are [MIT](https://github.com/dej611/italian-laws-history/blob/main/LICENSE). The license badge GitHub shows for this repository
refers to that code.

The law texts on `history`, and the `data/` files built from them onto
`gh-pages`, are Normattiva open data from the Istituto Poligrafico e Zecca
dello Stato, under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
`history` carries the attribution in `NOTICE`. Keep it with any
redistribution of those texts:

> Fonte: Normattiva (<https://www.normattiva.it>), Istituto Poligrafico e Zecca
> dello Stato, licenza CC BY 4.0. Testo non autentico e gratuito: l'unico
> testo ufficiale è quello pubblicato sulla Gazzetta Ufficiale a mezzo stampa.
dej611_110
🟧 echo.github ⭐The repository is the original project artifact (not a report relaying another creator's post): its description says, “Italian law as git hidej611——

Interpretation history

Decision trace