From 7e26f5fabc9d2244d1aa02eef243e9a67e756d6c Mon Sep 17 00:00:00 2001 From: Marius Ciepluch <11855163+norandom@users.noreply.github.com> Date: Fri, 27 Nov 2026 11:07:49 +0100 Subject: [PATCH] spec(contributor-scan): the ledger in the image is an open task on 3.1 (item 5a) A dated note on task 3.1 of .kiro/specs/contributor-scan/tasks.md (ninth session, 2026-11-27). No code changes, and nothing is decided: the maintainer chose "Open task" on 2026-11-26 for item 3 of the eighth session's menu ("Record it as an open task: nothing changes now. A dated note on task 3.1 holds the measurements and the design question (a ledger under the runs directory must be keyed by target, because its entries name relative paths)."), and the checkbox of 3.1 stays open. The note holds: - what a scan does with the false-positive ledger, by reading src/openultrasast/cli.py and reports.py: the path under the target, the read before the ranking is calibrated, the write when its content would change, the degradation ledger_not_written on a read-only target, the report's sentence under "What could not be analysed", and that through the image a scan applies learnings only from a ledger already in the tree and can never add one (by the code, not run); - the measurements of 2026-11-26, read again on 2026-11-27 from the run artifacts, not from new runs. Standard mode on contrib/examples of libpng at cf53e54, 15 findings on both sides, no key on either side. In the image (run 20261126T125414Z-facce3bb): calibrations_applied=0, project_score 26, penalty_total 80.0. Natively, a second scan of a copy that held the ledger an earlier native scan had written: calibrations_applied=2, project_score 59, penalty_total 32.0. calibrations_applied counts files: the native second scan applied all four learnings of that ledger, to two files; - the design question, with the options not chosen. The design question names no key for a ledger under the runs directory. The note records two candidates that cannot serve: the path as the image shows it (every target is /target there) and the fingerprint of the provenance stage, which classes a tree as human, agent or mixed and hashes nothing. The decision and its options are recorded in .kiro/handover.md, which is not tracked; the note says so. The measurements rest on the eighth and ninth sessions' scratch under /tmp/opencode, which is not kept; the note names the files. tests/test_obligation_siblings.py passes (4 tests), ruff, mypy, the three gates and compileall pass, and the gates print what they printed before. An independent reviewer approved the change in three rounds. Its remarks are applied: the handover is named as the record of the decision; the image figures come from the run without a key, as the native run is; calibrations_applied is said to count files; and a clause that pointed the design at a function that is not a key is gone. That clause came from the reviewer's own first-round remark and was written in after checking only the call site; the reviewer caught it in the second round. --- .kiro/specs/contributor-scan/tasks.md | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.kiro/specs/contributor-scan/tasks.md b/.kiro/specs/contributor-scan/tasks.md index 75b7926f..30f813ae 100644 --- a/.kiro/specs/contributor-scan/tasks.md +++ b/.kiro/specs/contributor-scan/tasks.md @@ -422,6 +422,40 @@ say when it left files out under its runs directory; whether a scan whose target lies inside its runs directory should be named (it is read as before and prints nothing about it); a sentence for the user docs, since README.md and docs/examples.md say where a run goes and not what a scan reads. + - _The ledger in the image is an open task, 2026-11-27 (ninth session), by the maintainer's decision of + 2026-11-26 on the eighth session's menu (item 3, "Open task"), as the handover records it. Nothing + changes now._ + The ledger is the one write a scan still makes into the analysed tree (part A, above): + `/.openultrasast/calibration/false_positive_learnings.json`. `_run_scan` reads it before the + ranking is calibrated, and `_persist_calibration_feedback` writes it when its content would change + (`src/openultrasast/cli.py`). The image mounts the target read-only. There the write fails, the manifest + records `ledger_not_written` (stage `record_calibration`, detail "[Errno 30] Read-only file system: + '/target/.openultrasast'"), the report says so under "What could not be analysed", and the next scan + starts without the learnings of the one before; the learnings of a scan are kept in its run directory. + Through the image a scan applies learnings only from a ledger that is already in the tree, and can never + add one (by the code, not run). + Measured on 2026-11-26 (eighth session), standard mode, no key on either side, `contrib/examples` of + libpng at `cf53e54` (four C files), 15 findings on both sides. In the image (`openultrasast:dev` + `3f959b31f2f2`): `calibrations_applied=0`, `project_score` 26, `penalty_total` 80.0. Natively, a second + scan of a copy that held the ledger an earlier native scan had written: `calibrations_applied=2`, + `project_score` 59, `penalty_total` 32.0. That ledger holds four entries, each of `reason` + `unreachable_path`; the native second scan applied all four, to two files (`calibrations_applied` counts + files). By the eighth session's record the scan that wrote it was its first native attempt, whose batch + queries had failed. Read again on 2026-11-27 from the run artifacts. + Open, the design question: should the ledger live under the runs directory, which the image can write? + A ledger there must be keyed by target, because its entries name paths relative to the target, and so + does the id of a finding: `c-unsafe-copy:iccfrompng.c:124` in a scan of `contrib/examples` is + `c-unsafe-copy:contrib/examples/iccfrompng.c:124` in a scan of libpng. Through the image every target is + mounted at `/target`, so the key cannot be the path the scan sees. The `fingerprint` of the `provenance` + stage is not a key either: it classes the tree as `human`, `agent` or `mixed` from tooling paths, + markers and git trailers, and hashes nothing (`src/openultrasast/provenance.py`). A scan also reads two + more files of that directory when they exist, `rule_policy.json` and `complexity_ledger.json`, which a + move would have to decide about. Not chosen on 2026-11-26: "Leave it, by design"; "Docker volume for + ledger" (compose only, a named volume at `/target/.openultrasast`); "Fix in scan path now". Evidence on + record, the eighth session's scratch under `/tmp/opencode`, not kept: `s8_evidence.md`, + `s8_d_standard_nokey.out`, `s8_d_native_standard.out`, the run directories + `s8_build/reports/runs/20261126T125414Z-facce3bb` and `s8_native_runs/20261126T125839Z-ec9e1a0e`; the + ninth session's readings `s9_c7_*.out`. - [x] 3.2 Build and verify the image - `docker compose build`, then run a real scan through it and through the shell wrapper. The Dockerfile and