Repository navigation
fix(triage): the pip path no longer scores higher by running fewer probes - #493
Merged
Merged
Conversation
…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>
|
✅ Docker image built successfully
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #489.
What
triage.pyscores 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-serverprinted100/100next tonpm deepsec's88/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:
This is the
didNotRunsemantics kit uses elsewhere — coverage that could not run is UNKNOWN, never clean. A declared gap does not withholdTRIAGE PASSED: it is an unknown, not a finding.Probes declared unavailable: Ncounts only what a path explicitly declared it cannot answer. It is not a completeness claim about the probe set — hence the wording, and hence noCoverage: fullline anywhere.2. Two probes that were absent rather than impossible, added.
createdfield, but every release file carries its upload time, so first-publish is the oldest one.kit triage pip <pkg>now reportsfirst published N days agoand warns under 30 days, exactly as npm does.100must not be a100that never checked the terms.After this, npm and pip run the same probe set except maintainer count, which pip declares.
3.
author: unknownfor nearly every modern Python package.info.authorisnullunder PEP 621 (authors = [{name=…, email=…}]); the value lands ininfo.author_email. Attribution is what settles a look-alike-repo provenance question cheaply, so it now falls back:Measured against the real registries
Run from this branch (
python3 skills/triage/scripts/triage.py, live PyPI/npm):npm deepsec88/100· single maintainer88/100· single maintainer ·Probes declared unavailable: 0npm @deepseek-ai/dsh88/100· very new (4 days)88/100· very new (9 days — it aged) ·unavailable: 0pip opensandbox-server100/100, no warnings,author: unknown100/100·Coverage: PARTIAL (maintainer count)·first published 196 days ago· real authorThe 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 realtriage.pyagainst 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:100/100without theCoverage: PARTIALline, and still passesauthor_email, neverunknown88/100), matching npm on the same shapeunavailable: 0and prints noCoverage: PARTIAL— the asymmetry is visible, which is the pointCRITICAL+TRIAGE FAILEDThe 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
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 teston 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