Skip to content

Harden set-version JSON updates#11

Merged
Prgm-code merged 1 commit into
mainfrom
develop
Jul 10, 2026
Merged

Harden set-version JSON updates#11
Prgm-code merged 1 commit into
mainfrom
develop

Conversation

@Prgm-code

@Prgm-code Prgm-code commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Reworked scripts/set-version.mjs to parse JSON before editing version fields.
  • Tightened validation so the script only updates a single top-level string version value.
  • Added safeguards against malformed JSON and nested or ambiguous version keys.

Testing

  • Not run (script-only change).
  • Verified the patch logic targets the top-level version field by indent and JSON structure.
  • Confirmed malformed JSON now fails with a parse error cause instead of a blind text replacement.

Summary by CodeRabbit

  • Bug Fixes
    • Improved version updates in project metadata files.
    • Added validation to prevent malformed or ambiguous version entries from being updated.
    • Preserved the original file formatting while changing only the top-level version value.

- Parse JSON before updating version fields
- Ensure only the top-level version key is replaced
- Improve error handling for invalid or ambiguous files
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 73f6aa1f-ba55-4554-9260-a6d9dc1672fd

📥 Commits

Reviewing files that changed from the base of the PR and between 21216fe and 1168722.

📒 Files selected for processing (1)
  • scripts/set-version.mjs

📝 Walkthrough

Walkthrough

The version update script now parses and validates JSON, identifies the unique top-level version field from the original source, and replaces only its value while preserving surrounding formatting. Parse failures include the original error as a cause.

Changes

Version update handling

Layer / File(s) Summary
Validated JSON version rewrite
scripts/set-version.mjs
updateJson validates the parsed JSON structure, locates the uniquely indented top-level version key, checks correspondence with the parsed value, and rewrites only the version value.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and testing, but it omits the required Docs, Security, Risk, and Screenshots sections. Add the missing template sections, especially the Security checklist, plus Docs, Risk, and Screenshots entries or N/A notes if not applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: hardening JSON version updates in set-version.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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 develop

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.

❤️ Share

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

@Prgm-code
Prgm-code merged commit f75fcc2 into main Jul 10, 2026
8 checks passed
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