From 012132743204befe7cea8763927c905c231e5d7a Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 06:36:24 +0100 Subject: [PATCH 01/36] Post every review verdict on the PR; ready only on four green jobs The owner decided (audit 0004-F4) that every fable-reviewer verdict is posted as a comment on the pull request, so an audit can check the approval. A PR is marked ready only when all four CI jobs are green, read in the job list: PR #2 was red on Windows for most of its life while only a pending run had been looked at. Roadmap 0.5 records the minor points of the last PR #2 review. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 15 ++++++++++----- docs/roadmap.md | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 5307953..d5d29f3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -28,7 +28,9 @@ No exception for "infrastructure". 5. **Independent review**: a **newly started** `fable-reviewer` agent (different model) for every review, briefed only with the scope and where the requirements are: never resumed, never given my conclusions or earlier findings. Fix its findings or explain to the user why - not. + not. Every verdict (APPROVED or CHANGES NEEDED, the findings in short, how each was closed) + is posted as a comment on the pull request, so the approval leaves a trace an audit can + check (the PR description alone is not enough). 6. Commit only when the user asks. Hooks (`.githooks/`): pre-commit runs the public-repository check, the audit cadence gate, the script tests when scripts or hooks change, fmt, clippy and tests; commit-msg scans the message; pre-push scans every commit not yet on the remote it pushes @@ -50,10 +52,13 @@ functions or options that never existed, work left half-done. Rules against it: draft PRs, red CI): finish it, or close it with a written reason, before starting anything new. - **Branches and PRs** (after the first push): one branch per roadmap step (`step/1.1-portable-names`), pushed early as a **draft PR**; marked ready only when CI is - green and `fable-reviewer` approved; merged into `main` **locally by fast-forward** - (`git switch main && git merge --ff-only step/x && git push`): the same commits CI checked, - linear history, pre-push hook run. The GitHub merge button is not used (it rewrites commits). **One step open at a time.** A session never ends with a draft PR without a comment saying its state and next - step; abandoned work is closed with the reason, never left open. + green on all four jobs (read in the job list, never assumed from a pending run) and + `fable-reviewer` approved (its verdict posted on the PR); merged into `main` **locally by + fast-forward** (`git switch main && git merge --ff-only step/x && git push`): the same commits + CI checked, linear history, pre-push hook run. The GitHub merge button is not used (it + rewrites commits). **One step open at a time.** A session never ends with a draft PR without a + comment saying its state and next step; abandoned work is closed with the reason, never left + open. - **Every 5 commits: coherence audit** by the `coherence-auditor` agent (Fable, fresh context, read-only): requirements vs tests vs code, every concrete reference checked for existence, docs agreeing with each other, unfinished work, project rules, health. Its report is saved as diff --git a/docs/roadmap.md b/docs/roadmap.md index d0288af..50d1ae6 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -54,7 +54,8 @@ The order follows two ideas: the `origin/HEAD` filter and "no tags or other refs" do); the "RED CHECKS" test covers the printed line and its absence, not which checks are selected as red (the `gh` stub returns the formatted line); only `FAILURE` counts as red today, not cancelled or timed-out jobs nor - commit statuses: decide and test; + commit statuses: decide and test; the negative RED CHECKS case does not assert that the + GitHub section ran, and its stub has a dead first line; - report-mode tests pass if the script prints nothing in that section. - from the targeted review of the third-round fixes: - the first push to a new remote scans the whole history and stops on the accepted From 4ab527fc5d3c10d9815a2af7882cea17441ff678 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 06:37:57 +0100 Subject: [PATCH 02/36] Add the writing guide (docs/writing.md) and point CLAUDE.md to it The guide is written as questions and answers: who reads, how a document is organised, sentence length, what is never reworded, what we cut, the patterns that make a text sound machine-made, voice, exceptions, who checks. The documents are rewritten to it in the next commits. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 3 ++ docs/writing.md | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 docs/writing.md diff --git a/CLAUDE.md b/CLAUDE.md index d5d29f3..b6a5d02 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -123,6 +123,9 @@ in the history even if deleted later. Before every commit and push: ## Conventions +- **Writing.** Every text (docs, comments, commit messages, PR texts, agent prompts, the + tool's strings) follows `docs/writing.md`: answers to the reader's questions, answer first, + short sentences, code and commands verbatim. - **Language.** Everything in the repository is in English: code, comments, file headers, docs, commit messages, script and hook messages, agent prompts and reports. Italian is used only when talking to the user (the developer) in the conversation. diff --git a/docs/writing.md b/docs/writing.md new file mode 100644 index 0000000..0bc5f01 --- /dev/null +++ b/docs/writing.md @@ -0,0 +1,80 @@ +# How we write + +Rules for every text in this repository: README, design, roadmap, CLAUDE.md, agent prompts, +comments, commit messages, PR texts, the user guide and the strings the tool shows. + +## Who reads our texts? + +A person looking for one answer. They arrive with a question ("does it work offline?", +"what happens if the file already exists?") and leave when they have the answer. We write so +that they find it fast and can trust it. + +## How is a document organised? + +As questions and answers. Each section heading is a question the reader would ask, in their +words: "Which files does SignSpector open?", not "File discovery". The first sentence under +the heading answers it. Reasons, details and exceptions come after. + +Requirement and step numbers stay (R16, 3.4): code and tests refer to them. They go at the +end of the answer, not in the heading. + +## How long is a sentence? + +At most about 20 words, one idea per sentence, active voice. Instructions use the imperative: +"Run `cargo nextest run`", not "The tests can be run with...". One term per thing: if it is +an "envelope" in one place, it is not a "container" two lines later. + +## What is never shortened or reworded? + +Code, commands, paths, file names, option names, error messages, numbers, versions and +dates. They are copied exactly, in backticks. Negations (not, never, only, except) are never +dropped to save words. + +## What do we cut? + +Anything that does not answer the question: + +- greetings, recaps, "in summary", "let me know", "I hope this helps"; +- hedging piled on hedging ("could potentially perhaps"): say what is known and what is not; +- filler: "in order to", "it is important to note that", "at its core"; +- generic endings ("the future looks bright"). + +## Which patterns make a text sound machine-made? + +We avoid them. The list comes from Wikipedia's "Signs of AI writing" (via the humanizer +guide): + +- inflated significance: "plays a pivotal role", "is a testament to", "marks a shift"; +- the usual vocabulary: crucial, delve, enhance, foster, intricate, landscape, leverage, + seamless, showcase, tapestry, underscore, vibrant; +- "serves as", "stands as", "boasts" instead of "is" or "has"; +- "not just X, but Y" and "it's not about X, it's about Y"; +- lists of three by reflex, and synonyms rotated to avoid repeating a word; +- false ranges: "from small offices to large institutions"; +- em dashes as decoration, emojis, curly quotes; +- bold words scattered in running text, and lists where every item starts with a bold + label and a colon; +- Title Case In Headings (we write headings in sentence case); +- vague sources: "experts say", "it is widely recognised". + +## Do our texts have a voice? + +Yes, a plain one. We state decisions and say why: "The release embeds the EU list of lists +and the Italian list only: embedding all of them would add megabytes, and the first run with +a network refreshes them." We say what we do not know: "Not tested on Windows on ARM." We use "we" for the project. A text with no opinion and no reason is +not neutral, it is useless. + +## Are there exceptions? + +- Safety warnings and irreversible actions: full sentences, even if longer. Clarity beats + brevity. +- Steps that must happen in order: a numbered list, one action per step. +- Tables: only when the reader compares values across rows. +- Strings shown by the tool follow the same rules in every language (R27), and must work + with screen readers (R35): words, not symbols. + +## Who checks? + +The author, before committing: read the text once as the reader with the question. The +`fable-reviewer` and `coherence-auditor` agents check the patterns above in every review. +No text is sent to tools or models outside this subscription to be rewritten. From df7ee923113ef922263e27080f883559c4551b05 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 06:43:34 +0100 Subject: [PATCH 03/36] Close the first review of the writing guide The reviewer and auditor prompts now check texts against the guide, and the auditor checks that each PR carries the reviewer's verdict comment. Verdict comments are summaries for the public with repository-relative paths, checked with check-public.sh before posting. The guide now says that everything is in English, how it applies to texts without headings and to fixed formats, that audit reports are never rewritten, and which tools may rewrite texts; its examples match the design, and it follows its own rules more closely. Co-Authored-By: Claude Opus 5.5 --- .claude/agents/coherence-auditor.md | 3 +- .claude/agents/fable-reviewer.md | 4 ++- CLAUDE.md | 5 ++- docs/writing.md | 50 ++++++++++++++++++----------- 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/.claude/agents/coherence-auditor.md b/.claude/agents/coherence-auditor.md index 998ca49..df160ed 100644 --- a/.claude/agents/coherence-auditor.md +++ b/.claude/agents/coherence-auditor.md @@ -33,7 +33,8 @@ Read first: `CLAUDE.md`, `docs/design.md`, `docs/roadmap.md`, the latest report and laws cited. Verify each one; list those that do not exist or say something different. 5. **Docs agree with each other.** `CLAUDE.md`, `design.md`, `roadmap.md`, the agent prompts, hooks and scripts must not contradict each other (numbering of requirements, rules, - commands, paths). Note anything outdated. + commands, paths). Note anything outdated. Texts follow `docs/writing.md`; every pull request + carries the reviewer's verdict as a comment (`gh pr view --comments`). 6. **Project rules.** Safety rules (R28–R34), accessibility (R35–R39), uninstall (R40–R43), language rules (English in the repository, translated user interface), public-repository rules (`sh scripts/check-public.sh --range tip HEAD`). diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index 4a1862f..33ff36a 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -41,7 +41,9 @@ Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). over-long names). 4. **Language**: code, comments, docs and developer messages in English. User-facing texts of the tool go through the translation layer (R27 in `docs/design.md`), never hard-coded, and - every new text has its Italian translation. + every new text has its Italian translation. Every changed text (docs, comments, commit + messages, PR text, prompts, tool strings) follows `docs/writing.md`: report the patterns it + lists, with `file:line`. 5. **Accessibility and uninstall** (R35–R43): no information by colour or symbols alone, `NO_COLOR`/`--plain` honoured, no prompt time limits, semantic and keyboard-operable HTML with sufficient contrast; anything installed is recorded for `uninstall`, which removes diff --git a/CLAUDE.md b/CLAUDE.md index b6a5d02..642da7d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -30,7 +30,10 @@ No exception for "infrastructure". never given my conclusions or earlier findings. Fix its findings or explain to the user why not. Every verdict (APPROVED or CHANGES NEEDED, the findings in short, how each was closed) is posted as a comment on the pull request, so the approval leaves a trace an audit can - check (the PR description alone is not enough). + check (the PR description alone is not enough). The comment is a summary written for the + public, with repository-relative paths, never the pasted report (reports carry local + paths); `check-public.sh` does not scan PR comments, so its file is checked with + `sh scripts/check-public.sh --message ` before posting. 6. Commit only when the user asks. Hooks (`.githooks/`): pre-commit runs the public-repository check, the audit cadence gate, the script tests when scripts or hooks change, fmt, clippy and tests; commit-msg scans the message; pre-push scans every commit not yet on the remote it pushes diff --git a/docs/writing.md b/docs/writing.md index 0bc5f01..9935e2a 100644 --- a/docs/writing.md +++ b/docs/writing.md @@ -1,7 +1,8 @@ # How we write -Rules for every text in this repository: README, design, roadmap, CLAUDE.md, agent prompts, -comments, commit messages, PR texts, the user guide and the strings the tool shows. +These rules apply to every text in this repository. That means docs, agent prompts, comments, +commit messages, PR texts, the user guide and the strings the tool shows. Everything is in +English; only the tool's own strings are translated (see "Language" in `CLAUDE.md`). ## Who reads our texts? @@ -27,8 +28,8 @@ an "envelope" in one place, it is not a "container" two lines later. ## What is never shortened or reworded? Code, commands, paths, file names, option names, error messages, numbers, versions and -dates. They are copied exactly, in backticks. Negations (not, never, only, except) are never -dropped to save words. +dates. We copy them exactly, and put code, commands, paths, file names and options in +backticks. We never drop a negation or a restriction (not, never, only, except) to save words. ## What do we cut? @@ -41,17 +42,19 @@ Anything that does not answer the question: ## Which patterns make a text sound machine-made? -We avoid them. The list comes from Wikipedia's "Signs of AI writing" (via the humanizer -guide): +These ones, from Wikipedia's page "Signs of AI writing" +(https://en.wikipedia.org/wiki/Wikipedia:Signs_of_AI_writing). We do not use them: - inflated significance: "plays a pivotal role", "is a testament to", "marks a shift"; -- the usual vocabulary: crucial, delve, enhance, foster, intricate, landscape, leverage, - seamless, showcase, tapestry, underscore, vibrant; +- the usual filler vocabulary: crucial, delve, enhance, foster, intricate, landscape, + leverage, seamless, showcase, tapestry, underscore, vibrant (a literal use is fine); - "serves as", "stands as", "boasts" instead of "is" or "has"; - "not just X, but Y" and "it's not about X, it's about Y"; - lists of three by reflex, and synonyms rotated to avoid repeating a word; - false ranges: "from small offices to large institutions"; -- em dashes as decoration, emojis, curly quotes; +- em dashes (use a comma, a colon or a new sentence), emojis, curly quotes; +- trailing "-ing" commentary ("..., ensuring a smooth experience"), promotional adjectives, + flattering openers; - bold words scattered in running text, and lists where every item starts with a bold label and a colon; - Title Case In Headings (we write headings in sentence case); @@ -59,22 +62,33 @@ guide): ## Do our texts have a voice? -Yes, a plain one. We state decisions and say why: "The release embeds the EU list of lists -and the Italian list only: embedding all of them would add megabytes, and the first run with -a network refreshes them." We say what we do not know: "Not tested on Windows on ARM." We use "we" for the project. A text with no opinion and no reason is -not neutral, it is useless. +Yes, a plain one. We state decisions and say why: "The release embeds the LOTL and the Italian +list. The tool then works offline from the start." We say what we do not know: "We do not +know yet whether the company proxy needs NTLM." We use "we" for the project. A text with no +opinion and no reason is not neutral, it is useless. ## Are there exceptions? -- Safety warnings and irreversible actions: full sentences, even if longer. Clarity beats - brevity. +Yes, six: + +- Safety warnings and irreversible actions: full sentences, even if longer. Clarity beats brevity. - Steps that must happen in order: a numbered list, one action per step. - Tables: only when the reader compares values across rows. - Strings shown by the tool follow the same rules in every language (R27), and must work with screen readers (R35): words, not symbols. +- Texts without headings (commit messages, comments, the tool's strings) keep the rest: answer + first, short sentences, nothing to cut. +- Numbered lists (requirements `R44.`, roadmap steps `3.4`) and fixed formats (the reviewer's + `VERDICT:` line, the audit report skeleton, the front matter of agent prompts) keep their + labels and layout; the text inside follows the guide. Audit reports in `docs/audits/` are + records: they are never rewritten. ## Who checks? -The author, before committing: read the text once as the reader with the question. The -`fable-reviewer` and `coherence-auditor` agents check the patterns above in every review. -No text is sent to tools or models outside this subscription to be rewritten. +The author, before committing, reads the text once as the reader with the question. The +`fable-reviewer` and `coherence-auditor` agents report the patterns above in their reviews. + +## May a tool rewrite our texts? + +Only the Claude models of the project's own subscription, the same ones that write the code. +We send no text to other services or models to be rewritten. From 0f92512e327caec0c0b16f3f3cebf487bf8e1f88 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 07:08:52 +0100 Subject: [PATCH 04/36] audit: 0005 Co-Authored-By: Claude Opus 5.5 --- docs/audits/0005-2026-11-23.md | 210 +++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 docs/audits/0005-2026-11-23.md diff --git a/docs/audits/0005-2026-11-23.md b/docs/audits/0005-2026-11-23.md new file mode 100644 index 0000000..014eb30 --- /dev/null +++ b/docs/audits/0005-2026-11-23.md @@ -0,0 +1,210 @@ +# Coherence audit 0005 (2026-11-23) +Range: 3268fde..df7ee92 (5d29d9d and 8561ec5, merged into `main` with PR #2; 0121327, 4ab527f and df7ee92 on `step/0.4-writing-guide`, PR #3, draft) plus the uncommitted working tree (`scripts/audit-status.sh`, `scripts/test-scripts.sh`, `rust-toolchain.toml`, `docs/design.md`) Verdict: COHERENT + +Auditor: `coherence-auditor` agent, fresh context, read-only, run because the cadence is due (5 commits since audit 0004). + +The committed range holds no false claim and no broken rule. Step 0.2.1 is now truly done: PR #2 was merged by fast-forward with all four jobs green and its verdicts posted. The findings are about the uncommitted "Rust" section of the session report (F1 to F3, worth fixing before it is committed) and small disagreements between the new writing guide and the other documents (F4 to F6). Step 0.4 is open and unfinished, as its PR says. + +## Unfinished work + +`sh scripts/audit-status.sh` (exit 0): + +``` +== Audit cadence +commits since last audit: 5 (audit every 5) +last audit: 3268fde 2026-11-22 audit: 0004 +AUDIT DUE + +== Rust +pinned Rust 1.100.0 is the latest stable + +== Unfinished local work +uncommitted changes: + M docs/design.md + M rust-toolchain.toml + M scripts/audit-status.sh + M scripts/test-scripts.sh +branch step/0.4-writing-guide: 0 unpushed, 0 not pulled +local branches not merged into main: + step/0.4-writing-guide +remote branches not merged into main: + origin/step/0.4-writing-guide + +== Markers in code +none + +== Leftovers (scripts/cleanup.sh --plan; run scripts/cleanup.sh to remove the local ones) +keep local branch (not merged): step/0.4-writing-guide +on GitHub, merged (kept, nothing is deleted on GitHub): origin/step/0.2-ci +on GitHub, merged (kept, nothing is deleted on GitHub): origin/step/0.2.1-confirmation-rules +on GitHub, draft PR (not closed here): #3 updated 2026-11-23: Roadmap 0.4: writing guide +nothing to remove + +== GitHub +open pull requests: +#3 DRAFT step/0.4-writing-guide updated 2026-11-23: Roadmap 0.4: writing guide +last CI runs on main: +2026-11-23 completed/success: Guard the Windows skips; test the report with no red checks +2026-11-23 completed/success: CI +2026-11-22 completed/success: Remove --apply everywhere, close review and audit 0002 findings +``` + +- **Uncommitted work**: four files, nothing staged, no stashes, nothing unpushed. + - `scripts/audit-status.sh:76-89`: new "Rust" section. It reads the pinned version, runs `rustup check` and prints one of three lines. + - `scripts/test-scripts.sh:361-371`: three checks for it, with a `rustup` stub. + - `rust-toolchain.toml:1-16`: comment (why pinned, how to update, which targets and why). The old inline comment on `channel` is gone. + - `docs/design.md:415`: two wrapped lines joined into one of 115 characters. No word changed. + - Committing it is the 6th commit: `sh scripts/audit-status.sh --gate-commit` exits 1 ("5 commits since the last coherence audit (limit 5)") until this report is committed alone. + - The change has no review yet, and PR #3 does not quote its red and green runs yet (`CLAUDE.md:24-25`). +- **PR #3** (draft, opened 2026-11-23, less than a day old, head df7ee92, 3 commits, 5 comments): + - What it is for: roadmap 0.4 (`docs/roadmap.md:34-38`): the writing guide, the rewrite of the documents to it, the `rust-toolchain.toml` comment, the session-report line for a newer Rust. + - Done: `docs/writing.md`, the pointers from `CLAUDE.md` and both agent prompts, the rule on verdict comments. + - Missing: + - a review of df7ee92. The only verdict posted is CHANGES NEEDED on 0121327 and 4ab527f; the last state comment says "Next session: a short review of that commit (verdict posted here)"; + - the commit, proof and review of the uncommitted change (F1 to F3); + - the rewrite of `README.md`, `docs/design.md`, `docs/roadmap.md`, `CLAUDE.md` and the agent prompts. Until then `CLAUDE.md:129-131` ("Every text ... follows `docs/writing.md`") describes the target, not the state: for example `README.md:10,33` have headings that are not questions and `README.md:38-57` is a list where every item starts with a bold label (`docs/writing.md:15-16,58-59`); + - the `[x]` mark at `docs/roadmap.md:34`, correctly absent. + - Still relevant: yes, it is the one open step. +- **PR #2** (merged 2026-11-23, head 8561ec5, not a draft when merged): `main`, `origin/main` and `origin/step/0.2.1-confirmation-rules` all point at 8561ec5, so the merge was a fast-forward of the commits CI checked. +- **CI job lists** (`gh pr checks `, `gh run list`): + + | Commit | Run | Repository rules | Linux musl | Windows gnu | macOS arm64 | + |---|---|---|---|---|---| + | 5d29d9d (PR #2) | 45078051669 | run result: success | | | | + | 8561ec5 (PR #2) | 45118069807 | pass | pass | pass | pass | + | 8561ec5 (`main`, push) | 45118709861 | pass | pass | pass | pass | + | 0121327 (PR #3) | 45118875896 | cancelled by the next push | | | | + | 4ab527f (PR #3) | 45119011124 | run result: success | | | | + | df7ee92 (PR #3) | 45119588761 | pass | pass | pass | pass | + + GitGuardian passes on both PRs. The weekly run on `main` (45117684619, at baa61c9) succeeded. No red run after 4fc97d8. +- **Verdict comments** (`gh pr view --comments`; rule at `CLAUDE.md:31-36`, in force since 0121327): + - PR #2: 4 comments. Verdict CHANGES NEEDED on 5d29d9d (round 7, findings A1 to A5), verdict APPROVED on 8561ec5 (round 8), the merged head. Two state comments. Rounds 1 to 6 have no verdict comment; they predate the rule and the first state comment says "approved up to 1c3fc05". + - PR #3: 5 comments. Verdict CHANGES NEEDED on 0121327 and 4ab527f (A1 to A6). Four state comments, the last one after df7ee92. No verdict on df7ee92 yet (see above). + - PR #1 (merged 2026-11-22 as a draft): 1 comment, no verdict. Already reported as 0003-F5; nothing can be changed now. +- **Branches**: local `main` and the step branch; on GitHub `main`, `step/0.2-ci` and `step/0.2.1-confirmation-rules` (both merged, kept) and the step branch. +- **Markers**: none. +- **Leftovers**: `sh scripts/cleanup.sh --plan` (exit 0) prints the four lines shown above and "nothing to remove". +- **Tracked files that belong to the work, not the product**: none. `git ls-files` shows 35 files; the only reports are the four under `docs/audits/`. + +## Findings + +### F1. `drift`: the script tests now call the real `rustup check`, over the network, 14 times +- `scripts/audit-status.sh:79` runs `rustup check` in every report-mode run. `scripts/test-scripts.sh` runs the report 19 times; only the three at lines 367, 369 and 371 put a `rustup` stub first in `PATH`. +- Probe on a scratch copy, with a counting `rustup` stub placed before the real one: + ``` + test-scripts exit 0 ; real-rustup calls (not the test's own shim): 14 + test-cleanup exit 0 ; real-rustup calls (not the test's own shim): 0 + test-hooks exit 0 ; real-rustup calls (not the test's own shim): 0 + ``` +- Consequences: the suite contacts the Rust release server from the pre-commit hook (`.githooks/pre-commit:14-18`) and from all three CI systems (`.github/workflows/ci.yml:47-51,120-125`); its result and duration depend on the network. The existing tests isolate `gh` with stubs for the same reason. +- In those 14 runs the test repository has no `rust-toolchain.toml`, so the report prints the wrong line of F2. +- Change (test): give the test repositories a default `rustup` stub, as for `gh`, or record the gap in roadmap 0.5. + +### F2. `minor`: the "Rust" section can print a statement that is not true +- `scripts/audit-status.sh:87-88`: the `else` branch prints `pinned Rust $pinned is the latest stable` for every case that is not "newer". +- Probes on a scratch repository with a `rustup` stub (line printed under "== Rust"): + + | `rust-toolchain.toml` | `rustup check` says | Printed | + |---|---|---| + | missing | `up to date: 1.100.0` | `pinned Rust is the latest stable` | + | `channel = "stable"` | `up to date: 1.100.0` | `pinned Rust is the latest stable` | + | `channel = "1.100.0"` | `up to date: 1.99.0` | `pinned Rust 1.100.0 is the latest stable` | + | `channel = "1.100"` | `up to date: 1.100.0` | `NEWER RUST STABLE: 1.100.0 (pinned: 1.100); see rust-toolchain.toml` | + | `channel = "1.100.0"` | `Up to date : 1.100.0` (older rustup wording) | `Rust release not checked (rustup check failed or no stable toolchain)` | + +- The real case works: here `rustup check` prints `stable-aarch64-apple-darwin - up to date: 1.100.0 (0ef1bc386 2026-11-09)` (rustup 1.29.3) and the report says `pinned Rust 1.100.0 is the latest stable`. Version order is numeric: 1.9.0 against 1.10.0 gives "NEWER RUST STABLE: 1.10.0". +- Change (code and test): a separate line when the pinned version cannot be read. Whether a pinned version ahead of the installed stable deserves its own line is the owner's choice. + +### F3. `minor`: two rules of the new section have no test, and one test name says the opposite of the code +- Rule breaking on the scratch copy, 8 mutations of `scripts/audit-status.sh:76-89`, `sh scripts/test-scripts.sh` after each: + + | Mutation | Tests failing | + |---|---| + | "NEWER RUST STABLE" line removed | 1 | + | "Rust release not checked" line removed | 1 | + | version-order condition (`sort ... tail -n 1`) removed | 0 | + | `"$latest" != "$pinned"` removed | 1 | + | "pinned Rust ... is the latest stable" line removed | 0 | + | "up to date" pattern removed from `sed` | 1 | + | whole section removed | 2 | + | pinned version read from a wrong file name | 1 | + +- `CLAUDE.md:25-27`: "a rule nobody's test notices gets a test". The two unnoticed ones are the order check (a pinned version newer than the installed stable must not be announced as "newer stable") and the positive line. +- `scripts/test-scripts.sh:369` is named "report: pinned Rust is the latest, nothing said", but the script does say something (`scripts/audit-status.sh:88`). The check only asserts that two other lines are absent, so it also passes if the section prints nothing: the known limit at `docs/roadmap.md:59`. +- `docs/roadmap.md:38` and the PR text promise "a line ... when a newer stable Rust exists"; the section prints a line in all three cases. Not a contradiction, but the roadmap does not describe the other two lines. +- Change (test): add the two cases, rename the check or assert the positive line; or list them in roadmap 0.5. + +### F4. `contradiction` (minor): the writing guide says only the tool's strings are translated; the user guide is translated too +- `docs/writing.md:3-5`: the texts are "docs, agent prompts, comments, commit messages, PR texts, the user guide and the strings the tool shows. Everything is in English; only the tool's own strings are translated". +- `CLAUDE.md` ("The tool's own interface is translated (console messages, `--help`, HTML report, user guide)"), R27 at `docs/design.md:130-133` and R37 at `docs/design.md:345-347` translate the user guide as well. +- The guide names the user guide and the tool's strings as two separate things, then translates only the second. +- Change (doc): `docs/writing.md:5`, for example "only the tool's interface (its strings and the user guide) is translated". + +### F5. `minor`: PR texts carry an emoji, which the guide forbids in PR texts +- `docs/writing.md:3-4` applies the guide to PR texts; `docs/writing.md:55` lists emojis among the patterns "we do not use". +- `gh pr view 3 --json body`: the last line is the robot emoji followed by "Generated with [Claude Code](...)". The same line closes the text of PR #2 (line 195 of its body). +- The line is an attribution footer, not prose. The owner decides: drop it from PR texts, or name it among the fixed formats at `docs/writing.md:81-84`. + +### F6. `minor`: the "State" section of PR #3 is out of date +- PR #3 text: "## State / Draft. Next: the writing guide." The guide was committed in 4ab527f and reviewed; the state comments are current (the last one names the review of df7ee92 as the next step). +- `CLAUDE.md:62-64` asks for a comment, and that exists. The text and the comments now tell two different states. +- Change: update the section with the next push, or replace it with a pointer to the comments. + +### F7. `minor`: carried over +- From 0001-F12, 0002-F9, 0003-F10, 0004-F8: `Cargo.toml:19-21` declares `assert_cmd` 2.2.2 and `predicates` 3.1.4; `tests/` holds only `fixtures/README.md`, no `tests/*.rs`. +- From 0003-F6, 0004-F8: no test fixes the choice that a branch just created at `main` is removed (`grep -n 'just created\|no commits' scripts/test-cleanup.sh` finds nothing). +- `docs/design.md:415` (uncommitted) is one line of 115 characters in a file wrapped at 100. Four other lines of that file are already longer (`docs/design.md:34,53,393,400`). No content changed. + +### Follow-up of audit 0004 +- F1: closed. `docs/roadmap.md:24` marks 0.2.1 done; PR #2 is merged and all four jobs are green on 8561ec5, in the PR run and in the `main` run. +- F2: closed. Windows is green on 5d29d9d and 8561ec5, every step of the job; 0121327 adds "green on all four jobs (read in the job list, never assumed from a pending run)" at `CLAUDE.md:57-59`. +- F3: closed. The fix was committed in 5d29d9d, guarded in 8561ec5 (`scripts/test-cleanup.sh:265-267`), reviewed in rounds 7 and 8. +- F4: closed. State and verdict comments exist on PR #2; the owner's decision is at `CLAUDE.md:31-36`. +- F5: closed. The double-quote check runs on Windows again; the skips are 4 + 1 (`scripts/test-cleanup.sh:159,226`), and `docs/roadmap.md:44-47` says 5 checks and that the double-quote check "does not exercise git's quoting". The hand-written numbers are listed at `docs/roadmap.md:46-47`. +- F6: closed (`.claude/agents/fable-reviewer.md:34-36`). +- F7: decided. `docs/design.md:163-164` says "a shorter summary than the console"; `README.md:43,105` and `CLAUDE.md:144` say "the same confirmations"; `docs/roadmap.md:143-146` lists what the shorter summary must still show. `grep -rn 'same questions'` finds nothing outside `docs/audits/`. +- F8: heading of 0.5 fixed (`docs/roadmap.md:39`), R28 speaks of folders (`docs/design.md:147`); the rest is F7 above. + +### Verified and found true +- **`docs/writing.md` against `CLAUDE.md`, `README.md`, `docs/design.md`**: apart from F4, no contradiction. + - Its examples match the design: "The release embeds the LOTL and the Italian list" (`docs/writing.md:65-66`, R44 at `docs/design.md:259-262`); "whether the company proxy needs NTLM" (`docs/writing.md:67`, `docs/design.md:446-448`). + - R27 and R35 are cited in their proper sense (`docs/writing.md:77-78`). + - "Yes, six" (`docs/writing.md:72`) is followed by six exceptions. + - The fixed formats it names exist: the `VERDICT:` line (`.claude/agents/fable-reviewer.md:71`), the audit skeleton (`.claude/agents/coherence-auditor.md:50-56`), the front matter of both prompts. + - "Who checks?" (`docs/writing.md:88-89`) is matched by `.claude/agents/fable-reviewer.md:44-46` and `.claude/agents/coherence-auditor.md:36-37`. + - `docs/roadmap.md:34-36` describes the guide as it is. The Wikipedia page "Signs of AI writing" exists under the address given. + - No em dash, curly quote or emoji in `docs/writing.md`, `CLAUDE.md`, `README.md`, `docs/design.md`, `docs/roadmap.md`, the agent prompts, the scripts, the hooks, `rust-toolchain.toml` or the five commit messages (en dashes appear only in ranges such as "R28–R34"). +- **Commit messages in the range**: every change they name exists. 5d29d9d: five checks skipped on Windows and counted, tests for "AUDIT DUE" and "RED CHECKS" (`scripts/test-scripts.sh:372-384`). 8561ec5: the skip guard with `OS=Windows_NT` (`scripts/test-cleanup.sh:267`), the negative RED CHECKS case. 0121327, 4ab527f, df7ee92: the texts listed above. The section list in the message of 4ab527f matches the headings of the guide. +- **`rust-toolchain.toml` comment**: the four targets are the ones in `targets` (lines 20-25) and in R24 (`docs/design.md:121`); R25 (`docs/design.md:122-124`) builds the packages from the musl binary; the mingw linker is in `.cargo/config.toml`; CI installs the pinned toolchain from this file (`.github/workflows/ci.yml:99-102`) and has four jobs. `sed` at `scripts/audit-status.sh:78` still reads the version after the inline comment was removed. +- **Rule on verdict comments**: `sh scripts/check-public.sh --message ` exists (it is what `.githooks/commit-msg:4` runs). The posted comments hold no local path and no personal data. +- **Requirement numbering**: every R number used in the texts changed in the range exists in `docs/design.md`. +- **Roadmap marks**: 0.1, 0.2, 0.2.1 and 1.0 hold. `is_envelope` is in `src/lib.rs:10` with six test functions, none ignored: five run on macOS, `windows_paths` is `#[cfg(windows)]` and `non_utf8_names` is `#[cfg(unix)]`. Files named by unmarked steps only (`scripts/make-fixtures.sh`, `docs/accessibility.md`) do not exist, as expected. +- **Hooks against `CLAUDE.md:37-41`**: `.githooks/pre-commit:8-30`, `commit-msg:4`, `pre-push:9-19` do what is described; unchanged in the range. +- **GitHub settings against `CLAUDE.md`**: protection of `main` (the four checks, strict, admins included, linear history, no force-push, no deletion); merge commits and squash off, no automatic branch deletion, wiki and projects off; interaction limit `collaborators_only`, expiring 2027-05-22. The actions allowlist and secret scanning were not re-queried. +- **Crate versions**: `assert_cmd` 2.2.2 and `predicates` 3.1.4 in `Cargo.toml` match `Cargo.lock`. Rust 1.100.0 is installed and is the current stable according to `rustup check`. +- **Safety, accessibility, uninstall (R28-R43)**: still no code; nothing is claimed done; the placeholder in `src/main.rs:3-10` reads and writes nothing and is the recorded exception (`docs/design.md:437-438`). +- **Language rule**: all text added in the range and in the working tree is English. +- **Public-repository rule**: `sh scripts/check-public.sh --range tip HEAD` exits 0; the five commits of the range have no-reply author and committer addresses. No `tests/corpus/` was read. + +## Health + +Run on macOS arm64 on the working tree (with the uncommitted change); script tests, probes and rule breaking on a scratch copy with a `gh` stub first in `PATH`. + +| Command | Result | +|---|---| +| `cargo fmt --check` | clean (exit 0) | +| `cargo clippy --all-targets -- -D warnings` | no issues (exit 0) | +| `cargo nextest run` | 5 passed (2 binaries), exit 0 | +| `cargo test --doc` | 0 doctests (none exist), exit 0 | +| `cargo deny check` | `advisories ok, bans ok, licenses ok, sources ok`; warnings for allowed licences not used yet (for example `Zlib`, `deny.toml:22`) | +| `sh scripts/test-scripts.sh` | 140 passed, 0 failed (137 at 8561ec5 plus the 3 new checks) | +| `sh scripts/test-cleanup.sh` | 79 passed, 0 failed, 0 skipped | +| `sh scripts/test-hooks.sh` | 24 passed, 0 failed | +| `sh scripts/check-public.sh --range tip HEAD` | exit 0 ("0 commits and the tree of df7ee92 scanned") | +| `sh scripts/audit-status.sh --gate-push HEAD` | exit 0 (5 commits since audit 0004) | +| `sh scripts/audit-status.sh --gate-commit` | exit 1: "5 commits since the last coherence audit (limit 5)" | +| CI on df7ee92 (PR #3) | all four jobs green | +| CI on `main` (8561ec5) | all four jobs green | + +The repository was not modified by the audit: `git status --porcelain` shows the same four files before and after, nothing staged, no stash. From 2557e7f12ef69de2eb4c7e687964cea8017e3f44 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 07:08:58 +0100 Subject: [PATCH 05/36] Session report says when a newer Rust stable exists; explain the pin The session report has a "Rust" section: it compares the version pinned in rust-toolchain.toml with the latest stable from `rustup check`. It says "NEWER RUST STABLE" when there is one, and says so when the pin is missing, when rustup cannot check, or when the pin is ahead of the installed stable. The script tests use a rustup stub, so they never reach the network (audit 0005-F1 to F3). rust-toolchain.toml now explains why the version is pinned, how to move it, and which targets it builds (R24, R25). The writing guide says the user guide is translated too (0005-F4). A wrapped line in design.md is joined. Co-Authored-By: Claude Opus 5.5 --- docs/design.md | 3 +-- docs/writing.md | 3 ++- rust-toolchain.toml | 18 +++++++++++++++++- scripts/audit-status.sh | 18 ++++++++++++++++++ scripts/test-scripts.sh | 22 ++++++++++++++++++++++ 5 files changed, 60 insertions(+), 4 deletions(-) diff --git a/docs/design.md b/docs/design.md index 8b10a3c..5300d34 100644 --- a/docs/design.md +++ b/docs/design.md @@ -412,8 +412,7 @@ The order of work is in `roadmap.md` (safety-critical, pure parts first). `openssl cms -sign`, `openssl ts`) and by Rust test helpers for what OpenSSL cannot produce: BER indefinite lengths, nested envelopes, `.tsd`, base64, RSA-PSS, ECDSA, countersignatures, tampered content, expired and untrusted certificates, a fake TSL listing the test CA. -- Fuzzing of the `ber` and `cms` readers (`cargo fuzz`, needs nightly) once they exist: no input - may panic or hang. +- Fuzzing of the `ber` and `cms` readers (`cargo fuzz`, needs nightly) once they exist: no input may panic or hang. - Real documents stay on the Windows PC (`tests/corpus/`, git-ignored, personal data): used to check results by hand and, if useful, against the old tool's output. diff --git a/docs/writing.md b/docs/writing.md index 9935e2a..30780b1 100644 --- a/docs/writing.md +++ b/docs/writing.md @@ -2,7 +2,8 @@ These rules apply to every text in this repository. That means docs, agent prompts, comments, commit messages, PR texts, the user guide and the strings the tool shows. Everything is in -English; only the tool's own strings are translated (see "Language" in `CLAUDE.md`). +English; only the tool's interface (its strings and the user guide) is translated (see +"Language" in `CLAUDE.md`). ## Who reads our texts? diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 52e3e46..663808b 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,21 @@ +# Which Rust builds SignSpector? Exactly this version, on every machine and in CI. +# +# Why pinned? A new Rust release can add lints, and clippy runs with -D warnings: the build +# must not break on its own. We move to a new version on purpose, in its own commit. +# +# How to update: +# 1. rustup check (shows the latest stable) +# 2. change `channel` below, then: rustup show +# 3. cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo nextest run +# 4. commit alone ("Rust 1.x.y"); CI runs the four jobs on the new version. +# +# Which targets, and why? The release builds (R24 in docs/design.md): +# aarch64-apple-darwin, x86_64-apple-darwin macOS arm64 and Intel (universal binary) +# x86_64-pc-windows-gnu Windows, mingw-w64 (linker in .cargo/config.toml) +# x86_64-unknown-linux-musl Linux, one static binary (cargo zigbuild); +# the .deb, .rpm and .tar.gz are made from it (R25) [toolchain] -channel = "1.100.0" # pinned: update by hand, new lints can break -D warnings +channel = "1.100.0" components = ["clippy", "rustfmt", "llvm-tools-preview"] targets = [ "aarch64-apple-darwin", diff --git a/scripts/audit-status.sh b/scripts/audit-status.sh index 8ea302e..8b85035 100755 --- a/scripts/audit-status.sh +++ b/scripts/audit-status.sh @@ -73,6 +73,24 @@ else fi [ "$since" -ge "$AUDIT_EVERY" ] && echo "AUDIT DUE" +section "Rust" +# The pinned version (rust-toolchain.toml) is moved by hand; say when a newer stable exists. +pinned=$(sed -n 's/^channel *= *"\([0-9.]*\)".*/\1/p' rust-toolchain.toml 2>/dev/null) +latest=$(rustup check 2>/dev/null \([0-9][0-9.]*\).*/\1/p' \ + -e 's/^stable-.* up to date: \([0-9][0-9.]*\).*/\1/p' | head -n 1) +if [ -z "$pinned" ]; then + echo "pinned Rust version not found in rust-toolchain.toml" +elif [ -z "$latest" ]; then + echo "Rust release not checked (rustup check failed or no stable toolchain)" +elif [ "$latest" = "$pinned" ]; then + echo "pinned Rust $pinned is the latest stable" +elif [ "$(printf '%s\n%s\n' "$pinned" "$latest" | sort -t. -k1,1n -k2,2n -k3,3n | tail -n 1)" = "$latest" ]; then + echo "NEWER RUST STABLE: $latest (pinned: $pinned); see rust-toolchain.toml" +else + echo "pinned Rust $pinned; latest stable reported by rustup: $latest" +fi + section "Unfinished local work" dirty=$(git status --porcelain) [ -n "$dirty" ] && { echo "uncommitted changes:"; printf '%s\n' "$dirty"; } || echo "working tree clean" diff --git a/scripts/test-scripts.sh b/scripts/test-scripts.sh index d5f6d77..40fb325 100755 --- a/scripts/test-scripts.sh +++ b/scripts/test-scripts.sh @@ -36,6 +36,8 @@ expect_reason() { # Report-mode tests never call the real gh (network, user account): default gh says "not logged in". unset GH_REPO GH_HOST GH_TOKEN GITHUB_TOKEN GH_ENTERPRISE_TOKEN mkdir -p "$work/nogh"; printf '#!/bin/sh\necho "$*" >> "%s/gh-stub.log"\nexit 1\n' "$work" > "$work/nogh/gh"; chmod +x "$work/nogh/gh" +# The same for rustup: the report's "Rust" section must not reach the network in the tests. +printf '#!/bin/sh\necho "$*" >> "%s/rustup-stub.log"\nexit 1\n' "$work" > "$work/nogh/rustup"; chmod +x "$work/nogh/rustup" PATH="$work/nogh:$PATH" new_repo() { @@ -358,6 +360,26 @@ PATH="$work/ghshim:$PATH" sh scripts/audit-status.sh 2>/dev/null | grep -q "INTE PATH="$work/ghshim:$PATH" sh scripts/audit-status.sh 2>/dev/null | grep -q "== GitHub"; expect "GitHub section ran (limit far away)" 0 $? fake_gh "" PATH="$work/ghshim:$PATH" sh scripts/audit-status.sh 2>/dev/null | grep -q "INTERACTION LIMIT NOT ACTIVE"; expect "limit missing" 0 $? +# The report says when a newer stable Rust exists than the pinned one (rust-toolchain.toml). +new_repo +printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml +mkdir -p "$work/rustupshim" +rustup_says() { printf '#!/bin/sh\n[ "$1" = check ] || exit 1\n%s\n' "$1" > "$work/rustupshim/rustup"; chmod +x "$work/rustupshim/rustup"; } +rustup_says "echo 'stable-x86_64-unknown-linux-gnu - update available: 1.100.0 (a 2026-11-09) -> 1.101.0 (b 2026-12-21)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "NEWER RUST STABLE: 1.101.0 (pinned: 1.100.0); see rust-toolchain.toml"; expect "report: newer Rust stable shown" 0 $? +rustup_says "echo 'stable-x86_64-unknown-linux-gnu - up to date: 1.100.0 (a 2026-11-09)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: pinned Rust is the latest stable" 0 $? +rustup_says "echo 'stable-x86_64-unknown-linux-gnu - up to date: 1.99.0 (a 2026-10-01)'" +out=$(PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1) +printf '%s\n' "$out" | grep -q "NEWER RUST"; expect "report: an older installed stable is not newer" 1 $? +printf '%s\n' "$out" | grep -qx "pinned Rust 1.100.0; latest stable reported by rustup: 1.99.0"; expect "report: pinned ahead of the stable said" 0 $? +rm -f rust-toolchain.toml +rustup_says "echo 'stable-x86_64-unknown-linux-gnu - up to date: 1.100.0 (a 2026-11-09)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust version not found in rust-toolchain.toml"; expect "report: missing pin said" 0 $? +grep -q "^check" "$work/rustup-stub.log"; expect "the test stub stands in for the real rustup" 0 $? +printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml +rustup_says "exit 1" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "Rust release not checked (rustup check failed or no stable toolchain)"; expect "report: rustup check failing is said" 0 $? # The report says when an audit is due (5 commits since the last one), and not before. new_repo commit a; commit b; commit c; commit d From 1ac9d1de58f0dc16ebd89d6b70759ef99f14fe1a Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 11:41:02 +0100 Subject: [PATCH 06/36] Close the second review of PR #3: test every rule of the Rust check The review of df7ee92 and 2557e7f found rules of the "Rust" section that no test noticed when broken. Each now has a test: - versions compared number by number (patch 9 before 10, major 9 before 10); - one line read when rustup prints a stable line per host; - rustup reads no input and its errors stay out of the report; - a commented channel line is ignored. Fixes, each with a test that failed first: - the older rustup line "Up to date : X" is read; - a tab before "=" and single quotes in the pin are read; - a pin that is not x.y.z is reported, never compared; - when the check fails, the report says how to install a stable toolchain. rust-toolchain.toml says that rustup check needs a stable toolchain, and installs with "rustup toolchain install", as CI does. Writing guide fixes: writing.md counts seven exceptions; shorter sentences in writing.md and CLAUDE.md; the auditor checks verdict comments under project rules, with a gh call that cannot prompt; one long line wrapped in design.md. Co-Authored-By: Claude Opus 5.5 --- .claude/agents/coherence-auditor.md | 8 +++--- CLAUDE.md | 2 +- docs/design.md | 3 ++- docs/writing.md | 10 ++++---- rust-toolchain.toml | 5 ++-- scripts/audit-status.sh | 10 +++++--- scripts/test-scripts.sh | 38 ++++++++++++++++++++++++++++- 7 files changed, 60 insertions(+), 16 deletions(-) diff --git a/.claude/agents/coherence-auditor.md b/.claude/agents/coherence-auditor.md index df160ed..b9cba73 100644 --- a/.claude/agents/coherence-auditor.md +++ b/.claude/agents/coherence-auditor.md @@ -33,11 +33,13 @@ Read first: `CLAUDE.md`, `docs/design.md`, `docs/roadmap.md`, the latest report and laws cited. Verify each one; list those that do not exist or say something different. 5. **Docs agree with each other.** `CLAUDE.md`, `design.md`, `roadmap.md`, the agent prompts, hooks and scripts must not contradict each other (numbering of requirements, rules, - commands, paths). Note anything outdated. Texts follow `docs/writing.md`; every pull request - carries the reviewer's verdict as a comment (`gh pr view --comments`). + commands, paths). Note anything outdated. Report texts that break `docs/writing.md`, with + `file:line`. 6. **Project rules.** Safety rules (R28–R34), accessibility (R35–R39), uninstall (R40–R43), language rules (English in the repository, translated user interface), public-repository - rules (`sh scripts/check-public.sh --range tip HEAD`). + rules (`sh scripts/check-public.sh --range tip HEAD`). Check that every pull request carries + the reviewer's verdict as a comment: + `GH_PROMPT_DISABLED=1 gh pr view --comments ` before posting. 6. Commit only when the user asks. Hooks (`.githooks/`): pre-commit runs the public-repository check, the audit cadence gate, the script tests when scripts or hooks change, fmt, clippy diff --git a/docs/design.md b/docs/design.md index 5300d34..8b10a3c 100644 --- a/docs/design.md +++ b/docs/design.md @@ -412,7 +412,8 @@ The order of work is in `roadmap.md` (safety-critical, pure parts first). `openssl cms -sign`, `openssl ts`) and by Rust test helpers for what OpenSSL cannot produce: BER indefinite lengths, nested envelopes, `.tsd`, base64, RSA-PSS, ECDSA, countersignatures, tampered content, expired and untrusted certificates, a fake TSL listing the test CA. -- Fuzzing of the `ber` and `cms` readers (`cargo fuzz`, needs nightly) once they exist: no input may panic or hang. +- Fuzzing of the `ber` and `cms` readers (`cargo fuzz`, needs nightly) once they exist: no input + may panic or hang. - Real documents stay on the Windows PC (`tests/corpus/`, git-ignored, personal data): used to check results by hand and, if useful, against the old tool's output. diff --git a/docs/writing.md b/docs/writing.md index 30780b1..b67d47f 100644 --- a/docs/writing.md +++ b/docs/writing.md @@ -70,7 +70,7 @@ opinion and no reason is not neutral, it is useless. ## Are there exceptions? -Yes, six: +Yes, seven: - Safety warnings and irreversible actions: full sentences, even if longer. Clarity beats brevity. - Steps that must happen in order: a numbered list, one action per step. @@ -79,10 +79,10 @@ Yes, six: with screen readers (R35): words, not symbols. - Texts without headings (commit messages, comments, the tool's strings) keep the rest: answer first, short sentences, nothing to cut. -- Numbered lists (requirements `R44.`, roadmap steps `3.4`) and fixed formats (the reviewer's - `VERDICT:` line, the audit report skeleton, the front matter of agent prompts) keep their - labels and layout; the text inside follows the guide. Audit reports in `docs/audits/` are - records: they are never rewritten. +- Numbered lists and fixed formats keep their labels and layout. Examples: requirements + `R44.`, roadmap steps `3.4`, the reviewer's `VERDICT:` line, the audit report skeleton, the + front matter of agent prompts. The text inside them follows the guide. +- Audit reports in `docs/audits/` are records: they are never rewritten. ## Who checks? diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 663808b..9ec4de1 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -4,8 +4,9 @@ # must not break on its own. We move to a new version on purpose, in its own commit. # # How to update: -# 1. rustup check (shows the latest stable) -# 2. change `channel` below, then: rustup show +# 1. rustup check (shows the latest stable; needs a "stable" toolchain: +# rustup toolchain install stable) +# 2. change `channel` below, then: rustup toolchain install (as CI does) # 3. cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo nextest run # 4. commit alone ("Rust 1.x.y"); CI runs the four jobs on the new version. # diff --git a/scripts/audit-status.sh b/scripts/audit-status.sh index 8b85035..aa5e7e9 100755 --- a/scripts/audit-status.sh +++ b/scripts/audit-status.sh @@ -75,14 +75,18 @@ fi section "Rust" # The pinned version (rust-toolchain.toml) is moved by hand; say when a newer stable exists. -pinned=$(sed -n 's/^channel *= *"\([0-9.]*\)".*/\1/p' rust-toolchain.toml 2>/dev/null) +# rustup check needs a "stable" toolchain installed; its lines (rustup 1.29: "up to date: X", +# "update available: X -> Y"; up to 1.28: "Up to date : X") are read for the first stable host. +pinned=$(sed -n "s/^channel[[:space:]]*=[[:space:]]*[\"']\([^\"']*\)[\"'].*/\1/p" rust-toolchain.toml 2>/dev/null) latest=$(rustup check 2>/dev/null \([0-9][0-9.]*\).*/\1/p' \ - -e 's/^stable-.* up to date: \([0-9][0-9.]*\).*/\1/p' | head -n 1) + -e 's/^stable-.* [Uu]p to date *: *\([0-9][0-9.]*\).*/\1/p' | head -n 1) if [ -z "$pinned" ]; then echo "pinned Rust version not found in rust-toolchain.toml" +elif ! printf '%s\n' "$pinned" | grep -qx '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*'; then + echo "pinned Rust $pinned is not x.y.z; see rust-toolchain.toml" elif [ -z "$latest" ]; then - echo "Rust release not checked (rustup check failed or no stable toolchain)" + echo "Rust release not checked (rustup check failed, or no stable toolchain: rustup toolchain install stable)" elif [ "$latest" = "$pinned" ]; then echo "pinned Rust $pinned is the latest stable" elif [ "$(printf '%s\n%s\n' "$pinned" "$latest" | sort -t. -k1,1n -k2,2n -k3,3n | tail -n 1)" = "$latest" ]; then diff --git a/scripts/test-scripts.sh b/scripts/test-scripts.sh index 40fb325..b42c90c 100755 --- a/scripts/test-scripts.sh +++ b/scripts/test-scripts.sh @@ -364,6 +364,7 @@ PATH="$work/ghshim:$PATH" sh scripts/audit-status.sh 2>/dev/null | grep -q "INTE new_repo printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml mkdir -p "$work/rustupshim" +# The stub lines copy the format of rustup 1.29.3 (rustup check), apart from the older-format test. rustup_says() { printf '#!/bin/sh\n[ "$1" = check ] || exit 1\n%s\n' "$1" > "$work/rustupshim/rustup"; chmod +x "$work/rustupshim/rustup"; } rustup_says "echo 'stable-x86_64-unknown-linux-gnu - update available: 1.100.0 (a 2026-11-09) -> 1.101.0 (b 2026-12-21)'" PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "NEWER RUST STABLE: 1.101.0 (pinned: 1.100.0); see rust-toolchain.toml"; expect "report: newer Rust stable shown" 0 $? @@ -379,7 +380,42 @@ PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned grep -q "^check" "$work/rustup-stub.log"; expect "the test stub stands in for the real rustup" 0 $? printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml rustup_says "exit 1" -PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "Rust release not checked (rustup check failed or no stable toolchain)"; expect "report: rustup check failing is said" 0 $? +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "Rust release not checked (rustup check failed, or no stable toolchain: rustup toolchain install stable)"; expect "report: rustup check failing is said" 0 $? +# Versions are compared number by number: patch 10 is after patch 9, major 10 after major 9. +printf '[toolchain]\nchannel = "1.100.9"\n' > rust-toolchain.toml +rustup_says "echo 'stable-x86_64-unknown-linux-gnu - update available: 1.100.9 (a 2026-11-09) -> 1.100.10 (b 2026-11-20)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "NEWER RUST STABLE: 1.100.10 (pinned: 1.100.9); see rust-toolchain.toml"; expect "report: newer patch release shown" 0 $? +printf '[toolchain]\nchannel = "1.100.10"\n' > rust-toolchain.toml +rustup_says "echo 'stable-x86_64-unknown-linux-gnu - up to date: 1.100.9 (a 2026-11-09)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -q "NEWER RUST"; expect "report: older patch release is not newer" 1 $? +printf '[toolchain]\nchannel = "9.0.0"\n' > rust-toolchain.toml +rustup_says "echo 'stable-x86_64-unknown-linux-gnu - up to date: 10.0.0 (a 2026-11-09)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "NEWER RUST STABLE: 10.0.0 (pinned: 9.0.0); see rust-toolchain.toml"; expect "report: newer major release shown" 0 $? +printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml +# Two hosts installed (e.g. arm64 and x86_64 on a Mac): rustup prints two stable lines, one is read. +rustup_says "printf '%s\\n' 'stable-aarch64-apple-darwin - update available: 1.100.0 (a 2026-11-09) -> 1.101.0 (b 2026-12-21)' 'stable-x86_64-apple-darwin - update available: 1.100.0 (a 2026-11-09) -> 1.101.0 (b 2026-12-21)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "NEWER RUST STABLE: 1.101.0 (pinned: 1.100.0); see rust-toolchain.toml"; expect "report: two stable lines read as one" 0 $? +# The line format of older rustup (up to 1.28): "Up to date : X". +rustup_says "echo 'stable-x86_64-unknown-linux-gnu - Up to date : 1.100.0 (a 2026-11-09)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: older rustup format read" 0 $? +# rustup gets no standard input, and its error text stays out of the report. +rustup_says "echo \"stdin=\$(cat)\" >> '$work/rustup-ask.log'; echo rustup-noise >&2; echo 'stable-x86_64-unknown-linux-gnu - up to date: 1.100.0 (a 2026-11-09)'" +rm -f "$work/rustup-ask.log" +out=$(echo typed | PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1) +[ "$(cat "$work/rustup-ask.log" 2>/dev/null)" = "stdin=" ]; expect "report: rustup reads no input" 0 $? +printf '%s\n' "$out" | grep -q "rustup-noise"; expect "report: rustup errors not shown" 1 $? +# Only the real channel line counts: not a commented one; tabs and single quotes are valid TOML. +rustup_says "echo 'stable-x86_64-unknown-linux-gnu - up to date: 1.100.0 (a 2026-11-09)'" +printf '[toolchain]\n# channel = "1.0.0"\nchannel = "1.100.0"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: commented channel line ignored" 0 $? +printf "[toolchain]\nchannel\t= '1.100.0'\n" > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: tab and single quotes read" 0 $? +# A pin that is not x.y.z (e.g. "1.100" or "stable") is said, never compared. +printf '[toolchain]\nchannel = "1.100"\n' > rust-toolchain.toml +out=$(PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1) +printf '%s\n' "$out" | grep -qx "pinned Rust 1.100 is not x.y.z; see rust-toolchain.toml"; expect "report: pin without patch said" 0 $? +printf '%s\n' "$out" | grep -q "NEWER RUST"; expect "report: pin without patch not compared" 1 $? +printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml # The report says when an audit is due (5 commits since the last one), and not before. new_repo commit a; commit b; commit c; commit d From c3f070e7f90ab8f0b7c9cbe8945b9d645762923f Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 11:58:48 +0100 Subject: [PATCH 07/36] Close the review of 1ac9d1d: more tests for the Rust check The review found rules of the "Rust" section in scripts/audit-status.sh that no test noticed when broken. Each now has a test: - only stable lines are read, not nightly ones; - the whole pin must be x.y.z ("stable" and "1.100.0-beta.1" are said); - a trailing comment and CRLF line ends in rust-toolchain.toml are read; - without the file, no sed error reaches the report. Two fixes, each with a test that failed first: - an indented channel key is read; - with two channel keys, the first one is read, in a one-line message. The comment no longer says which rustup release changed the "Up to date" line, because that was not verified. The subject of 1ac9d1d says "every rule". The review showed that some were still untested. Co-Authored-By: Claude Opus 5.5 --- scripts/audit-status.sh | 4 ++-- scripts/test-scripts.sh | 28 +++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/scripts/audit-status.sh b/scripts/audit-status.sh index aa5e7e9..a19e683 100755 --- a/scripts/audit-status.sh +++ b/scripts/audit-status.sh @@ -76,8 +76,8 @@ fi section "Rust" # The pinned version (rust-toolchain.toml) is moved by hand; say when a newer stable exists. # rustup check needs a "stable" toolchain installed; its lines (rustup 1.29: "up to date: X", -# "update available: X -> Y"; up to 1.28: "Up to date : X") are read for the first stable host. -pinned=$(sed -n "s/^channel[[:space:]]*=[[:space:]]*[\"']\([^\"']*\)[\"'].*/\1/p" rust-toolchain.toml 2>/dev/null) +# "update available: X -> Y"; older releases: "Up to date : X") are read for the first stable host. +pinned=$(sed -n "s/^[[:space:]]*channel[[:space:]]*=[[:space:]]*[\"']\([^\"']*\)[\"'].*/\1/p" rust-toolchain.toml 2>/dev/null | head -n 1) latest=$(rustup check 2>/dev/null \([0-9][0-9.]*\).*/\1/p' \ -e 's/^stable-.* [Uu]p to date *: *\([0-9][0-9.]*\).*/\1/p' | head -n 1) diff --git a/scripts/test-scripts.sh b/scripts/test-scripts.sh index b42c90c..edcd101 100755 --- a/scripts/test-scripts.sh +++ b/scripts/test-scripts.sh @@ -395,7 +395,7 @@ printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml # Two hosts installed (e.g. arm64 and x86_64 on a Mac): rustup prints two stable lines, one is read. rustup_says "printf '%s\\n' 'stable-aarch64-apple-darwin - update available: 1.100.0 (a 2026-11-09) -> 1.101.0 (b 2026-12-21)' 'stable-x86_64-apple-darwin - update available: 1.100.0 (a 2026-11-09) -> 1.101.0 (b 2026-12-21)'" PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "NEWER RUST STABLE: 1.101.0 (pinned: 1.100.0); see rust-toolchain.toml"; expect "report: two stable lines read as one" 0 $? -# The line format of older rustup (up to 1.28): "Up to date : X". +# The line format of older rustup releases: "Up to date : X". rustup_says "echo 'stable-x86_64-unknown-linux-gnu - Up to date : 1.100.0 (a 2026-11-09)'" PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: older rustup format read" 0 $? # rustup gets no standard input, and its error text stays out of the report. @@ -416,6 +416,32 @@ out=$(PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1) printf '%s\n' "$out" | grep -qx "pinned Rust 1.100 is not x.y.z; see rust-toolchain.toml"; expect "report: pin without patch said" 0 $? printf '%s\n' "$out" | grep -q "NEWER RUST"; expect "report: pin without patch not compared" 1 $? printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml +# Only stable lines count: a nightly line (cargo fuzz needs nightly) before the stable one is skipped. +rustup_says "printf '%s\\n' 'nightly-x86_64-unknown-linux-gnu - update available: 1.102.0-nightly (a 2026-11-20) -> 1.102.0-nightly (b 2026-11-22)' 'stable-x86_64-unknown-linux-gnu - up to date: 1.100.0 (a 2026-11-09)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: nightly line skipped" 0 $? +rustup_says "printf '%s\\n' 'nightly-x86_64-unknown-linux-gnu - up to date: 1.102.0-nightly (a 2026-11-22)' 'stable-x86_64-unknown-linux-gnu - update available: 1.100.0 (a 2026-11-09) -> 1.101.0 (b 2026-12-21)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "NEWER RUST STABLE: 1.101.0 (pinned: 1.100.0); see rust-toolchain.toml"; expect "report: nightly up-to-date line skipped" 0 $? +rustup_says "echo 'stable-x86_64-unknown-linux-gnu - up to date: 1.100.0 (a 2026-11-09)'" +# The whole pin must be x.y.z: a channel name or a pre-release is said, never compared. +printf '[toolchain]\nchannel = "stable"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust stable is not x.y.z; see rust-toolchain.toml"; expect "report: channel name said" 0 $? +printf '[toolchain]\nchannel = "1.100.0-beta.1"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0-beta.1 is not x.y.z; see rust-toolchain.toml"; expect "report: pre-release pin said" 0 $? +# Text after the closing quote is ignored: a trailing comment, CRLF line ends (Windows checkout). +printf '[toolchain]\nchannel = "1.100.0" # pinned\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: trailing comment ignored" 0 $? +printf '[toolchain]\r\nchannel = "1.100.0"\r\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: CRLF line ends read" 0 $? +# An indented key is valid TOML. +printf '[toolchain]\n channel = "1.100.0"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: indented channel read" 0 $? +# A duplicate key (invalid TOML) still gives one line, from the first key. +printf '[toolchain]\nchannel = "1.99.0"\nchannel = "1.100.0"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "NEWER RUST STABLE: 1.100.0 (pinned: 1.99.0); see rust-toolchain.toml"; expect "report: first of two channel keys read" 0 $? +# Without the file, the report says so and shows no sed error. +rm -f rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -q "^sed"; expect "report: no sed error without the file" 1 $? +printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml # The report says when an audit is due (5 commits since the last one), and not before. new_repo commit a; commit b; commit c; commit d From 1363b188f64c65e110f443f147406e13196eb84e Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 12:13:42 +0100 Subject: [PATCH 08/36] Test the last unchecked rules of the Rust check (review of c3f070e) The review broke 48 rules of the "Rust" section in scripts/audit-status.sh, one per copy, and 8 left every test green. New tests cover them: - the section prints its heading and one line, with no error text; - no spaces around "=", and a tab after it, are read; - an apostrophe in a comment after a single-quoted pin is ignored; - a pin with four numbers is not x.y.z; - with two stable hosts at different versions, the first line is read; - a custom toolchain whose name only contains "stable-" is skipped. The same 48 breakages now each make at least one test fail. No behaviour changed. The comment above the section is split into short sentences. Co-Authored-By: Claude Opus 5.5 --- scripts/audit-status.sh | 5 +++-- scripts/test-scripts.sh | 24 ++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/scripts/audit-status.sh b/scripts/audit-status.sh index a19e683..a9aec07 100755 --- a/scripts/audit-status.sh +++ b/scripts/audit-status.sh @@ -75,8 +75,9 @@ fi section "Rust" # The pinned version (rust-toolchain.toml) is moved by hand; say when a newer stable exists. -# rustup check needs a "stable" toolchain installed; its lines (rustup 1.29: "up to date: X", -# "update available: X -> Y"; older releases: "Up to date : X") are read for the first stable host. +# rustup check needs a "stable" toolchain installed. It prints one line per toolchain: +# "up to date: X" or "update available: X -> Y" (rustup 1.29), "Up to date : X" (older releases). +# The first line of the stable channel is read. pinned=$(sed -n "s/^[[:space:]]*channel[[:space:]]*=[[:space:]]*[\"']\([^\"']*\)[\"'].*/\1/p" rust-toolchain.toml 2>/dev/null | head -n 1) latest=$(rustup check 2>/dev/null \([0-9][0-9.]*\).*/\1/p' \ diff --git a/scripts/test-scripts.sh b/scripts/test-scripts.sh index edcd101..634dcc3 100755 --- a/scripts/test-scripts.sh +++ b/scripts/test-scripts.sh @@ -438,9 +438,29 @@ PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned # A duplicate key (invalid TOML) still gives one line, from the first key. printf '[toolchain]\nchannel = "1.99.0"\nchannel = "1.100.0"\n' > rust-toolchain.toml PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "NEWER RUST STABLE: 1.100.0 (pinned: 1.99.0); see rust-toolchain.toml"; expect "report: first of two channel keys read" 0 $? -# Without the file, the report says so and shows no sed error. +# Without the file, the "Rust" section is its heading and one line: no sed error text. rm -f rust-toolchain.toml -PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -q "^sed"; expect "report: no sed error without the file" 1 $? +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | sed -n '/^== Rust$/,/^== /p' > "$work/rust-section.txt" +printf '== Rust\npinned Rust version not found in rust-toolchain.toml\n\n== Unfinished local work\n' | cmp -s - "$work/rust-section.txt"; expect "report: Rust section is one line without the file" 0 $? +# White space around "=" is free in TOML: none, or a tab after it. +rustup_says "echo 'stable-x86_64-unknown-linux-gnu - up to date: 1.100.0 (a 2026-11-09)'" +printf '[toolchain]\nchannel="1.100.0"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: no spaces around = read" 0 $? +printf '[toolchain]\nchannel =\t"1.100.0"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: tab after = read" 0 $? +# The value ends at its closing quote, even when a comment after it holds the other quote. +printf "[toolchain]\nchannel = '1.100.0' # don't move\n" > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: apostrophe in a trailing comment" 0 $? +# A pin with a fourth number is not x.y.z. +printf '[toolchain]\nchannel = "1.100.0.1"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0.1 is not x.y.z; see rust-toolchain.toml"; expect "report: four-part pin said" 0 $? +printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml +# With two stable hosts at different versions, the first line is read. +rustup_says "printf '%s\\n' 'stable-aarch64-apple-darwin - up to date: 1.100.0 (a 2026-11-09)' 'stable-x86_64-apple-darwin - update available: 1.100.0 (a 2026-11-09) -> 1.101.0 (b 2026-12-21)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: first of two stable hosts read" 0 $? +# A toolchain whose name only contains "stable-" (a custom one) is not the stable channel. +rustup_says "printf '%s\\n' 'my-stable-x86_64-unknown-linux-gnu - up to date: 1.50.0 (a 2025-01-01)' 'my-stable-x86_64-unknown-linux-gnu - update available: 1.50.0 (a 2025-01-01) -> 1.51.0 (b 2025-02-01)' 'stable-x86_64-unknown-linux-gnu - up to date: 1.100.0 (a 2026-11-09)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: custom toolchain named *stable- skipped" 0 $? printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml # The report says when an audit is due (5 commits since the last one), and not before. new_repo From fb410290dbd4168b773b6f7afb4677fe59be48b5 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 12:26:55 +0100 Subject: [PATCH 09/36] Close the review of 1363b18: five more tests for the Rust check The review found no bug. It broke rules of the "Rust" section in scripts/audit-status.sh that no test noticed. New tests cover them: - double quotes in a comment after a double-quoted pin; - a channel key indented with a tab; - a bad or missing pin is said before a rustup failure; - a pin with an empty part ("1.100.") is not x.y.z; - the first stable host is read, also when it has the higher version. No behaviour changed. Each of these breakages, and the 8 of the previous review, now makes at least one test fail. Co-Authored-By: Claude Opus 5.5 --- scripts/test-scripts.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/test-scripts.sh b/scripts/test-scripts.sh index 634dcc3..d3eb11a 100755 --- a/scripts/test-scripts.sh +++ b/scripts/test-scripts.sh @@ -451,6 +451,13 @@ PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned # The value ends at its closing quote, even when a comment after it holds the other quote. printf "[toolchain]\nchannel = '1.100.0' # don't move\n" > rust-toolchain.toml PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: apostrophe in a trailing comment" 0 $? +printf '[toolchain]\nchannel = "1.100.0" # was "1.99.0"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: double quotes in a trailing comment" 0 $? +printf '[toolchain]\n\tchannel = "1.100.0"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: tab-indented channel read" 0 $? +# A pin with an empty part is not x.y.z. +printf '[toolchain]\nchannel = "1.100."\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100. is not x.y.z; see rust-toolchain.toml"; expect "report: pin with an empty part said" 0 $? # A pin with a fourth number is not x.y.z. printf '[toolchain]\nchannel = "1.100.0.1"\n' > rust-toolchain.toml PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0.1 is not x.y.z; see rust-toolchain.toml"; expect "report: four-part pin said" 0 $? @@ -458,6 +465,15 @@ printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml # With two stable hosts at different versions, the first line is read. rustup_says "printf '%s\\n' 'stable-aarch64-apple-darwin - up to date: 1.100.0 (a 2026-11-09)' 'stable-x86_64-apple-darwin - update available: 1.100.0 (a 2026-11-09) -> 1.101.0 (b 2026-12-21)'" PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: first of two stable hosts read" 0 $? +rustup_says "printf '%s\\n' 'stable-aarch64-apple-darwin - update available: 1.100.0 (a 2026-11-09) -> 1.101.0 (b 2026-12-21)' 'stable-x86_64-apple-darwin - up to date: 1.100.0 (a 2026-11-09)'" +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "NEWER RUST STABLE: 1.101.0 (pinned: 1.100.0); see rust-toolchain.toml"; expect "report: first stable host read, not the lowest" 0 $? +# A pin problem is said before a rustup failure: the pin is the thing to fix first. +rustup_says "exit 1" +printf '[toolchain]\nchannel = "stable"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust stable is not x.y.z; see rust-toolchain.toml"; expect "report: bad pin said before rustup failure" 0 $? +rm -f rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust version not found in rust-toolchain.toml"; expect "report: missing pin said before rustup failure" 0 $? +printf '[toolchain]\nchannel = "1.100.0"\n' > rust-toolchain.toml # A toolchain whose name only contains "stable-" (a custom one) is not the stable channel. rustup_says "printf '%s\\n' 'my-stable-x86_64-unknown-linux-gnu - up to date: 1.50.0 (a 2025-01-01)' 'my-stable-x86_64-unknown-linux-gnu - update available: 1.50.0 (a 2025-01-01) -> 1.51.0 (b 2025-02-01)' 'stable-x86_64-unknown-linux-gnu - up to date: 1.100.0 (a 2026-11-09)'" PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0 is the latest stable"; expect "report: custom toolchain named *stable- skipped" 0 $? From 2891328bab2de21b413b63ab7be39f3508074b24 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 12:36:08 +0100 Subject: [PATCH 10/36] audit: 0006 Co-Authored-By: Claude Opus 5.5 --- docs/audits/0006-2026-11-23.md | 183 +++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 docs/audits/0006-2026-11-23.md diff --git a/docs/audits/0006-2026-11-23.md b/docs/audits/0006-2026-11-23.md new file mode 100644 index 0000000..dfcdfea --- /dev/null +++ b/docs/audits/0006-2026-11-23.md @@ -0,0 +1,183 @@ +# Coherence audit 0006 (2026-11-23) +Range: 2557e7f..fb41029 (five commits on `step/0.4-writing-guide`, PR #3, draft; working tree clean) Verdict: COHERENT + +Auditor: `coherence-auditor` agent, fresh context, read-only, run because the cadence is due (5 commits since audit 0005). + +The committed range holds no false claim and no broken rule. All five commits work on the "Rust" section of the session report and its tests, plus small text fixes. What the commit messages and the PR text say about them was checked and holds. The open points are on PR #3: its comments stop one step behind its head (F1), and a decision quoted in the PR text is not written in the project rules (F2). Step 0.4 is still open and unfinished, as its PR says. + +## Unfinished work + +`sh scripts/audit-status.sh` (exit 0): + +``` +== Audit cadence +commits since last audit: 5 (audit every 5) +last audit: 0f92512 2026-11-23 audit: 0005 +AUDIT DUE + +== Rust +pinned Rust 1.100.0 is the latest stable + +== Unfinished local work +working tree clean +branch step/0.4-writing-guide: 0 unpushed, 0 not pulled +local branches not merged into main: + step/0.4-writing-guide +remote branches not merged into main: + origin/step/0.4-writing-guide + +== Markers in code +none + +== Leftovers (scripts/cleanup.sh --plan; run scripts/cleanup.sh to remove the local ones) +keep local branch (not merged): step/0.4-writing-guide +on GitHub, merged (kept, nothing is deleted on GitHub): origin/step/0.2-ci +on GitHub, merged (kept, nothing is deleted on GitHub): origin/step/0.2.1-confirmation-rules +on GitHub, draft PR (not closed here): #3 updated 2026-11-23: Roadmap 0.4: writing guide +nothing to remove + +== GitHub +open pull requests: +#3 DRAFT step/0.4-writing-guide updated 2026-11-23: Roadmap 0.4: writing guide +last CI runs on main: +2026-11-23 completed/success: Guard the Windows skips; test the report with no red checks +2026-11-23 completed/success: CI +2026-11-22 completed/success: Remove --apply everywhere, close review and audit 0002 findings +``` + +- **Local work**: nothing uncommitted, no stashes, nothing unpushed, one worktree. +- **Cadence**: `sh scripts/audit-status.sh --gate-push HEAD` exits 0. `--gate-commit` exits 1 ("5 commits since the last coherence audit (limit 5)") until this report is committed alone. +- **PR #3** (draft, opened 2026-11-23, less than a day old, head fb41029, 9 commits, 10 comments): + - What it is for: roadmap 0.4 (`docs/roadmap.md:34-38`): the writing guide, the rewrite of the documents to it, the `rust-toolchain.toml` comment, the session-report line for a newer Rust. + - Done: `docs/writing.md`, the pointers to it, the rule on verdict comments, the `rust-toolchain.toml` comment, the "Rust" section with its tests. + - Missing: + - the comments that follow fb41029 (F1); + - an APPROVED verdict. PR #3 has five verdicts, all CHANGES NEEDED; `CLAUDE.md:57-59` makes a PR ready only after the reviewer approved; + - the rewrite of `README.md`, `docs/design.md`, `docs/roadmap.md`, `CLAUDE.md` and the agent prompts. Until then `CLAUDE.md:129-130` ("Every text ... follows `docs/writing.md`") describes the target, not the state. Example: the `README.md` headings at lines 10, 33, 59 are not questions, and `README.md:122-128` is a list with bold labels and colons (`docs/writing.md:16-18,59-60`). `README.md` does not name the guide (`grep -n writing README.md` finds nothing); + - the `[x]` mark at `docs/roadmap.md:34`, correctly absent. + - Still relevant: yes, it is the one open step. +- **CI job lists** (`gh pr checks 3`, `gh run list`): + + | Commit | Run | Result | + |---|---|---| + | 2557e7f | 45122270491 | run result: success | + | 1ac9d1d | 45158439855 | run result: success | + | c3f070e | 45161036812 | run result: success | + | 1363b18 | 45163358980 | run result: success | + | fb41029 (head) | 45165402536 | Repository rules, Linux musl, Windows gnu, macOS arm64: all four pass, read in the job list | + + The run on fb41029 was still pending at the start of the audit and finished green during it. GitGuardian passes. No red run in the range. `main` is unchanged at 8561ec5, green. +- **Branches**: local `main` and the step branch; on GitHub `main`, `step/0.2-ci` and `step/0.2.1-confirmation-rules` (both merged, kept) and the step branch. Nothing stale. +- **Pull requests**: #1 and #2 merged, #3 open as a draft. No other open PR. +- **Markers**: none. +- **Leftovers**: `sh scripts/cleanup.sh --plan` (exit 0) prints the four lines shown above and "nothing to remove". +- **Tracked files that belong to the work, not the product**: none. `git ls-files` shows 35 files; the only reports are the five under `docs/audits/`. + +## Findings + +### F1. `unfinished`: the comments of PR #3 stop before its head commit +- `GH_PROMPT_DISABLED=1 gh pr view 3 --comments `) left all tests green; it cannot change the result on a real rustup line, so it is not a finding. +- **PR #3 text**: the test names in the table of the "fifth review" are the names in `scripts/test-scripts.sh:448-479`. The counts match: 176 passed under `sh` and under `dash`. +- **`rust-toolchain.toml:1-17`**: CI installs the pinned toolchain with `rustup toolchain install` (`.github/workflows/ci.yml:98-100`) and has four jobs (`ci.yml:39,78` with three targets); the mingw linker is in `.cargo/config.toml`; the four targets are those at lines 21-26. +- **rustup line format**: here `rustup --version` says 1.29.3 and `rustup check` prints `stable-aarch64-apple-darwin - up to date: 1.100.0`, as the comment at `scripts/audit-status.sh:79` and the stub lines say. The older form "Up to date : X" could not be produced here; the code names no release for it. +- **Crate versions**: `assert_cmd` 2.2.2 and `predicates` 3.1.4 in `Cargo.toml` match `Cargo.lock`. Rust 1.100.0 is pinned, installed and the current stable. +- **Roadmap marks**: 0.1, 0.2, 0.2.1 and 1.0 hold; nothing was marked in the range. `is_envelope` is in `src/lib.rs:10` with six test functions, none ignored (`windows_paths` is `#[cfg(windows)]`, `non_utf8_names` is `#[cfg(unix)]`). `src/` did not change in the range. There is no other module or public function. +- **Requirement numbering**: R24, R25, R27, R35 as cited in the changed texts exist in `docs/design.md` in that sense. +- **Verdict comments** (`CLAUDE.md:31-36`): PR #3 carries verdicts on 0121327 and 4ab527f, on df7ee92 and 2557e7f, on 1ac9d1d, on c3f070e and on 1363b18, each by a "new fable-reviewer agent", each with the findings in short. The comments hold no local path and no personal data. PR #2: verdicts as reported in audit 0005. PR #1: no verdict (0003-F5, predates the rule). +- **Writing guide on the changed texts**: no em dash, curly quote or emoji found in the commit messages of the range or in the PR #3 text. The comment at `scripts/audit-status.sh:77-80` and the header of `rust-toolchain.toml` use short sentences and exact commands. +- **Safety, accessibility, uninstall (R28-R43)**: still no code; nothing is claimed done; the placeholder in `src/main.rs` reads and writes nothing and is the recorded exception (`docs/design.md:438-439`). +- **Language rule**: all text added in the range is English. +- **Public-repository rule**: `sh scripts/check-public.sh --range tip HEAD` exits 0; the five commits have no-reply author and committer addresses. No `tests/corpus/` was read. +- **Not re-queried**: the GitHub settings (branch protection, actions allowlist, secret scanning). The session report prints no interaction-limit warning, so the limit is active and more than 30 days from expiry. + +## Health + +Run on macOS arm64 at fb41029, working tree clean. Script tests, probes and rule breaking ran on a scratch copy (`git archive HEAD`) with `gh` and `rustup` stubs first in `PATH`. + +| Command | Result | +|---|---| +| `cargo fmt --check` | clean (exit 0) | +| `cargo clippy --all-targets -- -D warnings` | no issues | +| `cargo nextest run` | 5 passed (2 binaries), exit 0 | +| `cargo test --doc` | 0 doctests (none exist) | +| `cargo deny check` | `advisories ok, bans ok, licenses ok, sources ok` (exit 0); warning for an allowed licence not used yet (`Zlib`, `deny.toml:22`) | +| `sh scripts/test-scripts.sh` | 176 passed, 0 failed (also under `dash`) | +| `sh scripts/test-cleanup.sh` | 79 passed, 0 failed, 0 skipped | +| `sh scripts/test-hooks.sh` | 24 passed, 0 failed | +| `sh scripts/check-public.sh --range tip HEAD` | exit 0 ("0 commits and the tree of fb41029 scanned") | +| `sh scripts/audit-status.sh --gate-push HEAD` | exit 0 (5 commits since audit 0005) | +| `sh scripts/audit-status.sh --gate-commit` | exit 1: "5 commits since the last coherence audit (limit 5)" | +| CI on fb41029 (PR #3) | all four jobs green | +| CI on `main` (8561ec5) | green, unchanged | + +The repository was not modified by the audit: `git status --porcelain` is empty before and after, no stash. `cleanup.sh` was run with `--plan` only. Nothing was posted or changed on GitHub. From d323e7450b58f76dc666144648490262ed6bf9ed Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 12:36:44 +0100 Subject: [PATCH 11/36] Rewrite the README to the writing guide; record the Rust-section decision README.md: - Section headings are the reader's questions ("Can it damage my documents?", "How do I build it?"), each answered in its first sentence. - No bold labels in lists; long sentences split. - It now points to docs/writing.md. - Commands, options, numbers, links and safety rules are unchanged. docs/roadmap.md, step 0.5: the owner's decision to stop the review rounds on the "Rust" section of the session report. It also records the open note that `rustup check` has no time limit (audit 0006, F2). Co-Authored-By: Claude Opus 5.5 --- README.md | 167 +++++++++++++++++++++++++----------------------- docs/roadmap.md | 5 ++ 2 files changed, 91 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index ce62863..49df040 100644 --- a/README.md +++ b/README.md @@ -1,82 +1,84 @@ # SignSpector -**Cross-platform batch verifier for CAdES signatures and time stamps** (`.p7m`, `.p7s`, `.tsd`, -`.m7m`) against the European trusted lists (Italy, Romania, France and every other EU/EEA -country), with an accessible HTML report and safe extraction of the signed documents. +SignSpector checks signed and time-stamped files (`.p7m`, `.p7s`, `.tsd`, `.m7m`) in bulk. It +verifies CAdES signatures and time stamps against the European trusted lists (Italy, Romania, +France and every other EU/EEA country). It writes an accessible HTML report and, on request, +extracts the signed documents safely. It runs on Windows, macOS and Linux. -> **Status: early development.** Nothing is usable yet: the project is being built step by -> step, test first. See the [roadmap](docs/roadmap.md) for what is done and what comes next. +> Status: early development. Nothing is usable yet. We build the project step by step, test +> first. The [roadmap](docs/roadmap.md) shows what is done and what comes next. -## What it does +## What does it do? -Offices receive and archive documents that are digitally signed (CAdES `.p7m`, detached -`.p7s`) and time-stamped (`.tsd`, `.m7m`), often nested several layers deep. Opening them one by +Point SignSpector at a folder. It finds every signed or time-stamped file there, verifies it, +and writes a report. Offices receive and archive such files every day: CAdES `.p7m`, detached +`.p7s`, time-stamped `.tsd` and `.m7m`, often nested several layers deep. Opening them one by one is slow and tells little about the signatures. -Point SignSpector at a folder and it will: +For each folder, SignSpector: -- **find** every signed or time-stamped file in it and its subfolders; -- **open** every layer: BER/DER envelopes (including indefinite lengths), base64 envelopes, +- finds every signed or time-stamped file in it and its subfolders; +- opens every layer: BER/DER envelopes (including indefinite lengths), base64 envelopes, nested signatures, RFC 5544 time-stamped data; -- **verify** each signature (RSA, RSA-PSS, ECDSA; SHA-1/2), the signer's certificate - (validity, key usage, qualified status), the chain up to a CA of the - national trusted list of the certifier's country, reached through the - [EU List of Trusted Lists](https://ec.europa.eu/tools/lotl/eu-lotl.xml) and chosen - automatically from the signatures found, whether the certificate was revoked (from data in the - signature or the CA's revocation list, not one query per signature), countersignatures - and RFC 3161 time stamps; -- **report** the results on the console and in a self-contained HTML report (and JSON for +- verifies each signature (RSA, RSA-PSS, ECDSA; SHA-1/2) and the signer's certificate + (validity, key usage, qualified status); +- follows the chain up to a CA of the national trusted list of the certifier's country. It + reaches that list through the [EU List of Trusted Lists](https://ec.europa.eu/tools/lotl/eu-lotl.xml) + and chooses it from the signatures found; +- checks whether the certificate was revoked, from data in the signature or the CA's + revocation list: not one query per signature; +- verifies countersignatures and RFC 3161 time stamps; +- reports the results on the console and in a self-contained HTML report (and JSON for scripts); -- **extract**, only on request, the signed documents beside the originals: +- extracts the signed documents beside the originals, only on request: `Relazione.pdf.p7m` → `Relazione.pdf`. -## Safety by design - -Signed documents are often the only official copy. SignSpector is built so that it cannot -damage them: - -- **Dry run by default.** Without an explicit `extract`, nothing is written except the report. -- **Confirmation before anything happens.** After a folder is chosen, the tool only counts the - files and asks before analysing. Writing needs a second confirmation on the complete write - plan, by typing the number of documents to write. Folders such as a drive root or the home - folder, or more than 10,000 files, get a stronger warning and the number of files must be - typed. From the context menu the same confirmations appear in a window. In scripts only the - analysis of an ordinary folder, its report and `--plan` (for `extract`, on an ordinary - folder) run: extracting, undoing and - uninstalling need a person to confirm. -- **Originals are read-only.** They are never modified, moved or renamed. -- **Nothing is ever overwritten.** Every file is created with an exclusive "create new" - operation, so the operating system itself refuses to overwrite. Name clashes become - `x (1).pdf`. -- **Nothing is written outside the chosen folder.** File names taken from envelopes are made - valid on Windows, macOS and Linux at once: no forbidden characters, no reserved names, no - clashes that differ only in letter case or Unicode form. -- **Undo.** Every written file is logged with its SHA-256. `signspector undo` removes only - files that are still identical to what SignSpector wrote. -- **Clean uninstall.** `signspector uninstall` removes only what SignSpector installed, and - never user data. - -## Accessibility - -Accessibility is a requirement, not an afterthought. The targets are **EN 301 549**, the -standard referenced by the Italian accessibility law (Legge 4/2004) and the AgID guidelines, -and **WCAG 2.2 level AA** for the HTML report: +## Can it damage my documents? + +No. Signed documents are often the only official copy, so SignSpector is built so that it +cannot damage them: + +- Without an explicit `extract`, it writes nothing except the report. +- After you choose a folder, it only counts the files and asks before analysing them. +- Writing needs a second confirmation on the complete write plan: you type the number of + documents to write. +- A risky folder (a drive root, the home folder, more than 10,000 files) gets a stronger + warning, and you type the number of files. +- From the context menu, the same confirmations appear in a window. +- In scripts, only these run: the analysis of an ordinary folder and its report, and `--plan` + (for `extract`, on an ordinary folder). Extracting, undoing and uninstalling need a person to + confirm. +- Originals are read-only. They are never modified, moved or renamed. +- Nothing is ever overwritten. Every file is created with an exclusive "create new" operation, + so the operating system itself refuses to overwrite. A name clash becomes `x (1).pdf`. +- Nothing is written outside the chosen folder. File names taken from envelopes are made valid + on Windows, macOS and Linux at once: no forbidden characters, no reserved names, no clashes + that differ only in letter case or Unicode form. +- Every written file is logged with its SHA-256. `signspector undo` removes only the files that + are still identical to what SignSpector wrote. +- `signspector uninstall` removes only what SignSpector installed, and never user data. + +## Is it accessible? + +Yes, by requirement. The targets are EN 301 549, the standard referenced by the Italian +accessibility law (Legge 4/2004) and the AgID guidelines, and WCAG 2.2 level AA for the HTML +report: - no information conveyed by colour or symbols alone; - `NO_COLOR`, `--no-color` and a `--plain` mode for screen readers; - no time limits on prompts; - a semantic, keyboard-operable report that works without JavaScript. -## Languages +## Which languages does it speak? -The interface speaks the operating system's language, or the one chosen with `--lang`. The -report is written in the same language, or in another one with `--report-lang`. English and Italian come first; more languages can be -added without code changes. +The operating system's language, or the one chosen with `--lang`. The report uses the same +language, or another one chosen with `--report-lang`. English and Italian come first. More +languages can be added without code changes. -## Platforms +## Which platforms does it run on? -One self-contained executable per platform, written in pure Rust (no OpenSSL, no runtime to -install): +Windows, macOS and Linux, with one self-contained executable per platform. It is written in +pure Rust: no OpenSSL, no runtime to install. | Platform | Package | |---|---| @@ -84,10 +86,10 @@ install): | macOS (Apple Silicon and Intel) | universal binary | | Linux x86_64 | `.deb`, `.rpm`, static `.tar.gz` | -Context-menu integration is planned for Explorer, Finder (Quick Actions), Nautilus and Dolphin, -and needs no administrator rights. +We plan context-menu entries for Explorer, Finder (Quick Actions), Nautilus and Dolphin. They +need no administrator rights. -## Planned usage +## How will it be used? ```sh signspector check ... # analyse and write a report in each folder (default) @@ -99,38 +101,41 @@ signspector uninstall # remove everything SignSpector installed ``` Every command that changes something shows its plan first and acts only after you confirm: -`extract` asks you to type the number of documents it will write; `undo`, `install-menu`, -`uninstall-menu` and `uninstall` ask a yes/no question, with No as the default. In scripts they -refuse; `--plan` -shows the plan and stops. From the context menu the same confirmations appear in a window, with -the focus on Cancel. There is no `--apply`, `--yes` or `--expect`. -## Building from source +- `extract` asks you to type the number of documents it will write. +- `undo`, `install-menu`, `uninstall-menu` and `uninstall` ask a yes/no question. The default + is No. +- In scripts they refuse. `--plan` shows the plan and stops. +- From the context menu, the same confirmations appear in a window, with the focus on Cancel. -Requires [rustup](https://rustup.rs). The toolchain version is pinned in `rust-toolchain.toml`. +There is no `--apply`, `--yes` or `--expect`. + +## How do I build it? + +Install [rustup](https://rustup.rs). The toolchain version is pinned in `rust-toolchain.toml`. ```sh cargo build --release cargo nextest run # tests (cargo install cargo-nextest) ``` -Cross builds for all targets from macOS (mingw-w64, zig, cargo-zigbuild) are described in -[docs/design.md](docs/design.md#building-on-the-mac). +[docs/design.md](docs/design.md#building-on-the-mac) describes the cross builds for all +targets from macOS (mingw-w64, zig, cargo-zigbuild). -## Development +## How is it developed? -- **Test-driven:** every behaviour starts as a failing test. -- **Independent review:** each step is reviewed by a second AI model, different from the one - that wrote the code, so that the review is not anchored on the author's reasoning. -- **Coherence audits** every five commits: requirements, tests, code and documentation are - checked against each other. Every reference is verified to exist, and unfinished work is - surfaced. -- **Privacy:** this repository is public, so test data is synthetic only. Real signed documents - contain personal data and never enter the repository; local git hooks (pre-commit, - commit-msg, pre-push) refuse it. After cloning: `git config core.hooksPath .githooks`. +- Test first: every behaviour starts as a failing test. +- Every step is reviewed by a second AI model, different from the one that wrote the code, so + that the review is not anchored on the author's reasoning. +- Every five commits, a coherence audit checks requirements, tests, code and documentation + against each other. It verifies that every reference exists, and it surfaces unfinished work. +- This repository is public, so test data is synthetic only. Real signed documents contain + personal data and never enter the repository: local git hooks (pre-commit, commit-msg, + pre-push) refuse it. After cloning, run `git config core.hooksPath .githooks`. Requirements and design are in [docs/design.md](docs/design.md), the order of work in -[docs/roadmap.md](docs/roadmap.md), contributor rules in [CLAUDE.md](CLAUDE.md). +[docs/roadmap.md](docs/roadmap.md), contributor rules in [CLAUDE.md](CLAUDE.md). Every text +follows the writing guide, [docs/writing.md](docs/writing.md). ## License diff --git a/docs/roadmap.md b/docs/roadmap.md index 50d1ae6..33c8e3f 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -57,6 +57,11 @@ The order follows two ideas: commit statuses: decide and test; the negative RED CHECKS case does not assert that the GitHub section ran, and its stub has a dead first line; - report-mode tests pass if the script prints nothing in that section. + - `audit-status.sh`, "Rust" section: five review rounds (PR #3) added a test for each + breakage they found, and none found a bug. The owner decided (2026-11-23) to stop the rounds + there: a later breakage of this section that shows no bug is listed on the PR and here, not + closed with another round. Known limit: `rustup check` has no time limit; it runs only in + report mode, after the hook gates, so no commit or push waits on it. - from the targeted review of the third-round fixes: - the first push to a new remote scans the whole history and stops on the accepted exception `cd3620d` (CLAUDE.md): encode the exception if a second remote is ever added; From 40e2d4ca1220cf91146f4c25be744caed69ec53f Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 12:44:38 +0100 Subject: [PATCH 12/36] Fix two wrong facts in the README and roadmap (review of d323e74) The README listed only three kinds of risky folder. R28 also names Desktop, Documents, system folders and network share roots; the README now lists them all, and counts envelopes, as R28 does. The script rule now matches R30: it names `check --plan` and the `--plan` lists of undo, the menus and uninstall. docs/roadmap.md said the five review rounds on the "Rust" section found no bug. The first two found minor bugs; only the last three found none. CLAUDE.md now points to this exception from the rule that every unnoticed breakage gets a test. Smaller README fixes: "automatically" restored for the choice of the trusted list; no new "every day" claim; the intro is not repeated; the platform heading says "will"; shorter sentences; the long link line wrapped. Two tests for a pin with an empty first or middle part; each fails when its rule is broken on a copy. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 3 ++- README.md | 42 +++++++++++++++++++++-------------------- docs/roadmap.md | 12 +++++++----- scripts/test-scripts.sh | 4 ++++ 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 35ae699..8866361 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -24,7 +24,8 @@ No exception for "infrastructure". 4. **Proof**: every PR description quotes the red output (the failing test run) and the green one. Rules that protect (scripts under `scripts/`, safety code) are also checked by breaking each rule on a copy and seeing at least one test fail; a rule nobody's test notices gets a - test. + test. One exception, decided by the owner: the "Rust" section of `audit-status.sh` (see + `docs/roadmap.md`, 0.5). 5. **Independent review**: a **newly started** `fable-reviewer` agent (different model) for every review, briefed only with the scope and where the requirements are: never resumed, never given my conclusions or earlier findings. Fix its findings or explain to the user why diff --git a/README.md b/README.md index 49df040..e8e7ca7 100644 --- a/README.md +++ b/README.md @@ -3,17 +3,16 @@ SignSpector checks signed and time-stamped files (`.p7m`, `.p7s`, `.tsd`, `.m7m`) in bulk. It verifies CAdES signatures and time stamps against the European trusted lists (Italy, Romania, France and every other EU/EEA country). It writes an accessible HTML report and, on request, -extracts the signed documents safely. It runs on Windows, macOS and Linux. +extracts the signed documents safely. It is built for Windows, macOS and Linux. > Status: early development. Nothing is usable yet. We build the project step by step, test > first. The [roadmap](docs/roadmap.md) shows what is done and what comes next. ## What does it do? -Point SignSpector at a folder. It finds every signed or time-stamped file there, verifies it, -and writes a report. Offices receive and archive such files every day: CAdES `.p7m`, detached -`.p7s`, time-stamped `.tsd` and `.m7m`, often nested several layers deep. Opening them one by -one is slow and tells little about the signatures. +It saves opening signed files one by one. Offices receive and archive CAdES `.p7m`, detached +`.p7s` and time-stamped `.tsd` and `.m7m` files, often nested several layers deep. Opening +them one by one is slow and tells little about the signatures. For each folder, SignSpector: @@ -23,8 +22,9 @@ For each folder, SignSpector: - verifies each signature (RSA, RSA-PSS, ECDSA; SHA-1/2) and the signer's certificate (validity, key usage, qualified status); - follows the chain up to a CA of the national trusted list of the certifier's country. It - reaches that list through the [EU List of Trusted Lists](https://ec.europa.eu/tools/lotl/eu-lotl.xml) - and chooses it from the signatures found; + reaches that list through the + [EU List of Trusted Lists](https://ec.europa.eu/tools/lotl/eu-lotl.xml) and chooses it + automatically from the signatures found; - checks whether the certificate was revoked, from data in the signature or the CA's revocation list: not one query per signature; - verifies countersignatures and RFC 3161 time stamps; @@ -39,15 +39,17 @@ No. Signed documents are often the only official copy, so SignSpector is built s cannot damage them: - Without an explicit `extract`, it writes nothing except the report. -- After you choose a folder, it only counts the files and asks before analysing them. +- After you choose a folder, it only counts the signed files (envelopes) and asks before + analysing them. - Writing needs a second confirmation on the complete write plan: you type the number of documents to write. -- A risky folder (a drive root, the home folder, more than 10,000 files) gets a stronger - warning, and you type the number of files. +- A risky folder gets a stronger warning, and you type the number of envelopes. Risky folders + are: the root of a drive or volume, the home folder, Desktop, Documents, system folders, + network share roots, and any folder with more than 10,000 envelopes. - From the context menu, the same confirmations appear in a window. -- In scripts, only these run: the analysis of an ordinary folder and its report, and `--plan` - (for `extract`, on an ordinary folder). Extracting, undoing and uninstalling need a person to - confirm. +- In scripts, only these run: `check` on an ordinary folder, `check --plan`, `extract --plan` + on an ordinary folder, and the `--plan` lists of `undo`, the menu commands and `uninstall`. + Everything else stops and says that a person must confirm. - Originals are read-only. They are never modified, moved or renamed. - Nothing is ever overwritten. Every file is created with an exclusive "create new" operation, so the operating system itself refuses to overwrite. A name clash becomes `x (1).pdf`. @@ -60,9 +62,9 @@ cannot damage them: ## Is it accessible? -Yes, by requirement. The targets are EN 301 549, the standard referenced by the Italian -accessibility law (Legge 4/2004) and the AgID guidelines, and WCAG 2.2 level AA for the HTML -report: +Yes, by requirement. The target is EN 301 549, the standard referenced by the Italian +accessibility law (Legge 4/2004) and the AgID guidelines. The HTML report also targets WCAG 2.2 +level AA: - no information conveyed by colour or symbols alone; - `NO_COLOR`, `--no-color` and a `--plain` mode for screen readers; @@ -75,7 +77,7 @@ The operating system's language, or the one chosen with `--lang`. The report use language, or another one chosen with `--report-lang`. English and Italian come first. More languages can be added without code changes. -## Which platforms does it run on? +## Which platforms will it run on? Windows, macOS and Linux, with one self-contained executable per platform. It is written in pure Rust: no OpenSSL, no runtime to install. @@ -105,7 +107,7 @@ Every command that changes something shows its plan first and acts only after yo - `extract` asks you to type the number of documents it will write. - `undo`, `install-menu`, `uninstall-menu` and `uninstall` ask a yes/no question. The default is No. -- In scripts they refuse. `--plan` shows the plan and stops. +- In scripts, these commands refuse. `--plan` shows the plan and stops. - From the context menu, the same confirmations appear in a window, with the focus on Cancel. There is no `--apply`, `--yes` or `--expect`. @@ -125,8 +127,8 @@ targets from macOS (mingw-w64, zig, cargo-zigbuild). ## How is it developed? - Test first: every behaviour starts as a failing test. -- Every step is reviewed by a second AI model, different from the one that wrote the code, so - that the review is not anchored on the author's reasoning. +- A second AI model reviews every step. It is not the model that wrote the code, so its review + is not anchored on the author's reasoning. - Every five commits, a coherence audit checks requirements, tests, code and documentation against each other. It verifies that every reference exists, and it surfaces unfinished work. - This repository is public, so test data is synthetic only. Real signed documents contain diff --git a/docs/roadmap.md b/docs/roadmap.md index 33c8e3f..a029745 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -57,11 +57,13 @@ The order follows two ideas: commit statuses: decide and test; the negative RED CHECKS case does not assert that the GitHub section ran, and its stub has a dead first line; - report-mode tests pass if the script prints nothing in that section. - - `audit-status.sh`, "Rust" section: five review rounds (PR #3) added a test for each - breakage they found, and none found a bug. The owner decided (2026-11-23) to stop the rounds - there: a later breakage of this section that shows no bug is listed on the PR and here, not - closed with another round. Known limit: `rustup check` has no time limit; it runs only in - report mode, after the hook gates, so no commit or push waits on it. + - `audit-status.sh`, "Rust" section: five review rounds on PR #3. The reviews of 2557e7f and + 1ac9d1d found minor bugs, fixed with tests in 1ac9d1d and c3f070e. The reviews of c3f070e, + 1363b18 and fb41029 found no bug, only breakages no test noticed. The owner decided + (2026-11-23) to stop the rounds there. A later breakage of this section that shows no bug + is listed on the PR and here, not closed with another round. Known limit: `rustup check` + has no time limit. It runs only in report mode, after the hook gates, so no commit or push + waits on it. - from the targeted review of the third-round fixes: - the first push to a new remote scans the whole history and stops on the accepted exception `cd3620d` (CLAUDE.md): encode the exception if a second remote is ever added; diff --git a/scripts/test-scripts.sh b/scripts/test-scripts.sh index d3eb11a..52265f4 100755 --- a/scripts/test-scripts.sh +++ b/scripts/test-scripts.sh @@ -458,6 +458,10 @@ PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned # A pin with an empty part is not x.y.z. printf '[toolchain]\nchannel = "1.100."\n' > rust-toolchain.toml PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100. is not x.y.z; see rust-toolchain.toml"; expect "report: pin with an empty part said" 0 $? +printf '[toolchain]\nchannel = "1..0"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1..0 is not x.y.z; see rust-toolchain.toml"; expect "report: pin with an empty middle part said" 0 $? +printf '[toolchain]\nchannel = ".100.0"\n' > rust-toolchain.toml +PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust .100.0 is not x.y.z; see rust-toolchain.toml"; expect "report: pin with an empty first part said" 0 $? # A pin with a fourth number is not x.y.z. printf '[toolchain]\nchannel = "1.100.0.1"\n' > rust-toolchain.toml PATH="$work/rustupshim:$PATH" sh scripts/audit-status.sh 2>&1 | grep -qx "pinned Rust 1.100.0.1 is not x.y.z; see rust-toolchain.toml"; expect "report: four-part pin said" 0 $? From 5ba364e1bcdd9213c0f847beff39b944d2b825b3 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 13:12:43 +0100 Subject: [PATCH 13/36] Say what check writes besides the report (owner's decision); review of 40e2d4c R16 said that `check` writes nothing but the report, but R44, R47 and R49 keep a cache of trusted lists and revocation lists, and R14 and R15 let the user name the report and JSON paths. The owner decided to keep that behaviour and state it: `check` writes no document, only the report and the tool's cache. R16, the overview in docs/design.md, CLAUDE.md, the reviewer prompt and the README now say so. The README limits "never outside the chosen folder" to extracted documents, as R31 does. Other fixes from the review: - CLAUDE.md: the exception covers only breakages of the "Rust" section that show no bug. - docs/roadmap.md 0.5: names PR #3; says which minor bug is left (no time limit on rustup check); lists the three breakages found by this review. - README: the first sentence answers "What does it do?"; "envelopes (signed or time-stamped files)"; the 10,000 limit is on all chosen folders; hidden folders and symbolic links are skipped and listed (R2); the two long safety sentences are lists. Co-Authored-By: Claude Opus 5.5 --- .claude/agents/fable-reviewer.md | 8 +++---- CLAUDE.md | 7 +++--- README.md | 39 ++++++++++++++++++++------------ docs/design.md | 10 ++++---- docs/roadmap.md | 12 ++++++---- 5 files changed, 47 insertions(+), 29 deletions(-) diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index 33ff36a..2616e84 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -25,10 +25,10 @@ Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). wrong cryptographic checks (digest compared to the wrong bytes, signed attributes not re-encoded as SET, signature algorithm not matched to the key, time checked against the wrong reference), anything that could report a forged or invalid file as valid. -3. **Safety rules.** Originals are never written, moved or renamed; nothing is written except - the report without `extract` and its typed confirmation; existing files are never - overwritten; no panic on malformed input (no `unwrap`/`expect`/indexing on untrusted data - outside tests); no PowerShell; no OpenSSL or C dependencies. Confirmation and write safety +3. **Safety rules.** Originals are never written, moved or renamed; without `extract` and its + typed confirmation nothing is written except the report and the tool's cache (R16); + existing files are never overwritten; no panic on malformed input (no + `unwrap`/`expect`/indexing on untrusted data outside tests); no PowerShell; no OpenSSL or C dependencies. Confirmation and write safety (R28–R34 in `docs/design.md`) is a fixed point of every review: look for any path that processes without the first confirmation, writes without a `ConfirmedPlan`, opens a file for writing without `create_new`, can resolve outside the selected folder, treats a non-terminal diff --git a/CLAUDE.md b/CLAUDE.md index 8866361..355cf2a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -24,8 +24,8 @@ No exception for "infrastructure". 4. **Proof**: every PR description quotes the red output (the failing test run) and the green one. Rules that protect (scripts under `scripts/`, safety code) are also checked by breaking each rule on a copy and seeing at least one test fail; a rule nobody's test notices gets a - test. One exception, decided by the owner: the "Rust" section of `audit-status.sh` (see - `docs/roadmap.md`, 0.5). + test. One exception, decided by the owner: in the "Rust" section of `audit-status.sh`, a + breakage that shows no bug is listed, not tested (`docs/roadmap.md`, 0.5). 5. **Independent review**: a **newly started** `fable-reviewer` agent (different model) for every review, briefed only with the scope and where the requirements are: never resumed, never given my conclusions or earlier findings. Fix its findings or explain to the user why @@ -138,7 +138,8 @@ in the history even if deleted later. Before every commit and push: (`--lang`, see R27 in `docs/design.md`). Source strings are English; every user-facing text goes through the translation layer, never hard-coded, and each new text gets its Italian translation in the same change. -- `check` writes nothing but the report. **There is no `--apply`, `--yes` or `--expect`.** +- `check` writes no document: only the report and the tool's cache of trusted lists and CRLs + (R16). **There is no `--apply`, `--yes` or `--expect`.** Every command that changes files or the system shows the exact plan first. The number is typed only for files found in a folder (risky folder, R28; documents to write, R29); `undo`, menus and `uninstall` ask a yes/no question, default No, answers in words (R19, R35). From diff --git a/README.md b/README.md index e8e7ca7..8f67d9c 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,15 @@ extracts the signed documents safely. It is built for Windows, macOS and Linux. ## What does it do? -It saves opening signed files one by one. Offices receive and archive CAdES `.p7m`, detached -`.p7s` and time-stamped `.tsd` and `.m7m` files, often nested several layers deep. Opening -them one by one is slow and tells little about the signatures. +It checks every signed or time-stamped file in a folder and writes one report. Offices receive +and archive CAdES `.p7m`, detached `.p7s` and time-stamped `.tsd` and `.m7m` files, often +nested several layers deep. Opening them one by one is slow and tells little about the +signatures. For each folder, SignSpector: -- finds every signed or time-stamped file in it and its subfolders; +- finds every signed or time-stamped file in it and its subfolders (hidden folders and + symbolic links are skipped and listed in the report); - opens every layer: BER/DER envelopes (including indefinite lengths), base64 envelopes, nested signatures, RFC 5544 time-stamped data; - verifies each signature (RSA, RSA-PSS, ECDSA; SHA-1/2) and the signer's certificate @@ -38,24 +40,33 @@ For each folder, SignSpector: No. Signed documents are often the only official copy, so SignSpector is built so that it cannot damage them: -- Without an explicit `extract`, it writes nothing except the report. -- After you choose a folder, it only counts the signed files (envelopes) and asks before - analysing them. +- Without an explicit `extract`, it writes no document. It writes only the report (in the + folder, or at the `--report` or `--json` path you name) and its own cache of trusted lists + and revocation lists. +- After you choose a folder, it only counts the envelopes (signed or time-stamped files) and + asks before analysing them. - Writing needs a second confirmation on the complete write plan: you type the number of documents to write. - A risky folder gets a stronger warning, and you type the number of envelopes. Risky folders - are: the root of a drive or volume, the home folder, Desktop, Documents, system folders, - network share roots, and any folder with more than 10,000 envelopes. + are: + - the root of a drive or volume; + - the home folder, Desktop and Documents; + - system folders; + - network share roots; + - more than 10,000 envelopes in all the folders chosen. - From the context menu, the same confirmations appear in a window. -- In scripts, only these run: `check` on an ordinary folder, `check --plan`, `extract --plan` - on an ordinary folder, and the `--plan` lists of `undo`, the menu commands and `uninstall`. +- In scripts, only these run: + - `check` on an ordinary folder, and `check --plan`; + - `extract --plan` on an ordinary folder; + - the `--plan` lists of `undo`, the menu commands and `uninstall`. + Everything else stops and says that a person must confirm. - Originals are read-only. They are never modified, moved or renamed. - Nothing is ever overwritten. Every file is created with an exclusive "create new" operation, so the operating system itself refuses to overwrite. A name clash becomes `x (1).pdf`. -- Nothing is written outside the chosen folder. File names taken from envelopes are made valid - on Windows, macOS and Linux at once: no forbidden characters, no reserved names, no clashes - that differ only in letter case or Unicode form. +- Extracted documents are never written outside the chosen folder. File names taken from envelopes + are made valid on Windows, macOS and Linux at once: no forbidden characters, no reserved names, + no clashes that differ only in letter case or Unicode form. - Every written file is logged with its SHA-256. `signspector undo` removes only the files that are still identical to what SignSpector wrote. - `signspector uninstall` removes only what SignSpector installed, and never user data. diff --git a/docs/design.md b/docs/design.md index 8b10a3c..fcd029f 100644 --- a/docs/design.md +++ b/docs/design.md @@ -58,7 +58,9 @@ beside the originals, ready to open. - *To decide*: layout and content of the report (start from the old tool's report as a sketch?). ### Extracting -- R16. `check` (the default) writes nothing but the report. `extract` writes the signed +- R16. `check` (the default) writes no document: only the report (in each folder, or at the + `--report` and `--json` paths the user names, R14, R15) and the tool's own cache of trusted + lists and revocation lists (R44, R47, R49). `extract` writes the signed documents beside the originals (`Relazione.pdf.p7m` -> `Relazione.pdf`) after the two confirmations of R28 and R29: typing the number of documents is the safeguard. - R17. Never overwrite: same content already there -> nothing to do; different content -> @@ -104,7 +106,7 @@ beside the originals, ready to open. refuses a risky one, like `check`. - For the other commands it lists the items, with no question, also from a script. - `check` changes nothing but the report. + `check` writes no document: only the report and the tool's cache (R16). Options: `--open`, `--report`, `--no-report`, `--report-lang `, `--json `, `--threads`, `--offline`, `--trust-lists `, `--trust-list `, `--lang `, `--interactive`, `--plain`, `--no-color`, `--plan`. Help translated (R27). @@ -141,8 +143,8 @@ beside the originals, ready to open. Nothing is ever processed right after a person chooses a folder, and nothing is written without a second, separate confirmation. Writing never replaces an existing file. A folder named in a script has no person to ask: an ordinary folder is analysed (`check` writes only the -report), a risky one is refused (only counted by `check --plan`), and nothing is written -(R30). +report and the tool's cache, R16), a risky one is refused (only counted by `check --plan`), +and nothing is written (R30). - R28. **Confirm before analysing.** After the folders are chosen the tool only counts (no envelope is opened) and asks, default No (Enter alone cancels): diff --git a/docs/roadmap.md b/docs/roadmap.md index a029745..8e00a2c 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -36,8 +36,8 @@ The order follows two ideas: sentences, code and commands verbatim. Rewrite README, design, roadmap, CLAUDE.md and the agent prompts with it; comment in `rust-toolchain.toml` (targets and R25, how to update the pinned version); session report line when a newer stable Rust exists. -- [ ] 0.5 Remaining gaps in the rule-script tests, found by the reviews of PR #1 and PR #2 and - accepted as known limits for now (each needs a test before the code changes): +- [ ] 0.5 Remaining gaps in the rule-script tests, found by the reviews of PR #1, PR #2 and + PR #3 and accepted as known limits for now (each needs a test before the code changes): - `check-public.sh`: failures of `git show`, `ls-tree`, `diff-tree` are not each tested; names of people, phone numbers, IPs, base64 content and branch names are not detected (header "Known limits"); @@ -58,12 +58,16 @@ The order follows two ideas: GitHub section ran, and its stub has a dead first line; - report-mode tests pass if the script prints nothing in that section. - `audit-status.sh`, "Rust" section: five review rounds on PR #3. The reviews of 2557e7f and - 1ac9d1d found minor bugs, fixed with tests in 1ac9d1d and c3f070e. The reviews of c3f070e, + 1ac9d1d found minor bugs. All but one were fixed in 1ac9d1d and c3f070e; the missing time + limit on `rustup check` is the one left (below). The reviews of c3f070e, 1363b18 and fb41029 found no bug, only breakages no test noticed. The owner decided (2026-11-23) to stop the rounds there. A later breakage of this section that shows no bug is listed on the PR and here, not closed with another round. Known limit: `rustup check` has no time limit. It runs only in report mode, after the hook gates, so no commit or push - waits on it. + waits on it. Breakages listed so far (review of 40e2d4c), each leaves all tests green: + - the first dot of the x.y.z check unescaped (`1x100.0` would pass); + - a single digit accepted for the major and patch numbers (`10.0.0` would be "not x.y.z"); + - the captured rustup version may start with a dot. - from the targeted review of the third-round fixes: - the first push to a new remote scans the whole history and stops on the accepted exception `cd3620d` (CLAUDE.md): encode the exception if a second remote is ever added; From f0cc4707ac9db4f03c004dd56c9f374ec78f65b4 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 13:23:48 +0100 Subject: [PATCH 14/36] Owner's decisions on risky folders, reports, --plan and preferences Decided by the owner on 2026-11-23: - A risky folder is one that holds more than 10,000 files of any kind, subfolders included. The number typed stays the envelopes, which the interface calls "files to process" (R28, R19, R34). - An existing report or JSON file is never replaced; the new one gets the next free name. Only the tool's own cache is refreshed in place (R16, R31). - --plan writes nothing, not even the report or the cache, and downloads nothing (R19, R34). - A preference is saved only by an explicit command; SignSpector keeps no log files (R27, R40). From the review of 5ba364e: - R16 lists what check writes; extraction at the interactive end of run (R20) is named as the one way a check run writes documents. - The ConfirmedPlan rule is for documents; create_new is for every file the tool writes outside its cache. CLAUDE.md, the reviewer prompt and README say the same. - "Plan first" names the exception of check from a script (R19, CLAUDE.md, README). - R34 gets tests for what check writes, a temporary cache folder in tests, and the 10,000-file rule. - README: "check" as subject; JSON as an extra output; a risky run, not a risky "folder of 10,000 envelopes"; extracted documents logged; every LOTL country; "->" as in the design. - docs/roadmap.md 0.5: the listed items are rule breakings, not defects. Co-Authored-By: Claude Opus 5.5 --- .claude/agents/fable-reviewer.md | 16 +++--- CLAUDE.md | 13 +++-- README.md | 47 +++++++++-------- docs/design.md | 86 +++++++++++++++++++------------- docs/roadmap.md | 15 +++--- 5 files changed, 104 insertions(+), 73 deletions(-) diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index 2616e84..78f0f71 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -25,13 +25,15 @@ Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). wrong cryptographic checks (digest compared to the wrong bytes, signed attributes not re-encoded as SET, signature algorithm not matched to the key, time checked against the wrong reference), anything that could report a forged or invalid file as valid. -3. **Safety rules.** Originals are never written, moved or renamed; without `extract` and its - typed confirmation nothing is written except the report and the tool's cache (R16); - existing files are never overwritten; no panic on malformed input (no - `unwrap`/`expect`/indexing on untrusted data outside tests); no PowerShell; no OpenSSL or C dependencies. Confirmation and write safety - (R28–R34 in `docs/design.md`) is a fixed point of every review: look for any path that - processes without the first confirmation, writes without a `ConfirmedPlan`, opens a file for - writing without `create_new`, can resolve outside the selected folder, treats a non-terminal +3. **Safety rules.** Originals are never written, moved or renamed; `check` writes no document, + only the report and the tool's cache (R16); documents need `extract` and its typed + confirmation; existing files are never overwritten, not even a report; no panic on + malformed input (no `unwrap`/`expect`/indexing on untrusted data outside tests); no + PowerShell; no OpenSSL or C dependencies. Confirmation and write safety (R28–R34 in + `docs/design.md`) is a fixed point of every review: look for any path that processes + without the first confirmation, writes a document without a `ConfirmedPlan`, opens any file + for writing (the report too) without `create_new`, can write a document outside the + selected folder, lets `--plan` write or download anything, treats a non-terminal input as a yes, confirms anything from a script (only `check` on an ordinary folder, `check --plan`, `extract --plan` on an ordinary folder, and the `--plan` lists of `undo`, the menus and `uninstall` run there), judges time from the signer's claimed signing time, skips the diff --git a/CLAUDE.md b/CLAUDE.md index 355cf2a..c6c0f5d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -140,8 +140,10 @@ in the history even if deleted later. Before every commit and push: translation in the same change. - `check` writes no document: only the report and the tool's cache of trusted lists and CRLs (R16). **There is no `--apply`, `--yes` or `--expect`.** - Every command that changes files or the system shows the exact plan first. The number is - typed only for files found in a folder (risky folder, R28; documents to write, R29); `undo`, + Every command that changes files or the system shows the exact plan first (except the report + and cache of `check`, R16). The number is + typed only for files found in a folder (files to process in a risky folder, R28; documents + to write, R29); `undo`, menus and `uninstall` ask a yes/no question, default No, answers in words (R19, R35). From the context menu the same confirmations come in a native dialog, focus on Cancel; from a script they refuse (R30); `--plan` shows the plan and stops. These rules are for the tool; the @@ -154,9 +156,10 @@ in the history even if deleted later. Before every commit and push: confirmation (R28; from a script an ordinary folder is analysed without a question, a risky one is refused); writing needs a second confirmation on the full write plan, with the number typed (R29); no implicit yes, ever (R30: terminal, dialog from the context menu, refusal in - scripts). Writing only through a `ConfirmedPlan`, files created with `create_new`, never - outside the chosen folder (R31). File names valid on - Windows, macOS and Linux at once (R32). Any change here needs the tests of R34. + scripts). Documents are written only through a `ConfirmedPlan` and never outside the chosen + folder; every file the tool writes, the report too, is created with `create_new` (R31). + File names valid on Windows, macOS and Linux at once (R32). Any change here needs the tests + of R34. - **Accessibility is a requirement, not a polish step** (EN 301 549; WCAG 2.2 AA for the report; R35–R39). Never convey information by colour or symbols alone; honour `NO_COLOR`, `--no-color`, `--plain`; no spinners or rapid line rewriting; no time limits on prompts; diff --git a/README.md b/README.md index 8f67d9c..c170362 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ SignSpector checks signed and time-stamped files (`.p7m`, `.p7s`, `.tsd`, `.m7m`) in bulk. It verifies CAdES signatures and time stamps against the European trusted lists (Italy, Romania, -France and every other EU/EEA country). It writes an accessible HTML report and, on request, -extracts the signed documents safely. It is built for Windows, macOS and Linux. +France and every other country on the EU List of Trusted Lists). It writes an accessible HTML +report and, on request, extracts the signed documents safely. It is built for Windows, macOS +and Linux. > Status: early development. Nothing is usable yet. We build the project step by step, test > first. The [roadmap](docs/roadmap.md) shows what is done and what comes next. @@ -33,27 +34,28 @@ For each folder, SignSpector: - reports the results on the console and in a self-contained HTML report (and JSON for scripts); - extracts the signed documents beside the originals, only on request: - `Relazione.pdf.p7m` → `Relazione.pdf`. + `Relazione.pdf.p7m` -> `Relazione.pdf`. ## Can it damage my documents? No. Signed documents are often the only official copy, so SignSpector is built so that it cannot damage them: -- Without an explicit `extract`, it writes no document. It writes only the report (in the - folder, or at the `--report` or `--json` path you name) and its own cache of trusted lists - and revocation lists. -- After you choose a folder, it only counts the envelopes (signed or time-stamped files) and - asks before analysing them. -- Writing needs a second confirmation on the complete write plan: you type the number of - documents to write. -- A risky folder gets a stronger warning, and you type the number of envelopes. Risky folders - are: +- `check` writes no document. It writes only the HTML report (in each folder, or at the + `--report` path you name), the JSON file of `--json`, and its own cache of trusted lists and + CRLs. Documents are written only by an extraction you ask for and confirm. +- After you choose a folder, it only counts the files to process (signed or time-stamped + files) and asks before analysing them. +- Writing documents needs a second confirmation on the complete write plan: you type the + number of documents to write. +- A risky run gets a stronger warning, and you type the number of files to process. A run is + risky when a chosen folder is: - the root of a drive or volume; - - the home folder, Desktop and Documents; - - system folders; - - network share roots; - - more than 10,000 envelopes in all the folders chosen. + - the home folder, Desktop or Documents; + - a system folder; + - a network share root; + - a folder that holds more than 10,000 files of any kind, subfolders included (counted over + all the folders chosen). - From the context menu, the same confirmations appear in a window. - In scripts, only these run: - `check` on an ordinary folder, and `check --plan`; @@ -62,13 +64,14 @@ cannot damage them: Everything else stops and says that a person must confirm. - Originals are read-only. They are never modified, moved or renamed. -- Nothing is ever overwritten. Every file is created with an exclusive "create new" operation, - so the operating system itself refuses to overwrite. A name clash becomes `x (1).pdf`. +- Nothing is ever overwritten, not even an earlier report. Every file is created with an + exclusive "create new" operation, so the operating system itself refuses to overwrite. A + name clash becomes `x (1).pdf`. Only the tool's own cache is refreshed in place. - Extracted documents are never written outside the chosen folder. File names taken from envelopes are made valid on Windows, macOS and Linux at once: no forbidden characters, no reserved names, no clashes that differ only in letter case or Unicode form. -- Every written file is logged with its SHA-256. `signspector undo` removes only the files that - are still identical to what SignSpector wrote. +- Every extracted document is logged in the report with its SHA-256. `signspector undo` + removes only the files that are still identical to what SignSpector wrote. - `signspector uninstall` removes only what SignSpector installed, and never user data. ## Is it accessible? @@ -113,7 +116,9 @@ signspector uninstall-menu # remove only the context-menu entries signspector uninstall # remove everything SignSpector installed ``` -Every command that changes something shows its plan first and acts only after you confirm: +Every command that changes something shows its plan first and acts only after you confirm. +The one exception is `check` on an ordinary folder from a script, which writes its report and +the cache without a question. - `extract` asks you to type the number of documents it will write. - `undo`, `install-menu`, `uninstall-menu` and `uninstall` ask a yes/no question. The default diff --git a/docs/design.md b/docs/design.md index fcd029f..cc00eb8 100644 --- a/docs/design.md +++ b/docs/design.md @@ -58,9 +58,16 @@ beside the originals, ready to open. - *To decide*: layout and content of the report (start from the old tool's report as a sketch?). ### Extracting -- R16. `check` (the default) writes no document: only the report (in each folder, or at the - `--report` and `--json` paths the user names, R14, R15) and the tool's own cache of trusted - lists and revocation lists (R44, R47, R49). `extract` writes the signed +- R16. `check` (the default) writes no document. It writes only: + - the HTML report, in each folder or at `--report ` (none with `--no-report`, R14); + - the JSON file of `--json ` (R15); + - the tool's own cache of trusted lists and CRLs (R44, R47, R49). + + The report and the JSON file never replace an existing file: they are created with + `create_new`, and a name already taken gets the next free name (`(1)`, `(2)`...), as in R17. + Only files inside the tool's cache folder are ever replaced. One exception writes documents + in a `check` run: extraction chosen at the interactive end of run (R20), through R29. + `extract` writes the signed documents beside the originals (`Relazione.pdf.p7m` -> `Relazione.pdf`) after the two confirmations of R28 and R29: typing the number of documents is the safeguard. - R17. Never overwrite: same content already there -> nothing to do; different content -> @@ -70,9 +77,10 @@ beside the originals, ready to open. ### Using it - R19. Command line. Commands: `check ...` (default), `extract ...`, `undo `, - `install-menu`, `uninstall-menu`, `uninstall`. **There is no `--apply`, `--yes` or - `--expect`.** Every command that changes files or the system shows the exact plan first and - acts only after a person confirms. Where the person is decides how (R30): + `install-menu`, `uninstall-menu`, `uninstall`. **There is no `--apply`, `--yes` or `--expect`.** + Every command that changes files or the system shows the exact plan first and acts only after a + person confirms. The one exception is what `check` writes on an ordinary folder from a script: + the report and the cache, with no question (R16, R30). Where the person is decides how (R30): - **at a terminal**: before analysing, a yes/no question (R28); for files found in a folder the user types the number (risky folder, R28; documents to write, R29); `undo`, `install-menu`, `uninstall-menu`, `uninstall` change only what the tool itself made and @@ -85,7 +93,7 @@ beside the originals, ready to open. `check` and `extract` take one or more folders (several can be selected in the file manager). They are counted and confirmed together: one summary with a row per folder (path and number of files to process) and the total, one question for all. The number typed is the total. A - single risky folder makes the whole run risky, and the 10,000-envelope limit applies to the + single risky folder makes the whole run risky, and the 10,000-file limit applies to the total (R28). A folder with no envelopes is shown with 0; if all are empty the run stops. The same folder given twice (also spelt differently: letter case, a symbolic link, a trailing slash), or a folder inside another selected one, is counted once, under the outer @@ -98,7 +106,8 @@ beside the originals, ready to open. desktop session), `--interactive` refuses with exit code 2, like a script. `--plan` shows what the command would do and stops before doing it. It never writes - anything, not even the report. + anything, not even the report or the cache, and downloads nothing: it uses the embedded + lists and those already in the cache, and says which lists a real run would download. - `check --plan` only counts (R28; no envelope is opened) and prints the summary: no question, allowed everywhere, also from a script on a risky folder. - `extract --plan` builds the write plan of R29, which opens every envelope, so it asks the @@ -131,7 +140,8 @@ beside the originals, ready to open. ### Languages - R27. The interface (console messages, `--help`, HTML report, JSON field values meant for people, user guide) is translated. Language = the one chosen by the user (`--lang it`, - or a saved preference), otherwise the operating system's language, otherwise English. + or a preference saved by an explicit command; `check` and `extract` never save one), + otherwise the operating system's language, otherwise English. Source language English; first translation Italian; more can be added without code changes. - *To decide*: translation mechanism (e.g. Fluent `.ftl` files embedded in the executable, or `rust-i18n`), OS language detection (`sys-locale`), where the preference is saved, how @@ -140,20 +150,22 @@ beside the originals, ready to open. in another one (for example to send it to an office abroad). ### Confirmation and write safety -Nothing is ever processed right after a person chooses a folder, and nothing is written -without a second, separate confirmation. Writing never replaces an existing file. A folder -named in a script has no person to ask: an ordinary folder is analysed (`check` writes only the -report and the tool's cache, R16), a risky one is refused (only counted by `check --plan`), -and nothing is written (R30). +Nothing is ever processed right after a person chooses a folder, and no document is written +without a second, separate confirmation. Writing never replaces an existing file; only the +tool's own cache is refreshed in place (R16). A folder named in a script has no person to ask: +an ordinary folder is analysed (`check` writes only the report and the tool's cache, R16); a +risky one is refused, only counted by `check --plan`, and nothing is written (R30). - R28. **Confirm before analysing.** After the folders are chosen the tool only counts (no envelope is opened) and asks, default No (Enter alone cancels): - folder, number of envelopes, total size, number of subfolders, unreadable folders that will - be skipped. Zero envelopes: say so and stop. **Risky folder**: root of a drive or volume, - the user's home, Desktop, Documents, system folders (`C:\Windows`, `Program Files`, - `/System`, `/usr`, `/etc`...), network share roots, or **more than 10,000 envelopes**: a - stronger warning and the user must type the number of envelopes. Every path-based kind of - risky folder is judged on the path after resolving symbolic links. + folder, number of files to process (the envelopes, R1a), number of files of any kind, total + size, number of subfolders, unreadable folders that will be skipped. Zero envelopes: say so + and stop. The interface calls the envelopes "files to process". **Risky folder**: root of a + drive or volume, the user's home, Desktop, Documents, system folders (`C:\Windows`, + `Program Files`, `/System`, `/usr`, `/etc`...), network share roots, or a folder that holds + **more than 10,000 files of any kind**, subfolders included: a stronger warning and the user + must type the number of files to process (envelopes). Every path-based kind of risky folder + is judged on the path after resolving symbolic links. - R29. **Confirm before writing.** Extraction first builds the complete write plan and shows it: new documents, documents already present with identical content (not rewritten), documents saved under an alternative name `x (1).pdf`, and "existing files modified: 0" @@ -177,12 +189,13 @@ and nothing is written (R30). "Terminal" means both input and output are a terminal: with output redirected (`| tee log`, `> file`) the run counts as a script. - R31. **Never overwrite, never write outside.** - - In code, writing requires a `ConfirmedPlan` that only the confirmation step can build - (typestate): a path that writes without confirmation does not compile. Originals are held - in a read-only `Original` type that write functions do not accept. - - Every file is created with `OpenOptions::create_new(true)`: the OS refuses if the name - exists, even if the file appeared after the plan; then the next free name `(2)`, `(3)`... - is used. A partly written file (error, disk full) is removed, only if we created it. + - In code, writing a document requires a `ConfirmedPlan` that only the confirmation step can + build (typestate): a path that writes without confirmation does not compile. Originals are + held in a read-only `Original` type that write functions do not accept. + - Every file the tool writes outside its cache (documents, report, JSON) is created with + `OpenOptions::create_new(true)`: the OS refuses if the name exists, even if the file + appeared after the plan; then the next free name `(2)`, `(3)`... is used. A partly written + file (error, disk full) is removed, only if we created it. - Before writing, each original is re-checked against the analysis (size, mtime, SHA-256); if the folder changed, the plan is rebuilt and confirmed again. - Every target must stay inside the selected folder its envelope was found in, after @@ -205,7 +218,7 @@ and nothing is written (R30). APFS default are case-insensitive; APFS treats NFC/NFD as the same name), so two documents never compete for "names" that the file system sees as equal; - the original name, when changed, is shown in the report. -- R33. **Undo.** The report records every file written with its SHA-256. +- R33. **Undo.** The report records every document written with its SHA-256. `signspector undo ` removes only files written by SignSpector whose content still matches that hash; changed or missing files are listed and left alone; originals are never touched. It shows what it would remove and removes it after a yes/no question (R19); never @@ -221,7 +234,12 @@ and nothing is written (R30). `check --plan` anywhere, `extract --plan` on an ordinary folder and `--plan` of `undo`, the menus and `uninstall` run without a question; output redirected counts as a script; - `--interactive` with a terminal keeps the questions in the terminal; - - `--plan` writes nothing, not even the report; + - `--plan` writes nothing, not even the report or the cache, and downloads nothing; + - `check` adds only its report to the folder (snapshot); an existing report or JSON file is + not replaced, the new one gets the next free name; end-to-end tests point the cache to a + temporary folder, never the user's real one; + - risky folder: more than 10,000 files of any kind (subfolders included) is risky even with + few envelopes, and the number typed is the files to process; - time: a back-dated signing-time attribute changes no verdict; without a time stamp the report says "claimed, not proved" (R9); - yes/no question: Enter alone cancels, `y` on a pipe is refused, a number is not a yes; @@ -248,7 +266,7 @@ and nothing is written (R30). option or build flag that confirms. ### European trusted lists -Signatures may come from any EU/EEA country (Italy, Romania, France...). Trust is anchored in +Signatures may come from any country on the LOTL (Italy, Romania, France...). Trust is anchored in the EU **List of Trusted Lists** (LOTL, `https://ec.europa.eu/tools/lotl/eu-lotl.xml`, signed by the European Commission). It points to each national trusted list and names the certificates that sign it (checked 2026-11-22: LOTL no. 398, 43 pointers: EU-27, Iceland, @@ -358,11 +376,11 @@ public administration checks the applicable obligations (e.g. accessibility stat Windows high contrast. Results recorded in `docs/accessibility.md`. ### Uninstalling -- R40. **`signspector uninstall`** removes everything SignSpector added to the system, and - only that: context menu entries, the Windows "Installed apps" entry (R42), trust-list and CRL cache, - saved preferences, logs. Same rule as every command that changes something (R19): it shows - the exact list of what it would remove and removes it after a yes/no question; never from - a script (R30); accessible like the rest (R35). +- R40. **`signspector uninstall`** removes everything SignSpector added to the system, and only + that: context menu entries, the Windows "Installed apps" entry (R42), trust-list and CRL cache, + saved preferences (SignSpector keeps no log files). Same rule as every command that changes + something (R19): it shows the exact list of what it would remove and removes it after a yes/no + question; never from a script (R30); accessible like the rest (R35). - R41. **Only what we installed.** `install-menu` records every item it creates (path or registry key, plus a hash of the content) in a manifest in the SignSpector config folder; `uninstall` removes only manifest items that still match, reports changed or foreign items diff --git a/docs/roadmap.md b/docs/roadmap.md index 8e00a2c..1d16a55 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -61,13 +61,15 @@ The order follows two ideas: 1ac9d1d found minor bugs. All but one were fixed in 1ac9d1d and c3f070e; the missing time limit on `rustup check` is the one left (below). The reviews of c3f070e, 1363b18 and fb41029 found no bug, only breakages no test noticed. The owner decided - (2026-11-23) to stop the rounds there. A later breakage of this section that shows no bug + (2026-11-23) to stop the rounds there. A breakage of this section that shows no bug is listed on the PR and here, not closed with another round. Known limit: `rustup check` has no time limit. It runs only in report mode, after the hook gates, so no commit or push - waits on it. Breakages listed so far (review of 40e2d4c), each leaves all tests green: - - the first dot of the x.y.z check unescaped (`1x100.0` would pass); - - a single digit accepted for the major and patch numbers (`10.0.0` would be "not x.y.z"); - - the captured rustup version may start with a dot. + waits on it. The script is correct today; breaking these rules on a copy leaves all tests + green (review of 40e2d4c): + - unescaping the first dot of the x.y.z check (`1x100.0` would then pass); + - accepting only a single digit for the major and patch numbers (`10.0.0` would then be + "not x.y.z"); + - letting the captured rustup version start with a dot. - from the targeted review of the third-round fixes: - the first push to a new remote scans the whole history and stops on the accepted exception `cd3620d` (CLAUDE.md): encode the exception if a second remote is ever added; @@ -94,7 +96,8 @@ The order follows two ideas: the total; regular files only, symbolic links not followed and hidden folders skipped (both listed in the report), unreadable folders listed; count, total size, subfolders. Risky-folder detection (drive - roots, home, Desktop, Documents, system folders, network share roots, > 10,000 envelopes). + roots, home, Desktop, Documents, system folders, network share roots, > 10,000 files of any + kind, subfolders included). - [ ] 1.6 **Confirmation logic** (R28–R30): pure functions turning (counts, folder, terminal, dialog via `--interactive`, or script; `--plan`) into the question to ask and parsing the answer: typed count (R28 risky folder, From 20a420d57baeffdf8d23dd8b30f726442c8174b7 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 13:33:44 +0100 Subject: [PATCH 15/36] Owner's decisions on the second report, the count, the cache and preferences Decided by the owner on 2026-11-23, after the review of f0cc470: - An extraction chosen at the interactive end of a check run writes a second report beside the first, with the analysis and the documents written; undo uses that one (R20, R33). - The 10,000-file count covers the regular files of the folders the walk visits: not hidden folders, symbolic links or unreadable folders; overlaps count once (R28). - The cache is the system's standard cache folder; no option moves it. Tests move it only through the system's own variables. Only files with the fixed names the tool creates there are replaced (R47). - No preference is saved for now; the language comes from --lang or the system (R27, R40, R42). Other fixes from the review: - --plan names the lists to download only for extract --plan (R19, R45). - "No file replaced outside the cache" is scoped to check and extract, so the install manifest (R41) is not caught by it (R16, R31). - CLAUDE.md and the reviewer prompt state the cache exception, the script condition of the plan-first exception, the JSON file and the R20 path. - R34: the 10,000 boundary, extract --plan naming lists, --report on an existing file, --no-report, the R20 path, a foreign file in the cache. - The summary and the dialog show the any-kind count and why a run is risky. - One free-name rule ((1), (2)...); --no-report cited from R19; the README separates the total from the per-folder rule; roadmap 1.5 has both counts; "write log" becomes the record in the report; one term per thing in the README. Co-Authored-By: Claude Opus 5.5 --- .claude/agents/fable-reviewer.md | 31 ++++----- CLAUDE.md | 27 ++++---- README.md | 31 +++++---- docs/design.md | 106 ++++++++++++++++++------------- docs/roadmap.md | 17 +++-- 5 files changed, 118 insertions(+), 94 deletions(-) diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index 78f0f71..2d2e47c 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -26,21 +26,22 @@ Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). re-encoded as SET, signature algorithm not matched to the key, time checked against the wrong reference), anything that could report a forged or invalid file as valid. 3. **Safety rules.** Originals are never written, moved or renamed; `check` writes no document, - only the report and the tool's cache (R16); documents need `extract` and its typed - confirmation; existing files are never overwritten, not even a report; no panic on - malformed input (no `unwrap`/`expect`/indexing on untrusted data outside tests); no - PowerShell; no OpenSSL or C dependencies. Confirmation and write safety (R28–R34 in - `docs/design.md`) is a fixed point of every review: look for any path that processes - without the first confirmation, writes a document without a `ConfirmedPlan`, opens any file - for writing (the report too) without `create_new`, can write a document outside the - selected folder, lets `--plan` write or download anything, treats a non-terminal - input as a yes, confirms anything from a script (only `check` on an ordinary folder, `check - --plan`, `extract --plan` on an ordinary folder, and the `--plan` lists of `undo`, the menus - and `uninstall` run there), judges time from the signer's claimed signing time, skips the - native dialog of a context-menu run, counts several selected folders wrongly (a row each, the - total typed, overlaps counted once), or produces a file name that is invalid on another OS - (Windows reserved names and characters, trailing dot/space, NFC/NFD or case collisions, - over-long names). + only the report (HTML and JSON) and the tool's cache (R16); documents need an extraction + confirmed by the typed number (`extract`, or the interactive end of run, R20, R29); existing + files are never overwritten, not even a report; no panic on malformed input (no + `unwrap`/`expect`/indexing on untrusted data outside tests); no PowerShell; no OpenSSL or C + dependencies. Confirmation and write safety (R28–R34 in `docs/design.md`) is a fixed point of + every review: look for any path that processes without the first confirmation, writes a document + without a `ConfirmedPlan`, opens any file for writing outside the tool's cache (the report too) + without `create_new`, replaces a file in the cache that the tool did not create, can write a + document outside the selected folder, lets `--plan` write or download anything, treats a + non-terminal input as a yes, confirms anything from a script (only `check` on an ordinary + folder, `check --plan`, `extract --plan` on an ordinary folder, and the `--plan` lists of + `undo`, the menus and `uninstall` run there), judges time from the signer's claimed signing + time, skips the native dialog of a context-menu run, counts several selected folders wrongly (a + row each, the total typed, overlaps counted once), or produces a file name that is invalid on + another OS (Windows reserved names and characters, trailing dot/space, NFC/NFD or case + collisions, over-long names). 4. **Language**: code, comments, docs and developer messages in English. User-facing texts of the tool go through the translation layer (R27 in `docs/design.md`), never hard-coded, and every new text has its Italian translation. Every changed text (docs, comments, commit diff --git a/CLAUDE.md b/CLAUDE.md index c6c0f5d..50ebb88 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -138,18 +138,18 @@ in the history even if deleted later. Before every commit and push: (`--lang`, see R27 in `docs/design.md`). Source strings are English; every user-facing text goes through the translation layer, never hard-coded, and each new text gets its Italian translation in the same change. -- `check` writes no document: only the report and the tool's cache of trusted lists and CRLs - (R16). **There is no `--apply`, `--yes` or `--expect`.** - Every command that changes files or the system shows the exact plan first (except the report - and cache of `check`, R16). The number is - typed only for files found in a folder (files to process in a risky folder, R28; documents - to write, R29); `undo`, - menus and `uninstall` ask a yes/no question, default No, answers in words (R19, R35). From - the context menu the same confirmations come in a native dialog, focus on Cancel; from a script - they refuse (R30); `--plan` shows the plan and stops. These rules are for the tool; the - developer script `scripts/cleanup.sh` is the one exception (it removes only junk and merged - branches, without asking, see above). Never ask the developer to type numbers in chat: the - typed count is a rule of the tool, not of the conversation. +- `check` writes no document: only the report (HTML and JSON) and the tool's cache of trusted lists + and CRLs (R16); documents come only from an extraction confirmed through R29 (`extract`, or the + interactive end of a `check` run, R20). **There is no `--apply`, `--yes` or `--expect`.** Every + command that changes files or the system shows the exact plan first, except `check` on an + ordinary folder from a script, which writes its report and the cache without a question (R16, + R30). The number is typed only for files found in a folder (files to process in a risky folder, + R28; documents to write, R29); `undo`, menus and `uninstall` ask a yes/no question, default No, + answers in words (R19, R35). From the context menu the same confirmations come in a native + dialog, focus on Cancel; from a script they refuse (R30); `--plan` shows the plan and stops. + These rules are for the tool; the developer script `scripts/cleanup.sh` is the one exception (it + removes only junk and merged branches, without asking, see above). Never ask the developer to + type numbers in chat: the typed count is a rule of the tool, not of the conversation. - Originals are only read, never modified, moved or renamed; existing files are never overwritten ("x.pdf" exists with other content -> "x (1).pdf"). - **Never process right after a person chooses a folder**: first count and ask for @@ -157,7 +157,8 @@ in the history even if deleted later. Before every commit and push: one is refused); writing needs a second confirmation on the full write plan, with the number typed (R29); no implicit yes, ever (R30: terminal, dialog from the context menu, refusal in scripts). Documents are written only through a `ConfirmedPlan` and never outside the chosen - folder; every file the tool writes, the report too, is created with `create_new` (R31). + folder; every file `check` and `extract` write outside the cache, the report too, is created + with `create_new` (R31). File names valid on Windows, macOS and Linux at once (R32). Any change here needs the tests of R34. - **Accessibility is a requirement, not a polish step** (EN 301 549; WCAG 2.2 AA for the diff --git a/README.md b/README.md index c170362..1c8407f 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ For each folder, SignSpector: - finds every signed or time-stamped file in it and its subfolders (hidden folders and symbolic links are skipped and listed in the report); -- opens every layer: BER/DER envelopes (including indefinite lengths), base64 envelopes, - nested signatures, RFC 5544 time-stamped data; +- opens every layer: BER/DER encoding (including indefinite lengths), base64 encoding, nested + signatures, RFC 5544 time-stamped data; - verifies each signature (RSA, RSA-PSS, ECDSA; SHA-1/2) and the signer's certificate (validity, key usage, qualified status); - follows the chain up to a CA of the national trusted list of the certifier's country. It @@ -29,7 +29,7 @@ For each folder, SignSpector: [EU List of Trusted Lists](https://ec.europa.eu/tools/lotl/eu-lotl.xml) and chooses it automatically from the signatures found; - checks whether the certificate was revoked, from data in the signature or the CA's - revocation list: not one query per signature; + revocation list (CRL): not one query per signature; - verifies countersignatures and RFC 3161 time stamps; - reports the results on the console and in a self-contained HTML report (and JSON for scripts); @@ -44,18 +44,20 @@ cannot damage them: - `check` writes no document. It writes only the HTML report (in each folder, or at the `--report` path you name), the JSON file of `--json`, and its own cache of trusted lists and CRLs. Documents are written only by an extraction you ask for and confirm. -- After you choose a folder, it only counts the files to process (signed or time-stamped - files) and asks before analysing them. +- After you choose a folder, it only counts the signed or time-stamped files (the tool calls + them "files to process") and asks before analysing them. - Writing documents needs a second confirmation on the complete write plan: you type the number of documents to write. -- A risky run gets a stronger warning, and you type the number of files to process. A run is - risky when a chosen folder is: +- A risky run gets a stronger warning, says why, and you type the number of files to process. + A run is risky when a chosen folder is: - the root of a drive or volume; - the home folder, Desktop or Documents; - a system folder; - a network share root; - - a folder that holds more than 10,000 files of any kind, subfolders included (counted over - all the folders chosen). + - a folder that holds more than 10,000 files of any kind, subfolders included. + + A run is also risky when the folders chosen hold more than 10,000 files in all. Hidden + folders and symbolic links, which the analysis skips, are not counted. - From the context menu, the same confirmations appear in a window. - In scripts, only these run: - `check` on an ordinary folder, and `check --plan`; @@ -67,11 +69,12 @@ cannot damage them: - Nothing is ever overwritten, not even an earlier report. Every file is created with an exclusive "create new" operation, so the operating system itself refuses to overwrite. A name clash becomes `x (1).pdf`. Only the tool's own cache is refreshed in place. -- Extracted documents are never written outside the chosen folder. File names taken from envelopes - are made valid on Windows, macOS and Linux at once: no forbidden characters, no reserved names, - no clashes that differ only in letter case or Unicode form. -- Every extracted document is logged in the report with its SHA-256. `signspector undo` - removes only the files that are still identical to what SignSpector wrote. +- Extracted documents are never written outside the chosen folder. File names taken from the + signed files are made valid on Windows, macOS and Linux at once: no forbidden characters, no + reserved names, no clashes that differ only in letter case or Unicode form. +- Every extracted document is recorded in the report with its SHA-256. An extraction never + rewrites an earlier report: it writes a new one. `signspector undo` removes only the files + that are still identical to what SignSpector wrote. - `signspector uninstall` removes only what SignSpector installed, and never user data. ## Is it accessible? diff --git a/docs/design.md b/docs/design.md index cc00eb8..7bae897 100644 --- a/docs/design.md +++ b/docs/design.md @@ -59,16 +59,15 @@ beside the originals, ready to open. ### Extracting - R16. `check` (the default) writes no document. It writes only: - - the HTML report, in each folder or at `--report ` (none with `--no-report`, R14); + - the HTML report, in each folder or at `--report ` (none with `--no-report`, R19); - the JSON file of `--json ` (R15); - the tool's own cache of trusted lists and CRLs (R44, R47, R49). - The report and the JSON file never replace an existing file: they are created with - `create_new`, and a name already taken gets the next free name (`(1)`, `(2)`...), as in R17. - Only files inside the tool's cache folder are ever replaced. One exception writes documents - in a `check` run: extraction chosen at the interactive end of run (R20), through R29. - `extract` writes the signed - documents beside the originals (`Relazione.pdf.p7m` -> `Relazione.pdf`) after the two + The report and the JSON file never replace an existing file: they are created with `create_new`, + and a name already taken gets the next free name (`(1)`, `(2)`...), as in R17. `check` and + `extract` replace no file outside the tool's cache folder. One exception writes documents in a + `check` run: extraction chosen at the interactive end of run (R20), through R29. `extract` writes + the signed documents beside the originals (`Relazione.pdf.p7m` -> `Relazione.pdf`) after the two confirmations of R28 and R29: typing the number of documents is the safeguard. - R17. Never overwrite: same content already there -> nothing to do; different content -> `Relazione (1).pdf`. Originals are never modified, moved or renamed. @@ -80,7 +79,8 @@ beside the originals, ready to open. `install-menu`, `uninstall-menu`, `uninstall`. **There is no `--apply`, `--yes` or `--expect`.** Every command that changes files or the system shows the exact plan first and acts only after a person confirms. The one exception is what `check` writes on an ordinary folder from a script: - the report and the cache, with no question (R16, R30). Where the person is decides how (R30): + the report (HTML and JSON) and the cache, with no question (R16, R30). Where the person is + decides how (R30): - **at a terminal**: before analysing, a yes/no question (R28); for files found in a folder the user types the number (risky folder, R28; documents to write, R29); `undo`, `install-menu`, `uninstall-menu`, `uninstall` change only what the tool itself made and @@ -91,13 +91,14 @@ beside the originals, ready to open. - **from a script** (no terminal, no `--interactive`): nobody can answer, so they refuse. `check` and `extract` take one or more folders (several can be selected in the file manager). - They are counted and confirmed together: one summary with a row per folder (path and number - of files to process) and the total, one question for all. The number typed is the total. A - single risky folder makes the whole run risky, and the 10,000-file limit applies to the - total (R28). A folder with no envelopes is shown with 0; if all are empty the run stops. - The same folder given twice (also spelt differently: letter case, a symbolic link, a - trailing slash), or a folder inside another selected one, is counted once, under the outer - folder; the summary says so, and its envelopes go in the outer folder's report. + They are counted and confirmed together: one summary with a row per folder (path, number of files + to process, number of files of any kind) and the totals, one question for all. When the run is + risky, the summary says why (the kind of folder, or the 10,000-file limit). The number typed is + the total. A single risky folder makes the whole run risky, and the 10,000-file limit applies to + the total (R28). A folder with no envelopes is shown with 0; if all are empty the run stops. The + same folder given twice (also spelt differently: letter case, a symbolic link, a trailing slash), + or a folder inside another selected one, is counted once, under the outer folder; the summary + says so, and its envelopes go in the outer folder's report. `--interactive` says that a person is there even without a terminal: questions come in native dialogs (R30) and the run ends with the interactive end of run (R20). The @@ -107,21 +108,23 @@ beside the originals, ready to open. `--plan` shows what the command would do and stops before doing it. It never writes anything, not even the report or the cache, and downloads nothing: it uses the embedded - lists and those already in the cache, and says which lists a real run would download. + lists and those already in the cache. - `check --plan` only counts (R28; no envelope is opened) and prints the summary: no question, allowed everywhere, also from a script on a risky folder. - `extract --plan` builds the write plan of R29, which opens every envelope, so it asks the R28 question first (console or dialog), and from a script runs on an ordinary folder and - refuses a risky one, like `check`. + refuses a risky one, like `check`. It also says which trusted lists a real run would + download (R45). - For the other commands it lists the items, with no question, also from a script. - `check` writes no document: only the report and the tool's cache (R16). Options: `--open`, `--report`, `--no-report`, `--report-lang `, `--json `, `--threads`, `--offline`, `--trust-lists `, `--trust-list `, `--lang `, `--interactive`, `--plain`, `--no-color`, `--plan`. Help translated (R27). - R20. Interactive end of run (double-click on Windows, context menu, `--interactive`): after the analysis, offer to view the report or to extract; extraction goes through the write - plan and its confirmation (R29) and reuses the analysis already done. + plan and its confirmation (R29) and reuses the analysis already done. The first report is + never rewritten: the extraction writes a second report beside it (next free name, R16) with + the analysis and the documents written, and `undo` uses that one (R33). - R21. `install-menu` / `uninstall-menu` (plan and yes/no question, R19) for the file manager's context menu: Windows per-user registry keys (no admin, no PowerShell); macOS Quick Actions; Linux Nautilus script and Dolphin service menu. Full removal: `uninstall` (R40–R43). @@ -139,21 +142,22 @@ beside the originals, ready to open. ### Languages - R27. The interface (console messages, `--help`, HTML report, JSON field values meant for - people, user guide) is translated. Language = the one chosen by the user (`--lang it`, - or a preference saved by an explicit command; `check` and `extract` never save one), - otherwise the operating system's language, otherwise English. + people, user guide) is translated. Language = the one chosen with `--lang it`, otherwise the + operating system's language, otherwise English. No preference is saved; a command to save + one can be added later, with its plan and question (R19). Source language English; first translation Italian; more can be added without code changes. - *To decide*: translation mechanism (e.g. Fluent `.ftl` files embedded in the executable, or - `rust-i18n`), OS language detection (`sys-locale`), where the preference is saved, how - dates and numbers are formatted per language. + `rust-i18n`), OS language detection (`sys-locale`), how dates and numbers are formatted per + language. - The report is written in the interface language by default; `--report-lang ` writes it in another one (for example to send it to an office abroad). ### Confirmation and write safety Nothing is ever processed right after a person chooses a folder, and no document is written -without a second, separate confirmation. Writing never replaces an existing file; only the -tool's own cache is refreshed in place (R16). A folder named in a script has no person to ask: -an ordinary folder is analysed (`check` writes only the report and the tool's cache, R16); a +without a second, separate confirmation. `check` and `extract` never replace an existing file; +only the tool's own cache is refreshed in place (R16). A folder named in a script has no +person to ask: an ordinary folder is analysed (`check` writes only the report, HTML and JSON, +and the tool's cache, R16); a risky one is refused, only counted by `check --plan`, and nothing is written (R30). - R28. **Confirm before analysing.** After the folders are chosen the tool only counts (no @@ -164,8 +168,10 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 drive or volume, the user's home, Desktop, Documents, system folders (`C:\Windows`, `Program Files`, `/System`, `/usr`, `/etc`...), network share roots, or a folder that holds **more than 10,000 files of any kind**, subfolders included: a stronger warning and the user - must type the number of files to process (envelopes). Every path-based kind of risky folder - is judged on the path after resolving symbolic links. + must type the number of files to process (envelopes). The 10,000 count covers the regular + files of the folders the walk visits (R2): files in hidden folders, behind symbolic links + or in unreadable folders are not counted, and a file in overlapping folders counts once. + Every path-based kind of risky folder is judged on the path after resolving symbolic links. - R29. **Confirm before writing.** Extraction first builds the complete write plan and shows it: new documents, documents already present with identical content (not rewritten), documents saved under an alternative name `x (1).pdf`, and "existing files modified: 0" @@ -177,7 +183,8 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 - Context menu: no terminal, started with `--interactive`: the same confirmations in a native dialog (R38), with a shorter summary than the console. The dialog lists every selected folder with its number of files to process (envelopes to analyse, R28; documents to write, - R29), the total and the operation proposed, then asks the question. When a number is + R29), the total, the reason when the run is risky (R19) and the operation proposed, then + asks the question. When a number is required (R28 risky folder, R29) it is typed in a text field and Confirm accepts only the right number; otherwise the dialog is a yes/no question. In every dialog the focus starts on Cancel; Enter alone and closing the window cancel; no time limit. @@ -192,9 +199,9 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 - In code, writing a document requires a `ConfirmedPlan` that only the confirmation step can build (typestate): a path that writes without confirmation does not compile. Originals are held in a read-only `Original` type that write functions do not accept. - - Every file the tool writes outside its cache (documents, report, JSON) is created with - `OpenOptions::create_new(true)`: the OS refuses if the name exists, even if the file - appeared after the plan; then the next free name `(2)`, `(3)`... is used. A partly written + - Every file `check` and `extract` write outside the cache (documents, report, JSON) is created + with `OpenOptions::create_new(true)`: the OS refuses if the name exists, even if the file + appeared after the plan; then the next free name (`(1)`, `(2)`...) is used. A partly written file (error, disk full) is removed, only if we created it. - Before writing, each original is re-checked against the analysis (size, mtime, SHA-256); if the folder changed, the plan is rebuilt and confirmed again. @@ -218,7 +225,8 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 APFS default are case-insensitive; APFS treats NFC/NFD as the same name), so two documents never compete for "names" that the file system sees as equal; - the original name, when changed, is shown in the report. -- R33. **Undo.** The report records every document written with its SHA-256. +- R33. **Undo.** The report written by an extraction records every document written with its + SHA-256 (an extraction at the interactive end of run writes its own report, R20). `signspector undo ` removes only files written by SignSpector whose content still matches that hash; changed or missing files are listed and left alone; originals are never touched. It shows what it would remove and removes it after a yes/no question (R19); never @@ -235,11 +243,18 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 the menus and `uninstall` run without a question; output redirected counts as a script; - `--interactive` with a terminal keeps the questions in the terminal; - `--plan` writes nothing, not even the report or the cache, and downloads nothing; - - `check` adds only its report to the folder (snapshot); an existing report or JSON file is - not replaced, the new one gets the next free name; end-to-end tests point the cache to a - temporary folder, never the user's real one; + - `check` adds only its report to the folder (snapshot), and nothing with `--no-report`; an + existing report or JSON file, also one named with `--report` or `--json`, is not replaced: + the new one gets the next free name; `extract --plan` names the lists a real run would + download; end-to-end tests point the cache to a temporary folder through the system's own + variables (R47), never the user's real one; a file in the cache folder that the tool did + not create is never replaced; + - interactive end of run (R20): documents are written only through R29, declining writes + none, and an extraction writes a second report without touching the first; - risky folder: more than 10,000 files of any kind (subfolders included) is risky even with - few envelopes, and the number typed is the files to process; + few envelopes, and the number typed is the files to process; exactly 10,000 is not risky, + 10,001 is, also as a total over several folders; files in hidden folders, behind symbolic + links or in unreadable folders are not counted, and overlaps are counted once; - time: a back-dated signing-time attribute changes no verdict; without a time stamp the report says "claimed, not proved" (R9); - yes/no question: Enter alone cancels, `y` on a pipe is refused, a number is not a yes; @@ -282,14 +297,18 @@ Liechtenstein, Norway, United Kingdom). precedence (R47). - R45. **Automatic choice.** The analysis collects the country of every certifier found in the files (`C=` of the issuing CA) and loads only those lists: from the cache if still valid, - otherwise downloaded. The summary before confirmation names them, for example "signatures + otherwise downloaded. The write plan (R29) and the report name them, for example "signatures from 3 countries: Italy, Romania, France; lists: Italy and France up to date, Romania downloaded now". - R46. **Settable.** `--trust-lists auto` (default) / `all` / `it,ro,fr`; `--trust-list ` loads a list by hand; `--offline` uses only the embedded copies and the cache. A missing list is reported as such ("list of Romania not available offline"), never as an invalid signature. - R47. **Cache.** Lists (and the CRLs of R49) are cached in the SignSpector cache folder and - refreshed when their own `NextUpdate` date passes; `uninstall` removes the cache (R40). + refreshed when their own `NextUpdate` date passes; `uninstall` removes the cache (R40). The + cache folder is the operating system's standard one (R42); no option moves it. Tests move it + only through the system's own variables (`HOME`, `XDG_CACHE_HOME`, `LOCALAPPDATA`). The tool + replaces only the files with the fixed names it creates there, never another file found in + that folder. - R48. **Verdicts.** Qualified status is checked at the reference time (R9) using the service history in the list (a service withdrawn later still validates an earlier signature). A certifier on no list is reported as "not on a European trusted list", distinct from "invalid @@ -378,7 +397,8 @@ public administration checks the applicable obligations (e.g. accessibility stat ### Uninstalling - R40. **`signspector uninstall`** removes everything SignSpector added to the system, and only that: context menu entries, the Windows "Installed apps" entry (R42), trust-list and CRL cache, - saved preferences (SignSpector keeps no log files). Same rule as every command that changes + the install manifest (R41). SignSpector saves no preferences and keeps no log files: the + record of written documents is in the report (R33). Same rule as every command that changes something (R19): it shows the exact list of what it would remove and removes it after a yes/no question; never from a script (R30); accessible like the rest (R35). - R41. **Only what we installed.** `install-menu` records every item it creates (path or @@ -394,7 +414,7 @@ public administration checks the applicable obligations (e.g. accessibility stat A running `.exe` cannot delete itself: the tool says where it is so the user can delete it (no PowerShell, no scheduled tricks). - macOS: Quick Actions in `~/Library/Services`, caches in `~/Library/Caches/SignSpector`, - preferences in `~/Library/Application Support/SignSpector`. + the manifest in `~/Library/Application Support/SignSpector`. - Linux: Nautilus script, Dolphin service menu, `~/.cache/signspector`, `~/.config/signspector`. `.deb`/`.rpm` remove only system files they installed; the per-user items are removed by `signspector uninstall` (the package's removal message @@ -419,7 +439,7 @@ Library crate with one module per concern, the executable only parses arguments | `xmldsig` | exclusive C14N, XML signature verification (R44) | `roxmltree`, own code | | `tsl` | LOTL and national lists: embedded copies, choice by country, refresh, cache (R44–R48) | `roxmltree`, `flate2`, `ureq` + rustls, `directories` | | `scan` | folder walk, per-file pipeline, parallelism | `std::thread::scope` | -| `extract` | safe writer, write log, `undo` (R31, R33), content type (R18) | `zip` | +| `extract` | safe writer, record of written documents in the report, `undo` (R31, R33), content type (R18) | `zip` | | `report` | console, HTML, JSON | `serde_json`, `anstream` | | `menu` | context-menu install, manifest, `uninstall` (R21, R40–R43) | `winreg` (Windows) | | `main.rs` | arguments, help | `clap` | diff --git a/docs/roadmap.md b/docs/roadmap.md index 1d16a55..3554d0c 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -64,7 +64,7 @@ The order follows two ideas: (2026-11-23) to stop the rounds there. A breakage of this section that shows no bug is listed on the PR and here, not closed with another round. Known limit: `rustup check` has no time limit. It runs only in report mode, after the hook gates, so no commit or push - waits on it. The script is correct today; breaking these rules on a copy leaves all tests + waits on it. These three rules are correct today; breaking them on a copy leaves all tests green (review of 40e2d4c): - unescaping the first dot of the x.y.z check (`1x100.0` would then pass); - accepting only a single digit for the major and patch numbers (`10.0.0` would then be @@ -92,12 +92,11 @@ The order follows two ideas: `Relazione.pdf.p7m` -> `Relazione.pdf`, nested `.pdf.p7m.tsd`, uppercase extensions. - [ ] 1.4 **i18n skeleton** (R27): pick the mechanism (Fluent vs `rust-i18n`, decided with the user), English + Italian, `--lang`, OS language detection. Needed before any message below. -- [ ] 1.5 **Walk and count** (R1b, R2, R19, R28): one or more folders, a row per folder and - the total; regular files only, symbolic links not followed and - hidden folders skipped (both listed in the report), - unreadable folders listed; count, total size, subfolders. Risky-folder detection (drive - roots, home, Desktop, Documents, system folders, network share roots, > 10,000 files of any - kind, subfolders included). +- [ ] 1.5 **Walk and count** (R1b, R2, R19, R28): one or more folders, a row per folder and the + total; regular files only, symbolic links not followed and hidden folders skipped (both listed in + the report), unreadable folders listed; two counts (files to process, files of any kind), total + size, subfolders. Risky-folder detection (drive roots, home, Desktop, Documents, system folders, + network share roots, > 10,000 files of any kind, subfolders included). - [ ] 1.6 **Confirmation logic** (R28–R30): pure functions turning (counts, folder, terminal, dialog via `--interactive`, or script; `--plan`) into the question to ask and parsing the answer: typed count (R28 risky folder, @@ -117,8 +116,8 @@ The order follows two ideas: - [ ] 2.2 `cms` SignedData parsing: encapsulated content, certificates, signer infos (no verification yet); base64 envelopes; nested layers (R3, R4, R7). - [ ] 2.3 End-to-end slice: `check` and `extract` on simple fixtures through the real flow, - minimal console output with `--plain`, `--no-color` (R35), minimal JSON (R15), write log - with SHA-256 and `undo` (R33). + minimal console output with `--plain`, `--no-color` (R35), minimal JSON (R15), written + documents recorded in the report with SHA-256, and `undo` (R33). ## Phase 3: verification - [ ] 3.1 `crypto`: digests, RSA PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384/P-521 (R8). From b0a9cd9e21d2498e35d4cfe6b8c9c205641cb956 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:18:52 +0100 Subject: [PATCH 16/36] audit: 0007 Co-Authored-By: Claude Opus 5.5 --- docs/audits/0007-2026-11-23.md | 199 +++++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 docs/audits/0007-2026-11-23.md diff --git a/docs/audits/0007-2026-11-23.md b/docs/audits/0007-2026-11-23.md new file mode 100644 index 0000000..b977932 --- /dev/null +++ b/docs/audits/0007-2026-11-23.md @@ -0,0 +1,199 @@ +# Coherence audit 0007 (2026-11-23) +Range: 2891328..20a420d (five commits on `step/0.4-writing-guide`, PR #3, draft; working tree clean) Verdict: DRIFT FOUND + +Auditor: `coherence-auditor` agent, fresh context, read-only, run because the cadence is due (5 commits since audit 0006). + +No code changed in the range, and no claim about code is false. The drift is in the documents. Three of the five commits change requirements (R16, R19, R20, R27, R28, R31, R33, R34, R40, R42, R45, R47) inside a step named "writing guide", and the new texts contradict each other in five places (F1 to F5). A sixth review comment, posted on PR #3 during this audit, lists most of them; they were checked here independently and are still open at the head. PR #3 has no comment that says its current state and next step (F7). + +## Unfinished work + +`sh scripts/audit-status.sh` (exit 0): + +``` +== Audit cadence +commits since last audit: 5 (audit every 5) +last audit: 2891328 2026-11-23 audit: 0006 +AUDIT DUE + +== Rust +pinned Rust 1.100.0 is the latest stable + +== Unfinished local work +working tree clean +branch step/0.4-writing-guide: 0 unpushed, 0 not pulled +local branches not merged into main: + step/0.4-writing-guide +remote branches not merged into main: + origin/step/0.4-writing-guide + +== Markers in code +none + +== Leftovers (scripts/cleanup.sh --plan; run scripts/cleanup.sh to remove the local ones) +keep local branch (not merged): step/0.4-writing-guide +on GitHub, merged (kept, nothing is deleted on GitHub): origin/step/0.2-ci +on GitHub, merged (kept, nothing is deleted on GitHub): origin/step/0.2.1-confirmation-rules +on GitHub, draft PR (not closed here): #3 updated 2026-11-23: Roadmap 0.4: writing guide +nothing to remove + +== GitHub +open pull requests: +#3 DRAFT step/0.4-writing-guide updated 2026-11-23: Roadmap 0.4: writing guide +last CI runs on main: +2026-11-23 completed/success: Guard the Windows skips; test the report with no red checks +2026-11-23 completed/success: CI +2026-11-22 completed/success: Remove --apply everywhere, close review and audit 0002 findings +``` + +- **Local work**: nothing uncommitted, no stashes, nothing unpushed, one worktree. +- **Cadence**: `sh scripts/audit-status.sh --gate-push HEAD` exits 0. `--gate-commit` exits 1 ("5 commits since the last coherence audit (limit 5)") until this report is committed alone. Audit 0006 was committed alone (`git show --stat 2891328`: one file). +- **PR #3** (draft, opened 2026-11-23 05:36 UTC, less than a day old, head 20a420d, 15 commits, 16 comments): + - What it is for: roadmap 0.4 (`docs/roadmap.md:34-38`): the writing guide, the rewrite of README, design, roadmap, `CLAUDE.md` and the agent prompts to it, the `rust-toolchain.toml` comment, the session-report line for a newer Rust. + - Done: the guide, the pointers to it, the `rust-toolchain.toml` comment, the "Rust" section with its tests, the README rewritten to the guide (d323e74, 40e2d4c). + - Missing: + - an APPROVED verdict. PR #3 has nine verdicts, all CHANGES NEEDED. The latest, on 20a420d (comment of 12:38 UTC), has 21 items, four of them questions for the owner; none is closed yet; + - the rewrite of `docs/design.md`, `docs/roadmap.md`, `CLAUDE.md` and the agent prompts; + - a state comment with the next step (F7); + - the `[x]` mark at `docs/roadmap.md:34`, correctly absent. + - Still relevant: yes, it is the one open step. Its content has grown beyond the step (F6). +- **CI job lists** (`gh run list`, `gh run view`, `gh pr checks 3`): + + | Commit | Run | Result | + |---|---|---| + | 2891328 (audit 0006) | 45166698876 | cancelled | + | d323e74 | 45166789199 | success | + | 40e2d4c | 45168033014 | success | + | 5ba364e | 45172170142 | success | + | f0cc470 | 45173925936 | success | + | 20a420d (head) | 45175501435 | Repository rules, Linux musl, Windows gnu, macOS arm64: all four pass, read in the job list | + + The run on 2891328 was cancelled, not red: d323e74 was pushed 36 seconds later, and a new push to a pull request replaces the running check (`.github/workflows/ci.yml:22-26`). The run on the head was still in progress at the start of the audit and finished green during it. GitGuardian passes. `main` is unchanged at 8561ec5, green. +- **Branches**: local `main` and the step branch; on GitHub `main`, `step/0.2-ci` and `step/0.2.1-confirmation-rules` (both merged, kept) and the step branch. Nothing stale. +- **Pull requests**: #1 and #2 merged, #3 open as a draft. No other open PR. +- **Markers**: none. +- **Leftovers**: `sh scripts/cleanup.sh --plan` (exit 0) prints the four lines shown above and "nothing to remove". +- **Tracked files that belong to the work, not the product**: none. `git ls-files` shows 37 files; the only reports are the six under `docs/audits/`. + +## Findings + +F1 to F5 are about what the tool should do. Each needs the owner's choice; none should be settled by aligning one text to the other. + +### F1. `contradiction`: a foreign file in the cache is "never replaced" in one place and replaceable in another +- R47, `docs/design.md:309-311`: "The tool replaces only the files with the fixed names it creates there, never another file found in that folder." A file that the tool did not create, but that carries one of the fixed names, may be replaced under this rule. +- R34, `docs/design.md:250-251`: "a file in the cache folder that the tool did not create is never replaced". `.claude/agents/fable-reviewer.md:36` says the same ("replaces a file in the cache that the tool did not create"). +- The two rules give different answers for a foreign file with a fixed name. No R34 case names it. Also open: the names of cached CRL files, which must not come from the input if R47 is to hold. +- Change: the owner decides which rule holds; then R47, R34 and the reviewer prompt say the same, and R34 gets the case. Item 4 and 13 of the review of 20a420d on PR #3. + +### F2. `contradiction`: R47 sends the reader to R42 for the cache folder, and the test rule does not fit the candidate crate on Windows +- R47, `docs/design.md:307-309`: "The cache folder is the operating system's standard one (R42) ... Tests move it only through the system's own variables (`HOME`, `XDG_CACHE_HOME`, `LOCALAPPDATA`)." +- R42, `docs/design.md:410-415`: the Windows item names registry keys and the uninstall entry only. It names no cache folder and no folder for the manifest. macOS and Linux have both (`docs/design.md:416-419`). +- The architecture table names `directories` as the candidate crate for the cache (`docs/design.md:440`). On Windows that crate does not read `LOCALAPPDATA`: it asks the system (`SHGetKnownFolderPath`). Checked in the crate sources: `dirs-sys` `src/lib.rs:153,180` (`known_folder_local_app_data`), used by `directories` `src/win.rs:13`. A test that sets `LOCALAPPDATA` would still reach the user's real cache, which R34 forbids (`docs/design.md:249-250`). +- The manifest of R41 lives in the config folder. No rule says how tests of `install-menu` move that folder. +- Change: name the Windows cache and config folders in R42; decide before roadmap 3.5 how the folder is found on Windows so that the test rule of R47 can work. `directories` is not a dependency yet (`Cargo.toml:16`), so nothing is broken today. Item 5 of the review of 20a420d. + +### F3. `contradiction`: the "create new" rule has three different scopes +- R31, `docs/design.md:202-203`, and `CLAUDE.md:160-161`: "every file `check` and `extract` write outside the cache". +- `.claude/agents/fable-reviewer.md:35-36`: "opens any file for writing outside the tool's cache (the report too) without `create_new`", for every command. +- `README.md:69-71`: "Nothing is ever overwritten, not even an earlier report. Every file is created with an exclusive "create new" operation". +- The commit message of 20a420d says the rule was "scoped to check and extract, so the install manifest (R41) is not caught by it". The README and the reviewer prompt were not scoped. With the narrow scope, no rule says what `install-menu` does when it meets a foreign menu item with the same name, which `uninstall` could then remove (R41, `docs/design.md:404-408`). +- Change: the owner decides the rule for `install-menu`; then the three texts carry one scope. Items 1 to 3 of the review of 20a420d. + +### F4. `contradiction` (gap): `--no-report` and the second report +- `--no-report` appears three times: `docs/design.md:62` ("none with `--no-report`, R19"), the option list at `docs/design.md:120`, and the test case at `docs/design.md:246`. R19 only lists the name. No text says what it does with `extract`. +- R33 (`docs/design.md:228-229`) and R20 (`docs/design.md:125-127`) make the report of an extraction the only record `undo` can use. With `--no-report`, an extraction would leave no record. With `--report ` or `--json `, where the second report and a second JSON file go is not said. +- Change: the owner decides whether `--no-report` is allowed with an extraction and what the second report does for `--json`; define the option in R19. Items 7 and 18 of the review of 20a420d. + +### F5. `contradiction` (minor): what the dialog shows, and the R34 cases that follow +- The commit message of 20a420d says: "The summary and the dialog show the any-kind count and why a run is risky." The console summary does (`docs/design.md:94-96`). The dialog of R30 shows the files to process, the total, the reason and the operation (`docs/design.md:184-187`); it does not show the any-kind count. +- R34, dialogs (`docs/design.md:265-269`): "every selected folder with its count, the total and the operation are shown". The reason, which R30 now requires, has no case. The console cases (`docs/design.md:254-264`) have none for "the summary says why" or for the any-kind count in rows and totals. +- Change: decide whether the dialog shows the any-kind count; add the missing cases to R34. Items 6, 9 and 10 of the review of 20a420d. + +### F6. `drift`: three commits of requirement decisions inside the step "writing guide" +- Roadmap 0.4 (`docs/roadmap.md:34-38`) covers the guide, the rewrite of the documents, a comment and a report line. Commits 5ba364e, f0cc470 and 20a420d record owner's decisions that change what the tool does: what `check` writes, the 10,000-file rule on files of any kind, reports never replaced, `--plan` downloading nothing, the second report, the cache rules, no saved preference (`git diff 2891328..HEAD --stat`: `docs/design.md` 90 lines added, 50 removed). +- The decisions are dated and attributed in the commit messages and in the PR comments of 12:28 and 12:38 UTC. No roadmap step names them. The PR text does not either: its "Done so far" paragraph ends with the README and the "Rust" decision. +- Each decision opened new questions (F1 to F5), and the review rounds on this PR now discuss requirements, not the wording of documents. `CLAUDE.md:63` says "One step open at a time". +- Change: the owner decides whether these decisions stay in PR #3 (then roadmap 0.4 and the PR text name them) or go to a step of their own. + +### F7. `unfinished`: PR #3 has no comment with its current state and next step +- `GH_PROMPT_DISABLED=1 gh pr view 3 --comments `. + +### F10. `minor`: carried over +- From 0005-F3: `docs/roadmap.md:38` promises a "session report line when a newer stable Rust exists". The section prints one of six lines (`scripts/audit-status.sh:85-97`). The roadmap text can name the section when 0.4 is marked done. +- From 0001-F12 to 0006-F4: `Cargo.toml:19-21` declares `assert_cmd` 2.2.2 and `predicates` 3.1.4; `tests/` holds only `fixtures/`, no `tests/*.rs`. +- From 0003-F6 to 0006-F4: no test fixes the choice that a branch just created at `main` is removed (`grep -n 'just created\|no commits' scripts/test-cleanup.sh` finds nothing). + +### Follow-up of audit 0006 +- F1: closed by the comment of 11:37 UTC (how the review of 1363b18 was closed, state, next step). Open again as F7. +- F2: closed. `CLAUDE.md:27-28` states the exception and points to `docs/roadmap.md` 0.5; `docs/roadmap.md:60-72` records the decision, the missing time limit on `rustup check` and three listed breakages. +- F3: no change needed. +- F4: the text of merged PR #2 no longer ends with the emoji (`gh pr view 2 --json body`, last line: "Generated with [Claude Code](https://claude.com/claude-code)"). The other items are carried in F10. + +### Verified and found true +- **Commit messages in the range**: apart from F8, every change they name exists. + - d323e74: README headings are questions (`README.md:12,39,80,91,97,111,134,146`); it points to the guide (`README.md:158-159`); no bold label in its lists. + - 40e2d4c: every kind of risky folder of R28 (`README.md:52-57`); the script rule (`README.md:62-67`); two tests added (`scripts/test-scripts.sh:461-464`). + - 5ba364e: R16 (`docs/design.md:61-71`), `CLAUDE.md:141-143`, `.claude/agents/fable-reviewer.md:28-30`, `README.md:44-46` say what `check` writes in the same way. + - f0cc470 and 20a420d: R19 `--plan` (`docs/design.md:109-118`), R20 (`125-127`), R27 (`144-147`), R28 (`163-174`), R33 (`228-229`), R34 (`245-257`), R40 (`398-403`), R45 (`298-302`), R47 (`306-311`), roadmap 1.5 and 2.3 (`docs/roadmap.md:95-99,118-120`). "write log" is gone and the first free name is `(1)` everywhere (`grep -n 'write log\|(3)'` finds nothing). +- **Roadmap 0.5, "Rust" section** (`docs/roadmap.md:60-72`): the review history matches the comments of PR #3. The three listed breakages were made on a scratch copy; `sh scripts/test-scripts.sh` after each: + + | Breakage | Result | + |---|---| + | first dot of the x.y.z check unescaped | 178 passed, 0 failed | + | single digit only for major and patch | 178 passed, 0 failed | + | captured rustup version may start with a dot | 178 passed, 0 failed | + | x.y.z check accepts an empty middle part | 1 failed: `pin with an empty middle part said` | + | x.y.z check accepts an empty first part | 1 failed: `pin with an empty first part said` | + + The first three are green, as the roadmap says. The last two confirm the claim of 40e2d4c ("each fails when its rule is broken on a copy"). +- **PR #3 text**: the table of the "fifth review" names the two tests added in 40e2d4c, and the count is 178. +- **Roadmap marks**: 0.1, 0.2, 0.2.1 and 1.0 hold; nothing was marked in the range. `is_envelope` is at `src/lib.rs:10` with six test functions, none ignored (`windows_paths` is `#[cfg(windows)]`, `non_utf8_names` is `#[cfg(unix)]`). `src/` did not change in the range. There is no other module or public function. +- **References in the new texts**: `OpenOptions::create_new`, `std::io::IsTerminal`, `HOME`, `XDG_CACHE_HOME`, `LOCALAPPDATA` exist with the meaning used (but see F2 for the crate). Requirement numbers cited in the changed texts (R1a, R2, R9, R14 to R20, R27 to R31, R33 to R35, R40 to R42, R44, R45, R47, R49) exist in `docs/design.md` in that sense. `assert_cmd` 2.2.2 and `predicates` 3.1.4 match `Cargo.lock`. +- **Agent prompts**: `.claude/agents/coherence-auditor.md` is unchanged in the range and agrees with `CLAUDE.md:66-72`. The reviewer prompt agrees with `CLAUDE.md` and R16, R20, R29 except for F1 and F3. +- **Verdict comments** (`CLAUDE.md:32-37`): PR #3 carries a verdict for every review in the range, each by "a new fable-reviewer agent", each followed by how it was closed: on fb41029 and d323e74 (11:42), on 40e2d4c (11:53), on 5ba364e (12:17), on f0cc470 (12:28), on 20a420d (12:38, UTC). The comments hold no local path and no address; `sh scripts/check-public.sh --message ` exits 0 on each of the five comments of the range that existed when checked. PR #2: three verdict comments. PR #1: none (0003-F5, predates the rule). +- **Safety, accessibility, uninstall (R28–R43)**: still no code; nothing is claimed done; the placeholder in `src/main.rs` reads and writes nothing and is the recorded exception (`docs/design.md:478-479`). +- **Language rule**: all text added in the range is English. +- **Public-repository rule**: `sh scripts/check-public.sh --range tip HEAD` exits 0; the five commits have no-reply author and committer addresses. No `tests/corpus/` was read. +- **Not re-checked**: the GitHub settings (branch protection, actions allowlist, secret scanning); the LOTL numbers at `docs/design.md:287-288` (unchanged in the range); the laws and standards cited in the unchanged "Accessibility" section. + +## Health + +Run on macOS arm64 at 20a420d, working tree clean. Script tests and rule breaking ran on a scratch copy (`git archive HEAD`) with failing `gh` and `rustup` stubs first in `PATH`. + +| Command | Result | +|---|---| +| `cargo fmt --check` | clean (exit 0) | +| `cargo clippy --all-targets -- -D warnings` | no issues (exit 0) | +| `cargo nextest run` | 5 passed (2 binaries), exit 0 | +| `cargo test --doc` | 0 doctests (none exist), exit 0 | +| `cargo deny check` | `advisories ok, bans ok, licenses ok, sources ok` (exit 0); warning for an allowed licence not used yet (`Zlib`, `deny.toml:22`) | +| `sh scripts/test-scripts.sh` | 178 passed, 0 failed (also under `dash`) | +| `sh scripts/test-cleanup.sh` | 79 passed, 0 failed, 0 skipped | +| `sh scripts/test-hooks.sh` | 24 passed, 0 failed | +| `sh scripts/check-public.sh --range tip HEAD` | exit 0 ("0 commits and the tree of 20a420d scanned") | +| `sh scripts/audit-status.sh --gate-push HEAD` | exit 0 | +| `sh scripts/audit-status.sh --gate-commit` | exit 1: "5 commits since the last coherence audit (limit 5)" | +| CI on 20a420d (PR #3) | all four jobs green | +| CI on `main` (8561ec5) | green, unchanged | + +The repository was not modified by the audit: `git status --porcelain` is empty before and after, no stash, HEAD still 20a420d. `cleanup.sh` was run with `--plan` only. Nothing was posted or changed on GitHub. Two files of the `directories` and `dirs-sys` crates were read from their public repositories for F2; nothing about this project was sent. From c3311f66dab60a9682c1d75778545bd48fda2f24 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:21:01 +0100 Subject: [PATCH 17/36] Close the requirement changes of step 0.4; list what is still open Owner's decisions (2026-11-23), after the review of 20a420d: - install-menu creates each item with create_new; a foreign item with the same name is reported and left, and never enters the manifest (R41). - An extraction always writes its report, and its JSON file with --json; --no-report skips only the report of an analysis (R19, R20, R33). - The owner closed the requirement changes here: what is left is recorded as "To decide" in docs/design.md, next to the roadmap step that needs it. Text fixes, so that every rule is stated once and the same way: - create_new: every file the tool writes, except the fixed-name files of its cache and its install manifest (R31, R16, CLAUDE.md, reviewer prompt, README). - The cache replaces only its fixed-name files; a CRL file is named by a hash of its CA, never by input text (R47, R34, reviewer prompt). - R28: "symbolic links met during the walk"; a selected folder that is a link is resolved and counted. - R34: undo with the two reports of an R20 run, extract --no-report, a foreign menu item, both counts and the reason in the summary. - README: the count rule as in R28; the overwrite rule with its two exceptions. - docs/roadmap.md 0.4 names the requirement decisions taken in this step (audit 0007, F6). Still to decide, recorded in docs/design.md: the Windows cache and manifest folders and how tests move them (audit 0007, F2), the any-kind count in the dialog, what --open and --threads do. Co-Authored-By: Claude Opus 5.5 --- .claude/agents/fable-reviewer.md | 6 +- CLAUDE.md | 4 +- README.md | 20 +++--- docs/design.md | 103 ++++++++++++++++++++++--------- docs/roadmap.md | 7 ++- 5 files changed, 97 insertions(+), 43 deletions(-) diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index 2d2e47c..a12b83c 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -32,8 +32,10 @@ Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). `unwrap`/`expect`/indexing on untrusted data outside tests); no PowerShell; no OpenSSL or C dependencies. Confirmation and write safety (R28–R34 in `docs/design.md`) is a fixed point of every review: look for any path that processes without the first confirmation, writes a document - without a `ConfirmedPlan`, opens any file for writing outside the tool's cache (the report too) - without `create_new`, replaces a file in the cache that the tool did not create, can write a + without a `ConfirmedPlan`, opens any file + for writing without `create_new` (the report and menu items too; only the cache's + fixed-name files and the install manifest are exempt, R31), replaces a file in the cache + that is not one of its fixed names, can write a document outside the selected folder, lets `--plan` write or download anything, treats a non-terminal input as a yes, confirms anything from a script (only `check` on an ordinary folder, `check --plan`, `extract --plan` on an ordinary folder, and the `--plan` lists of diff --git a/CLAUDE.md b/CLAUDE.md index 50ebb88..fb24fee 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -157,8 +157,8 @@ in the history even if deleted later. Before every commit and push: one is refused); writing needs a second confirmation on the full write plan, with the number typed (R29); no implicit yes, ever (R30: terminal, dialog from the context menu, refusal in scripts). Documents are written only through a `ConfirmedPlan` and never outside the chosen - folder; every file `check` and `extract` write outside the cache, the report too, is created - with `create_new` (R31). + folder; every file the tool writes is created with `create_new`, the report too, except + the fixed-name files of its cache and its install manifest (R31). File names valid on Windows, macOS and Linux at once (R32). Any change here needs the tests of R34. - **Accessibility is a requirement, not a polish step** (EN 301 549; WCAG 2.2 AA for the diff --git a/README.md b/README.md index 1c8407f..58fbd78 100644 --- a/README.md +++ b/README.md @@ -44,20 +44,21 @@ cannot damage them: - `check` writes no document. It writes only the HTML report (in each folder, or at the `--report` path you name), the JSON file of `--json`, and its own cache of trusted lists and CRLs. Documents are written only by an extraction you ask for and confirm. -- After you choose a folder, it only counts the signed or time-stamped files (the tool calls - them "files to process") and asks before analysing them. +- After you choose a folder, it only counts: the signed or time-stamped files (the tool calls + them "files to process") and the files of any kind. Then it asks before analysing. - Writing documents needs a second confirmation on the complete write plan: you type the number of documents to write. -- A risky run gets a stronger warning, says why, and you type the number of files to process. - A run is risky when a chosen folder is: +- A risky run gets a stronger warning that says why. You type the number of files to + process. A run is risky when a chosen folder is: - the root of a drive or volume; - the home folder, Desktop or Documents; - a system folder; - a network share root; - a folder that holds more than 10,000 files of any kind, subfolders included. - A run is also risky when the folders chosen hold more than 10,000 files in all. Hidden - folders and symbolic links, which the analysis skips, are not counted. + A run is also risky when the folders chosen hold more than 10,000 files in all. Files the + analysis skips are not counted (hidden folders, symbolic links, unreadable folders), and a + file in overlapping folders counts once. - From the context menu, the same confirmations appear in a window. - In scripts, only these run: - `check` on an ordinary folder, and `check --plan`; @@ -66,9 +67,10 @@ cannot damage them: Everything else stops and says that a person must confirm. - Originals are read-only. They are never modified, moved or renamed. -- Nothing is ever overwritten, not even an earlier report. Every file is created with an - exclusive "create new" operation, so the operating system itself refuses to overwrite. A - name clash becomes `x (1).pdf`. Only the tool's own cache is refreshed in place. +- Nothing is ever overwritten, not even an earlier report or a menu entry that is not + SignSpector's. Every file is created with an exclusive "create new" operation, so the + operating system itself refuses to overwrite. A name clash becomes `x (1).pdf`. Only the + tool's own cache and its install record are refreshed in place. - Extracted documents are never written outside the chosen folder. File names taken from the signed files are made valid on Windows, macOS and Linux at once: no forbidden characters, no reserved names, no clashes that differ only in letter case or Unicode form. diff --git a/docs/design.md b/docs/design.md index 7bae897..e6a5420 100644 --- a/docs/design.md +++ b/docs/design.md @@ -63,12 +63,13 @@ beside the originals, ready to open. - the JSON file of `--json ` (R15); - the tool's own cache of trusted lists and CRLs (R44, R47, R49). - The report and the JSON file never replace an existing file: they are created with `create_new`, - and a name already taken gets the next free name (`(1)`, `(2)`...), as in R17. `check` and - `extract` replace no file outside the tool's cache folder. One exception writes documents in a - `check` run: extraction chosen at the interactive end of run (R20), through R29. `extract` writes - the signed documents beside the originals (`Relazione.pdf.p7m` -> `Relazione.pdf`) after the two - confirmations of R28 and R29: typing the number of documents is the safeguard. + The report and the JSON file never replace an existing file: they are created with + `create_new`, and a name already taken gets the next free name (`(1)`, `(2)`...), as in R17. + `check` and `extract` replace no file outside the tool's cache folder (R31). One exception + writes documents in a `check` run: extraction chosen at the interactive end of run (R20), + through R29. `extract` writes the signed documents beside the originals (`Relazione.pdf.p7m` -> + `Relazione.pdf`) after the two confirmations of R28 and R29: typing the number of documents is + the safeguard. - R17. Never overwrite: same content already there -> nothing to do; different content -> `Relazione (1).pdf`. Originals are never modified, moved or renamed. - R18. Name without a usable extension: guess it from the content (PDF, ZIP-based office @@ -120,11 +121,21 @@ beside the originals, ready to open. Options: `--open`, `--report`, `--no-report`, `--report-lang `, `--json `, `--threads`, `--offline`, `--trust-lists `, `--trust-list `, `--lang `, `--interactive`, `--plain`, `--no-color`, `--plan`. Help translated (R27). + `--no-report` skips the report of an analysis. An extraction always writes its report, and + its JSON file when `--json` is given, so that `undo` has the list of documents (R33; owner's + decision, 2026-11-23). +- *To decide*: what `--open` and `--threads` do (R23 asks for parallel work, not an option). + `--no-report` skips the report of an analysis. An extraction always writes its report, and + its JSON file when `--json` is given, so that `undo` has the list of documents (R33; owner's + decision, 2026-11-23). +- *To decide*: what `--open` and `--threads` do (R23 asks for parallel work, not an option). - R20. Interactive end of run (double-click on Windows, context menu, `--interactive`): after the analysis, offer to view the report or to extract; extraction goes through the write plan and its confirmation (R29) and reuses the analysis already done. The first report is never rewritten: the extraction writes a second report beside it (next free name, R16) with - the analysis and the documents written, and `undo` uses that one (R33). + the analysis and the documents written, and `undo` uses that one (R33). With `--json` it + also writes a second JSON file beside the first. With `--json` it + also writes a second JSON file beside the first. - R21. `install-menu` / `uninstall-menu` (plan and yes/no question, R19) for the file manager's context menu: Windows per-user registry keys (no admin, no PowerShell); macOS Quick Actions; Linux Nautilus script and Dolphin service menu. Full removal: `uninstall` (R40–R43). @@ -169,8 +180,9 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 `Program Files`, `/System`, `/usr`, `/etc`...), network share roots, or a folder that holds **more than 10,000 files of any kind**, subfolders included: a stronger warning and the user must type the number of files to process (envelopes). The 10,000 count covers the regular - files of the folders the walk visits (R2): files in hidden folders, behind symbolic links - or in unreadable folders are not counted, and a file in overlapping folders counts once. + files of the folders the walk visits (R2). Files in hidden folders, behind symbolic links met + during the walk or in unreadable folders are not counted. A file in overlapping folders + counts once. A selected folder that is itself a symbolic link is resolved and counted (R19). Every path-based kind of risky folder is judged on the path after resolving symbolic links. - R29. **Confirm before writing.** Extraction first builds the complete write plan and shows it: new documents, documents already present with identical content (not rewritten), @@ -181,13 +193,12 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 - Terminal (`std::io::IsTerminal` on input and output): questions in the console (R28, R29, R19). - Context menu: no terminal, started with `--interactive`: the same confirmations in a native - dialog (R38), with a shorter summary than the console. The dialog lists every selected - folder with its number of files to process (envelopes to analyse, R28; documents to write, - R29), the total, the reason when the run is risky (R19) and the operation proposed, then - asks the question. When a number is - required (R28 risky folder, R29) it is typed in a text field and Confirm accepts only the - right number; otherwise the dialog is a yes/no question. In every dialog the focus starts on - Cancel; Enter alone and closing the window cancel; no time limit. + dialog (R38), with a shorter summary than the console. The dialog lists every selected folder + with its number of files to process (envelopes to analyse, R28; documents to write, R29), the + total, the reason when the run is risky (R19) and the operation proposed, then asks the + question. When a number is required (R28 risky folder, R29) it is typed in a text field and + Confirm accepts only the right number; otherwise the dialog is a yes/no question. In every + dialog the focus starts on Cancel; Enter alone and closing the window cancel; no time limit. - Script (no terminal, no `--interactive`): `extract`, `undo`, `install-menu`, `uninstall-menu`, `uninstall` and `check` on a risky folder (R28) stop with exit code 2 and say that a person must confirm. A `y` or a number arriving on a pipe is not a @@ -199,10 +210,12 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 - In code, writing a document requires a `ConfirmedPlan` that only the confirmation step can build (typestate): a path that writes without confirmation does not compile. Originals are held in a read-only `Original` type that write functions do not accept. - - Every file `check` and `extract` write outside the cache (documents, report, JSON) is created - with `OpenOptions::create_new(true)`: the OS refuses if the name exists, even if the file - appeared after the plan; then the next free name (`(1)`, `(2)`...) is used. A partly written - file (error, disk full) is removed, only if we created it. + - Every file the tool writes is created with `OpenOptions::create_new(true)`, except two kinds + of its own files: the fixed-name files of its cache (R47) and its install manifest (R41). + Documents, reports, JSON files and menu items are all created this way: the OS refuses if the + name exists, even if the file appeared after the plan; then the next free name (`(1)`, + `(2)`...) is used. A partly written file (error, disk full) is removed, only if we created + it. - Before writing, each original is re-checked against the analysis (size, mtime, SHA-256); if the folder changed, the plan is rebuilt and confirmed again. - Every target must stay inside the selected folder its envelope was found in, after @@ -247,10 +260,22 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 existing report or JSON file, also one named with `--report` or `--json`, is not replaced: the new one gets the next free name; `extract --plan` names the lists a real run would download; end-to-end tests point the cache to a temporary folder through the system's own - variables (R47), never the user's real one; a file in the cache folder that the tool did - not create is never replaced; + variables (R47), never the user's real one; a file in the cache folder whose name is not + one of the tool's fixed names is never replaced; - interactive end of run (R20): documents are written only through R29, declining writes - none, and an extraction writes a second report without touching the first; + none, and an extraction writes a second report without touching the first; `undo` on the + second report removes the documents, on the first it removes nothing and says so; + - `extract --no-report` still writes the extraction report; + - `install-menu` meeting a foreign item with the same name reports it, leaves it, and + `uninstall` does not remove it; + - the console summary shows both counts in each row and in the totals, and the reason for a + risky run; the dialog shows the reason; `undo` on the + second report removes the documents, on the first it removes nothing and says so; + - `extract --no-report` still writes the extraction report; + - `install-menu` meeting a foreign item with the same name reports it, leaves it, and + `uninstall` does not remove it; + - the console summary shows both counts in each row and in the totals, and the reason for a + risky run; the dialog shows the reason; - risky folder: more than 10,000 files of any kind (subfolders included) is risky even with few envelopes, and the number typed is the files to process; exactly 10,000 is not risky, 10,001 is, also as a total over several folders; files in hidden folders, behind symbolic @@ -307,8 +332,8 @@ Liechtenstein, Norway, United Kingdom). refreshed when their own `NextUpdate` date passes; `uninstall` removes the cache (R40). The cache folder is the operating system's standard one (R42); no option moves it. Tests move it only through the system's own variables (`HOME`, `XDG_CACHE_HOME`, `LOCALAPPDATA`). The tool - replaces only the files with the fixed names it creates there, never another file found in - that folder. + replaces only the files with the fixed names it uses there, never another file found in that + folder. A CRL file is named by a hash of its CA, never by text taken from the input. - R48. **Verdicts.** Qualified status is checked at the reference time (R9) using the service history in the list (a service withdrawn later still validates an earlier signature). A certifier on no list is reported as "not on a European trusted list", distinct from "invalid @@ -405,20 +430,40 @@ public administration checks the applicable obligations (e.g. accessibility stat registry key, plus a hash of the content) in a manifest in the SignSpector config folder; `uninstall` removes only manifest items that still match, reports changed or foreign items and leaves them. If the manifest is lost, entries are recognised by an explicit SignSpector - marker, never by guessing. Running it twice is harmless. + marker, never by guessing. Running it twice is harmless. Each item is created with + `create_new`: when an item with the same name exists and is not in the manifest, + `install-menu` reports it and leaves it, and it never enters the manifest, so `uninstall` + never removes it (owner's decision, 2026-11-23). The manifest is the one file `install-menu` + and `uninstall` replace. Each item is created with + `create_new`: when an item with the same name exists and is not in the manifest, + `install-menu` reports it and leaves it, and it never enters the manifest, so `uninstall` + never removes it (owner's decision, 2026-11-23). The manifest is the one file `install-menu` + and `uninstall` replace. - R42. **Per platform.** - Windows: per-user, no admin: registry keys under `HKCU`, plus an uninstall entry in `HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\SignSpector` so the user finds it - in Settings → Apps; its `UninstallString` runs `signspector.exe uninstall --interactive`, + in Settings -> Apps; its `UninstallString` runs `signspector.exe uninstall --interactive`, which shows the list in a native dialog with the focus on Cancel (R30). A running `.exe` cannot delete itself: the tool says where it is so the user can delete it (no PowerShell, no scheduled tricks). - macOS: Quick Actions in `~/Library/Services`, caches in `~/Library/Caches/SignSpector`, the manifest in `~/Library/Application Support/SignSpector`. - - Linux: Nautilus script, Dolphin service menu, `~/.cache/signspector`, - `~/.config/signspector`. `.deb`/`.rpm` remove only system files they installed; the + - Linux: Nautilus script, Dolphin service menu, the cache in `~/.cache/signspector`, the + manifest in `~/.config/signspector`. `.deb`/`.rpm` remove only system files they installed; the per-user items are removed by `signspector uninstall` (the package's removal message says so). +- *To decide* (before roadmap 3.5): the Windows cache and manifest folders, and how the tool + finds them so that tests can move them. The candidate crate `directories` asks the system + (`SHGetKnownFolderPath`) and ignores `LOCALAPPDATA`, so the test rule of R47 cannot work with + it as is (audit 0007, F2). Tests of `install-menu` must also move the manifest folder. +- *To decide*: whether the dialog of R30 also shows the count of files of any kind, as the + console summary does (R19). +- *To decide* (before roadmap 3.5): the Windows cache and manifest folders, and how the tool + finds them so that tests can move them. The candidate crate `directories` asks the system + (`SHGetKnownFolderPath`) and ignores `LOCALAPPDATA`, so the test rule of R47 cannot work with + it as is (audit 0007, F2). Tests of `install-menu` must also move the manifest folder. +- *To decide*: whether the dialog of R30 also shows the count of files of any kind, as the + console summary does (R19). - R43. **User data is never removed**: originals, extracted documents and reports stay; at the end the tool lists what it left in place on purpose and where the executable is. diff --git a/docs/roadmap.md b/docs/roadmap.md index 3554d0c..2d779fb 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -35,7 +35,12 @@ The order follows two ideas: machine-made patterns (after Wikipedia's "Signs of AI writing"), answer first, short sentences, code and commands verbatim. Rewrite README, design, roadmap, CLAUDE.md and the agent prompts with it; comment in `rust-toolchain.toml` (targets and R25, how to update the - pinned version); session report line when a newer stable Rust exists. + pinned version); session report line when a newer stable Rust exists. The reviews of this + step also led to owner's decisions on requirements (2026-11-23), recorded in + `docs/design.md`: what `check` writes (R16), risky folders counted on files of any kind + (R28), reports never replaced and the second report (R16, R20, R33), `--plan` writing and + downloading nothing (R19), the cache (R47), no saved preference (R27), `--no-report` (R19), + foreign menu items (R41). Questions they opened are listed as *To decide* there. - [ ] 0.5 Remaining gaps in the rule-script tests, found by the reviews of PR #1, PR #2 and PR #3 and accepted as known limits for now (each needs a test before the code changes): - `check-public.sh`: failures of `git show`, `ls-tree`, `diff-tree` are not each tested; From 0fc8394a61921c661354486d1b7b59ebff845392 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:27:47 +0100 Subject: [PATCH 18/36] Remove text pasted twice; restore the cache safeguard (review of c3311f6) c3311f6 left five passages of docs/design.md pasted twice, because an edit script that appends text ran twice. They are removed, and the R34 bullet damaged by the splice is restored. The cache rule of c3311f6 had weakened a safeguard: "never replace a file the tool did not create" became "never replace a file whose name is not a fixed name", so a symbolic link at a fixed name could make a refresh overwrite user data. Now (R31, R47, R34, CLAUDE.md, reviewer prompt): the cache and the manifest are refreshed by writing a new file with create_new under a temporary name and renaming it; the tool never follows a symbolic link there and refuses a name that is not a regular file. A CRL file is named by the SHA-256 of its CA certificate. Contradictions fixed: - a menu item whose name is taken is reported and left, never renamed (R31, README); "foreign" means not in the manifest and without our marker; an existing item of ours is left or reported (R41); - install-menu and uninstall-menu replace the manifest; uninstall removes it; - "symbolic links met during the walk" in R2, R28, R34 and the README; - R47 and R34 point to the open Windows question. New R34 cases: the second JSON file, a CA name with path separators, a link or folder at a cache name or the manifest path, install-menu run twice and after a lost manifest, snapshots of the config and cache folders. New questions, recorded as "To decide" with the roadmap step that needs the answer: create_new for registry keys and .workflow folders (5.1), extract --no-report refused or accepted (4.4), uninstall and foreign files in the cache (5.3). The dialog question moved under R30 (5.2); --open and --threads point to 4.4. Roadmap 0.4 lists the owner's decisions one per line. Co-Authored-By: Claude Opus 5.5 --- .claude/agents/fable-reviewer.md | 26 ++++----- CLAUDE.md | 3 +- README.md | 12 ++-- docs/design.md | 98 +++++++++++++++++--------------- docs/roadmap.md | 31 +++++++--- 5 files changed, 96 insertions(+), 74 deletions(-) diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index a12b83c..20eb335 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -31,19 +31,19 @@ Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). files are never overwritten, not even a report; no panic on malformed input (no `unwrap`/`expect`/indexing on untrusted data outside tests); no PowerShell; no OpenSSL or C dependencies. Confirmation and write safety (R28–R34 in `docs/design.md`) is a fixed point of - every review: look for any path that processes without the first confirmation, writes a document - without a `ConfirmedPlan`, opens any file - for writing without `create_new` (the report and menu items too; only the cache's - fixed-name files and the install manifest are exempt, R31), replaces a file in the cache - that is not one of its fixed names, can write a - document outside the selected folder, lets `--plan` write or download anything, treats a - non-terminal input as a yes, confirms anything from a script (only `check` on an ordinary - folder, `check --plan`, `extract --plan` on an ordinary folder, and the `--plan` lists of - `undo`, the menus and `uninstall` run there), judges time from the signer's claimed signing - time, skips the native dialog of a context-menu run, counts several selected folders wrongly (a - row each, the total typed, overlaps counted once), or produces a file name that is invalid on - another OS (Windows reserved names and characters, trailing dot/space, NFC/NFD or case - collisions, over-long names). + every review: look for any path that processes without the first confirmation, writes a + document without a `ConfirmedPlan`, opens any file for writing without `create_new` (the + report and menu items too; only the cache files, under names the tool derives, and the install + manifest are exempt, R31), replaces a file in the cache under a name it does not derive, + follows a symbolic link in the cache or at the manifest, can write a document outside the + selected folder, lets `--plan` write or download anything, treats a non-terminal input as a + yes, confirms anything from a script (only `check` on an ordinary folder, `check --plan`, + `extract --plan` on an ordinary folder, and the `--plan` lists of `undo`, the menus and + `uninstall` run there), judges time from the signer's claimed signing time, skips the native + dialog of a context-menu run, counts several selected folders wrongly (a row each, the total + typed, overlaps counted once), or produces a file name that is invalid on another OS (Windows + reserved names and characters, trailing dot/space, NFC/NFD or case collisions, over-long + names). 4. **Language**: code, comments, docs and developer messages in English. User-facing texts of the tool go through the translation layer (R27 in `docs/design.md`), never hard-coded, and every new text has its Italian translation. Every changed text (docs, comments, commit diff --git a/CLAUDE.md b/CLAUDE.md index fb24fee..8fa2717 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -158,7 +158,8 @@ in the history even if deleted later. Before every commit and push: (R29); no implicit yes, ever (R30: terminal, dialog from the context menu, refusal in scripts). Documents are written only through a `ConfirmedPlan` and never outside the chosen folder; every file the tool writes is created with `create_new`, the report too, except - the fixed-name files of its cache and its install manifest (R31). + its cache files and its install manifest, which are refreshed through a temporary file and a + rename, never through a symbolic link (R31, R47). File names valid on Windows, macOS and Linux at once (R32). Any change here needs the tests of R34. - **Accessibility is a requirement, not a polish step** (EN 301 549; WCAG 2.2 AA for the diff --git a/README.md b/README.md index 58fbd78..1c48544 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,8 @@ cannot damage them: - a folder that holds more than 10,000 files of any kind, subfolders included. A run is also risky when the folders chosen hold more than 10,000 files in all. Files the - analysis skips are not counted (hidden folders, symbolic links, unreadable folders), and a + analysis skips are not counted (hidden folders, symbolic links inside the folders, unreadable + folders), and a file in overlapping folders counts once. - From the context menu, the same confirmations appear in a window. - In scripts, only these run: @@ -67,10 +68,11 @@ cannot damage them: Everything else stops and says that a person must confirm. - Originals are read-only. They are never modified, moved or renamed. -- Nothing is ever overwritten, not even an earlier report or a menu entry that is not - SignSpector's. Every file is created with an exclusive "create new" operation, so the - operating system itself refuses to overwrite. A name clash becomes `x (1).pdf`. Only the - tool's own cache and its install record are refreshed in place. +- Nothing is ever overwritten, not even an earlier report. Every file is created with an + exclusive "create new" operation, so the operating system itself refuses to overwrite. A + document or report whose name is taken becomes `x (1).pdf`. A menu entry that is not + SignSpector's is reported and left alone. Only the tool's own cache and its manifest (the + list of what it installed) are refreshed, and never through a symbolic link. - Extracted documents are never written outside the chosen folder. File names taken from the signed files are made valid on Windows, macOS and Linux at once: no forbidden characters, no reserved names, no clashes that differ only in letter case or Unicode form. diff --git a/docs/design.md b/docs/design.md index e6a5420..801d4e7 100644 --- a/docs/design.md +++ b/docs/design.md @@ -21,7 +21,8 @@ beside the originals, ready to open. `archivio.p7m` is not an envelope). - *To decide*: a file named exactly `.p7m` (no stem) is not an envelope today: list it in the report as skipped? Are stand-alone time-stamp responses `.tsr` an input format? -- R2. Unreadable folders are reported and skipped; the walk goes on. Symbolic links are not +- R2. Unreadable folders are reported and skipped; the walk goes on. Symbolic links met during + the walk (not a selected folder, R19, R28) are not followed and hidden folders (name starting with `.`) are skipped; both are listed in the report, so nothing is left out silently. @@ -124,18 +125,16 @@ beside the originals, ready to open. `--no-report` skips the report of an analysis. An extraction always writes its report, and its JSON file when `--json` is given, so that `undo` has the list of documents (R33; owner's decision, 2026-11-23). -- *To decide*: what `--open` and `--threads` do (R23 asks for parallel work, not an option). - `--no-report` skips the report of an analysis. An extraction always writes its report, and - its JSON file when `--json` is given, so that `undo` has the list of documents (R33; owner's - decision, 2026-11-23). -- *To decide*: what `--open` and `--threads` do (R23 asks for parallel work, not an option). +- *To decide* (before roadmap 4.4): what `--open` and `--threads` do (R23 asks for parallel + work, not an option); whether `extract --no-report` is refused as a usage error or accepted + with a message saying the extraction report is written anyway. - R20. Interactive end of run (double-click on Windows, context menu, `--interactive`): after the analysis, offer to view the report or to extract; extraction goes through the write plan and its confirmation (R29) and reuses the analysis already done. The first report is never rewritten: the extraction writes a second report beside it (next free name, R16) with the analysis and the documents written, and `undo` uses that one (R33). With `--json` it - also writes a second JSON file beside the first. With `--json` it - also writes a second JSON file beside the first. + also writes a second JSON file beside the first. After `check --no-report` there is no first + report: the extraction report is the only one. - R21. `install-menu` / `uninstall-menu` (plan and yes/no question, R19) for the file manager's context menu: Windows per-user registry keys (no admin, no PowerShell); macOS Quick Actions; Linux Nautilus script and Dolphin service menu. Full removal: `uninstall` (R40–R43). @@ -166,10 +165,10 @@ beside the originals, ready to open. ### Confirmation and write safety Nothing is ever processed right after a person chooses a folder, and no document is written without a second, separate confirmation. `check` and `extract` never replace an existing file; -only the tool's own cache is refreshed in place (R16). A folder named in a script has no -person to ask: an ordinary folder is analysed (`check` writes only the report, HTML and JSON, -and the tool's cache, R16); a -risky one is refused, only counted by `check --plan`, and nothing is written (R30). +only the tool's own cache is refreshed in place (R16; the general rule is R31). A folder named in +a script has no person to ask: an ordinary folder is analysed (`check` writes only the report, +HTML and JSON, and the tool's cache, R16); a risky one is refused, only counted by `check +--plan`, and nothing is written (R30). - R28. **Confirm before analysing.** After the folders are chosen the tool only counts (no envelope is opened) and asks, default No (Enter alone cancels): @@ -199,6 +198,8 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 question. When a number is required (R28 risky folder, R29) it is typed in a text field and Confirm accepts only the right number; otherwise the dialog is a yes/no question. In every dialog the focus starts on Cancel; Enter alone and closing the window cancel; no time limit. + *To decide* (before roadmap 5.2): whether the dialog also shows the count of files of any + kind, as the console summary does (R19). - Script (no terminal, no `--interactive`): `extract`, `undo`, `install-menu`, `uninstall-menu`, `uninstall` and `check` on a risky folder (R28) stop with exit code 2 and say that a person must confirm. A `y` or a number arriving on a pipe is not a @@ -211,11 +212,14 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 build (typestate): a path that writes without confirmation does not compile. Originals are held in a read-only `Original` type that write functions do not accept. - Every file the tool writes is created with `OpenOptions::create_new(true)`, except two kinds - of its own files: the fixed-name files of its cache (R47) and its install manifest (R41). - Documents, reports, JSON files and menu items are all created this way: the OS refuses if the - name exists, even if the file appeared after the plan; then the next free name (`(1)`, - `(2)`...) is used. A partly written file (error, disk full) is removed, only if we created - it. + of its own files: the files of its cache, under the names it derives itself (R47), and its + install manifest (R41). These are refreshed safely: a new file is written with `create_new` + under a temporary name in the same folder, then renamed over the old one; the tool never + follows a symbolic link there and refuses a name that is not a regular file. Documents, + reports, JSON files and menu items are all created this way: the OS refuses if the name + exists, even if the file appeared after the plan. A document, report or JSON file then takes + the next free name (`(1)`, `(2)`...); a menu item is reported and left (R41). A partly + written file (error, disk full) is removed, only if we created it. - Before writing, each original is re-checked against the analysis (size, mtime, SHA-256); if the folder changed, the plan is rebuilt and confirmed again. - Every target must stay inside the selected folder its envelope was found in, after @@ -260,18 +264,20 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 existing report or JSON file, also one named with `--report` or `--json`, is not replaced: the new one gets the next free name; `extract --plan` names the lists a real run would download; end-to-end tests point the cache to a temporary folder through the system's own - variables (R47), never the user's real one; a file in the cache folder whose name is not - one of the tool's fixed names is never replaced; + variables (R47; Windows to decide), never the user's real one; a file in the cache folder + under a name the tool does not derive is never replaced; a symbolic link or a folder at + one of the tool's own names (cache or manifest) is refused, never followed; a CA whose name + holds `../` or a separator gives a cache file named only by the hash, inside the folder; + - only the manifest and the cache files are replaced: snapshots of the config and cache + folders around `install-menu`, `uninstall-menu` and a list refresh; + - `install-menu` run twice changes nothing; after a lost manifest, our marked items are + recognised and a foreign item never enters the manifest; + - with `--json`, an extraction at the interactive end of run writes a second JSON file and + leaves the first; `extract --no-report --json f` still writes `f`; - interactive end of run (R20): documents are written only through R29, declining writes none, and an extraction writes a second report without touching the first; `undo` on the second report removes the documents, on the first it removes nothing and says so; - `extract --no-report` still writes the extraction report; - - `install-menu` meeting a foreign item with the same name reports it, leaves it, and - `uninstall` does not remove it; - - the console summary shows both counts in each row and in the totals, and the reason for a - risky run; the dialog shows the reason; `undo` on the - second report removes the documents, on the first it removes nothing and says so; - - `extract --no-report` still writes the extraction report; - `install-menu` meeting a foreign item with the same name reports it, leaves it, and `uninstall` does not remove it; - the console summary shows both counts in each row and in the totals, and the reason for a @@ -279,7 +285,8 @@ risky one is refused, only counted by `check --plan`, and nothing is written (R3 - risky folder: more than 10,000 files of any kind (subfolders included) is risky even with few envelopes, and the number typed is the files to process; exactly 10,000 is not risky, 10,001 is, also as a total over several folders; files in hidden folders, behind symbolic - links or in unreadable folders are not counted, and overlaps are counted once; + links met during the walk or in unreadable folders are not counted, a selected folder that + is a symbolic link is resolved and counted, and overlaps are counted once; - time: a back-dated signing-time attribute changes no verdict; without a time stamp the report says "claimed, not proved" (R9); - yes/no question: Enter alone cancels, `y` on a pipe is refused, a number is not a yes; @@ -331,9 +338,11 @@ Liechtenstein, Norway, United Kingdom). - R47. **Cache.** Lists (and the CRLs of R49) are cached in the SignSpector cache folder and refreshed when their own `NextUpdate` date passes; `uninstall` removes the cache (R40). The cache folder is the operating system's standard one (R42); no option moves it. Tests move it - only through the system's own variables (`HOME`, `XDG_CACHE_HOME`, `LOCALAPPDATA`). The tool - replaces only the files with the fixed names it uses there, never another file found in that - folder. A CRL file is named by a hash of its CA, never by text taken from the input. + only through the system's own variables (`HOME`, `XDG_CACHE_HOME`; Windows: to decide, see + after R42). The tool replaces only files under the names it derives itself: one fixed name + per list, and for a CRL the SHA-256 of its CA certificate, never text taken from the input. + It never replaces another file found in that folder, never follows a symbolic link there, + and refreshes a file as R31 says (temporary file, then rename). - R48. **Verdicts.** Qualified status is checked at the reference time (R9) using the service history in the list (a service withdrawn later still validates an earlier signature). A certifier on no list is reported as "not on a European trusted list", distinct from "invalid @@ -431,14 +440,13 @@ public administration checks the applicable obligations (e.g. accessibility stat `uninstall` removes only manifest items that still match, reports changed or foreign items and leaves them. If the manifest is lost, entries are recognised by an explicit SignSpector marker, never by guessing. Running it twice is harmless. Each item is created with - `create_new`: when an item with the same name exists and is not in the manifest, - `install-menu` reports it and leaves it, and it never enters the manifest, so `uninstall` - never removes it (owner's decision, 2026-11-23). The manifest is the one file `install-menu` - and `uninstall` replace. Each item is created with - `create_new`: when an item with the same name exists and is not in the manifest, - `install-menu` reports it and leaves it, and it never enters the manifest, so `uninstall` - never removes it (owner's decision, 2026-11-23). The manifest is the one file `install-menu` - and `uninstall` replace. + `create_new` (on Windows: a registry key created only if it did not exist; Q1 below). An + item is foreign when it is not in the manifest and has no SignSpector marker. When a foreign + item has the same name, `install-menu` reports it and leaves it, and it never enters the + manifest. So `uninstall` never removes it (owner's decision, 2026-11-23). An item of ours + that already exists (in the manifest, or marked after a lost manifest) is left as it is if + unchanged, and reported if changed. `install-menu` and `uninstall-menu` are the only commands + that replace the manifest; `uninstall` removes it (R40). - R42. **Per platform.** - Windows: per-user, no admin: registry keys under `HKCU`, plus an uninstall entry in `HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\SignSpector` so the user finds it @@ -455,15 +463,13 @@ public administration checks the applicable obligations (e.g. accessibility stat - *To decide* (before roadmap 3.5): the Windows cache and manifest folders, and how the tool finds them so that tests can move them. The candidate crate `directories` asks the system (`SHGetKnownFolderPath`) and ignores `LOCALAPPDATA`, so the test rule of R47 cannot work with - it as is (audit 0007, F2). Tests of `install-menu` must also move the manifest folder. -- *To decide*: whether the dialog of R30 also shows the count of files of any kind, as the - console summary does (R19). -- *To decide* (before roadmap 3.5): the Windows cache and manifest folders, and how the tool - finds them so that tests can move them. The candidate crate `directories` asks the system - (`SHGetKnownFolderPath`) and ignores `LOCALAPPDATA`, so the test rule of R47 cannot work with - it as is (audit 0007, F2). Tests of `install-menu` must also move the manifest folder. -- *To decide*: whether the dialog of R30 also shows the count of files of any kind, as the - console summary does (R19). + it as is (audit 0007, F2). Tests of `install-menu` must also move the manifest folder + (`XDG_CONFIG_HOME`, `APPDATA`). +- *To decide* (before roadmap 5.1): Q1, how `create_new` applies to a registry key (for + example `RegCreateKeyEx`, accepted only when the key was created new, also for the + `Uninstall\SignSpector` key) and to a macOS Quick Action, which is a `.workflow` folder. +- *To decide* (before roadmap 5.3): whether `uninstall` removes a file in the cache folder that + the tool did not write, or leaves and lists it (R40, R43). - R43. **User data is never removed**: originals, extracted documents and reports stay; at the end the tool lists what it left in place on purpose and where the executable is. diff --git a/docs/roadmap.md b/docs/roadmap.md index 2d779fb..aaffb4a 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -37,10 +37,18 @@ The order follows two ideas: agent prompts with it; comment in `rust-toolchain.toml` (targets and R25, how to update the pinned version); session report line when a newer stable Rust exists. The reviews of this step also led to owner's decisions on requirements (2026-11-23), recorded in - `docs/design.md`: what `check` writes (R16), risky folders counted on files of any kind - (R28), reports never replaced and the second report (R16, R20, R33), `--plan` writing and - downloading nothing (R19), the cache (R47), no saved preference (R27), `--no-report` (R19), - foreign menu items (R41). Questions they opened are listed as *To decide* there. + `docs/design.md`: + - what `check` writes (R16); + - risky folders counted on files of any kind (R28); + - reports never replaced, and the second report (R16, R20, R33); + - `--plan` writes and downloads nothing (R19); + - the cache (R47); + - no saved preference (R27); + - `--no-report` (R19); + - foreign menu items (R41). + + The questions they opened are listed as *To decide* in `docs/design.md`, each with the + roadmap step that needs the answer (3.5, 4.4, 5.1, 5.2, 5.3). - [ ] 0.5 Remaining gaps in the rule-script tests, found by the reviews of PR #1, PR #2 and PR #3 and accepted as known limits for now (each needs a test before the code changes): - `check-public.sh`: failures of `git show`, `ls-tree`, `diff-tree` are not each tested; @@ -134,7 +142,8 @@ The order follows two ideas: - [ ] 3.4 `tsl`: LOTL and national lists, signatures verified, embedded LOTL + Italian list, service history (R44, R48). - [ ] 3.5 Choice of lists from the certifiers' countries, download, cache, `--trust-lists`, - `--offline` (R45–R47). + `--offline` (R45–R47). First decide the Windows cache folder and how tests move it (*To + decide* after R42 in `docs/design.md`). - [ ] 3.6 Chain building against the TSL and the system store (R10). - [ ] 3.7 Countersignatures (R11); `tsp`: RFC 3161, `.tsd`, `.m7m` (R5, R12); detached `.p7s` (R6). A time stamp is a proved time (R9) only if it verifies per R12 (chain to a trusted-list @@ -154,15 +163,19 @@ The order follows two ideas: - [ ] 4.1 Console summary, colours with contrast, exit codes (R13, R35). - [ ] 4.2 Accessible HTML report, WCAG 2.2 AA (R14, R36), checker in CI (R39). - [ ] 4.3 Full `--json` (R15); parallel processing with stable output order (R23). -- [ ] 4.4 Command line and translated help, interactive end of run (R19, R20, R37). +- [ ] 4.4 Command line and translated help, interactive end of run (R19, R20, R37). First + decide `--open`, `--threads` and `extract --no-report` (*To decide* in R19). ## Phase 5: system integration -- [ ] 5.1 Install manifest (R41). +- [ ] 5.1 Install manifest (R41). First decide how `create_new` applies to registry keys and + `.workflow` folders (*To decide* after R42). - [ ] 5.2 Context menu per OS (R21, R38) with the confirmation dialogs (R30): decide what the shorter dialog summary must still show (unreadable folders, alternative names, "existing files - modified: 0", a way to see the full list; the list for `undo`, menus and `uninstall`), with + modified: 0", a way to see the full list; the list for `undo`, menus and `uninstall`; the + count of files of any kind, *To decide* in R30), with R34 tests; Windows "Installed apps" entry (R42). -- [ ] 5.3 `uninstall` (R40–R43). +- [ ] 5.3 `uninstall` (R40–R43). First decide what happens to a file in the cache folder that + the tool did not write (*To decide* after R42 in `docs/design.md`). ## Phase 6: release - [ ] 6.1 Builds for all targets; `.deb`, `.rpm`, `.tar.gz` (R24, R25); one self-contained From cebaf407a7944f31fbd9610bcc7c994b7f8b2817 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:34:41 +0100 Subject: [PATCH 19/36] Fix four contradictions of 0fc8394; record the new open questions From the review of 0fc8394: - R34 no longer assumes the answer on `extract --no-report`: both outcomes are stated until the To decide after R19 settles it. - R31: documents, reports, JSON files and menu items are created with create_new; the replacement of cache files and the manifest (temporary file, rename, no symbolic link, regular files only) is its own bullet. - The write-safety intro says cache files are replaced as R31 says, not "refreshed in place". - The Windows test question no longer offers APPDATA; HOME is named for macOS. - CLAUDE.md, the README and the reviewer prompt carry the full cache rule (derived names, regular files only); "symbolic links met during the walk" in the README and roadmap 1.5; the (1) rule names JSON files; R41 points to the open registry question. New questions, recorded as To decide with the roadmap step that needs them: a selected hidden folder (1.5); menu item upgrade, lost manifest, refusal at the manifest path, Windows registry in tests (5.1); a refusal at a cache name, a linked cache folder, list file names, --trust-list caching (3.5); partitioned CRLs (3.9); leftover temporary files (5.3). Co-Authored-By: Claude Opus 5.5 --- .claude/agents/fable-reviewer.md | 3 +- CLAUDE.md | 5 +-- README.md | 6 ++-- docs/design.md | 57 ++++++++++++++++++++++---------- docs/roadmap.md | 30 +++++++++-------- 5 files changed, 64 insertions(+), 37 deletions(-) diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index 20eb335..2cd6f0a 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -35,7 +35,8 @@ Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). document without a `ConfirmedPlan`, opens any file for writing without `create_new` (the report and menu items too; only the cache files, under names the tool derives, and the install manifest are exempt, R31), replaces a file in the cache under a name it does not derive, - follows a symbolic link in the cache or at the manifest, can write a document outside the + follows a symbolic link in the cache or at the manifest, replaces a name there that is not a + regular file, can write a document outside the selected folder, lets `--plan` write or download anything, treats a non-terminal input as a yes, confirms anything from a script (only `check` on an ordinary folder, `check --plan`, `extract --plan` on an ordinary folder, and the `--plan` lists of `undo`, the menus and diff --git a/CLAUDE.md b/CLAUDE.md index 8fa2717..b890d13 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -158,8 +158,9 @@ in the history even if deleted later. Before every commit and push: (R29); no implicit yes, ever (R30: terminal, dialog from the context menu, refusal in scripts). Documents are written only through a `ConfirmedPlan` and never outside the chosen folder; every file the tool writes is created with `create_new`, the report too, except - its cache files and its install manifest, which are refreshed through a temporary file and a - rename, never through a symbolic link (R31, R47). + its cache files (under the names it derives itself) and its install manifest, which are + replaced through a temporary file and a rename, never through a symbolic link and never when + the name is not a regular file (R31, R47). File names valid on Windows, macOS and Linux at once (R32). Any change here needs the tests of R34. - **Accessibility is a requirement, not a polish step** (EN 301 549; WCAG 2.2 AA for the diff --git a/README.md b/README.md index 1c48544..60e40a0 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ signatures. For each folder, SignSpector: - finds every signed or time-stamped file in it and its subfolders (hidden folders and - symbolic links are skipped and listed in the report); + symbolic links met inside are skipped and listed in the report); - opens every layer: BER/DER encoding (including indefinite lengths), base64 encoding, nested signatures, RFC 5544 time-stamped data; - verifies each signature (RSA, RSA-PSS, ECDSA; SHA-1/2) and the signer's certificate @@ -70,9 +70,9 @@ cannot damage them: - Originals are read-only. They are never modified, moved or renamed. - Nothing is ever overwritten, not even an earlier report. Every file is created with an exclusive "create new" operation, so the operating system itself refuses to overwrite. A - document or report whose name is taken becomes `x (1).pdf`. A menu entry that is not + document, report or JSON file whose name is taken becomes `x (1).pdf`. A menu entry that is not SignSpector's is reported and left alone. Only the tool's own cache and its manifest (the - list of what it installed) are refreshed, and never through a symbolic link. + list of what it installed) are replaced, through a new file, never through a symbolic link. - Extracted documents are never written outside the chosen folder. File names taken from the signed files are made valid on Windows, macOS and Linux at once: no forbidden characters, no reserved names, no clashes that differ only in letter case or Unicode form. diff --git a/docs/design.md b/docs/design.md index 801d4e7..5c8f2d5 100644 --- a/docs/design.md +++ b/docs/design.md @@ -22,9 +22,10 @@ beside the originals, ready to open. - *To decide*: a file named exactly `.p7m` (no stem) is not an envelope today: list it in the report as skipped? Are stand-alone time-stamp responses `.tsr` an input format? - R2. Unreadable folders are reported and skipped; the walk goes on. Symbolic links met during - the walk (not a selected folder, R19, R28) are not - followed and hidden folders (name starting with `.`) are skipped; both are listed in the - report, so nothing is left out silently. + the walk (not a selected folder, R19, R28) are not followed, and hidden folders (name starting + with `.`) are skipped; both are listed in the report, so nothing is left out silently. +- *To decide* (before roadmap 1.5): a selected folder whose own name starts with `.`: analysed + or skipped? ### Opening envelopes - R3. Read CMS SignedData in BER, including indefinite lengths (common in real files), and in @@ -165,7 +166,7 @@ beside the originals, ready to open. ### Confirmation and write safety Nothing is ever processed right after a person chooses a folder, and no document is written without a second, separate confirmation. `check` and `extract` never replace an existing file; -only the tool's own cache is refreshed in place (R16; the general rule is R31). A folder named in +only the tool's own cache files are replaced (R16), as R31 says. A folder named in a script has no person to ask: an ordinary folder is analysed (`check` writes only the report, HTML and JSON, and the tool's cache, R16); a risky one is refused, only counted by `check --plan`, and nothing is written (R30). @@ -213,13 +214,15 @@ HTML and JSON, and the tool's cache, R16); a risky one is refused, only counted held in a read-only `Original` type that write functions do not accept. - Every file the tool writes is created with `OpenOptions::create_new(true)`, except two kinds of its own files: the files of its cache, under the names it derives itself (R47), and its - install manifest (R41). These are refreshed safely: a new file is written with `create_new` - under a temporary name in the same folder, then renamed over the old one; the tool never - follows a symbolic link there and refuses a name that is not a regular file. Documents, - reports, JSON files and menu items are all created this way: the OS refuses if the name - exists, even if the file appeared after the plan. A document, report or JSON file then takes - the next free name (`(1)`, `(2)`...); a menu item is reported and left (R41). A partly - written file (error, disk full) is removed, only if we created it. + install manifest (R41). Documents, reports, JSON files and menu items are all created with + `create_new`: the OS refuses if the name exists, even if the file appeared after the plan. + A document, report or JSON file then takes the next free name (`(1)`, `(2)`...); a menu item + is reported and left (R41; registry keys and `.workflow` folders: *To decide* after R42). A + partly written file (error, disk full) is removed, only if we created it. + - A cache file or the manifest is replaced in two steps. The tool writes the new content with + `create_new` under a temporary name in the same folder. Then it renames that file over the + old one. It never follows a symbolic link there, and it refuses a name that is not a + regular file. - Before writing, each original is re-checked against the analysis (size, mtime, SHA-256); if the folder changed, the plan is rebuilt and confirmed again. - Every target must stay inside the selected folder its envelope was found in, after @@ -273,11 +276,13 @@ HTML and JSON, and the tool's cache, R16); a risky one is refused, only counted - `install-menu` run twice changes nothing; after a lost manifest, our marked items are recognised and a foreign item never enters the manifest; - with `--json`, an extraction at the interactive end of run writes a second JSON file and - leaves the first; `extract --no-report --json f` still writes `f`; + leaves the first; `extract --no-report --json f` writes `f`, or is refused with exit 2 + and writes nothing, as the *To decide* after R19 settles; - interactive end of run (R20): documents are written only through R29, declining writes none, and an extraction writes a second report without touching the first; `undo` on the second report removes the documents, on the first it removes nothing and says so; - - `extract --no-report` still writes the extraction report; + - `extract --no-report` writes the extraction report, or is refused with exit 2 and writes + nothing, as the *To decide* after R19 settles; - `install-menu` meeting a foreign item with the same name reports it, leaves it, and `uninstall` does not remove it; - the console summary shows both counts in each row and in the totals, and the reason for a @@ -440,7 +445,7 @@ public administration checks the applicable obligations (e.g. accessibility stat `uninstall` removes only manifest items that still match, reports changed or foreign items and leaves them. If the manifest is lost, entries are recognised by an explicit SignSpector marker, never by guessing. Running it twice is harmless. Each item is created with - `create_new` (on Windows: a registry key created only if it did not exist; Q1 below). An + `create_new` (registry keys and `.workflow` folders: see *To decide* after R42). An item is foreign when it is not in the manifest and has no SignSpector marker. When a foreign item has the same name, `install-menu` reports it and leaves it, and it never enters the manifest. So `uninstall` never removes it (owner's decision, 2026-11-23). An item of ours @@ -464,12 +469,30 @@ public administration checks the applicable obligations (e.g. accessibility stat finds them so that tests can move them. The candidate crate `directories` asks the system (`SHGetKnownFolderPath`) and ignores `LOCALAPPDATA`, so the test rule of R47 cannot work with it as is (audit 0007, F2). Tests of `install-menu` must also move the manifest folder - (`XDG_CONFIG_HOME`, `APPDATA`). -- *To decide* (before roadmap 5.1): Q1, how `create_new` applies to a registry key (for + (`XDG_CONFIG_HOME` on Linux, `HOME` on macOS; Windows open, as for the cache). +- *To decide* (before roadmap 5.1): how `create_new` applies to a registry key (for example `RegCreateKeyEx`, accepted only when the key was created new, also for the `Uninstall\SignSpector` key) and to a macOS Quick Action, which is a `.workflow` folder. - *To decide* (before roadmap 5.3): whether `uninstall` removes a file in the cache folder that - the tool did not write, or leaves and lists it (R40, R43). + the tool did not write, or leaves and lists it (R40, R43); and how leftover temporary files + of an interrupted refresh (R31) are named, skipped and removed. +- *To decide* (before roadmap 5.1), menu items (R41): + - an item of ours that matches the manifest but not what the current version would write + (after an update or a moved executable): updated, or reported; + - after a lost manifest, what a marked item is compared with, and whether it enters the new + manifest; + - a symbolic link or a folder at the manifest path: `install-menu` refuses before it creates + any item; + - Windows `HKCU` and the menu folders (`~/Library/Services`, Nautilus, Dolphin) in tests, + and in the R34 snapshots. +- *To decide* (before roadmap 3.5), cache (R47): + - a refusal at a cache name: the run goes on with the list in memory, or reports "list not + available"; + - the cache folder, or a folder above it, being a symbolic link (redirected profiles); + - the territory code of a national list is checked (two letters) before it becomes a file + name; whether a list given with `--trust-list ` is cached. +- *To decide* (before roadmap 3.9): a CA that publishes partitioned CRLs has several CRLs: + name each file by the hash of the CA and of the distribution point, or keep one (R49). - R43. **User data is never removed**: originals, extracted documents and reports stay; at the end the tool lists what it left in place on purpose and where the executable is. diff --git a/docs/roadmap.md b/docs/roadmap.md index aaffb4a..ea9e976 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -105,11 +105,13 @@ The order follows two ideas: `Relazione.pdf.p7m` -> `Relazione.pdf`, nested `.pdf.p7m.tsd`, uppercase extensions. - [ ] 1.4 **i18n skeleton** (R27): pick the mechanism (Fluent vs `rust-i18n`, decided with the user), English + Italian, `--lang`, OS language detection. Needed before any message below. -- [ ] 1.5 **Walk and count** (R1b, R2, R19, R28): one or more folders, a row per folder and the - total; regular files only, symbolic links not followed and hidden folders skipped (both listed in - the report), unreadable folders listed; two counts (files to process, files of any kind), total - size, subfolders. Risky-folder detection (drive roots, home, Desktop, Documents, system folders, - network share roots, > 10,000 files of any kind, subfolders included). +- [ ] 1.5 **Walk and count** (first decide the selected hidden folder, *To decide* after R2) + (R1b, R2, R19, R28): one or more folders, a row per folder and the total; regular files only, + symbolic links met during the walk not followed (a selected one is resolved) and hidden folders + skipped (both listed in the report), unreadable folders listed; two counts (files to process, + files of any kind), total size, subfolders. Risky-folder detection (drive roots, home, Desktop, + Documents, system folders, network share roots, > 10,000 files of any kind, subfolders + included). - [ ] 1.6 **Confirmation logic** (R28–R30): pure functions turning (counts, folder, terminal, dialog via `--interactive`, or script; `--plan`) into the question to ask and parsing the answer: typed count (R28 risky folder, @@ -150,21 +152,21 @@ The order follows two ideas: TSA); negative test: a forged or untrusted time stamp changes no verdict. Which time stamp counts when there are several. - [ ] 3.8 Content sniffing for names without a usable extension (R18). -- [ ] 3.9 Revocation (R49): define the case of a revocation time equal to the time stamp; data - embedded in the signature, CRL per CA with cache, one check per certificate, "revocation not - checked" offline. Negative tests: revoked before and after the time stamp, revoked with no - time stamp (cannot be determined, never invalid), stale or forged embedded data, forged or - oversized CRL, CRL older than the reference time, expired certificate no longer listed, - distribution point outside `http`/`https`. Also to define with the tests: revocation reasons - (`removeFromCRL`, `keyCompromise`); an embedded CRL older than the reference time when the - CA's CRL cannot be fetched ("revocation not checked"). +- [ ] 3.9 Revocation (R49): decide partitioned CRLs (*To decide* after R42); define the case of a + revocation time equal to the time stamp; data embedded in the signature, CRL per CA with cache, + one check per certificate, "revocation not checked" offline. Negative tests: revoked before and + after the time stamp, revoked with no time stamp (cannot be determined, never invalid), stale + or forged embedded data, forged or oversized CRL, CRL older than the reference time, expired + certificate no longer listed, distribution point outside `http`/`https`. Also to define with + the tests: revocation reasons (`removeFromCRL`, `keyCompromise`); an embedded CRL older than + the reference time when the CA's CRL cannot be fetched ("revocation not checked"). ## Phase 4: output - [ ] 4.1 Console summary, colours with contrast, exit codes (R13, R35). - [ ] 4.2 Accessible HTML report, WCAG 2.2 AA (R14, R36), checker in CI (R39). - [ ] 4.3 Full `--json` (R15); parallel processing with stable output order (R23). - [ ] 4.4 Command line and translated help, interactive end of run (R19, R20, R37). First - decide `--open`, `--threads` and `extract --no-report` (*To decide* in R19). + decide `--open`, `--threads` and `extract --no-report` (*To decide* after R19). ## Phase 5: system integration - [ ] 5.1 Install manifest (R41). First decide how `create_new` applies to registry keys and From 8bdf261311dad1e9a97a3a3ea8779bae927c4156 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 17:39:45 +0100 Subject: [PATCH 20/36] Rewrite docs/design.md to the writing guide; one place per rule The owner chose one rewrite instead of more patches (2026-11-23): each round of patches left the same rule worded differently in several places. docs/design.md: - Section headings are the reader's questions, answers come first, long rules are split into short bullets. Requirement numbers R1a to R49 and their meaning are unchanged, apart from the review fixes below. - Each rule is written once: how every file is written and which files are ever replaced is R31; the cache is R47; what each command writes is R16. Other places point to them. - Every open question is in one section, "What is still open?", grouped by the roadmap step that needs the answer (1.4, 1.5, 1.7, 3.5, 3.6, 3.9, 4.2, 4.4, 5.1, 5.2, 5.3). The old "Open questions" and the scattered "To decide" items moved there. Review of cebaf40, closed in the rewrite: - R31: every file is created with create_new, temporary files included; only cache files and the manifest are ever replaced, by a rename; a name that exists and is not a regular file is refused (C3, C4). - R47 and R49 point to the open question on partitioned CRLs (C5); list file names and temporary names are open questions for 3.5 (C6, C7). - One R34 bullet for extraction reports and `extract --no-report` (M1). - New questions recorded: a selected hidden folder via `.` or links, non-regular files at cache names, the manifest path for uninstall-menu and uninstall, updating a menu item, which menu folders tests cannot move. CLAUDE.md, the README and the reviewer prompt now point to R31 instead of restating it. Every roadmap step with an open question points to it. Co-Authored-By: Claude Opus 5.5 --- .claude/agents/fable-reviewer.md | 8 +- CLAUDE.md | 7 +- README.md | 7 +- docs/design.md | 962 ++++++++++++++++--------------- docs/roadmap.md | 50 +- 5 files changed, 544 insertions(+), 490 deletions(-) diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index 2cd6f0a..4fe1651 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -32,11 +32,9 @@ Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). `unwrap`/`expect`/indexing on untrusted data outside tests); no PowerShell; no OpenSSL or C dependencies. Confirmation and write safety (R28–R34 in `docs/design.md`) is a fixed point of every review: look for any path that processes without the first confirmation, writes a - document without a `ConfirmedPlan`, opens any file for writing without `create_new` (the - report and menu items too; only the cache files, under names the tool derives, and the install - manifest are exempt, R31), replaces a file in the cache under a name it does not derive, - follows a symbolic link in the cache or at the manifest, replaces a name there that is not a - regular file, can write a document outside the + document without a `ConfirmedPlan`, breaks any part of R31 (a file opened without + `create_new`, a file replaced in place, a file replaced other than a cache file or the manifest, + a symbolic link followed, a non-regular file replaced), can write a document outside the selected folder, lets `--plan` write or download anything, treats a non-terminal input as a yes, confirms anything from a script (only `check` on an ordinary folder, `check --plan`, `extract --plan` on an ordinary folder, and the `--plan` lists of `undo`, the menus and diff --git a/CLAUDE.md b/CLAUDE.md index b890d13..4183fd2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -156,11 +156,8 @@ in the history even if deleted later. Before every commit and push: confirmation (R28; from a script an ordinary folder is analysed without a question, a risky one is refused); writing needs a second confirmation on the full write plan, with the number typed (R29); no implicit yes, ever (R30: terminal, dialog from the context menu, refusal in - scripts). Documents are written only through a `ConfirmedPlan` and never outside the chosen - folder; every file the tool writes is created with `create_new`, the report too, except - its cache files (under the names it derives itself) and its install manifest, which are - replaced through a temporary file and a rename, never through a symbolic link and never when - the name is not a regular file (R31, R47). + scripts). How every file is written, and the only files ever replaced, is R31 in + `docs/design.md`: read it before touching any write path. File names valid on Windows, macOS and Linux at once (R32). Any change here needs the tests of R34. - **Accessibility is a requirement, not a polish step** (EN 301 549; WCAG 2.2 AA for the diff --git a/README.md b/README.md index 60e40a0..0035518 100644 --- a/README.md +++ b/README.md @@ -70,9 +70,10 @@ cannot damage them: - Originals are read-only. They are never modified, moved or renamed. - Nothing is ever overwritten, not even an earlier report. Every file is created with an exclusive "create new" operation, so the operating system itself refuses to overwrite. A - document, report or JSON file whose name is taken becomes `x (1).pdf`. A menu entry that is not - SignSpector's is reported and left alone. Only the tool's own cache and its manifest (the - list of what it installed) are replaced, through a new file, never through a symbolic link. + document, report or JSON file whose name is taken gets the next free name, for example + `x (1).pdf`. A menu entry that is not SignSpector's is reported and left alone. The only files + ever replaced are the tool's own cache and its list of what it installed; the full rule is R31 + in [docs/design.md](docs/design.md). - Extracted documents are never written outside the chosen folder. File names taken from the signed files are made valid on Windows, macOS and Linux at once: no forbidden characters, no reserved names, no clashes that differ only in letter case or Unicode form. diff --git a/docs/design.md b/docs/design.md index 5c8f2d5..cc14e44 100644 --- a/docs/design.md +++ b/docs/design.md @@ -1,237 +1,244 @@ # SignSpector: requirements and design -Status: **draft**, to be completed with the author. Sections marked *To decide* are open. +Status: draft, completed with the owner step by step. Open points are listed at the end, under +"What is still open?", each with the roadmap step that needs the answer. -## The idea +Each rule is written once, in the requirement named in brackets. Other places point to it +instead of repeating it. -Offices receive and archive documents signed digitally (CAdES `.p7m`, detached `.p7s`) and -time-stamped (`.tsd`, `.m7m`), often nested (a `.p7m` inside a `.p7m`, a `.tsd` around a -`.p7m`). Opening them one by one is slow and tells little about the signatures. SignSpector -takes a folder, finds every such file, opens all the layers, checks signatures, certificates and -time stamps, and produces a report anyone can read. On request it saves the signed documents -beside the originals, ready to open. +## What is SignSpector for? + +It saves opening signed files one by one. Offices receive and archive documents signed +digitally (CAdES `.p7m`, detached `.p7s`) and time-stamped (`.tsd`, `.m7m`). They are often +nested: a `.p7m` inside a `.p7m`, a `.tsd` around a `.p7m`. Opening them one by one is slow and +tells little about the signatures. + +SignSpector takes a folder and finds every such file. It opens all the layers and checks +signatures, certificates and time stamps. Then it writes a report anyone can read. On request it +saves the signed documents beside the originals, ready to open. ## Requirements -### Finding files -- R1a. A name is an envelope when its extension is `.p7m`, `.p7s`, `.tsd` or `.m7m`, ignoring - case; purely lexical, any bytes allowed in the rest of the name (non-UTF-8 names on Linux). - *(done: `is_envelope`)* -- R1b. Walk a folder recursively; only regular files are checked with R1a (a folder named - `archivio.p7m` is not an envelope). -- *To decide*: a file named exactly `.p7m` (no stem) is not an envelope today: list it in the - report as skipped? Are stand-alone time-stamp responses `.tsr` an input format? -- R2. Unreadable folders are reported and skipped; the walk goes on. Symbolic links met during - the walk (not a selected folder, R19, R28) are not followed, and hidden folders (name starting - with `.`) are skipped; both are listed in the report, so nothing is left out silently. -- *To decide* (before roadmap 1.5): a selected folder whose own name starts with `.`: analysed - or skipped? - -### Opening envelopes -- R3. Read CMS SignedData in BER, including indefinite lengths (common in real files), and in - base64 form. -- R4. Unwrap nested layers until the signed document is reached; report each layer. -- R5. RFC 5544 TimeStampedData (`.tsd`) and `.m7m` (MIME with signature and time stamp). -- R6. Detached `.p7s`: look for the signed file beside it. -- R7. A malformed file never stops the run: it becomes a "problem" line for that file (source wording in English, translated per R27). - -### Verifying -- R8. Each signature: digest of the content, signed attributes, signature (RSA PKCS#1 v1.5, - RSA-PSS, ECDSA P-256/P-384/P-521; SHA-1/256/384/512). -- R9. Signer certificate: validity at the reference time, key usage (non-repudiation), - qualified / QSCD flags. The **reference time** is a proved time only: the signature's time - stamp, or the time stamp of a `.tsd`/`.m7m` that contains the file (R5, R12). The - signing-time attribute is written by the signer and proves nothing: without a time stamp - the reference time is the time of the check, and the report shows the claimed time marked - "claimed, not proved". The same reference time is used by R48 and R49. -- R10. Chain to a CA of a **European trusted list** (R44–R48): the national list of the - certifier's country, reached through the EU List of Trusted Lists; optionally to the system - trust store, labelled "recognised by the system" (translated per R27). +### Which files does it look at? +- R1a. A name is an envelope when its extension is `.p7m`, `.p7s`, `.tsd` or `.m7m`, in any + letter case. The test is on the name only, and any bytes are allowed in the rest of the name + (non-UTF-8 names on Linux). *(done: `is_envelope`)* +- R1b. The folder is walked recursively. Only regular files are tested with R1a: a folder named + `archivio.p7m` is not an envelope. +- R2. Some folders are not walked, and each is listed in the report, so nothing is left out + silently: + - an unreadable folder is reported and skipped, and the walk goes on; + - a symbolic link met during the walk is not followed (a selected folder is different: R19); + - a hidden folder (name starting with `.`) is skipped. + +### How does it open an envelope? +- R3. It reads CMS SignedData in BER, including indefinite lengths (common in real files), and + in base64 form. +- R4. It unwraps nested layers until the signed document is reached, and reports each layer. +- R5. It reads RFC 5544 TimeStampedData (`.tsd`) and `.m7m` (MIME with signature and time + stamp). +- R6. For a detached `.p7s`, it looks for the signed file beside it. +- R7. A malformed file never stops the run. It becomes a "problem" line for that file (source + text in English, translated per R27). + +### What does it verify? +- R8. Each signature: the digest of the content, the signed attributes, and the signature (RSA + PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384/P-521; SHA-1/256/384/512). +- R9. The signer's certificate: validity at the reference time, key usage (non-repudiation), + qualified and QSCD flags. + - The **reference time** is a proved time only: the signature's time stamp, or the time stamp + of a `.tsd` or `.m7m` that contains the file (R5, R12). + - The signing-time attribute is written by the signer and proves nothing. Without a time + stamp, the reference time is the time of the check, and the report shows the claimed time + marked "claimed, not proved". + - R48 and R49 use the same reference time. +- R10. The chain must reach a CA of a **European trusted list** (R44–R48): the national list of + the certifier's country, reached through the EU List of Trusted Lists. Optionally it may reach + the system trust store, labelled "recognised by the system" (translated per R27). - R11. Countersignatures. -- R12. Time stamps (RFC 3161): imprint matches, TSA signature and chain valid. -- Revocation: R49. *To decide*: Brainpool curves? Download of missing intermediates (AIA)? - -### Output -- R13. Console summary per file, in the user's language (R27), with colours; exit codes 0 all fine / 1 problems / - 2 cannot run. -- R14. HTML report (one self-contained file) in each analysed folder, covering that folder - only, or at `--report ` (one file for the whole run). -- R15. `--json ` with the same information, for scripts. -- *To decide*: layout and content of the report (start from the old tool's report as a sketch?). - -### Extracting -- R16. `check` (the default) writes no document. It writes only: - - the HTML report, in each folder or at `--report ` (none with `--no-report`, R19); - - the JSON file of `--json ` (R15); - - the tool's own cache of trusted lists and CRLs (R44, R47, R49). - - The report and the JSON file never replace an existing file: they are created with - `create_new`, and a name already taken gets the next free name (`(1)`, `(2)`...), as in R17. - `check` and `extract` replace no file outside the tool's cache folder (R31). One exception - writes documents in a `check` run: extraction chosen at the interactive end of run (R20), - through R29. `extract` writes the signed documents beside the originals (`Relazione.pdf.p7m` -> - `Relazione.pdf`) after the two confirmations of R28 and R29: typing the number of documents is - the safeguard. -- R17. Never overwrite: same content already there -> nothing to do; different content -> +- R12. Time stamps (RFC 3161): the imprint matches, and the TSA signature and chain are valid. +- Revocation is R49. + +### What does it show and write after an analysis? +- R13. A console summary per file, in the user's language (R27), with colours (R35). Exit codes: + 0 all fine, 1 problems found, 2 cannot run. +- R14. An HTML report (one self-contained file) in each analysed folder, covering that folder + only. With `--report `, one file for the whole run instead. `--no-report` skips the + report of an analysis (not of an extraction: R16). +- R15. With `--json `, a JSON file with the same information, for scripts. +- R16. **What each command writes.** + - `check` (the default) writes no document. It writes only the HTML report (R14), the JSON + file (R15) and the tool's own cache of trusted lists and CRLs (R47). + - `extract` writes the signed documents beside the originals (`Relazione.pdf.p7m` -> + `Relazione.pdf`) after the two confirmations of R28 and R29. Typing the number of documents + is the safeguard. + - An extraction always writes its own report, and its JSON file when `--json` is given, so + that `undo` has the list of documents (R33). `--no-report` does not apply to it (owner's + decision, 2026-11-23). + - A `check` run writes documents in one case only: an extraction chosen at the interactive + end of run (R20), which goes through R29. + - How every file is created, and which files may ever be replaced, is R31. + +### How does it name extracted documents? +- R17. Never overwrite. The same content already there: nothing to do. Different content: `Relazione (1).pdf`. Originals are never modified, moved or renamed. -- R18. Name without a usable extension: guess it from the content (PDF, ZIP-based office - formats, XML, images). - -### Using it -- R19. Command line. Commands: `check ...` (default), `extract ...`, `undo `, - `install-menu`, `uninstall-menu`, `uninstall`. **There is no `--apply`, `--yes` or `--expect`.** - Every command that changes files or the system shows the exact plan first and acts only after a - person confirms. The one exception is what `check` writes on an ordinary folder from a script: - the report (HTML and JSON) and the cache, with no question (R16, R30). Where the person is - decides how (R30): - - **at a terminal**: before analysing, a yes/no question (R28); for files found in a folder - the user types the number (risky folder, R28; documents to write, R29); `undo`, - `install-menu`, `uninstall-menu`, `uninstall` change only what the tool itself made and - ask a yes/no question. Yes/no questions default to No, Enter alone cancels, and the - answers and the default are written out in words in the user's language (R35, R27); - - **from the context menu** (`--interactive`): the same confirmations (same number to type, - same default) in a native dialog (R38), with the summary of R30, focus on Cancel; - - **from a script** (no terminal, no `--interactive`): nobody can answer, so they refuse. - - `check` and `extract` take one or more folders (several can be selected in the file manager). - They are counted and confirmed together: one summary with a row per folder (path, number of files - to process, number of files of any kind) and the totals, one question for all. When the run is - risky, the summary says why (the kind of folder, or the 10,000-file limit). The number typed is - the total. A single risky folder makes the whole run risky, and the 10,000-file limit applies to - the total (R28). A folder with no envelopes is shown with 0; if all are empty the run stops. The - same folder given twice (also spelt differently: letter case, a symbolic link, a trailing slash), - or a folder inside another selected one, is counted once, under the outer folder; the summary - says so, and its envelopes go in the outer folder's report. - - `--interactive` says that a person is there even without a terminal: questions come in - native dialogs (R30) and the run ends with the interactive end of run (R20). The - context-menu entries and the Windows uninstall entry (R42) pass it. With a terminal the - questions stay in the terminal and R20 still applies. If no dialog can be shown (no - desktop session), `--interactive` refuses with exit code 2, like a script. - - `--plan` shows what the command would do and stops before doing it. It never writes - anything, not even the report or the cache, and downloads nothing: it uses the embedded - lists and those already in the cache. - - `check --plan` only counts (R28; no envelope is opened) and prints the summary: no - question, allowed everywhere, also from a script on a risky folder. - - `extract --plan` builds the write plan of R29, which opens every envelope, so it asks the - R28 question first (console or dialog), and from a script runs on an ordinary folder and - refuses a risky one, like `check`. It also says which trusted lists a real run would - download (R45). - - For the other commands it lists the items, with no question, also from a script. - - Options: `--open`, `--report`, `--no-report`, `--report-lang `, `--json `, - `--threads`, `--offline`, `--trust-lists `, `--trust-list `, - `--lang `, `--interactive`, `--plain`, `--no-color`, `--plan`. Help translated (R27). - `--no-report` skips the report of an analysis. An extraction always writes its report, and - its JSON file when `--json` is given, so that `undo` has the list of documents (R33; owner's - decision, 2026-11-23). -- *To decide* (before roadmap 4.4): what `--open` and `--threads` do (R23 asks for parallel - work, not an option); whether `extract --no-report` is refused as a usage error or accepted - with a message saying the extraction report is written anyway. -- R20. Interactive end of run (double-click on Windows, context menu, `--interactive`): after - the analysis, offer to view the report or to extract; extraction goes through the write - plan and its confirmation (R29) and reuses the analysis already done. The first report is - never rewritten: the extraction writes a second report beside it (next free name, R16) with - the analysis and the documents written, and `undo` uses that one (R33). With `--json` it - also writes a second JSON file beside the first. After `check --no-report` there is no first - report: the extraction report is the only one. -- R21. `install-menu` / `uninstall-menu` (plan and yes/no question, R19) for the file manager's - context menu: Windows per-user registry keys (no admin, no PowerShell); macOS Quick Actions; - Linux Nautilus script and Dolphin service menu. Full removal: `uninstall` (R40–R43). - -### Non-functional -- R22. One self-contained executable per platform, pure Rust dependencies. -- R23. Files processed in parallel, output printed in a stable order. +- R18. A name without a usable extension gets one guessed from the content (PDF, ZIP-based + office formats, XML, images). +- R32 has the rules for valid names. + +### How is it used? +- R19. **Command line.** Commands: `check ...` (default), `extract ...`, + `undo `, `install-menu`, `uninstall-menu`, `uninstall`. **There is no `--apply`, + `--yes` or `--expect`.** + - Every command that changes files or the system shows the exact plan first and acts only + after a person confirms. The one exception: `check` on an ordinary folder from a script + writes its report and the cache with no question (R16, R30). + - Where the person is decides how they confirm (R30): + - at a terminal: before analysing, a yes/no question (R28). For files found in a folder the + user types the number (files to process in a risky run, R28; documents to write, R29). + `undo`, `install-menu`, `uninstall-menu` and `uninstall` change only what the tool itself + made, and ask a yes/no question. Yes/no questions default to No, Enter alone cancels, and + the answers and the default are written out in words in the user's language (R35, R27); + - from the context menu (`--interactive`): the same confirmations, with the same number to + type and the same default, in a native dialog (R30, R38), focus on Cancel; + - from a script (no terminal, no `--interactive`): nobody can answer, so they refuse. + - **Several folders.** `check` and `extract` take one or more folders (several can be + selected in the file manager). They are counted and confirmed together: + - one summary with a row per folder (path, number of files to process, number of files of + any kind) and the totals, and one question for all. The number typed is the total; + - when the run is risky, the summary says why: the kind of folder, or the 10,000-file limit + (R28). A single risky folder makes the whole run risky, and the limit applies to the + total; + - a folder with no envelopes is shown with 0; if all are empty, the run stops; + - the same folder given twice (also spelt differently: letter case, a symbolic link, a + trailing slash), or a folder inside another selected one, is counted once, under the + outer folder. The summary says so, and its envelopes go in the outer folder's report; + - a selected folder that is a symbolic link is resolved, then counted and judged like any + other folder (R28). + - **`--interactive`** says that a person is there even without a terminal: questions come in + native dialogs (R30) and the run ends with the interactive end of run (R20). The + context-menu entries and the Windows uninstall entry (R42) pass it. With a terminal, the + questions stay in the terminal and R20 still applies. If no dialog can be shown (no + desktop session), `--interactive` refuses with exit code 2, like a script. + - **`--plan`** shows what the command would do and stops before doing it. It writes nothing, + not even the report or the cache, and downloads nothing: it uses the embedded lists and + those already in the cache. + - `check --plan` only counts (R28; no envelope is opened) and prints the summary. It asks + no question and runs everywhere, also from a script on a risky folder. + - `extract --plan` builds the write plan of R29, which opens every envelope. So it asks the + R28 question first (console or dialog), and from a script it runs on an ordinary folder + and refuses a risky one, like `check`. It also says which trusted lists a real run would + download (R45). + - For the other commands it lists the items, with no question, also from a script. + - Options: `--open`, `--report`, `--no-report`, `--report-lang `, `--json `, + `--threads`, `--offline`, `--trust-lists `, `--trust-list `, + `--lang `, `--interactive`, `--plain`, `--no-color`, `--plan`. Help is translated + (R27). +- R20. **Interactive end of run** (double-click on Windows, context menu, `--interactive`). + After the analysis, the tool offers to view the report or to extract. An extraction goes + through the write plan and its confirmation (R29) and reuses the analysis already done. + - The first report is never rewritten. The extraction writes a second report beside it (next + free name, R31) with the analysis and the documents written, and `undo` uses that one (R33). + - With `--json`, it also writes a second JSON file beside the first. + - After `check --no-report` there is no first report: the extraction report is the only one. +- R21. `install-menu` and `uninstall-menu` (plan and yes/no question, R19) add and remove the + file manager's context menu: Windows per-user registry keys (no admin, no PowerShell), macOS + Quick Actions, a Linux Nautilus script and Dolphin service menu. Full removal: `uninstall` + (R40–R43). + +### How is it built and released? +- R22. One self-contained executable per platform, with pure Rust dependencies. +- R23. Files are processed in parallel, and the output is printed in a stable order. - R24. Targets: Windows x86_64, macOS arm64 + universal, Linux x86_64 static (musl). -- R25. Linux packages: `.deb`, `.rpm` and a generic `.tar.gz` (static musl binary, works on - any distribution). Built on the Mac from the musl binary with `cargo-deb` and - `cargo-generate-rpm` (pure Rust, no dpkg/rpmbuild needed). -- R26. Versioning: SemVer starting from `0.1.0`; `0.x` while behaviour and options may still - change, `1.0.0` when the tool is ready to replace the old one in production. The old tool's +- R25. Linux packages: `.deb`, `.rpm` and a generic `.tar.gz` (static musl binary, works on any + distribution). They are built on the Mac from the musl binary with `cargo-deb` and + `cargo-generate-rpm` (pure Rust, no dpkg or rpmbuild needed). +- R26. Versioning: SemVer starting from `0.1.0`. `0.x` while behaviour and options may still + change; `1.0.0` when the tool is ready to replace the old one in production. The old tool's numbering is not continued. Every release is a git tag `vX.Y.Z`. -### Languages -- R27. The interface (console messages, `--help`, HTML report, JSON field values meant for - people, user guide) is translated. Language = the one chosen with `--lang it`, otherwise the - operating system's language, otherwise English. No preference is saved; a command to save - one can be added later, with its plan and question (R19). - Source language English; first translation Italian; more can be added without code changes. -- *To decide*: translation mechanism (e.g. Fluent `.ftl` files embedded in the executable, or - `rust-i18n`), OS language detection (`sys-locale`), how dates and numbers are formatted per - language. -- The report is written in the interface language by default; `--report-lang ` writes it - in another one (for example to send it to an office abroad). - -### Confirmation and write safety -Nothing is ever processed right after a person chooses a folder, and no document is written -without a second, separate confirmation. `check` and `extract` never replace an existing file; -only the tool's own cache files are replaced (R16), as R31 says. A folder named in -a script has no person to ask: an ordinary folder is analysed (`check` writes only the report, -HTML and JSON, and the tool's cache, R16); a risky one is refused, only counted by `check ---plan`, and nothing is written (R30). - -- R28. **Confirm before analysing.** After the folders are chosen the tool only counts (no - envelope is opened) and asks, default No (Enter alone cancels): - folder, number of files to process (the envelopes, R1a), number of files of any kind, total - size, number of subfolders, unreadable folders that will be skipped. Zero envelopes: say so - and stop. The interface calls the envelopes "files to process". **Risky folder**: root of a - drive or volume, the user's home, Desktop, Documents, system folders (`C:\Windows`, - `Program Files`, `/System`, `/usr`, `/etc`...), network share roots, or a folder that holds - **more than 10,000 files of any kind**, subfolders included: a stronger warning and the user - must type the number of files to process (envelopes). The 10,000 count covers the regular - files of the folders the walk visits (R2). Files in hidden folders, behind symbolic links met - during the walk or in unreadable folders are not counted. A file in overlapping folders - counts once. A selected folder that is itself a symbolic link is resolved and counted (R19). - Every path-based kind of risky folder is judged on the path after resolving symbolic links. -- R29. **Confirm before writing.** Extraction first builds the complete write plan and shows +### Which languages does it speak? +- R27. The interface is translated: console messages, `--help`, HTML report, JSON field values + meant for people, user guide. + - The language is the one chosen with `--lang it`, otherwise the operating system's language, + otherwise English. + - No preference is saved. A command to save one can be added later, with its plan and + question (R19). + - Source language English; first translation Italian; more can be added without code + changes. + - The report is written in the interface language by default. `--report-lang ` writes it + in another one, for example to send it to an office abroad. + +### How does it protect the user's files? +No folder is processed right after a person chooses it: the tool counts first and asks (R28). +No document is written without a second, separate confirmation on the full write plan (R29). +There is never an implicit yes (R30). R31 says how every file is created and which files may +ever be replaced. From a script, an ordinary folder is analysed, a risky one is refused (only +counted by `check --plan`), and no document is written (R30). + +- R28. **Confirm before analysing.** After the folders are chosen, the tool only counts (no + envelope is opened) and asks, default No (Enter alone cancels). + - The question shows: folder, number of files to process (the envelopes, R1a), number of + files of any kind, total size, number of subfolders, unreadable folders that will be + skipped. The interface calls the envelopes "files to process". Zero envelopes: it says so and + stops. + - **A risky run** gets a stronger warning, and the user must type the number of files to + process. A run is risky when a chosen folder is the root of a drive or volume, the user's + home, Desktop, Documents, a system folder (`C:\Windows`, `Program Files`, `/System`, + `/usr`, `/etc`...) or a network share root. It is also risky when the folders hold **more + than 10,000 files of any kind** in all, subfolders included (owner's decision, 2026-11-23). + - The 10,000 count covers the regular files of the folders the walk visits (R2). Files in + hidden folders, behind symbolic links met during the walk, or in unreadable folders are not + counted. A file in overlapping folders counts once. + - Every path-based kind of risky folder is judged on the path after resolving symbolic links. +- R29. **Confirm before writing.** An extraction first builds the complete write plan and shows it: new documents, documents already present with identical content (not rewritten), documents saved under an alternative name `x (1).pdf`, and "existing files modified: 0" - (always zero, shown as a guarantee). The full list can be viewed. To proceed the user types + (always zero, shown as a guarantee). The full list can be viewed. To proceed, the user types the number of documents to write (language-neutral, cannot be confirmed by a stray key). - R30. **Three ways to confirm, never an implicit yes.** - - Terminal (`std::io::IsTerminal` on input and output): questions in the console (R28, R29, - R19). - - Context menu: no terminal, started with `--interactive`: the same confirmations in a native - dialog (R38), with a shorter summary than the console. The dialog lists every selected folder - with its number of files to process (envelopes to analyse, R28; documents to write, R29), the - total, the reason when the run is risky (R19) and the operation proposed, then asks the - question. When a number is required (R28 risky folder, R29) it is typed in a text field and - Confirm accepts only the right number; otherwise the dialog is a yes/no question. In every - dialog the focus starts on Cancel; Enter alone and closing the window cancel; no time limit. - *To decide* (before roadmap 5.2): whether the dialog also shows the count of files of any - kind, as the console summary does (R19). + - Terminal (`std::io::IsTerminal` on input and output): questions in the console (R19, R28, + R29). "Terminal" means both input and output are a terminal. With output redirected + (`| tee log`, `> file`) the run counts as a script. + - Context menu (no terminal, started with `--interactive`): the same confirmations in a + native dialog (R38), with a shorter summary than the console. + - The dialog lists every selected folder with its number of files to process (envelopes to + analyse, R28; documents to write, R29), the total, the reason when the run is risky + (R19) and the operation proposed. Then it asks the question. + - When a number is required (risky run, R28; R29), it is typed in a text field, and Confirm + accepts only the right number. Otherwise the dialog is a yes/no question. + - In every dialog the focus starts on Cancel. Enter alone and closing the window cancel. + There is no time limit. - Script (no terminal, no `--interactive`): `extract`, `undo`, `install-menu`, - `uninstall-menu`, `uninstall` and `check` on a risky folder (R28) stop with exit code 2 + `uninstall-menu`, `uninstall`, and `check` on a risky folder (R28) stop with exit code 2 and say that a person must confirm. A `y` or a number arriving on a pipe is not a - confirmation. Only `check` on an ordinary folder, `check --plan`, `extract --plan` on an - ordinary folder and `--plan` of `undo`, the menus and `uninstall` (a list) run. - "Terminal" means both input and output are a terminal: with output redirected - (`| tee log`, `> file`) the run counts as a script. -- R31. **Never overwrite, never write outside.** + confirmation. Only these run: `check` on an ordinary folder, `check --plan`, + `extract --plan` on an ordinary folder, and `--plan` of `undo`, the menus and `uninstall` + (a list). +- R31. **Never overwrite, never write outside.** This is the one place for these rules. - In code, writing a document requires a `ConfirmedPlan` that only the confirmation step can build (typestate): a path that writes without confirmation does not compile. Originals are held in a read-only `Original` type that write functions do not accept. - - Every file the tool writes is created with `OpenOptions::create_new(true)`, except two kinds - of its own files: the files of its cache, under the names it derives itself (R47), and its - install manifest (R41). Documents, reports, JSON files and menu items are all created with - `create_new`: the OS refuses if the name exists, even if the file appeared after the plan. - A document, report or JSON file then takes the next free name (`(1)`, `(2)`...); a menu item - is reported and left (R41; registry keys and `.workflow` folders: *To decide* after R42). A - partly written file (error, disk full) is removed, only if we created it. - - A cache file or the manifest is replaced in two steps. The tool writes the new content with - `create_new` under a temporary name in the same folder. Then it renames that file over the - old one. It never follows a symbolic link there, and it refuses a name that is not a - regular file. - - Before writing, each original is re-checked against the analysis (size, mtime, SHA-256); - if the folder changed, the plan is rebuilt and confirmed again. - - Every target must stay inside the selected folder its envelope was found in, after + - **Every file the tool writes is created with `OpenOptions::create_new(true)`**: documents, + reports, JSON files, menu items, cache files, the manifest, and temporary files. The OS + refuses if the name exists, even if the file appeared after the plan. + - When the name is taken: a document, report or JSON file takes the next free name (`(1)`, + `(2)`...); a menu item is reported and left (R41). + - **Only two kinds of file are ever replaced**: the tool's own cache files (R47) and its + install manifest (R41). They are replaced in two steps. The new content is written with + `create_new` under a temporary name in the same folder; then that file is renamed over the + old one. The tool never follows a symbolic link there, and it refuses a name that exists + and is not a regular file. Nothing is ever written in place. + - A partly written file (error, disk full) is removed, only if the tool created it. + - Before writing, each original is re-checked against the analysis (size, mtime, SHA-256). If + the folder changed, the plan is rebuilt and confirmed again. + - Every document must stay inside the selected folder its envelope was found in, after resolving `..` and symbolic links. - - Free disk space is checked before starting. Ctrl+C finishes the current file, stops, and - the report records what was done. + - Free disk space is checked before starting. Ctrl+C finishes the current file, stops, and the + report records what was done. - R32. **Portable file names.** Names taken from envelopes (and the `(n)` variants) must be - valid on **Windows, macOS and Linux at the same time**, and on FAT32/exFAT file systems, - whatever system the tool runs on (archives move between systems): + valid on **Windows, macOS and Linux at the same time**, and on FAT32 and exFAT, whatever + system the tool runs on (archives move between systems): - removed or replaced: `/` `\` `:` `*` `?` `"` `<` `>` `|`, NUL and control characters U+0000–U+001F and U+007F; trailing dots and spaces; leading spaces; - reserved Windows names, with or without extension and in any case: `CON`, `PRN`, `AUX`, @@ -241,136 +248,135 @@ HTML and JSON, and the tool's cache, R16); a risky one is refused, only counted - invalid UTF-8 or unpaired surrogates are replaced; names are stored in Unicode NFC; - length: at most 255 UTF-8 bytes and 255 UTF-16 units per component, cut without breaking a character or the extension; - - collisions are checked **case-insensitively and normalization-insensitively** (NTFS and - APFS default are case-insensitive; APFS treats NFC/NFD as the same name), so two - documents never compete for "names" that the file system sees as equal; + - collisions are checked **case-insensitively and normalization-insensitively** (NTFS and the + APFS default are case-insensitive; APFS treats NFC and NFD as the same name), so two + documents never compete for names that the file system sees as equal; - the original name, when changed, is shown in the report. -- R33. **Undo.** The report written by an extraction records every document written with its - SHA-256 (an extraction at the interactive end of run writes its own report, R20). - `signspector undo ` removes only files written by SignSpector whose content still - matches that hash; changed or missing files are listed and left alone; originals are never - touched. It shows what it would remove and removes it after a yes/no question (R19); never - from a script (R30). -- R34. **Proof by tests.** A shared test helper snapshots the whole folder (paths + SHA-256) +- R33. **Undo.** The report written by an extraction records every document written, with its + SHA-256 (R16, R20). `signspector undo ` removes only files written by SignSpector + whose content still matches that hash. Changed or missing files are listed and left alone; + originals are never touched. It shows what it would remove and removes it after a yes/no + question (R19); never from a script (R30). On a report that records no document it removes + nothing and says so. +- R34. **Proof by tests.** A shared test helper snapshots the whole folder (paths and SHA-256) before and after every end-to-end test: originals identical, nothing changed but the - confirmed plan. Dedicated tests: empty answer, `n`, wrong number; file appearing between - plan and write; names with `..`, reserved names, forbidden characters, NFC/NFD and case - collisions, over-long names; symbolic link pointing outside; disk full (simulated); - `undo` with a modified file. Confirmation (R19, R28–R30): - - from a script: every changing command, `check` and `extract --plan` on a risky folder, - and `--interactive` without a desktop refused with exit 2; `check` on an ordinary folder, - `check --plan` anywhere, `extract --plan` on an ordinary folder and `--plan` of `undo`, - the menus and `uninstall` run without a question; output redirected counts as a script; - - `--interactive` with a terminal keeps the questions in the terminal; - - `--plan` writes nothing, not even the report or the cache, and downloads nothing; - - `check` adds only its report to the folder (snapshot), and nothing with `--no-report`; an - existing report or JSON file, also one named with `--report` or `--json`, is not replaced: - the new one gets the next free name; `extract --plan` names the lists a real run would - download; end-to-end tests point the cache to a temporary folder through the system's own - variables (R47; Windows to decide), never the user's real one; a file in the cache folder - under a name the tool does not derive is never replaced; a symbolic link or a folder at - one of the tool's own names (cache or manifest) is refused, never followed; a CA whose name - holds `../` or a separator gives a cache file named only by the hash, inside the folder; - - only the manifest and the cache files are replaced: snapshots of the config and cache - folders around `install-menu`, `uninstall-menu` and a list refresh; - - `install-menu` run twice changes nothing; after a lost manifest, our marked items are - recognised and a foreign item never enters the manifest; - - with `--json`, an extraction at the interactive end of run writes a second JSON file and - leaves the first; `extract --no-report --json f` writes `f`, or is refused with exit 2 - and writes nothing, as the *To decide* after R19 settles; - - interactive end of run (R20): documents are written only through R29, declining writes - none, and an extraction writes a second report without touching the first; `undo` on the - second report removes the documents, on the first it removes nothing and says so; - - `extract --no-report` writes the extraction report, or is refused with exit 2 and writes - nothing, as the *To decide* after R19 settles; - - `install-menu` meeting a foreign item with the same name reports it, leaves it, and - `uninstall` does not remove it; - - the console summary shows both counts in each row and in the totals, and the reason for a - risky run; the dialog shows the reason; - - risky folder: more than 10,000 files of any kind (subfolders included) is risky even with - few envelopes, and the number typed is the files to process; exactly 10,000 is not risky, - 10,001 is, also as a total over several folders; files in hidden folders, behind symbolic - links met during the walk or in unreadable folders are not counted, a selected folder that - is a symbolic link is resolved and counted, and overlaps are counted once; - - time: a back-dated signing-time attribute changes no verdict; without a time stamp the - report says "claimed, not proved" (R9); - - yes/no question: Enter alone cancels, `y` on a pipe is refused, a number is not a yes; - - several folders: the total is typed, one risky folder makes the run risky, the 10,000 - limit applies to the total, all folders empty stop the run, overlaps (also by letter - case, symbolic link, trailing slash) are counted once, one report per selected folder - that is not inside another, a symbolic link to a risky folder is risky; - - dialogs: when a number is required only the right one confirms, yes/no dialogs default - to Cancel, the focus starts on Cancel, Enter alone and closing the window cancel, a wrong - number does not confirm, every selected folder with its count, the total and the - operation are shown; a fake dialog helper placed first in `PATH` is not used, and a - folder name with quotes or script code is shown as text, never run. - - How confirmed runs are tested without a bypass: the public confirmation has two - constructors only, terminal and dialog, which take no input source: they open the terminal - or the dialog themselves and check `IsTerminal` inside. The core that turns answers into a - `ConfirmedPlan` is `pub(crate)`; the test answer source is a `#[cfg(test)]` item that calls - it, so it exists only in the library's own unit tests (`tests/*.rs` cannot see it) and the - compiler enforces R31. Cases that need confirmed writes (file appearing between plan and - write, disk full) are library unit tests or pseudo-terminal tests; the folder-snapshot - helper serves both. The executable is tested end to end under a pseudo-terminal (Unix pty, - Windows ConPTY) and for its refusals; the dialogs through the OS accessibility interface - where it can be driven, by hand otherwise (R39). There is no environment variable, hidden - option or build flag that confirms. - -### European trusted lists -Signatures may come from any country on the LOTL (Italy, Romania, France...). Trust is anchored in -the EU **List of Trusted Lists** (LOTL, `https://ec.europa.eu/tools/lotl/eu-lotl.xml`, -signed by the European Commission). It points to each national trusted list and names the -certificates that sign it (checked 2026-11-22: LOTL no. 398, 43 pointers: EU-27, Iceland, + confirmed plan. + - Writing (R29, R31, R32): empty answer, `n`, wrong number; a file appearing between plan and + write; names with `..`, reserved names, forbidden characters, NFC/NFD and case collisions, + over-long names; a symbolic link pointing outside; disk full (simulated); `undo` with a + modified file; `undo` on a report that records no document. + - Scripts (R30): every changing command, `check` and `extract --plan` on a risky folder, and + `--interactive` without a desktop are refused with exit 2. `check` on an ordinary folder, + `check --plan` anywhere, `extract --plan` on an ordinary folder and `--plan` of `undo`, the + menus and `uninstall` run without a question. Output redirected counts as a script. + `--interactive` with a terminal keeps the questions in the terminal. + - `--plan` (R19): it writes nothing, not even the report or the cache, and downloads nothing; + `extract --plan` names the lists a real run would download. + - What `check` writes (R16): only its report is added to the folder, and nothing with + `--no-report`. An existing report or JSON file, also one named with `--report` or `--json`, + is not replaced: the new one gets the next free name. + - Extraction reports (R16, R20, R33): an extraction at the interactive end of run writes a + second report, and with `--json` a second JSON file, without touching the first. Declining + writes no document. `undo` on the second report removes the documents. `extract + --no-report` follows the open question on it (see "What is still open?"). + - Cache and manifest (R31, R47): end-to-end tests point the cache to a temporary folder, + never the user's real one. A file in the cache folder under a name the tool does not derive + is never replaced. A symbolic link, a folder or another non-regular file at one of the + tool's own names (cache or manifest) is refused, never followed. A CA whose name holds + `../` or a separator gives a cache file named only by the hash, inside the folder. + Snapshots of the config and cache folders around `install-menu`, `uninstall-menu` and a list + refresh show that only the manifest and the cache files changed. + - Menu items (R41): `install-menu` run twice changes nothing. A foreign item with the same name + is reported, left, never enters the manifest, and `uninstall` does not remove it. After a + lost manifest, our marked items are recognised. + - Counting (R19, R28): the summary shows both counts in each row and in the totals, and the + reason for a risky run; the dialog shows the reason. More than 10,000 files of any kind is + risky even with few envelopes, and the number typed is the files to process: exactly + 10,000 is not risky, 10,001 is, also as a total over several folders. Files in hidden + folders, behind symbolic links met during the walk or in unreadable folders are not + counted; a selected folder that is a symbolic link is resolved and counted; overlaps count + once. + - Several folders (R19): the total is typed; one risky folder makes the run risky; all + folders empty stop the run; overlaps (also by letter case, symbolic link, trailing slash) + are counted once; one report per selected folder that is not inside another; a symbolic + link to a risky folder is risky. + - Time (R9): a back-dated signing-time attribute changes no verdict; without a time stamp the + report says "claimed, not proved". + - Yes/no questions (R19): Enter alone cancels, `y` on a pipe is refused, a number is not a + yes. + - Dialogs (R30): when a number is required only the right one confirms; yes/no dialogs default + to Cancel; the focus starts on Cancel; Enter alone and closing the window cancel; a wrong + number does not confirm; every selected folder with its count, the total and the operation + are shown; a fake dialog helper placed first in `PATH` is not used; a folder name with + quotes or script code is shown as text, never run. + + How are confirmed runs tested without a bypass? The public confirmation has two constructors + only, terminal and dialog, which take no input source: they open the terminal or the dialog + themselves and check `IsTerminal` inside. The core that turns answers into a `ConfirmedPlan` + is `pub(crate)`. The test answer source is a `#[cfg(test)]` item that calls it, so it exists + only in the library's own unit tests (`tests/*.rs` cannot see it), and the compiler enforces + R31. Cases that need confirmed writes (a file appearing between plan and write, disk full) + are library unit tests or pseudo-terminal tests; the folder-snapshot helper serves both. The + executable is tested end to end under a pseudo-terminal (Unix pty, Windows ConPTY) and for + its refusals. The dialogs are tested through the OS accessibility interface where it can be + driven, by hand otherwise (R39). There is no environment variable, hidden option or build + flag that confirms. + +### Which trusted lists does it use? +Signatures may come from any country on the EU **List of Trusted Lists** (LOTL, +`https://ec.europa.eu/tools/lotl/eu-lotl.xml`, signed by the European Commission): Italy, +Romania, France and the others. The LOTL points to each national trusted list and names the +certificates that sign it. Checked on 2026-11-22: LOTL no. 398, 43 pointers (EU-27, Iceland, Liechtenstein, Norway, United Kingdom). - R44. **Chain of trust.** The executable embeds the LOTL and the Commission's LOTL signing - certificates (published in the Official Journal of the EU). A national list is used only if - its XAdES signature verifies against the certificates the LOTL names for that country; the - LOTL only if it verifies against the embedded Commission certificates. Italy is one country - among the others. The repository stores no trusted list: the release build downloads the - current LOTL and the Italian list and embeds them, so the tool works offline out of the box; - at the first run with network the tool refreshes them into its cache, which then takes - precedence (R47). + certificates (published in the Official Journal of the EU). + - The LOTL is used only if it verifies against the embedded Commission certificates. + - A national list is used only if its XAdES signature verifies against the certificates the + LOTL names for that country. Italy is one country among the others. + - The repository stores no trusted list. The release build downloads the current LOTL and the + Italian list and embeds them, so the tool works offline out of the box. At the first run + with network the tool refreshes them into its cache, which then takes precedence (R47). + - XAdES needs XML canonicalisation (exclusive C14N) and XML signature verification. No mature + pure-Rust library exists, so we write it here, test first, as carefully as the BER reader. - R45. **Automatic choice.** The analysis collects the country of every certifier found in the files (`C=` of the issuing CA) and loads only those lists: from the cache if still valid, otherwise downloaded. The write plan (R29) and the report name them, for example "signatures from 3 countries: Italy, Romania, France; lists: Italy and France up to date, Romania downloaded now". -- R46. **Settable.** `--trust-lists auto` (default) / `all` / `it,ro,fr`; `--trust-list ` - loads a list by hand; `--offline` uses only the embedded copies and the cache. A missing list +- R46. **Settable.** `--trust-lists auto` (default), `all` or `it,ro,fr`. `--trust-list ` + loads a list by hand. `--offline` uses only the embedded copies and the cache. A missing list is reported as such ("list of Romania not available offline"), never as an invalid signature. -- R47. **Cache.** Lists (and the CRLs of R49) are cached in the SignSpector cache folder and - refreshed when their own `NextUpdate` date passes; `uninstall` removes the cache (R40). The - cache folder is the operating system's standard one (R42); no option moves it. Tests move it - only through the system's own variables (`HOME`, `XDG_CACHE_HOME`; Windows: to decide, see - after R42). The tool replaces only files under the names it derives itself: one fixed name - per list, and for a CRL the SHA-256 of its CA certificate, never text taken from the input. - It never replaces another file found in that folder, never follows a symbolic link there, - and refreshes a file as R31 says (temporary file, then rename). +- R47. **Cache.** This is the one place for the cache rules. + - Lists, and the CRLs of R49, are cached in the SignSpector cache folder and refreshed when + their own `NextUpdate` date passes. `uninstall` removes the cache (R40). + - The cache folder is the operating system's standard one (R42); no option moves it. Tests + move it only through the system's own variables (`HOME`, `XDG_CACHE_HOME`; Windows is still + open). + - The tool uses only names it derives itself: one fixed name per list, and for a CRL the + SHA-256 of its CA certificate (partitioned CRLs are still open). A name is never text taken + from the input. + - It never replaces another file found in that folder. A cache file is replaced only as R31 + says: a new file, a rename, no symbolic link. - R48. **Verdicts.** Qualified status is checked at the reference time (R9) using the service - history in the list (a service withdrawn later still validates an earlier signature). A + history in the list: a service withdrawn later still validates an earlier signature. A certifier on no list is reported as "not on a European trusted list", distinct from "invalid signature". Any country listed in the official LOTL is accepted, the United Kingdom included. The report names every list used (country, sequence number, issue date). -- Cost: verifying XAdES needs XML canonicalisation (exclusive C14N) and XML signature - verification; no mature pure-Rust library exists, so it is written here, test first, as - carefully as the BER reader. - R49. **Revocation without a query per signature.** Network traffic grows with the number of - certificates, never with the number of files: one result per certificate, the same - certificate in a thousand files is checked once; a CRL is fetched at most once per CA per - run. + certificates, never with the number of files. There is one result per certificate: the same + certificate in a thousand files is checked once. A CRL is fetched at most once per CA per + run (partitioned CRLs are still open). - **Reference time**: the proved time of R9 (a time stamp), otherwise the time of the check. - - **Revocation data inside the signature** (CAdES -LT/-LTA) is used only if its own - signature verifies against the issuing CA or an authorised OCSP responder and it was - issued after the reference time; otherwise it is ignored and the CA's CRL is used. - - **The CA's CRL**: fetched only once the chain reaches a CA of a trusted list, from its - distribution point, `http` or `https` only (redirects too), with limits on size and time; - its signature and issuer are verified before it is used or cached. It answers when it was - issued after the reference time; when the reference time is the time of the check, a CRL - inside its validity (`thisUpdate` <= now < `nextUpdate`) answers. Cached in the - SignSpector cache folder until its `nextUpdate` (R47; removed by `uninstall`, R40). OCSP - only when the CA publishes no CRL. + - **Revocation data inside the signature** (CAdES -LT/-LTA) is used only if its own signature + verifies against the issuing CA or an authorised OCSP responder, and it was issued after + the reference time. Otherwise it is ignored and the CA's CRL is used. + - **The CA's CRL** is fetched only once the chain reaches a CA of a trusted list. It comes + from its distribution point, `http` or `https` only (redirects too), with limits on size and + time. Its signature and issuer are verified before it is used or cached. It answers when it + was issued after the reference time. When the reference time is the time of the check, a + CRL inside its validity (`thisUpdate` <= now < `nextUpdate`) answers. It is cached until its + `nextUpdate` (R47). OCSP is used only when the CA publishes no CRL. - **Verdicts**: - "not revoked"; - "revoked on ", before a proved reference time (a time stamp): invalid; @@ -378,127 +384,102 @@ Liechtenstein, Norway, United Kingdom). revocation date; - revoked, but the signature has no time stamp: "cannot be determined: no proof the signature is older than the revocation" (as ETSI EN 319 102-1), never "invalid"; - - "cannot be determined" also when the certificate has expired and the CRL no longer - lists expired certificates (a CRL answers for an expired certificate only if issued - before its `notAfter` or marked ExpiredCertsOnCRL), and for a suspension - (`certificateHold`) that a later CRL no longer shows; + - "cannot be determined" also when the certificate has expired and the CRL no longer lists + expired certificates (a CRL answers for an expired certificate only if issued before its + `notAfter` or marked ExpiredCertsOnCRL), and for a suspension (`certificateHold`) that a + later CRL no longer shows; - "revocation not checked": no network, or no CRL fresh enough could be fetched. + None of the last three is "invalid signature". `--offline` uses a cached CRL that still answers, otherwise "revocation not checked". -### Accessibility -Legal frame (Italy/EU): Legge 4/2004 ("Legge Stanca", as amended by D.Lgs. 106/2018) and the -AgID guidelines on the accessibility of IT tools, which refer to the harmonised standard +### Who must be able to use it, and how? +Legal frame (Italy and EU): Legge 4/2004 ("Legge Stanca", as amended by D.Lgs. 106/2018) and +the AgID guidelines on the accessibility of IT tools. They refer to the harmonised standard **EN 301 549** (ch. 11 software, ch. 12 documentation and support, ch. 9 web content = WCAG). The European Accessibility Act (Directive 2019/882, D.Lgs. 82/2022) probably does not cover this tool, but meeting EN 301 549 covers it too. Targets: **EN 301 549** for the program and **WCAG 2.2 level AA** for the HTML report and the user guide. Whoever deploys the tool in a -public administration checks the applicable obligations (e.g. accessibility statement). +public administration checks the applicable obligations (for example an accessibility +statement). - R35. **Console.** - - Information is never conveyed by colour or symbols alone: every status is a word - ("OK", "Warning", "Error" in the user's language); colours only reinforce it, with - sufficient contrast on both light and dark terminals, never red/green as the only - difference. Colours off with `NO_COLOR`, `--no-color`, or when output is not a terminal. - - No box drawing, ASCII art or tables made of spaces for essential information: linear - text, one fact per line, read well by NVDA, JAWS, Narrator, VoiceOver and Orca. - - Progress does not flood screen readers: no spinners, no rewriting the same line many - times a second. `--plain` (also `SIGNSPECTOR_PLAIN=1`) gives line-by-line output with a - progress line at most every few seconds and a final summary. - - Prompts: the full question on one line, with the possible answers and the default - spelled out in words; keyboard only; **no time limits** on any prompt. - - Messages in plain language; every error says what happened, which file, and what the - user can do. + - Information is never conveyed by colour or symbols alone. Every status is a word ("OK", + "Warning", "Error" in the user's language); colours only reinforce it, with sufficient + contrast on both light and dark terminals, never red/green as the only difference. Colours + are off with `NO_COLOR`, `--no-color`, or when output is not a terminal. + - No box drawing, ASCII art or tables made of spaces for essential information: linear text, + one fact per line, read well by NVDA, JAWS, Narrator, VoiceOver and Orca. + - Progress does not flood screen readers: no spinners, no rewriting the same line many times + a second. `--plain` (also `SIGNSPECTOR_PLAIN=1`) gives line-by-line output with a progress + line at most every few seconds and a final summary. + - Prompts: the full question on one line, with the possible answers and the default spelled + out in words; keyboard only; **no time limits** on any prompt. + - Messages in plain language. Every error says what happened, which file, and what the user + can do. - R36. **HTML report (WCAG 2.2 AA).** - - `lang` set to the report language; meaningful ``; landmarks (`header`, `main`, + - `lang` set to the report language; a meaningful `<title>`; landmarks (`header`, `main`, `nav`) and a "skip to content" link; headings in order, no level skipped. - - Real tables with `<caption>` and `<th scope>`; status shown as text (with optional icon - that has a text alternative), never by colour alone. + - Real tables with `<caption>` and `<th scope>`. Status is shown as text (with an optional + icon that has a text alternative), never by colour alone. - Contrast at least 4.5:1 for text and 3:1 for UI parts and icons, in light and dark mode - (`prefers-color-scheme`); respects `prefers-reduced-motion`. - - Works at 200% zoom and reflows at 320 CSS px width without horizontal scrolling - (except data tables, which scroll on their own). - - Fully keyboard operable (`<details>`/`<summary>` for expandable parts), visible focus, + (`prefers-color-scheme`); `prefers-reduced-motion` is respected. + - Works at 200% zoom and reflows at 320 CSS px width without horizontal scrolling (except + data tables, which scroll on their own). + - Fully keyboard operable (`<details>` and `<summary>` for expandable parts), visible focus, no keyboard traps; works without JavaScript; descriptive link texts; prints readably. -- R37. **Documentation and help** (EN 301 549 ch. 12): `--help` and the user guide are plain - text / HTML (no scanned or untagged PDF), translated, and include a section describing the - accessibility features (`--plain`, `--no-color`, keyboard use, screen readers). -- R38. **Context menu and dialogs**: only native OS menus and native dialogs, which inherit - the OS accessibility (screen readers, keyboard); clear labels in the user's language. The - dialogs ask the confirmations of R30 for runs started from the context menu. No - custom-drawn GUI, no PowerShell. +- R37. **Documentation and help** (EN 301 549 ch. 12): `--help` and the user guide are plain text + or HTML (no scanned or untagged PDF), translated, and include a section on the accessibility + features (`--plain`, `--no-color`, keyboard use, screen readers). +- R38. **Context menu and dialogs**: only native OS menus and native dialogs, which inherit the + OS accessibility (screen readers, keyboard), with clear labels in the user's language. The + dialogs ask the confirmations of R30 for runs started from the context menu. No custom-drawn + GUI, no PowerShell. - R39. **Verification.** Automated: unit tests on the HTML structure (lang, headings, table - headers, no colour-only status) and an accessibility checker on sample reports in CI (e.g. - `axe-core` or `pa11y`); console tests with `NO_COLOR` and `--plain`. Manual before each - release: NVDA on Windows, VoiceOver on macOS, Orca on Linux, keyboard only, 200% zoom, - Windows high contrast. Results recorded in `docs/accessibility.md`. + headers, no colour-only status), an accessibility checker on sample reports in CI (for + example `axe-core` or `pa11y`), and console tests with `NO_COLOR` and `--plain`. Manual + before each release: NVDA on Windows, VoiceOver on macOS, Orca on Linux, keyboard only, 200% + zoom, Windows high contrast. Results are recorded in `docs/accessibility.md`. -### Uninstalling +### How is it uninstalled? - R40. **`signspector uninstall`** removes everything SignSpector added to the system, and only - that: context menu entries, the Windows "Installed apps" entry (R42), trust-list and CRL cache, - the install manifest (R41). SignSpector saves no preferences and keeps no log files: the - record of written documents is in the report (R33). Same rule as every command that changes - something (R19): it shows the exact list of what it would remove and removes it after a yes/no - question; never from a script (R30); accessible like the rest (R35). -- R41. **Only what we installed.** `install-menu` records every item it creates (path or - registry key, plus a hash of the content) in a manifest in the SignSpector config folder; - `uninstall` removes only manifest items that still match, reports changed or foreign items - and leaves them. If the manifest is lost, entries are recognised by an explicit SignSpector - marker, never by guessing. Running it twice is harmless. Each item is created with - `create_new` (registry keys and `.workflow` folders: see *To decide* after R42). An - item is foreign when it is not in the manifest and has no SignSpector marker. When a foreign - item has the same name, `install-menu` reports it and leaves it, and it never enters the - manifest. So `uninstall` never removes it (owner's decision, 2026-11-23). An item of ours - that already exists (in the manifest, or marked after a lost manifest) is left as it is if - unchanged, and reported if changed. `install-menu` and `uninstall-menu` are the only commands - that replace the manifest; `uninstall` removes it (R40). + that: context menu entries, the Windows "Installed apps" entry (R42), the trust-list and CRL + cache, and the install manifest (R41). SignSpector saves no preferences and keeps no log + files; the record of written documents is in the report (R33). As every command that changes + something (R19), it shows the exact list of what it would remove and removes it after a + yes/no question; never from a script (R30); accessible like the rest (R35). +- R41. **Only what we installed.** + - `install-menu` records every item it creates (path or registry key, plus a hash of the + content) in a manifest in the SignSpector config folder. `uninstall` removes only manifest + items that still match; it reports changed or foreign items and leaves them. + - If the manifest is lost, our items are recognised by an explicit SignSpector marker, never + by guessing. + - Each item is created as R31 says. An item is **foreign** when it is not in the manifest and + has no SignSpector marker. When a foreign item has the same name, `install-menu` reports it + and leaves it, and it never enters the manifest, so `uninstall` never removes it (owner's + decision, 2026-11-23). + - An item of ours that already exists is left as it is if unchanged, and reported if changed. + Running `install-menu` twice is harmless. + - `install-menu` and `uninstall-menu` replace the manifest (R31); `uninstall` removes it (R40). - R42. **Per platform.** - - Windows: per-user, no admin: registry keys under `HKCU`, plus an uninstall entry in - `HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\SignSpector` so the user finds it - in Settings -> Apps; its `UninstallString` runs `signspector.exe uninstall --interactive`, - which shows the list in a native dialog with the focus on Cancel (R30). - A running `.exe` cannot delete itself: the tool says where it is so the user can delete it - (no PowerShell, no scheduled tricks). - - macOS: Quick Actions in `~/Library/Services`, caches in `~/Library/Caches/SignSpector`, + - Windows: per-user, no admin. Registry keys under `HKCU`, plus an uninstall entry in + `HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\SignSpector`, so the user finds + it in Settings -> Apps. Its `UninstallString` runs `signspector.exe uninstall + --interactive`, which shows the list in a native dialog with the focus on Cancel (R30). A + running `.exe` cannot delete itself: the tool says where it is so the user can delete it + (no PowerShell, no scheduled tricks). The cache and manifest folders are still open. + - macOS: Quick Actions in `~/Library/Services`, the cache in `~/Library/Caches/SignSpector`, the manifest in `~/Library/Application Support/SignSpector`. - Linux: Nautilus script, Dolphin service menu, the cache in `~/.cache/signspector`, the - manifest in `~/.config/signspector`. `.deb`/`.rpm` remove only system files they installed; the - per-user items are removed by `signspector uninstall` (the package's removal message - says so). -- *To decide* (before roadmap 3.5): the Windows cache and manifest folders, and how the tool - finds them so that tests can move them. The candidate crate `directories` asks the system - (`SHGetKnownFolderPath`) and ignores `LOCALAPPDATA`, so the test rule of R47 cannot work with - it as is (audit 0007, F2). Tests of `install-menu` must also move the manifest folder - (`XDG_CONFIG_HOME` on Linux, `HOME` on macOS; Windows open, as for the cache). -- *To decide* (before roadmap 5.1): how `create_new` applies to a registry key (for - example `RegCreateKeyEx`, accepted only when the key was created new, also for the - `Uninstall\SignSpector` key) and to a macOS Quick Action, which is a `.workflow` folder. -- *To decide* (before roadmap 5.3): whether `uninstall` removes a file in the cache folder that - the tool did not write, or leaves and lists it (R40, R43); and how leftover temporary files - of an interrupted refresh (R31) are named, skipped and removed. -- *To decide* (before roadmap 5.1), menu items (R41): - - an item of ours that matches the manifest but not what the current version would write - (after an update or a moved executable): updated, or reported; - - after a lost manifest, what a marked item is compared with, and whether it enters the new - manifest; - - a symbolic link or a folder at the manifest path: `install-menu` refuses before it creates - any item; - - Windows `HKCU` and the menu folders (`~/Library/Services`, Nautilus, Dolphin) in tests, - and in the R34 snapshots. -- *To decide* (before roadmap 3.5), cache (R47): - - a refusal at a cache name: the run goes on with the list in memory, or reports "list not - available"; - - the cache folder, or a folder above it, being a symbolic link (redirected profiles); - - the territory code of a national list is checked (two letters) before it becomes a file - name; whether a list given with `--trust-list <file>` is cached. -- *To decide* (before roadmap 3.9): a CA that publishes partitioned CRLs has several CRLs: - name each file by the hash of the CA and of the distribution point, or keep one (R49). -- R43. **User data is never removed**: originals, extracted documents and reports stay; at - the end the tool lists what it left in place on purpose and where the executable is. - -## Architecture (proposal) - -Library crate with one module per concern, the executable only parses arguments and prints: + manifest in `~/.config/signspector`. `.deb` and `.rpm` remove only system files they + installed; the per-user items are removed by `signspector uninstall` (the package's removal + message says so). +- R43. **User data is never removed**: originals, extracted documents and reports stay. At the + end the tool lists what it left in place on purpose and where the executable is. + +## How is the code organised? (proposal) + +A library crate with one module per concern; the executable only parses arguments and prints. | Module | Role | Candidate crates | |---|---|---| @@ -518,18 +499,18 @@ Library crate with one module per concern, the executable only parses arguments | `menu` | context-menu install, manifest, `uninstall` (R21, R40–R43) | `winreg` (Windows) | | `main.rs` | arguments, help | `clap` | -The order of work is in `roadmap.md` (safety-critical, pure parts first). +The order of work is in `roadmap.md`: safety-critical, pure parts first. -## Test data +## Which test data do we use? - Synthetic fixtures in `tests/fixtures/`, generated by a script (Homebrew `openssl@3`: `openssl cms -sign`, `openssl ts`) and by Rust test helpers for what OpenSSL cannot produce: BER indefinite lengths, nested envelopes, `.tsd`, base64, RSA-PSS, ECDSA, countersignatures, tampered content, expired and untrusted certificates, a fake TSL listing the test CA. -- Fuzzing of the `ber` and `cms` readers (`cargo fuzz`, needs nightly) once they exist: no input - may panic or hang. -- Real documents stay on the Windows PC (`tests/corpus/`, git-ignored, personal data): used to - check results by hand and, if useful, against the old tool's output. +- Fuzzing of the `ber` and `cms` readers (`cargo fuzz`, needs nightly) once they exist: no + input may panic or hang. +- Real documents stay on the Windows PC (`tests/corpus/`, git-ignored, personal data). They are + used to check results by hand and, if useful, against the old tool's output. ## Building on the Mac @@ -545,34 +526,107 @@ x86_64-w64-mingw32-objdump -p target/x86_64-pc-windows-gnu/release/signspector.e The Windows executable must import only system DLLs (checked: `KERNEL32`, `ntdll`, `api-ms-win-*`). First milestone on the company PC: run the placeholder `.exe` from `cmd` to -confirm antivirus, SmartScreen and AppLocker accept a mingw-built executable. +confirm that antivirus, SmartScreen and AppLocker accept a mingw-built executable. -## Recorded exceptions +## Which exceptions are recorded? - Until the translation layer exists (roadmap 1.4), the placeholder message in `src/main.rs` is the only hard-coded user-facing text; it goes away with 1.4. -## Open questions +## What is still open? -- `ring` as the crypto provider of rustls (for the TSL refresh over HTTPS): it contains C and - assembly, cross-compiles fine, and is the only provider not banned in `deny.toml` - (`aws-lc-rs` is). Accept it as an exception to "pure Rust", or look for a pure-Rust provider - (e.g. `rustls-rustcrypto`)? To decide before roadmap 3.5 (download of the lists). -- Does the company proxy require integrated authentication (NTLM/Kerberos) to reach the - trusted lists (`ec.europa.eu` for the LOTL, `eidas.agid.gov.it` and the other national - addresses)? If yes, Windows needs WinHTTP for the refresh. -- Brainpool curves, AIA download of missing intermediates: needed by the real files? -- Native dialogs (R30, R38) before roadmap 5.2: a folder list, a text field for the number and - the focus on Cancel. Windows has no stock dialog with a text field (MessageBox and - TaskDialog have none): an own Win32 dialog in Rust, no PowerShell. macOS: AppleScript - `display dialog` (text field, default button Cancel). Linux: `zenity` or `kdialog`, which - may be missing; then a context-menu run refuses (R19). Which crate or code per OS? - Whatever is chosen: helper programs are run from fixed system paths (`/usr/bin/osascript`, - `/usr/bin/zenity`...), never found through `PATH`; folder names reach them as arguments, - never spliced into AppleScript source or markup. Enter in the number field confirms only if - the number is right; otherwise it does nothing. Several folders selected in Windows - Explorer start one process each with plain registry verbs: one summary needs a - multi-selection entry (`IExecuteCommand`, a drop target, or one instance collecting the - others). +The owner closed requirement changes in roadmap step 0.4 (2026-11-23). Each question below is +answered before the roadmap step named in its heading; that step points back here. + +### Before 1.4 (translations) +- Translation mechanism (for example Fluent `.ftl` files embedded in the executable, or + `rust-i18n`), OS language detection (`sys-locale`), how dates and numbers are formatted per + language. + +### Before 1.5 (walk and count) +- A file named exactly `.p7m` (no stem) is not an envelope today: should the report list it as + skipped? Are stand-alone time-stamp responses (`.tsr`) an input format? +- A selected folder whose name starts with `.`: is it analysed or skipped? Is the name judged + after resolving the path (`check .`, `check ..`)? What about a selected folder inside a hidden + one, and a selected symbolic link whose name is hidden but whose target is not, or the + reverse? + +### Before 1.7 (safe writer) and the first pseudo-terminal test - Pseudo-terminal tests (R34) need a pty crate as a dev-dependency, accepted by `deny.toml`: which one, for Unix and Windows ConPTY? + +### Before 3.5 (lists, download, cache) +- `ring` as the crypto provider of rustls (for the list refresh over HTTPS) contains C and + assembly. It cross-compiles fine and is the only provider not banned in `deny.toml` + (`aws-lc-rs` is). Do we accept it as an exception to "pure Rust", or look for a pure-Rust + provider (for example `rustls-rustcrypto`)? +- Does the company proxy require integrated authentication (NTLM or Kerberos) to reach the + trusted lists (`ec.europa.eu` for the LOTL, `eidas.agid.gov.it` and the other national + addresses)? If yes, Windows needs WinHTTP for the refresh. +- Which folders hold the cache and the manifest on Windows, and how do tests move them? The + candidate crate `directories` asks the system (`SHGetKnownFolderPath`) and ignores + `LOCALAPPDATA` and `APPDATA`, so the test rule of R47 cannot work with it as is (audit 0007, + F2). Tests of `install-menu` must also move the manifest folder (`XDG_CONFIG_HOME` on Linux, + `HOME` on macOS). +- When the tool refuses a cache name (R31), does the run go on with the list held in memory, or + report "list not available"? +- What if the cache folder, or a folder above it, is a symbolic link (redirected profiles on + company PCs)? +- Which non-regular files count as "not a regular file" at a cache or manifest name: a FIFO, a + socket, a device, a Windows junction or reparse point? +- What is the fixed name of a national list? The territory code comes from the downloaded LOTL: + is it accepted only as two letters, or hashed? Is a list given with `--trust-list <file>` + cached at all? +- How are temporary files named (R31), so that a leftover from an interrupted refresh does not + block every later refresh? Is a temporary name one the tool derives (R47)? + +### Before 3.6 (chains) +- Brainpool curves, and the download of missing intermediates (AIA): are they needed by the + real files? + +### Before 3.9 (revocation) +- A CA that publishes partitioned CRLs has several CRLs. Is each file named by the hash of the CA + and of the distribution point, or is one kept? R47 and R49 change with the answer. + +### Before 4.2 (HTML report) +- Layout and content of the report: do we start from the old tool's report as a sketch? + +### Before 4.4 (command line) +- What do `--open` and `--threads` do? (R23 asks for parallel work, not an option.) +- Is `extract --no-report` refused as a usage error (exit 2, nothing written), or accepted with a + message saying that the extraction report is written anyway (R16)? + +### Before 5.1 (install manifest) +- How does "created with `create_new`" (R31) apply to a registry key (for example + `RegCreateKeyEx`, accepted only when the key was created new, also for the + `Uninstall\SignSpector` key) and to a macOS Quick Action, which is a `.workflow` folder? +- An item of ours that matches the manifest but not what the current version would write (after + an update or a moved executable): is it updated or reported? If updated, R31, R34 and the + README change, since today a menu item is never replaced. +- After a lost manifest, what is a marked item compared with, and does it enter the new + manifest? +- A symbolic link or a folder at the manifest path: `install-menu` should refuse before it + creates any item; what do `uninstall-menu` and `uninstall` do there? +- How do tests move the Windows `HKCU` menu keys, which no variable moves? (On macOS + `~/Library/Services` moves with `HOME`; Nautilus and Dolphin follow `HOME` or + `XDG_DATA_HOME`.) + +### Before 5.2 (context menu and dialogs) +- Does the dialog of R30 also show the count of files of any kind, as the console summary does + (R19)? +- Native dialogs (R30, R38) need a folder list, a text field for the number and the focus on + Cancel. Windows has no stock dialog with a text field (MessageBox and TaskDialog have none): + an own Win32 dialog in Rust, no PowerShell. macOS: AppleScript `display dialog` (text field, + default button Cancel). Linux: `zenity` or `kdialog`, which may be missing; then a + context-menu run refuses (R19). Which crate or code per OS? Whatever is chosen: + - helper programs are run from fixed system paths (`/usr/bin/osascript`, `/usr/bin/zenity`...), + never found through `PATH`; + - folder names reach them as arguments, never spliced into AppleScript source or markup; + - Enter in the number field confirms only if the number is right; otherwise it does nothing. +- Several folders selected in Windows Explorer start one process each with plain registry + verbs. One summary needs a multi-selection entry (`IExecuteCommand`, a drop target, or one + instance collecting the others). + +### Before 5.3 (uninstall) +- Does `uninstall` remove a file in the cache folder that the tool did not write, or leave and + list it (R40, R43)? Does it remove leftover temporary files (R31)? diff --git a/docs/roadmap.md b/docs/roadmap.md index ea9e976..7e38241 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -14,7 +14,8 @@ The order follows two ideas: ## Phase 0: groundwork - [x] 0.1 First commit and push to `main` (after review of the file list). From then on: one - branch and one draft PR per step, coherence audit every 5 commits, merge by local fast-forward (`CLAUDE.md`). + branch and one draft PR per step, coherence audit every 5 commits, merge by local fast-forward + (`CLAUDE.md`). - [x] 0.2 GitHub Actions CI (`.github/workflows/ci.yml`) on Windows, macOS, Linux, on the shipped targets (windows-gnu, linux-musl, macOS arm64 + x86_64 build): fmt, clippy, nextest, doctests, release build, cargo deny (also weekly), tests of the rule scripts on all three @@ -47,8 +48,8 @@ The order follows two ideas: - `--no-report` (R19); - foreign menu items (R41). - The questions they opened are listed as *To decide* in `docs/design.md`, each with the - roadmap step that needs the answer (3.5, 4.4, 5.1, 5.2, 5.3). + The questions they opened are listed in "What is still open?" in `docs/design.md`, each with the + roadmap step that needs the answer (1.4, 1.5, 1.7, 3.5, 3.6, 3.9, 4.2, 4.4, 5.1, 5.2, 5.3). - [ ] 0.5 Remaining gaps in the rule-script tests, found by the reviews of PR #1, PR #2 and PR #3 and accepted as known limits for now (each needs a test before the code changes): - `check-public.sh`: failures of `git show`, `ls-tree`, `diff-tree` are not each tested; @@ -105,7 +106,8 @@ The order follows two ideas: `Relazione.pdf.p7m` -> `Relazione.pdf`, nested `.pdf.p7m.tsd`, uppercase extensions. - [ ] 1.4 **i18n skeleton** (R27): pick the mechanism (Fluent vs `rust-i18n`, decided with the user), English + Italian, `--lang`, OS language detection. Needed before any message below. -- [ ] 1.5 **Walk and count** (first decide the selected hidden folder, *To decide* after R2) + First decide the questions "Before 1.4" in `docs/design.md`. +- [ ] 1.5 **Walk and count** (first decide the questions "Before 1.5" in `docs/design.md`) (R1b, R2, R19, R28): one or more folders, a row per folder and the total; regular files only, symbolic links met during the walk not followed (a selected one is resolved) and hidden folders skipped (both listed in the report), unreadable folders listed; two counts (files to process, @@ -122,8 +124,9 @@ The order follows two ideas: resolved before the risky-folder check (all path-based kinds of risky folder, not only shares); several folders (total, overlaps counted once). The dialogs themselves come with the menus (5.2). - [ ] 1.7 **Safe writer** (R31): `create_new`, next free name on race, removal of partial files, - stays inside the folder (`..`, symbolic links), free-space check, re-check of originals. - Folder snapshot test helper (R34) introduced here and used from now on. + stays inside the folder (`..`, symbolic links), free-space check, re-check of originals. First + decide the question "Before 1.7" in `docs/design.md`. Folder snapshot test helper (R34) + introduced here and used from now on. ## Phase 2: opening envelopes (thin slice) - [ ] 2.1 `ber` reader: definite and indefinite lengths, limits on depth and size, checked @@ -144,40 +147,41 @@ The order follows two ideas: - [ ] 3.4 `tsl`: LOTL and national lists, signatures verified, embedded LOTL + Italian list, service history (R44, R48). - [ ] 3.5 Choice of lists from the certifiers' countries, download, cache, `--trust-lists`, - `--offline` (R45–R47). First decide the Windows cache folder and how tests move it (*To - decide* after R42 in `docs/design.md`). -- [ ] 3.6 Chain building against the TSL and the system store (R10). + `--offline` (R45–R47). First decide the questions "Before 3.5" in `docs/design.md`. +- [ ] 3.6 Chain building against the TSL and the system store (R10). First decide the question + "Before 3.6" in `docs/design.md`. - [ ] 3.7 Countersignatures (R11); `tsp`: RFC 3161, `.tsd`, `.m7m` (R5, R12); detached `.p7s` (R6). A time stamp is a proved time (R9) only if it verifies per R12 (chain to a trusted-list TSA); negative test: a forged or untrusted time stamp changes no verdict. Which time stamp counts when there are several. - [ ] 3.8 Content sniffing for names without a usable extension (R18). -- [ ] 3.9 Revocation (R49): decide partitioned CRLs (*To decide* after R42); define the case of a - revocation time equal to the time stamp; data embedded in the signature, CRL per CA with cache, - one check per certificate, "revocation not checked" offline. Negative tests: revoked before and - after the time stamp, revoked with no time stamp (cannot be determined, never invalid), stale - or forged embedded data, forged or oversized CRL, CRL older than the reference time, expired - certificate no longer listed, distribution point outside `http`/`https`. Also to define with - the tests: revocation reasons (`removeFromCRL`, `keyCompromise`); an embedded CRL older than - the reference time when the CA's CRL cannot be fetched ("revocation not checked"). +- [ ] 3.9 Revocation (R49): decide the question "Before 3.9" in `docs/design.md`; define the case + of a revocation time equal to the time stamp; data embedded in the signature, CRL per CA with + cache, one check per certificate, "revocation not checked" offline. Negative tests: revoked + before and after the time stamp, revoked with no time stamp (cannot be determined, never + invalid), stale or forged embedded data, forged or oversized CRL, CRL older than the reference + time, expired certificate no longer listed, distribution point outside `http`/`https`. Also to + define with the tests: revocation reasons (`removeFromCRL`, `keyCompromise`); an embedded CRL + older than the reference time when the CA's CRL cannot be fetched ("revocation not checked"). ## Phase 4: output - [ ] 4.1 Console summary, colours with contrast, exit codes (R13, R35). -- [ ] 4.2 Accessible HTML report, WCAG 2.2 AA (R14, R36), checker in CI (R39). +- [ ] 4.2 Accessible HTML report, WCAG 2.2 AA (R14, R36), checker in CI (R39). First decide the + question "Before 4.2" in `docs/design.md`. - [ ] 4.3 Full `--json` (R15); parallel processing with stable output order (R23). -- [ ] 4.4 Command line and translated help, interactive end of run (R19, R20, R37). First - decide `--open`, `--threads` and `extract --no-report` (*To decide* after R19). +- [ ] 4.4 Command line and translated help, interactive end of run (R19, R20, R37). First decide + `--open`, `--threads` and `extract --no-report` (questions "Before 4.4" in `docs/design.md`). ## Phase 5: system integration - [ ] 5.1 Install manifest (R41). First decide how `create_new` applies to registry keys and - `.workflow` folders (*To decide* after R42). + `.workflow` folders and the other questions "Before 5.1" in `docs/design.md`. - [ ] 5.2 Context menu per OS (R21, R38) with the confirmation dialogs (R30): decide what the shorter dialog summary must still show (unreadable folders, alternative names, "existing files modified: 0", a way to see the full list; the list for `undo`, menus and `uninstall`; the - count of files of any kind, *To decide* in R30), with + count of files of any kind, question "Before 5.2" in `docs/design.md`), with R34 tests; Windows "Installed apps" entry (R42). - [ ] 5.3 `uninstall` (R40–R43). First decide what happens to a file in the cache folder that - the tool did not write (*To decide* after R42 in `docs/design.md`). + the tool did not write (questions "Before 5.3" in `docs/design.md`). ## Phase 6: release - [ ] 6.1 Builds for all targets; `.deb`, `.rpm`, `.tar.gz` (R24, R25); one self-contained From 4a99ff1a151a5d3698ad5fbdaa2397da7ee72f8b Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 17:47:56 +0100 Subject: [PATCH 21/36] Restore what the design rewrite dropped; one place for more rules The review of 8bdf261 compared the old and new design requirement by requirement. Restored: - R41: install-menu and uninstall-menu are the only commands that replace the manifest; "an item of ours" is defined again. - R34: at the interactive end of run, documents are written only through R29; the `extract --no-report --json f` case. - R30: a refused run from a script writes nothing (not only no document). - R31 and R41 point to the open question on registry keys and .workflow folders; R19 names the JSON file in the script exception. One place per rule: R30 holds how each kind of run confirms (yes/no default, Enter, focus on Cancel, what runs from a script); R19, R28 and R42 point to it. R28 holds the risky run; R40 removes the cache; R47 says a cached list takes precedence over the embedded copy (R44 pointed there for it). Open questions: the points still in the roadmap text (3.2, 3.7, 3.9, 5.2) moved to "What is still open?"; Brainpool moved before 3.1; two R31 questions added (a name changing between check and rename, a report in a linked folder); unverified statements on APPDATA and HOME removed. Also: headings "What must it do?" and "How do I build it on the Mac?" (the README link follows), no bold labels in R49, commands kept on one line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- README.md | 2 +- docs/design.md | 167 ++++++++++++++++++++++++++++-------------------- docs/roadmap.md | 40 ++++++------ 3 files changed, 116 insertions(+), 93 deletions(-) diff --git a/README.md b/README.md index 0035518..d394740 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ cargo build --release cargo nextest run # tests (cargo install cargo-nextest) ``` -[docs/design.md](docs/design.md#building-on-the-mac) describes the cross builds for all +[docs/design.md](docs/design.md#how-do-i-build-it-on-the-mac) describes the cross builds for all targets from macOS (mingw-w64, zig, cargo-zigbuild). ## How is it developed? diff --git a/docs/design.md b/docs/design.md index cc14e44..7ad2a5f 100644 --- a/docs/design.md +++ b/docs/design.md @@ -17,7 +17,7 @@ SignSpector takes a folder and finds every such file. It opens all the layers an signatures, certificates and time stamps. Then it writes a report anyone can read. On request it saves the signed documents beside the originals, ready to open. -## Requirements +## What must it do? ### Which files does it look at? - R1a. A name is an envelope when its extension is `.p7m`, `.p7s`, `.tsd` or `.m7m`, in any @@ -63,8 +63,8 @@ saves the signed documents beside the originals, ready to open. - R13. A console summary per file, in the user's language (R27), with colours (R35). Exit codes: 0 all fine, 1 problems found, 2 cannot run. - R14. An HTML report (one self-contained file) in each analysed folder, covering that folder - only. With `--report <file>`, one file for the whole run instead. `--no-report` skips the - report of an analysis (not of an extraction: R16). + only. With `--report <file>`, one file for the whole run instead. `--no-report` skips it; + R16 says when it does not apply. - R15. With `--json <file>`, a JSON file with the same information, for scripts. - R16. **What each command writes.** - `check` (the default) writes no document. It writes only the HTML report (R14), the JSON @@ -91,24 +91,18 @@ saves the signed documents beside the originals, ready to open. `undo <report>`, `install-menu`, `uninstall-menu`, `uninstall`. **There is no `--apply`, `--yes` or `--expect`.** - Every command that changes files or the system shows the exact plan first and acts only - after a person confirms. The one exception: `check` on an ordinary folder from a script - writes its report and the cache with no question (R16, R30). - - Where the person is decides how they confirm (R30): - - at a terminal: before analysing, a yes/no question (R28). For files found in a folder the - user types the number (files to process in a risky run, R28; documents to write, R29). - `undo`, `install-menu`, `uninstall-menu` and `uninstall` change only what the tool itself - made, and ask a yes/no question. Yes/no questions default to No, Enter alone cancels, and - the answers and the default are written out in words in the user's language (R35, R27); - - from the context menu (`--interactive`): the same confirmations, with the same number to - type and the same default, in a native dialog (R30, R38), focus on Cancel; - - from a script (no terminal, no `--interactive`): nobody can answer, so they refuse. + after a person confirms. How a person confirms, at a terminal, in a dialog or not at all + from a script, is R30. The one exception: `check` on an ordinary folder from a script writes + its report (HTML and JSON) and the cache with no question (R16, R30). + - A number is typed only for files found in a folder: the files to process in a risky run + (R28) and the documents to write (R29). `undo`, `install-menu`, `uninstall-menu` and + `uninstall` change only what the tool itself made, and ask a yes/no question (R30). - **Several folders.** `check` and `extract` take one or more folders (several can be selected in the file manager). They are counted and confirmed together: - one summary with a row per folder (path, number of files to process, number of files of any kind) and the totals, and one question for all. The number typed is the total; - - when the run is risky, the summary says why: the kind of folder, or the 10,000-file limit - (R28). A single risky folder makes the whole run risky, and the limit applies to the - total; + - when the run is risky (R28), the summary says why: the kind of folder, or the + 10,000-file limit; - a folder with no envelopes is shown with 0; if all are empty, the run stops; - the same folder given twice (also spelt differently: letter case, a symbolic link, a trailing slash), or a folder inside another selected one, is counted once, under the @@ -124,12 +118,11 @@ saves the signed documents beside the originals, ready to open. not even the report or the cache, and downloads nothing: it uses the embedded lists and those already in the cache. - `check --plan` only counts (R28; no envelope is opened) and prints the summary. It asks - no question and runs everywhere, also from a script on a risky folder. + no question and runs everywhere (R30). - `extract --plan` builds the write plan of R29, which opens every envelope. So it asks the - R28 question first (console or dialog), and from a script it runs on an ordinary folder - and refuses a risky one, like `check`. It also says which trusted lists a real run would - download (R45). - - For the other commands it lists the items, with no question, also from a script. + R28 question first, and from a script it behaves like `check` (R30). It also says which + trusted lists a real run would download (R45). + - For the other commands it lists the items, with no question (R30). - Options: `--open`, `--report`, `--no-report`, `--report-lang <code>`, `--json <file>`, `--threads`, `--offline`, `--trust-lists <auto|all|codes>`, `--trust-list <file>`, `--lang <code>`, `--interactive`, `--plain`, `--no-color`, `--plan`. Help is translated @@ -172,18 +165,18 @@ saves the signed documents beside the originals, ready to open. ### How does it protect the user's files? No folder is processed right after a person chooses it: the tool counts first and asks (R28). No document is written without a second, separate confirmation on the full write plan (R29). -There is never an implicit yes (R30). R31 says how every file is created and which files may -ever be replaced. From a script, an ordinary folder is analysed, a risky one is refused (only -counted by `check --plan`), and no document is written (R30). +There is never an implicit yes: R30 says how each kind of run confirms, and what runs from a +script. R31 says how every file is created and which files may ever be replaced. - R28. **Confirm before analysing.** After the folders are chosen, the tool only counts (no - envelope is opened) and asks, default No (Enter alone cancels). + envelope is opened) and asks a yes/no question (R30). - The question shows: folder, number of files to process (the envelopes, R1a), number of files of any kind, total size, number of subfolders, unreadable folders that will be skipped. The interface calls the envelopes "files to process". Zero envelopes: it says so and stops. - **A risky run** gets a stronger warning, and the user must type the number of files to - process. A run is risky when a chosen folder is the root of a drive or volume, the user's + process. A single risky folder makes the whole run risky. A run is risky when a chosen + folder is the root of a drive or volume, the user's home, Desktop, Documents, a system folder (`C:\Windows`, `Program Files`, `/System`, `/usr`, `/etc`...) or a network share root. It is also risky when the folders hold **more than 10,000 files of any kind** in all, subfolders included (owner's decision, 2026-11-23). @@ -199,9 +192,12 @@ counted by `check --plan`), and no document is written (R30). - R30. **Three ways to confirm, never an implicit yes.** - Terminal (`std::io::IsTerminal` on input and output): questions in the console (R19, R28, R29). "Terminal" means both input and output are a terminal. With output redirected - (`| tee log`, `> file`) the run counts as a script. - - Context menu (no terminal, started with `--interactive`): the same confirmations in a - native dialog (R38), with a shorter summary than the console. + (`| tee log`, `> file`) the run counts as a script. Yes/no questions default to No, and + Enter alone cancels. The answers and the default are written out in words in the user's + language (R35, R27). + - Context menu (no terminal, started with `--interactive`): the same confirmations, with the + same number to type and the same default, in a native dialog (R38), with a shorter summary + than the console. - The dialog lists every selected folder with its number of files to process (envelopes to analyse, R28; documents to write, R29), the total, the reason when the run is risky (R19) and the operation proposed. Then it asks the question. @@ -210,8 +206,8 @@ counted by `check --plan`), and no document is written (R30). - In every dialog the focus starts on Cancel. Enter alone and closing the window cancel. There is no time limit. - Script (no terminal, no `--interactive`): `extract`, `undo`, `install-menu`, - `uninstall-menu`, `uninstall`, and `check` on a risky folder (R28) stop with exit code 2 - and say that a person must confirm. A `y` or a number arriving on a pipe is not a + `uninstall-menu`, `uninstall`, and `check` on a risky folder (R28) stop with exit code 2, + write nothing, and say that a person must confirm. A `y` or a number arriving on a pipe is not a confirmation. Only these run: `check` on an ordinary folder, `check --plan`, `extract --plan` on an ordinary folder, and `--plan` of `undo`, the menus and `uninstall` (a list). @@ -223,12 +219,14 @@ counted by `check --plan`), and no document is written (R30). reports, JSON files, menu items, cache files, the manifest, and temporary files. The OS refuses if the name exists, even if the file appeared after the plan. - When the name is taken: a document, report or JSON file takes the next free name (`(1)`, - `(2)`...); a menu item is reported and left (R41). + `(2)`...); a menu item is reported and left (R41). How this applies to registry keys and + `.workflow` folders is still open (question "Before 5.1"). - **Only two kinds of file are ever replaced**: the tool's own cache files (R47) and its install manifest (R41). They are replaced in two steps. The new content is written with `create_new` under a temporary name in the same folder; then that file is renamed over the - old one. The tool never follows a symbolic link there, and it refuses a name that exists - and is not a regular file. Nothing is ever written in place. + old one. A cache file or manifest that does not exist yet follows the same two steps. The + tool never follows a symbolic link there, and it refuses a name that exists and is not a + regular file. Nothing is ever written in place. - A partly written file (error, disk full) is removed, only if the tool created it. - Before writing, each original is re-checked against the analysis (size, mtime, SHA-256). If the folder changed, the plan is rebuilt and confirmed again. @@ -261,10 +259,10 @@ counted by `check --plan`), and no document is written (R30). - R34. **Proof by tests.** A shared test helper snapshots the whole folder (paths and SHA-256) before and after every end-to-end test: originals identical, nothing changed but the confirmed plan. - - Writing (R29, R31, R32): empty answer, `n`, wrong number; a file appearing between plan and - write; names with `..`, reserved names, forbidden characters, NFC/NFD and case collisions, - over-long names; a symbolic link pointing outside; disk full (simulated); `undo` with a - modified file; `undo` on a report that records no document. + - Writing and undo (R29, R31, R32, R33): empty answer, `n`, wrong number; a file appearing + between plan and write; names with `..`, reserved names, forbidden characters, NFC/NFD and + case collisions, over-long names; a symbolic link pointing outside; disk full (simulated); + `undo` with a modified file; `undo` on a report that records no document. - Scripts (R30): every changing command, `check` and `extract --plan` on a risky folder, and `--interactive` without a desktop are refused with exit 2. `check` on an ordinary folder, `check --plan` anywhere, `extract --plan` on an ordinary folder and `--plan` of `undo`, the @@ -275,10 +273,13 @@ counted by `check --plan`), and no document is written (R30). - What `check` writes (R16): only its report is added to the folder, and nothing with `--no-report`. An existing report or JSON file, also one named with `--report` or `--json`, is not replaced: the new one gets the next free name. - - Extraction reports (R16, R20, R33): an extraction at the interactive end of run writes a - second report, and with `--json` a second JSON file, without touching the first. Declining - writes no document. `undo` on the second report removes the documents. `extract - --no-report` follows the open question on it (see "What is still open?"). + - Extraction reports (R16, R20, R33): at the interactive end of run, documents are written + only through R29: a wrong number or Enter alone writes none, and declining writes none. An + extraction there writes a second report, and with `--json` a second JSON file, without + touching the first. `undo` on the second report removes the documents. + `extract --no-report`, with and without `--json f`, follows the open question on it + ("Before 4.4"): either it writes the extraction report (and `f`), or it is refused with + exit 2 and writes nothing. - Cache and manifest (R31, R47): end-to-end tests point the cache to a temporary folder, never the user's real one. A file in the cache folder under a name the tool does not derive is never replaced. A symbolic link, a folder or another non-regular file at one of the @@ -290,10 +291,10 @@ counted by `check --plan`), and no document is written (R30). is reported, left, never enters the manifest, and `uninstall` does not remove it. After a lost manifest, our marked items are recognised. - Counting (R19, R28): the summary shows both counts in each row and in the totals, and the - reason for a risky run; the dialog shows the reason. More than 10,000 files of any kind is - risky even with few envelopes, and the number typed is the files to process: exactly - 10,000 is not risky, 10,001 is, also as a total over several folders. Files in hidden - folders, behind symbolic links met during the walk or in unreadable folders are not + reason for a risky run; the dialog shows the reason. More than 10,000 files of any kind + (subfolders included) is risky even with few envelopes, and the number typed is the files to + process: exactly 10,000 is not risky, 10,001 is, also as a total over several folders. Files + in hidden folders, behind symbolic links met during the walk or in unreadable folders are not counted; a selected folder that is a symbolic link is resolved and counted; overlaps count once. - Several folders (R19): the total is typed; one risky folder makes the run risky; all @@ -335,8 +336,9 @@ Liechtenstein, Norway, United Kingdom). - A national list is used only if its XAdES signature verifies against the certificates the LOTL names for that country. Italy is one country among the others. - The repository stores no trusted list. The release build downloads the current LOTL and the - Italian list and embeds them, so the tool works offline out of the box. At the first run - with network the tool refreshes them into its cache, which then takes precedence (R47). + Italian list and embeds them, so the tool works offline out of the box. At the first run with + network the tool refreshes them into its cache, which then takes precedence over the embedded + copy (R47). - XAdES needs XML canonicalisation (exclusive C14N) and XML signature verification. No mature pure-Rust library exists, so we write it here, test first, as carefully as the BER reader. - R45. **Automatic choice.** The analysis collects the country of every certifier found in the @@ -349,7 +351,8 @@ Liechtenstein, Norway, United Kingdom). is reported as such ("list of Romania not available offline"), never as an invalid signature. - R47. **Cache.** This is the one place for the cache rules. - Lists, and the CRLs of R49, are cached in the SignSpector cache folder and refreshed when - their own `NextUpdate` date passes. `uninstall` removes the cache (R40). + their own `NextUpdate` date passes. A cached list that verifies (R44) takes precedence over + the embedded copy. Removing the cache is R40. - The cache folder is the operating system's standard one (R42); no option moves it. Tests move it only through the system's own variables (`HOME`, `XDG_CACHE_HOME`; Windows is still open). @@ -367,17 +370,18 @@ Liechtenstein, Norway, United Kingdom). certificates, never with the number of files. There is one result per certificate: the same certificate in a thousand files is checked once. A CRL is fetched at most once per CA per run (partitioned CRLs are still open). - - **Reference time**: the proved time of R9 (a time stamp), otherwise the time of the check. - - **Revocation data inside the signature** (CAdES -LT/-LTA) is used only if its own signature + - The reference time is the proved time of R9 (a time stamp), otherwise the time of the + check. + - Revocation data inside the signature (CAdES -LT/-LTA) is used only if its own signature verifies against the issuing CA or an authorised OCSP responder, and it was issued after the reference time. Otherwise it is ignored and the CA's CRL is used. - - **The CA's CRL** is fetched only once the chain reaches a CA of a trusted list. It comes + - The CA's CRL is fetched only once the chain reaches a CA of a trusted list. It comes from its distribution point, `http` or `https` only (redirects too), with limits on size and time. Its signature and issuer are verified before it is used or cached. It answers when it was issued after the reference time. When the reference time is the time of the check, a CRL inside its validity (`thisUpdate` <= now < `nextUpdate`) answers. It is cached until its `nextUpdate` (R47). OCSP is used only when the CA publishes no CRL. - - **Verdicts**: + - The verdicts are: - "not revoked"; - "revoked on <date>", before a proved reference time (a time stamp): invalid; - "revoked on <date>", after the time stamp: valid when signed, and the report shows the @@ -454,18 +458,21 @@ statement). items that still match; it reports changed or foreign items and leaves them. - If the manifest is lost, our items are recognised by an explicit SignSpector marker, never by guessing. - - Each item is created as R31 says. An item is **foreign** when it is not in the manifest and + - Each item is created as R31 says (registry keys and `.workflow` folders: still open, + question "Before 5.1"). An item is **foreign** when it is not in the manifest and has no SignSpector marker. When a foreign item has the same name, `install-menu` reports it and leaves it, and it never enters the manifest, so `uninstall` never removes it (owner's decision, 2026-11-23). - - An item of ours that already exists is left as it is if unchanged, and reported if changed. + - An item of ours that already exists (in the manifest, or marked after a lost manifest) is + left as it is if unchanged, and reported if changed. Running `install-menu` twice is harmless. - - `install-menu` and `uninstall-menu` replace the manifest (R31); `uninstall` removes it (R40). + - `install-menu` and `uninstall-menu` are the only commands that replace the manifest (R31); + `uninstall` removes it (R40). - R42. **Per platform.** - Windows: per-user, no admin. Registry keys under `HKCU`, plus an uninstall entry in `HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\SignSpector`, so the user finds - it in Settings -> Apps. Its `UninstallString` runs `signspector.exe uninstall - --interactive`, which shows the list in a native dialog with the focus on Cancel (R30). A + it in Settings -> Apps. Its `UninstallString` runs + `signspector.exe uninstall --interactive`, which shows the list in a native dialog (R30). A running `.exe` cannot delete itself: the tool says where it is so the user can delete it (no PowerShell, no scheduled tricks). The cache and manifest folders are still open. - macOS: Quick Actions in `~/Library/Services`, the cache in `~/Library/Caches/SignSpector`, @@ -512,7 +519,7 @@ The order of work is in `roadmap.md`: safety-critical, pure parts first. - Real documents stay on the Windows PC (`tests/corpus/`, git-ignored, personal data). They are used to check results by hand and, if useful, against the old tool's output. -## Building on the Mac +## How do I build it on the Mac? ```sh cargo build --release # macOS, this machine @@ -554,6 +561,17 @@ answered before the roadmap step named in its heading; that step points back her ### Before 1.7 (safe writer) and the first pseudo-terminal test - Pseudo-terminal tests (R34) need a pty crate as a dev-dependency, accepted by `deny.toml`: which one, for Unix and Windows ConPTY? +- R31 checks that a cache or manifest name is a regular file, then renames over it: what if the + name changes between the check and the rename? +- R31 keeps documents inside the selected folder. Does a rule cover a report written into a + selected folder that is a symbolic link? + +### Before 3.1 (crypto) +- Brainpool curves: are they needed by the real files? + +### Before 3.2 (certificates) +- How does the report word a certificate expired at the time of the check, when no time stamp + proves an earlier time? ### Before 3.5 (lists, download, cache) - `ring` as the crypto provider of rustls (for the list refresh over HTTPS) contains C and @@ -565,26 +583,30 @@ answered before the roadmap step named in its heading; that step points back her addresses)? If yes, Windows needs WinHTTP for the refresh. - Which folders hold the cache and the manifest on Windows, and how do tests move them? The candidate crate `directories` asks the system (`SHGetKnownFolderPath`) and ignores - `LOCALAPPDATA` and `APPDATA`, so the test rule of R47 cannot work with it as is (audit 0007, - F2). Tests of `install-menu` must also move the manifest folder (`XDG_CONFIG_HOME` on Linux, - `HOME` on macOS). + `LOCALAPPDATA` (audit 0007, F2), so the test rule of R47 cannot work with it as is. Tests of + `install-menu` must also move the manifest folder; which variable does that on each OS is to + be checked. - When the tool refuses a cache name (R31), does the run go on with the list held in memory, or report "list not available"? - What if the cache folder, or a folder above it, is a symbolic link (redirected profiles on company PCs)? - Which non-regular files count as "not a regular file" at a cache or manifest name: a FIFO, a socket, a device, a Windows junction or reparse point? -- What is the fixed name of a national list? The territory code comes from the downloaded LOTL: - is it accepted only as two letters, or hashed? Is a list given with `--trust-list <file>` - cached at all? +- What is the fixed name of a national list? The territory code comes from the downloaded LOTL. + The earlier draft accepted it only as two letters; the alternative is a hash. Which one? Is a + list given with `--trust-list <file>` cached at all? - How are temporary files named (R31), so that a leftover from an interrupted refresh does not block every later refresh? Is a temporary name one the tool derives (R47)? ### Before 3.6 (chains) -- Brainpool curves, and the download of missing intermediates (AIA): are they needed by the - real files? +- The download of missing intermediates (AIA): is it needed by the real files? + +### Before 3.7 (countersignatures and time stamps) +- Which time stamp counts when there are several? ### Before 3.9 (revocation) +- What is the verdict when the revocation time equals the time stamp? How are the revocation + reasons `removeFromCRL` and `keyCompromise` treated? Settled together with the tests. - A CA that publishes partitioned CRLs has several CRLs. Is each file named by the hash of the CA and of the distribution point, or is one kept? R47 and R49 change with the answer. @@ -607,11 +629,14 @@ answered before the roadmap step named in its heading; that step points back her manifest? - A symbolic link or a folder at the manifest path: `install-menu` should refuse before it creates any item; what do `uninstall-menu` and `uninstall` do there? -- How do tests move the Windows `HKCU` menu keys, which no variable moves? (On macOS - `~/Library/Services` moves with `HOME`; Nautilus and Dolphin follow `HOME` or - `XDG_DATA_HOME`.) +- How do tests move the Windows `HKCU` keys (the menu keys and the `Uninstall\SignSpector` + key), which no variable moves, and how do the R34 snapshots cover them? Which variable moves + the menu folders on macOS and Linux is to be checked. ### Before 5.2 (context menu and dialogs) +- What must the shorter dialog summary still show: unreadable folders, alternative names, + "existing files modified: 0", a way to see the full list, and the list for `undo`, the menus + and `uninstall`? - Does the dialog of R30 also show the count of files of any kind, as the console summary does (R19)? - Native dialogs (R30, R38) need a folder list, a text field for the number and the focus on diff --git a/docs/roadmap.md b/docs/roadmap.md index 7e38241..291ebb8 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -41,15 +41,16 @@ The order follows two ideas: `docs/design.md`: - what `check` writes (R16); - risky folders counted on files of any kind (R28); - - reports never replaced, and the second report (R16, R20, R33); + - reports never replaced, and the second report (R16, R20, R31, R33); - `--plan` writes and downloads nothing (R19); - the cache (R47); - no saved preference (R27); - - `--no-report` (R19); + - `--no-report` (R14, R16); - foreign menu items (R41). - The questions they opened are listed in "What is still open?" in `docs/design.md`, each with the - roadmap step that needs the answer (1.4, 1.5, 1.7, 3.5, 3.6, 3.9, 4.2, 4.4, 5.1, 5.2, 5.3). + The questions they opened are listed in "What is still open?" in `docs/design.md`, each with + the roadmap step that needs the answer (1.4, 1.5, 1.7, 3.1, 3.2, 3.5, 3.6, 3.7, 3.9, 4.2, 4.4, + 5.1, 5.2, 5.3). - [ ] 0.5 Remaining gaps in the rule-script tests, found by the reviews of PR #1, PR #2 and PR #3 and accepted as known limits for now (each needs a test before the code changes): - `check-public.sh`: failures of `git show`, `ls-tree`, `diff-tree` are not each tested; @@ -138,10 +139,10 @@ The order follows two ideas: documents recorded in the report with SHA-256, and `undo` (R33). ## Phase 3: verification -- [ ] 3.1 `crypto`: digests, RSA PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384/P-521 (R8). +- [ ] 3.1 `crypto`: digests, RSA PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384/P-521 (R8). First decide + the question "Before 3.1" in `docs/design.md`. - [ ] 3.2 `x509`: certificate fields, key usage, qualified/QSCD statements, validity (R9). - Report wording for a certificate expired at the time of the check when no time stamp - proves an earlier time. + First decide the question "Before 3.2" in `docs/design.md`. - [ ] 3.3 `xmldsig`: exclusive C14N and XML signature verification (R44), test first, fuzzed like `ber`. - [ ] 3.4 `tsl`: LOTL and national lists, signatures verified, embedded LOTL + Italian list, @@ -152,17 +153,16 @@ The order follows two ideas: "Before 3.6" in `docs/design.md`. - [ ] 3.7 Countersignatures (R11); `tsp`: RFC 3161, `.tsd`, `.m7m` (R5, R12); detached `.p7s` (R6). A time stamp is a proved time (R9) only if it verifies per R12 (chain to a trusted-list - TSA); negative test: a forged or untrusted time stamp changes no verdict. Which time stamp - counts when there are several. + TSA); negative test: a forged or untrusted time stamp changes no verdict. First decide the + question "Before 3.7" in `docs/design.md`. - [ ] 3.8 Content sniffing for names without a usable extension (R18). -- [ ] 3.9 Revocation (R49): decide the question "Before 3.9" in `docs/design.md`; define the case - of a revocation time equal to the time stamp; data embedded in the signature, CRL per CA with - cache, one check per certificate, "revocation not checked" offline. Negative tests: revoked - before and after the time stamp, revoked with no time stamp (cannot be determined, never - invalid), stale or forged embedded data, forged or oversized CRL, CRL older than the reference - time, expired certificate no longer listed, distribution point outside `http`/`https`. Also to - define with the tests: revocation reasons (`removeFromCRL`, `keyCompromise`); an embedded CRL - older than the reference time when the CA's CRL cannot be fetched ("revocation not checked"). +- [ ] 3.9 Revocation (R49): decide the questions "Before 3.9" in `docs/design.md`; data embedded + in the signature, CRL per CA with cache, one check per certificate, "revocation not checked" + offline. Negative tests: revoked before and after the time stamp, revoked with no time stamp + (cannot be determined, never invalid), stale or forged embedded data, forged or oversized CRL, + CRL older than the reference time, expired certificate no longer listed, distribution point + outside `http`/`https`. Also: an embedded CRL older than the reference time when the CA's CRL + cannot be fetched ("revocation not checked"). ## Phase 4: output - [ ] 4.1 Console summary, colours with contrast, exit codes (R13, R35). @@ -175,10 +175,8 @@ The order follows two ideas: ## Phase 5: system integration - [ ] 5.1 Install manifest (R41). First decide how `create_new` applies to registry keys and `.workflow` folders and the other questions "Before 5.1" in `docs/design.md`. -- [ ] 5.2 Context menu per OS (R21, R38) with the confirmation dialogs (R30): decide what the - shorter dialog summary must still show (unreadable folders, alternative names, "existing files - modified: 0", a way to see the full list; the list for `undo`, menus and `uninstall`; the - count of files of any kind, question "Before 5.2" in `docs/design.md`), with +- [ ] 5.2 Context menu per OS (R21, R38) with the confirmation dialogs (R30): first decide the + questions "Before 5.2" in `docs/design.md` (what the shorter dialog summary must show), with R34 tests; Windows "Installed apps" entry (R42). - [ ] 5.3 `uninstall` (R40–R43). First decide what happens to a file in the cache folder that the tool did not write (questions "Before 5.3" in `docs/design.md`). From e025b100498d7b3587bc688f8d3fcb10cd96a2f5 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 17:57:29 +0100 Subject: [PATCH 22/36] audit: 0008 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/audits/0008-2026-11-23.md | 180 +++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 docs/audits/0008-2026-11-23.md diff --git a/docs/audits/0008-2026-11-23.md b/docs/audits/0008-2026-11-23.md new file mode 100644 index 0000000..98bb31f --- /dev/null +++ b/docs/audits/0008-2026-11-23.md @@ -0,0 +1,180 @@ +# Coherence audit 0008 (2026-11-23) +Range: b0a9cd9..4a99ff1 (five commits on `step/0.4-writing-guide`, PR #3, draft; working tree clean) Verdict: DRIFT FOUND + +Auditor: `coherence-auditor` agent, fresh context, read-only, run because the cadence is due (5 commits since audit 0007). + +The drift is small and only in documents. No code, script, hook or workflow changed in the range (`git diff --stat b0a9cd9..HEAD`: `docs/design.md`, `docs/roadmap.md`, `README.md`, `CLAUDE.md`, `.claude/agents/fable-reviewer.md`), and no claim about code is false. The rewrite of `docs/design.md` (8bdf261, 4a99ff1) kept all 50 requirement numbers and, as far as this audit compared it, dropped no restriction. It left one dead reference and three pointers that are one requirement off (F1, F2). The seven contradictions and gaps of audit 0007 (F1 to F7) are closed or recorded as open questions. PR #3 still has no APPROVED verdict, and its head commit is not reviewed yet (F3). + +## Unfinished work + +`sh scripts/audit-status.sh` (exit 0): + +``` +== Audit cadence +commits since last audit: 5 (audit every 5) +last audit: b0a9cd9 2026-11-23 audit: 0007 +AUDIT DUE + +== Rust +pinned Rust 1.100.0 is the latest stable + +== Unfinished local work +working tree clean +branch step/0.4-writing-guide: 0 unpushed, 0 not pulled +local branches not merged into main: + step/0.4-writing-guide +remote branches not merged into main: + origin/step/0.4-writing-guide + +== Markers in code +none + +== Leftovers (scripts/cleanup.sh --plan; run scripts/cleanup.sh to remove the local ones) +keep local branch (not merged): step/0.4-writing-guide +on GitHub, merged (kept, nothing is deleted on GitHub): origin/step/0.2-ci +on GitHub, merged (kept, nothing is deleted on GitHub): origin/step/0.2.1-confirmation-rules +on GitHub, draft PR (not closed here): #3 updated 2026-11-23: Roadmap 0.4: writing guide +nothing to remove + +== GitHub +open pull requests: +#3 DRAFT step/0.4-writing-guide updated 2026-11-23: Roadmap 0.4: writing guide +last CI runs on main: +2026-11-23 completed/success: Guard the Windows skips; test the report with no red checks +2026-11-23 completed/success: CI +2026-11-22 completed/success: Remove --apply everywhere, close review and audit 0002 findings +``` + +- **Local work**: nothing uncommitted (`git status --porcelain` empty), no stashes, nothing unpushed, one worktree. +- **Cadence**: `sh scripts/audit-status.sh --gate-push HEAD` exits 0. `--gate-commit` exits 1 ("5 commits since the last coherence audit (limit 5)") until this report is committed alone. Audit 0007 was committed alone (`git show --stat b0a9cd9`: one file). +- **PR #3** (draft, opened 2026-11-23 05:36 UTC, less than a day old, head 4a99ff1, 21 commits, 25 comments): + - What it is for: roadmap 0.4 (`docs/roadmap.md:35-53`): the writing guide, the rewrite of README, design, roadmap, `CLAUDE.md` and the agent prompts to it, the `rust-toolchain.toml` comment, the session-report line for a newer Rust, and the owner's requirement decisions of 2026-11-23 now named in the step. + - Done in this range: the requirement decisions closed and listed (c3311f6, 0fc8394, cebaf40); `docs/design.md` rewritten to the guide with one section of open questions (8bdf261); the restrictions the rewrite had dropped restored (4a99ff1). + - Missing: + - an APPROVED verdict: no comment on PR #3 holds one (`grep -c APPROVED` on the 25 comments: 0). The four reviews of this range are all CHANGES NEEDED (F3); + - a review of the head 4a99ff1; + - the rewrite of `docs/roadmap.md`, `CLAUDE.md` and the agent prompts; + - the `[x]` mark at `docs/roadmap.md:35`, correctly absent. + - State comment: present. The latest comment (16:48 UTC) ends with "State: draft. Next: coherence audit 0008 (five commits since 0007), then a new reviewer on this commit, then the rewrite of docs/roadmap.md, CLAUDE.md and the agent prompts." This closes 0007-F7. + - Still relevant: yes, it is the one open step. +- **CI job lists** (`gh run list --branch step/0.4-writing-guide`, `gh run view 45220594282 --json jobs`, `gh pr checks 3`): + + | Commit | Run | Result | + |---|---|---| + | b0a9cd9 (audit 0007) | 45182718116 | cancelled | + | c3311f6 | 45183073784 | success | + | 0fc8394 | 45184216206 | success | + | cebaf40 | 45185340986 | success | + | 8bdf261 | 45219066210 | success | + | 4a99ff1 (head) | 45220594282 | Repository rules, Linux musl, Windows gnu, macOS arm64: all four `success`, read in the job list | + + The run on b0a9cd9 was cancelled, not red: c3311f6 was pushed two minutes later, and a new push to a pull request replaces the running check. The run on the head was in progress at the start of the audit and finished green during it. GitGuardian passes. `main` is unchanged at 8561ec5, green. +- **Branches**: local `main` and the step branch; on GitHub `main`, `step/0.2-ci` and `step/0.2.1-confirmation-rules` (both merged, kept) and the step branch. Nothing stale. +- **Pull requests** (`gh pr list --state all`): #1 and #2 merged, #3 open as a draft. No other open PR. +- **Markers**: none. +- **Leftovers**: `sh scripts/cleanup.sh --plan` (exit 0) prints the four lines shown above and "nothing to remove". +- **Tracked files that belong to the work, not the product**: none. `git ls-files` shows 38 files; the only reports are the seven under `docs/audits/`. + +## Findings + +### F1. `drift`: a reference to a design section that no longer exists +- `tests/fixtures/README.md:6`: `See "Test data" in docs/design.md for the list of cases to cover.` +- The rewrite renamed that section. `grep -n '^## ' docs/design.md` now gives "Which test data do we use?" (`docs/design.md:511`); `git show b0a9cd9:docs/design.md` had `## Test data`. +- No other file names an old heading: `grep -n -i -e 'open questions' -e 'recorded exceptions' -e 'Building on the Mac' -e '"Architecture'` over `CLAUDE.md`, `README.md`, `docs/roadmap.md`, `docs/writing.md`, the scripts, hooks, sources, `deny.toml`, `rust-toolchain.toml` and the workflow finds nothing. The README anchor `docs/design.md#how-do-i-build-it-on-the-mac` (`README.md:148`) matches the new heading (`docs/design.md:522`). +- Change: update the heading name in `tests/fixtures/README.md`. + +### F2. `drift` (minor): three pointers still name R19 for a rule that 4a99ff1 moved to R30 +- 4a99ff1 says: "R30 holds how each kind of run confirms (yes/no default, Enter, focus on Cancel, what runs from a script); R19, R28 and R42 point to it." R30 now holds it (`docs/design.md:195-197`: "Yes/no questions default to No, and Enter alone cancels. The answers and the default are written out in words"). R19 only says that these commands "ask a yes/no question (R30)" (`docs/design.md:98-99`). +- Still pointing to R19 for the default and the answers: + - `docs/design.md:306`, R34: "Yes/no questions (R19): Enter alone cancels, `y` on a pipe is refused, a number is not a yes." + - `docs/roadmap.md:121`: "yes/no default No (R19)". + - `CLAUDE.md:147-148`: "ask a yes/no question, default No, answers in words (R19, R35)". +- The reader reaches the rule in two hops instead of one; nothing contradicts. Change: name R30 in the three places (the last two when the roadmap and `CLAUDE.md` are rewritten). + +### F3. `unfinished`: PR #3 has no APPROVED verdict, and the head is not reviewed +- `GH_PROMPT_DISABLED=1 gh pr view 3 --json comments </dev/null`: the reviews of c3311f6 (13:25 UTC), 0fc8394 (13:32), cebaf40 (13:38) and 8bdf261 (16:45) are each "VERDICT: CHANGES NEEDED", each by "a new fable-reviewer agent", each followed by a comment saying how it was closed (13:28, 13:35, 16:40, 16:48). No comment reviews 4a99ff1. +- This is the state the last comment announces (review after this audit), so no rule is broken today. `CLAUDE.md:59-61` applies before the PR is marked ready: green on four jobs and an approval posted on the PR. +- Change: none to the files. The next reviewer's verdict on 4a99ff1 goes on the PR. + +### F4. `minor` (gap, for the owner): country codes of certificates and of the LOTL differ for two countries +- R45, `docs/design.md:344-345`: the analysis "collects the country of every certifier found in the files (`C=` of the issuing CA) and loads only those lists". R46 takes codes such as `it,ro,fr` (`docs/design.md:349`). The open question on list file names says "The territory code comes from the downloaded LOTL" (`docs/design.md:595`). +- The LOTL uses `EL` for Greece and `UK` for the United Kingdom; certificates carry the ISO codes `GR` and `GB`. Checked on the public file during this audit: `grep -o 'SchemeTerritory>[A-Z]*<' eu-lotl.xml | sort | uniq -c` lists `EL` and `UK`, and no `GR` or `GB`. +- No text says how a `C=` value is matched to a territory code. R48 names the United Kingdom as accepted (`docs/design.md:367`), so the case is in scope. +- Change: the owner decides; a question "Before 3.5" would record it. Not introduced in this range. + +### F5. `minor`: texts that break `docs/writing.md` +Rewritten file, `docs/design.md`: +- `docs/design.md:6`: "in the requirement named in brackets". Requirements are named in round brackets after the text and in bold titles; the sentence does not say which. +- Sentences far over 20 words, all in R34 test lists: `docs/design.md:308-312` (one sentence, 73 words), `262-265` (53), `300-303` (51). Also `docs/design.md:513-516` (48) and `391-394` (45). +- Broken line layout: `docs/design.md:179` (a line cut after "the user's"). +- Headings that are not questions: the fourteen `### Before x.y (...)` headings (`docs/design.md:548-655`) and "(proposal)" after the question at `docs/design.md:487`. `docs/writing.md:82-84` does not list them among the fixed formats. +- Bold labels at the start of sub-items: `docs/design.md:100,112,117` ("Several folders.", "`--interactive`", "`--plan`"), `177`, `224`. +- "Each rule is written once" (`docs/design.md:6-7`) holds for R16, R31 and R47. A few rules are still stated twice: never overwrite and the `(1)` name in R17 (`docs/design.md:83-84`) and R31 (`221-222`); which runs are allowed from a script in R30 (`211-213`) and in the `--plan` items of R19 (`120-125`). + +Files changed in the range but not yet rewritten: +- `README.md:61`: a line cut after "and a". +- `docs/roadmap.md:120` and `124`: lines cut in the middle of step 1.6; `docs/roadmap.md:94-95`: no blank line before "## Phase 1". +- `docs/roadmap.md:129`: 'the question "Before 1.7"', where the section holds three questions (`docs/design.md:561-567`). +- `CLAUDE.md:141-152`: one bullet of seven long sentences, unchanged from 0007-F9; `CLAUDE.md:159-162`: lines cut after the edit of 8bdf261. +- Lines longer than 100 characters: `CLAUDE.md:4,40`, `.claude/agents/coherence-auditor.md:22`, `.claude/agents/fable-reviewer.md:10` (all carried over); `docs/design.md:495,502,504` are table rows. The front-matter lines of the two prompts are a fixed format. +- No em dash, curly quote, arrow character or emoji in `README.md`, `CLAUDE.md`, `docs/design.md`, `docs/roadmap.md` or the agent prompts (`grep -P` for U+2014, U+2018 to U+201D, U+2192: no line). "Settings -> Apps" (`docs/design.md:474`) now matches the README. + +### F6. `minor`: carried over +- From 0007-F9: `docs/roadmap.md:27`, step 0.2.1, marked done: "from a script nothing that changes anything runs (R30)". R19 names the exception (`docs/design.md:95-96`). +- From 0007-F8: `README.md:166` ("License") is a heading that is not a question and not a listed fixed format. +- From 0005-F3: `docs/roadmap.md:39` promises a "session report line when a newer stable Rust exists"; the script prints a "Rust" section. The text can name the section when 0.4 is marked done. +- From 0001-F12: `Cargo.toml:19-21` declares `assert_cmd` 2.2.2 and `predicates` 3.1.4; `tests/` holds only `fixtures/`, no `tests/*.rs`. +- From 0003-F6: no test fixes the choice that a branch just created at `main` is removed by `cleanup.sh`. + +### Follow-up of audit 0007 +- F1 (foreign file in the cache): closed. The rule is by name everywhere: R31 (`docs/design.md:224-229`), R47 (`359-363`), R34 (`283-287`); the reviewer prompt points to R31 (`.claude/agents/fable-reviewer.md:35-37`). What `uninstall` does with a foreign file is an open question (`docs/design.md:656-657`). +- F2 (Windows cache folder and tests): closed as an open question. R42 and R47 say the Windows folders are still open (`docs/design.md:357-358,477`); the question is under "Before 3.5" (`584-588`). +- F3 (three scopes of "create new"): closed. One rule in R31 (`docs/design.md:218-229`); `README.md:71-76` and `CLAUDE.md:159-160` point to it; `install-menu` and a foreign item are in R41 (`461-465`). +- F4 (`--no-report`): closed. R14 and R16 define it (`docs/design.md:66-67,75-77`); the remaining choice is under "Before 4.4" (`618-619`), and R34 states both outcomes (`280-282`). +- F5 (dialog): closed. R34 has the cases (`docs/design.md:293-294`); the any-kind count in the dialog is under "Before 5.2" (`640-641`). +- F6 (requirement decisions inside step 0.4): closed. `docs/roadmap.md:39-53` names the eight decisions, and the PR text names them. +- F7 (state comment): closed, see "Unfinished work". +- F8: no change needed. F9: partly closed (`--open` and `--threads` are a question at `docs/design.md:617`; the README count rule now names unreadable folders and overlaps, `README.md:59-62`; R28 tells links met during the walk from a selected link, `docs/design.md:183-186`); the rest is in F5 and F6. F10: carried in F6. + +### Verified and found true +- **The rewrite kept the requirements.** The last text before the rewrite (cebaf40) and the head were compared: + - the same 50 requirement labels, R1a to R49, in both (`grep '^- R'` on each); + - every number in the old text is in the new one; the only code-quoted item gone is `XDG_CONFIG_HOME`, removed on purpose (4a99ff1: "unverified statements ... removed"); + - per requirement, the counts of restriction words (never, only, not, no, except, always, must, refuse, without) were compared, and every difference was read: R16, R19, R28, R30, R31, R33, R34, R41, R42 and R47 side by side with the old text. Each difference is a rule moved to its one place (R14, R16, R28, R30, R31, R40, R47) or a restriction added. None was lost at the head. + - every "To decide" item of the old text is a question under "What is still open?" (`docs/design.md:543-657`); `grep -n -i 'to decide'` finds only the table cell at `docs/design.md:494` and `deny.toml:40`, both still right. +- **Open questions and the roadmap point to each other.** The fourteen headings of "What is still open?" (1.4, 1.5, 1.7, 3.1, 3.2, 3.5, 3.6, 3.7, 3.9, 4.2, 4.4, 5.1, 5.2, 5.3) match the list at `docs/roadmap.md:52-53`, and each of those roadmap steps names its section (`docs/roadmap.md:110,111,129,143,145,151,153,157,159,170,173,177,179,182`). +- **Commit messages in the range**: every change they name exists. + - c3311f6, 0fc8394, cebaf40: the decisions on menu items (R41), the extraction report (R16), the cache rule and CRL names (R47), the R34 cases, the roadmap 0.4 list. + - 8bdf261: headings as questions (`grep -n '^#' docs/design.md`), R31, R47 and R16 as single places, `CLAUDE.md`, README and reviewer prompt pointing to R31. + - 4a99ff1: "the only commands" and "an item of ours" in R41 (`docs/design.md:466-470`); the R29-only and `--json f` cases in R34 (`276-282`); "write nothing" in R30 (`208-210`); pointers to "Before 5.1" (`222-223,461-462`); the JSON file in the script exception (`95-96`); precedence of the cached list in R47 (`354-355`); Brainpool before 3.1 (`569-570`); no bold labels in R49. +- **PR #3 text**: "Done so far" names the decisions, the closing of requirement changes and the rewrite. It ends with "Draft. The current state and the next step are in the latest comment", which is true at the head. +- **Verdict comments** (`CLAUDE.md:32-37`): PR #3 carries a verdict for each of the four reviews of the range (F3), each followed by how it was closed. `sh scripts/check-public.sh --message <file>` exits 0 on the PR text and on each of the nine comments of the range; none holds a local path or an address. PR #2: verdict comments present. PR #1: none (0003-F5, predates the rule). +- **Roadmap marks**: 0.1, 0.2, 0.2.1 and 1.0 hold; nothing was marked in the range. `is_envelope` is at `src/lib.rs:10` with six test functions, none ignored. `src/` did not change. There is no other module or public function, so no scope drift in code. +- **Concrete references**: the LOTL address answers; the file is sequence number 398 with 43 pointers (`grep -o '<TSLSequenceNumber>...'`, `grep -o 'OtherTSLPointer>' | wc -l`), as `docs/design.md:330` says. `assert_cmd` 2.2.2 and `predicates` 3.1.4 match `Cargo.lock:21-22,95-96`. Requirement numbers cited in `README.md`, `CLAUDE.md`, the roadmap and the reviewer prompt exist in `docs/design.md` in the sense used, except the three pointers of F2. Laws and standards (Legge 4/2004, D.Lgs. 106/2018, Directive 2019/882, D.Lgs. 82/2022, EN 301 549, WCAG 2.2, ETSI EN 319 102-1, RFC 3161, RFC 5544) are cited in the same sense as before the rewrite. +- **Agent prompts**: `.claude/agents/coherence-auditor.md` is unchanged and agrees with `CLAUDE.md`. The reviewer prompt agrees with R16, R20, R29, R30 and R31 (`.claude/agents/fable-reviewer.md:28-45`). +- **Safety, accessibility, uninstall (R28–R43)**: still no code; nothing is claimed done; the placeholder in `src/main.rs` reads and writes nothing and is the recorded exception (`docs/design.md:540-541`). +- **Language rule**: all text added in the range is English. +- **Public-repository rule**: `sh scripts/check-public.sh --range tip HEAD` exits 0; the five commits and the audit commit have no-reply author addresses (`git log --format='%ae'`). `tests/corpus/` was not read. +- **Not re-checked**: the GitHub settings (branch protection, actions allowlist, secret scanning); the crates named as candidates in the architecture table (unchanged in the range). + +## Health + +Run on macOS arm64 at 4a99ff1, working tree clean. Script tests ran on a scratch copy (`git archive HEAD`) with failing `gh` and `rustup` stubs first in `PATH`. + +| Command | Result | +|---|---| +| `cargo fmt --check` | clean (exit 0) | +| `cargo clippy --all-targets -- -D warnings` | no issues (exit 0) | +| `cargo nextest run` | 5 passed (2 binaries), exit 0 | +| `cargo test --doc` | 0 doctests (none exist), exit 0 | +| `cargo deny check` | `advisories ok, bans ok, licenses ok, sources ok` (exit 0); warnings for allowed licences not used yet (`Unicode-3.0`, `Zlib`, `deny.toml:21-22`) | +| `sh scripts/test-scripts.sh` | 178 passed, 0 failed | +| `sh scripts/test-cleanup.sh` | 79 passed, 0 failed, 0 skipped | +| `sh scripts/test-hooks.sh` | 24 passed, 0 failed | +| `sh scripts/check-public.sh --range tip HEAD` | exit 0 ("0 commits and the tree of 4a99ff1 scanned") | +| `sh scripts/audit-status.sh --gate-push HEAD` | exit 0 | +| `sh scripts/audit-status.sh --gate-commit` | exit 1: "5 commits since the last coherence audit (limit 5)" | +| CI on 4a99ff1 (PR #3) | all four jobs green | +| CI on `main` (8561ec5) | green, unchanged | + +The repository was not modified by the audit: `git status --porcelain` is empty before and after, no stash, HEAD still 4a99ff1. `cleanup.sh` was run with `--plan` only. Nothing was posted or changed on GitHub. The public LOTL file was downloaded once for F4 and for the numbers at `docs/design.md:330`; nothing about this project was sent. From 7179d7b4cf0251633226b6dbe758b01358b43c7d Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:05:07 +0100 Subject: [PATCH 23/36] Say risky run and ordinary run everywhere; close the review of 4a99ff1 The review of 4a99ff1 and audit 0008 found these points. Each is closed here. - R2 lists symbolic links to a file or to a folder again. - R31 no longer lists cache files and the manifest among files created with create_new: they reach their name only by the rename. - R28 defines a risky run and an ordinary run. R30, R34, the roadmap, the README, CLAUDE.md and the reviewer prompt use these terms. A script can no longer read "ordinary folder" as a licence to analyse two folders that hold more than 10,000 files together. - Yes/no questions point to R30, not R19. - R30 says check --plan runs from a script also in a risky run. - R44 points to R47 for the cache instead of restating it. - The rules on dialog helpers moved into R38. - New open questions are under "What is still open?": a race on the first creation of a cache name, a wrong or empty number at the terminal, country codes EL and UK against GR and GB, an embedded list newer than the cached one, the first-refresh trigger, download limits, the system trust store option, CRL limit values, the accessibility checker, double-click detection. - Roadmap 0.2.1 names the check exception; 1.7 says "the questions". - tests/fixtures/README.md points to the heading "Which test data do we use?". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- .claude/agents/fable-reviewer.md | 4 +- CLAUDE.md | 10 ++-- README.md | 6 +- docs/design.md | 98 +++++++++++++++++++------------- docs/roadmap.md | 18 +++--- tests/fixtures/README.md | 2 +- 6 files changed, 78 insertions(+), 60 deletions(-) diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index 4fe1651..82cc983 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -36,8 +36,8 @@ Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). `create_new`, a file replaced in place, a file replaced other than a cache file or the manifest, a symbolic link followed, a non-regular file replaced), can write a document outside the selected folder, lets `--plan` write or download anything, treats a non-terminal input as a - yes, confirms anything from a script (only `check` on an ordinary folder, `check --plan`, - `extract --plan` on an ordinary folder, and the `--plan` lists of `undo`, the menus and + yes, confirms anything from a script (only `check` in an ordinary run, `check --plan`, + `extract --plan` in an ordinary run, and the `--plan` lists of `undo`, the menus and `uninstall` run there), judges time from the signer's claimed signing time, skips the native dialog of a context-menu run, counts several selected folders wrongly (a row each, the total typed, overlaps counted once), or produces a file name that is invalid on another OS (Windows diff --git a/CLAUDE.md b/CLAUDE.md index 4183fd2..a6079eb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -141,11 +141,11 @@ in the history even if deleted later. Before every commit and push: - `check` writes no document: only the report (HTML and JSON) and the tool's cache of trusted lists and CRLs (R16); documents come only from an extraction confirmed through R29 (`extract`, or the interactive end of a `check` run, R20). **There is no `--apply`, `--yes` or `--expect`.** Every - command that changes files or the system shows the exact plan first, except `check` on an - ordinary folder from a script, which writes its report and the cache without a question (R16, - R30). The number is typed only for files found in a folder (files to process in a risky folder, + command that changes files or the system shows the exact plan first, except `check` in an + ordinary run from a script, which writes its report and the cache without a question (R16, + R30). The number is typed only for files found in a folder (files to process in a risky run, R28; documents to write, R29); `undo`, menus and `uninstall` ask a yes/no question, default No, - answers in words (R19, R35). From the context menu the same confirmations come in a native + answers in words (R30, R35). From the context menu the same confirmations come in a native dialog, focus on Cancel; from a script they refuse (R30); `--plan` shows the plan and stops. These rules are for the tool; the developer script `scripts/cleanup.sh` is the one exception (it removes only junk and merged branches, without asking, see above). Never ask the developer to @@ -153,7 +153,7 @@ in the history even if deleted later. Before every commit and push: - Originals are only read, never modified, moved or renamed; existing files are never overwritten ("x.pdf" exists with other content -> "x (1).pdf"). - **Never process right after a person chooses a folder**: first count and ask for - confirmation (R28; from a script an ordinary folder is analysed without a question, a risky + confirmation (R28; from a script an ordinary run is analysed without a question, a risky one is refused); writing needs a second confirmation on the full write plan, with the number typed (R29); no implicit yes, ever (R30: terminal, dialog from the context menu, refusal in scripts). How every file is written, and the only files ever replaced, is R31 in diff --git a/README.md b/README.md index d394740..3147961 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,8 @@ cannot damage them: file in overlapping folders counts once. - From the context menu, the same confirmations appear in a window. - In scripts, only these run: - - `check` on an ordinary folder, and `check --plan`; - - `extract --plan` on an ordinary folder; + - `check` in an ordinary run, and `check --plan`; + - `extract --plan` in an ordinary run; - the `--plan` lists of `undo`, the menu commands and `uninstall`. Everything else stops and says that a person must confirm. @@ -125,7 +125,7 @@ signspector uninstall # remove everything SignSpector installed ``` Every command that changes something shows its plan first and acts only after you confirm. -The one exception is `check` on an ordinary folder from a script, which writes its report and +The one exception is `check` in an ordinary run from a script, which writes its report and the cache without a question. - `extract` asks you to type the number of documents it will write. diff --git a/docs/design.md b/docs/design.md index 7ad2a5f..772d2ea 100644 --- a/docs/design.md +++ b/docs/design.md @@ -25,10 +25,11 @@ saves the signed documents beside the originals, ready to open. (non-UTF-8 names on Linux). *(done: `is_envelope`)* - R1b. The folder is walked recursively. Only regular files are tested with R1a: a folder named `archivio.p7m` is not an envelope. -- R2. Some folders are not walked, and each is listed in the report, so nothing is left out - silently: +- R2. Some entries are not walked or not checked, and each is listed in the report, so nothing + is left out silently: - an unreadable folder is reported and skipped, and the walk goes on; - - a symbolic link met during the walk is not followed (a selected folder is different: R19); + - a symbolic link met during the walk, to a file or to a folder, is not followed (a selected + folder is different: R19); - a hidden folder (name starting with `.`) is skipped. ### How does it open an envelope? @@ -92,7 +93,7 @@ saves the signed documents beside the originals, ready to open. `--yes` or `--expect`.** - Every command that changes files or the system shows the exact plan first and acts only after a person confirms. How a person confirms, at a terminal, in a dialog or not at all - from a script, is R30. The one exception: `check` on an ordinary folder from a script writes + from a script, is R30. The one exception: `check` in an ordinary run from a script writes its report (HTML and JSON) and the cache with no question (R16, R30). - A number is typed only for files found in a folder: the files to process in a risky run (R28) and the documents to write (R29). `undo`, `install-menu`, `uninstall-menu` and @@ -156,7 +157,7 @@ saves the signed documents beside the originals, ready to open. - The language is the one chosen with `--lang it`, otherwise the operating system's language, otherwise English. - No preference is saved. A command to save one can be added later, with its plan and - question (R19). + question (R30). - Source language English; first translation Italian; more can be added without code changes. - The report is written in the interface language by default. `--report-lang <code>` writes it @@ -174,16 +175,17 @@ script. R31 says how every file is created and which files may ever be replaced. files of any kind, total size, number of subfolders, unreadable folders that will be skipped. The interface calls the envelopes "files to process". Zero envelopes: it says so and stops. - - **A risky run** gets a stronger warning, and the user must type the number of files to - process. A single risky folder makes the whole run risky. A run is risky when a chosen - folder is the root of a drive or volume, the user's + - A risky run gets a stronger warning, and the user must type the number of files to + process. A run is risky when one chosen folder is the root of a drive or volume, the user's home, Desktop, Documents, a system folder (`C:\Windows`, `Program Files`, `/System`, `/usr`, `/etc`...) or a network share root. It is also risky when the folders hold **more than 10,000 files of any kind** in all, subfolders included (owner's decision, 2026-11-23). + A run that is not risky is an ordinary run. "Risky" and "ordinary" always describe the + whole run, never one folder. - The 10,000 count covers the regular files of the folders the walk visits (R2). Files in hidden folders, behind symbolic links met during the walk, or in unreadable folders are not counted. A file in overlapping folders counts once. - - Every path-based kind of risky folder is judged on the path after resolving symbolic links. + - Each kind of folder above is judged on the path after resolving symbolic links. - R29. **Confirm before writing.** An extraction first builds the complete write plan and shows it: new documents, documents already present with identical content (not rewritten), documents saved under an alternative name `x (1).pdf`, and "existing files modified: 0" @@ -206,25 +208,26 @@ script. R31 says how every file is created and which files may ever be replaced. - In every dialog the focus starts on Cancel. Enter alone and closing the window cancel. There is no time limit. - Script (no terminal, no `--interactive`): `extract`, `undo`, `install-menu`, - `uninstall-menu`, `uninstall`, and `check` on a risky folder (R28) stop with exit code 2, - write nothing, and say that a person must confirm. A `y` or a number arriving on a pipe is not a - confirmation. Only these run: `check` on an ordinary folder, `check --plan`, - `extract --plan` on an ordinary folder, and `--plan` of `undo`, the menus and `uninstall` - (a list). + `uninstall-menu`, `uninstall`, and `check` in a risky run (R28) stop with exit code 2, + write nothing, and say that a person must confirm. A `y` or a number arriving on a pipe is + not a confirmation. Only these run: `check` in an ordinary run, `check --plan` (also in a + risky run), `extract --plan` in an ordinary run, and `--plan` of `undo`, the menus and + `uninstall` (a list). - R31. **Never overwrite, never write outside.** This is the one place for these rules. - In code, writing a document requires a `ConfirmedPlan` that only the confirmation step can build (typestate): a path that writes without confirmation does not compile. Originals are held in a read-only `Original` type that write functions do not accept. - - **Every file the tool writes is created with `OpenOptions::create_new(true)`**: documents, - reports, JSON files, menu items, cache files, the manifest, and temporary files. The OS - refuses if the name exists, even if the file appeared after the plan. + - Documents, reports, JSON files, menu items and temporary files are created with + `OpenOptions::create_new(true)`. The OS refuses if the name exists, even if the file + appeared after the plan. A cache file and the manifest reach their name only by the rename + described below, also the first time. - When the name is taken: a document, report or JSON file takes the next free name (`(1)`, `(2)`...); a menu item is reported and left (R41). How this applies to registry keys and `.workflow` folders is still open (question "Before 5.1"). - - **Only two kinds of file are ever replaced**: the tool's own cache files (R47) and its + - Only two kinds of file are ever replaced: the tool's own cache files (R47) and its install manifest (R41). They are replaced in two steps. The new content is written with `create_new` under a temporary name in the same folder; then that file is renamed over the - old one. A cache file or manifest that does not exist yet follows the same two steps. The + old one. The tool never follows a symbolic link there, and it refuses a name that exists and is not a regular file. Nothing is ever written in place. - A partly written file (error, disk full) is removed, only if the tool created it. @@ -254,7 +257,7 @@ script. R31 says how every file is created and which files may ever be replaced. SHA-256 (R16, R20). `signspector undo <report>` removes only files written by SignSpector whose content still matches that hash. Changed or missing files are listed and left alone; originals are never touched. It shows what it would remove and removes it after a yes/no - question (R19); never from a script (R30). On a report that records no document it removes + question (R30); never from a script. On a report that records no document it removes nothing and says so. - R34. **Proof by tests.** A shared test helper snapshots the whole folder (paths and SHA-256) before and after every end-to-end test: originals identical, nothing changed but the @@ -263,9 +266,9 @@ script. R31 says how every file is created and which files may ever be replaced. between plan and write; names with `..`, reserved names, forbidden characters, NFC/NFD and case collisions, over-long names; a symbolic link pointing outside; disk full (simulated); `undo` with a modified file; `undo` on a report that records no document. - - Scripts (R30): every changing command, `check` and `extract --plan` on a risky folder, and - `--interactive` without a desktop are refused with exit 2. `check` on an ordinary folder, - `check --plan` anywhere, `extract --plan` on an ordinary folder and `--plan` of `undo`, the + - Scripts (R30): every changing command, `check` and `extract --plan` in a risky run, and + `--interactive` without a desktop are refused with exit 2. `check` in an ordinary run, + `check --plan` in any run, `extract --plan` in an ordinary run and `--plan` of `undo`, the menus and `uninstall` run without a question. Output redirected counts as a script. `--interactive` with a terminal keeps the questions in the terminal. - `--plan` (R19): it writes nothing, not even the report or the cache, and downloads nothing; @@ -297,13 +300,13 @@ script. R31 says how every file is created and which files may ever be replaced. in hidden folders, behind symbolic links met during the walk or in unreadable folders are not counted; a selected folder that is a symbolic link is resolved and counted; overlaps count once. - - Several folders (R19): the total is typed; one risky folder makes the run risky; all + - Several folders (R19): the total is typed; one risky folder makes the whole run risky; all folders empty stop the run; overlaps (also by letter case, symbolic link, trailing slash) are counted once; one report per selected folder that is not inside another; a symbolic link to a risky folder is risky. - Time (R9): a back-dated signing-time attribute changes no verdict; without a time stamp the report says "claimed, not proved". - - Yes/no questions (R19): Enter alone cancels, `y` on a pipe is refused, a number is not a + - Yes/no questions (R30): Enter alone cancels, `y` on a pipe is refused, a number is not a yes. - Dialogs (R30): when a number is required only the right one confirms; yes/no dialogs default to Cancel; the focus starts on Cancel; Enter alone and closing the window cancel; a wrong @@ -337,8 +340,7 @@ Liechtenstein, Norway, United Kingdom). LOTL names for that country. Italy is one country among the others. - The repository stores no trusted list. The release build downloads the current LOTL and the Italian list and embeds them, so the tool works offline out of the box. At the first run with - network the tool refreshes them into its cache, which then takes precedence over the embedded - copy (R47). + network the tool refreshes them into its cache (R47). - XAdES needs XML canonicalisation (exclusive C14N) and XML signature verification. No mature pure-Rust library exists, so we write it here, test first, as carefully as the BER reader. - R45. **Automatic choice.** The analysis collects the country of every certifier found in the @@ -353,12 +355,12 @@ Liechtenstein, Norway, United Kingdom). - Lists, and the CRLs of R49, are cached in the SignSpector cache folder and refreshed when their own `NextUpdate` date passes. A cached list that verifies (R44) takes precedence over the embedded copy. Removing the cache is R40. - - The cache folder is the operating system's standard one (R42); no option moves it. Tests - move it only through the system's own variables (`HOME`, `XDG_CACHE_HOME`; Windows is still - open). + - The cache folder is the operating system's standard one (R42); no option moves it. Tests move + it only through the system's own variables (`HOME`, `XDG_CACHE_HOME`; Windows: question + "Before 3.5", open). - The tool uses only names it derives itself: one fixed name per list, and for a CRL the - SHA-256 of its CA certificate (partitioned CRLs are still open). A name is never text taken - from the input. + SHA-256 of its CA certificate (partitioned CRLs: question "Before 3.9"). A name is never text + taken from the input. - It never replaces another file found in that folder. A cache file is replaced only as R31 says: a new file, a rename, no symbolic link. - R48. **Verdicts.** Qualified status is checked at the reference time (R9) using the service @@ -369,7 +371,7 @@ Liechtenstein, Norway, United Kingdom). - R49. **Revocation without a query per signature.** Network traffic grows with the number of certificates, never with the number of files. There is one result per certificate: the same certificate in a thousand files is checked once. A CRL is fetched at most once per CA per - run (partitioned CRLs are still open). + run (partitioned CRLs: question "Before 3.9"). - The reference time is the proved time of R9 (a time stamp), otherwise the time of the check. - Revocation data inside the signature (CAdES -LT/-LTA) is used only if its own signature @@ -438,7 +440,10 @@ statement). - R38. **Context menu and dialogs**: only native OS menus and native dialogs, which inherit the OS accessibility (screen readers, keyboard), with clear labels in the user's language. The dialogs ask the confirmations of R30 for runs started from the context menu. No custom-drawn - GUI, no PowerShell. + GUI, no PowerShell. Helper programs that show a dialog are run from fixed system paths + (`/usr/bin/osascript`, `/usr/bin/zenity`...), never found through `PATH`. Folder names reach + them as arguments, never spliced into script source or markup. In a number field, Enter + confirms only if the number is right; otherwise it does nothing. - R39. **Verification.** Automated: unit tests on the HTML structure (lang, headings, table headers, no colour-only status), an accessibility checker on sample reports in CI (for example `axe-core` or `pa11y`), and console tests with `NO_COLOR` and `--plain`. Manual @@ -474,7 +479,7 @@ statement). it in Settings -> Apps. Its `UninstallString` runs `signspector.exe uninstall --interactive`, which shows the list in a native dialog (R30). A running `.exe` cannot delete itself: the tool says where it is so the user can delete it - (no PowerShell, no scheduled tricks). The cache and manifest folders are still open. + (no PowerShell, no scheduled tricks). The cache and manifest folders: question "Before 3.5". - macOS: Quick Actions in `~/Library/Services`, the cache in `~/Library/Caches/SignSpector`, the manifest in `~/Library/Application Support/SignSpector`. - Linux: Nautilus script, Dolphin service menu, the cache in `~/.cache/signspector`, the @@ -565,6 +570,11 @@ answered before the roadmap step named in its heading; that step points back her name changes between the check and the rename? - R31 keeps documents inside the selected folder. Does a rule cover a report written into a selected folder that is a symbolic link? +- The first creation of a cache file or the manifest is also a rename (R31). A foreign file that + appears at that name between the check and the rename would be replaced: how is that + prevented? +- What does a wrong or empty number do at the terminal (R29, R30)? The dialog case is in R30; + the terminal case is only in the R34 tests. ### Before 3.1 (crypto) - Brainpool curves: are they needed by the real files? @@ -597,9 +607,18 @@ answered before the roadmap step named in its heading; that step points back her list given with `--trust-list <file>` cached at all? - How are temporary files named (R31), so that a leftover from an interrupted refresh does not block every later refresh? Is a temporary name one the tool derives (R47)? +- Certificates carry ISO country codes (`GR`, `GB`); the LOTL uses `EL` for Greece and `UK` for + the United Kingdom (audit 0008, F4). How is a certificate's `C=` matched to a list, and which + codes does `--trust-lists` accept? +- After an upgrade, the embedded LOTL may be newer than a cached one whose `NextUpdate` has not + passed. Does the higher sequence number win over R47's precedence of the cache? +- Which event triggers the first refresh: the first run with network (R44) or a passed + `NextUpdate` (R47)? +- Which limits on size and time apply to list downloads? ### Before 3.6 (chains) - The download of missing intermediates (AIA): is it needed by the real files? +- R10 says the chain may optionally reach the system trust store. Which option turns it on? ### Before 3.7 (countersignatures and time stamps) - Which time stamp counts when there are several? @@ -607,16 +626,19 @@ answered before the roadmap step named in its heading; that step points back her ### Before 3.9 (revocation) - What is the verdict when the revocation time equals the time stamp? How are the revocation reasons `removeFromCRL` and `keyCompromise` treated? Settled together with the tests. +- Which values do the CRL limits on size and time take (R49)? - A CA that publishes partitioned CRLs has several CRLs. Is each file named by the hash of the CA and of the distribution point, or is one kept? R47 and R49 change with the answer. ### Before 4.2 (HTML report) - Layout and content of the report: do we start from the old tool's report as a sketch? +- Which accessibility checker runs in CI (R39: `axe-core`, `pa11y`, or another)? ### Before 4.4 (command line) - What do `--open` and `--threads` do? (R23 asks for parallel work, not an option.) - Is `extract --no-report` refused as a usage error (exit 2, nothing written), or accepted with a message saying that the extraction report is written anyway (R16)? +- How is a double-click on Windows detected (R20), and which folder does it analyse? ### Before 5.1 (install manifest) - How does "created with `create_new`" (R31) apply to a registry key (for example @@ -643,11 +665,7 @@ answered before the roadmap step named in its heading; that step points back her Cancel. Windows has no stock dialog with a text field (MessageBox and TaskDialog have none): an own Win32 dialog in Rust, no PowerShell. macOS: AppleScript `display dialog` (text field, default button Cancel). Linux: `zenity` or `kdialog`, which may be missing; then a - context-menu run refuses (R19). Which crate or code per OS? Whatever is chosen: - - helper programs are run from fixed system paths (`/usr/bin/osascript`, `/usr/bin/zenity`...), - never found through `PATH`; - - folder names reach them as arguments, never spliced into AppleScript source or markup; - - Enter in the number field confirms only if the number is right; otherwise it does nothing. + context-menu run refuses (R30). Which crate or code per OS? Whatever is chosen follows R38. - Several folders selected in Windows Explorer start one process each with plain registry verbs. One summary needs a multi-selection entry (`IExecuteCommand`, a drop target, or one instance collecting the others). diff --git a/docs/roadmap.md b/docs/roadmap.md index 291ebb8..78f23d1 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -24,7 +24,8 @@ The order follows two ideas: force-push. CI is an alarm; the local hooks are the barrier. - [x] 0.2.1 Confirmation rules simplified: the typed number only for files found in a folder (R28, R29); `undo`, menus and `uninstall` ask yes/no; from the context menu the same - confirmations come in a native dialog; from a script nothing that changes anything runs (R30); + confirmations come in a native dialog; from a script nothing that changes anything runs except + `check` in an ordinary run, which writes its report and the cache (R30); `check`/`extract` take several folders (a row each, the total typed); revocation without a query per signature (R49); no `--yes`/`--expect`; `scripts/cleanup.sh` removes its safe leftovers without asking. @@ -117,16 +118,15 @@ The order follows two ideas: included). - [ ] 1.6 **Confirmation logic** (R28–R30): pure functions turning (counts, folder, terminal, dialog via `--interactive`, or script; `--plan`) into the question to ask and parsing the - answer: typed count (R28 risky folder, - R29), yes/no default No (R19). Typestate `ConfirmedPlan`. Tests: Enter, `n`, wrong number, - changing command, and `check` or `extract --plan` on a risky folder, refused from a - script; `check --plan`, `extract --plan` on an ordinary folder and the item lists of - `--plan` run from a script; symbolic links - resolved before the risky-folder check (all path-based kinds of risky folder, not only shares); - several folders (total, overlaps counted once). The dialogs themselves come with the menus (5.2). + answer: typed count (R28 risky run, R29), yes/no default No (R30). Typestate + `ConfirmedPlan`. Tests: Enter, `n`, wrong number, changing command, and `check` or + `extract --plan` in a risky run, refused from a script; `check --plan`, `extract --plan` in an + ordinary run and the item lists of `--plan` run from a script; symbolic links resolved before + each folder is judged (all path-based kinds of risky folder, not only shares); several folders + (total, overlaps counted once). The dialogs themselves come with the menus (5.2). - [ ] 1.7 **Safe writer** (R31): `create_new`, next free name on race, removal of partial files, stays inside the folder (`..`, symbolic links), free-space check, re-check of originals. First - decide the question "Before 1.7" in `docs/design.md`. Folder snapshot test helper (R34) + decide the questions "Before 1.7" in `docs/design.md`. Folder snapshot test helper (R34) introduced here and used from now on. ## Phase 2: opening envelopes (thin slice) diff --git a/tests/fixtures/README.md b/tests/fixtures/README.md index 8ec3af5..3cad87f 100644 --- a/tests/fixtures/README.md +++ b/tests/fixtures/README.md @@ -3,4 +3,4 @@ Synthetic files only: test CA, test signers and test time stamps generated by a script (Homebrew `openssl@3`) or by Rust test helpers. No real signed documents here: they contain personal data and stay on the Windows PC in `tests/corpus/` (git-ignored). -See "Test data" in `docs/design.md` for the list of cases to cover. +See "Which test data do we use?" in `docs/design.md` for the list of cases to cover. From b3c6fb9cb5a8a219c02f88f6ac68ea4776009eb7 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:11:26 +0100 Subject: [PATCH 24/36] Name the sensitive folders; one rule per place (review of 7179d7b) - R31 states the universal rule again: every file the tool writes is created with create_new. Cache files and the manifest are created that way under a temporary name, then renamed. - R28 calls the listed kinds of folder "sensitive folders". "Risky" describes only a run. R34, the README and roadmap 0.4, 1.5 and 1.6 use these terms. Roadmap 1.5 states the 10,000 limit as a total over the run. - The question on a wrong or empty number at the terminal moves to a new section "Before 1.6"; roadmap 1.6 points to it. - R21 points to R30 for its yes/no question. - R38 no longer states what Enter does in a number field; R30 is the one place. - The dialog tests in R34 point to R30 and R38. The reviewer and auditor prompts name the helper rules of R38 with R28 to R34. - The README defines an ordinary run. - Minor: roadmap 3.6 and 4.2 say "the questions"; 4.4 names the double-click question; the two overlapping questions before 1.7 are one; R31 reflowed; roadmap 1.6 splits terminal tests from script tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- .claude/agents/coherence-auditor.md | 8 ++-- .claude/agents/fable-reviewer.md | 3 +- README.md | 6 +-- docs/design.md | 63 ++++++++++++++--------------- docs/roadmap.md | 32 ++++++++------- 5 files changed, 57 insertions(+), 55 deletions(-) diff --git a/.claude/agents/coherence-auditor.md b/.claude/agents/coherence-auditor.md index b9cba73..dfce678 100644 --- a/.claude/agents/coherence-auditor.md +++ b/.claude/agents/coherence-auditor.md @@ -35,10 +35,10 @@ Read first: `CLAUDE.md`, `docs/design.md`, `docs/roadmap.md`, the latest report hooks and scripts must not contradict each other (numbering of requirements, rules, commands, paths). Note anything outdated. Report texts that break `docs/writing.md`, with `file:line`. -6. **Project rules.** Safety rules (R28–R34), accessibility (R35–R39), uninstall (R40–R43), - language rules (English in the repository, translated user interface), public-repository - rules (`sh scripts/check-public.sh --range tip HEAD`). Check that every pull request carries - the reviewer's verdict as a comment: +6. **Project rules.** Safety rules (R28–R34, dialog helpers in R38), accessibility (R35–R39), + uninstall (R40–R43), language rules (English in the repository, translated user interface), + public-repository rules (`sh scripts/check-public.sh --range tip HEAD`). Check that every pull + request carries the reviewer's verdict as a comment: `GH_PROMPT_DISABLED=1 gh pr view <n> --comments </dev/null`. 7. **Health.** `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, `cargo nextest run`, `cargo test --doc`, `cargo deny check`; report the actual results. diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index 82cc983..ae7d8bc 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -30,7 +30,8 @@ Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). confirmed by the typed number (`extract`, or the interactive end of run, R20, R29); existing files are never overwritten, not even a report; no panic on malformed input (no `unwrap`/`expect`/indexing on untrusted data outside tests); no PowerShell; no OpenSSL or C - dependencies. Confirmation and write safety (R28–R34 in `docs/design.md`) is a fixed point of + dependencies. Confirmation and write safety (R28–R34 and the dialog helper rules of R38 in + `docs/design.md`) is a fixed point of every review: look for any path that processes without the first confirmation, writes a document without a `ConfirmedPlan`, breaks any part of R31 (a file opened without `create_new`, a file replaced in place, a file replaced other than a cache file or the manifest, diff --git a/README.md b/README.md index 3147961..e0114dd 100644 --- a/README.md +++ b/README.md @@ -53,10 +53,10 @@ cannot damage them: - the root of a drive or volume; - the home folder, Desktop or Documents; - a system folder; - - a network share root; - - a folder that holds more than 10,000 files of any kind, subfolders included. + - a network share root. - A run is also risky when the folders chosen hold more than 10,000 files in all. Files the + A run is also risky when the folders chosen hold more than 10,000 files of any kind in all, + subfolders included. A run that is not risky is an ordinary run. Files the analysis skips are not counted (hidden folders, symbolic links inside the folders, unreadable folders), and a file in overlapping folders counts once. diff --git a/docs/design.md b/docs/design.md index 772d2ea..9de4879 100644 --- a/docs/design.md +++ b/docs/design.md @@ -135,7 +135,7 @@ saves the signed documents beside the originals, ready to open. free name, R31) with the analysis and the documents written, and `undo` uses that one (R33). - With `--json`, it also writes a second JSON file beside the first. - After `check --no-report` there is no first report: the extraction report is the only one. -- R21. `install-menu` and `uninstall-menu` (plan and yes/no question, R19) add and remove the +- R21. `install-menu` and `uninstall-menu` (plan and yes/no question, R30) add and remove the file manager's context menu: Windows per-user registry keys (no admin, no PowerShell), macOS Quick Actions, a Linux Nautilus script and Dolphin service menu. Full removal: `uninstall` (R40–R43). @@ -175,17 +175,17 @@ script. R31 says how every file is created and which files may ever be replaced. files of any kind, total size, number of subfolders, unreadable folders that will be skipped. The interface calls the envelopes "files to process". Zero envelopes: it says so and stops. - - A risky run gets a stronger warning, and the user must type the number of files to - process. A run is risky when one chosen folder is the root of a drive or volume, the user's - home, Desktop, Documents, a system folder (`C:\Windows`, `Program Files`, `/System`, - `/usr`, `/etc`...) or a network share root. It is also risky when the folders hold **more - than 10,000 files of any kind** in all, subfolders included (owner's decision, 2026-11-23). - A run that is not risky is an ordinary run. "Risky" and "ordinary" always describe the - whole run, never one folder. + - A risky run gets a stronger warning, and the user must type the number of files to process. A + run is risky when one chosen folder is a sensitive folder: the root of a drive or volume, the + user's home, Desktop, Documents, a system folder (`C:\Windows`, `Program Files`, `/System`, + `/usr`, `/etc`...) or a network share root. It is also risky when the folders hold **more than + 10,000 files of any kind** in all, subfolders included (owner's decision, 2026-11-23). A run + that is not risky is an ordinary run. "Risky" and "ordinary" always describe the whole run, + never one folder. - The 10,000 count covers the regular files of the folders the walk visits (R2). Files in hidden folders, behind symbolic links met during the walk, or in unreadable folders are not counted. A file in overlapping folders counts once. - - Each kind of folder above is judged on the path after resolving symbolic links. + - Each kind of sensitive folder is judged on the path after resolving symbolic links. - R29. **Confirm before writing.** An extraction first builds the complete write plan and shows it: new documents, documents already present with identical content (not rewritten), documents saved under an alternative name `x (1).pdf`, and "existing files modified: 0" @@ -217,19 +217,19 @@ script. R31 says how every file is created and which files may ever be replaced. - In code, writing a document requires a `ConfirmedPlan` that only the confirmation step can build (typestate): a path that writes without confirmation does not compile. Originals are held in a read-only `Original` type that write functions do not accept. - - Documents, reports, JSON files, menu items and temporary files are created with - `OpenOptions::create_new(true)`. The OS refuses if the name exists, even if the file - appeared after the plan. A cache file and the manifest reach their name only by the rename - described below, also the first time. + - Every file the tool writes is created with `OpenOptions::create_new(true)`: documents, + reports, JSON files, menu items and temporary files. The OS refuses if the name exists, even + if the file appeared after the plan. A cache file and the manifest are created that way under + a temporary name, and reach their own name only by the rename described below, also the + first time. - When the name is taken: a document, report or JSON file takes the next free name (`(1)`, `(2)`...); a menu item is reported and left (R41). How this applies to registry keys and `.workflow` folders is still open (question "Before 5.1"). - Only two kinds of file are ever replaced: the tool's own cache files (R47) and its install manifest (R41). They are replaced in two steps. The new content is written with `create_new` under a temporary name in the same folder; then that file is renamed over the - old one. The - tool never follows a symbolic link there, and it refuses a name that exists and is not a - regular file. Nothing is ever written in place. + old one. The tool never follows a symbolic link there, and it refuses a name that exists and + is not a regular file. Nothing is ever written in place. - A partly written file (error, disk full) is removed, only if the tool created it. - Before writing, each original is re-checked against the analysis (size, mtime, SHA-256). If the folder changed, the plan is rebuilt and confirmed again. @@ -300,19 +300,19 @@ script. R31 says how every file is created and which files may ever be replaced. in hidden folders, behind symbolic links met during the walk or in unreadable folders are not counted; a selected folder that is a symbolic link is resolved and counted; overlaps count once. - - Several folders (R19): the total is typed; one risky folder makes the whole run risky; all + - Several folders (R19): the total is typed; one sensitive folder makes the whole run risky; all folders empty stop the run; overlaps (also by letter case, symbolic link, trailing slash) are counted once; one report per selected folder that is not inside another; a symbolic - link to a risky folder is risky. + link to a sensitive folder makes the run risky. - Time (R9): a back-dated signing-time attribute changes no verdict; without a time stamp the report says "claimed, not proved". - Yes/no questions (R30): Enter alone cancels, `y` on a pipe is refused, a number is not a yes. - - Dialogs (R30): when a number is required only the right one confirms; yes/no dialogs default - to Cancel; the focus starts on Cancel; Enter alone and closing the window cancel; a wrong - number does not confirm; every selected folder with its count, the total and the operation - are shown; a fake dialog helper placed first in `PATH` is not used; a folder name with - quotes or script code is shown as text, never run. + - Dialogs (R30, R38): when a number is required only the right one confirms; yes/no dialogs + default to Cancel; the focus starts on Cancel; Enter alone and closing the window cancel; a + wrong number does not confirm; every selected folder with its count, the total and the operation + are shown; a fake dialog helper placed first in `PATH` is not used; a folder name with quotes or + script code is shown as text, never run. How are confirmed runs tested without a bypass? The public confirmation has two constructors only, terminal and dialog, which take no input source: they open the terminal or the dialog @@ -442,8 +442,7 @@ statement). dialogs ask the confirmations of R30 for runs started from the context menu. No custom-drawn GUI, no PowerShell. Helper programs that show a dialog are run from fixed system paths (`/usr/bin/osascript`, `/usr/bin/zenity`...), never found through `PATH`. Folder names reach - them as arguments, never spliced into script source or markup. In a number field, Enter - confirms only if the number is right; otherwise it does nothing. + them as arguments, never spliced into script source or markup. - R39. **Verification.** Automated: unit tests on the HTML structure (lang, headings, table headers, no colour-only status), an accessibility checker on sample reports in CI (for example `axe-core` or `pa11y`), and console tests with `NO_COLOR` and `--plain`. Manual @@ -563,18 +562,18 @@ answered before the roadmap step named in its heading; that step points back her one, and a selected symbolic link whose name is hidden but whose target is not, or the reverse? +### Before 1.6 (confirmation logic) +- What does a wrong or empty number do at the terminal (R29, R30)? The dialog case is in R30; + the terminal case is only in the R34 tests. + ### Before 1.7 (safe writer) and the first pseudo-terminal test - Pseudo-terminal tests (R34) need a pty crate as a dev-dependency, accepted by `deny.toml`: which one, for Unix and Windows ConPTY? -- R31 checks that a cache or manifest name is a regular file, then renames over it: what if the - name changes between the check and the rename? +- R31 checks that a cache or manifest name is a regular file, then renames over it. What if the + name changes between the check and the rename, or a foreign file appears at a name that did + not exist yet (the first creation is also a rename)? How is that prevented? - R31 keeps documents inside the selected folder. Does a rule cover a report written into a selected folder that is a symbolic link? -- The first creation of a cache file or the manifest is also a rename (R31). A foreign file that - appears at that name between the check and the rename would be replaced: how is that - prevented? -- What does a wrong or empty number do at the terminal (R29, R30)? The dialog case is in R30; - the terminal case is only in the R34 tests. ### Before 3.1 (crypto) - Brainpool curves: are they needed by the real files? diff --git a/docs/roadmap.md b/docs/roadmap.md index 78f23d1..406d80e 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -41,7 +41,7 @@ The order follows two ideas: step also led to owner's decisions on requirements (2026-11-23), recorded in `docs/design.md`: - what `check` writes (R16); - - risky folders counted on files of any kind (R28); + - risky runs counted on files of any kind (R28); - reports never replaced, and the second report (R16, R20, R31, R33); - `--plan` writes and downloads nothing (R19); - the cache (R47); @@ -50,8 +50,8 @@ The order follows two ideas: - foreign menu items (R41). The questions they opened are listed in "What is still open?" in `docs/design.md`, each with - the roadmap step that needs the answer (1.4, 1.5, 1.7, 3.1, 3.2, 3.5, 3.6, 3.7, 3.9, 4.2, 4.4, - 5.1, 5.2, 5.3). + the roadmap step that needs the answer (1.4, 1.5, 1.6, 1.7, 3.1, 3.2, 3.5, 3.6, 3.7, 3.9, 4.2, + 4.4, 5.1, 5.2, 5.3). - [ ] 0.5 Remaining gaps in the rule-script tests, found by the reviews of PR #1, PR #2 and PR #3 and accepted as known limits for now (each needs a test before the code changes): - `check-public.sh`: failures of `git show`, `ls-tree`, `diff-tree` are not each tested; @@ -113,17 +113,18 @@ The order follows two ideas: (R1b, R2, R19, R28): one or more folders, a row per folder and the total; regular files only, symbolic links met during the walk not followed (a selected one is resolved) and hidden folders skipped (both listed in the report), unreadable folders listed; two counts (files to process, - files of any kind), total size, subfolders. Risky-folder detection (drive roots, home, Desktop, - Documents, system folders, network share roots, > 10,000 files of any kind, subfolders - included). -- [ ] 1.6 **Confirmation logic** (R28–R30): pure functions turning (counts, folder, terminal, + files of any kind), total size, subfolders. Detection of sensitive folders (drive roots, home, + Desktop, Documents, system folders, network share roots) and of a risky run (a sensitive + folder, or more than 10,000 files of any kind over all the folders, subfolders included). +- [ ] 1.6 **Confirmation logic** (R28–R30; first decide the question "Before 1.6" in + `docs/design.md`): pure functions turning (counts, folder, terminal, dialog via `--interactive`, or script; `--plan`) into the question to ask and parsing the answer: typed count (R28 risky run, R29), yes/no default No (R30). Typestate - `ConfirmedPlan`. Tests: Enter, `n`, wrong number, changing command, and `check` or - `extract --plan` in a risky run, refused from a script; `check --plan`, `extract --plan` in an - ordinary run and the item lists of `--plan` run from a script; symbolic links resolved before - each folder is judged (all path-based kinds of risky folder, not only shares); several folders - (total, overlaps counted once). The dialogs themselves come with the menus (5.2). + `ConfirmedPlan`. Tests at the terminal: Enter, `n`, wrong number, changing command. Tests + from a script: `check` and `extract --plan` in a risky run are refused; `check --plan`, + `extract --plan` in an ordinary run and the item lists of `--plan` run. Also: symbolic links + resolved before each folder is judged (all kinds of sensitive folder, not only shares); + several folders (total, overlaps counted once). The dialogs themselves come with the menus (5.2). - [ ] 1.7 **Safe writer** (R31): `create_new`, next free name on race, removal of partial files, stays inside the folder (`..`, symbolic links), free-space check, re-check of originals. First decide the questions "Before 1.7" in `docs/design.md`. Folder snapshot test helper (R34) @@ -149,7 +150,7 @@ The order follows two ideas: service history (R44, R48). - [ ] 3.5 Choice of lists from the certifiers' countries, download, cache, `--trust-lists`, `--offline` (R45–R47). First decide the questions "Before 3.5" in `docs/design.md`. -- [ ] 3.6 Chain building against the TSL and the system store (R10). First decide the question +- [ ] 3.6 Chain building against the TSL and the system store (R10). First decide the questions "Before 3.6" in `docs/design.md`. - [ ] 3.7 Countersignatures (R11); `tsp`: RFC 3161, `.tsd`, `.m7m` (R5, R12); detached `.p7s` (R6). A time stamp is a proved time (R9) only if it verifies per R12 (chain to a trusted-list @@ -167,10 +168,11 @@ The order follows two ideas: ## Phase 4: output - [ ] 4.1 Console summary, colours with contrast, exit codes (R13, R35). - [ ] 4.2 Accessible HTML report, WCAG 2.2 AA (R14, R36), checker in CI (R39). First decide the - question "Before 4.2" in `docs/design.md`. + questions "Before 4.2" in `docs/design.md`. - [ ] 4.3 Full `--json` (R15); parallel processing with stable output order (R23). - [ ] 4.4 Command line and translated help, interactive end of run (R19, R20, R37). First decide - `--open`, `--threads` and `extract --no-report` (questions "Before 4.4" in `docs/design.md`). + `--open`, `--threads`, `extract --no-report` and double-click detection (questions + "Before 4.4" in `docs/design.md`). ## Phase 5: system integration - [ ] 5.1 Install manifest (R41). First decide how `create_new` applies to registry keys and From 0247cebffb22d40266bd91209fe24b4cf9e646bb Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:15:56 +0100 Subject: [PATCH 25/36] Keep the script refusals in 1.6; Enter in a dialog becomes a question Closes the review of b3c6fb9. - Roadmap 1.6: the script tests again refuse every changing command, and check and extract --plan in a risky run. - The sentence on Enter in a dialog number field, deleted by b3c6fb9, comes back as a question before 5.2: what Enter does after the right number, and what Enter and Confirm do after a wrong or empty one. It was never a decision of the owner, and requirement changes are closed for this PR. - The question before 1.6 cites R28 and no longer claims R30 answers the dialog case. - R21 points to R19 for the plan and R30 for the question. - R19 says "the kind of sensitive folder"; the README names the sensitive folders. - The merged question before 1.7 says the foreign file would be replaced. - README and reviewer prompt reflowed; no words changed there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- .claude/agents/fable-reviewer.md | 36 +++++++++++++++----------------- README.md | 9 ++++---- docs/design.md | 14 ++++++++----- docs/roadmap.md | 7 ++++--- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index ae7d8bc..0714cea 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -25,25 +25,23 @@ Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). wrong cryptographic checks (digest compared to the wrong bytes, signed attributes not re-encoded as SET, signature algorithm not matched to the key, time checked against the wrong reference), anything that could report a forged or invalid file as valid. -3. **Safety rules.** Originals are never written, moved or renamed; `check` writes no document, - only the report (HTML and JSON) and the tool's cache (R16); documents need an extraction - confirmed by the typed number (`extract`, or the interactive end of run, R20, R29); existing - files are never overwritten, not even a report; no panic on malformed input (no - `unwrap`/`expect`/indexing on untrusted data outside tests); no PowerShell; no OpenSSL or C - dependencies. Confirmation and write safety (R28–R34 and the dialog helper rules of R38 in - `docs/design.md`) is a fixed point of - every review: look for any path that processes without the first confirmation, writes a - document without a `ConfirmedPlan`, breaks any part of R31 (a file opened without - `create_new`, a file replaced in place, a file replaced other than a cache file or the manifest, - a symbolic link followed, a non-regular file replaced), can write a document outside the - selected folder, lets `--plan` write or download anything, treats a non-terminal input as a - yes, confirms anything from a script (only `check` in an ordinary run, `check --plan`, - `extract --plan` in an ordinary run, and the `--plan` lists of `undo`, the menus and - `uninstall` run there), judges time from the signer's claimed signing time, skips the native - dialog of a context-menu run, counts several selected folders wrongly (a row each, the total - typed, overlaps counted once), or produces a file name that is invalid on another OS (Windows - reserved names and characters, trailing dot/space, NFC/NFD or case collisions, over-long - names). +3. **Safety rules.** Originals are never written, moved or renamed; `check` writes no document, only + the report (HTML and JSON) and the tool's cache (R16); documents need an extraction confirmed by + the typed number (`extract`, or the interactive end of run, R20, R29); existing files are never + overwritten, not even a report; no panic on malformed input (no `unwrap`/`expect`/indexing on + untrusted data outside tests); no PowerShell; no OpenSSL or C dependencies. Confirmation and + write safety (R28–R34 and the dialog helper rules of R38 in `docs/design.md`) is a fixed point of + every review: look for any path that processes without the first confirmation, writes a document + without a `ConfirmedPlan`, breaks any part of R31 (a file opened without `create_new`, a file + replaced in place, a file replaced other than a cache file or the manifest, a symbolic link + followed, a non-regular file replaced), can write a document outside the selected folder, lets + `--plan` write or download anything, treats a non-terminal input as a yes, confirms anything from + a script (only `check` in an ordinary run, `check --plan`, `extract --plan` in an ordinary run, + and the `--plan` lists of `undo`, the menus and `uninstall` run there), judges time from the + signer's claimed signing time, skips the native dialog of a context-menu run, counts several + selected folders wrongly (a row each, the total typed, overlaps counted once), or produces a file + name that is invalid on another OS (Windows reserved names and characters, trailing dot/space, + NFC/NFD or case collisions, over-long names). 4. **Language**: code, comments, docs and developer messages in English. User-facing texts of the tool go through the translation layer (R27 in `docs/design.md`), never hard-coded, and every new text has its Italian translation. Every changed text (docs, comments, commit diff --git a/README.md b/README.md index e0114dd..bdda39e 100644 --- a/README.md +++ b/README.md @@ -49,17 +49,16 @@ cannot damage them: - Writing documents needs a second confirmation on the complete write plan: you type the number of documents to write. - A risky run gets a stronger warning that says why. You type the number of files to - process. A run is risky when a chosen folder is: + process. A run is risky when a chosen folder is a sensitive folder: - the root of a drive or volume; - the home folder, Desktop or Documents; - a system folder; - a network share root. A run is also risky when the folders chosen hold more than 10,000 files of any kind in all, - subfolders included. A run that is not risky is an ordinary run. Files the - analysis skips are not counted (hidden folders, symbolic links inside the folders, unreadable - folders), and a - file in overlapping folders counts once. + subfolders included. A run that is not risky is an ordinary run. Files the analysis skips are + not counted (hidden folders, symbolic links inside the folders, unreadable folders), and a file + in overlapping folders counts once. - From the context menu, the same confirmations appear in a window. - In scripts, only these run: - `check` in an ordinary run, and `check --plan`; diff --git a/docs/design.md b/docs/design.md index 9de4879..686099b 100644 --- a/docs/design.md +++ b/docs/design.md @@ -102,7 +102,7 @@ saves the signed documents beside the originals, ready to open. selected in the file manager). They are counted and confirmed together: - one summary with a row per folder (path, number of files to process, number of files of any kind) and the totals, and one question for all. The number typed is the total; - - when the run is risky (R28), the summary says why: the kind of folder, or the + - when the run is risky (R28), the summary says why: the kind of sensitive folder, or the 10,000-file limit; - a folder with no envelopes is shown with 0; if all are empty, the run stops; - the same folder given twice (also spelt differently: letter case, a symbolic link, a @@ -135,7 +135,7 @@ saves the signed documents beside the originals, ready to open. free name, R31) with the analysis and the documents written, and `undo` uses that one (R33). - With `--json`, it also writes a second JSON file beside the first. - After `check --no-report` there is no first report: the extraction report is the only one. -- R21. `install-menu` and `uninstall-menu` (plan and yes/no question, R30) add and remove the +- R21. `install-menu` and `uninstall-menu` (plan, R19; yes/no question, R30) add and remove the file manager's context menu: Windows per-user registry keys (no admin, no PowerShell), macOS Quick Actions, a Linux Nautilus script and Dolphin service menu. Full removal: `uninstall` (R40–R43). @@ -563,15 +563,16 @@ answered before the roadmap step named in its heading; that step points back her reverse? ### Before 1.6 (confirmation logic) -- What does a wrong or empty number do at the terminal (R29, R30)? The dialog case is in R30; - the terminal case is only in the R34 tests. +- What does a wrong or empty number do at the terminal (R28, R29, R30)? R30 and R34 say only + that a wrong number never confirms. ### Before 1.7 (safe writer) and the first pseudo-terminal test - Pseudo-terminal tests (R34) need a pty crate as a dev-dependency, accepted by `deny.toml`: which one, for Unix and Windows ConPTY? - R31 checks that a cache or manifest name is a regular file, then renames over it. What if the name changes between the check and the rename, or a foreign file appears at a name that did - not exist yet (the first creation is also a rename)? How is that prevented? + not exist yet (the first creation is also a rename) and would be replaced? How is that + prevented? - R31 keeps documents inside the selected folder. Does a rule cover a report written into a selected folder that is a symbolic link? @@ -655,6 +656,9 @@ answered before the roadmap step named in its heading; that step points back her the menu folders on macOS and Linux is to be checked. ### Before 5.2 (context menu and dialogs) +- In a dialog number field (R30), what does Enter do after the right number: confirm, or cancel + because the focus is on Cancel? What do Enter and Confirm do after a wrong or empty number: + nothing (the dialog stays open), or cancel? - What must the shorter dialog summary still show: unreadable folders, alternative names, "existing files modified: 0", a way to see the full list, and the list for `undo`, the menus and `uninstall`? diff --git a/docs/roadmap.md b/docs/roadmap.md index 406d80e..2418f18 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -120,11 +120,12 @@ The order follows two ideas: `docs/design.md`): pure functions turning (counts, folder, terminal, dialog via `--interactive`, or script; `--plan`) into the question to ask and parsing the answer: typed count (R28 risky run, R29), yes/no default No (R30). Typestate - `ConfirmedPlan`. Tests at the terminal: Enter, `n`, wrong number, changing command. Tests - from a script: `check` and `extract --plan` in a risky run are refused; `check --plan`, + `ConfirmedPlan`. Tests at the terminal: Enter, `n`, wrong number. Tests from a script: every + changing command, and `check` and `extract --plan` in a risky run, are refused; `check --plan`, `extract --plan` in an ordinary run and the item lists of `--plan` run. Also: symbolic links resolved before each folder is judged (all kinds of sensitive folder, not only shares); - several folders (total, overlaps counted once). The dialogs themselves come with the menus (5.2). + several folders (total, overlaps counted once). The dialogs themselves come with the menus + (5.2). - [ ] 1.7 **Safe writer** (R31): `create_new`, next free name on race, removal of partial files, stays inside the folder (`..`, symbolic links), free-space check, re-check of originals. First decide the questions "Before 1.7" in `docs/design.md`. Folder snapshot test helper (R34) From bc18b75919c157897583910fcfe6eb930c3a45e0 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:21:33 +0100 Subject: [PATCH 26/36] Ask only what R30 leaves open; name the script refusals in 1.6 Closes the review of 0247ceb. - The question before 5.2 starts from R30 (Enter alone cancels) and asks only what is open: Enter after the right number, Enter after a wrong number, Confirm after a wrong or empty one. - The question before 1.6 says what R34 covers (the R29 number) and what nothing covers: the R28 number, asking again or stopping, and the exit code. - Roadmap 1.6 names the refused commands as R30 does, adds the positive test for check in an ordinary run, and runs check --plan in any run. - Roadmap 5.2 names the Enter question. - The message of 0247ceb said no words changed in the README; one did ("is a sensitive folder:"). Recorded here, history is not rewritten. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/design.md | 12 +++++++----- docs/roadmap.md | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/docs/design.md b/docs/design.md index 686099b..0185ae8 100644 --- a/docs/design.md +++ b/docs/design.md @@ -563,8 +563,9 @@ answered before the roadmap step named in its heading; that step points back her reverse? ### Before 1.6 (confirmation logic) -- What does a wrong or empty number do at the terminal (R28, R29, R30)? R30 and R34 say only - that a wrong number never confirms. +- What does a wrong or empty number do at the terminal? R34 says that a wrong number or Enter + alone writes no document (R29). Nothing says it for the number of a risky run (R28), nor + whether the question is asked again or the run stops, and with which exit code. ### Before 1.7 (safe writer) and the first pseudo-terminal test - Pseudo-terminal tests (R34) need a pty crate as a dev-dependency, accepted by `deny.toml`: @@ -656,9 +657,10 @@ answered before the roadmap step named in its heading; that step points back her the menu folders on macOS and Linux is to be checked. ### Before 5.2 (context menu and dialogs) -- In a dialog number field (R30), what does Enter do after the right number: confirm, or cancel - because the focus is on Cancel? What do Enter and Confirm do after a wrong or empty number: - nothing (the dialog stays open), or cancel? +- R30 says Enter alone cancels a dialog. In a dialog number field, what does Enter do after the + right number: confirm, or cancel because the focus is on Cancel? What do Enter after a wrong + number, and Confirm after a wrong or empty one, do: nothing (the dialog stays open), or + cancel? - What must the shorter dialog summary still show: unreadable folders, alternative names, "existing files modified: 0", a way to see the full list, and the list for `undo`, the menus and `uninstall`? diff --git a/docs/roadmap.md b/docs/roadmap.md index 2418f18..d2d50aa 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -117,15 +117,15 @@ The order follows two ideas: Desktop, Documents, system folders, network share roots) and of a risky run (a sensitive folder, or more than 10,000 files of any kind over all the folders, subfolders included). - [ ] 1.6 **Confirmation logic** (R28–R30; first decide the question "Before 1.6" in - `docs/design.md`): pure functions turning (counts, folder, terminal, - dialog via `--interactive`, or script; `--plan`) into the question to ask and parsing the - answer: typed count (R28 risky run, R29), yes/no default No (R30). Typestate - `ConfirmedPlan`. Tests at the terminal: Enter, `n`, wrong number. Tests from a script: every - changing command, and `check` and `extract --plan` in a risky run, are refused; `check --plan`, - `extract --plan` in an ordinary run and the item lists of `--plan` run. Also: symbolic links - resolved before each folder is judged (all kinds of sensitive folder, not only shares); - several folders (total, overlaps counted once). The dialogs themselves come with the menus - (5.2). + `docs/design.md`): pure functions turning (counts, folder, terminal, dialog via `--interactive`, + or script; `--plan`) into the question to ask and parsing the answer: typed count (R28 risky run, + R29), yes/no default No (R30). Typestate `ConfirmedPlan`. Tests at the terminal: Enter, `n`, wrong + number. Tests from a script: `extract`, `undo`, `install-menu`, `uninstall-menu`, `uninstall`, and + `check` and `extract --plan` in a risky run, are refused; `check` in an ordinary run runs without + a question; `check --plan` in any run, `extract --plan` in an ordinary run and the item lists of + `--plan` run. Also: symbolic links resolved before each folder is judged (all kinds of sensitive + folder, not only shares); several folders (total, overlaps counted once). The dialogs themselves + come with the menus (5.2). - [ ] 1.7 **Safe writer** (R31): `create_new`, next free name on race, removal of partial files, stays inside the folder (`..`, symbolic links), free-space check, re-check of originals. First decide the questions "Before 1.7" in `docs/design.md`. Folder snapshot test helper (R34) @@ -179,8 +179,8 @@ The order follows two ideas: - [ ] 5.1 Install manifest (R41). First decide how `create_new` applies to registry keys and `.workflow` folders and the other questions "Before 5.1" in `docs/design.md`. - [ ] 5.2 Context menu per OS (R21, R38) with the confirmation dialogs (R30): first decide the - questions "Before 5.2" in `docs/design.md` (what the shorter dialog summary must show), with - R34 tests; Windows "Installed apps" entry (R42). + questions "Before 5.2" in `docs/design.md` (Enter in a number field, what the shorter dialog + summary must show), with R34 tests; Windows "Installed apps" entry (R42). - [ ] 5.3 `uninstall` (R40–R43). First decide what happens to a file in the cache folder that the tool did not write (questions "Before 5.3" in `docs/design.md`). From a3ad768889391077418f6c9e4a7bfe11b29ad5af Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:25:16 +0100 Subject: [PATCH 27/36] State the fixed point before the question; point 1.6 to R34 Closes the review of bc18b75. - The question before 1.6 starts from the rule: a wrong or empty number never confirms, for the files of a risky run (R28) or for the documents (R29). It asks only what is open: ask again or stop, the exit code of a run declined at the terminal, and an R34 test for the R28 number. The message of bc18b75 said nothing covers the R28 number; R28, R19 and R30 do. Recorded here. - Roadmap 1.6 no longer copies part of the R34 cases. It points to "Yes/no questions" and "Scripts" in R34, so the list lives in one place. - Roadmap 5.2 says "and the other questions". - The Enter question before 5.2 is split into short sentences. - The message of bc18b75 said one word changed in the README of 0247ceb; three did ("a sensitive folder"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/design.md | 14 ++++++++------ docs/roadmap.md | 14 ++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/design.md b/docs/design.md index 0185ae8..430c081 100644 --- a/docs/design.md +++ b/docs/design.md @@ -563,9 +563,11 @@ answered before the roadmap step named in its heading; that step points back her reverse? ### Before 1.6 (confirmation logic) -- What does a wrong or empty number do at the terminal? R34 says that a wrong number or Enter - alone writes no document (R29). Nothing says it for the number of a risky run (R28), nor - whether the question is asked again or the run stops, and with which exit code. +- A wrong or empty number never confirms, for the files of a risky run (R28) or for the + documents (R29). R34 tests it at the terminal only for R29. At the terminal, is the question + asked again or does the run stop? Which exit code does a run declined at the terminal give + (`n`, Enter, a wrong number)? R13 has 0, 1 and 2, and R30 gives 2 only for scripts. Does R34 + get the same test for the R28 number? ### Before 1.7 (safe writer) and the first pseudo-terminal test - Pseudo-terminal tests (R34) need a pty crate as a dev-dependency, accepted by `deny.toml`: @@ -658,9 +660,9 @@ answered before the roadmap step named in its heading; that step points back her ### Before 5.2 (context menu and dialogs) - R30 says Enter alone cancels a dialog. In a dialog number field, what does Enter do after the - right number: confirm, or cancel because the focus is on Cancel? What do Enter after a wrong - number, and Confirm after a wrong or empty one, do: nothing (the dialog stays open), or - cancel? + right number: confirm, or cancel because the focus is on Cancel? After a wrong number, does + Enter do nothing (the dialog stays open) or cancel? The same question for Confirm after a + wrong or empty number. - What must the shorter dialog summary still show: unreadable folders, alternative names, "existing files modified: 0", a way to see the full list, and the list for `undo`, the menus and `uninstall`? diff --git a/docs/roadmap.md b/docs/roadmap.md index d2d50aa..e5179a1 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -119,13 +119,11 @@ The order follows two ideas: - [ ] 1.6 **Confirmation logic** (R28–R30; first decide the question "Before 1.6" in `docs/design.md`): pure functions turning (counts, folder, terminal, dialog via `--interactive`, or script; `--plan`) into the question to ask and parsing the answer: typed count (R28 risky run, - R29), yes/no default No (R30). Typestate `ConfirmedPlan`. Tests at the terminal: Enter, `n`, wrong - number. Tests from a script: `extract`, `undo`, `install-menu`, `uninstall-menu`, `uninstall`, and - `check` and `extract --plan` in a risky run, are refused; `check` in an ordinary run runs without - a question; `check --plan` in any run, `extract --plan` in an ordinary run and the item lists of - `--plan` run. Also: symbolic links resolved before each folder is judged (all kinds of sensitive - folder, not only shares); several folders (total, overlaps counted once). The dialogs themselves - come with the menus (5.2). + R29), yes/no default No (R30). Typestate `ConfirmedPlan`. Tests: the terminal and script cases of + R34 ("Yes/no questions", "Scripts"), with a wrong or empty number at each typed count. Also: + symbolic links resolved before each folder is judged (all kinds of sensitive folder, not only + shares); several folders (total, overlaps counted once). The dialogs themselves come with the + menus (5.2). - [ ] 1.7 **Safe writer** (R31): `create_new`, next free name on race, removal of partial files, stays inside the folder (`..`, symbolic links), free-space check, re-check of originals. First decide the questions "Before 1.7" in `docs/design.md`. Folder snapshot test helper (R34) @@ -180,7 +178,7 @@ The order follows two ideas: `.workflow` folders and the other questions "Before 5.1" in `docs/design.md`. - [ ] 5.2 Context menu per OS (R21, R38) with the confirmation dialogs (R30): first decide the questions "Before 5.2" in `docs/design.md` (Enter in a number field, what the shorter dialog - summary must show), with R34 tests; Windows "Installed apps" entry (R42). + summary must show, and the other questions), with R34 tests; Windows "Installed apps" entry (R42). - [ ] 5.3 `uninstall` (R40–R43). First decide what happens to a file in the cache folder that the tool did not write (questions "Before 5.3" in `docs/design.md`). From 98bc03c5bb794ad11622ee3478a4a170937a5d41 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:33:43 +0100 Subject: [PATCH 28/36] audit: 0009 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/audits/0009-2026-11-23.md | 201 +++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 docs/audits/0009-2026-11-23.md diff --git a/docs/audits/0009-2026-11-23.md b/docs/audits/0009-2026-11-23.md new file mode 100644 index 0000000..23eef5a --- /dev/null +++ b/docs/audits/0009-2026-11-23.md @@ -0,0 +1,201 @@ +# Coherence audit 0009 (2026-11-23) +Range: e025b10..a3ad768 (five commits on `step/0.4-writing-guide`, PR #3, draft; working tree clean) Verdict: DRIFT FOUND + +Auditor: `coherence-auditor` agent, fresh context, read-only, run because the cadence is due (5 commits since audit 0008). + +The drift is small and only in documents. No code, script, hook or workflow changed in the range. `git diff --stat e025b10..HEAD` lists seven files: `docs/design.md`, `docs/roadmap.md`, `README.md`, `CLAUDE.md`, the two agent prompts and `tests/fixtures/README.md`. No claim about code is false. The findings of audit 0008 that asked for a change (F1, F2, F4, the 0.2.1 line of F6) are closed. Three new points concern the confirmation rules and the roadmap (F1 to F3). PR #3 still has no APPROVED verdict, and its head is not reviewed (F4). + +## Unfinished work + +`sh scripts/audit-status.sh` (exit 0): + +``` +== Audit cadence +commits since last audit: 5 (audit every 5) +last audit: e025b10 2026-11-23 audit: 0008 +AUDIT DUE + +== Rust +pinned Rust 1.100.0 is the latest stable + +== Unfinished local work +working tree clean +branch step/0.4-writing-guide: 0 unpushed, 0 not pulled +local branches not merged into main: + step/0.4-writing-guide +remote branches not merged into main: + origin/step/0.4-writing-guide + +== Markers in code +none + +== Leftovers (scripts/cleanup.sh --plan; run scripts/cleanup.sh to remove the local ones) +keep local branch (not merged): step/0.4-writing-guide +on GitHub, merged (kept, nothing is deleted on GitHub): origin/step/0.2-ci +on GitHub, merged (kept, nothing is deleted on GitHub): origin/step/0.2.1-confirmation-rules +on GitHub, draft PR (not closed here): #3 updated 2026-11-23: Roadmap 0.4: writing guide +nothing to remove + +== GitHub +open pull requests: +#3 DRAFT step/0.4-writing-guide updated 2026-11-23: Roadmap 0.4: writing guide +last CI runs on main: +2026-11-23 completed/success: Guard the Windows skips; test the report with no red checks +2026-11-23 completed/success: CI +2026-11-22 completed/success: Remove --apply everywhere, close review and audit 0002 findings +``` + +- **Local work**: nothing uncommitted (`git status --porcelain` empty), no stashes, nothing unpushed (`git rev-parse HEAD origin/step/0.4-writing-guide` give the same commit), one worktree. +- **Cadence**: `sh scripts/audit-status.sh --gate-push HEAD` exits 0. `--gate-commit` exits 1 ("5 commits since the last coherence audit (limit 5)") until this report is committed alone. Audit 0008 was committed alone (e025b10). +- **PR #3** (draft, opened 2026-11-23 05:36 UTC, less than a day old, head a3ad768, 35 comments): + - What it is for: roadmap 0.4 (`docs/roadmap.md:36-54`): the writing guide, the rewrite of README, design, roadmap, `CLAUDE.md` and the agent prompts to it, the `rust-toolchain.toml` comment, the session-report line for a newer Rust, and the owner's requirement decisions of 2026-11-23. + - Done in this range: five commits, each closing the review of the one before (7179d7b closes the review of 4a99ff1 and audit 0008; then b3c6fb9, 0247ceb, bc18b75, a3ad768). They rename the terms (a "sensitive folder", a "risky run", an "ordinary run"), move pointers to R30, move the dialog helper rules into R38, and add open questions, with a new section "Before 1.6". + - Missing: + - an APPROVED verdict: none of the 35 comments holds one (F4); + - a review of the head a3ad768; + - the rewrite of `docs/roadmap.md`, `CLAUDE.md` and the agent prompts to `docs/writing.md`; + - the `[x]` mark at `docs/roadmap.md:36`, correctly absent. + - State comment: present and true. The latest comment (17:25 UTC) ends with "State: draft. This is the fifth commit since audit 0008, so the next step is coherence audit 0009, then a review by a new fable-reviewer agent." + - Still relevant: yes, it is the one open step. +- **CI job lists** (`gh run list --branch step/0.4-writing-guide`, `gh run view <id> --json jobs`, `gh pr checks 3`): + + | Commit | Run | Result | + |---|---|---| + | e025b10 (audit 0008) | 45222341217 | success | + | 7179d7b | 45223765073 | success | + | b3c6fb9 | 45224955755 | success | + | 0247ceb | 45225808176 | success | + | bc18b75 | 45226835831 | cancelled | + | a3ad768 (head) | 45227514699 | Repository rules, Linux musl, macOS arm64, Windows gnu: all four `success`, read in the job list | + + The run on bc18b75 was cancelled, not red: a3ad768 was pushed four minutes later and replaced it; only its Windows job was cancelled, the other three had passed. The Windows job of the head was still running at the start of the audit and finished green at 17:31 UTC. GitGuardian passes. `main` is unchanged at 8561ec5, green. +- **Branches**: local `main` and the step branch; on GitHub `main`, `step/0.2-ci` and `step/0.2.1-confirmation-rules` (both merged, kept) and the step branch. Nothing stale. +- **Pull requests** (`gh pr list --state all`): #1 and #2 merged, #3 open as a draft. No other open PR. +- **Markers**: none (`grep` for `TODO`, `FIXME`, `todo!`, `unimplemented!`, `#[ignore` in `src`, `scripts`, `.githooks`, `.github`: only the pattern itself at `scripts/audit-status.sh:125`). +- **Leftovers**: `sh scripts/cleanup.sh --plan` (exit 0) prints the four lines shown above and "nothing to remove". +- **Tracked files that belong to the work, not the product**: none. `git ls-files` shows 39 files; the only reports are the eight under `docs/audits/`. + +## Findings + +### F1. `drift` (minor): "a wrong or empty number never confirms" is written as a rule only inside an open question +- `docs/design.md:566-567`, under "Before 1.6": "A wrong or empty number never confirms, for the files of a risky run (R28) or for the documents (R29)." The commit a3ad768 calls it "the fixed point" and says "R28, R19 and R30 do" cover it. +- `grep -n -i -e 'wrong' -e 'right number' docs/design.md` finds the rule in these places only: + - `207`, R30, dialog: "Confirm accepts only the right number"; + - `265`, `280`, `311-313`, R34: test cases (R29 at the terminal, the dialogs); + - `566`, `569`, `663-665`: open questions. +- For the terminal, R28 says "the user must type the number of files to process" (`docs/design.md:178`) and R29 "the user types the number of documents to write" (`192-193`). Neither says what a wrong or empty number does. R30's terminal item speaks only of yes/no questions (`197-199`). +- `docs/design.md:6-7` says each rule is written once, in a requirement. This one is implied by R28 to R30 and stated only in the section of open points. +- Change: state the sentence in R30 (or in R28 and R29) and let the question point to it. The meaning is not in doubt; no owner's decision is needed for the rule itself. What happens next (ask again or stop, exit code) stays an open question. + +### F2. `contradiction` (minor): roadmap 1.6 already plans a test that the question before 1.6 leaves open +- `docs/roadmap.md:122-123`: "Tests: the terminal and script cases of R34 ("Yes/no questions", "Scripts"), with a wrong or empty number at each typed count." The typed counts are R28 and R29 (`docs/roadmap.md:121-122`). +- `docs/design.md:569-570`: "Does R34 get the same test for the R28 number?" +- The roadmap answers yes while the design still asks. Also, the terminal cases "empty answer, `n`, wrong number" sit in the R34 item "Writing and undo" (`docs/design.md:265`), which the roadmap pointer does not name. +- Change: the owner answers the question; then R34 and roadmap 1.6 say the same. If the answer is yes, the question can go and R34 gets the case. + +### F3. `drift` (minor): no roadmap step names the two-step replace of cache files and the manifest +- PR #3, comment of 17:05 UTC (how the review of 4a99ff1 was closed): "The two-step replace is built in roadmap 1.7 (R31)." +- `docs/roadmap.md:127-130`, step 1.7: "`create_new`, next free name on race, removal of partial files, stays inside the folder (`..`, symbolic links), free-space check, re-check of originals." It does not name the temporary file and the rename of R31 (`docs/design.md:222-232`). +- `grep -n -i -e 'rename' -e 'two-step' -e 'two steps' -e 'replac' docs/roadmap.md` finds only lines 45 ("reports never replaced") and 190. Steps 3.5 (cache) and 5.1 (manifest) do not name it either. +- The questions "Before 1.7" do speak of the rename (`docs/design.md:575-578`), so 1.7 is the likely home. The roadmap text does not say so. +- Change: name the two-step replace in step 1.7 (or in the step the owner prefers) when the roadmap is rewritten. + +### F4. `unfinished`: PR #3 has no APPROVED verdict, and the head is not reviewed +- `GH_PROMPT_DISABLED=1 gh pr view 3 --json comments </dev/null`: 35 comments. The reviews of this range are five, each by "a new fable-reviewer agent", each "VERDICT: CHANGES NEEDED", each followed by a comment saying how it was closed: + + | Reviewed commit | Verdict comment (UTC) | Closing comment (UTC) | + |---|---|---| + | 4a99ff1 | 16:54 | 17:05 | + | 7179d7b | 17:08 | 17:11 | + | b3c6fb9 | 17:14 | 17:16 | + | 0247ceb | 17:20 | 17:21 | + | bc18b75 | 17:24 | 17:25 | + +- No comment reviews a3ad768. No comment on the PR holds APPROVED. +- Three of the five reviews found something the previous fix had lost or misstated, each put right in the next commit: + - b3c6fb9 dropped the script refusals from roadmap 1.6 and deleted the R38 sentence on Enter in a number field (review of b3c6fb9, items 1 and 2); + - 0247ceb offered an answer that R30 already excludes (review of 0247ceb, item 1); + - bc18b75 said nothing covers the R28 number (review of bc18b75, item 1). +- No rule is broken today: the last comment announces the review after this audit. `CLAUDE.md` asks for four green jobs and a posted approval before the PR is marked ready. +- Change: none to the files. The next reviewer's verdict on a3ad768 goes on the PR. + +### F5. `minor`: three statements in commit messages of the range were wrong, and later messages correct them +- 0247ceb: "README and reviewer prompt reflowed; no words changed there." `git diff --word-diff=porcelain b3c6fb9 0247ceb -- README.md` shows `-is:` and `+is a sensitive folder:` (three words added, `README.md:52`). +- bc18b75: "one did". Three did. bc18b75 also said nothing covers the R28 number. +- a3ad768 records both corrections in its message, and the PR comments of 17:20, 17:21, 17:24 and 17:25 UTC record them too. History is not rewritten. +- Change: none. Noted so that a reader of `git log` finds the correction. + +### F6. `minor`: texts that break `docs/writing.md` +New or changed in the range: +- `.claude/agents/fable-reviewer.md:33`: 102 characters after the reflow of 0247ceb. Item 3 of the prompt (`.claude/agents/fable-reviewer.md:28-44`) is still two sentences, the second of about 190 words. +- `docs/roadmap.md:119-126`, step 1.6: the first sentence runs to about 45 words with a nested bracket list. +- `docs/design.md:296-302` (R34 "Counting") and `303-306` ("Several folders"): single sentences of more than 50 words, edited in the range and not shortened. +- PR #3 description: "owner's decisions on requirements (what `check` writes, risky folders, ...)", while `docs/roadmap.md:44` now says "risky runs" and R28 says "risky" never describes a folder (`docs/design.md:183-184`). + +Carried over from 0008-F5, unchanged: +- `docs/design.md:6`: "in the requirement named in brackets". +- Bold labels at the start of sub-items: `docs/design.md:101,113,118`. Bold inside running text: `docs/design.md:181-182`, `423`, `466`. +- Headings that are not questions: the fifteen `### Before x.y (...)` headings (`docs/design.md:552-680`) and "(proposal)" at `491`. `docs/writing.md:82-84` does not list them among the fixed formats. +- `docs/roadmap.md:95-96`: no blank line before "## Phase 1". `docs/roadmap.md:35`: a blank line between steps 0.3 and 0.4 only. +- `CLAUDE.md:141-152`: one bullet of seven long sentences. +- Lines longer than 100 characters: `CLAUDE.md:4,40`, `.claude/agents/coherence-auditor.md:22`, `.claude/agents/fable-reviewer.md:10`; `docs/design.md:499,506,508` are table rows; line 3 of each prompt is front matter. + +Closed from 0008-F5: the broken lines at `docs/design.md:179`, `README.md:61`, `docs/roadmap.md:120,124` and `CLAUDE.md:159-162` are reflowed; `docs/roadmap.md:129` says "the questions". No em dash or curly quote in `README.md`, `CLAUDE.md`, `docs/design.md`, `docs/roadmap.md`, `docs/writing.md` or the prompts (`grep` for U+2014, U+2019, U+201C, U+201D: no line). + +The PR comment of 17:05 UTC says bold labels, long sentences and line wraps wait for the rewrite of the roadmap and `CLAUDE.md`, which is still to come in this PR. + +### F7. `minor`: carried over +- From 0007-F8: `README.md:165` ("License") is a heading that is not a question and not a listed fixed format. +- From 0005-F3: `docs/roadmap.md:40` promises a "session report line when a newer stable Rust exists"; the script prints a "Rust" section. +- From 0001-F12: `Cargo.toml:19-21` declares `assert_cmd` 2.2.2 and `predicates` 3.1.4; `tests/` holds only `fixtures/`, no `tests/*.rs`. +- From 0003-F6: no test fixes the choice that a branch just created at `main` is removed by `cleanup.sh`. + +### Follow-up of audit 0008 +- F1 (dead heading name): closed. `tests/fixtures/README.md:6` names "Which test data do we use?", the heading at `docs/design.md:515`. +- F2 (pointers to R19 for yes/no): closed. R30 is named at `docs/design.md:309` (R34), `docs/roadmap.md:122` and `CLAUDE.md:148`; also in R21 (`docs/design.md:138`), R27 (`160`) and R33 (`260`). The remaining `R19` references (`grep -n R19`) point to the command line, the plan, `--plan` or the several-folder rules, which R19 holds. +- F3 (no approval): open, see F4. +- F4 (country codes `EL`/`UK` against `GR`/`GB`): closed as an open question, `docs/design.md:613-615`, under "Before 3.5". +- F5 (writing): partly closed, see F6. +- F6: the 0.2.1 line is closed (`docs/roadmap.md:27-28` names the `check` exception); the rest is in F7. + +### Verified and found true +- **Requirement numbering.** The same 50 labels, R1a to R49, as before the range (`grep -o '^- R[0-9]*[ab]*' docs/design.md`). +- **Terms.** `grep -rn -i -e 'risky folder' -e 'ordinary folder' -e 'risky-folder'` over `CLAUDE.md`, `README.md`, `docs/design.md`, `docs/roadmap.md`, `docs/writing.md`, the prompts, scripts, hooks, workflow and sources finds nothing. R28 defines "sensitive folder", "risky run" and "ordinary run" (`docs/design.md:178-184`); `README.md:51-61`, `CLAUDE.md:144-146,155-157`, R19 (`docs/design.md:96,105`), R30 (`210-215`), R34 (`269-272,303-306`), roadmap 0.2.1, 0.4, 1.5 and 1.6 and the reviewer prompt (`.claude/agents/fable-reviewer.md:39`) use them in that sense. +- **What runs from a script** is stated the same way in R30 (`docs/design.md:210-215`), R19 `--plan` (`121-126`), R34 (`269-272`), `README.md:63-68`, the reviewer prompt (`38-40`) and `CLAUDE.md:144-146`: `check` in an ordinary run, `check --plan` in any run, `extract --plan` in an ordinary run, and the `--plan` lists of `undo`, the menus and `uninstall`. +- **R31.** The universal rule and the two replaced kinds agree (`docs/design.md:220-232`): cache files and the manifest are created with `create_new` under a temporary name and reach their name by rename. `README.md:70-75` says the same and points to R31. +- **R38 and its tests.** The helper rules (fixed system paths, folder names as arguments) are in R38 (`docs/design.md:443-445`); the R34 dialog cases point to R30 and R38 (`311-315`); the open question says "Whatever is chosen follows R38" (`675`). The auditor prompt (`.claude/agents/coherence-auditor.md`, check 6) and the reviewer prompt (`33`) name R38 with R28 to R34. +- **Open questions and the roadmap point to each other.** The fifteen headings of "What is still open?" (1.4, 1.5, 1.6, 1.7, 3.1, 3.2, 3.5, 3.6, 3.7, 3.9, 4.2, 4.4, 5.1, 5.2, 5.3) match the list at `docs/roadmap.md:53-54`. Each of those roadmap steps names its section (`docs/roadmap.md:111,112,119,129,143,145,151,153,157,159,170,174,178,180,183`), with "question" or "questions" matching the number of items. The pointers inside requirements name an existing section: `docs/design.md:227,284,360,362,374,466,481`. +- **Commit messages in the range**: every change they name exists, except the three statements of F5. + - 7179d7b: R2 names links to a file or a folder (`docs/design.md:31-32`); R44 points to R47 (`343`); the new questions are at `575-578`, `613-620`, `624`, `632`, `638`, `644`. + - b3c6fb9: "Before 1.6" exists (`565`); R21 points to R30 (`138`); `README.md:59` defines an ordinary run. + - 0247ceb, bc18b75, a3ad768: the Enter question before 5.2 (`662-665`); roadmap 1.6 points to "Yes/no questions" and "Scripts", which are items of R34 (`309`, `269`); roadmap 5.2 says "and the other questions" (`docs/roadmap.md:180-181`). +- **PR #3 text**: ends with "Draft. The current state and the next step are in the latest comment", which is true at the head. +- **Verdict comments**: PR #3 carries a verdict for each of the five reviews of the range (F4), each followed by how it was closed. `sh scripts/check-public.sh --message <file>` exits 0 on the PR text and on each of the ten comments of the range; none holds a local path or an address. PR #2: verdict comments present. PR #1: none (0003-F5, predates the rule). +- **Roadmap marks**: 0.1, 0.2, 0.2.1 and 1.0 hold; nothing was marked in the range. `is_envelope` is at `src/lib.rs:10` with six test functions (one for Windows only, one for Unix only), none ignored. `src/` did not change. There is no other module or public function, so no scope drift in code. +- **Concrete references added in the range**: R13's exit codes 0, 1 and 2 (`docs/design.md:64-65`), `--trust-lists` (R46, `351`), "audit 0008, F4" (this folder), `/usr/bin/osascript` and `/usr/bin/zenity` as examples of fixed paths. All exist in the sense used. Crates and versions did not change (`Cargo.toml`, `Cargo.lock` untouched). +- **Safety, accessibility, uninstall (R28–R43)**: still no code; nothing is claimed done; the placeholder in `src/main.rs` is the recorded exception (`docs/design.md:544-545`). +- **Language rule**: all text added in the range is English. +- **Public-repository rule**: `sh scripts/check-public.sh --range tip HEAD` exits 0; the five commits have no-reply author and committer addresses (`git log --format='%ae %ce'`). `tests/corpus/` was not read. +- **Not re-checked**: the GitHub settings (branch protection, actions allowlist, secret scanning); the LOTL numbers at `docs/design.md:333` (checked by audit 0008, text unchanged); the crates named as candidates in the architecture table (unchanged in the range). + +## Health + +Run on macOS arm64 at a3ad768, working tree clean. Script tests ran on a scratch copy (`git archive HEAD`) with failing `gh` and `rustup` stubs first in `PATH`. + +| Command | Result | +|---|---| +| `cargo fmt --check` | clean (exit 0) | +| `cargo clippy --all-targets -- -D warnings` | no issues (exit 0) | +| `cargo nextest run` | 5 passed, 0 skipped (2 binaries), exit 0 | +| `cargo test --doc` | 0 doctests (none exist), exit 0 | +| `cargo deny check` | `advisories ok, bans ok, licenses ok, sources ok` (exit 0); warnings for allowed licences not used yet (`ISC`, `MIT`, `Unicode-3.0`, `Zlib`, `deny.toml:15,20-22`) | +| `sh scripts/test-scripts.sh` | 178 passed, 0 failed | +| `sh scripts/test-cleanup.sh` | 79 passed, 0 failed, 0 skipped | +| `sh scripts/test-hooks.sh` | 24 passed, 0 failed | +| `sh scripts/check-public.sh --range tip HEAD` | exit 0 ("0 commits and the tree of a3ad768 scanned") | +| `sh scripts/audit-status.sh --gate-push HEAD` | exit 0 | +| `sh scripts/audit-status.sh --gate-commit` | exit 1: "5 commits since the last coherence audit (limit 5)" | +| CI on a3ad768 (PR #3) | all four jobs green (run 45227514699) | +| CI on `main` (8561ec5) | green, unchanged | + +The repository was not modified by the audit: `git status --porcelain` is empty before and after, no stash, HEAD still a3ad768. `cleanup.sh` was run with `--plan` only. Nothing was posted or changed on GitHub. From 770559d0fcc23569e82316933122706d91510f90 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 20:34:13 +0100 Subject: [PATCH 29/36] A wrong or empty number never confirms at the terminal (R30) Closes the review of a3ad768 and findings F1 to F3 of audit 0009. - Owner's decision (2026-11-23): R30 states that at the terminal a typed number confirms only if it is the right one; a wrong number or Enter alone never confirms, for the files to process of a risky run (R28) and for the documents to write (R29). It was implied by R28 and stood only in an open question. Roadmap 0.4 lists the decision. - R34 gets the test "Risky run at the terminal": an empty answer, `n` or a wrong number starts no analysis. "Yes/no questions" names `n`. - The question before 1.6 keeps only what is open: ask again or stop, and the exit code of a run declined at the terminal. - Roadmap 1.6 points to the R34 items by name, including "Counting", "Several folders" and the answers of "Writing and undo", instead of copying them. - Roadmap 1.7 names the two-step replace of cache files and the manifest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/design.md | 18 ++++++++++-------- docs/roadmap.md | 19 ++++++++++--------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/docs/design.md b/docs/design.md index 430c081..c5fe72c 100644 --- a/docs/design.md +++ b/docs/design.md @@ -195,8 +195,10 @@ script. R31 says how every file is created and which files may ever be replaced. - Terminal (`std::io::IsTerminal` on input and output): questions in the console (R19, R28, R29). "Terminal" means both input and output are a terminal. With output redirected (`| tee log`, `> file`) the run counts as a script. Yes/no questions default to No, and - Enter alone cancels. The answers and the default are written out in words in the user's - language (R35, R27). + Enter alone cancels. A typed number confirms only if it is the right one: a wrong number or + Enter alone never confirms, for the files to process of a risky run (R28) and for the + documents to write (R29) (owner's decision, 2026-11-23). The answers and the default are + written out in words in the user's language (R35, R27). - Context menu (no terminal, started with `--interactive`): the same confirmations, with the same number to type and the same default, in a native dialog (R38), with a shorter summary than the console. @@ -266,6 +268,8 @@ script. R31 says how every file is created and which files may ever be replaced. between plan and write; names with `..`, reserved names, forbidden characters, NFC/NFD and case collisions, over-long names; a symbolic link pointing outside; disk full (simulated); `undo` with a modified file; `undo` on a report that records no document. + - Risky run at the terminal (R28, R30): an empty answer, `n` or a wrong number starts no + analysis. - Scripts (R30): every changing command, `check` and `extract --plan` in a risky run, and `--interactive` without a desktop are refused with exit 2. `check` in an ordinary run, `check --plan` in any run, `extract --plan` in an ordinary run and `--plan` of `undo`, the @@ -306,8 +310,8 @@ script. R31 says how every file is created and which files may ever be replaced. link to a sensitive folder makes the run risky. - Time (R9): a back-dated signing-time attribute changes no verdict; without a time stamp the report says "claimed, not proved". - - Yes/no questions (R30): Enter alone cancels, `y` on a pipe is refused, a number is not a - yes. + - Yes/no questions (R30): Enter alone and `n` cancel, `y` on a pipe is refused, a number is + not a yes. - Dialogs (R30, R38): when a number is required only the right one confirms; yes/no dialogs default to Cancel; the focus starts on Cancel; Enter alone and closing the window cancel; a wrong number does not confirm; every selected folder with its count, the total and the operation @@ -563,11 +567,9 @@ answered before the roadmap step named in its heading; that step points back her reverse? ### Before 1.6 (confirmation logic) -- A wrong or empty number never confirms, for the files of a risky run (R28) or for the - documents (R29). R34 tests it at the terminal only for R29. At the terminal, is the question +- R30 says a wrong or empty number never confirms. At the terminal, after one, is the question asked again or does the run stop? Which exit code does a run declined at the terminal give - (`n`, Enter, a wrong number)? R13 has 0, 1 and 2, and R30 gives 2 only for scripts. Does R34 - get the same test for the R28 number? + (`n`, Enter, a wrong number)? R13 has 0, 1 and 2, and R30 gives 2 only for scripts. ### Before 1.7 (safe writer) and the first pseudo-terminal test - Pseudo-terminal tests (R34) need a pty crate as a dev-dependency, accepted by `deny.toml`: diff --git a/docs/roadmap.md b/docs/roadmap.md index e5179a1..1dbc375 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -44,6 +44,7 @@ The order follows two ideas: - risky runs counted on files of any kind (R28); - reports never replaced, and the second report (R16, R20, R31, R33); - `--plan` writes and downloads nothing (R19); + - a wrong or empty number never confirms at the terminal (R30); - the cache (R47); - no saved preference (R27); - `--no-report` (R14, R16); @@ -119,15 +120,15 @@ The order follows two ideas: - [ ] 1.6 **Confirmation logic** (R28–R30; first decide the question "Before 1.6" in `docs/design.md`): pure functions turning (counts, folder, terminal, dialog via `--interactive`, or script; `--plan`) into the question to ask and parsing the answer: typed count (R28 risky run, - R29), yes/no default No (R30). Typestate `ConfirmedPlan`. Tests: the terminal and script cases of - R34 ("Yes/no questions", "Scripts"), with a wrong or empty number at each typed count. Also: - symbolic links resolved before each folder is judged (all kinds of sensitive folder, not only - shares); several folders (total, overlaps counted once). The dialogs themselves come with the - menus (5.2). -- [ ] 1.7 **Safe writer** (R31): `create_new`, next free name on race, removal of partial files, - stays inside the folder (`..`, symbolic links), free-space check, re-check of originals. First - decide the questions "Before 1.7" in `docs/design.md`. Folder snapshot test helper (R34) - introduced here and used from now on. + R29), yes/no default No (R30). Typestate `ConfirmedPlan`. Tests: the cases of R34 "Risky run at + the terminal", "Yes/no questions", "Scripts", "Counting" and "Several folders", and the answers of + "Writing and undo" (empty answer, `n`, wrong number) at the count of documents. The dialogs + themselves come with the menus (5.2). +- [ ] 1.7 **Safe writer** (R31): `create_new`, next free name on race, the two-step replace of cache + files and the manifest (temporary file, then rename), removal of partial files, stays inside the + folder (`..`, symbolic links), free-space check, re-check of originals. First decide the questions + "Before 1.7" in `docs/design.md`. Folder snapshot test helper (R34) introduced here and used from + now on. ## Phase 2: opening envelopes (thin slice) - [ ] 2.1 `ber` reader: definite and indefinite lengths, limits on depth and size, checked From 977935310c06f5cd63f4896745b27e0dc4deebb6 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 20:38:05 +0100 Subject: [PATCH 30/36] Give 1.5 and 1.6 their own tests; any other answer never confirms Closes the review of 770559d. - B1: R34 "Several folders" tests a symbolic link to each kind of sensitive folder (R28), the test roadmap 1.6 had before 770559d. - B2: roadmap 1.6 names only the cases it owns: the R34 items "Risky run at the terminal", "Yes/no questions" and "Scripts", the answers of "Writing and undo", and from "Several folders" the typed total, one sensitive folder making the run risky and all folders empty. Roadmap 1.5 gets the walk cases of "Counting" and "Several folders". The dialog and report cases stay with 5.2 and the report steps. - M1: R30 says any other answer (a wrong number, `y`, `n`, Enter alone) never confirms; R34 tests `y` at both counts. This is the owner's decision of 770559d, stated in full. - M2: a new question before 1.6 asks when a typed number is the right one (separators, leading zeros, spaces). - M3: the R30 terminal bullet and roadmap 1.6 are split into shorter sentences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/design.md | 17 ++++++++++------- docs/roadmap.md | 28 ++++++++++++++++------------ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/docs/design.md b/docs/design.md index c5fe72c..ae433cf 100644 --- a/docs/design.md +++ b/docs/design.md @@ -195,9 +195,10 @@ script. R31 says how every file is created and which files may ever be replaced. - Terminal (`std::io::IsTerminal` on input and output): questions in the console (R19, R28, R29). "Terminal" means both input and output are a terminal. With output redirected (`| tee log`, `> file`) the run counts as a script. Yes/no questions default to No, and - Enter alone cancels. A typed number confirms only if it is the right one: a wrong number or - Enter alone never confirms, for the files to process of a risky run (R28) and for the - documents to write (R29) (owner's decision, 2026-11-23). The answers and the default are + Enter alone cancels. A typed number confirms only if it is the right one. Any other answer + (a wrong number, `y`, `n`, Enter alone) never confirms. This holds for the files to process + of a risky run (R28) and for the documents to write (R29). Owner's decision, 2026-11-23. The + answers and the default are written out in words in the user's language (R35, R27). - Context menu (no terminal, started with `--interactive`): the same confirmations, with the same number to type and the same default, in a native dialog (R38), with a shorter summary @@ -264,12 +265,12 @@ script. R31 says how every file is created and which files may ever be replaced. - R34. **Proof by tests.** A shared test helper snapshots the whole folder (paths and SHA-256) before and after every end-to-end test: originals identical, nothing changed but the confirmed plan. - - Writing and undo (R29, R31, R32, R33): empty answer, `n`, wrong number; a file appearing + - Writing and undo (R29, R31, R32, R33): empty answer, `y`, `n`, wrong number; a file appearing between plan and write; names with `..`, reserved names, forbidden characters, NFC/NFD and case collisions, over-long names; a symbolic link pointing outside; disk full (simulated); `undo` with a modified file; `undo` on a report that records no document. - - Risky run at the terminal (R28, R30): an empty answer, `n` or a wrong number starts no - analysis. + - Risky run at the terminal (R28, R30): an empty answer, `y`, `n` or a wrong number starts + no analysis. - Scripts (R30): every changing command, `check` and `extract --plan` in a risky run, and `--interactive` without a desktop are refused with exit 2. `check` in an ordinary run, `check --plan` in any run, `extract --plan` in an ordinary run and `--plan` of `undo`, the @@ -307,7 +308,7 @@ script. R31 says how every file is created and which files may ever be replaced. - Several folders (R19): the total is typed; one sensitive folder makes the whole run risky; all folders empty stop the run; overlaps (also by letter case, symbolic link, trailing slash) are counted once; one report per selected folder that is not inside another; a symbolic - link to a sensitive folder makes the run risky. + link to each kind of sensitive folder makes the run risky (R28). - Time (R9): a back-dated signing-time attribute changes no verdict; without a time stamp the report says "claimed, not proved". - Yes/no questions (R30): Enter alone and `n` cancel, `y` on a pipe is refused, a number is @@ -570,6 +571,8 @@ answered before the roadmap step named in its heading; that step points back her - R30 says a wrong or empty number never confirms. At the terminal, after one, is the question asked again or does the run stop? Which exit code does a run declined at the terminal give (`n`, Enter, a wrong number)? R13 has 0, 1 and 2, and R30 gives 2 only for scripts. +- When is a typed number the right one? With the separators of the user's language (`12.345`, + `12,345`), with leading zeros, with spaces around it (R27, questions "Before 1.4")? ### Before 1.7 (safe writer) and the first pseudo-terminal test - Pseudo-terminal tests (R34) need a pty crate as a dev-dependency, accepted by `deny.toml`: diff --git a/docs/roadmap.md b/docs/roadmap.md index 1dbc375..65dde7a 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -110,20 +110,24 @@ The order follows two ideas: - [ ] 1.4 **i18n skeleton** (R27): pick the mechanism (Fluent vs `rust-i18n`, decided with the user), English + Italian, `--lang`, OS language detection. Needed before any message below. First decide the questions "Before 1.4" in `docs/design.md`. -- [ ] 1.5 **Walk and count** (first decide the questions "Before 1.5" in `docs/design.md`) - (R1b, R2, R19, R28): one or more folders, a row per folder and the total; regular files only, - symbolic links met during the walk not followed (a selected one is resolved) and hidden folders - skipped (both listed in the report), unreadable folders listed; two counts (files to process, - files of any kind), total size, subfolders. Detection of sensitive folders (drive roots, home, - Desktop, Documents, system folders, network share roots) and of a risky run (a sensitive - folder, or more than 10,000 files of any kind over all the folders, subfolders included). -- [ ] 1.6 **Confirmation logic** (R28–R30; first decide the question "Before 1.6" in +- [ ] 1.5 **Walk and count** (first decide the questions "Before 1.5" in `docs/design.md`) (R1b, R2, + R19, R28): one or more folders, a row per folder and the total; regular files only, symbolic links + met during the walk not followed (a selected one is resolved) and hidden folders skipped (both + listed in the report), unreadable folders listed; two counts (files to process, files of any + kind), total size, subfolders. Detection of sensitive folders (drive roots, home, Desktop, + Documents, system folders, network share roots) and of a risky run (a sensitive folder, or more + than 10,000 files of any kind over all the folders, subfolders included). Tests: the walk cases of + R34 "Counting" (10,000 against 10,001, files not counted, a selected folder that is a symbolic + link, overlaps) and of "Several folders" (overlaps, a symbolic link to each kind of sensitive + folder). +- [ ] 1.6 **Confirmation logic** (R28–R30; first decide the questions "Before 1.6" in `docs/design.md`): pure functions turning (counts, folder, terminal, dialog via `--interactive`, or script; `--plan`) into the question to ask and parsing the answer: typed count (R28 risky run, - R29), yes/no default No (R30). Typestate `ConfirmedPlan`. Tests: the cases of R34 "Risky run at - the terminal", "Yes/no questions", "Scripts", "Counting" and "Several folders", and the answers of - "Writing and undo" (empty answer, `n`, wrong number) at the count of documents. The dialogs - themselves come with the menus (5.2). + R29), yes/no default No (R30). Typestate `ConfirmedPlan`. Tests: the R34 items "Risky run at the + terminal", "Yes/no questions" and "Scripts". The answers of "Writing and undo" (empty answer, `y`, + `n`, wrong number) at the count of documents. From "Several folders": the total is typed, one + sensitive folder makes the whole run risky, all folders empty stop the run. The reason for a risky + run in the terminal question. The dialogs themselves come with the menus (5.2). - [ ] 1.7 **Safe writer** (R31): `create_new`, next free name on race, the two-step replace of cache files and the manifest (temporary file, then rename), removal of partial files, stays inside the folder (`..`, symbolic links), free-space check, re-check of originals. First decide the questions From 818ba2d104fad60db90e2dab21be585f6e25d654 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Mon, 23 Nov 2026 20:43:00 +0100 Subject: [PATCH 31/36] Every R34 case of counting and several folders has a step Closes the review of 9779353. - B1: roadmap 1.6 also tests, from R34 "Counting", both counts in each row and in the totals of the terminal summary, the reason for a risky run, and the number typed being the files to process, also in a run risky only by the 10,000 limit. Roadmap 1.5 tests 10,001 also as a total over several folders. Roadmap 2.3 tests one report per selected folder that is not inside another. The dialog cases stay with 5.2. - B2: R34 "Writing and undo" states the results: at the count of documents an empty answer, `y`, `n` or a wrong number writes nothing; at the `undo` question an empty answer or `n` removes nothing. - R30: the owner's decision is attached to its sentence. "Extraction reports", roadmap 0.4 and the question before 1.6 say "any answer other than the right number", and the question names `y`. - The question on the right number points to R29 (language-neutral) and to the dialog text field. - R30 reflowed; roadmap 1.5, 1.6, 1.7 and 2.3 wrap at 96 columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/design.md | 37 ++++++++++++++++++----------------- docs/roadmap.md | 51 ++++++++++++++++++++++++++----------------------- 2 files changed, 47 insertions(+), 41 deletions(-) diff --git a/docs/design.md b/docs/design.md index ae433cf..ba53eec 100644 --- a/docs/design.md +++ b/docs/design.md @@ -195,11 +195,10 @@ script. R31 says how every file is created and which files may ever be replaced. - Terminal (`std::io::IsTerminal` on input and output): questions in the console (R19, R28, R29). "Terminal" means both input and output are a terminal. With output redirected (`| tee log`, `> file`) the run counts as a script. Yes/no questions default to No, and - Enter alone cancels. A typed number confirms only if it is the right one. Any other answer - (a wrong number, `y`, `n`, Enter alone) never confirms. This holds for the files to process - of a risky run (R28) and for the documents to write (R29). Owner's decision, 2026-11-23. The - answers and the default are - written out in words in the user's language (R35, R27). + Enter alone cancels. A typed number confirms only if it is the right one (owner's decision, + 2026-11-23). Any other answer (a wrong number, `y`, `n`, Enter alone) never confirms. This + holds for the files to process of a risky run (R28) and for the documents to write (R29). + The answers and the default are written out in words in the user's language (R35, R27). - Context menu (no terminal, started with `--interactive`): the same confirmations, with the same number to type and the same default, in a native dialog (R38), with a shorter summary than the console. @@ -265,10 +264,12 @@ script. R31 says how every file is created and which files may ever be replaced. - R34. **Proof by tests.** A shared test helper snapshots the whole folder (paths and SHA-256) before and after every end-to-end test: originals identical, nothing changed but the confirmed plan. - - Writing and undo (R29, R31, R32, R33): empty answer, `y`, `n`, wrong number; a file appearing - between plan and write; names with `..`, reserved names, forbidden characters, NFC/NFD and - case collisions, over-long names; a symbolic link pointing outside; disk full (simulated); - `undo` with a modified file; `undo` on a report that records no document. + - Writing and undo (R29, R31, R32, R33): at the count of documents (R29), an empty answer, `y`, + `n` or a wrong number writes nothing; at the `undo` question, an empty answer or `n` removes + nothing; a file appearing between plan and write; names with `..`, reserved names, forbidden + characters, NFC/NFD and case collisions, over-long names; a symbolic link pointing outside; + disk full (simulated); `undo` with a modified file; `undo` on a report that records no + document. - Risky run at the terminal (R28, R30): an empty answer, `y`, `n` or a wrong number starts no analysis. - Scripts (R30): every changing command, `check` and `extract --plan` in a risky run, and @@ -282,9 +283,9 @@ script. R31 says how every file is created and which files may ever be replaced. `--no-report`. An existing report or JSON file, also one named with `--report` or `--json`, is not replaced: the new one gets the next free name. - Extraction reports (R16, R20, R33): at the interactive end of run, documents are written - only through R29: a wrong number or Enter alone writes none, and declining writes none. An - extraction there writes a second report, and with `--json` a second JSON file, without - touching the first. `undo` on the second report removes the documents. + only through R29: any answer other than the right number writes none (R30), and declining + writes none. An extraction there writes a second report, and with `--json` a second JSON + file, without touching the first. `undo` on the second report removes the documents. `extract --no-report`, with and without `--json f`, follows the open question on it ("Before 4.4"): either it writes the extraction report (and `f`), or it is refused with exit 2 and writes nothing. @@ -568,11 +569,13 @@ answered before the roadmap step named in its heading; that step points back her reverse? ### Before 1.6 (confirmation logic) -- R30 says a wrong or empty number never confirms. At the terminal, after one, is the question - asked again or does the run stop? Which exit code does a run declined at the terminal give - (`n`, Enter, a wrong number)? R13 has 0, 1 and 2, and R30 gives 2 only for scripts. -- When is a typed number the right one? With the separators of the user's language (`12.345`, - `12,345`), with leading zeros, with spaces around it (R27, questions "Before 1.4")? +- R30 says any answer other than the right number never confirms. At the terminal, after such + an answer (`y`, `n`, Enter, a wrong number), is the question asked again or does the run stop? + Which exit code does a run declined at the terminal give? R13 has 0, 1 and 2, and R30 gives 2 + only for scripts. +- When is a typed number the right one? R29 calls it language-neutral. Does it accept the + separators of the user's language (`12.345`, `12,345`), leading zeros, spaces around it (R27, + questions "Before 1.4")? The answer holds for the dialog text field too (R30, "Before 5.2"). ### Before 1.7 (safe writer) and the first pseudo-terminal test - Pseudo-terminal tests (R34) need a pty crate as a dev-dependency, accepted by `deny.toml`: diff --git a/docs/roadmap.md b/docs/roadmap.md index 65dde7a..a063c94 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -44,7 +44,7 @@ The order follows two ideas: - risky runs counted on files of any kind (R28); - reports never replaced, and the second report (R16, R20, R31, R33); - `--plan` writes and downloads nothing (R19); - - a wrong or empty number never confirms at the terminal (R30); + - at the terminal, any answer other than the right number never confirms (R30); - the cache (R47); - no saved preference (R27); - `--no-report` (R14, R16); @@ -110,29 +110,31 @@ The order follows two ideas: - [ ] 1.4 **i18n skeleton** (R27): pick the mechanism (Fluent vs `rust-i18n`, decided with the user), English + Italian, `--lang`, OS language detection. Needed before any message below. First decide the questions "Before 1.4" in `docs/design.md`. -- [ ] 1.5 **Walk and count** (first decide the questions "Before 1.5" in `docs/design.md`) (R1b, R2, - R19, R28): one or more folders, a row per folder and the total; regular files only, symbolic links - met during the walk not followed (a selected one is resolved) and hidden folders skipped (both - listed in the report), unreadable folders listed; two counts (files to process, files of any - kind), total size, subfolders. Detection of sensitive folders (drive roots, home, Desktop, - Documents, system folders, network share roots) and of a risky run (a sensitive folder, or more - than 10,000 files of any kind over all the folders, subfolders included). Tests: the walk cases of - R34 "Counting" (10,000 against 10,001, files not counted, a selected folder that is a symbolic - link, overlaps) and of "Several folders" (overlaps, a symbolic link to each kind of sensitive - folder). +- [ ] 1.5 **Walk and count** (first decide the questions "Before 1.5" in `docs/design.md`) (R1b, + R2, R19, R28): one or more folders, a row per folder and the total; regular files only, + symbolic links met during the walk not followed (a selected one is resolved) and hidden + folders skipped (both listed in the report), unreadable folders listed; two counts (files to + process, files of any kind), total size, subfolders. Detection of sensitive folders (drive + roots, home, Desktop, Documents, system folders, network share roots) and of a risky run (a + sensitive folder, or more than 10,000 files of any kind over all the folders, subfolders + included). Tests: the walk cases of R34 "Counting" (10,000 against 10,001, also as a total + over several folders; files not counted; a selected folder that is a symbolic link; overlaps) + and of "Several folders" (overlaps, a symbolic link to each kind of sensitive folder). - [ ] 1.6 **Confirmation logic** (R28–R30; first decide the questions "Before 1.6" in - `docs/design.md`): pure functions turning (counts, folder, terminal, dialog via `--interactive`, - or script; `--plan`) into the question to ask and parsing the answer: typed count (R28 risky run, - R29), yes/no default No (R30). Typestate `ConfirmedPlan`. Tests: the R34 items "Risky run at the - terminal", "Yes/no questions" and "Scripts". The answers of "Writing and undo" (empty answer, `y`, - `n`, wrong number) at the count of documents. From "Several folders": the total is typed, one - sensitive folder makes the whole run risky, all folders empty stop the run. The reason for a risky - run in the terminal question. The dialogs themselves come with the menus (5.2). -- [ ] 1.7 **Safe writer** (R31): `create_new`, next free name on race, the two-step replace of cache - files and the manifest (temporary file, then rename), removal of partial files, stays inside the - folder (`..`, symbolic links), free-space check, re-check of originals. First decide the questions - "Before 1.7" in `docs/design.md`. Folder snapshot test helper (R34) introduced here and used from - now on. + `docs/design.md`): pure functions turning (counts, folder, terminal, dialog via + `--interactive`, or script; `--plan`) into the question to ask and parsing the answer: typed + count (R28 risky run, R29), yes/no default No (R30). Typestate `ConfirmedPlan`. Tests: the R34 + items "Risky run at the terminal", "Yes/no questions" and "Scripts". Tests also cover: the + answers of "Writing and undo" at the count of documents; from "Counting", both counts in each + row and in the totals of the terminal summary, the reason for a risky run, and the number + typed being the files to process (also when the run is risky only by the 10,000 limit); from + "Several folders", the typed total, one sensitive folder making the whole run risky, and all + folders empty stopping the run. The dialogs themselves come with the menus (5.2). +- [ ] 1.7 **Safe writer** (R31): `create_new`, next free name on race, the two-step replace of + cache files and the manifest (temporary file, then rename), removal of partial files, stays + inside the folder (`..`, symbolic links), free-space check, re-check of originals. First + decide the questions "Before 1.7" in `docs/design.md`. Folder snapshot test helper (R34) + introduced here and used from now on. ## Phase 2: opening envelopes (thin slice) - [ ] 2.1 `ber` reader: definite and indefinite lengths, limits on depth and size, checked @@ -141,7 +143,8 @@ The order follows two ideas: verification yet); base64 envelopes; nested layers (R3, R4, R7). - [ ] 2.3 End-to-end slice: `check` and `extract` on simple fixtures through the real flow, minimal console output with `--plain`, `--no-color` (R35), minimal JSON (R15), written - documents recorded in the report with SHA-256, and `undo` (R33). + documents recorded in the report with SHA-256, and `undo` (R33). Test from R34 "Several + folders": one report per selected folder that is not inside another. ## Phase 3: verification - [ ] 3.1 `crypto`: digests, RSA PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384/P-521 (R8). First decide From f14f725d47cf768e1ffb0b8e104d7419454e03b0 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Tue, 24 Nov 2026 11:32:37 +0100 Subject: [PATCH 32/36] Rewrite docs/roadmap.md to the writing guide The roadmap now reads as answers to the reader's questions (docs/writing.md). No step, requirement pointer, negation or restriction is dropped: the counts of "not", "never", "only" and "except" are the same as before. - Headings are questions: "How does a step get done?", "Why this order?", and one question per phase. - Step titles lose their bold labels. Long steps (0.2.1, 0.4, 0.5, 1.1, 1.5, 1.6, 1.7, 2.3, 3.7, 3.9) become short sentences or sub-lists. - 0.4 names the "Rust" section of the session report, as the script prints it (audit 0005-F3, 0009-F7). - 1.5 also tests each kind of sensitive folder selected directly. - 2.3 tests the `undo` cases of R34 "Writing and undo" (review of 818ba2d, m1). - No code span is broken across lines; lines wrap at 96 columns. In docs/design.md, the minor points of the review of 818ba2d: - R30: the owner's decision covers both sentences of the rule (m5). - The question on the right number asks whether the answer holds for the dialog text field, instead of stating it (m2). - R34 "Writing and undo" and R30 "Terminal" reflowed (m4). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/design.md | 23 +-- docs/roadmap.md | 381 +++++++++++++++++++++++++++--------------------- 2 files changed, 225 insertions(+), 179 deletions(-) diff --git a/docs/design.md b/docs/design.md index ba53eec..71920f4 100644 --- a/docs/design.md +++ b/docs/design.md @@ -195,10 +195,11 @@ script. R31 says how every file is created and which files may ever be replaced. - Terminal (`std::io::IsTerminal` on input and output): questions in the console (R19, R28, R29). "Terminal" means both input and output are a terminal. With output redirected (`| tee log`, `> file`) the run counts as a script. Yes/no questions default to No, and - Enter alone cancels. A typed number confirms only if it is the right one (owner's decision, - 2026-11-23). Any other answer (a wrong number, `y`, `n`, Enter alone) never confirms. This - holds for the files to process of a risky run (R28) and for the documents to write (R29). - The answers and the default are written out in words in the user's language (R35, R27). + Enter alone cancels. A typed number confirms only if it is the right one. Any other answer + (a wrong number, `y`, `n`, Enter alone) never confirms. This holds for the files to process + of a risky run (R28) and for the documents to write (R29). The owner decided both rules on + 2026-11-23. The answers and the default are written out in words in the user's language + (R35, R27). - Context menu (no terminal, started with `--interactive`): the same confirmations, with the same number to type and the same default, in a native dialog (R38), with a shorter summary than the console. @@ -264,12 +265,12 @@ script. R31 says how every file is created and which files may ever be replaced. - R34. **Proof by tests.** A shared test helper snapshots the whole folder (paths and SHA-256) before and after every end-to-end test: originals identical, nothing changed but the confirmed plan. - - Writing and undo (R29, R31, R32, R33): at the count of documents (R29), an empty answer, `y`, - `n` or a wrong number writes nothing; at the `undo` question, an empty answer or `n` removes - nothing; a file appearing between plan and write; names with `..`, reserved names, forbidden - characters, NFC/NFD and case collisions, over-long names; a symbolic link pointing outside; - disk full (simulated); `undo` with a modified file; `undo` on a report that records no - document. + - Writing and undo (R29, R31, R32, R33): at the count of documents (R29), an empty answer, + `y`, `n` or a wrong number writes nothing; at the `undo` question, an empty answer or `n` + removes nothing; a file appearing between plan and write; names with `..`, reserved names, + forbidden characters, NFC/NFD and case collisions, over-long names; a symbolic link pointing + outside; disk full (simulated); `undo` with a modified file; `undo` on a report that records + no document. - Risky run at the terminal (R28, R30): an empty answer, `y`, `n` or a wrong number starts no analysis. - Scripts (R30): every changing command, `check` and `extract --plan` in a risky run, and @@ -575,7 +576,7 @@ answered before the roadmap step named in its heading; that step points back her only for scripts. - When is a typed number the right one? R29 calls it language-neutral. Does it accept the separators of the user's language (`12.345`, `12,345`), leading zeros, spaces around it (R27, - questions "Before 1.4")? The answer holds for the dialog text field too (R30, "Before 5.2"). + questions "Before 1.4")? Is the answer the same for the dialog text field (R30, "Before 5.2")? ### Before 1.7 (safe writer) and the first pseudo-terminal test - Pseudo-terminal tests (R34) need a pty crate as a dev-dependency, accepted by `deny.toml`: diff --git a/docs/roadmap.md b/docs/roadmap.md index a063c94..e8eb76c 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,198 +1,243 @@ # SignSpector: roadmap -Order of work. Requirements (R…) are in `design.md`. Every step is TDD (red -> green -> -refactor), reviewed by the `fable-reviewer` agent, then committed. A step is done when its tests -are green on all three systems in CI and its PR is merged. Mark a step done here (`[x]`) in -the same PR that completes it; the coherence audit checks that the mark is true. - -The order follows two ideas: -1. **Safety first**: the parts that decide what gets written (names, collisions, confirmation) - come before the parts that read envelopes, and are pure functions, easy to test exhaustively. -2. **A thin end-to-end slice early**: as soon as envelopes can be opened, the whole path - count -> confirm -> plan -> confirm -> write -> report -> undo works on simple files, - before the long verification work. Problems in the flow show up early. - -## Phase 0: groundwork -- [x] 0.1 First commit and push to `main` (after review of the file list). From then on: one - branch and one draft PR per step, coherence audit every 5 commits, merge by local fast-forward - (`CLAUDE.md`). -- [x] 0.2 GitHub Actions CI (`.github/workflows/ci.yml`) on Windows, macOS, Linux, on the - shipped targets (windows-gnu, linux-musl, macOS arm64 + x86_64 build): fmt, clippy, nextest, - doctests, release build, cargo deny (also weekly), tests of the rule scripts on all three - systems; public-repository scan of every new commit (`check-public.sh --range`); audit - cadence on the PR head. Branch protection on `main`: all jobs green, linear history, no - force-push. CI is an alarm; the local hooks are the barrier. -- [x] 0.2.1 Confirmation rules simplified: the typed number only for files found in a folder - (R28, R29); `undo`, menus and `uninstall` ask yes/no; from the context menu the same - confirmations come in a native dialog; from a script nothing that changes anything runs except - `check` in an ordinary run, which writes its report and the cache (R30); - `check`/`extract` take several folders (a row each, the total typed); revocation without a - query per signature (R49); no `--yes`/`--expect`; `scripts/cleanup.sh` removes its safe - leftovers without asking. +## How does a step get done? + +Each step is test-driven: red, green, refactor. A new `fable-reviewer` agent reviews it, then it +is committed. A step is done when its tests are green on all three systems in CI and its PR is +merged. Mark the step done here (`[x]`) in the PR that completes it; the coherence audit checks +that the mark is true. Requirements (R…) are in `docs/design.md`. + +## Why this order? + +Two ideas set it: + +1. Safety first. The parts that decide what gets written (names, collisions, confirmation) come + before the parts that read envelopes. They are pure functions, easy to test exhaustively. +2. A thin end-to-end slice early. As soon as envelopes can be opened, the whole path works on + simple files: count, confirm, plan, confirm, write, report, undo. This comes before the long + verification work, so problems in the flow show up early. + +## Phase 0: what must be in place before the code? + +- [x] 0.1 First commit and push to `main`, after a review of the file list. From then on: one + branch and one draft PR per step, a coherence audit every 5 commits, merges by local + fast-forward (`CLAUDE.md`). +- [x] 0.2 GitHub Actions CI (`.github/workflows/ci.yml`) on Windows, macOS and Linux, on the + shipped targets (windows-gnu, linux-musl, macOS arm64 + x86_64 build). It runs fmt, clippy, + nextest, doctests, the release build, cargo deny (also weekly) and the tests of the rule + scripts on all three systems. It scans every new commit for the public repository + (`check-public.sh --range`) and checks the audit cadence on the PR head. Branch protection on + `main`: all jobs green, linear history, no force-push. CI is an alarm; the local hooks are the + barrier. +- [x] 0.2.1 Confirmation rules simplified: + - the number is typed only for files found in a folder (R28, R29); + - `undo`, menus and `uninstall` ask yes/no; + - from the context menu the same confirmations come in a native dialog; + - from a script nothing that changes anything runs, except `check` in an ordinary run, which + writes its report and the cache (R30); + - `check` and `extract` take several folders (a row each, the total typed); + - revocation without a query per signature (R49); + - no `--yes` or `--expect`; + - `scripts/cleanup.sh` removes its safe leftovers without asking. - [ ] 0.3 Fixture generator `scripts/make-fixtures.sh` (Homebrew `openssl@3`): test CA, signers, - simple `.p7m`/`.p7s`, `.tsd`. Synthetic identities only, private keys never committed - (generated at test time or kept in `target/`). - -- [ ] 0.4 Writing guide (`docs/writing.md`): texts as answers to the reader's questions, no - machine-made patterns (after Wikipedia's "Signs of AI writing"), answer first, short - sentences, code and commands verbatim. Rewrite README, design, roadmap, CLAUDE.md and the - agent prompts with it; comment in `rust-toolchain.toml` (targets and R25, how to update the - pinned version); session report line when a newer stable Rust exists. The reviews of this - step also led to owner's decisions on requirements (2026-11-23), recorded in - `docs/design.md`: - - what `check` writes (R16); - - risky runs counted on files of any kind (R28); - - reports never replaced, and the second report (R16, R20, R31, R33); - - `--plan` writes and downloads nothing (R19); - - at the terminal, any answer other than the right number never confirms (R30); - - the cache (R47); - - no saved preference (R27); - - `--no-report` (R14, R16); - - foreign menu items (R41). - - The questions they opened are listed in "What is still open?" in `docs/design.md`, each with - the roadmap step that needs the answer (1.4, 1.5, 1.6, 1.7, 3.1, 3.2, 3.5, 3.6, 3.7, 3.9, 4.2, - 4.4, 5.1, 5.2, 5.3). -- [ ] 0.5 Remaining gaps in the rule-script tests, found by the reviews of PR #1, PR #2 and - PR #3 and accepted as known limits for now (each needs a test before the code changes): - - `check-public.sh`: failures of `git show`, `ls-tree`, `diff-tree` are not each tested; - names of people, phone numbers, IPs, base64 content and branch names are not detected - (header "Known limits"); - - `cleanup.sh`: on Windows 5 checks are skipped (names with `\` cannot exist there, and a - read-only folder does not stop `rm`), so those rules are tested on macOS and Linux only; on - Windows the double-quote check runs but does not exercise git's quoting; the numbers passed - to `skip` are written by hand; the GitHub section duplicates `audit-status.sh`; "never asks" - is checked on the script's text (a word list) and with input on a pipe, never at a real - terminal; the check "still merged into main" (with full ref names) just before a branch is - deleted has no test (it guards a race); - - `audit-status.sh`: in the unfinished-work section, uncommitted changes, stashes and the - unpushed / not pulled counts have no test (the "AUDIT DUE" and "RED CHECKS" lines, the - current branch name, unmerged local and remote branches, a missing `main` or `origin/main`, - the `origin/HEAD` filter and "no tags or other refs" do); the "RED CHECKS" test covers the - printed line and its absence, not which checks are selected as red (the `gh` stub returns - the formatted line); only `FAILURE` counts as red today, not cancelled or timed-out jobs nor - commit statuses: decide and test; the negative RED CHECKS case does not assert that the - GitHub section ran, and its stub has a dead first line; - - report-mode tests pass if the script prints nothing in that section. - - `audit-status.sh`, "Rust" section: five review rounds on PR #3. The reviews of 2557e7f and - 1ac9d1d found minor bugs. All but one were fixed in 1ac9d1d and c3f070e; the missing time - limit on `rustup check` is the one left (below). The reviews of c3f070e, - 1363b18 and fb41029 found no bug, only breakages no test noticed. The owner decided - (2026-11-23) to stop the rounds there. A breakage of this section that shows no bug - is listed on the PR and here, not closed with another round. Known limit: `rustup check` - has no time limit. It runs only in report mode, after the hook gates, so no commit or push - waits on it. These three rules are correct today; breaking them on a copy leaves all tests - green (review of 40e2d4c): - - unescaping the first dot of the x.y.z check (`1x100.0` would then pass); - - accepting only a single digit for the major and patch numbers (`10.0.0` would then be - "not x.y.z"); - - letting the captured rustup version start with a dot. - - from the targeted review of the third-round fixes: - - the first push to a new remote scans the whole history and stops on the accepted - exception `cd3620d` (CLAUDE.md): encode the exception if a second remote is ever added; + simple `.p7m`/`.p7s`, `.tsd`. Synthetic identities only. Private keys are never committed: + they are generated at test time or kept in `target/`. +- [ ] 0.4 Writing guide (`docs/writing.md`): texts answer the reader's questions, answer first, + in short sentences, with code and commands verbatim and without machine-made patterns (after + Wikipedia's "Signs of AI writing"). README, design, roadmap, `CLAUDE.md` and the agent prompts + are rewritten with it. Also in this step: + - a comment in `rust-toolchain.toml`: targets and R25, how to update the pinned version; + - a "Rust" section in the session report (`scripts/audit-status.sh`) that names a newer stable + Rust when one exists; + - owner's decisions on requirements, taken in the reviews of this step (2026-11-23) and + recorded in `docs/design.md`: + - what `check` writes (R16); + - risky runs counted on files of any kind (R28); + - reports never replaced, and the second report (R16, R20, R31, R33); + - `--plan` writes and downloads nothing (R19); + - at the terminal, any answer other than the right number never confirms (R30); + - the cache (R47); + - no saved preference (R27); + - `--no-report` (R14, R16); + - foreign menu items (R41). + + The questions these decisions opened are in "What is still open?" in `docs/design.md`. Each + names the roadmap step that needs the answer: 1.4, 1.5, 1.6, 1.7, 3.1, 3.2, 3.5, 3.6, 3.7, + 3.9, 4.2, 4.4, 5.1, 5.2, 5.3. +- [ ] 0.5 Remaining gaps in the rule-script tests. The reviews of PR #1, PR #2 and PR #3 found + them, and they are accepted as known limits for now. Each needs a test before the code + changes. + - `check-public.sh`: + - failures of `git show`, `ls-tree` and `diff-tree` are not each tested; + - names of people, phone numbers, IPs, base64 content and branch names are not detected + (header "Known limits"). + - `cleanup.sh`: + - on Windows 5 checks are skipped: names with `\` cannot exist there, and a read-only folder + does not stop `rm`. Those rules are tested on macOS and Linux only; + - on Windows the double-quote check runs but does not exercise git's quoting; + - the numbers passed to `skip` are written by hand; + - the GitHub section duplicates `audit-status.sh`; + - "never asks" is checked on the script's text (a word list) and with input on a pipe, never + at a real terminal; + - the check "still merged into main" (with full ref names) just before a branch is deleted + has no test. It guards a race. + - `audit-status.sh`, unfinished-work section: + - uncommitted changes, stashes and the unpushed / not pulled counts have no test. These have + one: the "AUDIT DUE" and "RED CHECKS" lines, the current branch name, unmerged local and + remote branches, a missing `main` or `origin/main`, the `origin/HEAD` filter and "no tags + or other refs"; + - the "RED CHECKS" test covers the printed line and its absence, not which checks are + selected as red (the `gh` stub returns the formatted line); + - only `FAILURE` counts as red today, not cancelled or timed-out jobs nor commit statuses: + decide and test; + - the negative RED CHECKS case does not assert that the GitHub section ran, and its stub has + a dead first line; + - report-mode tests pass if the script prints nothing in that section. + - `audit-status.sh`, "Rust" section: + - five review rounds on PR #3. The reviews of 2557e7f and 1ac9d1d found minor bugs. All but + one were fixed in 1ac9d1d and c3f070e; the one left is the missing time limit on + `rustup check` (below); + - the reviews of c3f070e, 1363b18 and fb41029 found no bug, only breakages no test noticed. + The owner decided (2026-11-23) to stop the rounds there. A breakage of this section that + shows no bug is listed on the PR and here, not closed with another round; + - known limit: `rustup check` has no time limit. It runs only in report mode, after the hook + gates, so no commit or push waits on it; + - three rules are correct today, but breaking them on a copy leaves all tests green (review + of 40e2d4c): unescaping the first dot of the x.y.z check (`1x100.0` would then pass); + accepting only a single digit for the major and patch numbers (`10.0.0` would then be "not + x.y.z"); letting the captured rustup version start with a dot. + - From the targeted review of the third-round fixes: + - the first push to a new remote scans the whole history and stops on the accepted exception + `cd3620d` (`CLAUDE.md`). Encode the exception if a second remote is ever added; - nested annotated tags: only the outer message is scanned; - `core.commentChar` other than `#`: `git commit -v` is refused (fails closed); - - untested: `cleanup.sh` `--no-merged` with a detached HEAD at an unmerged commit; a - refused push and a crashing hook both exit 1. -## Phase 1: safe writing core (no cryptography) -- [x] 1.0 **R1a envelope names** (`is_envelope`): delivered with the project setup (0.1). -- [ ] 1.1 **R32 portable names** (`names` module). `portable_name(raw) -> PortableName { name, - changed }`. Tests, one per rule: forbidden characters, control characters, trailing dot and - space, reserved Windows names (any case, with extension, superscript digits), leading `-` - and `.`, `.`/`..`, invalid UTF-8, NFC, 255-byte/255-unit limit without breaking a character - or the extension, empty result -> fallback name. Property tests (`proptest`): output always - valid on all three systems, idempotent (`portable(portable(x)) == portable(x)`). -- [ ] 1.2 **Collision key and free name** (R17, R32): `collision_key` (case- and - normalization-insensitive); `next_free_name("x.pdf", taken)` -> `x (1).pdf`, `x (2).pdf`..., - still within the length limit. -- [ ] 1.3 **Output name from envelope name** (R16, R18 without content sniffing for now): + - untested: `cleanup.sh` `--no-merged` with a detached HEAD at an unmerged commit; a refused + push and a crashing hook both exit 1. + +## Phase 1: how do we write files safely, before any cryptography? + +- [x] 1.0 R1a, envelope names (`is_envelope`): delivered with the project setup (0.1). +- [ ] 1.1 R32, portable names (`names` module): + `portable_name(raw) -> PortableName { name, changed }`. + - Tests, one per rule: forbidden characters, control characters, trailing dot and space, + reserved Windows names (any case, with extension, superscript digits), leading `-` and `.`, + `.`/`..`, invalid UTF-8, NFC, the 255-byte/255-unit limit without breaking a character or + the extension, an empty result giving the fallback name. + - Property tests (`proptest`): the output is always valid on all three systems, and idempotent + (`portable(portable(x)) == portable(x)`). +- [ ] 1.2 Collision key and free name (R17, R32): `collision_key` ignores case and + normalization. `next_free_name("x.pdf", taken)` gives `x (1).pdf`, `x (2).pdf`..., still + within the length limit. +- [ ] 1.3 Output name from the envelope name (R16; R18 without content sniffing for now): `Relazione.pdf.p7m` -> `Relazione.pdf`, nested `.pdf.p7m.tsd`, uppercase extensions. -- [ ] 1.4 **i18n skeleton** (R27): pick the mechanism (Fluent vs `rust-i18n`, decided with the - user), English + Italian, `--lang`, OS language detection. Needed before any message below. +- [ ] 1.4 i18n skeleton (R27): pick the mechanism (Fluent or `rust-i18n`, decided with the + user), English and Italian, `--lang`, OS language detection. Needed before any message below. First decide the questions "Before 1.4" in `docs/design.md`. -- [ ] 1.5 **Walk and count** (first decide the questions "Before 1.5" in `docs/design.md`) (R1b, - R2, R19, R28): one or more folders, a row per folder and the total; regular files only, - symbolic links met during the walk not followed (a selected one is resolved) and hidden - folders skipped (both listed in the report), unreadable folders listed; two counts (files to - process, files of any kind), total size, subfolders. Detection of sensitive folders (drive - roots, home, Desktop, Documents, system folders, network share roots) and of a risky run (a - sensitive folder, or more than 10,000 files of any kind over all the folders, subfolders - included). Tests: the walk cases of R34 "Counting" (10,000 against 10,001, also as a total - over several folders; files not counted; a selected folder that is a symbolic link; overlaps) - and of "Several folders" (overlaps, a symbolic link to each kind of sensitive folder). -- [ ] 1.6 **Confirmation logic** (R28–R30; first decide the questions "Before 1.6" in - `docs/design.md`): pure functions turning (counts, folder, terminal, dialog via - `--interactive`, or script; `--plan`) into the question to ask and parsing the answer: typed - count (R28 risky run, R29), yes/no default No (R30). Typestate `ConfirmedPlan`. Tests: the R34 - items "Risky run at the terminal", "Yes/no questions" and "Scripts". Tests also cover: the - answers of "Writing and undo" at the count of documents; from "Counting", both counts in each - row and in the totals of the terminal summary, the reason for a risky run, and the number - typed being the files to process (also when the run is risky only by the 10,000 limit); from - "Several folders", the typed total, one sensitive folder making the whole run risky, and all - folders empty stopping the run. The dialogs themselves come with the menus (5.2). -- [ ] 1.7 **Safe writer** (R31): `create_new`, next free name on race, the two-step replace of - cache files and the manifest (temporary file, then rename), removal of partial files, stays - inside the folder (`..`, symbolic links), free-space check, re-check of originals. First - decide the questions "Before 1.7" in `docs/design.md`. Folder snapshot test helper (R34) - introduced here and used from now on. - -## Phase 2: opening envelopes (thin slice) +- [ ] 1.5 Walk and count (R1b, R2, R19, R28). First decide the questions "Before 1.5" in + `docs/design.md`. + - One or more folders, a row per folder and the total. + - Regular files only. Symbolic links met during the walk are not followed (a selected one is + resolved), and hidden folders are skipped; both are listed in the report. Unreadable folders + are listed. + - Two counts (files to process, files of any kind), total size, subfolders. + - Detection of sensitive folders (drive roots, home, Desktop, Documents, system folders, + network share roots) and of a risky run: a sensitive folder, or more than 10,000 files of + any kind over all the folders, subfolders included. + - Tests from R34 "Counting": 10,000 against 10,001, also as a total over several folders; + files not counted; a selected folder that is a symbolic link; overlaps. + - Tests from R34 "Several folders": overlaps; a symbolic link to each kind of sensitive + folder. Also each kind of sensitive folder selected directly. +- [ ] 1.6 Confirmation logic (R28–R30). First decide the questions "Before 1.6" in + `docs/design.md`. + - Pure functions turn the counts, the folder, the way the run started (terminal, dialog via + `--interactive`, or script) and `--plan` into the question to ask. They also parse the + answer. + - The question is a typed count (R28 risky run, R29) or a yes/no question with default No + (R30). Typestate `ConfirmedPlan`. + - Tests: the R34 items "Risky run at the terminal", "Yes/no questions" and "Scripts". + - Tests: the answers of R34 "Writing and undo" at the count of documents. + - Tests from R34 "Counting": both counts in each row and in the totals of the terminal + summary; the reason for a risky run; the number typed is the files to process, also when the + run is risky only by the 10,000 limit. + - Tests from R34 "Several folders": the typed total; one sensitive folder makes the whole run + risky; all folders empty stop the run. + - The dialogs themselves come with the menus (5.2). +- [ ] 1.7 Safe writer (R31). First decide the questions "Before 1.7" in `docs/design.md`. + - `create_new`, the next free name on a race, removal of partial files. + - The two-step replace of cache files and the manifest: a temporary file, then a rename. + - Writing stays inside the folder (`..`, symbolic links); free-space check; re-check of + originals. + - The folder snapshot test helper (R34) is introduced here and used from now on. + +## Phase 2: how do we open envelopes end to end? + - [ ] 2.1 `ber` reader: definite and indefinite lengths, limits on depth and size, checked arithmetic; fuzz target. - [ ] 2.2 `cms` SignedData parsing: encapsulated content, certificates, signer infos (no verification yet); base64 envelopes; nested layers (R3, R4, R7). -- [ ] 2.3 End-to-end slice: `check` and `extract` on simple fixtures through the real flow, - minimal console output with `--plain`, `--no-color` (R35), minimal JSON (R15), written - documents recorded in the report with SHA-256, and `undo` (R33). Test from R34 "Several - folders": one report per selected folder that is not inside another. - -## Phase 3: verification -- [ ] 3.1 `crypto`: digests, RSA PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384/P-521 (R8). First decide - the question "Before 3.1" in `docs/design.md`. -- [ ] 3.2 `x509`: certificate fields, key usage, qualified/QSCD statements, validity (R9). - First decide the question "Before 3.2" in `docs/design.md`. -- [ ] 3.3 `xmldsig`: exclusive C14N and XML signature verification (R44), test first, - fuzzed like `ber`. -- [ ] 3.4 `tsl`: LOTL and national lists, signatures verified, embedded LOTL + Italian list, +- [ ] 2.3 End-to-end slice: `check` and `extract` on simple fixtures through the real flow. + - Minimal console output with `--plain` and `--no-color` (R35); minimal JSON (R15). + - Written documents recorded in the report with SHA-256, and `undo` (R33). + - Tests from R34 "Several folders": one report per selected folder that is not inside another. + - Tests from R34 "Writing and undo": the `undo` cases (an empty answer or `n` removes nothing; + a modified file; a report that records no document). + +## Phase 3: how do we verify signatures and time stamps? + +- [ ] 3.1 `crypto`: digests, RSA PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384/P-521 (R8). First + decide the question "Before 3.1" in `docs/design.md`. +- [ ] 3.2 `x509`: certificate fields, key usage, qualified/QSCD statements, validity (R9). First + decide the question "Before 3.2" in `docs/design.md`. +- [ ] 3.3 `xmldsig`: exclusive C14N and XML signature verification (R44), test first, fuzzed + like `ber`. +- [ ] 3.4 `tsl`: LOTL and national lists, signatures verified, embedded LOTL and Italian list, service history (R44, R48). - [ ] 3.5 Choice of lists from the certifiers' countries, download, cache, `--trust-lists`, `--offline` (R45–R47). First decide the questions "Before 3.5" in `docs/design.md`. - [ ] 3.6 Chain building against the TSL and the system store (R10). First decide the questions "Before 3.6" in `docs/design.md`. -- [ ] 3.7 Countersignatures (R11); `tsp`: RFC 3161, `.tsd`, `.m7m` (R5, R12); detached `.p7s` (R6). - A time stamp is a proved time (R9) only if it verifies per R12 (chain to a trusted-list - TSA); negative test: a forged or untrusted time stamp changes no verdict. First decide the - question "Before 3.7" in `docs/design.md`. +- [ ] 3.7 Countersignatures (R11); `tsp`: RFC 3161, `.tsd`, `.m7m` (R5, R12); detached `.p7s` + (R6). First decide the question "Before 3.7" in `docs/design.md`. + - A time stamp is a proved time (R9) only if it verifies per R12, with a chain to a + trusted-list TSA. + - Negative test: a forged or untrusted time stamp changes no verdict. - [ ] 3.8 Content sniffing for names without a usable extension (R18). -- [ ] 3.9 Revocation (R49): decide the questions "Before 3.9" in `docs/design.md`; data embedded - in the signature, CRL per CA with cache, one check per certificate, "revocation not checked" - offline. Negative tests: revoked before and after the time stamp, revoked with no time stamp - (cannot be determined, never invalid), stale or forged embedded data, forged or oversized CRL, - CRL older than the reference time, expired certificate no longer listed, distribution point - outside `http`/`https`. Also: an embedded CRL older than the reference time when the CA's CRL - cannot be fetched ("revocation not checked"). - -## Phase 4: output +- [ ] 3.9 Revocation (R49). First decide the questions "Before 3.9" in `docs/design.md`. + - Data embedded in the signature, a CRL per CA with cache, one check per certificate, + "revocation not checked" offline. + - Negative tests: revoked before and after the time stamp; revoked with no time stamp (cannot + be determined, never invalid); stale or forged embedded data; a forged or oversized CRL; a + CRL older than the reference time; an expired certificate no longer listed; a distribution + point outside `http`/`https`. + - Also: an embedded CRL older than the reference time when the CA's CRL cannot be fetched + ("revocation not checked"). + +## Phase 4: what does the user see? + - [ ] 4.1 Console summary, colours with contrast, exit codes (R13, R35). - [ ] 4.2 Accessible HTML report, WCAG 2.2 AA (R14, R36), checker in CI (R39). First decide the questions "Before 4.2" in `docs/design.md`. -- [ ] 4.3 Full `--json` (R15); parallel processing with stable output order (R23). +- [ ] 4.3 Full `--json` (R15); parallel processing with a stable output order (R23). - [ ] 4.4 Command line and translated help, interactive end of run (R19, R20, R37). First decide - `--open`, `--threads`, `extract --no-report` and double-click detection (questions - "Before 4.4" in `docs/design.md`). + `--open`, `--threads`, `extract --no-report` and double-click detection (questions "Before + 4.4" in `docs/design.md`). + +## Phase 5: how does it fit into the system? -## Phase 5: system integration - [ ] 5.1 Install manifest (R41). First decide how `create_new` applies to registry keys and - `.workflow` folders and the other questions "Before 5.1" in `docs/design.md`. -- [ ] 5.2 Context menu per OS (R21, R38) with the confirmation dialogs (R30): first decide the - questions "Before 5.2" in `docs/design.md` (Enter in a number field, what the shorter dialog - summary must show, and the other questions), with R34 tests; Windows "Installed apps" entry (R42). + `.workflow` folders, and the other questions "Before 5.1" in `docs/design.md`. +- [ ] 5.2 Context menu per OS (R21, R38) with the confirmation dialogs (R30) and their R34 + tests; Windows "Installed apps" entry (R42). First decide the questions "Before 5.2" in + `docs/design.md`: Enter in a number field, what the shorter dialog summary must show, and the + other questions. - [ ] 5.3 `uninstall` (R40–R43). First decide what happens to a file in the cache folder that the tool did not write (questions "Before 5.3" in `docs/design.md`). -## Phase 6: release +## Phase 6: how do we release it? + - [ ] 6.1 Builds for all targets; `.deb`, `.rpm`, `.tar.gz` (R24, R25); one self-contained executable per platform, pure Rust (R22, enforced by `cargo deny`); version tag (R26). -- [ ] 6.2 Test on the company Windows PC (antivirus, SmartScreen, AppLocker) with the real corpus. +- [ ] 6.2 Test on the company Windows PC (antivirus, SmartScreen, AppLocker) with the real + corpus. - [ ] 6.3 Manual accessibility checks, `docs/accessibility.md` (R39); user guide (R37). - [ ] 6.4 `1.0.0` when ready to replace the old tool. From f8c0ac211c16e9db0f9d0eba74dc474f64e44f14 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Tue, 24 Nov 2026 12:03:26 +0100 Subject: [PATCH 33/36] Rewrite CLAUDE.md to the writing guide CLAUDE.md now reads as answers to the reader's questions (docs/writing.md). No rule is dropped: every requirement pointer and code span is kept, and "not", "never", "only" keep their counts or grow. "except" became "the one exception is". - Headings are questions: "How do we write code?", "How do we keep long work from drifting?", "What may never reach the public repository?", "Which rules hold everywhere?", "How do we build it?", "Which test data may we use?". - Bold labels are gone. Long items, such as the GitHub settings and the cleanup rules, become sub-lists of short sentences. - The comments that named the old headings follow the new ones: scripts/audit-status.sh, scripts/cleanup.sh, .githooks/pre-commit (comments only), docs/writing.md and the reviewer prompt. The minor points of the review of f14f725: - R30 names the two rules the owner decided. - Each phase of the roadmap has an answer under its heading. - Steps 1.0 and 1.1 put the requirement number at the end. - Roadmap 0.4 is split into short sentences, with "Rewrite ..." back in the imperative. - Roadmap 1.5 tests each kind of sensitive folder selected directly as its own item, pointing to R28. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- .claude/agents/fable-reviewer.md | 6 +- .githooks/pre-commit | 2 +- CLAUDE.md | 338 ++++++++++++++++--------------- docs/design.md | 6 +- docs/roadmap.md | 31 ++- docs/writing.md | 2 +- scripts/audit-status.sh | 5 +- scripts/cleanup.sh | 3 +- 8 files changed, 214 insertions(+), 179 deletions(-) diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index 0714cea..9683cf8 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -51,9 +51,9 @@ Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). `NO_COLOR`/`--plain` honoured, no prompt time limits, semantic and keyboard-operable HTML with sufficient contrast; anything installed is recorded for `uninstall`, which removes only what SignSpector installed and never user data. -6. **Public repository**: nothing that could carry personal or sensitive data (see the - "Public repository" section of `CLAUDE.md`); run `sh scripts/check-public.sh --staged` - when changes are staged. +6. **Public repository**: nothing that could carry personal or sensitive data (see the section + "What may never reach the public repository?" of `CLAUDE.md`); run + `sh scripts/check-public.sh --staged` when changes are staged. ## Proof of TDD diff --git a/.githooks/pre-commit b/.githooks/pre-commit index b3504ae..f4b24a2 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -7,7 +7,7 @@ set -e # The repository is public: no personal data, keys or unexpected files (allowlist + content scan). sh "$(git rev-parse --show-toplevel)/scripts/check-public.sh" --staged -# Coherence audit every 5 commits (CLAUDE.md, "Coherence audits and unfinished work"). +# Coherence audit every 5 commits (CLAUDE.md, "How do we keep long work from drifting?"). sh "$(git rev-parse --show-toplevel)/scripts/audit-status.sh" --gate-commit # Changes to the rules themselves: run their tests. diff --git a/CLAUDE.md b/CLAUDE.md index a6079eb..433c429 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,188 +1,204 @@ # SignSpector -Finds signed and time-stamped files (`.p7m`, `.p7s`, `.tsd`, `.m7m`) under a folder, verifies -signatures and time stamps (European trusted lists) and writes an HTML report; on request it extracts -the signed documents beside the originals. Runs on Windows, macOS and Linux. +SignSpector finds signed and time-stamped files (`.p7m`, `.p7s`, `.tsd`, `.m7m`) under a folder. +It verifies signatures and time stamps against the European trusted lists and writes an HTML +report. On request it extracts the signed documents beside the originals. It runs on Windows, +macOS and Linux. -A new project in Rust. It takes the idea of an earlier Windows-only tool by the same author -(`p7m-extract`, in C#, kept outside this repository in `../SignSpector-legacy/`), but it is -**not a port**: requirements and design are in `docs/design.md`, the order of work in -`docs/roadmap.md`; read both first. Look at the old code only when the user asks to. +It is a new project in Rust. It takes the idea of an earlier Windows-only tool by the same +author (`p7m-extract`, in C#, kept outside this repository in `../SignSpector-legacy/`), but it +is not a port. Requirements and design are in `docs/design.md`, the order of work in +`docs/roadmap.md`: read both first. Look at the old code only when the user asks to. After cloning, enable the hooks once: `git config core.hooksPath .githooks`. -## Way of working: TDD, for all code +## How do we write code? -TDD applies to **everything that has logic**: Rust, shell scripts, git hooks, the CI workflow. -No exception for "infrastructure". +Test first, always. TDD applies to everything that has logic: Rust, shell scripts, git hooks, +the CI workflow. There is no exception for "infrastructure". -1. **Red**: write the test for one small behaviour first; run it and see it fail for the right +1. Red: write the test for one small behaviour first. Run it and see it fail for the right reason. For the CI workflow the red is a failing run on GitHub. -2. **Green**: the smallest code that makes it pass. -3. **Refactor** with all tests green; `cargo clippy --all-targets -- -D warnings` and - `cargo fmt` clean. -4. **Proof**: every PR description quotes the red output (the failing test run) and the green - one. Rules that protect (scripts under `scripts/`, safety code) are also checked by breaking - each rule on a copy and seeing at least one test fail; a rule nobody's test notices gets a - test. One exception, decided by the owner: in the "Rust" section of `audit-status.sh`, a - breakage that shows no bug is listed, not tested (`docs/roadmap.md`, 0.5). -5. **Independent review**: a **newly started** `fable-reviewer` agent (different model) for - every review, briefed only with the scope and where the requirements are: never resumed, - never given my conclusions or earlier findings. Fix its findings or explain to the user why - not. Every verdict (APPROVED or CHANGES NEEDED, the findings in short, how each was closed) - is posted as a comment on the pull request, so the approval leaves a trace an audit can - check (the PR description alone is not enough). The comment is a summary written for the - public, with repository-relative paths, never the pasted report (reports carry local - paths). `check-public.sh` does not scan PR comments: save the comment to a file and run +2. Green: write the smallest code that makes it pass. +3. Refactor with all tests green; `cargo clippy --all-targets -- -D warnings` and `cargo fmt` + clean. +4. Proof: every PR description quotes the red output (the failing test run) and the green one. + Rules that protect (scripts under `scripts/`, safety code) are also checked by breaking each + rule on a copy and seeing at least one test fail. A rule that no test notices gets a test. + One exception, decided by the owner: in the "Rust" section of `audit-status.sh`, a breakage + that shows no bug is listed, not tested (`docs/roadmap.md`, 0.5). +5. Independent review: a newly started `fable-reviewer` agent (different model) for every + review. Brief it only with the scope and where the requirements are. Never resume it, and + never give it my conclusions or earlier findings. Fix its findings, or explain to the user + why not. Post every verdict as a comment on the pull request: APPROVED or CHANGES NEEDED, the + findings in short, how each was closed. The approval then leaves a trace an audit can check; + the PR description alone is not enough. The comment is a summary written for the public, with + repository-relative paths, never the pasted report (reports carry local paths). + `check-public.sh` does not scan PR comments: save the comment to a file and run `sh scripts/check-public.sh --message <file>` before posting. -6. Commit only when the user asks. Hooks (`.githooks/`): pre-commit runs the public-repository - check, the audit cadence gate, the script tests when scripts or hooks change, fmt, clippy - and tests; commit-msg scans the message; pre-push scans every commit not yet on the remote it pushes - to (other remotes never hide commits). Script and hook tests: `scripts/test-scripts.sh`, - `scripts/test-cleanup.sh`, `scripts/test-hooks.sh`. +6. Commit only when the user asks. The hooks (`.githooks/`) do this: + - pre-commit runs the public-repository check, the audit cadence gate, the script tests when + scripts or hooks change, fmt, clippy and tests; + - commit-msg scans the message; + - pre-push scans every commit not yet on the remote it pushes to (other remotes never hide + commits). + + Script and hook tests: `scripts/test-scripts.sh`, `scripts/test-cleanup.sh`, + `scripts/test-hooks.sh`. Logic lives in the library (`src/lib.rs` and modules); `src/main.rs` is only the command line. -Unit tests sit beside the code (`#[cfg(test)]`); end-to-end tests of the executable go in +Unit tests sit beside the code (`#[cfg(test)]`). End-to-end tests of the executable go in `tests/*.rs` (`assert_cmd`). Tools: `bacon` (tests on every save), `cargo nextest run`, `cargo llvm-cov nextest` (coverage), `cargo deny check` (licences, advisories, no OpenSSL). -## Coherence audits and unfinished work - -Long work across sessions drifts: docs claim things the code does not do, references to -functions or options that never existed, work left half-done. Rules against it: - -- **Session start**: run `sh scripts/audit-status.sh` and tell the user what it shows. Unfinished - work comes first (uncommitted changes, stashes, unpushed commits, unmerged branches, open or - draft PRs, red CI): finish it, or close it with a written reason, before starting anything new. -- **Branches and PRs** (after the first push): one branch per roadmap step - (`step/1.1-portable-names`), pushed early as a **draft PR**; marked ready only when CI is - green on all four jobs (read in the job list, never assumed from a pending run) and - `fable-reviewer` approved (its verdict posted on the PR); merged into `main` **locally by - fast-forward** (`git switch main && git merge --ff-only step/x && git push`): the same commits - CI checked, linear history, pre-push hook run. The GitHub merge button is not used (it - rewrites commits). **One step open at a time.** A session never ends with a draft PR without a - comment saying its state and next step; abandoned work is closed with the reason, never left +## How do we keep long work from drifting? + +Long work across sessions drifts: docs claim things the code does not do, references point to +functions or options that never existed, work is left half-done. These rules work against it. + +- Session start: run `sh scripts/audit-status.sh` and tell the user what it shows. Unfinished + work comes first: uncommitted changes, stashes, unpushed commits, unmerged branches, open or + draft PRs, red CI. Finish it, or close it with a written reason, before starting anything new. +- Branches and PRs (after the first push): one branch per roadmap step + (`step/1.1-portable-names`), pushed early as a draft PR. Mark it ready only when CI is green + on all four jobs (read in the job list, never assumed from a pending run) and `fable-reviewer` + approved, with its verdict posted on the PR. Merge it into `main` locally by fast-forward: + `git switch main && git merge --ff-only step/x && git push`. That keeps the commits CI + checked, a linear history and the pre-push hook. The GitHub merge button is not used: it + rewrites commits. One step is open at a time. A session never ends with a draft PR without a + comment saying its state and next step. Abandoned work is closed with the reason, never left open. -- **Every 5 commits: coherence audit** by the `coherence-auditor` agent (Fable, fresh context, - read-only): requirements vs tests vs code, every concrete reference checked for existence, - docs agreeing with each other, unfinished work, project rules, health. Its report is saved as - `docs/audits/NNNN-YYYY-MM-DD.md` and committed alone (`audit: NNNN`). The hooks enforce the - cadence: pre-commit refuses a 6th commit without an audit, pre-push refuses to push past it. - The gate is a reminder, not a proof: any added report satisfies it; the review of the report - is what counts. -- **Findings are verified before acting**: the auditor can be wrong too. Each finding carries - evidence (`file:line` or command output); check it, then fix it in a normal TDD cycle. When a - doc and the code disagree on *what the tool should do*, ask the user which one is right; - never silently align the doc to the code or the code to the doc. -- **After every audit, remove leftovers**: `sh scripts/cleanup.sh` removes the local ones, - without asking, and says what it removed (`.DS_Store`, `*.orig`, `*.rej` anywhere outside - ignored folders, also inside untracked ones; local branches already merged into main); - `--plan` only lists them. The removing form is run by the main session after an audit; - agents (auditor, reviewer) run only `sh scripts/cleanup.sh --plan`. Worktrees, - backups (`*.bak`), editor files and other untracked files are only - listed; ignored folders are never touched, and `tests/corpus/`, `tests/out/`, `target/` - are protected even if `.gitignore` lacks them. Deletion happens **only - locally, from the development environment, never on GitHub**: merged remote branches stay - there as history; stale or draft PRs found on GitHub are reported to the user. Untracked - files that are not recognisable junk are listed for the user, never deleted silently. -- Also run an audit, outside the cadence, after an interrupted session, a long pause, or when - something "remembered" cannot be found in the files. - -## Public repository: no sensitive data, ever - -`github.com/bertalan/SignSpector` is **public**: everything committed is published and stays -in the history even if deleted later. Before every commit and push: - -- Never commit: real signed documents or anything extracted from them, names, codici fiscali, - email addresses, phone numbers, company or office names, local paths that reveal a user name - (write `~` or `%USERPROFILE%` instead), hostnames, IPs, credentials, tokens, private keys - (also test keys: fixtures generate them at test time), logs or reports produced on real files. -- Commit messages, issues and PR texts follow the same rules (they are public too). +- Every 5 commits, a coherence audit by the `coherence-auditor` agent (Fable, fresh context, + read-only). It checks requirements against tests and code, the existence of every concrete + reference, the docs against each other, unfinished work, project rules and health. Its report + is saved as `docs/audits/NNNN-YYYY-MM-DD.md` and committed alone (`audit: NNNN`). The hooks + enforce the cadence: pre-commit refuses a 6th commit without an audit, pre-push refuses to + push past it. The gate is a reminder, not a proof: any added report satisfies it. The review + of the report is what counts. +- Findings are verified before acting, because the auditor can be wrong too. Each finding + carries evidence (`file:line` or command output). Check it, then fix it in a normal TDD cycle. + When a doc and the code disagree on what the tool should do, ask the user which one is right. + Never silently align the doc to the code or the code to the doc. +- After every audit, remove leftovers. `sh scripts/cleanup.sh` removes the local ones without + asking and says what it removed: `.DS_Store`, `*.orig`, `*.rej` anywhere outside ignored + folders (also inside untracked ones), and local branches already merged into main. `--plan` + only lists them. The main session runs the removing form after an audit; agents (auditor, + reviewer) run only `sh scripts/cleanup.sh --plan`. + - Worktrees, backups (`*.bak`), editor files and other untracked files are only listed. + - Ignored folders are never touched. `tests/corpus/`, `tests/out/` and `target/` are protected + even if `.gitignore` lacks them. + - Deletion happens only locally, from the development environment, never on GitHub. Merged + remote branches stay there as history. Stale or draft PRs found on GitHub are reported to + the user. + - Untracked files that are not recognisable junk are listed for the user, never deleted + silently. +- Also run an audit outside the cadence: after an interrupted session, after a long pause, or + when something "remembered" cannot be found in the files. + +## What may never reach the public repository? + +`github.com/bertalan/SignSpector` is public. Everything committed is published, and it stays in +the history even if deleted later. Before every commit and push: + +- Never commit real signed documents or anything extracted from them. Never commit names, codici + fiscali, email addresses, phone numbers, company or office names, hostnames, IPs, credentials, + tokens or private keys (also test keys: fixtures generate them at test time). Never commit + local paths that reveal a user name (write `~` or `%USERPROFILE%` instead), nor logs or + reports produced on real files. +- Commit messages, issues and PR texts follow the same rules: they are public too. - Fixtures are synthetic only, with obviously fake identities (`Mario Rossi Test`, `example.com`, invalid codici fiscali). -- `scripts/check-public.sh` enforces part of it: an allowlist of paths (a new kind of file - needs a deliberate change there; no PR texts, notes or key files) plus a content scan of - files, file names, commit messages and identities, run by the pre-commit, commit-msg and - pre-push hooks. Never bypass them with `--no-verify`; a false positive is fixed by changing - the script, reviewed like code. It does **not** detect names of people, phone numbers, host - names or IPs: those need review. -- **GitHub settings** (set 2026-11-22, changed only with the user's explicit authorisation): - `main` protected (the four CI jobs green on an up-to-date commit, also for admins; linear - history; no force-push, no deletion; no PR required, merges are local fast-forwards); merge - commits and squash disabled; no automatic branch deletion; **only collaborators may open - PRs, issues and comments** (interaction limit, 6 months at most: the session report warns 30 - days before it expires); fork PR workflows always need approval; only GitHub-owned actions - plus `Swatinem/rust-cache`, `taiki-e/install-action`, `EmbarkStudios/cargo-deny-action`, - pinned by SHA; wiki and projects off; vulnerability alerts on, no Dependabot PRs; secret - scanning with push protection on. The GitGuardian app installed on the owner's account adds - its own secret check to every PR (not a required check). -- **Accepted exception**: the repository's first commit (`cd3620d`, "Initial commit", made on - the GitHub website) has the owner's personal address as author. The owner accepted it - (2026-11-22); history is not rewritten. Every later commit uses the GitHub no-reply address. -- **The hooks are the barrier, CI is only an alarm**: when CI runs, the push is already public. - A pull request also runs its own version of the workflow, so changes to `.github/`, - `scripts/` and `.githooks/` get a careful review. +- `scripts/check-public.sh` enforces part of it. It has an allowlist of paths: a new kind of + file needs a deliberate change there, and PR texts, notes and key files are not allowed. It + also scans the content of files, file names, commit messages and identities. The pre-commit, + commit-msg and pre-push hooks run it. Never bypass them with `--no-verify`. A false positive + is fixed by changing the script, reviewed like code. The script does not detect names of + people, phone numbers, host names or IPs: those need review. +- GitHub settings were set on 2026-11-22. They change only with the user's explicit + authorisation. + - `main` is protected: the four CI jobs green on an up-to-date commit, also for admins; linear + history; no force-push, no deletion. No PR is required: merges are local fast-forwards. + - Merge commits and squash are disabled. There is no automatic branch deletion. + - Only collaborators may open PRs, issues and comments. This interaction limit lasts 6 months + at most; the session report warns 30 days before it expires. + - Fork PR workflows always need approval. + - Only GitHub-owned actions plus `Swatinem/rust-cache`, `taiki-e/install-action` and + `EmbarkStudios/cargo-deny-action` are allowed, pinned by SHA. + - Wiki and projects are off. Vulnerability alerts are on, with no Dependabot PRs. Secret + scanning with push protection is on. + - The GitGuardian app installed on the owner's account adds its own secret check to every PR. + It is not a required check. +- Accepted exception: the repository's first commit (`cd3620d`, "Initial commit", made on the + GitHub website) has the owner's personal address as author. The owner accepted it on + 2026-11-22; history is not rewritten. Every later commit uses the GitHub no-reply address. +- The hooks are the barrier; CI is only an alarm. When CI runs, the push is already public. A + pull request also runs its own version of the workflow, so changes to `.github/`, `scripts/` + and `.githooks/` get a careful review. - Before the first push of a session, review the exact file list (`git show --stat`) with the user. Pushing is always the user's decision. -## Conventions - -- **Writing.** Every text (docs, comments, commit messages, PR texts, agent prompts, the - tool's strings) follows `docs/writing.md`: answers to the reader's questions, answer first, - short sentences, code and commands verbatim. -- **Language.** Everything in the repository is in English: code, comments, file headers, - docs, commit messages, script and hook messages, agent prompts and reports. Italian is used - only when talking to the user (the developer) in the conversation. -- **The tool's own interface is translated** (console messages, `--help`, HTML report, user - guide): it speaks the operating system's language, or the one chosen by the user - (`--lang`, see R27 in `docs/design.md`). Source strings are English; every user-facing text - goes through the translation layer, never hard-coded, and each new text gets its Italian - translation in the same change. -- `check` writes no document: only the report (HTML and JSON) and the tool's cache of trusted lists - and CRLs (R16); documents come only from an extraction confirmed through R29 (`extract`, or the - interactive end of a `check` run, R20). **There is no `--apply`, `--yes` or `--expect`.** Every - command that changes files or the system shows the exact plan first, except `check` in an - ordinary run from a script, which writes its report and the cache without a question (R16, - R30). The number is typed only for files found in a folder (files to process in a risky run, - R28; documents to write, R29); `undo`, menus and `uninstall` ask a yes/no question, default No, - answers in words (R30, R35). From the context menu the same confirmations come in a native - dialog, focus on Cancel; from a script they refuse (R30); `--plan` shows the plan and stops. - These rules are for the tool; the developer script `scripts/cleanup.sh` is the one exception (it - removes only junk and merged branches, without asking, see above). Never ask the developer to - type numbers in chat: the typed count is a rule of the tool, not of the conversation. -- Originals are only read, never modified, moved or renamed; existing files are never - overwritten ("x.pdf" exists with other content -> "x (1).pdf"). -- **Never process right after a person chooses a folder**: first count and ask for - confirmation (R28; from a script an ordinary run is analysed without a question, a risky - one is refused); writing needs a second confirmation on the full write plan, with the number typed - (R29); no implicit yes, ever (R30: terminal, dialog from the context menu, refusal in - scripts). How every file is written, and the only files ever replaced, is R31 in - `docs/design.md`: read it before touching any write path. - File names valid on Windows, macOS and Linux at once (R32). Any change here needs the tests - of R34. -- **Accessibility is a requirement, not a polish step** (EN 301 549; WCAG 2.2 AA for the - report; R35–R39). Never convey information by colour or symbols alone; honour `NO_COLOR`, - `--no-color`, `--plain`; no spinners or rapid line rewriting; no time limits on prompts; - linear console text, no box drawing; the HTML report is semantic, keyboard operable, - contrast-checked, works without JavaScript. Every user-facing change keeps its tests green. -- **Uninstall is part of every install feature** (R40–R43): anything that adds something to - the system records it in the manifest and is removed by `signspector uninstall`, which - removes only what we installed and never user data. -- Malformed input never panics: it becomes an error for that file. No `unwrap`/`expect`/indexing - on untrusted data outside tests (enforced by clippy lints in `Cargo.toml`). -- No PowerShell in anything the tool runs on Windows: company PCs force Constrained Language Mode. -- Pure Rust dependencies (no OpenSSL, checked by `cargo deny`): one self-contained executable +## Which rules hold everywhere? + +- Every text follows `docs/writing.md`: docs, comments, commit messages, PR texts, agent + prompts, the tool's strings. Texts answer the reader's questions, answer first, in short + sentences, with code and commands verbatim. +- Everything in the repository is in English: code, comments, file headers, docs, commit + messages, script and hook messages, agent prompts and reports. Italian is used only when + talking to the user (the developer) in the conversation. +- The tool's own interface is translated: console messages, `--help`, the HTML report, the user + guide. It speaks the operating system's language, or the one chosen by the user (`--lang`, R27 + in `docs/design.md`). Source strings are English. Every user-facing text goes through the + translation layer, never hard-coded, and each new text gets its Italian translation in the + same change. +- `check` writes no document: only the report (HTML and JSON) and the tool's cache of trusted + lists and CRLs (R16). Documents come only from an extraction confirmed through R29: `extract`, + or the interactive end of a `check` run (R20). There is no `--apply`, `--yes` or `--expect`. +- Every command that changes files or the system shows the exact plan first. The one exception + is `check` in an ordinary run from a script, which writes its report and the cache without a + question (R16, R30). +- The number is typed only for files found in a folder: files to process in a risky run (R28), + documents to write (R29). `undo`, menus and `uninstall` ask a yes/no question, default No, + with answers in words (R30, R35). From the context menu the same confirmations come in a + native dialog, focus on Cancel. From a script they refuse (R30). `--plan` shows the plan and + stops. +- These rules are for the tool. The developer script `scripts/cleanup.sh` is the one exception: + it removes only junk and merged branches, without asking (see above). Never ask the developer + to type numbers in chat: the typed count is a rule of the tool, not of the conversation. +- Originals are only read, never modified, moved or renamed. Existing files are never + overwritten: if "x.pdf" exists with other content, the new file is "x (1).pdf". +- Never process right after a person chooses a folder. First count and ask for confirmation + (R28). From a script an ordinary run is analysed without a question, and a risky one is + refused. Writing needs a second confirmation on the full write plan, with the number typed + (R29). There is no implicit yes, ever (R30: terminal, dialog from the context menu, refusal in + scripts). +- How every file is written, and the only files ever replaced, is R31 in `docs/design.md`: read + it before touching any write path. File names are valid on Windows, macOS and Linux at once + (R32). Any change here needs the tests of R34. +- Accessibility is a requirement, not a polish step (EN 301 549; WCAG 2.2 AA for the report; + R35–R39). Never convey information by colour or symbols alone. Honour `NO_COLOR`, `--no-color` + and `--plain`. No spinners or rapid line rewriting, no time limits on prompts. Console text is + linear, with no box drawing. The HTML report is semantic, keyboard operable and + contrast-checked, and works without JavaScript. Every user-facing change keeps its tests + green. +- Uninstall is part of every install feature (R40–R43). Anything that adds something to the + system records it in the manifest and is removed by `signspector uninstall`. That command + removes only what we installed, never user data. +- Malformed input never panics: it becomes an error for that file. No `unwrap`, `expect` or + indexing on untrusted data outside tests (enforced by clippy lints in `Cargo.toml`). +- No PowerShell in anything the tool runs on Windows: company PCs force Constrained Language + Mode. +- Pure Rust dependencies, no OpenSSL (checked by `cargo deny`): one self-contained executable per platform. -## Building +## How do we build it? -Toolchain: rustup (pinned in `rust-toolchain.toml`) with targets for macOS arm64/x86_64, -Windows (mingw-w64, linker in `.cargo/config.toml`) and Linux musl (`cargo zigbuild`). -Commands in `docs/design.md`. Development happens on the user's Mac; Windows tests on real +The toolchain is rustup, pinned in `rust-toolchain.toml`. Targets: macOS arm64 and x86_64, +Windows (mingw-w64, linker in `.cargo/config.toml`) and Linux musl (`cargo zigbuild`). The +commands are in `docs/design.md`. Development happens on the user's Mac. Windows tests on real files happen on the Windows PC, where `tests/corpus/` lives. -## Test data +## Which test data may we use? -Real signed documents contain personal data: never commit them, never copy them to the Mac. -They stay on the Windows PC in `tests/corpus/` (git-ignored). Unit tests use synthetic -fixtures only (`tests/fixtures/`). +Real signed documents contain personal data. Never commit them, never copy them to the Mac. They +stay on the Windows PC in `tests/corpus/` (git-ignored). Unit tests use synthetic fixtures only +(`tests/fixtures/`). diff --git a/docs/design.md b/docs/design.md index 71920f4..c4766e8 100644 --- a/docs/design.md +++ b/docs/design.md @@ -197,9 +197,9 @@ script. R31 says how every file is created and which files may ever be replaced. (`| tee log`, `> file`) the run counts as a script. Yes/no questions default to No, and Enter alone cancels. A typed number confirms only if it is the right one. Any other answer (a wrong number, `y`, `n`, Enter alone) never confirms. This holds for the files to process - of a risky run (R28) and for the documents to write (R29). The owner decided both rules on - 2026-11-23. The answers and the default are written out in words in the user's language - (R35, R27). + of a risky run (R28) and for the documents to write (R29). The owner decided on 2026-11-23 + that only the right number confirms and that any other answer never confirms. The answers + and the default are written out in words in the user's language (R35, R27). - Context menu (no terminal, started with `--interactive`): the same confirmations, with the same number to type and the same default, in a native dialog (R38), with a shorter summary than the console. diff --git a/docs/roadmap.md b/docs/roadmap.md index e8eb76c..acb0c31 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -19,6 +19,9 @@ Two ideas set it: ## Phase 0: what must be in place before the code? +The repository, CI, the writing guide and the fixture generator, plus a list of the known gaps +in the script tests. + - [x] 0.1 First commit and push to `main`, after a review of the file list. From then on: one branch and one draft PR per step, a coherence audit every 5 commits, merges by local fast-forward (`CLAUDE.md`). @@ -42,10 +45,10 @@ Two ideas set it: - [ ] 0.3 Fixture generator `scripts/make-fixtures.sh` (Homebrew `openssl@3`): test CA, signers, simple `.p7m`/`.p7s`, `.tsd`. Synthetic identities only. Private keys are never committed: they are generated at test time or kept in `target/`. -- [ ] 0.4 Writing guide (`docs/writing.md`): texts answer the reader's questions, answer first, - in short sentences, with code and commands verbatim and without machine-made patterns (after - Wikipedia's "Signs of AI writing"). README, design, roadmap, `CLAUDE.md` and the agent prompts - are rewritten with it. Also in this step: +- [ ] 0.4 Writing guide (`docs/writing.md`). Texts answer the reader's questions, with the + answer first and short sentences. Code and commands stay verbatim. There are no machine-made + patterns (after Wikipedia's "Signs of AI writing"). Rewrite README, design, roadmap, + `CLAUDE.md` and the agent prompts with it. Also in this step: - a comment in `rust-toolchain.toml`: targets and R25, how to update the pinned version; - a "Rust" section in the session report (`scripts/audit-status.sh`) that names a newer stable Rust when one exists; @@ -116,8 +119,10 @@ Two ideas set it: ## Phase 1: how do we write files safely, before any cryptography? -- [x] 1.0 R1a, envelope names (`is_envelope`): delivered with the project setup (0.1). -- [ ] 1.1 R32, portable names (`names` module): +With pure functions for names and confirmation, and a writer that never overwrites. + +- [x] 1.0 Envelope names (`is_envelope`, R1a): delivered with the project setup (0.1). +- [ ] 1.1 Portable names (`names` module, R32): `portable_name(raw) -> PortableName { name, changed }`. - Tests, one per rule: forbidden characters, control characters, trailing dot and space, reserved Windows names (any case, with extension, superscript digits), leading `-` and `.`, @@ -146,7 +151,8 @@ Two ideas set it: - Tests from R34 "Counting": 10,000 against 10,001, also as a total over several folders; files not counted; a selected folder that is a symbolic link; overlaps. - Tests from R34 "Several folders": overlaps; a symbolic link to each kind of sensitive - folder. Also each kind of sensitive folder selected directly. + folder. + - Test for R28: each kind of sensitive folder selected directly. - [ ] 1.6 Confirmation logic (R28–R30). First decide the questions "Before 1.6" in `docs/design.md`. - Pure functions turn the counts, the folder, the way the run started (terminal, dialog via @@ -171,6 +177,8 @@ Two ideas set it: ## Phase 2: how do we open envelopes end to end? +With a BER reader, a CMS parser and one thin run of the whole flow. + - [ ] 2.1 `ber` reader: definite and indefinite lengths, limits on depth and size, checked arithmetic; fuzz target. - [ ] 2.2 `cms` SignedData parsing: encapsulated content, certificates, signer infos (no @@ -184,6 +192,8 @@ Two ideas set it: ## Phase 3: how do we verify signatures and time stamps? +One layer at a time: cryptography, certificates, trusted lists, chains, time stamps, revocation. + - [ ] 3.1 `crypto`: digests, RSA PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384/P-521 (R8). First decide the question "Before 3.1" in `docs/design.md`. - [ ] 3.2 `x509`: certificate fields, key usage, qualified/QSCD statements, validity (R9). First @@ -214,6 +224,8 @@ Two ideas set it: ## Phase 4: what does the user see? +A console summary, an accessible HTML report, JSON and a translated command line. + - [ ] 4.1 Console summary, colours with contrast, exit codes (R13, R35). - [ ] 4.2 Accessible HTML report, WCAG 2.2 AA (R14, R36), checker in CI (R39). First decide the questions "Before 4.2" in `docs/design.md`. @@ -224,6 +236,9 @@ Two ideas set it: ## Phase 5: how does it fit into the system? +Through a context menu with native dialogs, recorded in a manifest so that `uninstall` can +remove it. + - [ ] 5.1 Install manifest (R41). First decide how `create_new` applies to registry keys and `.workflow` folders, and the other questions "Before 5.1" in `docs/design.md`. - [ ] 5.2 Context menu per OS (R21, R38) with the confirmation dialogs (R30) and their R34 @@ -235,6 +250,8 @@ Two ideas set it: ## Phase 6: how do we release it? +As one self-contained executable per platform, tested on the company PC before `1.0.0`. + - [ ] 6.1 Builds for all targets; `.deb`, `.rpm`, `.tar.gz` (R24, R25); one self-contained executable per platform, pure Rust (R22, enforced by `cargo deny`); version tag (R26). - [ ] 6.2 Test on the company Windows PC (antivirus, SmartScreen, AppLocker) with the real diff --git a/docs/writing.md b/docs/writing.md index b67d47f..0b84f75 100644 --- a/docs/writing.md +++ b/docs/writing.md @@ -3,7 +3,7 @@ These rules apply to every text in this repository. That means docs, agent prompts, comments, commit messages, PR texts, the user guide and the strings the tool shows. Everything is in English; only the tool's interface (its strings and the user guide) is translated (see -"Language" in `CLAUDE.md`). +"Which rules hold everywhere?" in `CLAUDE.md`). ## Who reads our texts? diff --git a/scripts/audit-status.sh b/scripts/audit-status.sh index a9aec07..2a49ee2 100755 --- a/scripts/audit-status.sh +++ b/scripts/audit-status.sh @@ -6,8 +6,9 @@ # (pre-push with the pushed commit; CI with the PR head) # Every commit not reachable from the last audit counts, also those brought in by a merge. # Exit 2 when git cannot answer: never a silent pass. -# An audit is a non-merge commit that only adds files under docs/audits/ (see CLAUDE.md, "Coherence -# audits"); a commit mixing a report with other changes, or deleting one, does not count. +# An audit is a non-merge commit that only adds files under docs/audits/ (see CLAUDE.md, "How do +# we keep long work from drifting?"); a commit mixing a report with other changes, or deleting +# one, does not count. set -u AUDIT_EVERY=5 diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh index 572f245..76e7014 100755 --- a/scripts/cleanup.sh +++ b/scripts/cleanup.sh @@ -1,5 +1,6 @@ #!/bin/sh -# Removes local leftovers after a coherence audit (CLAUDE.md, "Coherence audits"). +# Removes local leftovers after a coherence audit (CLAUDE.md, "How do we keep long work from +# drifting?"). # scripts/cleanup.sh removes the local leftovers listed below and says what it removed # scripts/cleanup.sh --plan lists what it would remove and removes nothing (session report) # No question is asked: only unambiguous junk files and branches already merged into main From 79025cd842965fccc5aa9f1e50bd64bd91609e7c Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Tue, 24 Nov 2026 12:12:37 +0100 Subject: [PATCH 34/36] audit: 0010 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/audits/0010-2026-11-24.md | 203 +++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 docs/audits/0010-2026-11-24.md diff --git a/docs/audits/0010-2026-11-24.md b/docs/audits/0010-2026-11-24.md new file mode 100644 index 0000000..e7d9c49 --- /dev/null +++ b/docs/audits/0010-2026-11-24.md @@ -0,0 +1,203 @@ +# Coherence audit 0010 (2026-11-24) +Range: 98bc03c..f8c0ac2 (five commits on `step/0.4-writing-guide`, PR #3, draft; working tree clean) Verdict: DRIFT FOUND + +Auditor: `coherence-auditor` agent, fresh context, read-only, run because the cadence is due (5 commits since audit 0009). + +The drift is small and only in documents. No claim about code is false. The range rewrites `docs/roadmap.md` and `CLAUDE.md` to `docs/writing.md` and states the R30 rule on typed numbers. The two rewrites lost no step, requirement pointer, code span or negation (checked by comparison, see "Verified and found true"). Findings F1 to F3 of audit 0009 are closed. The head f8c0ac2 has no review yet, and the agent prompts are not rewritten yet (F1). One sentence about when the review happens does not match the practice on the PR (F2). + +## Unfinished work + +`sh scripts/audit-status.sh` (exit 0): + +``` +== Audit cadence +commits since last audit: 5 (audit every 5) +last audit: 98bc03c 2026-11-23 audit: 0009 +AUDIT DUE + +== Rust +pinned Rust 1.100.0 is the latest stable + +== Unfinished local work +working tree clean +branch step/0.4-writing-guide: 0 unpushed, 0 not pulled +local branches not merged into main: + step/0.4-writing-guide +remote branches not merged into main: + origin/step/0.4-writing-guide + +== Markers in code +none + +== Leftovers (scripts/cleanup.sh --plan; run scripts/cleanup.sh to remove the local ones) +keep local branch (not merged): step/0.4-writing-guide +on GitHub, merged (kept, nothing is deleted on GitHub): origin/step/0.2-ci +on GitHub, merged (kept, nothing is deleted on GitHub): origin/step/0.2.1-confirmation-rules +on GitHub, draft PR (not closed here): #3 updated 2026-11-24: Roadmap 0.4: writing guide +nothing to remove + +== GitHub +open pull requests: +#3 DRAFT step/0.4-writing-guide updated 2026-11-24: Roadmap 0.4: writing guide +last CI runs on main: +2026-11-23 completed/success: Guard the Windows skips; test the report with no red checks +2026-11-23 completed/success: CI +2026-11-22 completed/success: Remove --apply everywhere, close review and audit 0002 findings +``` + +- **Local work**: nothing uncommitted (`git status --porcelain` empty), no stashes, one worktree, nothing unpushed (`git rev-parse HEAD origin/step/0.4-writing-guide` give f8c0ac2 twice). +- **Cadence**: `sh scripts/audit-status.sh --gate-push HEAD` exits 0. `--gate-commit` exits 1 ("5 commits since the last coherence audit (limit 5)") until this report is committed alone. Audit 0009 was committed alone (`git show --stat 98bc03c`: one file, `docs/audits/0009-2026-11-23.md`). +- **PR #3** (draft, opened 2026-11-23 05:36 UTC, one day old, head f8c0ac2, 45 comments): + - What it is for: roadmap 0.4 (`docs/roadmap.md:48-69`): the writing guide, the rewrite of README, design, roadmap, `CLAUDE.md` and the agent prompts, the `rust-toolchain.toml` comment, the "Rust" section of the session report, and the owner's requirement decisions. + - Done in this range: + - 770559d, 9779353, 818ba2d: R30 says that only the right number confirms; R34 and roadmap 1.5, 1.6, 1.7 and 2.3 follow; + - f14f725: `docs/roadmap.md` rewritten to the guide; + - f8c0ac2: `CLAUDE.md` rewritten to the guide; the comments and pointers that named its old headings follow the new ones. + - Missing: + - a review verdict on the head f8c0ac2 (F1); + - the rewrite of the two agent prompts (`docs/roadmap.md:50-51`, F1); + - the `[x]` mark at `docs/roadmap.md:48`, correctly absent. + - State comment: present and true. The latest comment (2026-11-24 11:04 UTC) ends with "State: draft. This is the fifth commit since audit 0009. Next steps: coherence audit 0010 and a review by a new fable-reviewer agent on this commit, then the rewrite of the agent prompts." + - Still relevant: yes, it is the one open step. +- **CI job lists** (`gh run list --branch step/0.4-writing-guide`, `gh run view <id> --json jobs`, `gh pr checks 3`): + + | Commit | Run | Result | + |---|---|---| + | 98bc03c (audit 0009) | 45229043102 | success | + | 770559d | 45250339110 | cancelled | + | 9779353 | 45251015124 | cancelled | + | 818ba2d | 45251849479 | success | + | f14f725 | 45379762027 | success | + | f8c0ac2 (head) | 45380721870 | Repository rules, Linux musl, macOS arm64, Windows gnu: all four `success`, read in the job list | + + The two cancelled runs are not red: the next commit was pushed four and five minutes later and replaced each. The Windows job of the head was still running when the audit started and finished green at 11:09 UTC. GitGuardian passes. `main` is unchanged at 8561ec5, green. +- **Branches**: local `main` and the step branch; on GitHub `main`, `step/0.2-ci` and `step/0.2.1-confirmation-rules` (both merged, kept) and the step branch. Nothing stale. +- **Pull requests** (`gh pr list --state all`): #1 and #2 merged, #3 open as a draft. No other open PR. +- **Markers**: none. `grep -rnE 'TODO|FIXME|todo!|unimplemented!|#\[ignore' src scripts .githooks .github Cargo.toml` finds only the pattern itself at `scripts/audit-status.sh:126`. +- **Leftovers**: `sh scripts/cleanup.sh --plan` (exit 0) prints the four lines shown above and "nothing to remove". +- **Tracked files that belong to the work, not the product**: none. `git ls-files` shows 40 files; the only reports are the nine under `docs/audits/`. + +## Findings + +### F1. `unfinished`: the head is not reviewed, and the agent prompts are not rewritten +- `GH_PROMPT_DISABLED=1 gh pr view 3 --json comments </dev/null`: 45 comments. The verdicts of this range: + + | Reviewed commit | Verdict | Verdict comment (UTC) | Closing comment (UTC) | + |---|---|---|---| + | a3ad768 | CHANGES NEEDED | 11-23 17:28 | 19:34 | + | 770559d | CHANGES NEEDED | 19:37 | 19:38 | + | 9779353 | CHANGES NEEDED | 19:41 | 19:43 | + | 818ba2d | APPROVED | 19:46 | 11-24 10:58 (minor points) | + | f14f725 | APPROVED | 11-24 11:00 | 11:04 (minor points) | + | f8c0ac2 (head) | none | | | + +- PR #3 now holds its first two APPROVED verdicts, so 0009-F4 is half closed. No comment reviews f8c0ac2. That commit also closes the five minor points of the review of f14f725 and edits `docs/design.md:200-202`, `docs/roadmap.md`, three script or hook comments and the reviewer prompt. +- `docs/roadmap.md:50-51` asks to rewrite "the agent prompts" too. `git diff 98bc03c..HEAD -- .claude/agents` shows only three lines changed in `.claude/agents/fable-reviewer.md:54-56` (a heading name). The writing points of F4 on the prompts stay open. +- No rule is broken today: the latest comment announces both steps. `CLAUDE.md:63-65` asks for four green jobs and a posted approval before the PR is marked ready. +- Change: none to the files. The verdict on f8c0ac2 goes on the PR; the prompts are rewritten and reviewed; then the PR description is updated (F3). + +### F2. `drift` (minor): the docs say the review comes before the commit; on PR #3 it comes after the push +- `docs/roadmap.md:5-6`: "A new `fable-reviewer` agent reviews it, then it is committed." +- `.claude/agents/fable-reviewer.md:3`: "Use after each TDD cycle (red -> green -> refactor) and before every commit". +- On PR #3 every review of the range names a commit that was already pushed. Committer times (`TZ=UTC git log --format='%h %cd'`) against the verdict comments: + + | Commit | Committed (UTC) | CI run created | Verdict posted | + |---|---|---|---| + | 770559d | 11-23 19:34:13 | 19:34:27 | 19:37:01 | + | 9779353 | 19:38:05 | 19:38:20 | 19:41:19 | + | 818ba2d | 19:43:00 | 19:43:15 | 19:46:15 | + | f14f725 | 11-24 10:32:37 | 10:58:13 | 11:00:36 | + +- `CLAUDE.md:30-38` (step 5) does not say whether the review comes before or after the commit. It asks for the approval before the PR is marked ready (`CLAUDE.md:63-65`), which the practice respects. +- The sentence is old: `git show 98bc03c:docs/roadmap.md` has "reviewed by the `fable-reviewer` agent, then committed". The rewrite kept it. No earlier audit reports it (`grep -i 'before every commit' docs/audits/*`: no line). +- Change: the owner chooses. Either the two texts say "each commit is reviewed after the push, before the PR is marked ready", or the practice changes. +- A note on what an audit can check: three of the four verdicts were posted about three minutes after the commit, and each lists nextest, clippy, fmt and the public check as run. The files and the PR show the verdicts, not how the reviewer was started. That each review was "a new fable-reviewer agent" rests on the comments alone. + +### F3. `minor`: the PR #3 description is behind the branch +- The section "Done so far" of the description (`gh pr view 3 --json body`) lists the guide, the README and the design rewrite. It does not name the rewrite of `docs/roadmap.md` (f14f725) or of `CLAUDE.md` (f8c0ac2), nor the R30 decision of 770559d. +- It still says "owner's decisions on requirements (what `check` writes, risky folders, ...)". R28 says "risky" never describes a folder (`docs/design.md:183-184`); `docs/roadmap.md:58` says "risky runs". Carried over from 0009-F6. +- The description ends with "Draft. The current state and the next step are in the latest comment", which is true. +- Change: update the description before the PR is marked ready. + +### F4. `minor`: texts that break `docs/writing.md` +New or changed in the range: +- `docs/design.md:268-273` (R34 "Writing and undo"): one sentence of about 77 words, edited in 9779353, 818ba2d and f14f725. +- `docs/roadmap.md:165-167` (1.6, tests from "Counting"): one sentence of about 43 words. `docs/roadmap.md:127-130` (1.1) and `218-221` (3.9): lists of 47 and 48 words in one sentence. `docs/roadmap.md:108-111` (0.5): 57 words. +- `CLAUDE.md:32`: "never give it my conclusions". `docs/writing.md:68` says "We use 'we' for the project". The sentence was "my" before the rewrite too. +- The commit message of f8c0ac2 says "Steps 1.0 and 1.1 put the requirement number at the end". `docs/roadmap.md:124-125` put it at the end of the title, in brackets, before the colon. The meaning is clear; the wording is loose. + +Carried over from 0009-F6, unchanged: +- `docs/design.md:6`: "in the requirement named in brackets". +- Bold labels at the start of sub-items (`docs/design.md:101,113,118`) and bold inside running text (`181-182`, `430`, `473`). +- Headings that are not questions: the fifteen `### Before x.y (...)` headings (`docs/design.md:559-689`) and "(proposal)" at `498`. `docs/writing.md:82-84` does not list them among the fixed formats. +- `docs/design.md:310-313` ("Several folders", 58 words) and `318-322` ("Dialogs", 75 words): single sentences. +- The agent prompts, not rewritten yet (F1): `.claude/agents/fable-reviewer.md:10` (134 characters), item 3 at `28-44` (a sentence of about 177 words), `.claude/agents/coherence-auditor.md:22` (142 characters). Line 3 of each prompt is front matter. + +Closed from 0009-F6: `CLAUDE.md` has no line over 100 characters, no bold and no long bullet; all its headings below the title are questions. `docs/roadmap.md` has no bold, question headings with an answer under each, and step 1.6 is split into items (`docs/roadmap.md:156-170`). The blank-line faults around "Phase 1" and between 0.3 and 0.4 are gone. No em dash or curly quote in `README.md`, `CLAUDE.md`, `docs/design.md`, `docs/roadmap.md`, `docs/writing.md` or the prompts (scan for U+2014, U+2018, U+2019, U+201C, U+201D: no line). + +### F5. `drift` (minor): some R34 items are named by no roadmap step +- `grep -n -o -E 'R34 "[^"]+"|R34 items [^.]*' docs/roadmap.md` finds pointers at lines 151, 153, 163, 164, 165, 168, 189 and 190 only. They cover "Counting", "Several folders", "Risky run at the terminal", "Yes/no questions", "Scripts" and, from "Writing and undo", the answers at the count and the `undo` cases. Step 5.2 names the dialogs' "R34 tests" (`docs/roadmap.md:244-245`); step 1.7 names the snapshot helper (`176`). +- No step names these items of R34 (`docs/design.md:268-315`): "`--plan`" (`281-282`), "What `check` writes" (`283-285`), "Extraction reports" (`286-292`), "Cache and manifest" (`293-299`), "Menu items" (`300-302`), "Time" (`314-315`), and from "Writing and undo" the cases "a file appearing between plan and write", "a symbolic link pointing outside" and "disk full" (`270-272`). +- The commit 818ba2d claims only that every case of "Counting" and "Several folders" has a step. That claim is true (checked case by case against `docs/roadmap.md:151-155,165-169,189` and 5.2). So this is not a false claim. After the range, the roadmap names R34 items for steps 1.5, 1.6 and 2.3 and not for the others, and a reader cannot tell whether the rest is planned. +- Also: `docs/roadmap.md:155` plans a "Test for R28: each kind of sensitive folder selected directly". R34 lists only the symbolic-link variant (`docs/design.md:312-313`), while `CLAUDE.md:176` says "Any change here needs the tests of R34". +- Change: when the steps 1.7, 2.3, 3.5, 3.7, 4.4 and 5.1 are next edited, name the R34 item each one tests. The owner decides whether the direct-selection test also goes into R34. + +### F6. `minor`: carried over +- From 0007-F8: `README.md:165` ("License") is a heading that is not a question and not a listed fixed format. +- From 0001-F12: `Cargo.toml:19-21` declares `assert_cmd` 2.2.2 and `predicates` 3.1.4; `tests/` holds only `fixtures/`, no `tests/*.rs`. +- From 0003-F6: no test fixes the choice that a branch just created at `main` is removed by `cleanup.sh`. + +### Follow-up of audit 0009 +- F1 (the rule on a wrong number stood only in an open question): closed. R30 states it at `docs/design.md:198-201`, with the owner's decision. The question "Before 1.6" keeps only what is open (`573-576`). +- F2 (roadmap 1.6 planned a test the design still asked about): closed. R34 has "Risky run at the terminal" (`docs/design.md:274-275`); roadmap 1.6 points to it (`docs/roadmap.md:163`); the question is gone. +- F3 (two-step replace named by no step): closed. `docs/roadmap.md:173`: "The two-step replace of cache files and the manifest: a temporary file, then a rename." +- F4 (no approval): partly closed, see F1. +- F5 (wrong statements in older commit messages): no change needed. +- F6 (writing): partly closed, see F4. +- F7: the "Rust" section line is closed (`docs/roadmap.md:53-54` names the section as the script prints it); the rest is in F6. + +### Verified and found true +- **The roadmap rewrite lost nothing** (f14f725, f8c0ac2 against 818ba2d). A script compared the two versions: + - the same 37 steps with the same marks; + - no requirement pointer lost (gained: R28 once, R34 five times); + - no code span lost except `design.md`, which became `docs/design.md`; + - "not" 10, "only" 9, "except" 1 before and after; "never" 5, then 6 at f8c0ac2. + The message of f14f725 says these counts are the same, which holds at f14f725. No line of `docs/roadmap.md` is longer than 96 columns, and no code span crosses a line. +- **The `CLAUDE.md` rewrite lost nothing** (f8c0ac2 against f14f725): the set of code spans is identical (`diff` of the sorted spans: no line); no requirement pointer lost; "not" 11 to 12, "never" 14 to 17, "only" 14 to 14. The one "except" became "The one exception is" (`CLAUDE.md:156`), as the message says. The GitHub settings, the cleanup rules, the review rules and the hook list read the same as before. +- **Old heading names are gone.** `git grep -n -e 'Coherence audits' -e 'Conventions' -e 'Way of working' -e '"Public repository'` outside `docs/audits/` finds nothing. The new pointers name headings that exist: + - "How do we keep long work from drifting?" (`CLAUDE.md:54`), named at `.githooks/pre-commit:10`, `scripts/audit-status.sh:9-10`, `scripts/cleanup.sh:2-3`; + - "What may never reach the public repository?" (`CLAUDE.md:98`), named at `.claude/agents/fable-reviewer.md:54-55`; + - "Which rules hold everywhere?" (`CLAUDE.md:140`), named at `docs/writing.md:6`. +- **Scripts and hook changed in comments only.** `git diff 98bc03c..HEAD -- scripts .githooks` shows three comment blocks and no other line. The script, cleanup and hook tests pass with the numbers the PR comment gives (178, 79, 24). +- **R30, R34 and the roadmap agree on answers.** R30: only the right number confirms; a wrong number, `y`, `n` and Enter alone never do (`docs/design.md:198-201`). R34: "Writing and undo" (`268-270`), "Risky run at the terminal" (`274-275`), "Extraction reports" (`287`), "Yes/no questions" (`316-317`), "Dialogs" (`318-320`). Roadmap 0.4 lists the decision (`docs/roadmap.md:61`); 1.6 tests it (`163-164`); 2.3 tests the `undo` answers (`190-191`). `CLAUDE.md:159-163,169-173` and `README.md:47-68,126-134` say the same. +- **Open questions and the roadmap point to each other.** The fifteen headings of "What is still open?" (1.4, 1.5, 1.6, 1.7, 3.1, 3.2, 3.5, 3.6, 3.7, 3.9, 4.2, 4.4, 5.1, 5.2, 5.3) match the list at `docs/roadmap.md:68-69`. Each of those steps names its section (`docs/roadmap.md:140,141,156,171,198,200,206,208,210,215,231,235,243,246,249`), with "question" or "questions" matching the number of items. +- **Commit messages in the range**: every change they name exists in the diff of that commit, apart from the loose wording noted in F4. The cross-references hold: "audit 0005-F3, 0009-F7" (this folder), "review of 818ba2d, m1" to "m5" (PR comment of 19:46 UTC), "findings F1 to F3 of audit 0009". +- **Verdict comments**: PR #3 carries a verdict for every reviewed commit of the range except the head (F1), each followed by how it was closed. `sh scripts/check-public.sh --message <file>` exits 0 on the PR description and on each of the ten comments of the range; none holds a local path or an address. PR #2: verdict comments present. PR #1: none (0003-F5, predates the rule). +- **Roadmap marks**: 0.1, 0.2, 0.2.1 and 1.0 hold; nothing was marked in the range. `is_envelope` is at `src/lib.rs:10` with six test functions (one for Windows only, one for Unix only), none ignored. `src/` did not change. There is no other module or public function, so no scope drift in code. +- **Requirement numbering**: the labels R1a to R49 are unchanged in the range; no requirement was added or removed. +- **Safety, accessibility, uninstall (R28–R43)**: still no code; nothing is claimed done; the placeholder in `src/main.rs` is the recorded exception (`docs/design.md:551-552`). +- **Language rule**: all text added in the range is English. +- **Public-repository rule**: `sh scripts/check-public.sh --range tip HEAD` exits 0; the five commits have no-reply author and committer addresses (`git log --format='%ae %ce'`). `tests/corpus/` was not read. +- **Not re-checked**: the GitHub settings (branch protection, actions allowlist, secret scanning, interaction limit); the workflow against roadmap 0.2 (`.github/workflows/ci.yml` unchanged in the range); the LOTL numbers at `docs/design.md:340`; the crates named as candidates in the architecture table; the laws and standards cited at `docs/design.md:410-417` (text unchanged in the range). + +## Health + +Run on macOS arm64 at f8c0ac2, working tree clean. Script tests ran on a scratch copy (`git archive HEAD`) with failing `gh` and `rustup` stubs first in `PATH`. + +| Command | Result | +|---|---| +| `cargo fmt --check` | clean (exit 0) | +| `cargo clippy --all-targets -- -D warnings` | no issues (exit 0) | +| `cargo nextest run` | 5 passed (2 binaries), exit 0 | +| `cargo test --doc` | 0 doctests (none exist), exit 0 | +| `cargo deny check` | `advisories ok, bans ok, licenses ok, sources ok` (exit 0); warnings for allowed licences not used yet (for example `Zlib`, `deny.toml:22`) | +| `sh scripts/test-scripts.sh` | 178 passed, 0 failed | +| `sh scripts/test-cleanup.sh` | 79 passed, 0 failed, 0 skipped | +| `sh scripts/test-hooks.sh` | 24 passed, 0 failed | +| `sh scripts/check-public.sh --range tip HEAD` | exit 0 ("0 commits and the tree of f8c0ac2 scanned") | +| `sh scripts/audit-status.sh --gate-push HEAD` | exit 0 | +| `sh scripts/audit-status.sh --gate-commit` | exit 1: "5 commits since the last coherence audit (limit 5)" | +| CI on f8c0ac2 (PR #3) | all four jobs green (run 45380721870) | +| CI on `main` (8561ec5) | green, unchanged | + +The repository was not modified by the audit: `git status --porcelain` is empty before and after, no stash, HEAD still f8c0ac2. `cleanup.sh` was run with `--plan` only. Nothing was posted or changed on GitHub. From 5244cbe9300784aa5c1bd811651c588b9950f75b Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Tue, 24 Nov 2026 17:35:15 +0100 Subject: [PATCH 35/36] Close the review of f8c0ac2 and audit 0010; rewrite the agent prompts Owner's decisions of 2026-11-24, applied here: - R34 "Several folders" also tests each kind of sensitive folder selected directly, not only through a symbolic link. - The roadmap no longer maps R34 cases to steps. One rule instead: each step writes the R34 tests for what it introduces; R34 is the only list; before 1.0.0 every case of R34 has a test. - Commit and push only when the checks are complete. The review of the uncommitted changes must be APPROVED. A due audit runs first, and each of its findings is closed. - A finding is closed in one of three ways: fixed and reviewed, written into a roadmap step, or declared wrong by the owner. - The audit report is committed alone, without a fable-reviewer review. It is pushed with the commit that closes its findings. - After each commit, a PR comment names the commit that holds the approved changes. - Reviews and audits run on a different model of equal or higher capability than the author's. - The reviewer's brief holds only: the scope and where the requirements are; the planned commit message, checked as a claim; the red and green runs when no PR exists; the owner's decisions, quoted. - Minor rounds have a limit. After the third round that is APPROVED with only minor points, the minor points left move to the next PR. Its first commit fixes them or writes them into the roadmap. Bugs, missing tests and points on personal data, confirmation or writing files never move. Review of f8c0ac2, closed here: - CLAUDE.md sections open with their answer, such as "With the six rules below." and "These rules hold in every change." - "Any change here" now names what needs the R34 tests: counting, confirmation, write paths, file names and anything else R34 covers. - The cleanup and merge sentences in CLAUDE.md are reworded. - Roadmap 0.4 says "Texts use no machine-made patterns". Audit 0010 findings: - F1: both agent prompts are rewritten to docs/writing.md. - F2: closed by the owner's decision on review timing (above). - F3: the PR description is updated; it is not part of this commit. - F4: bold in running text is gone from the design. "(proposal)" is out of a design heading, and "my conclusions" is gone from CLAUDE.md. The "Before" headings are a fixed format in docs/writing.md. - F5: one rule for the R34 tests (above). - F6: the README heading is a question; assert_cmd and predicates go to roadmap 2.3; the missing cleanup test (audit 0003, F6) goes to the gaps in 0.5. Also: - The reviewer reads every new file in full, also inside new folders. It checks that the identities in fixtures are fake, and never reads a real or extracted document. It runs the public check on a staged copy. - The auditor checks that every commit after 79025cd follows an APPROVED verdict. The one exception is a commit that adds only one audit report. It also checks that every finding is closed, and that the first commit of a PR handles the minor points moved to it. - The lists the audit and the reviews named become sub-lists. - Roadmap 0.5 records that nothing ties an APPROVED verdict to the content of the commit, with a proposal for the owner to decide. - The design's "What is still open?" says that decisions taken after 2026-11-23 are listed in roadmap step 0.4 with their date. Correction to f8c0ac2 (owner's decision): its message says "Steps 1.0 and 1.1 put the requirement number at the end". The number is at the end of the step title, in brackets, before the colon. History is not rewritten. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- .claude/agents/coherence-auditor.md | 104 +++++++++------- .claude/agents/fable-reviewer.md | 181 ++++++++++++++++++---------- CLAUDE.md | 89 +++++++++----- README.md | 2 +- docs/design.md | 83 +++++++------ docs/roadmap.md | 102 +++++++++------- docs/writing.md | 10 +- 7 files changed, 353 insertions(+), 218 deletions(-) diff --git a/.claude/agents/coherence-auditor.md b/.claude/agents/coherence-auditor.md index dfce678..411702d 100644 --- a/.claude/agents/coherence-auditor.md +++ b/.claude/agents/coherence-auditor.md @@ -1,53 +1,76 @@ --- name: coherence-auditor -description: Periodic coherence audit on a different model (Fable), every 5 commits and whenever unfinished work is suspected. Checks that requirements, roadmap, docs, code, tests and the GitHub state agree, to catch drift, hallucinated facts and interrupted or abandoned work. Read-only: returns a report to be saved in docs/audits/. +description: Periodic coherence audit on a different model (Fable), of equal or higher capability than the author's, every 5 commits and whenever unfinished work is suspected. Checks that requirements, roadmap, docs, code, tests and the GitHub state agree, to catch drift, hallucinated facts and interrupted or abandoned work. Read-only: returns a report to be saved in docs/audits/. model: fable tools: Read, Grep, Glob, Bash --- -You audit the coherence of SignSpector, a Rust command-line tool (see `CLAUDE.md`). The code -and docs were written by another model across many sessions. Your job is to find where they -have drifted apart or where something was asserted that is not true. You start with no -context on purpose: believe only what you can verify in files or command output. +You audit the coherence of SignSpector, a Rust command-line tool (see `CLAUDE.md`). Another +model wrote the code and docs across many sessions. Your job is to find where they have drifted +apart, or where something was asserted that is not true. You start with no context on purpose: +believe only what you can verify in files or command output. Read first: `CLAUDE.md`, `docs/design.md`, `docs/roadmap.md`, the latest report in `docs/audits/` (if any) and `git log` since that report. -## Checks +## What do you check? -1. **Unfinished work.** Run `sh scripts/audit-status.sh`. Report uncommitted changes, stashes, - unpushed commits, unmerged or stale branches, open and draft pull requests (with their - age), red or missing CI runs, `TODO`/`FIXME`/`todo!`/`unimplemented!`/`#[ignore]`. For each - draft or open PR: what it was for, what is missing, whether it is still relevant. -2. **Leftovers.** Run `sh scripts/cleanup.sh --plan` (lists only; without `--plan` the script removes) and report what it lists. Also look for - tracked files that belong to the work rather than the product: PR texts, notes, review or - audit drafts outside `docs/audits/`, scratch files, generated output. Say which should be - removed (locally, by the developer; nothing is ever deleted on GitHub). -3. **Requirements <-> tests <-> code.** For every requirement or roadmap step marked done: - tests exist, are not ignored, actually check the requirement, and pass. For every module - and public function: which requirement it serves. Code or options with no requirement are - scope drift; requirements claimed done with no code are false claims. -4. **Hallucination check.** Every concrete reference in docs, comments, commit messages and - agent prompts must exist: files, functions, types, modules, command-line options, crate - names and versions (in `Cargo.toml`/`Cargo.lock`), scripts, hook behaviour, standards - and laws cited. Verify each one; list those that do not exist or say something different. -5. **Docs agree with each other.** `CLAUDE.md`, `design.md`, `roadmap.md`, the agent prompts, - hooks and scripts must not contradict each other (numbering of requirements, rules, - commands, paths). Note anything outdated. Report texts that break `docs/writing.md`, with - `file:line`. -6. **Project rules.** Safety rules (R28–R34, dialog helpers in R38), accessibility (R35–R39), - uninstall (R40–R43), language rules (English in the repository, translated user interface), - public-repository rules (`sh scripts/check-public.sh --range tip HEAD`). Check that every pull - request carries the reviewer's verdict as a comment: - `GH_PROMPT_DISABLED=1 gh pr view <n> --comments </dev/null`. -7. **Health.** `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, - `cargo nextest run`, `cargo test --doc`, `cargo deny check`; report the actual results. +1. Unfinished work. Run `sh scripts/audit-status.sh`. Report: + - uncommitted changes, stashes and unpushed commits; + - unmerged or stale branches; + - open and draft pull requests, with their age; + - red or missing CI runs; + - `TODO`, `FIXME`, `todo!`, `unimplemented!` or `#[ignore]` markers. -Prepend `/opt/homebrew/opt/rustup/bin:/opt/homebrew/bin` to PATH if `cargo` is missing. -Throw-away probes only in `/tmp` or the scratchpad; never modify the repository; never read + For each draft or open PR, say what it was for, what is missing and whether it is + still relevant. +2. Leftovers. Run `sh scripts/cleanup.sh --plan` and report what it lists (`--plan` only lists; + without it the script removes). Also look for tracked files that belong to the work rather + than the product: PR texts, notes, review or audit drafts outside `docs/audits/`, scratch + files, generated output. Say which should be removed: locally, by the developer. Nothing is + ever deleted on GitHub. +3. Requirements against tests against code. For every requirement or roadmap step marked done, + tests exist, are not ignored, actually check the requirement, and pass. For every module and + public function, name the requirement it serves. Code or options with no requirement are + scope drift. Requirements claimed done with no code are false claims. +4. Every concrete reference exists. Docs, comments, commit messages and agent prompts name + files, functions, types, modules, command-line options, crate names and versions (in + `Cargo.toml` and `Cargo.lock`), scripts, hook behaviour, standards and laws. Verify each one. + List those that do not exist or say something different. +5. The docs agree with each other. `CLAUDE.md`, `docs/design.md`, `docs/roadmap.md`, the agent + prompts, the hooks and the scripts must not contradict each other: numbering of requirements, + rules, commands, paths. Note anything outdated. Report texts that break `docs/writing.md`, + with `file:line`. +6. The project rules hold: + - safety rules: R28–R34, and the dialog helpers in R38; + - accessibility: R35–R39; + - uninstall: R40–R43; + - language rules: English in the repository, a translated user interface; + - public-repository rules: `sh scripts/check-public.sh --range tip HEAD`. + + Read the pull request comments with + `GH_PROMPT_DISABLED=1 gh pr view <n> --comments </dev/null`, and check: + - every pull request carries the reviewer's verdicts as comments; + - every commit after 79025cd (audit 0010) follows an APPROVED verdict that a comment ties to + it. Earlier commits predate the rule. The one exception is an audit report: a commit that + adds only one file under `docs/audits/` (check with `git show --stat`); + - every finding of the previous audit and of the reviews is closed in one of three ways: + - fixed and reviewed; + - written into the roadmap step that will fix it; + - declared wrong by the owner, with the reason in a PR comment; + - every minor point a verdict comment lists as moved to the next PR is fixed, or written into + a roadmap step, by the first commit of that PR. +7. Health. Run `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, + `cargo nextest run`, `cargo test --doc` and `cargo deny check`. Report the actual results. + +Prepend `/opt/homebrew/opt/rustup/bin:/opt/homebrew/bin` to PATH if `cargo` is missing. Write +throw-away probes only in `/tmp` or the scratchpad. Never modify the repository; never read `tests/corpus/`. -## Report (English, Markdown, ready to be saved as `docs/audits/NNNN-YYYY-MM-DD.md`) +## What does the report look like? + +It is in English and Markdown, ready to be saved as `docs/audits/NNNN-YYYY-MM-DD.md`, with this +skeleton: ``` # Coherence audit NNNN (YYYY-MM-DD) @@ -57,9 +80,8 @@ Range: <first>..<last commit> Verdict: COHERENT | DRIFT FOUND ## Health ``` -Every finding must carry its evidence: `file:line`, or the command and its output. A finding +Every finding carries its evidence: `file:line`, or the command and its output. A finding without evidence is not reported. Classify each as `false claim`, `drift`, `contradiction`, -`unfinished`, `rule broken` or `minor`, and say what should change (code, test or doc) without -deciding requirements: when docs and code disagree on what the tool should do, say so and -leave the choice to the user. The report is public: no personal data, no local paths with -user names. +`unfinished`, `rule broken` or `minor`. Say what should change: code, test or doc. Do not decide +requirements. When docs and code disagree on what the tool should do, say so and leave the +choice to the user. The report is public: no personal data, no local paths with user names. diff --git a/.claude/agents/fable-reviewer.md b/.claude/agents/fable-reviewer.md index 9683cf8..36d417c 100644 --- a/.claude/agents/fable-reviewer.md +++ b/.claude/agents/fable-reviewer.md @@ -1,78 +1,129 @@ --- name: fable-reviewer -description: Independent reviewer on a different model (Fable). Use after each TDD cycle (red -> green -> refactor) and before every commit, to certify that the tests express the requirements in docs/design.md and that the code is correct. Read-only: it reports, it never edits. +description: Independent reviewer on a different model (Fable), of equal or higher capability than the author's. Use after each TDD cycle (red -> green -> refactor), on the uncommitted changes before every commit (the audit report is the one exception), and again after every fix, to certify that the tests express the requirements in docs/design.md and that the code is correct. Read-only: it reports, it never edits. model: fable tools: Read, Grep, Glob, Bash --- -You are the independent reviewer of SignSpector, a Rust command-line tool that finds signed and -time-stamped files (.p7m, .p7s, .tsd, .m7m) under a folder, verifies signatures and time stamps -against the European trusted lists (the countries of the certifiers found), writes an HTML report and, on request, extracts the signed -documents. The code was written by a different model; your value is an opinion that is not -anchored on its reasoning. Do not trust comments, commit messages or the brief you were given: -check the code and the tests yourself. +You are the independent reviewer of SignSpector. SignSpector is a Rust command-line tool. It +finds signed and time-stamped files (.p7m, .p7s, .tsd, .m7m) under a folder and verifies +signatures and time stamps against the European trusted lists (the countries of the certifiers +found). It writes an HTML report and, on request, extracts the signed documents. + +A different model wrote the code. Your value is an opinion that is not anchored on its +reasoning. Do not trust comments, commit messages or the brief you were given: check the code +and the tests yourself. Read first: `CLAUDE.md` and `docs/design.md` (requirements and safety rules). -## What to check - -1. **Tests first, and meaningful.** For each requirement touched by the change, is there a test - that would fail if the requirement were broken? Flag tautological tests, tests that only - repeat the implementation, missing edge cases (empty input, truncated or malformed BER, - huge lengths, wrong case, non-UTF-8 paths, Windows paths) and missing negative cases - (tampered content, wrong signature, expired or untrusted certificate). -2. **Correctness.** Logic errors, off-by-one, integer overflow on lengths read from input, - wrong cryptographic checks (digest compared to the wrong bytes, signed attributes not - re-encoded as SET, signature algorithm not matched to the key, time checked against the wrong - reference), anything that could report a forged or invalid file as valid. -3. **Safety rules.** Originals are never written, moved or renamed; `check` writes no document, only - the report (HTML and JSON) and the tool's cache (R16); documents need an extraction confirmed by - the typed number (`extract`, or the interactive end of run, R20, R29); existing files are never - overwritten, not even a report; no panic on malformed input (no `unwrap`/`expect`/indexing on - untrusted data outside tests); no PowerShell; no OpenSSL or C dependencies. Confirmation and - write safety (R28–R34 and the dialog helper rules of R38 in `docs/design.md`) is a fixed point of - every review: look for any path that processes without the first confirmation, writes a document - without a `ConfirmedPlan`, breaks any part of R31 (a file opened without `create_new`, a file - replaced in place, a file replaced other than a cache file or the manifest, a symbolic link - followed, a non-regular file replaced), can write a document outside the selected folder, lets - `--plan` write or download anything, treats a non-terminal input as a yes, confirms anything from - a script (only `check` in an ordinary run, `check --plan`, `extract --plan` in an ordinary run, - and the `--plan` lists of `undo`, the menus and `uninstall` run there), judges time from the - signer's claimed signing time, skips the native dialog of a context-menu run, counts several - selected folders wrongly (a row each, the total typed, overlaps counted once), or produces a file - name that is invalid on another OS (Windows reserved names and characters, trailing dot/space, - NFC/NFD or case collisions, over-long names). -4. **Language**: code, comments, docs and developer messages in English. User-facing texts of - the tool go through the translation layer (R27 in `docs/design.md`), never hard-coded, and - every new text has its Italian translation. Every changed text (docs, comments, commit - messages, PR text, prompts, tool strings) follows `docs/writing.md`: report the patterns it - lists, with `file:line`. -5. **Accessibility and uninstall** (R35–R43): no information by colour or symbols alone, - `NO_COLOR`/`--plain` honoured, no prompt time limits, semantic and keyboard-operable HTML - with sufficient contrast; anything installed is recorded for `uninstall`, which removes - only what SignSpector installed and never user data. -6. **Public repository**: nothing that could carry personal or sensitive data (see the section - "What may never reach the public repository?" of `CLAUDE.md`); run - `sh scripts/check-public.sh --staged` when changes are staged. - -## Proof of TDD - -The PR description must quote the red run (the failing tests before the change) and the green -one. Missing proof is a finding. For code that protects (scripts under `scripts/`, safety -code), break each rule on a copy (outside the repository) and check that a test fails; report -every rule whose breakage no test notices. - -## How to work - -- Run: `cargo nextest run`, `cargo clippy --all-targets -- -D warnings`, `cargo fmt --check`. +## What do you review? + +The uncommitted changes in the working tree, before they are committed: + +- `git status --short --untracked-files=all` lists every changed and new file, also inside new + folders; +- `git diff HEAD` shows the changes to tracked files; +- you read every new file in full, except real documents: + - files under `tests/fixtures/` are synthetic: read them, and check that every identity in + them is obviously fake; + - never read anything under `tests/corpus/`; + - never read a signed document, or a document extracted from one, anywhere else: report it + unread, as a finding. + +After CHANGES NEEDED, the author fixes the findings and a new reviewer reviews the fixed changes. +A commit follows only an APPROVED verdict (`CLAUDE.md`). + +The brief holds: + +- the scope and where the requirements are; +- the planned commit message; +- the red and green runs, when no PR exists yet; +- any owner's decision the changes apply, quoted. + +## What do you check? + +1. Tests come first and mean something. For each requirement touched by the change, is there a + test that would fail if the requirement were broken? Flag tautological tests and tests that + only repeat the implementation. Flag missing edge cases: empty input, truncated or malformed + BER, huge lengths, wrong case, non-UTF-8 paths, Windows paths. Flag missing negative cases: + tampered content, wrong signature, expired or untrusted certificate. +2. The code is correct. Look for logic errors, off-by-one, and integer overflow on lengths read + from input. Look for wrong cryptographic checks: + - a digest compared to the wrong bytes; + - signed attributes not re-encoded as SET; + - a signature algorithm not matched to the key; + - time checked against the wrong reference. + + Flag anything that could report a forged or invalid file as valid. +3. The safety rules hold. + - Originals are never written, moved or renamed. + - `check` writes no document, only the report (HTML and JSON) and the tool's cache (R16). + Documents need an extraction confirmed by the typed number (`extract`, or the interactive + end of run, R20, R29). + - Existing files are never overwritten, not even a report. + - Malformed input never panics: no `unwrap`, `expect` or indexing on untrusted data outside + tests. + - No PowerShell; no OpenSSL or C dependencies. + - Confirmation and write safety (R28–R34 and the dialog helper rules of R38 in + `docs/design.md`) is a fixed point of every review. Look for any path that: + - processes without the first confirmation; + - writes a document without a `ConfirmedPlan`; + - breaks any part of R31: + - a file opened without `create_new`; + - a file replaced in place; + - a file replaced other than a cache file or the manifest; + - a symbolic link followed; + - a non-regular file replaced; + - can write a document outside the selected folder; + - lets `--plan` write or download anything; + - treats a non-terminal input as a yes; + - confirms anything from a script (only `check` in an ordinary run, `check --plan`, + `extract --plan` in an ordinary run, and the `--plan` lists of `undo`, the menus and + `uninstall` run there); + - judges time from the signer's claimed signing time; + - skips the native dialog of a context-menu run; + - counts several selected folders wrongly (a row each, the total typed, overlaps counted + once); + - produces a file name that is invalid on another OS: Windows reserved names and + characters, trailing dot or space, NFC/NFD or case collisions, over-long names. + - The step writes the R34 tests for the commands and modules it introduces, as soon as they + can be tested. +4. The language rules hold. Code, comments, docs and developer messages are in English. + User-facing texts of the tool go through the translation layer (R27 in `docs/design.md`), + never hard-coded, and every new text has its Italian translation. Every changed text (docs, + comments, PR text, prompts, tool strings) follows `docs/writing.md`: report the patterns it + lists, with `file:line`. Check the planned commit message from the brief too, including every + claim it makes about the changes; a missing message is a finding. +5. Accessibility and uninstall hold (R35–R43). No information by colour or symbols alone. + `NO_COLOR` and `--plain` are honoured. Prompts have no time limit. The HTML is semantic, + keyboard operable and has sufficient contrast. Anything installed is recorded for + `uninstall`, which removes only what SignSpector installed and never user data. +6. Nothing reaches the public repository that could carry personal or sensitive data (see the + section "What may never reach the public repository?" of `CLAUDE.md`). No mode of the public + check reads the working tree: `--staged` reads the index, and you must not touch the + repository's index. Copy the repository to the scratchpad (without `target/`, `tests/corpus/` + and `tests/out/`), run `git add -A` in the copy, then `sh scripts/check-public.sh --staged` + there. Check the planned commit message with `sh scripts/check-public.sh --message <file>`. + +## How is TDD proved? + +The PR description quotes the red run (the failing tests before the change) and the green one. +Missing proof is a finding. When no PR exists yet, look for the red and green runs in the brief. +If the brief does not hold them, report them missing. For code that protects (scripts under +`scripts/`, safety code), break each rule on a copy outside the repository and check that a test +fails. Report every rule whose breakage no test notices. + +## How do you work? + +- Run `cargo nextest run`, `cargo clippy --all-targets -- -D warnings` and `cargo fmt --check`. Report the actual results. -- If useful, write throw-away probes (extra tests, sample inputs) only under the scratchpad or - `/tmp`, never in the repository. You must not modify any file in the repository. +- Write throw-away probes (extra tests, sample inputs) only under the scratchpad or `/tmp`, + never in the repository. You must not modify any file in the repository. - Never read or copy anything from `tests/corpus/` (real documents with personal data). -## Report +## What does the report look like? -Start with one line: `VERDICT: APPROVED` or `VERDICT: CHANGES NEEDED`. -Then the findings, most severe first, each with `file:line`, what is wrong, a concrete input or -scenario that shows it, and the suggested fix. Separate "bug" from "missing test" from "minor". -No praise, no summary of what the code does. Write the report in English. +Start with one line: `VERDICT: APPROVED` or `VERDICT: CHANGES NEEDED`. Then list the findings, +most severe first. Each has `file:line`, what is wrong, a concrete input or scenario that shows +it, and the suggested fix. Separate "bug" from "missing test" from "minor". No praise, no +summary of what the code does. Write the report in English. diff --git a/CLAUDE.md b/CLAUDE.md index 433c429..b865051 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -27,16 +27,42 @@ the CI workflow. There is no exception for "infrastructure". rule on a copy and seeing at least one test fail. A rule that no test notices gets a test. One exception, decided by the owner: in the "Rust" section of `audit-status.sh`, a breakage that shows no bug is listed, not tested (`docs/roadmap.md`, 0.5). -5. Independent review: a newly started `fable-reviewer` agent (different model) for every - review. Brief it only with the scope and where the requirements are. Never resume it, and - never give it my conclusions or earlier findings. Fix its findings, or explain to the user - why not. Post every verdict as a comment on the pull request: APPROVED or CHANGES NEEDED, the - findings in short, how each was closed. The approval then leaves a trace an audit can check; - the PR description alone is not enough. The comment is a summary written for the public, with - repository-relative paths, never the pasted report (reports carry local paths). +5. Independent review, by a newly started `fable-reviewer` agent for every review: a different + model, of equal or higher capability than the author's. Never resume the reviewer. The brief + holds only: + - the scope and where the requirements are; + - the planned commit message, which the reviewer checks as a claim, not a fact; + - the red and green runs, when no PR exists yet; + - any owner's decision the changes apply, quoted. + + Never give the reviewer other conclusions of the author or earlier findings. The owner + decided the brief and these rules on 2026-11-24: + - It reviews the uncommitted changes, before the commit. After CHANGES NEEDED, the fixed + changes get a new review. + - Commit and push only when the checks are complete. The review must be APPROVED. When a + coherence audit is due, it runs first, and each of its findings must be closed. + - A finding of a review or an audit is closed in one of three ways: + - fixed and reviewed; + - written into the roadmap step that will fix it; + - declared wrong by the owner, with the reason in a PR comment. + - The audit report is committed alone first, without a `fable-reviewer` review. It is pushed + with the commit that closes its findings, or alone when no commit is needed. + - Minor rounds have a limit. A round that is APPROVED with only minor points is a minor + round. After the third minor round on the same changes, the minor points left move to the + next PR, and no new round runs for them. Its verdict comment lists them as moved. The first + commit of the next PR fixes them or writes them into the roadmap step that will fix them. + - Some points never move: bugs, missing tests, and points on personal data, confirmation or + writing files (R28–R34). They are fixed and reviewed. + + Post every verdict as a comment on the pull request, as soon as the PR exists: APPROVED or + CHANGES NEEDED, the findings in short, how each was closed. After the commit, a comment names + the commit that holds the approved changes. The approval then leaves a trace an audit can + check; the PR description alone is not enough. The comment is a summary written for the + public, with repository-relative paths, never the pasted report (reports carry local paths). `check-public.sh` does not scan PR comments: save the comment to a file and run `sh scripts/check-public.sh --message <file>` before posting. -6. Commit only when the user asks. The hooks (`.githooks/`) do this: +6. Commit only when the user asks, and only when the checks of step 5 are complete. The hooks + (`.githooks/`) do this: - pre-commit runs the public-repository check, the audit cadence gate, the script tests when scripts or hooks change, fmt, clippy and tests; - commit-msg scans the message; @@ -53,8 +79,8 @@ Unit tests sit beside the code (`#[cfg(test)]`). End-to-end tests of the executa ## How do we keep long work from drifting? -Long work across sessions drifts: docs claim things the code does not do, references point to -functions or options that never existed, work is left half-done. These rules work against it. +With the six rules below. Long work across sessions drifts: docs claim things the code does not +do, references point to functions or options that never existed, work is left half-done. - Session start: run `sh scripts/audit-status.sh` and tell the user what it shows. Unfinished work comes first: uncommitted changes, stashes, unpushed commits, unmerged branches, open or @@ -63,18 +89,19 @@ functions or options that never existed, work is left half-done. These rules wor (`step/1.1-portable-names`), pushed early as a draft PR. Mark it ready only when CI is green on all four jobs (read in the job list, never assumed from a pending run) and `fable-reviewer` approved, with its verdict posted on the PR. Merge it into `main` locally by fast-forward: - `git switch main && git merge --ff-only step/x && git push`. That keeps the commits CI - checked, a linear history and the pre-push hook. The GitHub merge button is not used: it - rewrites commits. One step is open at a time. A session never ends with a draft PR without a - comment saying its state and next step. Abandoned work is closed with the reason, never left - open. -- Every 5 commits, a coherence audit by the `coherence-auditor` agent (Fable, fresh context, - read-only). It checks requirements against tests and code, the existence of every concrete - reference, the docs against each other, unfinished work, project rules and health. Its report - is saved as `docs/audits/NNNN-YYYY-MM-DD.md` and committed alone (`audit: NNNN`). The hooks - enforce the cadence: pre-commit refuses a 6th commit without an audit, pre-push refuses to - push past it. The gate is a reminder, not a proof: any added report satisfies it. The review - of the report is what counts. + `git switch main && git merge --ff-only step/x && git push`. The merged commits are the same + ones CI checked, history stays linear and the pre-push hook runs. The GitHub merge button is + not used: it rewrites commits. One step is open at a time. A session never ends with a draft + PR without a comment saying its state and next step. Abandoned work is closed with the reason, + never left open. +- Every 5 commits, a coherence audit by the `coherence-auditor` agent (Fable, a different model + of equal or higher capability than the author's, fresh context, read-only). It checks + requirements, tests and code against each other, the existence of every concrete reference, + the docs against each other, unfinished work, project rules and health. Its report is saved as + `docs/audits/NNNN-YYYY-MM-DD.md` and committed alone (`audit: NNNN`). The hooks enforce the + cadence: pre-commit refuses a 6th commit without an audit, pre-push refuses to push past it. + The gate is a reminder, not a proof: any added report satisfies it. Checking the report's + findings is what counts. - Findings are verified before acting, because the auditor can be wrong too. Each finding carries evidence (`file:line` or command output). Check it, then fix it in a normal TDD cycle. When a doc and the code disagree on what the tool should do, ask the user which one is right. @@ -97,8 +124,9 @@ functions or options that never existed, work is left half-done. These rules wor ## What may never reach the public repository? -`github.com/bertalan/SignSpector` is public. Everything committed is published, and it stays in -the history even if deleted later. Before every commit and push: +Anything that could carry personal or sensitive data. `github.com/bertalan/SignSpector` is +public: everything committed is published, and it stays in the history even if deleted later. +Before every commit and push: - Never commit real signed documents or anything extracted from them. Never commit names, codici fiscali, email addresses, phone numbers, company or office names, hostnames, IPs, credentials, @@ -139,6 +167,9 @@ the history even if deleted later. Before every commit and push: ## Which rules hold everywhere? +These rules hold in every change. They cover texts and language, confirmation and writing +files, accessibility, uninstall, malformed input, PowerShell and dependencies. + - Every text follows `docs/writing.md`: docs, comments, commit messages, PR texts, agent prompts, the tool's strings. Texts answer the reader's questions, answer first, in short sentences, with code and commands verbatim. @@ -161,9 +192,10 @@ the history even if deleted later. Before every commit and push: with answers in words (R30, R35). From the context menu the same confirmations come in a native dialog, focus on Cancel. From a script they refuse (R30). `--plan` shows the plan and stops. -- These rules are for the tool. The developer script `scripts/cleanup.sh` is the one exception: - it removes only junk and merged branches, without asking (see above). Never ask the developer - to type numbers in chat: the typed count is a rule of the tool, not of the conversation. +- The confirmation rules are for the tool. The developer script `scripts/cleanup.sh` is the one + exception: it removes only junk and merged branches, without asking (see above). Never ask the + developer to type numbers in chat: the typed count is a rule of the tool, not of the + conversation. - Originals are only read, never modified, moved or renamed. Existing files are never overwritten: if "x.pdf" exists with other content, the new file is "x (1).pdf". - Never process right after a person chooses a folder. First count and ask for confirmation @@ -173,7 +205,8 @@ the history even if deleted later. Before every commit and push: scripts). - How every file is written, and the only files ever replaced, is R31 in `docs/design.md`: read it before touching any write path. File names are valid on Windows, macOS and Linux at once - (R32). Any change here needs the tests of R34. + (R32). Any change to counting, confirmation, write paths or file names, or to anything else + R34 covers, needs the tests R34 lists. - Accessibility is a requirement, not a polish step (EN 301 549; WCAG 2.2 AA for the report; R35–R39). Never convey information by colour or symbols alone. Honour `NO_COLOR`, `--no-color` and `--plain`. No spinners or rapid line rewriting, no time limits on prompts. Console text is diff --git a/README.md b/README.md index bdda39e..df1d17e 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,6 @@ Requirements and design are in [docs/design.md](docs/design.md), the order of wo [docs/roadmap.md](docs/roadmap.md), contributor rules in [CLAUDE.md](CLAUDE.md). Every text follows the writing guide, [docs/writing.md](docs/writing.md). -## License +## Which licence applies? [MIT](LICENSE) diff --git a/docs/design.md b/docs/design.md index c4766e8..3b1a76f 100644 --- a/docs/design.md +++ b/docs/design.md @@ -3,8 +3,8 @@ Status: draft, completed with the owner step by step. Open points are listed at the end, under "What is still open?", each with the roadmap step that needs the answer. -Each rule is written once, in the requirement named in brackets. Other places point to it -instead of repeating it. +Each rule is written once, in one requirement. Other places name that requirement in brackets +(R31) instead of repeating the rule. ## What is SignSpector for? @@ -47,13 +47,13 @@ saves the signed documents beside the originals, ready to open. PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384/P-521; SHA-1/256/384/512). - R9. The signer's certificate: validity at the reference time, key usage (non-repudiation), qualified and QSCD flags. - - The **reference time** is a proved time only: the signature's time stamp, or the time stamp + - The reference time is a proved time only: the signature's time stamp, or the time stamp of a `.tsd` or `.m7m` that contains the file (R5, R12). - The signing-time attribute is written by the signer and proves nothing. Without a time stamp, the reference time is the time of the check, and the report shows the claimed time marked "claimed, not proved". - R48 and R49 use the same reference time. -- R10. The chain must reach a CA of a **European trusted list** (R44–R48): the national list of +- R10. The chain must reach a CA of a European trusted list (R44–R48): the national list of the certifier's country, reached through the EU List of Trusted Lists. Optionally it may reach the system trust store, labelled "recognised by the system" (translated per R27). - R11. Countersignatures. @@ -89,8 +89,8 @@ saves the signed documents beside the originals, ready to open. ### How is it used? - R19. **Command line.** Commands: `check <dir>...` (default), `extract <dir>...`, - `undo <report>`, `install-menu`, `uninstall-menu`, `uninstall`. **There is no `--apply`, - `--yes` or `--expect`.** + `undo <report>`, `install-menu`, `uninstall-menu`, `uninstall`. There is no `--apply`, + `--yes` or `--expect`. - Every command that changes files or the system shows the exact plan first and acts only after a person confirms. How a person confirms, at a terminal, in a dialog or not at all from a script, is R30. The one exception: `check` in an ordinary run from a script writes @@ -98,7 +98,7 @@ saves the signed documents beside the originals, ready to open. - A number is typed only for files found in a folder: the files to process in a risky run (R28) and the documents to write (R29). `undo`, `install-menu`, `uninstall-menu` and `uninstall` change only what the tool itself made, and ask a yes/no question (R30). - - **Several folders.** `check` and `extract` take one or more folders (several can be + - Several folders. `check` and `extract` take one or more folders (several can be selected in the file manager). They are counted and confirmed together: - one summary with a row per folder (path, number of files to process, number of files of any kind) and the totals, and one question for all. The number typed is the total; @@ -110,12 +110,12 @@ saves the signed documents beside the originals, ready to open. outer folder. The summary says so, and its envelopes go in the outer folder's report; - a selected folder that is a symbolic link is resolved, then counted and judged like any other folder (R28). - - **`--interactive`** says that a person is there even without a terminal: questions come in + - `--interactive` says that a person is there even without a terminal: questions come in native dialogs (R30) and the run ends with the interactive end of run (R20). The context-menu entries and the Windows uninstall entry (R42) pass it. With a terminal, the questions stay in the terminal and R20 still applies. If no dialog can be shown (no desktop session), `--interactive` refuses with exit code 2, like a script. - - **`--plan`** shows what the command would do and stops before doing it. It writes nothing, + - `--plan` shows what the command would do and stops before doing it. It writes nothing, not even the report or the cache, and downloads nothing: it uses the embedded lists and those already in the cache. - `check --plan` only counts (R28; no envelope is opened) and prints the summary. It asks @@ -178,8 +178,8 @@ script. R31 says how every file is created and which files may ever be replaced. - A risky run gets a stronger warning, and the user must type the number of files to process. A run is risky when one chosen folder is a sensitive folder: the root of a drive or volume, the user's home, Desktop, Documents, a system folder (`C:\Windows`, `Program Files`, `/System`, - `/usr`, `/etc`...) or a network share root. It is also risky when the folders hold **more than - 10,000 files of any kind** in all, subfolders included (owner's decision, 2026-11-23). A run + `/usr`, `/etc`...) or a network share root. It is also risky when the folders hold more than + 10,000 files of any kind in all, subfolders included (owner's decision, 2026-11-23). A run that is not risky is an ordinary run. "Risky" and "ordinary" always describe the whole run, never one folder. - The 10,000 count covers the regular files of the folders the walk visits (R2). Files in @@ -241,7 +241,7 @@ script. R31 says how every file is created and which files may ever be replaced. - Free disk space is checked before starting. Ctrl+C finishes the current file, stops, and the report records what was done. - R32. **Portable file names.** Names taken from envelopes (and the `(n)` variants) must be - valid on **Windows, macOS and Linux at the same time**, and on FAT32 and exFAT, whatever + valid on Windows, macOS and Linux at the same time, and on FAT32 and exFAT, whatever system the tool runs on (archives move between systems): - removed or replaced: `/` `\` `:` `*` `?` `"` `<` `>` `|`, NUL and control characters U+0000–U+001F and U+007F; trailing dots and spaces; leading spaces; @@ -252,7 +252,7 @@ script. R31 says how every file is created and which files may ever be replaced. - invalid UTF-8 or unpaired surrogates are replaced; names are stored in Unicode NFC; - length: at most 255 UTF-8 bytes and 255 UTF-16 units per component, cut without breaking a character or the extension; - - collisions are checked **case-insensitively and normalization-insensitively** (NTFS and the + - collisions are checked case-insensitively and normalization-insensitively (NTFS and the APFS default are case-insensitive; APFS treats NFC and NFD as the same name), so two documents never compete for names that the file system sees as equal; - the original name, when changed, is shown in the report. @@ -266,11 +266,14 @@ script. R31 says how every file is created and which files may ever be replaced. before and after every end-to-end test: originals identical, nothing changed but the confirmed plan. - Writing and undo (R29, R31, R32, R33): at the count of documents (R29), an empty answer, - `y`, `n` or a wrong number writes nothing; at the `undo` question, an empty answer or `n` - removes nothing; a file appearing between plan and write; names with `..`, reserved names, - forbidden characters, NFC/NFD and case collisions, over-long names; a symbolic link pointing - outside; disk full (simulated); `undo` with a modified file; `undo` on a report that records - no document. + `y`, `n` or a wrong number writes nothing. At the `undo` question, an empty answer or `n` + removes nothing. Also tested: + - a file appearing between plan and write; + - names with `..`, reserved names, forbidden characters, NFC/NFD and case collisions, + over-long names; + - a symbolic link pointing outside; + - disk full (simulated); + - `undo` with a modified file, and `undo` on a report that records no document. - Risky run at the terminal (R28, R30): an empty answer, `y`, `n` or a wrong number starts no analysis. - Scripts (R30): every changing command, `check` and `extract --plan` in a risky run, and @@ -307,19 +310,24 @@ script. R31 says how every file is created and which files may ever be replaced. in hidden folders, behind symbolic links met during the walk or in unreadable folders are not counted; a selected folder that is a symbolic link is resolved and counted; overlaps count once. - - Several folders (R19): the total is typed; one sensitive folder makes the whole run risky; all - folders empty stop the run; overlaps (also by letter case, symbolic link, trailing slash) - are counted once; one report per selected folder that is not inside another; a symbolic - link to each kind of sensitive folder makes the run risky (R28). + - Several folders (R19, R28): the total is typed. One sensitive folder makes the whole run + risky. All folders empty stop the run. Overlaps (also by letter case, symbolic link, + trailing slash) are counted once. There is one report per selected folder that is not inside + another. Each kind of sensitive folder makes the run risky, selected directly or through a + symbolic link (owner's decision, 2026-11-24). - Time (R9): a back-dated signing-time attribute changes no verdict; without a time stamp the report says "claimed, not proved". - Yes/no questions (R30): Enter alone and `n` cancel, `y` on a pipe is refused, a number is not a yes. - - Dialogs (R30, R38): when a number is required only the right one confirms; yes/no dialogs - default to Cancel; the focus starts on Cancel; Enter alone and closing the window cancel; a - wrong number does not confirm; every selected folder with its count, the total and the operation - are shown; a fake dialog helper placed first in `PATH` is not used; a folder name with quotes or - script code is shown as text, never run. + - Dialogs (R30, R38): + - when a number is required, only the right one confirms; + - a wrong number does not confirm; + - yes/no dialogs default to Cancel; + - in every dialog the focus starts on Cancel; + - Enter alone and closing the window cancel; + - every selected folder with its count, the total and the operation are shown; + - a fake dialog helper placed first in `PATH` is not used; + - a folder name with quotes or script code is shown as text, never run. How are confirmed runs tested without a bypass? The public confirmation has two constructors only, terminal and dialog, which take no input source: they open the terminal or the dialog @@ -334,7 +342,7 @@ script. R31 says how every file is created and which files may ever be replaced. flag that confirms. ### Which trusted lists does it use? -Signatures may come from any country on the EU **List of Trusted Lists** (LOTL, +Signatures may come from any country on the EU List of Trusted Lists (LOTL, `https://ec.europa.eu/tools/lotl/eu-lotl.xml`, signed by the European Commission): Italy, Romania, France and the others. The LOTL points to each national trusted list and names the certificates that sign it. Checked on 2026-11-22: LOTL no. 398, 43 pointers (EU-27, Iceland, @@ -409,10 +417,10 @@ Liechtenstein, Norway, United Kingdom). ### Who must be able to use it, and how? Legal frame (Italy and EU): Legge 4/2004 ("Legge Stanca", as amended by D.Lgs. 106/2018) and the AgID guidelines on the accessibility of IT tools. They refer to the harmonised standard -**EN 301 549** (ch. 11 software, ch. 12 documentation and support, ch. 9 web content = WCAG). +EN 301 549 (ch. 11 software, ch. 12 documentation and support, ch. 9 web content = WCAG). The European Accessibility Act (Directive 2019/882, D.Lgs. 82/2022) probably does not cover -this tool, but meeting EN 301 549 covers it too. Targets: **EN 301 549** for the program and -**WCAG 2.2 level AA** for the HTML report and the user guide. Whoever deploys the tool in a +this tool, but meeting EN 301 549 covers it too. Targets: EN 301 549 for the program and +WCAG 2.2 level AA for the HTML report and the user guide. Whoever deploys the tool in a public administration checks the applicable obligations (for example an accessibility statement). @@ -427,7 +435,7 @@ statement). a second. `--plain` (also `SIGNSPECTOR_PLAIN=1`) gives line-by-line output with a progress line at most every few seconds and a final summary. - Prompts: the full question on one line, with the possible answers and the default spelled - out in words; keyboard only; **no time limits** on any prompt. + out in words; keyboard only; no time limits on any prompt. - Messages in plain language. Every error says what happened, which file, and what the user can do. - R36. **HTML report (WCAG 2.2 AA).** @@ -470,7 +478,7 @@ statement). - If the manifest is lost, our items are recognised by an explicit SignSpector marker, never by guessing. - Each item is created as R31 says (registry keys and `.workflow` folders: still open, - question "Before 5.1"). An item is **foreign** when it is not in the manifest and + question "Before 5.1"). An item is foreign when it is not in the manifest and has no SignSpector marker. When a foreign item has the same name, `install-menu` reports it and leaves it, and it never enters the manifest, so `uninstall` never removes it (owner's decision, 2026-11-23). @@ -495,9 +503,10 @@ statement). - R43. **User data is never removed**: originals, extracted documents and reports stay. At the end the tool lists what it left in place on purpose and where the executable is. -## How is the code organised? (proposal) +## How is the code organised? A library crate with one module per concern; the executable only parses arguments and prints. +This is a proposal. | Module | Role | Candidate crates | |---|---|---| @@ -553,8 +562,10 @@ confirm that antivirus, SmartScreen and AppLocker accept a mingw-built executabl ## What is still open? -The owner closed requirement changes in roadmap step 0.4 (2026-11-23). Each question below is -answered before the roadmap step named in its heading; that step points back here. +The owner closed requirement changes in roadmap step 0.4 on 2026-11-23. Decisions on +requirements taken after that date are listed in the same step, each with its date. Each +question below is answered before the roadmap step named in its heading; that step points back +here. ### Before 1.4 (translations) - Translation mechanism (for example Fluent `.ftl` files embedded in the executable, or diff --git a/docs/roadmap.md b/docs/roadmap.md index acb0c31..eade6ce 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -2,10 +2,13 @@ ## How does a step get done? -Each step is test-driven: red, green, refactor. A new `fable-reviewer` agent reviews it, then it -is committed. A step is done when its tests are green on all three systems in CI and its PR is -merged. Mark the step done here (`[x]`) in the PR that completes it; the coherence audit checks -that the mark is true. Requirements (R…) are in `docs/design.md`. +Each step is test-driven: red, green, refactor. A new `fable-reviewer` agent reviews the changes +of each commit before they are committed; the audit report is the one exception (`CLAUDE.md`). A +step is done when its tests are green on all three systems in CI and its PR is merged. Each step +writes the tests of R34 for the commands and modules it introduces, as soon as they can be +tested. R34 is the only list of these tests; the review of each step checks the step against it +(owner's decision, 2026-11-24). Mark the step done here (`[x]`) in the PR that completes it; the +coherence audit checks that the mark is true. Requirements (R…) are in `docs/design.md`. ## Why this order? @@ -46,14 +49,14 @@ in the script tests. simple `.p7m`/`.p7s`, `.tsd`. Synthetic identities only. Private keys are never committed: they are generated at test time or kept in `target/`. - [ ] 0.4 Writing guide (`docs/writing.md`). Texts answer the reader's questions, with the - answer first and short sentences. Code and commands stay verbatim. There are no machine-made + answer first and short sentences. Code and commands stay verbatim. Texts use no machine-made patterns (after Wikipedia's "Signs of AI writing"). Rewrite README, design, roadmap, `CLAUDE.md` and the agent prompts with it. Also in this step: - a comment in `rust-toolchain.toml`: targets and R25, how to update the pinned version; - a "Rust" section in the session report (`scripts/audit-status.sh`) that names a newer stable Rust when one exists; - - owner's decisions on requirements, taken in the reviews of this step (2026-11-23) and - recorded in `docs/design.md`: + - owner's decisions on requirements, taken in the reviews of this step (2026-11-23 unless + dated) and recorded in `docs/design.md`: - what `check` writes (R16); - risky runs counted on files of any kind (R28); - reports never replaced, and the second report (R16, R20, R31, R33); @@ -62,7 +65,9 @@ in the script tests. - the cache (R47); - no saved preference (R27); - `--no-report` (R14, R16); - - foreign menu items (R41). + - foreign menu items (R41); + - R34 also tests each kind of sensitive folder selected directly (R28), decided on + 2026-11-24. The questions these decisions opened are in "What is still open?" in `docs/design.md`. Each names the roadmap step that needs the answer: 1.4, 1.5, 1.6, 1.7, 3.1, 3.2, 3.5, 3.6, 3.7, @@ -83,12 +88,17 @@ in the script tests. - "never asks" is checked on the script's text (a word list) and with input on a pipe, never at a real terminal; - the check "still merged into main" (with full ref names) just before a branch is deleted - has no test. It guards a race. + has no test. It guards a race; + - no test fixes the choice that a branch just created at `main` is removed (audit 0003, F6). - `audit-status.sh`, unfinished-work section: - - uncommitted changes, stashes and the unpushed / not pulled counts have no test. These have - one: the "AUDIT DUE" and "RED CHECKS" lines, the current branch name, unmerged local and - remote branches, a missing `main` or `origin/main`, the `origin/HEAD` filter and "no tags - or other refs"; + - uncommitted changes, stashes and the unpushed / not pulled counts have no test; + - these have one: + - the "AUDIT DUE" and "RED CHECKS" lines; + - the current branch name; + - unmerged local and remote branches; + - a missing `main` or `origin/main`; + - the `origin/HEAD` filter; + - "no tags or other refs"; - the "RED CHECKS" test covers the printed line and its absence, not which checks are selected as red (the `gh` stub returns the formatted line); - only `FAILURE` counts as red today, not cancelled or timed-out jobs nor commit statuses: @@ -106,9 +116,11 @@ in the script tests. - known limit: `rustup check` has no time limit. It runs only in report mode, after the hook gates, so no commit or push waits on it; - three rules are correct today, but breaking them on a copy leaves all tests green (review - of 40e2d4c): unescaping the first dot of the x.y.z check (`1x100.0` would then pass); - accepting only a single digit for the major and patch numbers (`10.0.0` would then be "not - x.y.z"); letting the captured rustup version start with a dot. + of 40e2d4c): + - unescaping the first dot of the x.y.z check (`1x100.0` would then pass); + - accepting only a single digit for the major and patch numbers (`10.0.0` would then be + "not x.y.z"); + - letting the captured rustup version start with a dot. - From the targeted review of the third-round fixes: - the first push to a new remote scans the whole history and stops on the accepted exception `cd3620d` (`CLAUDE.md`). Encode the exception if a second remote is ever added; @@ -116,6 +128,11 @@ in the script tests. - `core.commentChar` other than `#`: `git commit -v` is refused (fails closed); - untested: `cleanup.sh` `--no-merged` with a detached HEAD at an unmerged commit; a refused push and a crashing hook both exit 1. + - Review trace (review of the closing changes of audit 0010, 2026-11-24): nothing ties an + APPROVED verdict to the content of the commit that follows. A change made between the + verdict and the commit cannot be seen later. Proposal for the owner to decide: the reviewer + reports `git write-tree` of its staged copy, and the auditor compares it with + `git rev-parse <commit>^{tree}`. ## Phase 1: how do we write files safely, before any cryptography? @@ -124,10 +141,17 @@ With pure functions for names and confirmation, and a writer that never overwrit - [x] 1.0 Envelope names (`is_envelope`, R1a): delivered with the project setup (0.1). - [ ] 1.1 Portable names (`names` module, R32): `portable_name(raw) -> PortableName { name, changed }`. - - Tests, one per rule: forbidden characters, control characters, trailing dot and space, - reserved Windows names (any case, with extension, superscript digits), leading `-` and `.`, - `.`/`..`, invalid UTF-8, NFC, the 255-byte/255-unit limit without breaking a character or - the extension, an empty result giving the fallback name. + - Tests, one per rule: + - forbidden characters; + - control characters; + - trailing dot and space; + - reserved Windows names (any case, with extension, superscript digits); + - leading `-` and `.`; + - `.` and `..`; + - invalid UTF-8; + - NFC; + - the 255-byte/255-unit limit, without breaking a character or the extension; + - an empty result, which gives the fallback name. - Property tests (`proptest`): the output is always valid on all three systems, and idempotent (`portable(portable(x)) == portable(x)`). - [ ] 1.2 Collision key and free name (R17, R32): `collision_key` ignores case and @@ -148,11 +172,6 @@ With pure functions for names and confirmation, and a writer that never overwrit - Detection of sensitive folders (drive roots, home, Desktop, Documents, system folders, network share roots) and of a risky run: a sensitive folder, or more than 10,000 files of any kind over all the folders, subfolders included. - - Tests from R34 "Counting": 10,000 against 10,001, also as a total over several folders; - files not counted; a selected folder that is a symbolic link; overlaps. - - Tests from R34 "Several folders": overlaps; a symbolic link to each kind of sensitive - folder. - - Test for R28: each kind of sensitive folder selected directly. - [ ] 1.6 Confirmation logic (R28–R30). First decide the questions "Before 1.6" in `docs/design.md`. - Pure functions turn the counts, the folder, the way the run started (terminal, dialog via @@ -160,13 +179,6 @@ With pure functions for names and confirmation, and a writer that never overwrit answer. - The question is a typed count (R28 risky run, R29) or a yes/no question with default No (R30). Typestate `ConfirmedPlan`. - - Tests: the R34 items "Risky run at the terminal", "Yes/no questions" and "Scripts". - - Tests: the answers of R34 "Writing and undo" at the count of documents. - - Tests from R34 "Counting": both counts in each row and in the totals of the terminal - summary; the reason for a risky run; the number typed is the files to process, also when the - run is risky only by the 10,000 limit. - - Tests from R34 "Several folders": the typed total; one sensitive folder makes the whole run - risky; all folders empty stop the run. - The dialogs themselves come with the menus (5.2). - [ ] 1.7 Safe writer (R31). First decide the questions "Before 1.7" in `docs/design.md`. - `create_new`, the next free name on a race, removal of partial files. @@ -186,9 +198,8 @@ With a BER reader, a CMS parser and one thin run of the whole flow. - [ ] 2.3 End-to-end slice: `check` and `extract` on simple fixtures through the real flow. - Minimal console output with `--plain` and `--no-color` (R35); minimal JSON (R15). - Written documents recorded in the report with SHA-256, and `undo` (R33). - - Tests from R34 "Several folders": one report per selected folder that is not inside another. - - Tests from R34 "Writing and undo": the `undo` cases (an empty answer or `n` removes nothing; - a modified file; a report that records no document). + - The first end-to-end tests in `tests/*.rs` use `assert_cmd` and `predicates`, declared in + `Cargo.toml` since 0.1 (audit 0001, F12). ## Phase 3: how do we verify signatures and time stamps? @@ -215,10 +226,14 @@ One layer at a time: cryptography, certificates, trusted lists, chains, time sta - [ ] 3.9 Revocation (R49). First decide the questions "Before 3.9" in `docs/design.md`. - Data embedded in the signature, a CRL per CA with cache, one check per certificate, "revocation not checked" offline. - - Negative tests: revoked before and after the time stamp; revoked with no time stamp (cannot - be determined, never invalid); stale or forged embedded data; a forged or oversized CRL; a - CRL older than the reference time; an expired certificate no longer listed; a distribution - point outside `http`/`https`. + - Negative tests: + - revoked before and after the time stamp; + - revoked with no time stamp (cannot be determined, never invalid); + - stale or forged embedded data; + - a forged or oversized CRL; + - a CRL older than the reference time; + - an expired certificate no longer listed; + - a distribution point outside `http`/`https`. - Also: an embedded CRL older than the reference time when the CA's CRL cannot be fetched ("revocation not checked"). @@ -241,10 +256,9 @@ remove it. - [ ] 5.1 Install manifest (R41). First decide how `create_new` applies to registry keys and `.workflow` folders, and the other questions "Before 5.1" in `docs/design.md`. -- [ ] 5.2 Context menu per OS (R21, R38) with the confirmation dialogs (R30) and their R34 - tests; Windows "Installed apps" entry (R42). First decide the questions "Before 5.2" in - `docs/design.md`: Enter in a number field, what the shorter dialog summary must show, and the - other questions. +- [ ] 5.2 Context menu per OS (R21, R38) with the confirmation dialogs (R30); Windows "Installed + apps" entry (R42). First decide the questions "Before 5.2" in `docs/design.md`: Enter in a + number field, what the shorter dialog summary must show, and the other questions. - [ ] 5.3 `uninstall` (R40–R43). First decide what happens to a file in the cache folder that the tool did not write (questions "Before 5.3" in `docs/design.md`). @@ -257,4 +271,4 @@ As one self-contained executable per platform, tested on the company PC before ` - [ ] 6.2 Test on the company Windows PC (antivirus, SmartScreen, AppLocker) with the real corpus. - [ ] 6.3 Manual accessibility checks, `docs/accessibility.md` (R39); user guide (R37). -- [ ] 6.4 `1.0.0` when ready to replace the old tool. +- [ ] 6.4 `1.0.0` when ready to replace the old tool. Before it, every case of R34 has a test. diff --git a/docs/writing.md b/docs/writing.md index 0b84f75..46611d8 100644 --- a/docs/writing.md +++ b/docs/writing.md @@ -79,9 +79,13 @@ Yes, seven: with screen readers (R35): words, not symbols. - Texts without headings (commit messages, comments, the tool's strings) keep the rest: answer first, short sentences, nothing to cut. -- Numbered lists and fixed formats keep their labels and layout. Examples: requirements - `R44.`, roadmap steps `3.4`, the reviewer's `VERDICT:` line, the audit report skeleton, the - front matter of agent prompts. The text inside them follows the guide. +- Numbered lists and fixed formats keep their labels and layout. The text inside them follows + the guide. Examples: + - requirements `R44.` and roadmap steps `3.4`; + - the reviewer's `VERDICT:` line and the audit report skeleton; + - the front matter of agent prompts; + - headings such as `### Before 1.5 (walk and count)` in "What is still open?" in + `docs/design.md`, which roadmap steps point to. - Audit reports in `docs/audits/` are records: they are never rewritten. ## Who checks? From 6fe702967b805bf0bdaa2b86f9fa907ba08dfde3 Mon Sep 17 00:00:00 2001 From: Bertalan Ivan <2826311+bertalan@users.noreply.github.com> Date: Tue, 24 Nov 2026 19:06:59 +0100 Subject: [PATCH 36/36] Mark roadmap step 0.4 done The writing guide is in docs/writing.md. README, design, roadmap, CLAUDE.md and both agent prompts are rewritten with it. The comment in rust-toolchain.toml and the "Rust" section of scripts/audit-status.sh are in place, and the owner's decisions of the step are recorded in docs/design.md. CI is green on all four jobs at 5244cbe. The roadmap now says, as the owner decided, that a step is done when the review of its last changes is APPROVED and CI is green on all four jobs; only then is its PR merged. The mark is set after the APPROVED review of the last commit; CI on that commit must be green before the merge. Nine minor points of review rounds 13 and 14 move to the next PR, as the comments of PR #3 list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/roadmap.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/roadmap.md b/docs/roadmap.md index eade6ce..eee2fe5 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -4,11 +4,12 @@ Each step is test-driven: red, green, refactor. A new `fable-reviewer` agent reviews the changes of each commit before they are committed; the audit report is the one exception (`CLAUDE.md`). A -step is done when its tests are green on all three systems in CI and its PR is merged. Each step -writes the tests of R34 for the commands and modules it introduces, as soon as they can be -tested. R34 is the only list of these tests; the review of each step checks the step against it -(owner's decision, 2026-11-24). Mark the step done here (`[x]`) in the PR that completes it; the -coherence audit checks that the mark is true. Requirements (R…) are in `docs/design.md`. +step is done when the review of its last changes is APPROVED and CI is green on all four jobs. +Only then is its PR merged (owner's decision, 2026-11-24). Each step writes the tests of R34 for +the commands and modules it introduces, as soon as they can be tested. R34 is the only list of +these tests; the review of each step checks the step against it (owner's decision, 2026-11-24). +Mark the step done here (`[x]`) in the PR that completes it; the coherence audit checks that the +mark is true. Requirements (R…) are in `docs/design.md`. ## Why this order? @@ -48,7 +49,7 @@ in the script tests. - [ ] 0.3 Fixture generator `scripts/make-fixtures.sh` (Homebrew `openssl@3`): test CA, signers, simple `.p7m`/`.p7s`, `.tsd`. Synthetic identities only. Private keys are never committed: they are generated at test time or kept in `target/`. -- [ ] 0.4 Writing guide (`docs/writing.md`). Texts answer the reader's questions, with the +- [x] 0.4 Writing guide (`docs/writing.md`). Texts answer the reader's questions, with the answer first and short sentences. Code and commands stay verbatim. Texts use no machine-made patterns (after Wikipedia's "Signs of AI writing"). Rewrite README, design, roadmap, `CLAUDE.md` and the agent prompts with it. Also in this step: