Add Cargo package registry support #80
Merged
Chief Work Horse opened 3 days ago

Summary

  • add a Cargo package plugin module with sparse index support
  • support Cargo publish, download, yank, and unyank endpoints
  • add Cargo package details/help panels and wire the module into the plugin reactor

Verification

  • git diff --check
  • mvn -pl server-plugin/server-plugin-pack-cargo -am test -DskipTests could not be run because mvn and java are not installed in this workspace

Fixes OD-2850

Commits were merged into target branch
  • Work Horse commented 3 days ago

    Summary

    Solid Cargo sparse-registry plugin that follows existing pack-plugin conventions: module wiring, permission checks, per-crate locking, blob storage, publish/download/yank/unyank routing, and sparse index path handling all look correct. UI panels for help and package details are consistent with other package types.

    Requested change

    Verify the crate checksum on publish. Cargo publish metadata includes a cksum field (SHA-256 of the .crate archive). The handler should reject the upload when metadata.cksum does not match Digest.sha256Of(upload.crateFile) (HTTP 400 with an error detail), similar to how PypiPackHandler validates sha256_digest. Without this, corrupted or mismatched publish bodies are accepted even though the index later serves the blob hash.

    Suggestions (non-blocking)

    • In getIndexEntry, default features to an empty object when absent rather than propagating a Jackson missing node (Cargo 1.84+ tolerates omission, but {} is safer).
    • Set index entry v to 2 only when publish metadata contains extended feature syntax; otherwise 1 is sufficient per the registry index spec.
  • Work Horse requested for changes 3 days ago
  • Work Horse commented 3 days ago

    Review summary

    Re-reviewed after the checksum validation fix. The publish handler now requires metadata.cksum, passes it to packBlobService.uploadBlob, and rejects uploads with HTTP 400 ("Digest mismatch") when the archive hash does not match — consistent with PypiPackHandler.

    The implementation looks solid overall: sparse index routing and path validation, publish/download/yank/unyank endpoints, per-crate locking, permission checks, blob storage, index dependency mapping, and UI help/package detail panels all follow existing pack-plugin conventions.

    Non-blocking follow-ups (optional):

    • Default features to {} in getIndexEntry when absent rather than propagating a missing Jackson node.
    • Set index entry v to 2 only when publish metadata contains extended feature syntax; otherwise 1 is sufficient per the registry index spec.
  • Work Horse approved 3 days ago
  • Robin Shen merged 3 days ago
1/1
Submitter Chief Work Horse
Target main
Source issue-2850-add-rust-cargo
Merge Strategy
Create Merge Commit
Watchers (1)
Reference
pull request OD-80
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover