Files
pdfcraft/crates/automation/src
Valentin Klein 894904616d Form-data import says when the form refused every value
Importing form data whose only value the form refuses now fails and names the field, instead of reporting success.

Fixes #7409

<details><summary>Details for review</summary>

**Cause:** the issue's analysis is right. `pdfcraft_xfdf::apply_values` records refused fields in `Report::rejected` and the library deliberately returns `Ok(report)`. The engine's `ImportData` handler (`crates/engine/src/edit/run.rs`) only looked at skipped comment appearances and dropped `rejected`, so the edit committed as an ordinary Import step: dirty, an Undo entry, and Redo cleared.

**Fix:**
- If the file gave values for known fields and the form refused all of them (no field and no comment taken), the import returns a new `DataError::Refused` (shown as "the form refused every value in the file, so nothing was imported: "Choice""). Nothing is committed, so Undo, Redo and the dirty state stay as they were, like the existing "nothing matches this document" case. The tools and the UI already show the edit error.
- If some values took and others were refused, the import still applies the valid ones, as the issue allows, and the repair log names the refused fields (first five, then a count).
- `doc_import_data` (CLI/MCP) returns the repair entries that import appended in `import_repairs` (empty when everything was taken), so a caller sees a refused value without calling `doc_info`.
- The library's own behaviour is unchanged.

**Tests** (`crates/engine/src/tests.rs`; and `crates/automation/tests/it/automation.rs`: `form_data_import_response_names_the_fields_the_form_refused`, which checks the response of a full, a mixed and an all-refused import): `form_data_the_form_refuses_is_reported_and_leaves_the_document_alone`. A combo with options A and B, Undo leaves Redo available, then importing `Choice=INVALID` must fail naming "Choice" with Undo/Redo and the value unchanged; a second import with `Choice=INVALID` plus `Notes=hello` applies Notes and names only Choice in the repair log. It fails without the fix (I checked this).

Checked: `cargo test -p pdfcraft-engine -p pdfcraft-xfdf -p pdfcraft-automation`: xfdf 130 pass, engine 779 pass, automation 451 pass. The 7 engine failures and 10 automation failures (OCR models, plus `file_processing_keeps_javascript_off_for_xfa_open_scripts` and `copy_restricted_text_stays_in_the_document`) fail the same way without my change. Clippy `-D warnings --all-targets` is clean for engine and automation; `pdfcraft-xfdf` has one existing `collapsible_match` finding at `xfdf.rs:326` on current upstream/main that I did not touch. rustfmt is clean. I did not run the CLI/MCP end to end.

</details>
2026-11-18 16:39:21 +07:00
..
…
…
…
…
…
…