Commit Graph
25 Commits
Author SHA1 Message Date
Marius Ciepluch d9205fd267 docs(ops): say where ousast pairs and ousast repos find their defaults (item 5b)
The maintainer's answer 6 of 2026-11-27, "Document: run from checkout"
(.kiro/handover.md:1333-1334): "one sentence in ops/README.md; no code changes." In
the handover's options for that question (:1422-1430): "run them from the checkout
root, as every page shows."

What changed
- ops/README.md, at the end of "Use it as a command", after the paragraph on the
  native route (lines 40-42): "With their defaults, `ousast pairs` and `ousast repos`
  need the root of the checkout as the working directory, which under the wrapper means
  a native run: `benchmarks/pairs/catalog.toml` and `benchmarks/repos` are read from
  the current directory."
- No code change, no test change.

The session's reading of the answer
- The sentence names the native run, which the answer's sentence does not. Measured
  below, the checkout root does not help through the wrapper's container path: the
  container's working directory is /work (docker-compose.yml:37), never the checkout.
  The image holds a copy of both defaults in /app, so the need is the wrapper's, not
  Docker's; the sentence says so.
- The sentence does not repeat "as every page shows". The pages show the two commands
  (docs/examples.md:66-70, README.md:331, benchmarks/pairs/README.md:126-128,
  benchmarks/repos/README.md:16-18); by reading, none of these four places says in
  which directory they are run. So the sentence gives the reason instead.

Measured (/tmp/opencode/s10_c6_probe.sh, output s10_c6_probe.out, 17:32:07Z to
17:32:13Z; each run file starts with its command, the wrapper files with a one-line
description of the call)
- From an empty directory, the CLI directly and natively: `pairs` ends with "pair
  catalog is not a file: benchmarks/pairs/catalog.toml", exit 1
  (s10_c6_native_elsewhere_pairs.out); `repos` with "no repository recipe matches
  'all' in benchmarks/repos", exit 1 (s10_c6_native_elsewhere_repos.out).
- The same two through the wrapper's native path, with stubs of joern and joern-parse
  ahead on PATH, never called (s10_c6_wrapper_native_elsewhere_pairs.out,
  s10_c6_wrapper_native_elsewhere_repos.out).
- From the checkout root, natively: `repos` lists seven recipes, exit 0
  (s10_c6_native_root_repos.out). `pairs --slice sast --json` ends with exit 0 and
  18,013 bytes of JSON, with per_slice.sast.pairs 11 and achievable.sast.pairs 10
  (one known limit, src/openultrasast/pairs.py:467), and without the lookup's message
  (s10_c6_native_root_pairs.out for the exit and the message;
  s10_c6_native_root_pairs_full.out for the bytes and the two counts). joern was not
  on PATH for that run; what scored the pairs was not examined.
- From the checkout root, through the wrapper's container path (OUSAST_PREFER_NATIVE=0;
  the image openultrasast:dev 3f959b31f2f2): both end with the same two messages, exit
  1 (s10_c6_wrapper_container_root_pairs.out,
  s10_c6_wrapper_container_root_repos.out). No container remains
  (s10_c6_wrapper_container_index.out).
- A separate run at 17:40:30Z, not from the probe: in the image's own working directory
  /app (Dockerfile:38), a plain `docker run` with no mount and no network, `repos`
  lists the seven recipes, each absent in the container, exit 0
  (s10_c6_image_app_repos.out). `pairs` was not run there.

By reading, not measured
- Where the defaults come from: src/openultrasast/pairs.py:47-53 and
  src/openultrasast/repos.py:34 hold relative paths. The two stops are at
  src/openultrasast/cli.py:1156-1157 and :1178-1180.
- The image's copy: Dockerfile:44 copies benchmarks, and .dockerignore excludes
  nothing of benchmarks/pairs or benchmarks/repos.

Checks, on the final text
- `mkdocs build --strict` into scratch: exit 0 (s10_c6b_mkdocs.out); the built page
  holds a phrase from each of the sentence's three lines once, and the first wording
  zero times (s10_c6c_site_sentence.out).
- tests/test_docs_site.py and tests/test_removed_plane_references.py: 8 passed
  (s10_c6b_docs_tests.out).
- Gates (s10_c6b_exits.txt): ten zeros; the three gate outputs equal the baseline's.

Found and not fixed, for the maintainer
- `ousast model candidates` has the same default for its catalog
  (src/openultrasast/cli.py:262), and `ousast plane harvest` for its own (:324). The
  sentence names the two commands of the answer. Neither was run.
- The pages that show the two commands do not say where they are run from (above). The
  answer puts one sentence in ops/README.md.
- Through the wrapper's container path the two commands cannot reach their defaults,
  by reading from any directory. A reader with Docker alone is told that they need a
  native run, not what to do instead.

Not checked
- ops/shell/ousast.ps1 was not read for this change.
- `ousast pairs` with --catalog, and `ousast repos` with --dir, through either path.
- `ousast pairs` in the image's /app.
- The whole test suite.

Review
- Review: three rounds against d8b4cac, by one reviewer subagent. Round one blocked
  on the message alone (the sast slice holds 11 pairs, 10 of them achievable) and
  remarked that the image keeps its own copy of both defaults in /app, that the
  sentence separated the code block from the paragraph that explains it, and that
  "each file starts with its command" held for the run files alone. On those: the
  sentence moved to the end of the section and says that the need for a native run is
  the wrapper's; `repos` was measured in /app. Round two approved the diff and blocked
  on one line citation in the message (40-42). Round three left the diff approved and
  blocked on one clause, that the /app run is a separate run; it is now marked so.
  Docker was run by the session alone, never by the reviewer.
2026-11-27 18:48:37 +01:00
Marius Ciepluch d1f61fbe6f fix(contributor-scan): the wrapper writes its runs to the user cache (item 5a)
The shell wrapper wrote the runs of the image to ./.ousast, inside the repository it
was scanning (the eighth session: three runs under it). It now creates
~/.cache/openultrasast/runs, mounts it at /reports, the one writable mount, and passes
-e OPENULTRASAST_RUNS_DIR=/reports to its compose run, so nothing is written to the
scanned directory.

The override is the maintainer's choice of 2026-11-27, on a measurement. Answer 4 of
the menu of 2026-11-26 was worded as the mount alone. Measured that day: compose sets
OPENULTRASAST_RUNS_DIR=/reports/runs in the service, so the mount alone put the run on
the host at ~/.cache/openultrasast/runs/runs/<run>, one level below a native run, and
nothing prunes it there (prune_old_runs removes only run directories directly under the
root whose names match the run id). With the override the run lands beside native runs.
Two things the choice does not change: a scan in the image never prunes, so the
wrapper's runs are removed by a later native scan on the default location; and the
wrapper writes to ~/.cache/openultrasast/runs whether or not XDG_CACHE_HOME or
OPENULTRASAST_RUNS_DIR moves a native run elsewhere.

ops/shell/ousast.ps1 gets the same change, the maintainer's second choice: it writes
%USERPROFILE%\.cache\openultrasast\runs and passes the same override. That file was
edited by reading and WAS NOT RUN: there is no PowerShell on this machine.

Tests: tests/test_shell_wrapper.py has a third test. It failed before the change (no
runs directory under HOME) and again until the override was passed. After: 3 passed.
Measured on 2026-11-27 through the shell wrapper with the real Docker, from a
directory without .env, both API keys unset: `ousast scan examples --mode quick` on a
copy of libpng's contrib/examples prints run_dir=/reports/<run>, the container prefix,
with file_targets=4, findings=4, exit 0; the run is on the host directly under
~/.cache/openultrasast/runs, owned by the user; the scanned directory stays empty.
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 one round; its remarks on the README
clause, on the test, on the evidence and on the width of one line are applied.

Left as it is, for the maintainer: with HOME unset the shell wrapper now fails, where
it wrote ./.ousast before ($HOME is empty, so the path is /.cache/openultrasast/runs,
and a failed mkdir is not checked, as it was not before).
2026-11-27 09:56:27 +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 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 8daca3df76 docs(plane-on-kubernetes): the pages that placed the plane in the kind cluster say it is stopped
By the maintainer's decisions of 2026-11-25 and 2026-11-26, recorded in the handover. The
question: "The local kind cluster is stopped since 2026-11-24, and three pages still say in
the present tense that the plane runs in it ... Fix them?" Answer: "One docs commit now", as
offered: "The statement step 3 made in the other pages: the cluster is stopped and its code
stays. The docs tests and a reviewer, as for step 3." Four smaller leftovers chosen in the
same menu are done here too: "Reword three link sentences", "Drop Today's in
deployment.md", "Note the proof on kind" and "Note the probe on kind".

The three pages: `docs/ops/ax/README.md` and `docs/where-we-stand.md` take the sentence of
`3a34929` ("That cluster is stopped since 2026-11-24: the code stays, `ops/ax/up.sh`
recreates the cluster, and whether the executor code is deleted is decided at the plane
re-plan"). `ops/ax/README.md` lines 3-4 are one sentence now, as the second menu decided,
and still two lines, because `docs/ops/ax/README.md` includes that page from its line 5.
For that reason the clause "`ousast plane run` submits, resumes, starts and collects" left
those two lines; it stays in the docs page's own paragraph.

The link sentences in `README.md`, `ops/README.md` and `docs/index.md` say what
`docs/deployment.md` holds, in the page's own words: how the plane was deployed on the
maintainer's host, and what moving it to a separate cluster would take. In
`docs/deployment.md`, "Today's EndpointSlice" is an undated statement about the kind
profile. Two dated notes say what waits for the cluster: the replay proof of 5.4 on kind,
and the kind half of the probe of task 3.2 in the parked search-with-proof spec.

Left alone, as decided: `ops/ax/README.md:20`; the rewrite of `ops/ax/README.md` and
`docs/ops/ax/README.md`, and k3s against kube-ax, wait for the plane re-plan.

Tests: the seven test files that read these pages (`test_docs_site.py`,
`test_removed_plane_references.py`, `test_plane_literals.py`, `test_plane_profile.py`,
`test_obligation_siblings.py`, `test_learn_experiments.py`, `test_config.py`): 113 passed
before and after the change. `git diff --check` is clean, and `mkdocs build --strict`
builds the site into a scratch directory. An independent reviewer approved the change in
one round; its remarks on the probe's kind half and on the style of the two notes are
applied.

Outside this commit, from the reviewer: `.kiro/specs/plane-on-kubernetes/tasks.md` has
"4.4 Kind proof and record 04", while `roadmap.md` places 4.4 on kube-ax.
2026-11-26 10:59:35 +01:00
Marius CiepluchandClaude Opus 5.5 591818d5fc pre-push(17.6): install, Docker wrapper and first-run docs
`ousast pre-push install|uninstall [REPO] [--force] [--docker]` ships in the
wheel with the hook as package data; it honours core.hooksPath, refuses an
existing hook unless --force (which chains it as pre-push.before-ousast), and
uninstall restores the chained hook. ops/ousast-docker is a hook-callable
script: the repository read-only and the artifact directory at their own
paths, stdin passed through, no network, --memory 3g, the GHCR 2.0.1 image by
default, advisory exit unless blocking. Help text for every pre-push flag; a
first-run guide, settings, skip-reason glossary, CI recipe and full --help in
docs/scanning.md; README tiers 1 and 2 pull the published image. The image
was not rebuilt: 1.1 GB free, below the 4 GB threshold. Requirements 7.4, 9.6.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
2026-10-02 22:51:22 +02:00
Marius CiepluchandClaude Fable 5.1 5aac7eac36 docs: audit against v2.0.0; deployment guide (local ax and a separate Kubernetes cluster)
Every README and docs page checked against ousast --help, the code and the committed records. New docs/deployment.md (in the nav): what runs where today, this host's setup (up.sh, doctor, smoke Run, footprint), step-by-step guidance for a separate Kubernetes cluster with implemented vs planned stated per item (no cluster deployment has been made; kube context and doctor's registry check are hard-coded in doctor.py, egress.py, router.py), and what the plane/ manifests need changed. Decision-engine pages state slice 2 (six families, pooled and within-pair AUC, BLOCK offered nowhere, canary below 0.9 for three families, positives-only inflation) and that the engine is not adopted; exp-002 registered, not run, no result quoted. Fixed: model/judge.py reference (now model/pipeline.py), missing-key behaviour, .env reference (OPENROUTER_EMBEDDING_MODEL, store variables), docs extra, plane memory-normalise and ousast index listed, ax README's cluster table made precise. RELEASE_NOTES gets an Unreleased entry.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
2026-10-02 16:03:46 +02:00
Marius CiepluchandClaude Opus 5.5 32a2cb8bcf docs: describe the system as of 2026-10-02 (ax plane, AI decision engine, PHP, v3)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
2026-10-02 07:08:44 +02:00
Marius CiepluchandClaude Opus 5.5 df1dfa3b7a docs(plane): handover -- ops README points at the ax runbook; replaced scripts marked reference-only (task 9)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
2026-09-30 08:39:24 +02:00
Marius Ciepluch fa074dd197 feat(pre-push-safety-net): bound optional assistance to admitted witnesses 2026-09-13 18:03:31 +02:00
Marius Ciepluch 749c7ab45d feat(pre-push-safety-net): preserve existing hooks during explicit integration 2026-09-13 17:51:28 +02:00
Marius Ciepluch 530b9c9879 feat(pre-push-safety-net): reuse compatible artifacts throughout replay 2026-09-13 17:08:49 +02:00
Marius Ciepluch 31e5ec7430 feat(pre-push-safety-net): replay immutable revisions through the full transaction 2026-09-13 14:50:25 +02:00
Marius Ciepluch 6b12b73411 feat(pre-push-safety-net): render bounded reports and preserve full evidence 2026-09-13 13:25:44 +02:00
Marius Ciepluch d0e0ecad78 feat(pre-push-safety-net): admit only supported actionable changes 2026-09-13 12:56:55 +02:00
Marius Ciepluch eb320730b6 feat(pre-push-safety-net): compare targeted base and head evidence 2026-09-13 12:42:15 +02:00
Marius Ciepluch 6ba2b06353 feat(pre-push-safety-net): exclude vendor inputs and partition frontend coverage 2026-09-13 11:53:29 +02:00
Marius Ciepluch d02406e758 docs(pre-push-safety-net): record frontend retention prerequisite 2026-09-13 11:05:44 +02:00
Marius Ciepluch ebad83009e feat(pre-push-safety-net): connect change context to ranked questions 2026-09-13 10:41:32 +02:00
Marius Ciepluch 546db24b8e feat(pre-push-safety-net): preserve exact ranker scope and outcomes 2026-09-13 10:16:22 +02:00
Marius Ciepluch bd53b6dc9d feat(pre-push-safety-net): bound backend execution by one deadline 2026-09-13 10:03:03 +02:00
Marius Ciepluch 948ee020db feat(pre-push-safety-net): retain bounded change and rename context 2026-09-12 21:12:45 +02:00
Marius Ciepluch 56cfc9da89 feat(pre-push-safety-net): reproduce evaluated Joern runtime 2026-09-12 18:32:18 +02:00
Marius CiepluchandClaude Opus 5 adbb824eac feat(ops): a sourceable wrapper so docker is nobody's problem
source ops/shell/ousast.sh     # bash / zsh
    . ops\shell\ousast.ps1         # powershell

    ousast scan .
    ousast scan src/api

The container becomes an implementation detail. The engine is a JVM and ~2 GB
of Joern, and a contributor evaluating this tool should not have to install
either to try it -- what they get is a command.

Path rewriting is what makes it feel local: arguments under the working
directory are mapped to their mounted equivalents, so `src/api` means what the
user expects. Anything outside the mount is passed through unchanged WITH A
WARNING rather than silently rewritten into a path the container cannot see --
a wrong path that looks like it worked is worse than one that complains.

A native install wins when it is present. Someone who installed Joern
deliberately should not be quietly routed through a container, so the wrapper
uses a local joern-parse and venv when both exist; OUSAST_PREFER_NATIVE=0
forces the container. Verified end to end from an unrelated directory.

The image builds itself on first use and says why it is pausing. A first run
that prints a wall of build output and then works is worse than one that
explains itself.

Defaults stay conservative: the working directory mounts READ-ONLY, findings go
to ./.ousast as the only writable mount, and the network is off unless
`ousast-with-judge` asks for it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG
2026-09-08 19:37:58 +02:00
Marius CiepluchandClaude Opus 5 46232fe3e6 feat(ops): ship the tool and its engine in one image
A contributor should be able to run this with nothing installed but Docker:

  docker compose build
  TARGET=/path/to/repo docker compose run --rm ousast scan /target

One image rather than two services, and the reason is the seam. The model
layer reaches Joern by subprocess; putting both in the same image means Joern
is simply on PATH, so there is no container-to-container call, no docker socket
to mount, no host/container path translation, and no second code path in
cpg/backend.py to get wrong. Sibling services would need the tool to exec into
the engine's container, which means handing a linter the docker socket -- a
large amount of privilege for something that reads source code. The image is
big (a JRE plus ~2 GB of Joern); that is the honest cost of bundling an engine.

I had started building the two-service version with a docker-wrapper mode in
the backend and dropped it, tests included: once the engine is on PATH the
wrapper is complexity with no purpose.

Defaults chosen so an unfamiliar analyser is safe to try: the target mounts
READ-ONLY, /work is a tmpfs so CPG scratch never outlives the run or touches
the host, network_mode is `none` unless the LLM judge is wanted, and API keys
pass through the environment rather than into an image layer. mem_limit is set
because two Joern JVMs at once is what triggered an out-of-memory kill on a
7.7 GB machine during this feature's measurements.

pyinfra deploy kept for persistent host installs, with the same version pin and
the same checksum verification -- done as an explicit `sha512sum -c` step
because pyinfra's files.download offers sha384/sha256/sha1/md5 and Joern
publishes sha512. That mismatch was caught by validating against the installed
pyinfra rather than trusting the API from memory.

Both include php-cli: php2cpg drives PHP-Parser and shells out to a real
interpreter, and without it a PHP tree fails with an opaque "Process exited
with code 1" -- measured here, which is what makes a WordPress corpus feasible.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG
2026-09-08 19:36:10 +02:00