diff-sentry 0.10.0__tar.gz → 0.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/.claude/rules/monitoring.md +10 -1
  2. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/.claude/rules/rubric-and-eval.md +1 -0
  3. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/.env.example +3 -0
  4. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/AGENTS.md +3 -3
  5. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/CHANGELOG.md +17 -0
  6. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/PKG-INFO +3 -3
  7. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/README.md +1 -1
  8. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/action.yml +1 -1
  9. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/__init__.py +1 -1
  10. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/cli.py +36 -7
  11. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/deep_classify.py +1 -1
  12. diff_sentry-0.12.0/diff_sentry/images.py +628 -0
  13. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/releases.py +318 -12
  14. diff_sentry-0.12.0/docs/release-watch.md +67 -0
  15. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/tests/conftest.py +1 -1
  16. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/pyproject.toml +2 -2
  17. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/diff_sentry_studio/mapper.py +2 -2
  18. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/tests/test_mapper.py +1 -1
  19. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/conftest.py +1 -1
  20. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_adversarial_input.py +1 -1
  21. diff_sentry-0.12.0/tests/test_images.py +505 -0
  22. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_releases.py +441 -0
  23. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/uv.lock +5 -5
  24. diff_sentry-0.10.0/docs/release-watch.md +0 -29
  25. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/.claude/rules/detect-setup.md +0 -0
  26. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/.claude/rules/handoff.md +0 -0
  27. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/.claude/rules/indicators.md +0 -0
  28. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/.claude/skills/release/SKILL.md +0 -0
  29. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/.github/workflows/ci.yml +0 -0
  30. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/.github/workflows/release.yml +0 -0
  31. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/.gitignore +0 -0
  32. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/.python-version +0 -0
  33. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/LICENSE +0 -0
  34. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/VENDOR.md +0 -0
  35. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/__main__.py +0 -0
  36. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/actors.py +0 -0
  37. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/assemble.py +0 -0
  38. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/config.py +0 -0
  39. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/dbutil.py +0 -0
  40. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/detect.py +0 -0
  41. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/emit.py +0 -0
  42. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/fetch_tool.py +0 -0
  43. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/hosts.py +0 -0
  44. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/indicators.py +0 -0
  45. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/ingest.py +0 -0
  46. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/linewide.py +0 -0
  47. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/normalize.py +0 -0
  48. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/response.py +0 -0
  49. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/rl_export.py +0 -0
  50. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/rubric.py +0 -0
  51. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/schema.py +0 -0
  52. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/shelllex.py +0 -0
  53. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/skills/ci-and-workflows.md +0 -0
  54. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/skills/concealment-and-provenance.md +0 -0
  55. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/skills/developer-autorun.md +0 -0
  56. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/skills/llm-directed-text.md +0 -0
  57. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/skills/package-and-build-hooks.md +0 -0
  58. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/skills/runtime-droppers-and-exfil.md +0 -0
  59. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/skills/triage-a-change.md +0 -0
  60. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/snapshot.py +0 -0
  61. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/diff_sentry/watch.py +0 -0
  62. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/docs/development.md +0 -0
  63. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/docs/how-it-works.md +0 -0
  64. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/docs/limits.md +0 -0
  65. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/docs/watch.md +0 -0
  66. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/README.md +0 -0
  67. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/diff_sentry_eval/__init__.py +0 -0
  68. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/diff_sentry_eval/__main__.py +0 -0
  69. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/diff_sentry_eval/cli.py +0 -0
  70. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/diff_sentry_eval/judge.py +0 -0
  71. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/diff_sentry_eval/schema.py +0 -0
  72. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/diff_sentry_eval/score.py +0 -0
  73. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/diff_sentry_eval/taskset.py +0 -0
  74. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/pyproject.toml +0 -0
  75. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/taskset.example.json +0 -0
  76. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/tests/test_boundary.py +0 -0
  77. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/tests/test_cli.py +0 -0
  78. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/tests/test_judge.py +0 -0
  79. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/tests/test_schema.py +0 -0
  80. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/tests/test_score.py +0 -0
  81. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/eval/tests/test_taskset.py +0 -0
  82. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/DESIGN.md +0 -0
  83. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/README.md +0 -0
  84. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/diff_sentry_studio/__init__.py +0 -0
  85. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/diff_sentry_studio/app.py +0 -0
  86. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/diff_sentry_studio/iterations.py +0 -0
  87. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/diff_sentry_studio/live.py +0 -0
  88. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/pyproject.toml +0 -0
  89. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/static/app.js +0 -0
  90. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/static/index.html +0 -0
  91. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/static/replay-core.js +0 -0
  92. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/static/run-core.js +0 -0
  93. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/static/style.css +0 -0
  94. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/static/trajectory.js +0 -0
  95. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/static/vendor/fonts/jetbrains-mono-400.woff2 +0 -0
  96. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/static/vendor/fonts/jetbrains-mono-700.woff2 +0 -0
  97. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/tests/replay-core.test.js +0 -0
  98. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/tests/run-core.test.js +0 -0
  99. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/tests/static-contract.test.js +0 -0
  100. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/tests/test_app.py +0 -0
  101. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/tests/test_iterations.py +0 -0
  102. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/tests/test_live.py +0 -0
  103. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/studio/tests/trajectory.test.js +0 -0
  104. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/__init__.py +0 -0
  105. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/corpus/change_corpus.json +0 -0
  106. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/corpus/hackerbot_claw_campaign.json +0 -0
  107. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/corpus/hackerbot_claw_incident.json +0 -0
  108. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/fixtures/known-malicious.diff +0 -0
  109. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/oracle/__init__.py +0 -0
  110. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/oracle/grammar.py +0 -0
  111. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/oracle/harness.py +0 -0
  112. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/oracle/lexrunner.py +0 -0
  113. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/oracle/programs.py +0 -0
  114. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/oracle/runner.py +0 -0
  115. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_actors.py +0 -0
  116. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_assemble.py +0 -0
  117. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_campaign_replay.py +0 -0
  118. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_cli.py +0 -0
  119. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_cli_watch.py +0 -0
  120. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_config.py +0 -0
  121. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_deep_classify.py +0 -0
  122. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_detect.py +0 -0
  123. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_detection_quality.py +0 -0
  124. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_dogfood_gate.py +0 -0
  125. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_emit.py +0 -0
  126. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_enclosure.py +0 -0
  127. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_export.py +0 -0
  128. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_fetch_tool.py +0 -0
  129. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_file_scope.py +0 -0
  130. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_file_structure.py +0 -0
  131. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_forward_offline.py +0 -0
  132. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_gate_edges.py +0 -0
  133. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_grounding.py +0 -0
  134. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_hosts.py +0 -0
  135. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_incident_hackerbot_claw.py +0 -0
  136. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_indicators.py +0 -0
  137. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_ingest.py +0 -0
  138. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_ingest_metadata.py +0 -0
  139. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_injection_offline.py +0 -0
  140. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_inline_exec_and_bidi.py +0 -0
  141. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_linewide.py +0 -0
  142. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_lookalike_owner.py +0 -0
  143. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_metadata_rules.py +0 -0
  144. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_normalize.py +0 -0
  145. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_oracle.py +0 -0
  146. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_oracle_harness.py +0 -0
  147. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_provenance.py +0 -0
  148. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_python_loader.py +0 -0
  149. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_response.py +0 -0
  150. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_rubric.py +0 -0
  151. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_schema.py +0 -0
  152. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_shelllex.py +0 -0
  153. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_snapshot.py +0 -0
  154. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_subscription.py +0 -0
  155. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_watch.py +0 -0
  156. {diff_sentry-0.10.0 → diff_sentry-0.12.0}/tests/test_watch_pool.py +0 -0
@@ -47,8 +47,17 @@ paths:
47
47
 
48
48
  - **A release is a change.** `release_event` builds a `kind="release"` event (`repo` `pypi/<name>`, run id `pypi__<name>-<version>`, `-r<n>` for files added to a release later) whose files are the members of the new artifacts with content the previous release lacked, labelled `<kind>/<path>` (`wheel/cook.pth`, `sdist/pyproject.toml`), with a unified diff as the patch. It goes through `cli.screen`, so every text and file-structure rule reads it; never add a second scanning path for releases.
49
49
  - **Release facts are host-side facts.** `scan_release` turns `event["release"]` into baseline hits beside `scan_provenance` in `cli._baseline_indicators`: `release-new-install-root` (medium), `release-new-dependency` (low), `release-attestation-dropped` (`high`: the previous release had attestations, all of its files or any, and these files have none), `release-publisher-changed` (`high`: a Trusted Publisher, as kind, repository, workflow, environment and a Google publisher's email, case-folded, that the previous release's attestations did not name; it names the repository whose workflow uploaded, not the source it built from, and needs an attested previous release; read from PyPI's provenance URL in the index, retried when PyPI does not serve it) and `release-publisher-lookalike` (`critical`: that publisher's owner differs from a previous one's only by hyphens), and what was not read, all `high`: `release-shadowed-member` (two members of one artifact install to one path, which pip resolves to the `.data` copy), `release-code-not-read` (a changed member that runs, by suffix or as a build file or script, and was not shown as text: too large, past the diff's 20,000 lines, past a text or patch budget, compiled bytecode, a source file declaring a coding it cannot be read in, and a native module whose name, without its ABI tag, the previous release did not have), and `release-not-fully-read` (an artifact not downloaded, not matching its sha256, not read to its end for any reason, or a comparison given up after five attempts, which is screened and alerts on its own). `scan_release_change` is `scan_change` with `release_scope`, which keeps the mention rules (`prompt-injection`, `codeowners-tamper`, `workflow-tamper`, `privileged-fork-trigger`, `ci-bypass`) at `medium` anywhere in a release: a package's files are read by the programs that import them, a package governs no repository, and a comment mentions these as readily as code. The workflow-content rules (`pwn-request`, `workflow-permission-escalation`) keep their severity in every file, a workflow file of the sdist included: wherever a package carries that content, its code or its build can push it into someone's repository (a worm's shape), and every narrower reading tried had a spelling that hid one. Package code that writes only a code-owners file is a known gap.
50
- - **Artifacts are data.** Download only from `pypi.org` and `files.pythonhosted.org` over https, no redirects, each body checked against the index's sha256; read archives in memory, never extract, never install. Bounds: a download (`DS_RELEASE_MAX_ARTIFACT_MB`, 256), a release (1 GiB or four downloads), a zip's central directory (32 MiB: the largest of the size the end record states and the zip64 records whenever a locator sits before it, the one zipfile reads right before the locator and the one the locator names; never the member count, which zipfile ignores), members per artifact (50,000, a cut noted), decompressed bytes per artifact (256 MiB, counted by a capped stream so a tar header is bounded too), text kept per comparison (256 MiB), text per member (1 MiB; a larger one is compared by its sha256), patch text per event (16 MiB). A download PyPI does not serve is retried, never judged on part of a release.
50
+ - **Artifacts are data.** Download only from `pypi.org` and `files.pythonhosted.org` (and the tag comparison's refs and trees from `github.com` and `api.github.com`) over https, no redirects, each body checked against the index's sha256; read archives in memory, never extract, never install. Bounds: a download (`DS_RELEASE_MAX_ARTIFACT_MB`, 256), a release (1 GiB or four downloads), a zip's central directory (32 MiB: the largest of the size the end record states and the zip64 records whenever a locator sits before it, the one zipfile reads right before the locator and the one the locator names; never the member count, which zipfile ignores), members per artifact (50,000, a cut noted), decompressed bytes per artifact (256 MiB, counted by a capped stream so a tar header is bounded too), text kept per comparison (256 MiB), text per member (1 MiB; a larger one is compared by its sha256), patch text per event (16 MiB). A download PyPI does not serve is retried, never judged on part of a release.
51
51
  - **Two passes.** The first reads digests only, to learn which members changed; the second keeps text for those and for the metadata alone, so a release of many platform wheels does not spend the text budget on what did not change. A Python source member is read as UTF-8 with replacement characters and its NULs kept, and, when its first two lines hold a `coding[:=]` declaration anywhere, also as that coding (resolved by `codecs.lookup` as CPython resolves it; a name of more than 200 characters is not resolved), both readings scanned (a `coding: utf-7` file hides its code from a UTF-8 read, and where CPython honours a declaration is not reproduced, so neither reading is left to the author); a declared coding that cannot be read is `release-code-not-read` (`site` runs a `.pth` line after a NUL line); any other member that is not UTF-8 is binary.
52
52
  - **Paths are where pip puts them.** A wheel's `x.data/purelib/` and `platlib/` map to the site-packages root, `x.data/scripts/` to `{scripts}/`, `x.dist-info/` to `{dist-info}/`; an sdist member loses its top directory, and one at the root keeps its path (pip builds from the root when the members share no top directory). `RECORD`, `WHEEL` and `METADATA` of a wheel, and `PKG-INFO` and `*.egg-info/` of an sdist, are derived and not diffed; `Requires-Dist` is read from `METADATA`.
53
+ - **The source tag** (`tag_facts`): with a source repository (`--sources`, else the one GitHub repository the previous release's Trusted Publishers name), the members Python runs (`_compared`: `.py`, `.pyw`, `.pth` and build files; not a wheel's `{dist-info}/` or `{scripts}/`, not an sdist's derived files) are compared by git blob sha1 (`Member.blobs`, also of the bytes with CRLF as LF) with the tree of the tag for its version. Tags come from GitHub's `git fetch` ref advertisement (`tag_commits`, no API quota; an annotated tag's peeled commit), a tree from the API (`GITHUB_TOKEN` when set). A tag matches by `packaging` version after a non-digit prefix (`_tags_of`); a prefix that tags both releases is preferred, then one naming the package, then the shortest (`_pick`). Where an artifact sits in the repository (`src/`, a monorepo directory) is voted by its members' blobs (`_prefix`). The previous release against its own tag gives the paths a build writes (`_differences`), and only a difference at another path is `release-differs-from-tag` (high). Expectations are by exact path, never by directory: a directory key would let a generated `_version.py` vouch for every file beside it, and a generated root module for a root `.pth`. A comparison a judgment could not make leaves a `tag_checks` row: a release without a tag for its version (`release-tag-missing` at `medium`), or one judged while the API refused for its rate limit (`tag_limited`, a fact). One row per version (`<run id without revision>-tag`), since the comparison covers the whole release; a judgment that owes a comparison opens a closed row again with fresh clocks, so a wheel added to the release after its comparison is compared too, and each opening screens under its own id (`-tag2`, …) so a refused alert of an earlier one is still re-sent. `_recheck_tags` looks at the refs every poll: once a tag for the version appears and `_api_room` says the API has two calls left, `tag_event` reads the tag and both trees first (`_resolve_tag`) and only then downloads the release again for its blobs, and the tag facts alone are screened (an event with no files, so the content findings are not sent twice) under that run id. A release still untagged `_TAG_GRACE` (an hour) after it was judged is screened as `release-tag-missing` (high) without a download, and a comparison still owed `_TAG_DEADLINE` (six hours) after the judgment, whatever the reason (a tree the API keeps refusing, an API with no room), is `release-not-fully-read`: nothing owed is dropped without an alert. A Trusted Publisher's repository GitHub stops serving ends the check quietly (`unserved`), as at judgment. A release PyPI no longer lists when its tag appears is a note, not a clean comparison. No tag for the previous release compares nothing, a fact (`tag_compared`). A configured repository GitHub does not serve (401, 404, a redirect) is a note (`release-not-fully-read`); the Trusted Publisher's is a fact. The API's rate limit (403, 429) defers the comparison to `_recheck_tags`; any other GitHub failure is retried like a download; a truncated tree is a note.
53
54
  - **The previous release** is the highest version below the new one with a file that is not yanked; a pre-release is compared only when the new one is a pre-release too. Members are compared by content across all artifacts of a kind, so a payload in one platform's wheel shows.
54
55
  - **State is per file.** First sight of a package (even an empty one) records every file as the baseline. After that, each file not yet recorded is judged with the other new files of its release, against the previous release, so a wheel uploaded after its release was judged, or added to an old release, is judged too. A file is recorded only after its comparison is screened, and the index's ETag only after every new file of it is: a watcher stopped mid-comparison judges the same files on its next pass. A failed comparison is retried on every pass (the ETag is not sent while one is pending), superseded when the files to judge change, and kept as `error` after five, with an alert that it was not compared. A `--check` runs under `...-check` and never stands in for the watcher's judgment. An alert the SIEM did not accept is re-sent from `screened/` a few per poll.
56
+
57
+ ## Image watch (`images.py`, `release-watch --images`)
58
+
59
+ - **Provenance only, never a layer.** `image_provenance` reads an image's index, each BuildKit attestation manifest and its SLSA provenance layer; `provenance_facts` keeps the source repository (`vcs:source`; `owner/name` only for a URL whose host is exactly github.com, any other source as written, so a lookalike is only judged between GitHub repositories), revision, building repository, workflow without its ref, ref and ref protection. An attestation counts only when its `vnd.docker.reference.digest` is a platform image of the same index and the provenance's `subject` names that image (BuildKit always writes one); a platform image no attestation names is a note. A layer's content is a known gap.
60
+ - **Judged against what is known, never against the last image.** A repository holds images from several workflows, so `images.known` holds the sources, the builders (repository and workflow) and the workflows seen building from protected refs: seeded at first sight from the watched floating tags and the newest `_SAMPLED_VERSIONS` version tags, and extended by every image judged clean. An image that signals never extends it, so one bad image cannot vouch for the next. On GHCR the namespace (`_namespace`) is a known owner from the start. `scan_image` grades by owner, since one organisation's repositories share a trust boundary: a source or building repository whose owner imitates a known owner is `image-source-lookalike` / `image-builder-lookalike` (critical, via `indicators.lookalike_owner`); one of an unknown owner is `image-source-changed` / `image-builder-changed` (high); another repository or workflow of a known owner is `medium` (`image-workflow-changed`, a nightly or branch build); an unprotected ref under a workflow known protected is `image-ref-unprotected` (high); an image without provenance while the repository's images carry it, a single manifest included, is `image-provenance-dropped` (high); notes are `release-not-fully-read` (high). A first-sight sample whose owners imitate each other is screened as `image-source-lookalike` (critical) and learns neither: both owners are kept as `known.suspect`, every image of the repository is `image-owner-unresolved` (high) and none is learned until the state is reset, and the suspect owners count among those an image's owner is checked for imitating (`_without_lookalikes`). The first-sight alert has a fixed run id and an `image_judgments` row, so it is sent once and re-sent when refused. An empty owner (Docker Hub has no namespace; a build outside GitHub Actions has no building repository) is never a known owner, and a first sight that read nothing and learned nothing is no baseline (retried next poll). The provenance is unsigned: a match proves nothing, only a mismatch is evidence.
61
+ - **What is judged**: a new tag (cosign's `sha256-<digest>.sig/.att/.sbom` skipped, newest first by the version numbers a tag starts with, at most `_MAX_NEW_TAGS` a poll), a watched floating tag that points at another digest, and one of the newest `_RECHECKED_VERSIONS` plain release tags (`_releases`: no `-nightly` or `-rc` suffix, so one version's pre-releases cannot crowd the current release out) pushed again. The first-sight sample takes the newest plain releases the same way. Digests are read with HEAD requests, which Docker Hub does not count toward its pull limit.
62
+ - **Registries are read anonymously and only from their own hosts**: GHCR and Docker Hub (`registry-1.docker.io`), a Bearer token asked for only from a realm on an allowed host, kept per registry and repository and asked for again on a 401 (Docker Hub's expire in minutes), a blob redirect followed only to their CDN hosts (`pkg-containers.githubusercontent.com`, Docker Hub's `production.cloudfront.docker.com` and `production.cloudflare.docker.com`); every response is bounded. A 429 (`RateLimited`) stops that image's poll and counts as no failure.
63
+ - **Like releases**, a comparison that fails is retried on later polls and, after five, screened as not compared (`release-not-fully-read`, which alerts); an alert the SIEM did not accept is re-sent from `screened/` a few per poll.
@@ -15,6 +15,7 @@ paths:
15
15
  - `rl_export.rubric_signal` attaches the ATLAS 4-category (TF/TA/TG/PA) decomposition as LABELS: a fixed, no-LLM skeleton in `run_start` meta (`rubric_to_meta(default_rubric())`, one criterion per category, since the task is constant; there is no `generate_rubric` path) plus deterministic per-criterion `criteria_facts`.
16
16
  - The facts are a re-lens over `run_labels` / `run_metrics`, not a second derivation: `rubric.trace_facts` reuses them, so a criterion's `observed` cannot drift from what a trainer reads. `_CATEGORY_LENS` maps TF↔(verdict / signal / hit_iteration_cap), TA↔(scan / deep_classify / analyst / fetch / skill counts + circuit-breaks + analyst failures), TG↔(indicator_count / max_indicator_severity / signal / cited_unknown), PA↔(verdict / cited_unknown).
17
17
  - `deep_classify_circuit_breaks` counts the tool_calls the breaker short-circuited. From rlm-harness 1.22.0 a repeating error status (`is_fast_fail_http`) counts toward the breaker as an unusable reply does, so a break in a newer trace can mean a misconfigured classifier endpoint as well as a thrashing planner; the status in the run's endpoint-error tool_calls (`Error code: 401`) tells them apart, since a 429, a 5xx or a timeout records one too and does not count.
18
+ - The per-action `cause` that `rl_export` re-exports from the kit (`export_actions`, read by `payload_cause`) is the kit's field: from rlm-harness 1.24.0 a tool_call without `ok` reads as `unknown`, where it read as `invalid` before, so an older trace's `read_skill` rows move. Split a corpus by `run_start.payload.rlm_harness` before comparing `cause` rates across it.
18
19
  - `CriterionFact` has no score/met field; the trainer scores. Never add a reward/score/met field to any rubric type.
19
20
  - `rubric.py` is a dspy-free leaf: it imports only `.schema` at top, and its `rl_export` reuse is a function-level import (that path is dspy-free too), so `response.py` can import it at top.
20
21
  - `response._rubric` surfaces it as `DetectionResponse.rubric` (`RubricReport`); the studio shows it as a card tagged `labels — not a score` that adds no judgement. Keep the card legacy-guarded: a response without a `rubric` renders nothing.
@@ -79,3 +79,6 @@ DS_API_KEY=sk-...
79
79
  # DS_RELEASE_PACKAGES=litellm,requests # release-watch: PyPI projects (or --packages / --packages-file)
80
80
  # DS_RELEASE_INTERVAL=300 # release-watch: seconds between polls of each project's index
81
81
  # DS_RELEASE_MAX_ARTIFACT_MB=256 # release-watch: a larger wheel or sdist is not compared, which alerts
82
+ # DS_RELEASE_SOURCES=litellm=BerriAI/litellm # release-watch: the GitHub repository each package is built from, compared by tag (or --sources)
83
+ # DS_RELEASE_IMAGES=ghcr.io/owner/name # release-watch: container images compared by build provenance (or --images)
84
+ # DS_RELEASE_IMAGE_TAGS=latest # release-watch: floating tags whose moves are judged (or --image-tags)
@@ -31,10 +31,10 @@ rlm-harness is an exact PyPI pin (`rlm-harness==X.Y.Z` in `pyproject.toml`, lock
31
31
  - **The budget is hard: `max_retries=1`, no whole-RLM retry inside a run.** One change = one trajectory, so the trace stays valid training data. (`watch` may run a change again, but only when the previous attempt produced no result at all, an infrastructure failure; `cli.run` resets that run id's trace first, so exactly one trajectory per run id survives.) A failed run is infra before it is a schema bug; see `.claude/rules/detect-setup.md` for how the failure names itself.
32
32
  - **A second model-judgement is a TOOL, never the sub-LM.** `deep_classify` (on rlm-harness's `make_model_tool`) is the swappable second-stage seam the planner chooses to call, so the decision is a `tool_call` in the trajectory. The analyst intercept (`intercept_sub_lm`) is tracing-only, zero transforms. Swapping the backend touches only `classify_backend` / `_selfclassify_chat`. The planner passes distilled findings, never the whole diff.
33
33
  - **Sandboxed code builds no sub-agents.** In dspy 3.4.1 and later, sandboxed code can construct dspy programs that run on the host, call the analyst, can drive the task's tools, and record as one `sub_call` with no inner turns. The kit's default allows it, so `setup` passes `sandbox_sub_agents=False` explicitly, and production never injects an interpreter (which would bypass it); `test_program_offers_no_sub_agents` holds the behaviour.
34
- - **GitHub ingest, monitoring, and SIEM emission are host-side plumbing, never planner tools.** `ingest.py` shells out to `gh` host-side (transport injectable); `emit.emit_signal` POSTs and never raises; `watch`, `actors` and `snapshot` poll, remember, and archive outside the trajectory, and `releases` reads PyPI's own hosts only, as data that is never installed. Only choices the policy makes are tools; delivering a finished result is plumbing. What the store learns reaches the signal only as provenance facts through `scan_provenance`, never as a second derivation (see `.claude/rules/monitoring.md`).
34
+ - **GitHub ingest, monitoring, and SIEM emission are host-side plumbing, never planner tools.** `ingest.py` shells out to `gh` host-side (transport injectable); `emit.emit_signal` POSTs and never raises; `watch`, `actors` and `snapshot` poll, remember, and archive outside the trajectory, `releases` reads PyPI's own hosts, and the refs and trees of a package's GitHub repository, as data that is never installed, and `images` reads the GHCR and Docker Hub APIs only (manifests and provenance, never a layer). Only choices the policy makes are tools; delivering a finished result is plumbing. What the store learns reaches the signal only as provenance facts through `scan_provenance`, never as a second derivation (see `.claude/rules/monitoring.md`).
35
35
  - **This is a ROLLOUT source: trajectories, not reward.** `rl_export` passes `reward=None`; labels read the assembled verdict and metrics are objective effort counters. `deep_classify` tool_calls train the classifier; every other action is the planner's. A metric keeps ONE meaning across rlm-harness versions (the corpus mixes them; `run_start.payload.rlm_harness` names the writer): a quantity a newer kit makes observable gets a NEW key that is None where the trace cannot say (e.g. `analyst_failures`). The ATLAS rubric and the eval member stay reward-free too; see `.claude/rules/rubric-and-eval.md`.
36
36
  - **Attack knowledge lives in `diff_sentry/skills/`, not the prompt.** The skill catalog is injected (`load_skills_as_tools(discovery="inject")`) and `read_skill(name)` pulls a body on demand. Fix a wrong convention by editing or adding a skill; `detect.INSTRUCTIONS` holds only identity, the MISSION frame, the tool cost model, the triage loop, and output-gating rules. Skills ship via `packages = ["diff_sentry"]`; a force-include duplicates them and breaks the build.
37
- - **Keep the dspy-free modules dspy-free.** `config`, `schema`, `normalize`, `indicators`, `shelllex`, `linewide`, `assemble`, `response`, `emit`, `ingest`, `hosts`, `dbutil`, `actors`, `snapshot`, `watch`, `releases`, `rl_export`, and `rubric` must not import dspy at module top, and `import diff_sentry` must not import dspy (`ClassifyChange` / `setup` / `run` / `screen` / `detect_from_event` are lazy PEP 562 re-exports).
37
+ - **Keep the dspy-free modules dspy-free.** `config`, `schema`, `normalize`, `indicators`, `shelllex`, `linewide`, `assemble`, `response`, `emit`, `ingest`, `hosts`, `dbutil`, `actors`, `snapshot`, `watch`, `releases`, `images`, `rl_export`, and `rubric` must not import dspy at module top, and `import diff_sentry` must not import dspy (`ClassifyChange` / `setup` / `run` / `screen` / `detect_from_event` are lazy PEP 562 re-exports).
38
38
  - **The trace self-describes the run.** `run_start` meta carries the normalized event, instructions, source echo, `baseline_indicators`, `emit_on`, role→model names, budgets, and the rubric skeleton, so an offline re-render/export re-derives the same `signal` (reading `emit_on` from meta, never current config). Any new per-run config that affects read-time derivation must ride in meta.
39
39
 
40
40
  ## Topic guides
@@ -54,5 +54,5 @@ Claude Code loads each rule automatically when you touch a matching file; other
54
54
 
55
55
  - rlm-harness owns the generic cores: `make_model_tool` (chat → retry → validate → circuit-break) under `deep_classify`, and the SSRF primitives (`is_safe_url`, `resolved_host_is_safe`, `parse_cidrs`) under `fetch_tool`, which adds the GitHub allowlist, the httpx provider, and tracing.
56
56
  - When this consumer needs a workaround, fix the reusable gap in rlm-harness generically; never special-case diff-sentry there. Consumer values (`DS_*` roles, the verdict schema, indicator rules, the SIEM payload shape) stay here.
57
- - The deterministic tier ships as `cli.screen`, `watch` and `release-watch` (host-side, in front of `cli.run`). Next increments: comparing a release's sdist with its git tag, and npm releases beside PyPI's; an optional small single-shot model call inside that tier; a GH Archive backfill for account history older than the Events API's 30 days; per-repository workflow awareness (which repos run `issue_comment` or `pull_request_target` workflows) to weight the slash-command rule.
57
+ - The deterministic tier ships as `cli.screen`, `watch` and `release-watch` (host-side, in front of `cli.run`). Next increments: an image's new layers by content, and npm releases beside PyPI's; an optional small single-shot model call inside that tier; a GH Archive backfill for account history older than the Events API's 30 days; per-repository workflow awareness (which repos run `issue_comment` or `pull_request_target` workflows) to weight the slash-command rule.
58
58
  - Two workspace members, never in the `diff_sentry` wheel: `studio/` (`diff-sentry-studio`, the detection console, behind its `live` extra) and `eval/` (`diff-sentry-eval`, the reward-free scorecard). Both read the trace / `DetectionResponse` contract through the public surface only. Keep the root wheel at `packages = ["diff_sentry"]` so `uv build` never sweeps them in.
@@ -2,6 +2,23 @@
2
2
 
3
3
  All notable changes to diff-sentry, a BewAIre-style detector that classifies one GitHub change (PR, issue or push) for malicious intent on [`rlm-harness`](https://github.com/qazbnm456/rlm-harness).
4
4
 
5
+ ## 0.12.0
6
+
7
+ Upgrade from 0.11.0: `release-watch` can compare each release with its git tag, and `rlm-harness` moves to 1.24.0. The GitHub Action's scan is unchanged, and nothing needs configuring.
8
+
9
+ ### Added
10
+ - **`release-watch` compares each release with its git tag**, when it knows the GitHub repository a package is built from (`--sources litellm=BerriAI/litellm`, `DS_RELEASE_SOURCES`, or else the repository of the previous release's Trusted Publisher). The files Python runs are compared with the tag for the version by git blob hash, so nothing is downloaded from GitHub but its tag list and two file trees. A file the tag does not hold, or holds with other content, is `release-differs-from-tag` (`high`); what the previous release also differed by at the same path, such as a version file the build writes, is expected. A release whose repository tagged the previous one and has no tag for it (`BerriAI/litellm` has no `v1.107.0`) is `release-tag-missing`: `medium` at first, compared once the tag appears, and `high` after an hour. A comparison that still cannot be made six hours after the release was judged alerts that it was not made. See [Comparing a release with its git tag](docs/release-watch.md#comparing-a-release-with-its-git-tag).
11
+
12
+ ### Changed
13
+ - **`rlm-harness` 1.24.0.** A tool call recorded without an outcome now reads as unknown rather than as a decline; every call diff-sentry records declares its outcome.
14
+
15
+ ## 0.11.0
16
+
17
+ Upgrade from 0.10.0: `release-watch` can now watch container images. The GitHub Action's scan is unchanged, nothing needs configuring, and `rlm-harness==1.22.0` is unchanged.
18
+
19
+ ### Added
20
+ - **`release-watch --images` compares GHCR and Docker Hub images by their build provenance.** litellm's 1.107.0 images, and the `latest` and `main-stable` tags moved onto them, carried the same payload as the wheels. Each new tag, each move of a watched floating tag, and each re-push of a recent release is judged against the repositories and workflows the image is known to be built from and by. A source or building repository whose owner imitates a known one is `critical`. An unknown owner, a build from an unprotected ref by a workflow that used protected ones, or an image without the provenance the repository's images carry is `high`. Another workflow of a known owner, such as a nightly build, is `medium`. Images are read anonymously and never pulled; the provenance is unsigned, so only a mismatch is evidence, and a layer's content is not read. See [Container images](docs/release-watch.md#container-images).
21
+
5
22
  ## 0.10.0
6
23
 
7
24
  Upgrade from 0.9.0: the GitHub Action now flags a GitHub owner that imitates your repository's own, so a workflow change it passed before can fail it now, and `release-watch` compares who published each release. Nothing needs configuring: the Action reads the repository from `GITHUB_REPOSITORY`. `rlm-harness==1.22.0` is unchanged.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: diff-sentry
3
- Version: 0.10.0
3
+ Version: 0.12.0
4
4
  Summary: Catch malicious pull requests before they merge: scan a diff for supply-chain attack patterns with deterministic evidence a model cannot suppress.
5
5
  Author: Boik Su
6
6
  License-Expression: MIT
@@ -10,7 +10,7 @@ Requires-Python: >=3.11
10
10
  Requires-Dist: httpx>=0.27
11
11
  Requires-Dist: packaging>=23
12
12
  Requires-Dist: pydantic>=2.11.0
13
- Requires-Dist: rlm-harness==1.22.0
13
+ Requires-Dist: rlm-harness==1.24.0
14
14
  Provides-Extra: classify
15
15
  Requires-Dist: openai>=1.0; extra == 'classify'
16
16
  Provides-Extra: observe
@@ -43,7 +43,7 @@ jobs:
43
43
  - uses: actions/checkout@v7
44
44
  with:
45
45
  fetch-depth: 0 # the scan diffs against the PR base
46
- - uses: qazbnm456/diff-sentry@v0.10.0
46
+ - uses: qazbnm456/diff-sentry@v0.12.0
47
47
  ```
48
48
 
49
49
  That is the whole setup. The job fails when an indicator at or above `high` fires. Add `push` to `on:` to also scan commits pushed straight to a branch. A push that bypasses branch protection can also delete this workflow, so `watch` and `release-watch` read the repository and its releases from outside.
@@ -21,7 +21,7 @@ jobs:
21
21
  - uses: actions/checkout@v7
22
22
  with:
23
23
  fetch-depth: 0 # the scan diffs against the PR base
24
- - uses: qazbnm456/diff-sentry@v0.10.0
24
+ - uses: qazbnm456/diff-sentry@v0.12.0
25
25
  ```
26
26
 
27
27
  That is the whole setup. The job fails when an indicator at or above `high` fires. Add `push` to `on:` to also scan commits pushed straight to a branch. A push that bypasses branch protection can also delete this workflow, so `watch` and `release-watch` read the repository and its releases from outside.
@@ -40,7 +40,7 @@ inputs:
40
40
  that PR rather than by the ones already on main.
41
41
  required: false
42
42
  # KEEP IN STEP WITH [project].version. release.yml fails the build if this drifts from the tag being released, because a stale default here would silently run an old scanner under a new action tag.
43
- default: '0.10.0'
43
+ default: '0.12.0'
44
44
 
45
45
  outputs:
46
46
  failed:
@@ -72,7 +72,7 @@ __all__ = [
72
72
  "screen",
73
73
  ]
74
74
 
75
- __version__ = "0.10.0"
75
+ __version__ = "0.12.0"
76
76
 
77
77
 
78
78
  def __getattr__(name: str): # PEP 562: defer the dspy import to first use
@@ -14,6 +14,7 @@ import json
14
14
  import math
15
15
  import os
16
16
  import sys
17
+ import time
17
18
  from collections.abc import Callable
18
19
  from dataclasses import dataclass
19
20
 
@@ -77,6 +78,7 @@ async def detect_from_event(
77
78
 
78
79
  def _baseline_indicators(event: dict, *, content_hits: list[IndicatorHit] | None = None) -> list[dict]:
79
80
  """The host-side deterministic evidence recorded in run_start meta BEFORE the planner runs: the text detectors over the raw content ∪ the provenance detectors over the ingest facts. Both re-source into the evidence union on read (MF3), so a false-benign SUBMIT can skew the verdict but never suppress these."""
81
+ from .images import scan_image
80
82
  from .indicators import keep_worse, scan_change, scan_provenance
81
83
  from .releases import release_scope, scan_release, scan_release_change
82
84
 
@@ -84,7 +86,8 @@ def _baseline_indicators(event: dict, *, content_hits: list[IndicatorHit] | None
84
86
  release = event.get("kind") == "release"
85
87
  scan = scan_release_change if release else scan_change
86
88
  hits = (scan(event) if content_hits is None else release_scope(list(content_hits)) if release else list(content_hits)) \
87
- + scan_provenance(event.get("provenance") or {}) + scan_release(event.get("release") or {})
89
+ + scan_provenance(event.get("provenance") or {}) + scan_release(event.get("release") or {}) \
90
+ + scan_image((event.get("release") or {}).get("image") or {})
88
91
  # Hits an EARLIER version of this same change raised ride along, so an edit that removes the payload cannot also remove the evidence (the watcher supplies them; a change scanned on its own has none).
89
92
  for raw in event.get("prior_indicators") or []:
90
93
  if isinstance(raw, IndicatorHit):
@@ -333,7 +336,8 @@ def _cmd_release_watch(args) -> int:
333
336
  import logging
334
337
  import signal
335
338
 
336
- from .releases import ReleaseWatcher, parse_packages
339
+ from .images import ImageWatcher
340
+ from .releases import ReleaseWatcher, parse_packages, parse_sources
337
341
 
338
342
  logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
339
343
  if not math.isfinite(args.interval) or args.interval <= 0:
@@ -347,7 +351,17 @@ def _cmd_release_watch(args) -> int:
347
351
  packages = parse_packages(texts)
348
352
  if args.check:
349
353
  packages = parse_packages([args.check[0]])
350
- watcher = ReleaseWatcher(packages, state_dir=args.state, out_dir=args.out, emit=not args.no_emit)
354
+ images = [i for text in [*args.images, os.getenv("DS_RELEASE_IMAGES", "")] for i in text.replace(",", " ").split()]
355
+ floating = tuple(args.image_tags or os.getenv("DS_RELEASE_IMAGE_TAGS", "latest").replace(",", " ").split())
356
+ image_watcher = ImageWatcher([] if args.check else images, state_dir=args.state, out_dir=args.out,
357
+ floating=floating, emit=not args.no_emit)
358
+ try:
359
+ sources = parse_sources([*args.sources, os.getenv("DS_RELEASE_SOURCES", "")])
360
+ watcher = ReleaseWatcher(packages, state_dir=args.state, out_dir=args.out, emit=not args.no_emit,
361
+ sources=sources)
362
+ except BaseException:
363
+ image_watcher.close()
364
+ raise
351
365
  except (OSError, ValueError, RuntimeError) as exc:
352
366
  print(f"release-watch: {exc}", file=sys.stderr)
353
367
  return 2
@@ -356,22 +370,29 @@ def _cmd_release_watch(args) -> int:
356
370
  result = watcher.check(packages[0], args.check[1])
357
371
  print(json.dumps(result, indent=2, default=str))
358
372
  return 1 if "error" in result else 0
359
- if not packages:
360
- print("release-watch: no packages (--packages, --packages-file or DS_RELEASE_PACKAGES)", file=sys.stderr)
373
+ if not packages and not images:
374
+ print("release-watch: nothing to watch (--packages, --packages-file, --images, or DS_RELEASE_PACKAGES / "
375
+ "DS_RELEASE_IMAGES)", file=sys.stderr)
361
376
  return 2
362
377
  if args.once:
363
- for result in watcher.poll_once():
378
+ for result in watcher.poll_once() + image_watcher.poll_once():
364
379
  print(json.dumps(result, default=str))
365
380
  return 0
366
381
  stopping = []
367
382
  signal.signal(signal.SIGTERM, lambda *_: stopping.append(True))
368
383
  try:
369
- watcher.run(args.interval, stop=lambda: bool(stopping))
384
+ while not stopping:
385
+ started = time.monotonic()
386
+ watcher.poll_once()
387
+ image_watcher.poll_once()
388
+ while not stopping and time.monotonic() - started < args.interval:
389
+ time.sleep(min(1.0, args.interval))
370
390
  except KeyboardInterrupt:
371
391
  pass
372
392
  return 0
373
393
  finally:
374
394
  watcher.close()
395
+ image_watcher.close()
375
396
 
376
397
 
377
398
  def _cmd_render(args) -> int:
@@ -636,6 +657,14 @@ def build_parser() -> argparse.ArgumentParser:
636
657
  help="compare each new release of watched PyPI packages with the one before it (no model)")
637
658
  rw.add_argument("--packages", nargs="+", default=[], help="PyPI project names (or set DS_RELEASE_PACKAGES)")
638
659
  rw.add_argument("--packages-file", help="a file of project names, one per line (# comments allowed)")
660
+ rw.add_argument("--sources", nargs="+", default=[], metavar="PACKAGE=OWNER/NAME",
661
+ help="the GitHub repository each package is built from, to compare each release with its tag "
662
+ "(or set DS_RELEASE_SOURCES; default: the repository of the previous release's Trusted Publisher)")
663
+ rw.add_argument("--images", nargs="+", default=[],
664
+ help="container images (ghcr.io/owner/name, docker.io/owner/name) whose tags are compared by provenance "
665
+ "(or set DS_RELEASE_IMAGES)")
666
+ rw.add_argument("--image-tags", nargs="+", default=None,
667
+ help="floating tags whose moves are judged (DS_RELEASE_IMAGE_TAGS, default: latest)")
639
668
  rw.add_argument("--out", default="./output")
640
669
  rw.add_argument("--state", default=os.getenv("DS_WATCH_STATE_DIR", "./output/state"),
641
670
  help="state directory: releases.db, snapshots/")
@@ -143,7 +143,7 @@ def make_deep_classify_tool(config: DetectConfig, chat_fn: Callable[[str], str]
143
143
  return ("DEEP_CLASSIFY CIRCUIT BREAKER — too many unusable replies or failing calls in a row. Decide from the "
144
144
  "deterministic indicators and your own reading; do not keep re-asking.")
145
145
  if r.endpoint_error is not None:
146
- record_tool_call("deep_classify", args={"findings": findings[:400]}, error=r.endpoint_error)
146
+ record_tool_call("deep_classify", args={"findings": findings[:400]}, ok=False, error=r.endpoint_error)
147
147
  return f"DEEP_CLASSIFY ENDPOINT ERROR: {r.endpoint_error}. Decide from the indicators yourself."
148
148
  v: ClassifyValidation = r.validated
149
149
  # SEAM: a delegated rlm-harness HARNESS backend (make_harness_tool) returns