Conversation
Skip malformed PDSC entries with warnings and treat directory stat errors as nonexistent paths to avoid panics. Preserve configured public index filenames instead of appending a duplicate index.pidx.
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (3)
🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|
There was a problem hiding this comment.
🟡 Changes recommended
Three moderate issues remain unresolved in public-index handling and PDSC validation.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR hardens public index handling, PIDX parsing, and directory error handling.
Changes:
- Resolves sources that already include
index.pidx. - Skips malformed PDSC entries with warnings.
- Makes
DirExistssafely returnfalseon filesystem errors. - Adds regression tests.
File summaries
| File | Summary |
|---|---|
cmd/xml/pidx.go |
Validates and filters PDSC entries. Moderate findings: versionless entries remain accepted, and valid timezone-suffixed dates may be rejected (1 vote each). |
cmd/xml/pidx_test.go |
Adds malformed PDSC entry test coverage. |
cmd/utils/utils.go |
Handles filesystem errors safely in directory checks. |
cmd/utils/utils_test.go |
Adds invalid-directory regression coverage. |
cmd/installer/root.go |
Resolves public index sources. Moderate finding: file:// sources are not converted before local path handling (3 votes). |
cmd/installer/root_test.go |
Adds public-index source and invalid-path regression coverage. |
Review details
Suppressed comments (2)
cmd/xml/pidx.go:483
versionis a requiredpdscattribute intestdata/PackIndex.xsd:60, but this condition skips validation when it is empty. A versionless entry is still inserted under aVendor.Name.key and can be selected as the public pack entry, so malformed PDSC records are not fully excluded. Validate the field unconditionally (or explicitly handle versionless entries as a separate supported format).
if p.Version != "" && !utils.IsPackVersionValid(p.Version) {
invalidFields = append(invalidFields, "version")
cmd/xml/pidx.go:487
- The PIDX schema declares
deprecatedasxs:date(testdata/PackIndex.xsd:62), whose lexical form permits a trailingZor timezone offset. This exact layout rejects valid values such as2026-09-14Zand skips the entire PDSC entry, so valid metadata can disappear; parse the full schema date form and keepcomputeIsDeprecatedconsistent with it.
if p.Deprecated != "" {
if _, err := time.Parse("2006-01-02", p.Deprecated); err != nil {
invalidFields = append(invalidFields, "deprecated")
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Fixes
cpackget addcrashes when updating a filesystem hosted.Web/index.pidxgenerated byvidx2pidx#835Changes
index.pidx.falsefromDirExistsfor any filesystem error instead of risking a panic.Invalid PDSC entries are now excluded from the index, which may change behavior for previously accepted malformed metadata.
Checklist