tools, instructions: Abhängigkeiten festgeschrieben - Lock-Dateien mit Hashes und 7 Tagen Abkühlzeit, Preflight-Stempel über das Lock, pip-audit und frische Auflösung im Nightly; Python 3.13-3.14 als zugelassene Spanne, CI auf beiden Enden (#245); 11.0.0-beta.1
CI / verify (push) Successful in 8m47s
CI / pwsh (push) Successful in 3m13s
CI / python314 (push) Successful in 5m35s
Converters / converters (push) Successful in 9m49s
Release / converters (push) Successful in 26s
Release / release (push) Successful in 39s
Release / wiki-mirror (push) Skipped

Files changed:
- .gitea/workflows/ci.yml
- .gitea/workflows/converters.yml
- .gitea/workflows/nightly.yml
- .gitea/workflows/release.yml
- .gitea/workflows/tracker-live.yml
- CHANGES.md
- INSTALL.md
- VERSION
- docs/dev/development.md
- docs/how-to/set-up-the-mcp-server.md
- instructions/dev/dependency-locks.md
- instructions/dev/publish-and-ci.md
- instructions/dev/stack-mode.md
- instructions/dev/tracker-testing.md
- instructions/mcp-read-server.md
- instructions/preflight.md
- tools/CONTRACT.md
- tools/README.md
- tools/chemenu/commands/dist_cmd.py
- tools/chemenu/commands/doctor.py
- tools/chemenu/install_doc.py
- tools/chemenu/prerequisites.py
- tools/chemenu/tests/test_dependency_locks.py
- tools/chemenu/tests/test_dist_cmd.py
- tools/chemenu/tests/test_doctor.py
- tools/chemenu/tests/test_install_doc.py
- tools/chemenu/tests/test_preflight.py
- tools/chemenu/tests/test_preflight_pwsh.py
- tools/lock_requirements.py
- tools/preflight.ps1
- tools/preflight.sh
- tools/prerequisites.txt
- tools/requirements-browser.lock
- tools/requirements-browser.txt
- tools/requirements-dev.lock
- tools/requirements-dev.txt
- tools/requirements-mcp.lock
- tools/requirements-mcp.txt
- tools/requirements.lock
- tools/requirements.txt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015uxGFdBAmyA23g1isCtGEY
This commit is contained in:
torbenandClaude Opus 5.5 committed 2026-11-18 21:34:20 +01:00
1 parent 0fce67e6b9
commit 37070ffae2
40 files changed
+3472 -159

No files matched your search

+140
View File
@@ -0,0 +1,140 @@
---
type: types/instruction.md
name: dependency-locks
description: How the Python packages of the stack are pinned and moved - the four lock files under tools/, regenerating them with the 7-day cooldown, lifting one package at once for a security fix without ever lowering it again, checking that no locked package was too young, and what a red nightly audit or fresh-resolution run asks for.
---
# Pin the stack's packages, and move them on purpose
Every Python package the stack or its CI installs comes from a lock under `tools/`: exact
versions with SHA-256 hashes, transitive packages included, installed with
`pip install --require-hashes`. Before Gitea #245 the requirement files carried lower bounds
only, CI installed whatever was newest that morning, and an instance kept the packages of the day
it was set up - CI went red after four quiet weeks when pytest 9.2 and typer 0.29.1 came out
(#243), and a compromised release would have reached the next install unchecked. Pins answer both
sides of faster attacks: nothing new flows in unchecked, and a known hole is closed by a
deliberate lift, at once.
<!-- wikitool:toc -->
## Contents
- [The files](#the-files)
- [When to run](#when-to-run)
- [Steps](#steps)
- [Decision points](#decision-points)
- [Scope](#scope)
<!-- /wikitool:toc -->
## The files
| Source (lower bounds) | Lock | Installed by | Ships |
|---|---|---|---|
| `tools/requirements.txt` | `tools/requirements.lock` | the preflight, every run whose stamp differs | yes |
| `tools/requirements-mcp.txt` | `tools/requirements-mcp.lock` | the user, by hand (command in the source's head); CI | yes |
| `tools/requirements-browser.txt` | `tools/requirements-browser.lock` | the preflight, `--with browser` and after | yes |
| `tools/requirements-dev.txt` | `tools/requirements-dev.lock` | CI and a developer: pytest, pytest-cov, radicale, pip-audit, uv | no (`TOOLS_DEV_ONLY`) |
`tools/lock_requirements.py` (dev-only) is the one way a lock is written. It resolves the four in
that order, each constrained by every lock above it (`-c`), because all of them land in one venv:
a package in two locks has one version, and a later `pip install -r` never moves a package an
earlier lock placed. `test_dependency_locks.py` holds every property below on each push.
The locks resolve for the Python minimum in `tools/prerequisites.txt` with `--universal`, so one
file serves Linux, macOS and Windows across the admitted span. A source file is never installed
itself - not by the preflight, not by CI (the same test reads every workflow for it).
## When to run
- **A regular lift** - a new package version is wanted, a source file's floor moved, or a lock is
simply due. It is a small stack package of its own: the locks, a patch bump, `publish`.
- **A security lift** - the nightly's `pip-audit` step is red, or an advisory names a locked
version. Same day, one package, no cooldown.
- **The nightly's fresh-resolution step is red** - today's regular lift would break the suite.
Not a lift yet: the defect it shows is fixed first, in a package of its own, and the lift
follows with it.
## Steps
1. **Have `uv` on `PATH`.** `requirements-dev.lock` carries it; in a checkout with the test tools
installed, `tools/.venv/bin/uv` is it.
2. **Regular lift - regenerate every lock:**
```bash
PATH="$PWD/tools/.venv/bin:$PATH" python3 tools/lock_requirements.py
```
It sets `--exclude-newer` to now minus 7 days: a file uploaded later is not considered. A
compromised release is usually found and pulled within hours to days; the cooldown lets that
happen before a lock can take one. Exceptions from an earlier security lift are carried over
while still younger than the cutoff and dropped once it passes them (step 3).
3. **Security lift - one package, at once.** `pip-audit` names the package and the first fixed
version X:
- Raise the floor in its source file to `<name>>=X`. It stays there for good - it is simply
true that vulnerable versions are no longer taken, and it is what keeps every later lift
from lowering the package again.
- Regenerate with an exception for that package alone, up to X's upload time plus a minute
(PyPI's JSON API shows it as `upload_time_iso_8601` per file):
```bash
PATH="$PWD/tools/.venv/bin:$PATH" python3 tools/lock_requirements.py \
--exception <name>=<upload time of X + 1 minute, e.g. 2026-11-17T09:31:00Z>
```
uv writes the exception into each lock's head beside the cutoff. **The invariant: no later
lift lowers the package below X.** While X is younger than the cooldown, the script carries
the exception into the next regular lift; once the cutoff has passed X, the exception is no
longer needed and drops out, and the floor stays. Without both, a lift would fail loudly -
"No solution ... filtered by `exclude-newer`" - rather than lower the package silently: that
is the floor doing its job, not a reason to remove it.
4. **Check the result.**
```bash
cd tools && .venv/bin/python -m pytest -q chemenu/tests/test_dependency_locks.py
```
It holds: an exact version and at least one SHA-256 per package; every source requirement
pinned at or above its floor; one version per package across the four locks; each lock
constrained by the ones before it; and **no package younger than 7 days** - the lock's
`--exclude-newer` lies at least 7 days before the lock's last commit (before now, while the
file differs from `HEAD`). A security lift's package is the one exception, visible as
`--exclude-newer-package` in the head. Read the diff as well: a package that moved a major
version, or one new in a lock, is worth a line in the changelog entry.
5. **Install and run the suite against the new locks** - the preflight installs
`requirements.lock` by itself once its hash changed; the other two by hand:
```bash
tools/preflight.sh
tools/.venv/bin/python -m pip install --require-hashes -r tools/requirements-mcp.lock
tools/.venv/bin/python -m pip install --require-hashes -r tools/requirements-dev.lock
cd tools && .venv/bin/python -m pytest -q
```
6. **Bump and publish.** A lock under `tools/` reaches every instance - its next preflight moves
the venv to it - so it is a patch bump ([version-parts.md](version-parts.md)) with a changelog
entry naming the lift, then [publish-and-ci.md](publish-and-ci.md). A lift that touches
`requirements.lock` also starts the `Converters` workflow.
## Decision points
- **The nightly's `pip-audit` step is red, but no fixed version exists yet?** Nothing to lift.
Name the advisory and whether the stack reaches the vulnerable code in the topic issue, and
check again when a fix is released.
- **A regular lift fails with "No solution found ... filtered by `exclude-newer`"?** A floor in a
source file names a version younger than the cutoff - usually a security lift whose exception
was lost. Restore the exception from the lock's head in `git log -p`; never lower the floor.
- **A package wants a Python outside the span?** The resolution for the minimum fails or picks an
old version. The span is a design decision in `tools/prerequisites.txt`, not something a lift
moves; take it to `stack-dev`.
- **A new dependency?** Add it to the source file that matches who needs it, with a floor, then
regenerate. A package only the origin repository's tests need goes into
`requirements-dev.txt`, never into a lock that ships.
## Scope
The origin repository only - `dist export` ships the three runtime locks, not this file, the
script or the dev lock. The span of Python versions itself is `tools/prerequisites.txt` and
[instructions/preflight.md](../preflight.md); reasons for the design are Gitea #245.
+9 -7
View File
@@ -40,10 +40,12 @@ formality after it - which is why waiting for it belongs to the phase that wrote
3. **Wait for CI on the published commit, this way.** One runner serves the repository and it
currently runs **no jobs in parallel**, so the jobs of a push run **one after another**: CI's `verify` job (about
**8 minutes**) and `pwsh` job (about **3 minutes**) first, then the second run a push to
**8 minutes**), `pwsh` job (about **3 minutes**) and `python314` job (the suite on the upper
end of the Python span, about **6 minutes**) first, then the second run a push to
`main` starts - `release.yml`, preceded by the `Converters` check - which waits `queued`
until CI is done and then takes about **1 minute**. From the push to the last green run that
is about **12 minutes** (measured 10.5 to 13 minutes, October 2026); a second run still
is about **18 minutes** (measured 10.5 to 13 minutes in October 2026, before the `python314`
job, whose share is an estimate until measured); a second run still
`queued` while CI works is the runner's order, not a hang. The times below rest on that
setup (`ENVIRONMENT.md` § CI records it); once the runner takes parallel jobs, measure them
again and rewrite them here.
@@ -52,8 +54,8 @@ formality after it - which is why waiting for it belongs to the phase that wrote
`ENVIRONMENT.md` lists (the Gitea MCP's `actions_run_read`, `list_runs`), right after
`publish`, to get their ids. **Never anonymously via `curl`:** Gitea answers the Actions
API with `401 token is required` even for this public repo.
- Check again after about 11 minutes, then every 2 minutes.
- **Give up after 25 minutes** - twice the usual time, so a slow day is not mistaken for a
- Check again after about 16 minutes, then every 2 minutes.
- **Give up after 35 minutes** - about twice the usual time, so a slow day is not mistaken for a
hang - and hand the open runs to the user by id and link, rather than waiting on.
- **Count from when the runner is free, not from the push.** Runs of an earlier push that are
still open when you publish run first, and the runner does not keep push order: it may take
@@ -69,11 +71,11 @@ formality after it - which is why waiting for it belongs to the phase that wrote
**Converter changes have a second run.** When the published commit touches the converter
surface - `tools/chemenu/filters/`, `tools/chemenu/commands/raw/derive.py` or `accept.py`,
`tools/chemenu/tests/test_raw_derive*.py`, `tools/chemenu/tests/binary_formats.py`,
`tools/requirements.txt` or `.gitea/workflows/converters.yml` - the `Converters` workflow
`tools/requirements.txt`, `tools/requirements.lock` or `.gitea/workflows/converters.yml` - the `Converters` workflow
(`converters.yml`) starts by itself with CI and derives the real documents of the private
test corpus. Deriving the corpus takes about **10 minutes** on top of CI, on the same
runner and after it, so the last run finishes about **22 minutes** after the push; give up
after **35 minutes** instead of 25, and count a red run like a red CI run (step 4). Start it by hand
runner and after it, so the last run finishes about **28 minutes** after the push; give up
after **45 minutes** instead of 35, and count a red run like a red CI run (step 4). Start it by hand
(`actions_run_write`, `dispatch_workflow` on `main`) when only the private repository changed
or when the commit reaches the converters only indirectly. A release without suffix runs the
same steps as the first job of `release.yml`, which the release waits for.
+5
View File
@@ -92,6 +92,11 @@ slash command for the operator, and stops.
*good*, not merely working: the converters against reference tools over the private corpus,
seven measures, markings judged against the original, a baseline moved only on purpose. Read it
before designing a converter change, after building one, and when the corpus gains a file.
- [dependency-locks.md](dependency-locks.md) - the four lock files under `tools/`: how a lock
is regenerated with the 7-day cooldown, how one package is lifted at once for a security fix
without ever being lowered again, how the result is checked, and what a red nightly audit or
fresh-resolution run asks for. Read it before changing a `tools/requirements*.txt`, and when
the nightly's dependency steps are red.
- [doc-pull-through.md](doc-pull-through.md) - which document makes a claim about a touched
surface (a `wikitool` command, a stage's rules, an `AGENTS.md` rule/gate/invariant, a
README-shaped human doc, a `docs/` page's reasoning) and therefore needs updating alongside
+3 -3
View File
@@ -123,7 +123,7 @@ that fails against theirs. The steps differ per tracker only in the profile and
| Workflow | When | What |
|---|---|---|
| `ci.yml`, step "Live tracker suite (CalDAV)" | Every push and PR | Radicale as a process on loopback (`pip install radicale`), `CHEMENU_LIVE_REQUIRE=caldav`. The one half that needs no app and no display. |
| `ci.yml`, step "Live tracker suite (CalDAV)" | Every push and PR | Radicale as a process on loopback (from `tools/requirements-dev.lock`), `CHEMENU_LIVE_REQUIRE=caldav`. The one half that needs no app and no display. |
| `tracker-live.yml` | Nightly 05:00 UTC, and by hand | Both kinds, `CHEMENU_LIVE_REQUIRE=sp,caldav`, inside the `chemenu-sp-live` image. It logs the installed Super Productivity version and warns when it differs from the update channel. |
| `sp-live-image.yml` | Daily 04:10 UTC, and by hand | Builds `gitea.nehmer.net/torben/chemenu-sp-live` when the registry lacks the channel's current version, and once a month regardless. |
@@ -178,9 +178,9 @@ shows a new answer shape, and when the manifest's version is more than a few rel
1. Get a Super Productivity to record from: the current `chemenu-sp-live` image with the
checkout mounted (`docker run --rm -v "$PWD:/work" -w /work/tools ...`, then a venv from
`requirements.txt` inside it), or any machine with the `.deb` installed and
`requirements.lock` inside it), or any machine with the `.deb` installed and
`CHEMENU_LIVE_SP_BINARY` set.
2. From `tools/`, in an environment that has `requirements.txt`:
2. From `tools/`, in an environment that has `requirements.lock` installed:
```bash
.venv/bin/python -m chemenu.tests.record_sp_fixtures chemenu/tests/fixtures/sp/api
+4 -3
View File
@@ -41,11 +41,12 @@ everything an operator needs that is *true of the software* rather than of one i
## Steps
1. **Install the server's dependency.** It is deliberately not in `requirements.txt`: an
instance that only uses the CLI should not be made to install pydantic, starlette, uvicorn
and cryptography to do it.
instance that only uses the CLI should not be made to install starlette, uvicorn and the
rest of a web server to do it. Install the lock beside it, never the `.txt`: exact versions
and hashes, consistent with what the preflight put into `tools/.venv`.
```bash
tools/.venv/bin/python -m pip install -r tools/requirements-mcp.txt
tools/.venv/bin/python -m pip install --require-hashes -r tools/requirements-mcp.lock
```
2. **Decide which checkout it serves.** The root resolves by precedence - an explicit `--root`,
+10 -5
View File
@@ -14,20 +14,25 @@ known to exist: `tools/preflight.sh` for POSIX shells, `tools/preflight.ps1` for
Windows. The two answer the same questions from the same list and write the same
`.wikitool-tools.json`. It does three things, all inside the install folder:
- checks the tools listed in `tools/prerequisites.txt` - Python 3.11 or newer, git, ripgrep
(`rg`) - and, on Windows, that the install folder is short enough for Windows' path limit and
- checks the tools listed in `tools/prerequisites.txt` - Python 3.13 to 3.14 (both checked in
CI; an older or newer one is refused with exit 42, and a `python3.14`/`python3.13`, or `py -3.14`
on Windows, is taken where the plain `python` lies outside), git, ripgrep (`rg`) - and, on Windows, that the install folder is short enough for Windows' path limit and
(PowerShell only) that the execution policy and the files' Mark of the Web let
`tools/wikitool.ps1` start;
- records the absolute path of each tool in `.wikitool-tools.json`, which `wikitool` then starts
them from instead of trusting whatever `PATH` a session inherited - and of an optional tool,
such as the 1Password CLI `op`, when it finds one: an optional tool missing is reported as
`ABSENT` and is never a reason to stop, nor to install anything;
- creates `tools/.venv` from the recorded Python and installs `tools/requirements.txt` into it.
- creates `tools/.venv` from the recorded Python and installs `tools/requirements.lock` into it:
exact versions with their SHA-256 hashes (`pip install --require-hashes`), so every instance
of one stack version runs the same packages. When an update brings a changed lock, the next
run moves the venv to it, a version up or down; a venv built on a Python outside the span is
built again on the one found.
One more thing it does only when the user asks for it: `--with browser` installs the optional
browser component - `tools/requirements-browser.txt` and the Chromium it drives - into
browser component - `tools/requirements-browser.lock` and the Chromium it drives - into
`tools/.venv`. Only `raw login` and a page a site handler fetches through a browser need it. Once
installed, every later run keeps it up to date; nothing else ever installs it.
installed, every later run keeps it at its lock; nothing else ever installs it.
<!-- wikitool:toc -->
## Contents