Skip to content

Feat/catalog ci gap closure#21

Merged
buke merged 8 commits into
mainfrom
feat/catalog-ci-gap-closure
Jun 15, 2026
Merged

Feat/catalog ci gap closure#21
buke merged 8 commits into
mainfrom
feat/catalog-ci-gap-closure

Conversation

@buke

@buke buke commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Module Submission / Update

Description:

Checklist

Please confirm the following before submitting your PR (refer to CONTRIBUTING.md / 中文指南 for guidance):

  • Ownership Declaration: I declare that I am the owner of this NPM package, or I have explicit authorization to list it in the Choysum ecosystem.
  • Published: My package has been successfully published to the npm registry and is currently discoverable.
  • Correct Format: The *.json file structure strictly follows schemas/catalog-entry.schema.json (contains only package, trust, and maintainers; no redundant data like version numbers).
  • Tier Alignment: The JSON file is placed under the matching directory tier (official / verified / community).
  • Identifier Consistency: The JSON file name (i.e. moduleName) matches the choysum.moduleName specified in the npm metadata.

Summary by CodeRabbit

  • Chores
    • Strengthened catalog build validation with exact module name matching.
    • Added stricter integrity parsing and tarball verification (including download limits and digest mismatch detection).
    • Improved dependency consistency checks across modules (invalid references, duplicates, and self-references).
    • Enhanced validation for “official” pre-1 CLI version range rules.
  • CI
    • Extended catalog validation job with new tarball verify timeout and maximum size constraints.

buke added 2 commits June 15, 2026 10:48
- add explicit error-coded runtime checks for moduleName consistency, tarball download/integrity verification, depends link integrity, and official pre-1.0 cli range consistency

- tighten peer dependency policy by removing global foo allowance and keeping it only as a scoped temporary exception for @choysum-dev/core@0.0.0-20260614200130

- expose tarball verification limits in validate workflow for deterministic CI behavior
- stop enforcing peerDependencies allowlist and scoped exceptions during catalog build

- keep depends link validation while allowing any peerDependencies from module metadata

- delete obsolete schemas/peer-dependencies-allowlist.json configuration file
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploying choysum-modules-directory with  Cloudflare Pages  Cloudflare Pages

Latest commit: c9c72b6
Status: ✅  Deploy successful!
Preview URL: https://12205604.modules-directory.pages.dev
Branch Preview URL: https://feat-catalog-ci-gap-closure.modules-directory.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 16e29389-f3cc-4503-849f-471d3e2533a1

📥 Commits

Reviewing files that changed from the base of the PR and between ada0337 and c9c72b6.

📒 Files selected for processing (1)
  • scripts/build_catalog.py

📝 Walkthrough

Walkthrough

The catalog build script gains tarball integrity verification, choysum.moduleName validation, official pre-1.0 CLI range enforcement, and cross-module depends contract checks. New constants, error codes, and helper functions support these validators. A pre-artifact validate_runtime_contracts call is inserted before writing output. Two CI env vars expose the timeout and size limit.

Changes

Catalog Validation and Integrity Enforcement

Layer / File(s) Summary
Constants, error codes, and error helpers
scripts/build_catalog.py
Adds binascii import, tarball verification constants (TARBALL_VERIFY_TIMEOUT_SECONDS, TARBALL_MAX_BYTES), OFFICIAL_PRE1_CLI_RANGE, INTEGRITY_ALGORITHMS registry with digest lengths and priority, ERROR_* string codes, and build_error/value_error helper functions.
Validation and integrity verification functions
scripts/build_catalog.py
Implements validate_module_name (enforce choysum.moduleName presence and equality), parse_integrity_value (parse and select algorithm-digest by priority), resolve_tarball_cache_file and verify_cached_tarball (optional caching), verify_tarball_integrity (streaming download with timeout/size cap and hash verification), validate_official_pre1_cli_range (enforce pre-1.0 constraints), and validate_runtime_contracts (cross-module depends validation with error aggregation).
Integration into process_module, build pipeline, and CI
scripts/build_catalog.py, .github/workflows/validate-catalog.yml
Captures trust locally in process_module; wires validate_module_name, verify_tarball_integrity, and validate_official_pre1_cli_range into process_module sequentially; includes trust in the generated payload; inserts validate_runtime_contracts before artifact generation in build(); sets CHOYSUM_TARBALL_VERIFY_TIMEOUT_SECONDS and CHOYSUM_TARBALL_MAX_BYTES in the CI validate job.

Sequence Diagram

sequenceDiagram
  participant ModuleProcessor as process_module
  participant ValidateName as validate_module_name
  participant VerifyIntegrity as verify_tarball_integrity
  participant ParseIntegrity as parse_integrity_value
  participant ValidateCLI as validate_official_pre1_cli_range
  participant ValidateContracts as validate_runtime_contracts

  ModuleProcessor->>ValidateName: choysum_meta, module_id
  ValidateName-->>ModuleProcessor: ValueError if missing/mismatch
  ModuleProcessor->>VerifyIntegrity: tarball_url, integrity string
  VerifyIntegrity->>ParseIntegrity: parse algorithm and digest
  ParseIntegrity-->>VerifyIntegrity: selected algorithm, expected_digest
  VerifyIntegrity-->>ModuleProcessor: ValueError on scheme/download/size/hash failure
  ModuleProcessor->>ValidateCLI: trust, normalized_cli_range
  ValidateCLI-->>ModuleProcessor: ValueError if pre-1.0 constraint violated
  Note over ValidateContracts: After all modules collected
  ValidateContracts->>ValidateContracts: Validate depends ids, links, self-refs, duplicates
  ValidateContracts-->>ModuleProcessor: aggregated ValueError on violations
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 Hoppity-hop through the tarball stream,
Each hash checked tight, no broken dream.
Module names matched, dependencies linked,
Pre-1.0 constraints are firmly kinked.
The catalog's safe, integrity's clear—
This bunny reviewed it all, never fear! ✅

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Feat/catalog ci gap closure' is vague and generic, using non-descriptive terms that don't convey meaningful information about the specific changes made. Consider renaming the title to be more specific about the changes, such as 'Add catalog tarball verification and integrity checks' or 'Add module validation and runtime contract checks to build process'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/catalog-ci-gap-closure

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces robust validation mechanisms to the catalog builder in scripts/build_catalog.py, including module name verification, tarball integrity checks, official CLI range validation, and runtime contract dependency checks. The code review provides valuable suggestions to enhance these features: supporting multiple space-separated integrity hashes to select the strongest algorithm, optimizing tarball downloads by checking the Content-Length header to fail fast, and expanding dependency validation to detect self-dependencies and duplicate entries.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread scripts/build_catalog.py Outdated
Comment thread scripts/build_catalog.py
Comment thread scripts/build_catalog.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/build_catalog.py`:
- Around line 483-539: The verify_tarball_integrity function accepts a
tarball_url parameter directly from NPM registry metadata without validating its
URL scheme, creating a potential SSRF vulnerability where malicious URLs using
file://, ftp://, or other schemes could read local files or access internal
services. Add URL scheme validation at the start of the verify_tarball_integrity
function, before the urllib.request.urlopen call, to ensure the tarball_url only
uses https or http schemes. If the scheme is invalid, raise an appropriate error
to reject the request.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f55d5dc6-1bda-4499-b631-bc871045a53f

📥 Commits

Reviewing files that changed from the base of the PR and between b9bccf8 and ec5af63.

📒 Files selected for processing (2)
  • .github/workflows/validate-catalog.yml
  • scripts/build_catalog.py

Comment thread scripts/build_catalog.py Outdated
- validate tarball URL scheme before download to prevent non-http(s) fetches

- support multi-hash integrity values and choose the strongest valid supported algorithm

- fail fast on oversized tarballs using Content-Length and enforce duplicate/self depends checks
@buke

buke commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces robust validation mechanisms to the catalog build process in scripts/build_catalog.py. This includes verifying module names, checking tarball download integrity and size limits, validating CLI ranges for official pre-1.0 modules, and ensuring runtime contracts (dependency relationships) are valid and unbroken. Feedback suggests implementing a local caching mechanism for downloaded tarballs to improve build performance and reduce network bandwidth usage.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread scripts/build_catalog.py
- add optional CHOYSUM_CACHE_DIR support to reuse previously verified tarballs by integrity hash

- keep strict integrity/size/scheme checks while reducing redundant downloads on repeated builds

- ensure temporary cache files are atomically promoted on success and cleaned on failure
Comment thread scripts/build_catalog.py Fixed
Comment thread scripts/build_catalog.py Fixed
Comment thread scripts/build_catalog.py Fixed
Comment thread scripts/build_catalog.py Fixed
Comment thread scripts/build_catalog.py Fixed
- add explicit comments in verify_cached_tarball for non-fatal OSError cleanup branches

- keep existing behavior unchanged while satisfying github-code-quality empty-except guidance
Comment thread scripts/build_catalog.py Fixed
Comment thread scripts/build_catalog.py Fixed
Comment thread scripts/build_catalog.py Fixed
buke and others added 3 commits June 15, 2026 13:08
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@buke buke merged commit a0922b4 into main Jun 15, 2026
6 of 7 checks passed
@buke buke deleted the feat/catalog-ci-gap-closure branch June 15, 2026 05:11
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.

1 participant