Repository navigation
Conversation
Adds scripts/verify_sources.py and a 'sources' job on pull requests. It fails when a listing's repository is missing, private or archived, its license differs from the repository's, its package or version was never published, or an install command names another package. It warns on an outdated version or a version with no matching tag.
OpenRoot ReviewConfidence score: 5/5 · Safe to mergeThe changes are purely additive CI checks, a new verification script, tests, and a documentation tweak; they do not alter production runtime behavior and only run in pull-request CI. SummaryAdds a CI Key files to review (2)
4 files reviewed · 3 comments (
|
| raise v.NotFound(url) | ||
| if url.endswith('/tags?per_page=100'): | ||
| return [{'name': t} for t in (tags or [])] | ||
| if 'api.github.com' in url: |
There was a problem hiding this comment.
OpenRoot Review summary
The new scripts/verify_sources.py sources-check job is coherent and degrades well for network/API failures, but I found three defects tied to specific lines: (1) installed_packages keeps only the first package per install command ([:1] at lines 90/92/96/98), so pip install demo demo-evil validates only demo and lets a differently named second package pass — the exact failure mode the job advertises; (2) when a listing has a distribution registry URL but its install command names a package of another kind, neither branch of the install loop runs and the command is never checked (line 188); (3) main does not catch per-file exceptions, so one invalid listing aborts the whole job and leaves later listings unchecked (line 220). The workflow and review-agent.md changes look consistent with the script's CLI. I did not flag test code, per review guidance."
Key Issues
| Issue | Location | |
|---|---|---|
| 🔴 | installed_packages only validates the first package named by pip/uv/npm install commands ([:1]), so a wrongly named second package slips through — the exact failure mode the job claims to catch |
scripts/verify_sources.py:90 |
| 🔴 | one invalid listing or exception inside check aborts the whole main loop, leaving later listings unchecked |
scripts/verify_sources.py:220 |
| for i, word in enumerate(words[:-1]): | ||
| nxt = words[i + 1:] | ||
| if word in ('pip', 'pip3', 'pipx') and nxt and nxt[0] == 'install': | ||
| found += [('pypi', w) for w in nxt[1:] if not w.startswith('-')][:1] |
There was a problem hiding this comment.
Bug
installed_packages ignores all but the first package in multi-package install co
installed_packages keeps only the first non-flag package after pip install / uv pip install / npm install because each comprehension ends with [:1] (lines 90, 92, 96, 98). So pip install demo demo-evil validates only demo; a second differently named package installs silently even though the job's stated failure mode is "an install command names a different package". Drop [:1] so every named package is checked against the listing.
| found += [('pypi', w) for w in nxt[1:] if not w.startswith('-')][:1] | |
| found += [('pypi', w) for w in nxt[1:] if not w.startswith('-')] |
Prompt for AI Agents
In scripts/verify_sources.py, remove the `[:1]` slice from all four list comprehensions in `installed_packages` (lines 90, 92, 96 and 98) so every package named by pip/uv/npx install commands is validated against the listing, not just the first one.
Apply this code change:
found += [('pypi', w) for w in nxt[1:] if not w.startswith('-')]
Not useful? Reply
@openroot-review rejectto dismiss this suggestion.
| # Install commands must name the listed package | ||
| for step in entry.get('installation') or []: | ||
| for kind, name in installed_packages(step.get('command', '')): | ||
| if ref and kind == ref[0]: |
There was a problem hiding this comment.
Bug
💡 Suggestion
Install commands in a different package manager than the distribution registry a
When an entry has a distribution registry URL (ref is set) but an install command names a package of another kind — e.g. a PyPI listing with npm install foo — neither branch runs: if ref and kind == ref[0] is false and elif not ref is false, so the command passes unchecked. Cross-registry install commands should at least be verified as published, mirroring the elif not ref branch.
| if ref and kind == ref[0]: | |
| if ref and kind == ref[0]: | |
| if not same_package(kind, name, ref[1]): | |
| errors.append(f'installation: `{step.get("command")}` installs {name}, not the listed package {ref[1]}') | |
| elif not ref or kind != ref[0]: |
Prompt for AI Agents
In scripts/verify_sources.py, in the install-command loop of `check`, change `elif not ref:` to `elif not ref or kind != ref[0]:` so install commands naming a package in a different registry than the listing's distribution URL are still verified as published (using the existing NotFound handling), instead of being silently skipped.
Apply this code change:
if ref and kind == ref[0]:
if not same_package(kind, name, ref[1]):
errors.append(f'installation: `{step.get("command")}` installs {name}, not the listed package {ref[1]}')
elif not ref or kind != ref[0]:
Not useful? Reply
@openroot-review rejectto dismiss this suggestion.
| files = args.files or (changed_listings(args.base) if args.base else sorted((ROOT / 'data/listings').glob('*.json'))) | ||
| report = ['## Listing source check', ''] | ||
| failed = False | ||
| for path in files: |
There was a problem hiding this comment.
Error Handling
💡 Suggestion
One unreadable or invalid listing aborts the whole check job
The per-file loop in main does not catch exceptions: invalid listing JSON (or a failure inside check) aborts the loop, so later listings are never checked and the job exits with a traceback instead of a per-file error annotation. Wrap each file's read/check in try/except, record an error for that file, and continue.
| for path in files: | |
| for path in files: | |
| try: | |
| entry = json.loads(Path(path).read_text(encoding='utf-8')) | |
| errors, warnings = check(entry) | |
| except Exception as error: # noqa: BLE001 | |
| errors = [f'could not check listing: {error}'] | |
| warnings = [] |
Prompt for AI Agents
In scripts/verify_sources.py, in `main`, wrap the per-file `json.loads` and `check(entry)` calls (the `for path in files:` block) in a try/except that records an error for that file and continues with the remaining files, so one bad listing does not abort the whole job.
Apply this code change:
for path in files:
try:
entry = json.loads(Path(path).read_text(encoding='utf-8'))
errors, warnings = check(entry)
except Exception as error: # noqa: BLE001
errors = [f'could not check listing: {error}']
warnings = []
Not useful? Reply
@openroot-review rejectto dismiss this suggestion.
Adds a
sourcesjob on pull requests that runsscripts/verify_sources.pyagainst the listings a PR adds or changes. It reads public APIs only.Fails when the repository is missing, private or archived; the license differs from the repository's; the package or the listed version was never published; or an install command names a different package.
Warns on an older version than the latest release, a version with no matching tag, or anything it couldn't check.
Run against the six open tanbopiao PRs (#68–#73) it flags zifu-memory (listing says Apache-2.0, repo is AGPL-3.0) and warns that sop-retrieval-mcp lists 0.1.21 while 0.1.22 is out. All 21 published listings pass with no errors.
review-agent.mdnow tells the review bot to treat a failure of this job as a finding.🤖 Generated with Claude Code