Commit Graph
773 Commits
Author SHA1 Message Date
Marius Ciepluch 5ad9e7781d fix(contributor-scan): compose refuses a target that does not exist (item 5a)
A mistyped TARGET read as a clean scan. The `/target` mount was in the short syntax, so
Docker created a path that does not exist as an empty directory owned by 0:0, and the
scan ended with exit 0 and no findings (the eighth session, 2026-11-26: file_targets=0,
findings=0, exit=0).

The mount is now in the long syntax with `create_host_path: false`, as `/reports` is
since 9d53c32. The source is still `${TARGET:-.}` and the mount is still read-only. A
path that does not exist is refused by the daemon before the container starts ("bind
source path does not exist"), and nothing is created. Measured on 2026-11-26 with the
new file alone in a scratch directory, Docker 29.8.1 and Compose v5.5.1, image
openultrasast:dev (3f959b31f2f2), both API keys unset: a TARGET that does not exist
gives exit 1 in one second and no directory; the documented command with `--mode quick`
on a copy of libpng's contrib/examples gives file_targets=4, findings=4, exit 0;
`touch /target/x` ends with "Read-only file system", exit 1; with TARGET unset the
default source mounts (exit 0).

Tests: the new
`tests/test_task_images.py::test_compose_refuses_a_target_that_does_not_exist` fails on
the short syntax (1 failed, 22 deselected) and passes after; with
`tests/test_search_image.py`, 24 passed. ruff format, ruff check, mypy, the three gates
and compileall pass, and the gates print what they printed before the change. An
independent reviewer approved the change in one round; its remarks on two wordings are
applied.

Left as they are: `docs/detection-techniques.md` cites `docker-compose.yml` by line
numbers that were already off before this change; that is the next docs commit of item
5a. An empty directory that exists still scans clean, natively and in the image; the
menu did not choose to fail that.
2026-11-26 17:44:46 +01:00
Marius Ciepluch a6e8e2615a fix(contributor-scan): the wrapper's native path runs in the caller's directory (item 5a)
`ousast scan .` through ops/shell/ousast.sh with a native install scanned the wrong
tree. The native path changed into the checkout before it passed the arguments on, so
`.` was the OpenUltraSAST checkout and a relative file name was looked up there. The
eighth session showed it with a stub interpreter in place of `.venv/bin/python`
(`cwd=/tmp/opencode/s8_fakehome args=-m openultrasast.cli scan .`). The check also
looked for `joern-parse` only, while the batch queries run `joern`: with `joern-parse`
alone on PATH every batch query failed and a standard scan still exited 0 (2026-11-26,
14 findings where the working launcher gives 15).

The native path now runs the checkout's interpreter by its absolute path, in the
caller's directory, as the container path does, and it is taken only when `joern` is on
PATH as well. So `.`, relative names and relative options mean the caller's files. The
reviewer found, and a run confirmed, what dropping the `cd` brings: `-m` alone puts the
working directory first on the interpreter's path, so a file of the scanned tree could
stand in for a module the CLI imports (a `json.py` in the caller's directory: `ousast
--help` printed SHADOW-EXECUTED and exited 3). The interpreter is started with `-P`,
which keeps that directory off the path; the flag needs Python 3.11, the project's
floor (pyproject.toml).

Changes a caller sees, beyond the one the decision named:
- The checkout's .env is no longer read on the native path; the CLI reads .env from the
  working directory, which is now the caller's. ops/README.md says so.
- `ousast pairs` and `ousast repos` no longer find their defaults outside the
  checkout, because `benchmarks/` is read relative to the working directory. Measured
  for `pairs`: through the wrapper natively, and on the container path, `pairs --slice
  vibe-py` ends with "pair catalog is not a file: benchmarks/pairs/catalog.toml",
  exit 1, so the container path already behaved this way. `repos` by reading. Run from
  the checkout root they find their defaults again (by reading; not run). The header's
  `ousast pairs --slice vibe-py` example is removed. This is a reading the maintainer
  may correct.
- The message for a machine without Docker names both executables.

Tests: the new tests/test_shell_wrapper.py runs the wrapper by bash with a stub of the
interpreter, `joern`, `joern-parse` and `docker` ahead of /usr/bin and /bin on PATH.
Its two tests failed before the change (2 failed: the interpreter ran in the fake
checkout, and the native path was taken without `joern`), and the first failed again
until `-P` was passed (1 failed). With the real venv and Joern 4.0.625 on PATH, from a
directory without .env: `ousast scan examples --mode quick` on a fresh copy of libpng's
contrib/examples gives file_targets=4, findings=4, exit 0, before and after the flag,
the figures of the eighth session. The eight tests of tests/test_docs_site.py and
tests/test_removed_plane_references.py pass, `mkdocs build --strict` exits 0, ruff
format, ruff check, mypy, the three gates and compileall pass, and the gates print what
they printed before the change. An independent reviewer approved the change in the
second round; its two findings of the first round led to the `-P` flag and to the
removal of the header example.

Found by the reviewer and left alone, outside this decision: the background child of
`ousast pre-push` (src/openultrasast/push/background.py) starts the CLI with `-m` and
without `-P`, from the pushed repository.
2026-11-26 17:29:16 +01:00
Marius Ciepluch 88ea171dbe fix(contributor-scan): the release builds the scan image from the pinned base (3.2, part 2)
The `images` job of `.github/workflows/release.yml` built `Dockerfile` with no build
arguments, so the file's own defaults applied: `TASK_BASE_TAG=base-unpublished` and an
empty digest. The first `FROM` could not be resolved. The log of the `v2.1.0-alpha.1` tag's
run (42229293910, job `images (openultrasast, Dockerfile)`, 2026-11-06T13:54:46Z) reads
`ERROR: failed to build: failed to solve: failed to parse stage name
"ghcr.io/norandom/ousast-task-base:base-unpublished@": invalid reference format`. Compose
had the same defect, closed in 89d08e0.

The job now reads `plane/task-base.digest` in a `pins` step before its build, the way the
`pins` job of `engine-image.yml` does: the same pattern, fail closed on an unpublished or
malformed pin, the tag and digest written to the step's outputs. The build step passes them
as `TASK_BASE_TAG` and `TASK_BASE_DIGEST`. The other leg of the matrix, the runner, declares
no such arguments and ignores them. The `image` job of `engine-image.yml` already passes
both arguments to its search-task leg, which does not declare them either: run 42229294086
of the same tag succeeded, and its log holds no line about unused arguments.

Tests: the new `tests/test_task_images.py::test_release_pins_the_base_of_its_scan_image`
fails on the workflow at 9d53c32 (3 failed: the job reads no pin) and passes after, in five
cases. A valid pin writes exactly the two output lines. An unpublished pin, a bare tag, a
short digest and another repository each stop the script with its own message and write
nothing. The test also asserts that the pin is read before the build and that the build
carries both arguments from that step. With `tests/test_search_image.py`, 23 passed. On
this machine the script, run from the tree, wrote `base_tag=base-b696c08` and the digest
`docker-compose.yml` defaults to. ruff format, ruff check, mypy, the three gates and
compileall pass, and the gates print what they printed before the change. An independent
reviewer approved the change in one round; its three notes on the test are applied here
(the step order, the exit status and message, two more malformed pins).

Not run: the release workflow itself, on GitHub.
2026-11-26 13:50:17 +01:00
Marius Ciepluch 9d53c320a5 fix(contributor-scan): compose leaves the reports directory to the user (3.2, part 2)
On a fresh checkout the documented command, `TARGET=/path/to/repo docker compose run
--rm ousast scan /target`, died before scanning. The `/reports` mount was in the short
syntax, so Docker created a missing `./reports` as root, and the image runs as uid 1000.
On 2026-11-26, from a copy of the compose file at 8daca3d, Docker created the directory
owned by 0:0 and the scan stopped after one second with exit 1 and `PermissionError:
[Errno 13] Permission denied: '/reports/runs'`.

The mount is now in the long syntax with `create_host_path: false`, so nothing is
created. Without the directory the daemon refuses the container ("bind source path does
not exist") and leaves nothing behind. After `mkdir -p reports` the same command
completes with exit 0 and writes the run directory owned by the user (quick mode on four
C files: file_targets=4, findings=4). The documented command in the compose header, in
`README.md` and in `ops/README.md` creates the directory first. Both shell wrappers
already did.

Tests: the new `tests/test_task_images.py::test_compose_leaves_the_reports_directory_to_the_user`
fails on the short syntax (1 failed, 16 deselected) and passes after; with
`tests/test_search_image.py`, 18 passed. The eight test files that read `README.md` pass
(183 tests). ruff format, ruff check, mypy, the three gates and compileall pass, and the
gates print what they printed before the change. An independent reviewer approved the
change in one round.

Left as it was, an open item for the maintainer: the `/target` mount is still in the
short syntax, so a `TARGET` that does not exist is created as an empty root-owned
directory and the scan ends with exit 0 and no findings (measured on 2026-11-26).
2026-11-26 13:25:20 +01:00
Marius Ciepluch a706a7d811 build(image): the app layers name the runtime user, so the chown layer is gone
By the maintainer's decision of 2026-11-25, recorded in the handover. The option as
offered: "Drop the duplicate chown layer", as offered: "`COPY --chown` on the app file
layers instead of a final `chown -R`. Every file under `/app` stays owned by uid 1000,
compared file by file in the rebuilt image."

`RUN chown -R ousast /app` ran after the last COPY, so it copied every file of `/app`
into a second layer: 194 MB beside the 189 MB `benchmarks` layer in the local image,
and the build of 2026-11-25 spent 311 of its 470 seconds in it. The line is removed, and
the copies it covered take `--chown=1000` as `benchmarks` already did: `pyproject.toml`,
`README.md` and `LICENSE` in one, `src` in the other. Nothing after the last COPY writes
under `/app`: the pip install runs with the uv_build backend and left nothing there in
the image built on 2026-11-25.

Two things are expected to change besides the layer. `/app` itself, which `WORKDIR`
creates, is owned by root, where `chown -R` made it uid 1000. And the files that were
gid 0 take gid 1000. No tracked use writes into `/app` as the runtime user: compose runs
in `/work` and writes under `/reports`, the wrapper `ops/ousast-docker` works in the
mounted repository, and the workflows build and push.

Tests: the new `tests/test_task_images.py::test_app_layers_carry_their_owner` fails on
a `RUN chown` in the final stage and on a `COPY` into it that does not start with
`COPY --chown=1000 `. It failed before the change (1 failed, 15 passed) and passes
after; with `tests/test_search_image.py`, 17 passed. On scratch copies it fails when
the chown line is put back and when the flag is dropped from `COPY src ./src`.
`test_digest_required_and_code_last` found its code line by `COPY src `; it accepts the
new prefix, and its ordering check is unchanged. ruff, mypy, the three gates and
compileall pass, and the gates print what they printed before the change. An independent
reviewer approved the change in one round.

Not claimed here: the rebuilt image. It follows in this step's next part, with the
proof that every file under `/app` is owned by uid 1000 and that `/app` holds the
tracked files only.
2026-11-26 10:36:59 +01:00
Marius Ciepluch 005bffb677 build(image): the image leaves the search pilot's git-ignored working files out
By the maintainer's decision of 2026-11-25, recorded in the handover. The option as
offered: "One line in `.dockerignore` names `benchmarks/search/private/`, with a test
that pins it. The local image then holds what a checkout holds."

`.gitignore` ignores `benchmarks/search/private/`, where the feasibility pilot keeps its
local identities and working files. `.dockerignore` did not, so `COPY --chown=1000
benchmarks` baked the directory of a local tree, 49,961 files, into the local image
`openultrasast:dev`; nothing under it is tracked. A checkout has none of these files, so
an image built from one never held them. Nothing under `src/` names the directory: the
pilot scripts, `benchmarks/search/pilot_run.py` and `pilot_select.py`, run on the host
and take the image under test as an argument.

Tests: `tests/test_task_images.py::test_search_pilot_files_stay_out_of_the_image` pins
the pattern, and that no `!` line with its exact prefix, with or without the trailing
slash, lets it back in. It failed before the change (1 failed, 14 deselected) and passes
after; with `tests/test_search_image.py`, 16 passed. On scratch copies the test fails
when the line is removed, and when `!benchmarks/search/private` or
`!benchmarks/search/private/` is appended. ruff, mypy, the three gates and compileall
pass, and the gates print what they printed before the change. An independent reviewer
approved the change in one round; its remark on the re-include check is applied.

Not claimed here: the rebuilt image. It follows in this step's next part, with the check
that the directory is absent from it.
2026-11-26 10:15:26 +01:00
Marius Ciepluch 91d305cd3c ci: keep the local .env out of the dagger upload
By the maintainer's decision of 2026-11-25, recorded in the handover: "dagger/ci.py syncs the
git-ignored .env into the local container when run locally, and step 9 runs that script locally
for the first time. I have not read how CI supplies what .env holds; that is checked first, so
CI keeps what it needs."

`.env` is the first entry of the exclude list of the one upload in dagger/ci.py,
`client.host().directory(".", exclude=[...])`. The script is CI's dagger job and the same
script run locally; the entry matches nothing in CI and removes the root `.env` of the tree
when the script runs on a machine that has one.

CI keeps what it needs, read before the change: `.github/workflows/ci.yml` (97 lines) sets two
literal variables (`UV_NO_SYNC`, `DAGGER_VERSION`), uses no `secrets.*` and no `vars.*`, and
has no step that creates or copies a `.env`; the container gets one variable, `UV_NO_SYNC=1`.
The names `.env.example` lists, the two API keys, the `VALID_BENCHMARK_*` S3 settings and the
two Discord values, are supplied by no workflow. A checkout has no `.env`, because the file is
git-ignored; `.env.example` is not matched and stays in the upload. No test reads a `.env` from
the tree.

That the pattern removes the root `.env` rests on reading, not on a run: the SDK passes the
list unchanged to the engine, whose filter matches a pattern without wildcards against the
whole relative path (the independent reviewer traced it at v0.21.7, the version CI pins, and
ran that filter over a scratch tree; no engine and no container was started).

Tests: the new tests/test_dagger_ci_upload.py parses dagger/ci.py as text, so it needs no
dagger engine, and asserts that the one exclude list holds `.env`. It failed before the change
(the list without the entry, 1 failed) and passes after; with the two test files that read the
workflow files, 16 passed. ruff, mypy, the three gates and compileall pass, and the gates print
what they printed before the change. An independent reviewer approved the change in one round;
its remarks on the wording of the comment and of the test, and on the failure message of the
test, are applied.

Left for the maintainer's menu, not decided: excluding `.env.*` files as well (a bare pattern
would also drop `.env.example`, which a test reads), an in-container check that fails the
pipeline if the file ever got in, and `__pycache__` directories, which a local run uploads.
2026-11-25 18:37:30 +01:00
Marius Ciepluch 8998697b4e fix(contributor-scan): the MCP server answers a tool that stops the CLI and stays up (3.1, follow-up)
By the maintainer's decision of 2026-11-25, recorded in the handover: "McpServer.handle
catches Exception only, so a missing scan path raises SystemExit through it and ends the stdio
loop; openultrasast.scan and openultrasast.benchmark both take that path. One bad call would
become an error result for that call and the server would stay up."

`McpServer.handle` in src/openultrasast/mcp.py catches `SystemExit` beside `Exception` and
answers with the error it already builds for any exception a tool raises: `-32603` with
`SystemExit: scan path is not a directory: <path>`. The stdio loop reads on, answers the next
request and exits 0 at EOF; before, the process exited 1 with that message on stderr and nothing
on stdout. `openultrasast.benchmark` takes the same clause when the manifest names a source path
that does not exist. No other path changes: the notification return comes before the `try`, a
line that does not parse is answered in `serve`, and `cli.py:588` is the only `SystemExit` a tool
handler can reach (the independent reviewer's trace), raised before the configuration is loaded
and before a run directory is created.

"Error result" is read as that JSON-RPC error: the decision names `handle`, and the handover
keeps this channel apart from `isError: true`, which `_call_tool` builds for `McpToolError`. A
missing path therefore travels a different channel from a missing `path` argument or an
unsupported mode; that is left for the maintainer's menu, with one pre-existing gap the reviewer
found: a line that is valid JSON but not an object still ends the loop.

Tests: through `serve`, a tools/call for `openultrasast.scan` with a missing path followed by a
ping gives the error object and then the ping result, and `serve` returns 0; through `handle`,
the same call gives that error object. Both failed on the code as it was, each with the
`SystemExit` raised through the function it calls (the first in my run, the second in the
reviewer's, on a copy of the code before the change); the second pins that the catch sits in
`handle`, the public dispatch, where a catch in `serve` alone passes the first. The 23 test files
around the scan path and the MCP server pass (242 passed before the second test was added, and
`tests/test_mcp.py` 18 passed after); ruff, mypy, the three gates and compileall pass, and the
gates print what they printed before the change. The real `ousast mcp` process, fed the same two
lines, answered both and exited 0 with an empty stderr. An independent reviewer approved the
change in one round and proposed the second test.
2026-11-25 18:14:06 +01:00
Marius Ciepluch 52c9afb85f feat(contributor-scan): a scan says how many source files it left out under its runs directory (3.1, follow-up)
`56c4620` made a scan skip its runs directory when it lies inside the scanned
path, and said nothing about it. By the maintainer's decision of 2026-11-25,
recorded in the handover, the scan now prints one notice. The decision, as the
handover records it: "When source files lie under the runs directory inside the
scanned path, the scan prints one notice: line naming the path and the number
left out, the way run retention does."

The line is `notice: skipped <n> source files under the runs directory <path>`
(`source file` at one). `ousast scan` prints it, the `openultrasast.scan` tool
returns it among its notices, and `openultrasast.benchmark` returns the notices
of the scan it runs. Nothing is added to the manifest or the report.

The count follows the scanned tree's own rules, so it is the number the skip
took: a source file that the target's root `.gitignore` already keeps out, or
that lies under a directory the scan ignores, brings no notice, and a
`.gitignore` inside the runs directory does not hide what was left out. To that
end `enumerate_source_files` in src/openultrasast/preprocess.py and the new
`count_skipped_source_files` share one private predicate,
`_is_read_as_source`. The enumeration returns the lists it returned before
(the skip test now comes first, so a path under the skipped directory is no
longer stat'ed). The count is taken after the preprocess stage, so a tree
whose ignore file cannot be read stops the scan inside that stage, as before.
It costs one more read of the target's root `.gitignore` and, where there is
one, one more `git ls-files`, and only when the runs directory lies inside the
scanned path.

Nothing is said when no source file is left out, when the runs directory lies
outside the scanned path, or when it is the target or lies above it.

Tests: the notice tests failed on the code as it was (6 failed) and pass after
the change. Four more failed on a first cut that counted by the runs
directory's own `.gitignore` and pass on this one: a `.gitignore` inside the
runs directory does not hide what the scan left out, nothing is left out where
the target already ignores the runs directory, nothing under a directory the
scan ignores, and a directory named `.gitignore` costs the scan nothing. The
test that a target inside the runs directory is read as it was now also pins
that nothing is said; a count that covered that target failed it. The 23 test
files around the change pass (241 passed); ruff, mypy, the three gates and
compileall pass, and the gates print what they printed before the change.

An independent reviewer approved the change in two rounds. Its first round
found the count by the wrong rules, which this cut closes. Its second round
named two things that are left open and recorded in the handover: were the
target's root `.gitignore` to become unreadable between the preprocess stage
and the count, the scan would stop with no failed stage recorded in its trace
and no manifest; and no test pins that a tracked source file under an ignored
runs directory is counted.
2026-11-25 17:15:13 +01:00
Marius Ciepluch 56c4620087 feat(contributor-scan): a scan skips its runs directory when it lies inside the scanned path (3.1, follow-up)
Since part A a native scan writes its run under the user cache or wherever
`OPENULTRASAST_RUNS_DIR` points. A scan of a path that contains that directory,
a home directory or a tree with the runs directory set inside it, took the
files under it for source: those of earlier runs and those of its own run. On
the code as it was, a source file under the runs directory inside the target
was read and its finding reported (`file_targets=3 findings=2` for a tree of
two files and one such copy).

By the maintainer's decision, recorded as step 2c of the handover, the scan
skips the runs directory only: `config.runs_dir`, the default location or the
override. The other directories under `~/.cache/openultrasast` are read as
before, and so is every tree whose runs directory lies outside it.

`preprocess_repository` and `enumerate_source_files` in
src/openultrasast/preprocess.py take a `skip` directory, and the preprocess
stage of a scan (`_map_scan_targets` in cli.py) passes `Path(config.runs_dir)`.
The skip applies only where the runs directory lies inside the scanned path:
a target that is the runs directory or lies inside it is read as it was, so a
runs directory set to `.` does not silence a scan. Both paths are compared
resolved, so a symlinked or relative name is found, and the excluded path is
built under the root as the walk spells it, so a relative root works too. Every
other caller of the two functions passes no `skip` and is unchanged.

No run of this package keeps a source file today (the independent reviewer's
count: a quick run holds 15 files, all `.json`, `.jsonl`, `.md` or `.sarif`;
the two benchmark runs in the real cache hold `.json` and `.toml`). The copy in
the tests is a constructed case.

Tests: four tests failed on the code as it was and pass after the change: the
runs directory inside the scanned path, by the override, by the default
location and by the override through a symlink, and the rest of the cache
still read. Two more pin the narrow reading, a target that is the runs
directory or lies inside it is read as it was; they failed on a first cut
that skipped more than was decided. A direct call with a relative root pins
the path comparison. The nine test files around the change pass (113 passed),
as do the 37 files that exercise the scan path (362 passed); ruff, mypy, the
three gates and compileall pass. Runs of the real CLI on one scratch subject,
the code at HEAD against this tree: with the runs directory inside the target
the copy under it is no longer read (`file_targets=4 findings=3` for five
source files); with the runs directory a parent of the target, or the target
itself, both read the same five files and report the same four findings. An
independent reviewer approved the change in three rounds; its first round
found that the first cut also silenced a scan whose target lay inside the
runs directory, which this cut narrows to the decided case.
2026-11-25 14:41:44 +01:00
Marius Ciepluch 9e4983f465 feat(contributor-scan): benchmark runs go beside the scan runs (3.1, follow-up)
`ousast benchmark` and its MCP twin wrote a run to
`<target>/.openultrasast/benchmarks/<id>/`, into the scanned tree, and no user
document said so. By the maintainer decision of 2026-11-24 a benchmark run now
goes to `<runs_dir>/<benchmark-run-id>/`, beside the scan runs, where run
retention removes it like a scan run.

`create_benchmark_run` in src/openultrasast/benchmark.py takes the runs
directory instead of the target. The two `_benchmark` functions, in cli.py and
in mcp.py, load the configuration the way `_run_scan` does and pass
`config.runs_dir`, so a benchmark run follows `OPENULTRASAST_RUNS_DIR` like the
scan it runs.

Both create the run once the scan has returned. Created first, as it was, the
run was under the scan's own retention while the scan ran, and a scan that
outlasted the retention window took it for an old one: the scoreboard could not
be written and the scan outcome was never printed. A failed scan now also
leaves no empty run behind.

README.md and docs/examples.md name where a benchmark run goes.

Tests: the three location assertions failed before the change and pass after
it. A new test pins that retention removes a benchmark run like a scan run, and
another that a benchmark keeps its run when its scan outlasts the retention
window. The nine test files around the change pass (120 passed); ruff, mypy,
the three gates and compileall pass. A run of the real CLI printed `run_dir=`
and `benchmark_run_dir=` as siblings under the runs directory and left only the
calibration ledger in the scanned tree. An independent reviewer approved the
change in two rounds; its first round found the retention window, which this
cut closes.
2026-11-25 10:40:01 +01:00
Marius Ciepluch 53a68907ea test(detection-core): give the measured seed budget headroom over its proxy workload
Forty-five tests in tests/test_detection_core_performance.py failed on the
GitHub runner (run 45352669096) with "measured budget gate failed", for
example 206ms>157ms. The seed budget is the slowest `_validate_work`
sample, and it gates the complete consumer run, which also derives and
encodes output. The two workloads scale differently per host: the complete
run measured 0.78 of the seed on the development machine and 1.28 to 1.41
on the runner. Through the final gate's nested run this was also the run's
eleventh failure.

The seed is now doubled before it is used. The budget that the tests
derive and assert is unchanged, and the gate keeps its teeth: with the
gated run slowed by one second the module fails (1222ms>1146ms), with a
quarter of a second it passes. No production code changes.
2026-11-24 20:16:23 +01:00
Marius Ciepluch 7c707d61f9 test(search-with-proof): flush the disk-bound write inside the program
tests/test_search_worker.py::test_run_timeout_truncation_and_disk_bound
failed on the ubuntu-26.04 runner (run 45352669096) with exit status 0,
where it requires a non-zero status. The runner's Python 3.14 buffers
131072 bytes by default, so a 16 KiB write to an unclosed file is flushed
only at interpreter exit, where the error is ignored. The program now
closes its file, so ENOSPC surfaces on every Python version.
2026-11-24 20:16:23 +01:00
Marius Ciepluch c4720ba186 test(search-with-proof): skip by cause where the host refuses the browser sandbox, a private network namespace or node
GitHub CI's checks job failed nine search tests on the ubuntu-26.04 runner
(run 45352669096), which has chromium and bubblewrap. Three causes:

- chromium prints "No usable sandbox!" inside the bubblewrap user namespace
  and does not exit. The browser test skips on that evidence in the launch
  error's cause, as it already did on "Operation not permitted" and
  "Permission denied"; an ordinary browser failure still fails.
- `unshare --user --map-root-user --net` is refused ("write failed
  /proc/self/uid_map: Operation not permitted"). The ssrf differential and
  the namespace handoff test probe that command first and skip when it
  fails. The other three differential families do not need it.
- The six node fixture tests could not run their app on the runner. They
  need /usr/bin/node, the path the demo launcher uses, and now skip when
  it is not executable. The runner's log does not name the missing path;
  hiding it locally reproduces the same six failures.

A present but broken node, or a browser that fails for its own reasons,
remains a failure.
2026-11-24 20:16:23 +01:00
Marius Ciepluch 17d46c0f93 feat(contributor-scan): remove scan runs older than 30 days from the default cache (3.1, run retention)
By maintainer decision. Since 6edae3a a native scan leaves a run directory
under ~/.cache/openultrasast/runs/ and nothing removed them. After a scan's
manifest is written, with no OPENULTRASAST_RUNS_DIR set, the runs in that
default location that are older than 30 days are now removed. The age comes
from the UTC timestamp in the run id, never from file times, so a copied or
touched directory is not misjudged, and a run exactly 30 days old is kept.

Never touched: the scan's own run; anything not named exactly like a run
(only direct children of the runs root whose name is a run id); symlinks,
which are neither followed nor removed; and any location chosen with
OPENULTRASAST_RUNS_DIR, even when it resolves to the default.

OPENULTRASAST_RUNS_RETENTION_DAYS sets the number of days and 0 keeps every
run. A failed prune never fails the scan: it is one notice on the command
line, and the MCP scan and benchmark results now carry a notices key. A
retention longer than the calendar and a directory tree too deep to remove
are both turned into that same behaviour.

Known limits, on record: a removal that fails part-way leaves the run half
deleted and it is retried on every later scan; the prune stops at the first
failure; a clock set far ahead removes earlier runs; a filesystem mounted at
or under an expired run is emptied before the removal fails.

Tests: tests/test_run_pruning.py drives the function and the real command
line (34 tests); tests/test_mcp.py pins the notices. The reviewer attacked
the deletion path with about sixty hostile inputs and twenty-three mutations;
all are killed or kept safe.
2026-11-24 17:51:37 +01:00
Marius Ciepluch 6edae3a585 feat(contributor-scan): a scan writes its run to the user cache, and the ledger only when it learns (3.1, part A)
Where a scan writes. A native scan now creates its run under the user cache,
~/.cache/openultrasast/runs/<scan-id>/ by default ($XDG_CACHE_HOME when it is
set and absolute), prints run_dir=<path> once, and no longer writes anything
under the analysed tree. OPENULTRASAST_RUNS_DIR still wins: an absolute value
is used as given, a relative one resolves against the working directory.
Pre-push storage is unchanged.

The calibration ledger, by maintainer decision: .openultrasast/calibration/
stays the store, and a scan writes the false-positive ledger into the tree
only when its content would change. On a read-only tree the scan records
ledger_not_written, with a sentence in the report, and completes; before, a
read-only target with one rejected finding crashed before report.md existed.

benchmarks/repos/measure.py follows the printed run directory. It read the
run from under the scanned copy, which would have recorded every repository
as failed, and it also read a stale run left in a copy.

Tests: tests/test_scan_output_location.py drives the real CLI and compares
the whole tree before and after; tests/test_repo_measure.py pins the
measurement script; an autouse fixture keeps every test's scan runs out of
the developer's cache; fourteen test files follow the run to its new place.
README, docs/examples.md and the scan skill name the ledger as the one write
a scan makes. _run_scan is touched by one line and stays over the complexity
cap.

Task 3.1 stays open for part B, the readable summary.
2026-11-24 15:33:35 +01:00
Marius Ciepluch 90170380ec fix(docker): keep the reserved populations out of the image (contributor-scan 3.2)
The root image copies benchmarks/ (Dockerfile:43), and .dockerignore let benchmarks/valid
and benchmarks/unseen through, about 18 MB of reserved-population material.
RELEASE_NOTES.md says every version tag is pushed to ghcr.io/norandom/openultrasast.
Decided by the maintainer on 2026-11-24: both stay out of the image.

The scan path reads neither. The one run-time reader is the hunter's contamination report
(hunt/contamination.py), which runs from a checkout: a missing pool contributes nothing to
it, and it imports benchmarks.unseen.eligibility late, so inside the image that report has
no eligibility module and fails at the import rather than silently.

A test pins both patterns and fails if a later negation lets either back in. The built image
is checked for their absence in task 3.2 part 2, when it is rebuilt.
2026-11-24 14:25:30 +01:00
Marius Ciepluch 89d08e01d3 fix(contributor-scan): build the image from the pinned base and keep runs on the writable mount (3.2, part 1)
`docker compose build` has failed since 1b9d1ca (2026-10-05): the Dockerfile requires the task
base's tag and digest and deliberately has no floating fallback, but the compose file passed
neither argument. Compose now defaults both from plane/task-base.digest, the pin CI builds
from, and a test fails when the two drift apart or an argument goes missing.

The service also sets OPENULTRASAST_RUNS_DIR=/reports/runs, so a scan's run directory lands on
the one writable mount (Req 6.3) whatever the default location is.

Built and verified once, with no scan (2026-11-24, 11:02Z to 11:10Z): `docker compose build`
exit 0 in 8m03s, the Joern zip passing its sha512 check, and inside the image the CLI usage,
native PHP 8.4.26, lib/io.joern.joern-cli-4.0.625.jar, the installed package, and the pinned
base's 12 layers and 24 history entries as the image's prefix. That image held HEAD's source
and was removed from the build machine by a Docker prune at 12:56Z.

Task 3.2 stays open: the image must be rebuilt after task 3.1 lands, and part 2 (a real scan
through the image and the shell wrapper, parity with a native run) is not done. Known for part
2: on a fresh checkout Docker creates ./reports root-owned and the image runs as uid 1000, so
the first run cannot write its output.
2026-11-24 14:04:33 +01:00
Marius Ciepluch 4c5b5d7932 test(contributor-scan): pin tier-zero pruning at the scan boundary (5.14)
Four regression tests for the mechanism that landed in 9a8e9f0 and 3b6e642:

- a family absent from the repository is never asked, at callDepth 0 or 3;
- the evidence that prunes a question is asked over that question's own
  scope and at the arbiter's callDepth;
- a pruned question is recorded as deferred with reason tier_zero and
  never as an outcome;
- an evidence summary that does not say the family is absent excludes
  nothing.

Each test was shown red under a control that breaks only the rule it
names. The engine's half of the rules (familyInRepo over the whole graph,
the reachable-set scope above depth 0) is verified by reading taint.sc
only; no executable test pins it.

Task 5.14 stays open: its Observable also asks whether the query completes
on pmpro, and the record on file (2026-09-22) answers that it does not.
2026-11-24 11:43:37 +01:00
Marius Ciepluch 28f160419a test(valid-detection-benchmark): add the opt-in full-scale rehearsal
One test runs the whole lifecycle at 840 inputs with every planned arm and
the per-population review subject, so a correctly reviewed full-scale run
completes for the first time. It is skipped unless
OPENULTRASAST_FULL_SCALE_REHEARSAL=1 and records per-stage wall-clock
seconds. The default path is unchanged: the new ScaleLifecycle arguments
default to None and the timing wrapper always calls its stage.
2026-11-24 07:41:26 +01:00
Marius Ciepluch 081adfc052 test(valid-detection-benchmark): route the harness spends through the production spend stage
The end-to-end and scale harnesses committed the shared custody spend by
hand. They now bind the production stage (bind_case_adapter_spend_stage)
through one shared helper that predicts the release review subject before
the spend, so the harness exercises the same path the adapter replay
binds. The failure-injection copy stays a raising fault injector so the
failure matrix keeps its pinned outcomes.

The sealed release the harness persists now has the production shape
(schema version and review covered by the release digest); nothing
pinned the old five-key payload.
2026-11-23 21:54:42 +01:00
Marius Ciepluch 2951f7d53a fix(valid-detection-benchmark): refuse a wrong-typed stage product as an instrument failure
A run stage that returned None or a product of another type escaped the run
command as a raw AttributeError, or was passed on to the next stage. The
run command now type-checks every stage product against its declared type
and persists an IMPAIRED outcome at that phase with reason
INSTRUMENT_FAILURE; the spent flag stays what durable custody says. Seam
refusals are still re-raised and the INTERRUPTED path is unchanged.
2026-11-23 20:15:28 +01:00
Marius Ciepluch f9d29aa6e8 fix(valid-detection-benchmark): bind a production spend stage for the adapter path
Add bind_case_adapter_spend_stage and export it from the run module: the
stage derives the preparation from the adapter request and commits the
shared spend through commit_preparation_spend_and_release, so a receipt
minted on this path satisfies the core's shared-spend validation. The
legacy release is refused on the same path (contrast test).

The bound stage refuses a stage product that differs from the execution the
request was validated for, before any custody read or write.
2026-11-23 20:15:21 +01:00
Marius Ciepluch 5fdf65e02d fix(valid-detection-benchmark): mint the shared spend receipt from the preparation
Add commit_preparation_spend_and_release: the shared label spend mints its
custody receipt from preparation.label_release_request, which is what the
core's shared-spend validation requires (arm id and influenced artifact
digest of the authority). commit_spend_and_release keeps its behaviour and
its mint order; its receipts cannot satisfy a preparation and are refused by
the replay, as a contrast test now pins.

Closed refusals, all before any write unless stated: wrong preparation type,
head unavailable or moved (no CAS), lost CAS, labels unreadable after the
committed spend (labels_spent true).
2026-11-23 20:15:09 +01:00
Marius Ciepluch d9b7aaa6ac feat(pre-push-safety-net): exclude the memory family explicitly and document the scope line
- advisory-scope.json names the taxonomy family memory as excluded, with
  the registry-grounded reason and what a run does not tell
- docs/scanning.md shows the Scope line exactly as the hook prints it
- the loaded-scope guard moves into a helper, so __post_init__ keeps its
  complexity of 14
2026-11-23 13:45:27 +01:00
Marius Ciepluch 364b4c0777 test(valid-detection-benchmark): pin each fix-site key element and non-integer closure totals
- one sourcing-queue pair per fix-site key element (path-only,
  function-only), each proven red by dropping that key line alone
- the closure decode test covers a self-consistent bool total next to
  the float total
- the _request_order docstring names the two ties that remain open
  (fix revisions; shared candidate digest with another family or CWE)
2026-11-23 13:31:01 +01:00
Marius Ciepluch b82b52f976 feat(pre-push-safety-net): declare the provisional advisory scope and print it on every run
One packaged record (advisory-scope.json, shipped in the wheel beside eligibility.json) states the provisional scope, every exclusion with its reason, and what each exclusion leaves untold. The hook renders exactly one bounded Scope line per run in every state (provisional, with defects, record unavailable) and the artifact carries the record under advisory_scope. The record is provisional if and only if the shipped registry is NO-GO with no enabled declaration.

Task 15.2. The task text cites a requirement 5.6 that does not exist, so this is implemented against 3.1, 5.1, 7.1 and 7.3.
2026-11-23 13:01:01 +01:00
Marius Ciepluch 0d5aaeecca test(valid-detection-benchmark): cover a non-permissive license class behind an allowlisted expression
The license_class conjunct of the public-material partition had no mismatch fixture. NON_PERMISSIVE and UNCERTAIN sources with an allowlisted expression and an approval are now pinned to the private partition.
2026-11-23 11:40:09 +01:00
Marius Ciepluch 67bc37cac6 fix(valid-detection-benchmark): break sourcing-queue ties on fix-site path and function
Candidates that differed only in fix-site path or function were selected by input order under the queue cap. Both scalars are now part of the request order, so cap selection no longer depends on input order for them.
2026-11-23 11:40:09 +01:00
Marius Ciepluch 9e884e8342 fix(valid-detection-benchmark): require a strict integer for the accepted positive total
total_accepted_positives accepted floats and booleans on both the direct and the decode path. Both now fail closed with STATE_MISMATCH through one sibling helper that keeps _validate_closure within the complexity cap.
2026-11-23 11:40:09 +01:00
Marius Ciepluch 60bb7f0bdd fix(valid-detection-benchmark): fail cohort selection closed on a malformed pending ledger
_ledger_facts accepted any pending_entries value and turned it into a set; a ledger outside the durable shape is now a STATE_MISMATCH on both selection rounds. The _pending_by_ecosystem docstring now states the conflicting-accepted-review corner accurately.
2026-11-23 11:40:09 +01:00
Marius Ciepluch 7e6da2efae fix(valid-detection-benchmark): normalize mixed-case .git suffixes in reservation identity
A reference such as OWNER/REPO.GIT escaped the reserved-identity check at both reservation sites because the suffix was stripped case-sensitively. One shared strip now handles the suffix case-insensitively; identities without a mixed-case suffix are byte-identical.
2026-11-23 11:40:09 +01:00
Marius Ciepluch f2093a5380 fix(valid-detection-benchmark): floor scale runtimes at one millisecond
The 11.5 review noted that the scale validator accepted runtime_ms >= 0,
so a sub-millisecond or frozen-clock reading could be recorded as 0 ms.
Clamp every recorded runtime (per-arm, streaming, lane) to at least 1 ms
and tighten the validator to > 0. A frozen-clock test proves all three
floors; it fails against the previous source (0 ms receipts).
2026-11-23 11:05:20 +01:00
Marius Ciepluch f30a5d2cb2 style(valid-detection-benchmark): apply ruff format to 10.x/11.x test files
`ruff format --check src tests` failed on the 17 test files and helpers added by tasks 10.x and 11.x. Formatting only: the AST of every file is unchanged.
2026-11-23 09:27:41 +01:00
Marius Ciepluch a68796610a feat(valid-detection-benchmark): 11.5 streaming scale bounded validation and back-pressure 2026-11-23 06:21:43 +01:00
Marius Ciepluch 66ec3e1a31 feat(valid-detection-benchmark): 11.4 spend-ordering crash and failure-visibility matrix 2026-11-23 03:51:56 +01:00
Marius Ciepluch da5323002e feat(valid-detection-benchmark): 11.3 end-to-end lifecycle with case adapter and hostile-decode retrofit 2026-11-23 02:50:12 +01:00
Marius Ciepluch 73c8a9d6b3 feat(valid-detection-benchmark): 11.2 persistence custody and scratch-loss suites 2026-11-22 23:28:46 +01:00
Marius Ciepluch 936835477a feat(valid-detection-benchmark): 11.1 governance and confidentiality adversarial suites 2026-11-22 23:01:01 +01:00
Marius Ciepluch c587f25bb3 feat(valid-detection-benchmark): 10.7 freeze and causally bind replacement baseline 2026-11-22 22:27:09 +01:00
Marius Ciepluch 93ebea7b93 feat(valid-detection-benchmark): 10.6 draw and validate ordinary-change population 2026-11-22 21:38:26 +01:00
Marius Ciepluch c2b5f5bc92 feat(valid-detection-benchmark): 10.5 ingest fourth cohort and close positive set 2026-11-22 20:12:03 +01:00
Marius Ciepluch 6d66501192 feat(valid-detection-benchmark): 10.4 select and ingest third reviewed cohort 2026-11-22 19:16:54 +01:00
Marius Ciepluch 408a562c41 feat(valid-detection-benchmark): 10.3 ingest bounded reviewed JavaScript/TypeScript cohort 2026-11-22 18:42:51 +01:00
Marius Ciepluch 825e680804 feat(valid-detection-benchmark): 10.2 ingest bounded reviewed Python cohort 2026-11-22 10:25:59 +01:00
Marius Ciepluch 34344234d5 feat(valid-detection-benchmark): 10.1 create bounded sourcing and review queues for both initial ecosystems 2026-11-21 21:29:52 +01:00
Marius Ciepluch d81255e256 style(valid-detection-benchmark): apply repo formatter to R1 test files 2026-11-21 19:28:10 +01:00
Marius Ciepluch 38e12282da feat(valid-detection-benchmark): 9.3 publish benchmark-only run, resume, and status commands 2026-11-21 19:27:27 +01:00
Marius Ciepluch 4085f236f3 feat(valid-detection-benchmark): 8.6 resume exact pre-spend and post-spend workflows without changing authority 2026-11-21 17:39:10 +01:00
Marius Ciepluch 6fad162962 feat(valid-detection-benchmark): 8.5 produce every scoped report and one complete evaluation replay 2026-11-21 16:34:30 +01:00