[spark-compete] tolerate malformed package scripts#1423
Open
Aeyod7 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spark Compete Packet
{ "schema": "spark-compete.packet.v1", "event": "submit", "submission_mode": "pr_review", "submission_target_url": "https://github.com/vibeforge1111/spark-cli/pull/1423", "team": "ARC DEBUG TEAM", "members": [ "Aeyod7", "Shady-web", "AlgofootPrint" ], "author": "Aeyod7", "target_repo": "vibeforge1111/spark-cli", "issue": "Malformed npm package scripts could crash direct_node_package_script_argv with ValueError instead of failing closed.", "evidence": [ "Before patch: direct_node_package_script_argv('npm run dev', package root with scripts.dev = 'node \"unterminated') raised ValueError: No closing quotation.", "After patch: the same malformed package script returns None instead of throwing.", "Focused tests passed: 3 passed in 0.09s.", "Full CLI test file passed: 664 passed, 1 skipped, 160 subtests passed in 14.20s.", "compileall and git diff --check both passed." ], "proposed_fix": "Catch ValueError alongside SystemExit in direct_node_package_script_argv when parsing package scripts and return None for malformed scripts; add regression coverage.", "pr": { "url": "https://github.com/vibeforge1111/spark-cli/pull/1423", "title": "[spark-compete] tolerate malformed package scripts", "branch": "Aeyod7:spark-fresh-bughunt-20260607" }, "review_claim": "pr_review" }actual_behavior
A malformed
package.jsonnpm script with an unterminated quote could crash the package-script fast path:{"scripts": {"dev": "node \"unterminated"}}Calling
direct_node_package_script_argv("npm run dev", root)raised:expected_behavior
Malformed package scripts should fail closed and return
None, matching the surrounding fallback behavior for missing package files, invalid JSON, absent scripts, empty scripts, and command-splitting failures. Spark CLI startup/runtime handling should not crash just because a local npm script is malformed.repro_steps
package.jsoncontaining{"scripts": {"dev": "node \\"unterminated"}}.direct_node_package_script_argv("npm run dev", root).ValueError: No closing quotation.None.before_after_proof
ValueError: No closing quotationfromdirect_node_package_script_argv.None.SparkCliTests::test_direct_node_package_script_argv_returns_none_for_malformed_package_script.tests_or_smoke
duplicate_notes
Checked this as a focused malformed
package.jsonnpm-script crash indirect_node_package_script_argv. No clear existing PR was found for this exact package-scriptValueErrorpath. Related malformed runtime command quote lanes were treated as weaker / possibly duplicate and were not included here.risk_notes
Small CLI-owned defensive parsing fix. It only broadens the existing failure handling around package-script command splitting from
SystemExittoSystemExitorValueError, returningNoneso the caller can use normal fallback behavior. No secrets, credentials, installer publication, or external network behavior changed.review_claim
pr_reviewContributor Checklist