fix(marketplace): guard fetch-source against missing sourceUrl/sha#1691
fix(marketplace): guard fetch-source against missing sourceUrl/sha#1691gai095481 wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe marketplace source-fetch script makes ChangesOptional source-fetch fields and validation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The marketplace-fetch-source script crashes with TypeError when sourceUrl
is undefined, which happens when the CI workflow runs on PRs that don't
add a marketplace entry (no sourceUrl in entry.json).
- Make sourceUrl and sha optional in MarketplaceEntry interface
- Add early return with exit(0) when either field is missing
- Output empty {files, errors} result so downstream AI review node
can proceed without source files instead of killing the workflow
Fixes the Run marketplace auto-review CI failure on PRs coleam00#1685 and coleam00#1689.
Review SummaryVerdict: minor-fixes-needed This PR adds a guard to Blocking issues(none — no CRITICAL findings) Suggested fixes
Minor / nice-to-have
Compliments
Reviewed via maintainer-review-pr workflow (Pi/Minimax). Aspects run: code-review, error-handling, test-coverage, comment-quality. |
- Add marketplace-fetch-source.test.ts covering all guard paths: - missing sourceUrl only (stderr mentions sourceUrl, exit 0) - missing sha only (stderr mentions sha, exit 0) - missing both (stderr mentions both, exit 0) - both present (guard does not trigger, gh api errors expected) - missing entry.json (exit 1) - Trim inline comment to 2 lines per review feedback
Summary
The
marketplace-fetch-sourcescript crashes withTypeError: undefined is not an object (evaluating 'sourceUrl.match')whensourceUrlis undefined inentry.json. This happens on PRs that don't add a marketplace entry (nosourceUrlfield), causing the marketplace-auto-review CI check to fail on every such PR.Problem
fetch-sourcedestructures{ sourceUrl, sha }fromentry.jsonwithout null checksmarketplace.ts, thesourceUrlfield isundefined.match()onundefinedthrowsTypeError, killing the entire workflowWhat Changed
sourceUrlandshaoptional in theMarketplaceEntryinterface{ files, errors }result, then exit 0Validation
exit(0)— no behavioral change whensourceUrlandshaare present (the happy path for marketplace entries)Security Impact
None. This is a defensive null check that prevents a crash; no new data flows or permissions are introduced.
Compatibility
Fully backward compatible. Existing marketplace entries with valid
sourceUrl/shaare unaffected.Rollback Plan
Revert this commit to restore the previous behavior (crash on missing fields).
Blast Radius
Single script:
.archon/scripts/marketplace-fetch-source.ts. Only affects thefetch-sourcenode inmarketplace-pr-review-and-merge.yaml. No other workflows or scripts are impacted.Risks & Mitigations
bundle-sourcenode (from PR fix(marketplace-auto-review): feed actual workflow source to AI reviewer #1689) already handles surfacing available source content to the AI reviewer. When source files are empty, the reviewer works with what it has — this is preferable to the entire CI check crashing.Summary by CodeRabbit