Fix Hub Viewer conversion fan-out
Browse filesExpose one stable research_view configuration while preserving all 26 CSV/Parquet tables. Keep the frozen v0.4.0 release immutable and separate historical-package verification from mutable-main parity.
- CHANGELOG.md +6 -0
- README.md +23 -57
- docs/guia-rapida-es.md +18 -6
- docs/red-team-v0.4.0.md +4 -2
- package.json +1 -0
- scripts/build-release-manifest.mjs +20 -1
- scripts/test-hardening.mjs +35 -1
- scripts/validate-data.mjs +33 -6
- scripts/verify-package.mjs +17 -8
CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
| 1 |
# Changelog
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
## 0.4.0 — 2026-08-15
|
| 4 |
|
| 5 |
- Defined the release unambiguously as a purposive, exploratory evidence index: not proof of agency transfer, not a prevalence sample, and not a causal estimate of election effects.
|
|
|
|
| 1 |
# Changelog
|
| 2 |
|
| 3 |
+
## Unreleased — Viewer metadata hotfix
|
| 4 |
+
|
| 5 |
+
- Limited the mutable `main` dataset card to one interactive `research_view` configuration after Hugging Face's 26-way conversion fan-out repeatedly hit shared-branch locks. All 26 canonical CSV and Parquet tables remain unchanged and directly downloadable.
|
| 6 |
+
- Replaced links to retired Data Studio configurations with frozen file links and added a direct loader recipe for any table.
|
| 7 |
+
- Kept the `v0.4.0` tag and its ZIP, workbook and checksums immutable; release verification now distinguishes the frozen package from later documentation-only changes on `main`.
|
| 8 |
+
|
| 9 |
## 0.4.0 — 2026-08-15
|
| 10 |
|
| 11 |
- Defined the release unambiguously as a purposive, exploratory evidence index: not proof of agency transfer, not a prevalence sample, and not a causal estimate of election effects.
|
README.md
CHANGED
|
@@ -3,8 +3,6 @@ license: cc-by-4.0
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
pretty_name: AI, Elections and Agency Transfer Evidence Index
|
| 6 |
-
size_categories:
|
| 7 |
-
- 1K<n<10K
|
| 8 |
tags:
|
| 9 |
- elections
|
| 10 |
- political-disinformation
|
|
@@ -16,62 +14,14 @@ configs:
|
|
| 16 |
- config_name: research_view
|
| 17 |
default: true
|
| 18 |
data_files: [{split: data, path: parquet/research_view.parquet}]
|
| 19 |
-
- config_name: case_catalog
|
| 20 |
-
data_files: [{split: data, path: parquet/case_catalog.parquet}]
|
| 21 |
-
- config_name: pathways
|
| 22 |
-
data_files: [{split: data, path: parquet/pathways.parquet}]
|
| 23 |
-
- config_name: observations
|
| 24 |
-
data_files: [{split: data, path: parquet/observations.parquet}]
|
| 25 |
-
- config_name: model_evaluations
|
| 26 |
-
data_files: [{split: data, path: parquet/model_evaluations.parquet}]
|
| 27 |
-
- config_name: cases
|
| 28 |
-
data_files: [{split: data, path: parquet/cases.parquet}]
|
| 29 |
-
- config_name: claims
|
| 30 |
-
data_files: [{split: data, path: parquet/claims.parquet}]
|
| 31 |
-
- config_name: sources
|
| 32 |
-
data_files: [{split: data, path: parquet/sources.parquet}]
|
| 33 |
-
- config_name: claim_evidence
|
| 34 |
-
data_files: [{split: data, path: parquet/claim_evidence.parquet}]
|
| 35 |
-
- config_name: analytic_record_claims
|
| 36 |
-
data_files: [{split: data, path: parquet/analytic_record_claims.parquet}]
|
| 37 |
-
- config_name: events
|
| 38 |
-
data_files: [{split: data, path: parquet/events.parquet}]
|
| 39 |
-
- config_name: case_sources
|
| 40 |
-
data_files: [{split: data, path: parquet/case_sources.parquet}]
|
| 41 |
-
- config_name: case_actors
|
| 42 |
-
data_files: [{split: data, path: parquet/case_actors.parquet}]
|
| 43 |
-
- config_name: technology_uses
|
| 44 |
-
data_files: [{split: data, path: parquet/technology_uses.parquet}]
|
| 45 |
-
- config_name: content_items
|
| 46 |
-
data_files: [{split: data, path: parquet/content_items.parquet}]
|
| 47 |
-
- config_name: case_elections
|
| 48 |
-
data_files: [{split: data, path: parquet/case_elections.parquet}]
|
| 49 |
-
- config_name: election_sources
|
| 50 |
-
data_files: [{split: data, path: parquet/election_sources.parquet}]
|
| 51 |
-
- config_name: sampling_frame
|
| 52 |
-
data_files: [{split: data, path: parquet/sampling_frame.parquet}]
|
| 53 |
-
- config_name: coverage_summary
|
| 54 |
-
data_files: [{split: data, path: parquet/coverage_summary.parquet}]
|
| 55 |
-
- config_name: candidates
|
| 56 |
-
data_files: [{split: data, path: parquet/candidates.parquet}]
|
| 57 |
-
- config_name: watchlist
|
| 58 |
-
data_files: [{split: data, path: parquet/watchlist.parquet}]
|
| 59 |
-
- config_name: official_elections
|
| 60 |
-
data_files: [{split: data, path: parquet/official_elections.parquet}]
|
| 61 |
-
- config_name: official_election_metrics
|
| 62 |
-
data_files: [{split: data, path: parquet/official_election_metrics.parquet}]
|
| 63 |
-
- config_name: official_turnout
|
| 64 |
-
data_files: [{split: data, path: parquet/official_turnout.parquet}]
|
| 65 |
-
- config_name: official_results
|
| 66 |
-
data_files: [{split: data, path: parquet/official_results.parquet}]
|
| 67 |
-
- config_name: official_data_sources
|
| 68 |
-
data_files: [{split: data, path: parquet/official_data_sources.parquet}]
|
| 69 |
---
|
| 70 |
|
| 71 |
# AI, Elections and Agency Transfer Evidence Index
|
| 72 |
|
| 73 |
**Version 0.4.0 · released 15 August 2026 · research cutoff 12 August 2026**
|
| 74 |
|
|
|
|
|
|
|
| 75 |
This is a **purposive, exploratory evidence index**. It makes claims, sources, counterevidence, uncertainty, mechanisms, and selected measurements easier to inspect. It does **not** empirically prove the agency-transfer hypothesis, estimate how common election manipulation is, or identify votes or election outcomes caused by AI.
|
| 76 |
|
| 77 |
The repository slug is inherited. The canonical title is the one above: the index also contains preparedness files, boundary comparisons, screening leads, official electoral context, and empirical model studies. Inclusion is not a finding that every record is manipulative or harmful.
|
|
@@ -82,7 +32,7 @@ The repository slug is inherited. The canonical title is the one above: the inde
|
|
| 82 |
- [Read the Spanish quick guide](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/main/docs/guia-rapida-es.md) — concise interpretation guide.
|
| 83 |
- [Read the methodology](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/main/docs/methodology.md) — units, coding and limitations.
|
| 84 |
- [Read the v0.4.0 red-team report](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/main/docs/red-team-v0.4.0.md) — findings, fixes and residual limits.
|
| 85 |
-
- [Inspect the claim–evidence table](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/
|
| 86 |
- [Download the complete v0.4.0 package](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/resolve/v0.4.0/release/agency-transfer-election-cases-v0.4.0.zip?download=true) — CSV, Parquet, documentation, ledgers, scripts and workbook.
|
| 87 |
- [Download the v0.4.0 Excel workbook](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/resolve/v0.4.0/release/agency-transfer-election-evidence-index-v0.4.0.xlsx?download=true) — navigation and QA convenience artifact.
|
| 88 |
- [Verify release checksums](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/v0.4.0/release/SHA256SUMS) — hashes for the frozen ZIP and workbook.
|
|
@@ -111,9 +61,9 @@ These counts describe the generated v0.4.0 build and must be refreshed if that b
|
|
| 111 |
|
| 112 |
The strongest pathway conclusion is deliberately limited: 4 records show an observed control mechanism, 2 show an observed attempted transfer, 2 remain insufficient, and 2 are preparedness records rather than incidents. **No record codes observed agency change or observed agency preservation/extension.** These categories describe evidence ceilings, not severity scores.
|
| 113 |
|
| 114 |
-
## The 26
|
| 115 |
|
| 116 |
-
| Use |
|
| 117 |
|---|---|
|
| 118 |
| Orient and scope | `research_view`, `case_catalog`, `coverage_summary`, `sampling_frame` |
|
| 119 |
| Claims and evidence | `cases`, `claims`, `sources`, `claim_evidence`, `analytic_record_claims` |
|
|
@@ -122,7 +72,9 @@ The strongest pathway conclusion is deliberately limited: 4 records show an obse
|
|
| 122 |
| Discovery | `candidates`, `watchlist` |
|
| 123 |
| Empirical capability evidence | `model_evaluations` |
|
| 124 |
|
| 125 |
-
|
|
|
|
|
|
|
| 126 |
|
| 127 |
Files under `research/` are transparent build inputs and historical working ledgers, not canonical v0.4.0 tables. Some retain superseded draft annotations; see [`research/README.md`](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/main/research/README.md) before using them.
|
| 128 |
|
|
@@ -141,6 +93,16 @@ view = load_dataset(
|
|
| 141 |
)
|
| 142 |
```
|
| 143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
### pandas
|
| 145 |
|
| 146 |
```python
|
|
@@ -229,11 +191,15 @@ After the externally generated workbook is frozen in `release/`, maintainers run
|
|
| 229 |
|
| 230 |
```bash
|
| 231 |
npm run build:package
|
| 232 |
-
npm run verify:package
|
| 233 |
npm run build:release-manifest
|
| 234 |
npm run validate
|
| 235 |
```
|
| 236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
`npm run audit:links` is a separate, time-dependent network check; it is not evidence that a blocked or rate-limited page is absent. Within the declared runtime and inputs, the deterministic scripts rebuild and check the tabular and packaged artifacts they cover. That remains narrower than end-to-end source reproducibility: external pages are not frozen, 47 pinpoints cover only a factual premise or part of their claim, 20 relations have no verified pinpoint, and automated QA does not validate source truth.
|
| 238 |
|
| 239 |
The Excel workbook is a convenience artifact, not the canonical analytic source. Its builder requires the `@oai/artifact-tool` runtime, which is not part of the public `package.json`; use CSV or Parquet unless that environment is available. The ZIP and workbook should be verified against the release manifest, not assumed equivalent merely because their filenames contain the same version.
|
|
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
pretty_name: AI, Elections and Agency Transfer Evidence Index
|
|
|
|
|
|
|
| 6 |
tags:
|
| 7 |
- elections
|
| 8 |
- political-disinformation
|
|
|
|
| 14 |
- config_name: research_view
|
| 15 |
default: true
|
| 16 |
data_files: [{split: data, path: parquet/research_view.parquet}]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
---
|
| 18 |
|
| 19 |
# AI, Elections and Agency Transfer Evidence Index
|
| 20 |
|
| 21 |
**Version 0.4.0 · released 15 August 2026 · research cutoff 12 August 2026**
|
| 22 |
|
| 23 |
+
**Viewer hotfix on `main`, 15 August 2026:** Data Studio now exposes one orientation view. The frozen `v0.4.0` tag, its 26 tables, ZIP, workbook and checksums are unchanged.
|
| 24 |
+
|
| 25 |
This is a **purposive, exploratory evidence index**. It makes claims, sources, counterevidence, uncertainty, mechanisms, and selected measurements easier to inspect. It does **not** empirically prove the agency-transfer hypothesis, estimate how common election manipulation is, or identify votes or election outcomes caused by AI.
|
| 26 |
|
| 27 |
The repository slug is inherited. The canonical title is the one above: the index also contains preparedness files, boundary comparisons, screening leads, official electoral context, and empirical model studies. Inclusion is not a finding that every record is manipulative or harmful.
|
|
|
|
| 32 |
- [Read the Spanish quick guide](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/main/docs/guia-rapida-es.md) — concise interpretation guide.
|
| 33 |
- [Read the methodology](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/main/docs/methodology.md) — units, coding and limitations.
|
| 34 |
- [Read the v0.4.0 red-team report](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/main/docs/red-team-v0.4.0.md) — findings, fixes and residual limits.
|
| 35 |
+
- [Inspect the claim–evidence table](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/v0.4.0/data/claim_evidence.csv) — trace claims to source records.
|
| 36 |
- [Download the complete v0.4.0 package](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/resolve/v0.4.0/release/agency-transfer-election-cases-v0.4.0.zip?download=true) — CSV, Parquet, documentation, ledgers, scripts and workbook.
|
| 37 |
- [Download the v0.4.0 Excel workbook](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/resolve/v0.4.0/release/agency-transfer-election-evidence-index-v0.4.0.xlsx?download=true) — navigation and QA convenience artifact.
|
| 38 |
- [Verify release checksums](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/v0.4.0/release/SHA256SUMS) — hashes for the frozen ZIP and workbook.
|
|
|
|
| 61 |
|
| 62 |
The strongest pathway conclusion is deliberately limited: 4 records show an observed control mechanism, 2 show an observed attempted transfer, 2 remain insufficient, and 2 are preparedness records rather than incidents. **No record codes observed agency change or observed agency preservation/extension.** These categories describe evidence ceilings, not severity scores.
|
| 63 |
|
| 64 |
+
## The 26 tables
|
| 65 |
|
| 66 |
+
| Use | Table names |
|
| 67 |
|---|---|
|
| 68 |
| Orient and scope | `research_view`, `case_catalog`, `coverage_summary`, `sampling_frame` |
|
| 69 |
| Claims and evidence | `cases`, `claims`, `sources`, `claim_evidence`, `analytic_record_claims` |
|
|
|
|
| 72 |
| Discovery | `candidates`, `watchlist` |
|
| 73 |
| Empirical capability evidence | `model_evaluations` |
|
| 74 |
|
| 75 |
+
All 26 canonical tables are available as CSV in [`data/`](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/tree/v0.4.0/data) and as native Parquet in [`parquet/`](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/tree/v0.4.0/parquet). Relational types, keys and foreign keys are declared in [`data/datapackage.json`](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/v0.4.0/data/datapackage.json).
|
| 76 |
+
|
| 77 |
+
Only `research_view` is declared as an interactive Data Studio configuration. This keeps the public preview small and avoids conversion-lock contention among 26 unrelated schemas. It does not remove or merge any table; load the other 25 directly from their CSV or Parquet files.
|
| 78 |
|
| 79 |
Files under `research/` are transparent build inputs and historical working ledgers, not canonical v0.4.0 tables. Some retain superseded draft annotations; see [`research/README.md`](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/main/research/README.md) before using them.
|
| 80 |
|
|
|
|
| 93 |
)
|
| 94 |
```
|
| 95 |
|
| 96 |
+
To load any of the 26 tables directly, replace `claim_evidence` with a table name from the map above:
|
| 97 |
+
|
| 98 |
+
```python
|
| 99 |
+
from datasets import load_dataset
|
| 100 |
+
|
| 101 |
+
table = "claim_evidence"
|
| 102 |
+
url = f"https://huggingface.co/datasets/apol/ai-election-manipulation-cases/resolve/v0.4.0/parquet/{table}.parquet"
|
| 103 |
+
records = load_dataset("parquet", data_files={"data": url}, split="data")
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
### pandas
|
| 107 |
|
| 108 |
```python
|
|
|
|
| 191 |
|
| 192 |
```bash
|
| 193 |
npm run build:package
|
| 194 |
+
npm run verify:package:checkout
|
| 195 |
npm run build:release-manifest
|
| 196 |
npm run validate
|
| 197 |
```
|
| 198 |
|
| 199 |
+
`npm run verify:package` verifies the frozen ZIP internally against its embedded manifest and checksums. Use `npm run verify:package:checkout` only while cutting a release to additionally require byte-for-byte parity with the current checkout; later documentation-only changes on mutable `main` do not rewrite an existing release.
|
| 200 |
+
|
| 201 |
+
Do not run `build:package` to overwrite an already tagged version from mutable `main`; bump the version and cut a new tag first.
|
| 202 |
+
|
| 203 |
`npm run audit:links` is a separate, time-dependent network check; it is not evidence that a blocked or rate-limited page is absent. Within the declared runtime and inputs, the deterministic scripts rebuild and check the tabular and packaged artifacts they cover. That remains narrower than end-to-end source reproducibility: external pages are not frozen, 47 pinpoints cover only a factual premise or part of their claim, 20 relations have no verified pinpoint, and automated QA does not validate source truth.
|
| 204 |
|
| 205 |
The Excel workbook is a convenience artifact, not the canonical analytic source. Its builder requires the `@oai/artifact-tool` runtime, which is not part of the public `package.json`; use CSV or Parquet unless that environment is available. The ZIP and workbook should be verified against the release manifest, not assumed equivalent merely because their filenames contain the same version.
|
docs/guia-rapida-es.md
CHANGED
|
@@ -9,16 +9,16 @@ Los datos y campos codificados están en inglés. Esta guía y algunos metadatos
|
|
| 9 |
## Empiece aquí
|
| 10 |
|
| 11 |
1. [Vista de investigación](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/viewer/research_view/data): 10 registros resumidos.
|
| 12 |
-
2. [Catálogo completo](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/
|
| 13 |
-
3. [Vías analíticas](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/
|
| 14 |
-
4. [Afirmaciones](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/
|
| 15 |
-
5. [Observaciones](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/
|
| 16 |
|
| 17 |
El proyecto forma parte de la [colección Agency Transfer](https://huggingface.co/collections/apol/agency-transfer).
|
| 18 |
|
| 19 |
-
## Mapa de las 26
|
| 20 |
|
| 21 |
-
| Uso |
|
| 22 |
|---|---|
|
| 23 |
| Orientación y cobertura | `research_view`, `case_catalog`, `coverage_summary`, `sampling_frame` |
|
| 24 |
| Afirmaciones y evidencia | `cases`, `claims`, `sources`, `claim_evidence`, `analytic_record_claims` |
|
|
@@ -27,6 +27,8 @@ El proyecto forma parte de la [colección Agency Transfer](https://huggingface.c
|
|
| 27 |
| Descubrimiento | `candidates`, `watchlist` |
|
| 28 |
| Estudios de modelos | `model_evaluations` |
|
| 29 |
|
|
|
|
|
|
|
| 30 |
## Cargar una versión fija
|
| 31 |
|
| 32 |
```python
|
|
@@ -40,6 +42,16 @@ vista = load_dataset(
|
|
| 40 |
)
|
| 41 |
```
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
Con pandas o Polars:
|
| 44 |
|
| 45 |
```python
|
|
|
|
| 9 |
## Empiece aquí
|
| 10 |
|
| 11 |
1. [Vista de investigación](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/viewer/research_view/data): 10 registros resumidos.
|
| 12 |
+
2. [Catálogo completo](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/v0.4.0/data/case_catalog.csv): separa núcleo, candidatos y estudios de modelos.
|
| 13 |
+
3. [Vías analíticas](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/v0.4.0/data/pathways.csv): mecanismo, control y estatus epistémico.
|
| 14 |
+
4. [Afirmaciones](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/v0.4.0/data/claims.csv) y [relaciones de evidencia](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/v0.4.0/data/claim_evidence.csv): base para cualquier uso factual.
|
| 15 |
+
5. [Observaciones](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/blob/v0.4.0/data/observations.csv): cantidades seleccionadas con unidad, denominador y estatus causal.
|
| 16 |
|
| 17 |
El proyecto forma parte de la [colección Agency Transfer](https://huggingface.co/collections/apol/agency-transfer).
|
| 18 |
|
| 19 |
+
## Mapa de las 26 tablas
|
| 20 |
|
| 21 |
+
| Uso | Tablas |
|
| 22 |
|---|---|
|
| 23 |
| Orientación y cobertura | `research_view`, `case_catalog`, `coverage_summary`, `sampling_frame` |
|
| 24 |
| Afirmaciones y evidencia | `cases`, `claims`, `sources`, `claim_evidence`, `analytic_record_claims` |
|
|
|
|
| 27 |
| Descubrimiento | `candidates`, `watchlist` |
|
| 28 |
| Estudios de modelos | `model_evaluations` |
|
| 29 |
|
| 30 |
+
Data Studio muestra de forma interactiva solo `research_view`. Las 26 tablas completas siguen disponibles en [`data/`](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/tree/v0.4.0/data) como CSV y en [`parquet/`](https://huggingface.co/datasets/apol/ai-election-manipulation-cases/tree/v0.4.0/parquet) como Parquet. Esta separación evita que 26 esquemas distintos compitan durante la conversión del Viewer.
|
| 31 |
+
|
| 32 |
## Cargar una versión fija
|
| 33 |
|
| 34 |
```python
|
|
|
|
| 42 |
)
|
| 43 |
```
|
| 44 |
|
| 45 |
+
Para cargar cualquier tabla por nombre:
|
| 46 |
+
|
| 47 |
+
```python
|
| 48 |
+
from datasets import load_dataset
|
| 49 |
+
|
| 50 |
+
tabla = "claim_evidence"
|
| 51 |
+
url = f"https://huggingface.co/datasets/apol/ai-election-manipulation-cases/resolve/v0.4.0/parquet/{tabla}.parquet"
|
| 52 |
+
datos = load_dataset("parquet", data_files={"data": url}, split="data")
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
Con pandas o Polars:
|
| 56 |
|
| 57 |
```python
|
docs/red-team-v0.4.0.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
# Red-team report for v0.4.0
|
| 2 |
|
|
|
|
|
|
|
| 3 |
## Verdict
|
| 4 |
|
| 5 |
Version 0.4.0 is an exploratory evidence index, not an empirical test of the agency-transfer hypothesis. The red-team found that v0.3.1 was structurally useful but its central pathway field could make inferred control shifts look observed. The release was therefore recoded rather than patched cosmetically.
|
|
@@ -20,7 +22,7 @@ Version 0.4.0 is an exploratory evidence index, not an empirical test of the age
|
|
| 20 |
| The validator could pass stale audits, a forged Parquet manifest or silent type coercion | The v0.4 validator compares stored and live audits, verifies all 26 CSV/Parquet schemas and hashes, rejects invalid coercion, and has isolated mutation tests. |
|
| 21 |
| Legacy scripts could overwrite current outputs | The old `audit-data.mjs` entry point is now a read-only compatibility wrapper; the v0.4 auditor retains its historical `audit-v03.mjs` filename, and the obsolete workbook entry point fails before writing. |
|
| 22 |
| Public version identity and packaged metadata drifted | v0.4 aligns README, CFF, package, datapackage, Parquet manifest, workbook and ZIP; package members and release artifacts receive explicit SHA-256 manifests. |
|
| 23 |
-
| Dataset-card onboarding and link health were weak | Added clickable entry points, a 26-
|
| 24 |
|
| 25 |
## What remains unresolved
|
| 26 |
|
|
@@ -41,6 +43,6 @@ A publishable v0.4.0 build must satisfy all of the following:
|
|
| 41 |
5. a visually reviewed workbook whose QA sheet reports the same audit result;
|
| 42 |
6. a safe ZIP whose member hashes match both its internal manifest and the checked-out files;
|
| 43 |
7. external SHA-256 checksums for the ZIP and workbook;
|
| 44 |
-
8. a fixed Hub revision, public downloads and anonymous Data Studio
|
| 45 |
|
| 46 |
This report records model-assisted red-team work. It is not a peer review, source-by-source adjudication, legal opinion or substitute for independent replication.
|
|
|
|
| 1 |
# Red-team report for v0.4.0
|
| 2 |
|
| 3 |
+
> Post-release Viewer note, 15 August 2026: the original 26-configuration Data Studio fan-out repeatedly hit shared conversion locks. The mutable `main` card now exposes only `research_view`; all frozen v0.4.0 CSV, Parquet and release artifacts remain unchanged. Acceptance criterion 8 below reflects that operational correction.
|
| 4 |
+
|
| 5 |
## Verdict
|
| 6 |
|
| 7 |
Version 0.4.0 is an exploratory evidence index, not an empirical test of the agency-transfer hypothesis. The red-team found that v0.3.1 was structurally useful but its central pathway field could make inferred control shifts look observed. The release was therefore recoded rather than patched cosmetically.
|
|
|
|
| 22 |
| The validator could pass stale audits, a forged Parquet manifest or silent type coercion | The v0.4 validator compares stored and live audits, verifies all 26 CSV/Parquet schemas and hashes, rejects invalid coercion, and has isolated mutation tests. |
|
| 23 |
| Legacy scripts could overwrite current outputs | The old `audit-data.mjs` entry point is now a read-only compatibility wrapper; the v0.4 auditor retains its historical `audit-v03.mjs` filename, and the obsolete workbook entry point fails before writing. |
|
| 24 |
| Public version identity and packaged metadata drifted | v0.4 aligns README, CFF, package, datapackage, Parquet manifest, workbook and ZIP; package members and release artifacts receive explicit SHA-256 manifests. |
|
| 25 |
+
| Dataset-card onboarding and link health were weak | Added clickable entry points, a 26-table map, English-language metadata, a Spanish guide, pinned Datasets/pandas/Polars recipes and corrected known dead links. Data Studio exposes one orientation view; all tables remain directly loadable. |
|
| 26 |
|
| 27 |
## What remains unresolved
|
| 28 |
|
|
|
|
| 43 |
5. a visually reviewed workbook whose QA sheet reports the same audit result;
|
| 44 |
6. a safe ZIP whose member hashes match both its internal manifest and the checked-out files;
|
| 45 |
7. external SHA-256 checksums for the ZIP and workbook;
|
| 46 |
+
8. a fixed Hub revision, public downloads for all 26 tables and an anonymous Data Studio check for the `research_view` orientation configuration.
|
| 47 |
|
| 48 |
This report records model-assisted red-team work. It is not a peer review, source-by-source adjudication, legal opinion or substitute for independent replication.
|
package.json
CHANGED
|
@@ -15,6 +15,7 @@
|
|
| 15 |
"build:parquet": "node scripts/build-parquet.mjs",
|
| 16 |
"build:package": "node scripts/build-package.mjs",
|
| 17 |
"verify:package": "node scripts/verify-package.mjs",
|
|
|
|
| 18 |
"build:release-manifest": "node scripts/build-release-manifest.mjs",
|
| 19 |
"audit:links": "node scripts/audit-links.mjs",
|
| 20 |
"test:hardening": "node scripts/test-hardening.mjs"
|
|
|
|
| 15 |
"build:parquet": "node scripts/build-parquet.mjs",
|
| 16 |
"build:package": "node scripts/build-package.mjs",
|
| 17 |
"verify:package": "node scripts/verify-package.mjs",
|
| 18 |
+
"verify:package:checkout": "node scripts/verify-package.mjs --checkout-parity",
|
| 19 |
"build:release-manifest": "node scripts/build-release-manifest.mjs",
|
| 20 |
"audit:links": "node scripts/audit-links.mjs",
|
| 21 |
"test:hardening": "node scripts/test-hardening.mjs"
|
scripts/build-release-manifest.mjs
CHANGED
|
@@ -11,12 +11,15 @@
|
|
| 11 |
import fs from "node:fs/promises";
|
| 12 |
import path from "node:path";
|
| 13 |
import { createHash } from "node:crypto";
|
|
|
|
| 14 |
import { fileURLToPath } from "node:url";
|
| 15 |
|
| 16 |
const RELEASE_VERSION = "0.4.0";
|
| 17 |
const here = path.dirname(fileURLToPath(import.meta.url));
|
| 18 |
const root = path.resolve(here, "..");
|
| 19 |
const releaseDir = path.join(root, "release");
|
|
|
|
|
|
|
| 20 |
const requested = process.argv.slice(2);
|
| 21 |
const releasePattern = new RegExp(`-v${RELEASE_VERSION.replaceAll(".", "\\.")}\\.(?:zip|xlsx)$`);
|
| 22 |
const packageFiles = ["README.md", "CITATION.cff", "package.json", "data/datapackage.json"];
|
|
@@ -33,6 +36,18 @@ function safeArtifactName(value) {
|
|
| 33 |
return name;
|
| 34 |
}
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
let artifactNames;
|
| 37 |
if (requested.length) {
|
| 38 |
artifactNames = requested.map(safeArtifactName);
|
|
@@ -43,6 +58,9 @@ artifactNames = [...new Set(artifactNames)].sort();
|
|
| 43 |
if (!artifactNames.length) {
|
| 44 |
throw new Error(`No v${RELEASE_VERSION} ZIP/XLSX artifacts found in release/. Build them before checksums.`);
|
| 45 |
}
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
const artifacts = [];
|
| 48 |
for (const name of artifactNames) {
|
|
@@ -51,8 +69,9 @@ for (const name of artifactNames) {
|
|
| 51 |
}
|
| 52 |
|
| 53 |
const packageFileEntries = [];
|
|
|
|
| 54 |
for (const name of packageFiles) {
|
| 55 |
-
const buffer =
|
| 56 |
packageFileEntries.push({ name, bytes: buffer.byteLength, sha256: sha256(buffer) });
|
| 57 |
}
|
| 58 |
|
|
|
|
| 11 |
import fs from "node:fs/promises";
|
| 12 |
import path from "node:path";
|
| 13 |
import { createHash } from "node:crypto";
|
| 14 |
+
import { spawnSync } from "node:child_process";
|
| 15 |
import { fileURLToPath } from "node:url";
|
| 16 |
|
| 17 |
const RELEASE_VERSION = "0.4.0";
|
| 18 |
const here = path.dirname(fileURLToPath(import.meta.url));
|
| 19 |
const root = path.resolve(here, "..");
|
| 20 |
const releaseDir = path.join(root, "release");
|
| 21 |
+
const packageRoot = `agency-transfer-election-cases-v${RELEASE_VERSION}`;
|
| 22 |
+
const packageZipName = `${packageRoot}.zip`;
|
| 23 |
const requested = process.argv.slice(2);
|
| 24 |
const releasePattern = new RegExp(`-v${RELEASE_VERSION.replaceAll(".", "\\.")}\\.(?:zip|xlsx)$`);
|
| 25 |
const packageFiles = ["README.md", "CITATION.cff", "package.json", "data/datapackage.json"];
|
|
|
|
| 36 |
return name;
|
| 37 |
}
|
| 38 |
|
| 39 |
+
function readZipMember(zipPath, member) {
|
| 40 |
+
const result = spawnSync("unzip", ["-p", zipPath, member], {
|
| 41 |
+
encoding: null,
|
| 42 |
+
maxBuffer: 128 * 1024 * 1024
|
| 43 |
+
});
|
| 44 |
+
if (result.error) throw result.error;
|
| 45 |
+
if (result.status !== 0) {
|
| 46 |
+
throw new Error(`Could not read ${member} from ${path.basename(zipPath)}: ${String(result.stderr || "").trim()}`);
|
| 47 |
+
}
|
| 48 |
+
return Buffer.from(result.stdout);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
let artifactNames;
|
| 52 |
if (requested.length) {
|
| 53 |
artifactNames = requested.map(safeArtifactName);
|
|
|
|
| 58 |
if (!artifactNames.length) {
|
| 59 |
throw new Error(`No v${RELEASE_VERSION} ZIP/XLSX artifacts found in release/. Build them before checksums.`);
|
| 60 |
}
|
| 61 |
+
if (!artifactNames.includes(packageZipName)) {
|
| 62 |
+
throw new Error(`The frozen package ${packageZipName} is required to build release package-file checksums.`);
|
| 63 |
+
}
|
| 64 |
|
| 65 |
const artifacts = [];
|
| 66 |
for (const name of artifactNames) {
|
|
|
|
| 69 |
}
|
| 70 |
|
| 71 |
const packageFileEntries = [];
|
| 72 |
+
const packageZipPath = path.join(releaseDir, packageZipName);
|
| 73 |
for (const name of packageFiles) {
|
| 74 |
+
const buffer = readZipMember(packageZipPath, `${packageRoot}/${name}`);
|
| 75 |
packageFileEntries.push({ name, bytes: buffer.byteLength, sha256: sha256(buffer) });
|
| 76 |
}
|
| 77 |
|
scripts/test-hardening.mjs
CHANGED
|
@@ -167,10 +167,43 @@ try {
|
|
| 167 |
assert(packageRebuild.status === 0 && firstZipHash === secondZipHash, "Repeated package build was not byte-deterministic");
|
| 168 |
const packageVerification = run(repo, "verify-package.mjs");
|
| 169 |
assert(packageVerification.status === 0, `Package member verification failed.\n${packageVerification.stdout}\n${packageVerification.stderr}`);
|
|
|
|
|
|
|
| 170 |
const manifestBuild = run(repo, "build-release-manifest.mjs");
|
| 171 |
assert(manifestBuild.status === 0, `Release manifest fixture build failed.\n${manifestBuild.stdout}\n${manifestBuild.stderr}`);
|
| 172 |
const cleanValidation = run(repo, "validate-data.mjs");
|
| 173 |
assert(cleanValidation.status === 0, `Matching release manifest fixture did not validate.\n${cleanValidation.stdout}\n${cleanValidation.stderr}`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
await fs.appendFile(path.join(releaseDir, zipName), "tampered\n");
|
| 175 |
const tamperedValidation = run(repo, "validate-data.mjs");
|
| 176 |
const codes = errorCodes(tamperedValidation);
|
|
@@ -181,7 +214,8 @@ try {
|
|
| 181 |
results.push({
|
| 182 |
mutation: "release_artifact_after_manifest", status: "rejected",
|
| 183 |
code: "RELEASE_ARTIFACT_HASH_MISMATCH", deterministic_package_rebuild: true,
|
| 184 |
-
package_member_verification: "pass"
|
|
|
|
| 185 |
});
|
| 186 |
}
|
| 187 |
|
|
|
|
| 167 |
assert(packageRebuild.status === 0 && firstZipHash === secondZipHash, "Repeated package build was not byte-deterministic");
|
| 168 |
const packageVerification = run(repo, "verify-package.mjs");
|
| 169 |
assert(packageVerification.status === 0, `Package member verification failed.\n${packageVerification.stdout}\n${packageVerification.stderr}`);
|
| 170 |
+
const initialCheckoutParity = run(repo, "verify-package.mjs", ["--checkout-parity"]);
|
| 171 |
+
assert(initialCheckoutParity.status === 0, `Fresh package must match its checkout.\n${initialCheckoutParity.stdout}\n${initialCheckoutParity.stderr}`);
|
| 172 |
const manifestBuild = run(repo, "build-release-manifest.mjs");
|
| 173 |
assert(manifestBuild.status === 0, `Release manifest fixture build failed.\n${manifestBuild.stdout}\n${manifestBuild.stderr}`);
|
| 174 |
const cleanValidation = run(repo, "validate-data.mjs");
|
| 175 |
assert(cleanValidation.status === 0, `Matching release manifest fixture did not validate.\n${cleanValidation.stdout}\n${cleanValidation.stderr}`);
|
| 176 |
+
const releaseManifestPath = path.join(releaseDir, "release-manifest.json");
|
| 177 |
+
const cleanReleaseManifest = await fs.readFile(releaseManifestPath, "utf8");
|
| 178 |
+
const duplicateManifest = JSON.parse(cleanReleaseManifest);
|
| 179 |
+
duplicateManifest.package_files[1] = { ...duplicateManifest.package_files[0] };
|
| 180 |
+
await fs.writeFile(releaseManifestPath, `${JSON.stringify(duplicateManifest, null, 2)}\n`);
|
| 181 |
+
const duplicateValidation = run(repo, "validate-data.mjs");
|
| 182 |
+
assert(
|
| 183 |
+
duplicateValidation.status !== 0 && errorCodes(duplicateValidation).includes("RELEASE_PACKAGE_FILE_DUPLICATE"),
|
| 184 |
+
"Duplicate release package-file entries were not rejected"
|
| 185 |
+
);
|
| 186 |
+
await fs.writeFile(releaseManifestPath, cleanReleaseManifest);
|
| 187 |
+
const manifestBeforeCheckoutChange = sha256(await fs.readFile(releaseManifestPath));
|
| 188 |
+
await fs.appendFile(path.join(repo, "README.md"), "\nPost-release mutable-main documentation fixture.\n");
|
| 189 |
+
const frozenVerification = run(repo, "verify-package.mjs");
|
| 190 |
+
assert(frozenVerification.status === 0, `Mutable checkout incorrectly invalidated the frozen package.\n${frozenVerification.stdout}\n${frozenVerification.stderr}`);
|
| 191 |
+
const changedCheckoutParity = run(repo, "verify-package.mjs", ["--checkout-parity"]);
|
| 192 |
+
assert(
|
| 193 |
+
changedCheckoutParity.status !== 0 && /differs from current checkout/i.test(`${changedCheckoutParity.stdout}\n${changedCheckoutParity.stderr}`),
|
| 194 |
+
"Explicit checkout-parity verification did not reject mutable-main drift"
|
| 195 |
+
);
|
| 196 |
+
const manifestRebuild = run(repo, "build-release-manifest.mjs");
|
| 197 |
+
const manifestAfterCheckoutChange = sha256(await fs.readFile(releaseManifestPath));
|
| 198 |
+
assert(
|
| 199 |
+
manifestRebuild.status === 0 && manifestBeforeCheckoutChange === manifestAfterCheckoutChange,
|
| 200 |
+
"Release manifest changed when only the mutable checkout diverged from the frozen ZIP"
|
| 201 |
+
);
|
| 202 |
+
const mutableMainValidation = run(repo, "validate-data.mjs");
|
| 203 |
+
assert(
|
| 204 |
+
mutableMainValidation.status === 0,
|
| 205 |
+
`Mutable-main documentation incorrectly invalidated the frozen release.\n${mutableMainValidation.stdout}\n${mutableMainValidation.stderr}`
|
| 206 |
+
);
|
| 207 |
await fs.appendFile(path.join(releaseDir, zipName), "tampered\n");
|
| 208 |
const tamperedValidation = run(repo, "validate-data.mjs");
|
| 209 |
const codes = errorCodes(tamperedValidation);
|
|
|
|
| 214 |
results.push({
|
| 215 |
mutation: "release_artifact_after_manifest", status: "rejected",
|
| 216 |
code: "RELEASE_ARTIFACT_HASH_MISMATCH", deterministic_package_rebuild: true,
|
| 217 |
+
package_member_verification: "pass", mutable_main_release_verification: "pass",
|
| 218 |
+
explicit_checkout_parity_after_drift: "rejected", duplicate_package_file_entry: "rejected"
|
| 219 |
});
|
| 220 |
}
|
| 221 |
|
scripts/validate-data.mjs
CHANGED
|
@@ -76,6 +76,18 @@ function cleanOutput(value) {
|
|
| 76 |
return String(value || "").trim().replace(/\s+/g, " ").slice(0, 500);
|
| 77 |
}
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
function readJson(filepath, label, code) {
|
| 80 |
if (!fs.existsSync(filepath)) {
|
| 81 |
fileError(`${code}_MISSING`, label, `${label} is missing`);
|
|
@@ -398,19 +410,34 @@ if (!sourceOnly) {
|
|
| 398 |
if (actualSums !== canonicalSums) fileError("RELEASE_SUMS_MISMATCH", "release/SHA256SUMS", "SHA256SUMS differs from sorted manifest artifacts");
|
| 399 |
}
|
| 400 |
const expectedPackageFiles = ["README.md", "CITATION.cff", "package.json", "data/datapackage.json"];
|
|
|
|
|
|
|
|
|
|
| 401 |
if (!Array.isArray(manifest.package_files)) fileError("RELEASE_PACKAGE_FILES_INVALID", "release/release-manifest.json", "package_files must be an array");
|
| 402 |
else {
|
| 403 |
const names = manifest.package_files.map((item) => item?.name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 404 |
for (const name of expectedPackageFiles) if (!names.includes(name)) fileError("RELEASE_PACKAGE_FILE_MISSING", name, "Release manifest lacks package metadata hash");
|
|
|
|
|
|
|
|
|
|
| 405 |
for (const item of manifest.package_files) {
|
| 406 |
if (!expectedPackageFiles.includes(item?.name)) { fileError("RELEASE_PACKAGE_FILE_UNEXPECTED", String(item?.name), "Unexpected package-file entry"); continue; }
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
|
|
|
| 413 |
}
|
|
|
|
|
|
|
| 414 |
}
|
| 415 |
}
|
| 416 |
if (manifest.reproducibility?.workbook !== "checksum_only_external_artifact_runtime_not_in_public_dependency_graph") {
|
|
|
|
| 76 |
return String(value || "").trim().replace(/\s+/g, " ").slice(0, 500);
|
| 77 |
}
|
| 78 |
|
| 79 |
+
function readZipMember(zipPath, member) {
|
| 80 |
+
const result = spawnSync("unzip", ["-p", zipPath, member], {
|
| 81 |
+
encoding: null,
|
| 82 |
+
maxBuffer: 128 * 1024 * 1024
|
| 83 |
+
});
|
| 84 |
+
if (result.error) throw result.error;
|
| 85 |
+
if (result.status !== 0) {
|
| 86 |
+
throw new Error(`unzip could not read ${member}: ${String(result.stderr || "").trim()}`);
|
| 87 |
+
}
|
| 88 |
+
return Buffer.from(result.stdout);
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
function readJson(filepath, label, code) {
|
| 92 |
if (!fs.existsSync(filepath)) {
|
| 93 |
fileError(`${code}_MISSING`, label, `${label} is missing`);
|
|
|
|
| 410 |
if (actualSums !== canonicalSums) fileError("RELEASE_SUMS_MISMATCH", "release/SHA256SUMS", "SHA256SUMS differs from sorted manifest artifacts");
|
| 411 |
}
|
| 412 |
const expectedPackageFiles = ["README.md", "CITATION.cff", "package.json", "data/datapackage.json"];
|
| 413 |
+
const frozenPackageRoot = `agency-transfer-election-cases-v${RELEASE_VERSION}`;
|
| 414 |
+
const frozenPackageName = `${frozenPackageRoot}.zip`;
|
| 415 |
+
const frozenPackagePath = path.join(releaseDir, frozenPackageName);
|
| 416 |
if (!Array.isArray(manifest.package_files)) fileError("RELEASE_PACKAGE_FILES_INVALID", "release/release-manifest.json", "package_files must be an array");
|
| 417 |
else {
|
| 418 |
const names = manifest.package_files.map((item) => item?.name);
|
| 419 |
+
if (new Set(names).size !== names.length) {
|
| 420 |
+
fileError("RELEASE_PACKAGE_FILE_DUPLICATE", "release/release-manifest.json", "Duplicate package-file entry");
|
| 421 |
+
}
|
| 422 |
+
if (JSON.stringify(names) !== JSON.stringify(expectedPackageFiles)) {
|
| 423 |
+
fileError("RELEASE_PACKAGE_FILE_ORDER_INVALID", "release/release-manifest.json", "Package-file entries must exactly match the declared order");
|
| 424 |
+
}
|
| 425 |
for (const name of expectedPackageFiles) if (!names.includes(name)) fileError("RELEASE_PACKAGE_FILE_MISSING", name, "Release manifest lacks package metadata hash");
|
| 426 |
+
if (!fs.existsSync(frozenPackagePath)) {
|
| 427 |
+
fileError("RELEASE_PACKAGE_ARCHIVE_MISSING", frozenPackageName, "Frozen package ZIP is missing");
|
| 428 |
+
}
|
| 429 |
for (const item of manifest.package_files) {
|
| 430 |
if (!expectedPackageFiles.includes(item?.name)) { fileError("RELEASE_PACKAGE_FILE_UNEXPECTED", String(item?.name), "Unexpected package-file entry"); continue; }
|
| 431 |
+
if (!fs.existsSync(frozenPackagePath)) continue;
|
| 432 |
+
let buffer;
|
| 433 |
+
try {
|
| 434 |
+
buffer = readZipMember(frozenPackagePath, `${frozenPackageRoot}/${item.name}`);
|
| 435 |
+
} catch (caught) {
|
| 436 |
+
fileError("RELEASE_PACKAGE_FILE_ABSENT", item.name, `Frozen package member is missing or unreadable: ${cleanOutput(caught.message)}`);
|
| 437 |
+
continue;
|
| 438 |
}
|
| 439 |
+
if (item.bytes !== buffer.byteLength) fileError("RELEASE_PACKAGE_FILE_BYTE_COUNT_MISMATCH", item.name, "Frozen package member byte count differs");
|
| 440 |
+
if (item.sha256 !== sha256(buffer)) fileError("RELEASE_PACKAGE_FILE_HASH_MISMATCH", item.name, "Frozen package member differs from release manifest SHA-256");
|
| 441 |
}
|
| 442 |
}
|
| 443 |
if (manifest.reproducibility?.workbook !== "checksum_only_external_artifact_runtime_not_in_public_dependency_graph") {
|
scripts/verify-package.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
#!/usr/bin/env node
|
| 2 |
|
| 3 |
-
/** Verify ZIP
|
| 4 |
|
| 5 |
import fs from "node:fs";
|
| 6 |
import path from "node:path";
|
|
@@ -13,7 +13,13 @@ const here = path.dirname(fileURLToPath(import.meta.url));
|
|
| 13 |
const root = path.resolve(here, "..");
|
| 14 |
const packageRoot = `agency-transfer-election-cases-v${VERSION}`;
|
| 15 |
const workbookName = `agency-transfer-election-evidence-index-v${VERSION}.xlsx`;
|
| 16 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
function sha256(buffer) {
|
| 19 |
return createHash("sha256").update(buffer).digest("hex");
|
|
@@ -67,11 +73,13 @@ for (const entry of manifest.files) {
|
|
| 67 |
const member = `${packageRoot}/${entry.path}`;
|
| 68 |
const buffer = Buffer.from(unzip(["-p", zipPath, member], true));
|
| 69 |
if (buffer.byteLength !== entry.bytes || sha256(buffer) !== entry.sha256) throw new Error(`ZIP member differs from manifest: ${entry.path}`);
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
| 75 |
}
|
| 76 |
}
|
| 77 |
const expectedSums = `${manifest.files.map((entry) => `${entry.sha256} ${entry.path}`).join("\n")}\n`;
|
|
@@ -86,5 +94,6 @@ process.stdout.write(`${JSON.stringify({
|
|
| 86 |
bytes: zipBuffer.byteLength,
|
| 87 |
sha256: sha256(zipBuffer),
|
| 88 |
members: fileMembers.length,
|
| 89 |
-
payload_files: manifest.files.length
|
|
|
|
| 90 |
})}\n`);
|
|
|
|
| 1 |
#!/usr/bin/env node
|
| 2 |
|
| 3 |
+
/** Verify frozen ZIP integrity, with optional parity against the mutable checkout. */
|
| 4 |
|
| 5 |
import fs from "node:fs";
|
| 6 |
import path from "node:path";
|
|
|
|
| 13 |
const root = path.resolve(here, "..");
|
| 14 |
const packageRoot = `agency-transfer-election-cases-v${VERSION}`;
|
| 15 |
const workbookName = `agency-transfer-election-evidence-index-v${VERSION}.xlsx`;
|
| 16 |
+
const cliArgs = process.argv.slice(2);
|
| 17 |
+
const checkoutParity = cliArgs.includes("--checkout-parity");
|
| 18 |
+
const unknownOptions = cliArgs.filter((arg) => arg.startsWith("--") && arg !== "--checkout-parity");
|
| 19 |
+
const positional = cliArgs.filter((arg) => !arg.startsWith("--"));
|
| 20 |
+
if (unknownOptions.length) throw new Error(`Unknown option: ${unknownOptions.join(", ")}`);
|
| 21 |
+
if (positional.length > 1) throw new Error("Expected at most one ZIP path");
|
| 22 |
+
const zipPath = path.resolve(positional[0] || path.join(root, "release", `${packageRoot}.zip`));
|
| 23 |
|
| 24 |
function sha256(buffer) {
|
| 25 |
return createHash("sha256").update(buffer).digest("hex");
|
|
|
|
| 73 |
const member = `${packageRoot}/${entry.path}`;
|
| 74 |
const buffer = Buffer.from(unzip(["-p", zipPath, member], true));
|
| 75 |
if (buffer.byteLength !== entry.bytes || sha256(buffer) !== entry.sha256) throw new Error(`ZIP member differs from manifest: ${entry.path}`);
|
| 76 |
+
if (checkoutParity) {
|
| 77 |
+
const checkoutPath = entry.path.startsWith("workbook/")
|
| 78 |
+
? path.join(root, "release", workbookName)
|
| 79 |
+
: path.join(root, entry.path);
|
| 80 |
+
if (!fs.existsSync(checkoutPath) || sha256(fs.readFileSync(checkoutPath)) !== entry.sha256) {
|
| 81 |
+
throw new Error(`ZIP member differs from current checkout/release artifact: ${entry.path}`);
|
| 82 |
+
}
|
| 83 |
}
|
| 84 |
}
|
| 85 |
const expectedSums = `${manifest.files.map((entry) => `${entry.sha256} ${entry.path}`).join("\n")}\n`;
|
|
|
|
| 94 |
bytes: zipBuffer.byteLength,
|
| 95 |
sha256: sha256(zipBuffer),
|
| 96 |
members: fileMembers.length,
|
| 97 |
+
payload_files: manifest.files.length,
|
| 98 |
+
checkout_parity: checkoutParity ? "pass" : "not_checked"
|
| 99 |
})}\n`);
|