feat(domain): R4.7 report-compare on the core: pdf::compare (feature cli, pure lines, runner over a Files trait), report-compare binary on the seed sheet, pnpm report:compare switched to it; O10 230 rows (158 exact, 72 declared A.3 closed lines), 11 cases as ledger targets, binary spawned; rust-check on cli

This commit is contained in:
bchanot committed 2026-10-19 11:13:35 +02:00
1 parent 264c5fa3fc
commit 02ebf05195
17 files changed
+1598 -24

No files matched your search

+32 -4
View File
@@ -109,6 +109,32 @@ const IMPORT_R46 =
const ROUNDTRIP_R46 =
'vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8'
/** R4.7: the `scripts.compare.test.ts` case → the cargo test replaying its O10 rows. */
const COMPARE_CASES = {
'compareReport on the frozen v2 archive PDF > shows every legacy zone and finding next to its canonical target':
'frozen_v2_archive_pdf_shows_every_legacy_item_next_to_its_target',
'compareReport on unresolved items > names a removed finding, a finding unknown to the catalog and an unknown zone':
'unresolved_items_name_a_removed_an_unknown_finding_and_an_unknown_zone',
'compareReport on unresolved items > reads a v3 report as is and flags what the sheet cannot place':
'v3_report_read_as_is_flags_what_the_sheet_cannot_place',
'compareReport on unresolved items > prints the archive line of an envelope: snapshot kept, or rejected with its reason':
'envelope_archive_line_says_snapshot_kept_or_rejected_with_its_reason',
'compareReport on unresolved items > warns when a v3 report was written on another sheet document':
'v3_report_written_on_another_sheet_document_warns',
'diff and arguments > diffs the v3 content of a migrated v2 report and its v3 re-reading':
'diff_of_a_migrated_v2_report_and_its_v3_re_reading',
'diff and arguments > compares placeholders by default and real texts with --full':
'diff_compares_placeholders_by_default_and_real_texts_with_full',
'diff and arguments > parses files and options, refuses unknown ones':
'arguments_parsed_and_unknown_options_refused',
'terminal safety and privacy > escapes control characters in every untrusted string':
'control_characters_escaped_in_every_untrusted_string',
'terminal safety and privacy > does not throw on prototype-chain names used as legacy ids':
'prototype_chain_names_as_legacy_ids_do_not_throw',
'terminal safety and privacy > hides names and free texts by default, shows them with --full':
'names_and_free_texts_hidden_by_default_shown_with_full',
}
const ported = (target, oracle, note = NONE) => ({
disposition: 'ported',
target,
@@ -273,10 +299,12 @@ const RULES = [
},
{ file: `${APP}migration.leaves.test.ts`, ...kept(NONE) },
{ file: `${APP}pdf.browserRasterizer.test.ts`, ...kept(NONE) },
{
// R4.7: the archive check tool on the core, one cargo test per case over the O10 rows.
...Object.entries(COMPARE_CASES).map(([title, test]) => ({
file: `${APP}scripts.compare.test.ts`,
...ported('R4.7 cargo (pending)', 'O10'),
},
title,
...ported(`cargo pdf_compare::${test}`, 'O10'),
})),
...APP_MOCKING_SUITES.map((name) => ({
file: `${APP}${name}`,
...kept(NONE, 'mocks rewritten at R4.3 / R4.6'),
@@ -469,7 +497,7 @@ function cargoTests(file) {
'-p',
'faunosteo-core',
'--features',
'pdf-read,pdf-write',
'cli',
'--locked',
'--test',
file,
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# `pnpm report:compare <file.pdf | folder>... [--summary] [--full] [--locale fr|en]
# [--diff a.pdf b.pdf]`: the archive check tool on the core (R4.7, plan §B.1.7), the
# `report-compare` binary of crates/core behind its `cli` feature, on the native toolchain of
# the development machine (scripts/rust-env.sh). The first run compiles it (release profile);
# the next ones start at once. Paths are typed from the folder pnpm was run in (INIT_CWD).
set -euo pipefail
cd "$(dirname "$0")/.."
. scripts/rust-env.sh
exec cargo run --release --locked -q -p faunosteo-core --features cli --bin report-compare -- "$@"
+5 -4
View File
@@ -15,10 +15,11 @@ cd "$(dirname "$0")/.."
cargo fmt --all --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test --workspace --locked
# The PDF reader (R4) is feature-gated in the core: its code and suites compile only here
# and in the wasm module, never in the worker.
cargo clippy -p faunosteo-core --all-targets --features pdf-read,pdf-write --locked -- -D warnings
cargo test -p faunosteo-core --features pdf-read,pdf-write --locked
# The PDF reader and writer (R4) are feature-gated in the core: their code and suites compile
# only here and in the wasm module, never in the worker; `cli` adds the archive check tool
# (`report-compare`, R4.7) and its O10 suite, never built into the module.
cargo clippy -p faunosteo-core --all-targets --features cli --locked -- -D warnings
cargo test -p faunosteo-core --features cli --locked
# Exports the TypeScript types of the contracts (ts-rs) into packages/core-wasm/types.
# `git status --porcelain --untracked-files=all -- packages/core-wasm/types` must stay
# empty afterwards (scripts/check-all.sh, .gitea/workflows/ci.yml): the committed types