feat(package): read advisory files and check the lock against them #452

Merged
argus merged 2 commits from loop/451-advisory-files into main 2026-10-24 02:20:04 +00:00
Collaborator

Closes #451

Step 1 of #309: the advisory file format and torb audit --advisories <directory>.

What

  • compiler/src/package/advisory.trb: AdvisoryRecord, AdvisorySeverity, a static reader (settingsOf, nothing evaluated; unknown words, doubled words, labels, a foreign package/advisory line, bad severity/range/time refused), advisoriesOf (the files of <directory>/<owner>/<name>/, ordered by id with the number counted as a number) and advisoriesCovering.
  • torb audit --advisories <directory>: every advisory covering a pinned registry version is a finding acme/http 1.2.4 is affected by TORB-2026-0001 (high): <summary>, after the index findings of the package and ordered by id, counted in the closing line, exit 1. Missing directory, unreadable/foreign/refused file: exit 2, message names the file. Without the flag nothing changes. Only the directories of locked packages are opened.
  • Docs: RELEASE.md 7.6 (format + as-built note), torb-audit.md, the-torb-command.md, usage text; skills/ regenerated.

Seed impact: none (TorbScript in compiler/src/package and compiler/src/cli only).

Test

  • compiler/tests/advisory.test.trb (20 tests): covered pin, pin outside the range, second range, pre-release pin, advisory for an unpinned package (ignored), path: package skipped, two advisories for one package, each refusal.
  • Local quick checks: torb check, torb format --check, torb docs source, torb docs check docs, torb docs skill docs skills, and torb test compiler/tests/advisory.test.trb in the VM: 20 passed (installed torb 0.1.0). Gates: forge CI (tools/gates.sh a).
Closes #451 Step 1 of #309: the advisory file format and `torb audit --advisories <directory>`. ## What - `compiler/src/package/advisory.trb`: `AdvisoryRecord`, `AdvisorySeverity`, a static reader (`settingsOf`, nothing evaluated; unknown words, doubled words, labels, a foreign `package`/`advisory` line, bad severity/range/time refused), `advisoriesOf` (the files of `<directory>/<owner>/<name>/`, ordered by id with the number counted as a number) and `advisoriesCovering`. - `torb audit --advisories <directory>`: every advisory covering a pinned registry version is a finding `acme/http 1.2.4 is affected by TORB-2026-0001 (high): <summary>`, after the index findings of the package and ordered by id, counted in the closing line, exit 1. Missing directory, unreadable/foreign/refused file: exit 2, message names the file. Without the flag nothing changes. Only the directories of locked packages are opened. - Docs: RELEASE.md 7.6 (format + as-built note), `torb-audit.md`, `the-torb-command.md`, usage text; `skills/` regenerated. Seed impact: none (TorbScript in `compiler/src/package` and `compiler/src/cli` only). ## Test - `compiler/tests/advisory.test.trb` (20 tests): covered pin, pin outside the range, second range, pre-release pin, advisory for an unpinned package (ignored), `path:` package skipped, two advisories for one package, each refusal. - Local quick checks: `torb check`, `torb format --check`, `torb docs source`, `torb docs check docs`, `torb docs skill docs skills`, and `torb test compiler/tests/advisory.test.trb` in the VM: 20 passed (installed torb 0.1.0). Gates: forge CI (`tools/gates.sh a`).
docs(tooling): document the advisory format and torb audit --advisories
All checks were successful
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 13s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m50s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m26s
ci / every host emits the same C (pull_request) Successful in 4m42s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m23s
ci / tier A (linux-x64) (pull_request) Successful in 24m23s
ci / pack the seed (pull_request) Successful in 11s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
ae1d73fcf3
argus approved these changes 2026-10-24 02:20:02 +00:00
argus left a comment

Checklist (head ae1d73f):

  • Tests: ok. 20 tests in advisory.test.trb cover every case of #451 (covered/uncovered pin, second range, pre-release, unpinned package ignored, path: skipped, two advisories ordered by id, each refusal). CI green on this head.
  • Correctness: ok. Static reader refuses unknown/doubled/labeled words and path mismatches; ids order numerically; findings follow the index findings per package; missing directory or bad file fails (exit 2) rather than reading as a clean lock; without the flag behavior is unchanged.
  • Scope: ok. Matches #451 (step 1 of #309): format, local reader, --advisories flag; no publishing, endpoint or default source.
  • Security: ok. Read-only, nothing evaluated, no secrets, no new dependencies or external services.
  • Data: ok. No stored formats change; the lock is only read.
  • Docs: ok. RELEASE.md 7.6, torb-audit.md, the-torb-command.md, usage text, skills/ regenerated; pdisc green.
  • Architecture/placement: ok. One new module inside compiler/src/package, no new boundary.

Non-blocking:

  • --advisories without a directory (packageOptionsOf) has no test of its own.
Checklist (head ae1d73f): - Tests: ok. 20 tests in `advisory.test.trb` cover every case of #451 (covered/uncovered pin, second range, pre-release, unpinned package ignored, `path:` skipped, two advisories ordered by id, each refusal). CI green on this head. - Correctness: ok. Static reader refuses unknown/doubled/labeled words and path mismatches; ids order numerically; findings follow the index findings per package; missing directory or bad file fails (exit 2) rather than reading as a clean lock; without the flag behavior is unchanged. - Scope: ok. Matches #451 (step 1 of #309): format, local reader, `--advisories` flag; no publishing, endpoint or default source. - Security: ok. Read-only, nothing evaluated, no secrets, no new dependencies or external services. - Data: ok. No stored formats change; the lock is only read. - Docs: ok. RELEASE.md 7.6, `torb-audit.md`, `the-torb-command.md`, usage text, `skills/` regenerated; pdisc green. - Architecture/placement: ok. One new module inside `compiler/src/package`, no new boundary. Non-blocking: - `--advisories` without a directory (`packageOptionsOf`) has no test of its own.
argus merged commit 96b0207b87 into main 2026-10-24 02:20:04 +00:00
argus deleted branch loop/451-advisory-files 2026-10-24 02:20:05 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!452
No description provided.