Skip to content

fix(triage): the pip path no longer scores higher by running fewer probes - #493

Merged
sandstream merged 1 commit into
mainfrom
fix/triage-ecosystem-parity
Aug 20, 2026
Merged

sandstream merged 1 commit into
mainfrom
fix/triage-ecosystem-parity

Conversation

@sandstream

@sandstream sandstream commented Aug 20, 2026 •

Copy link
Copy Markdown
Owner

Closes #489.

What

triage.py scores by flat penalty count (100 - 45*critical - 12*warning), so the number falls out of how many probes an ecosystem has, not out of how safe the package is. pip opensandbox-server printed 100/100 next to npm deepsec's 88/100, and the 88 existed only because the npm path looked for something the pip path never did. A reader comparing them concludes the Python package is the safer one.

Three changes, in the order they matter:

1. Absence is printed, not scored. The pip path declares the one probe PyPI cannot answer, and the report says so where the score is:

  ~ NOT CHECKED: maintainer count -- PyPI's JSON API publishes no maintainer list
    (info.maintainer is free-text and usually empty), so bus-factor /
    account-takeover risk was NOT assessed

Health score: 100/100
Critical issues: 0
Warnings: 0
Probes declared unavailable: 1
Coverage: PARTIAL -- 1 probe(s) cannot run for this ecosystem (maintainer count);
the score covers only what was checked

This is the didNotRun semantics kit uses elsewhere — coverage that could not run is UNKNOWN, never clean. A declared gap does not withhold TRIAGE PASSED: it is an unknown, not a finding.

Probes declared unavailable: N counts only what a path explicitly declared it cannot answer. It is not a completeness claim about the probe set — hence the wording, and hence no Coverage: full line anywhere.

2. Two probes that were absent rather than impossible, added.

  • pip newness. PyPI has no created field, but every release file carries its upload time, so first-publish is the oldest one. kit triage pip <pkg> now reports first published N days ago and warns under 30 days, exactly as npm does.
  • npm license. The pip path had warned on a missing license since it was written; the npm path never looked. Comparability breaks in both directions, so an npm 100 must not be a 100 that never checked the terms.

After this, npm and pip run the same probe set except maintainer count, which pip declares.

3. author: unknown for nearly every modern Python package. info.author is null under PEP 621 (authors = [{name=…, email=…}]); the value lands in info.author_email. Attribution is what settles a look-alike-repo provenance question cheaply, so it now falls back:

before: . triaged 0.2.2, 18 releases, author: unknown
after:  . triaged 0.2.2, 18 releases, author: OpenSandbox Team <pangjiping.pjp@alibaba-inc.com>

Measured against the real registries

Run from this branch (python3 skills/triage/scripts/triage.py, live PyPI/npm):

target before (#489, 6.6.3) after
npm deepsec 88/100 · single maintainer 88/100 · single maintainer · Probes declared unavailable: 0
npm @deepseek-ai/dsh 88/100 · very new (4 days) 88/100 · very new (9 days — it aged) · unavailable: 0
pip opensandbox-server 100/100, no warnings, author: unknown 100/100 · Coverage: PARTIAL (maintainer count) · first published 196 days ago · real author

The pip score is still higher for the same package shape — that is inherent to a flat penalty count, and changing the scoring formula is a bigger decision than this issue. What no longer happens is that being invisible.

Tests

src/triage-ecosystem-parity.test.ts — 7 tests running the real triage.py against a local HTTP registry fixture (both registry hosts are env-overridable for air-gapped mirrors, which makes them injectable), asserting on the script's actual stdout, i.e. the text kit prints verbatim to the operator:

  • a clean pip package cannot print 100/100 without the Coverage: PARTIAL line, and still passes
  • PEP 621 attribution resolves from author_email, never unknown
  • pip warns on a 4-day-old package (88/100), matching npm on the same shape
  • npm declares unavailable: 0 and prints no Coverage: PARTIAL — the asymmetry is visible, which is the point
  • npm warns on a missing license
  • single-maintainer npm still warns while pip says it cannot check
  • a missing package is still a fail-closed CRITICAL + TRIAGE FAILED

The python3-absent path calls t.skip() with a message naming what went unverified, so a runner without python3 cannot report this file as passing coverage.

Not in scope

  • The scoring formula itself (a flat penalty count remains ecosystem-sensitive by construction).
  • The same declaration for triage_docker / triage_repo / triage_skill. Report.notchecked() is generic, so those paths can adopt it; nothing in this PR claims their coverage is complete.

Verification

  • npm test on this branch: 4307 tests, 0 fail, 0 skipped (macOS, non-root)
  • python3 -c "import ast; ast.parse(...)" clean; the three real-registry runs above

🤖 Generated with Claude Code

…obes

The health score is a flat penalty count (100 - 45*critical - 12*warning), so it
falls out of how many probes an ecosystem HAS, not out of how safe the package
is. `pip opensandbox-server` printed 100/100 next to `npm deepsec`'s 88/100, and
that 88 existed only because the npm path looked for something the pip path
never did. A reader comparing the two numbers in one CLI concludes the Python
package is the safer one — kit's own "lost coverage outranks a regression" rule,
inverted.

Absence is now printed rather than scored: the pip path declares `maintainer
count` as unavailable (PyPI's JSON API publishes no maintainer list; info.author
is free-text and usually empty), and the report carries `Probes declared
unavailable: N` plus a `Coverage: PARTIAL` line naming the probes. A declared gap
does not withhold TRIAGE PASSED — it is an unknown, not a finding.

Two probes that were absent rather than impossible now run: pip newness (PyPI has
no `created` field, but the oldest release file's upload time is the first
publish) and npm license (the pip path had warned on a missing license since it
was written; the npm path never looked — comparability breaks in both
directions).

Also: `info.author` is null under PEP 621, so `author: unknown` was printed for
essentially every modern Python package. It now falls back to `author_email`,
which is the attribution that settles a look-alike-repo provenance question.

Tests run the real triage.py against a local registry fixture (both registry
hosts are env-overridable for air-gapped mirrors, which makes them injectable)
and assert on its stdout — the text kit prints verbatim to the operator. The
python3-absent path skips loudly, naming what went unverified.

Refs #489

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit c61ede7 into main Aug 20, 2026
19 checks passed
@sandstream
sandstream deleted the fix/triage-ecosystem-parity branch August 20, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

triage: the pip path scores higher than npm by running fewer probes

1 participant