Skip to content

[Experimental] Modernize Python tooling scripts#213

Merged
TheGoatGod merged 10 commits intomasterfrom
codex/update-all-python-packages
Apr 9, 2026
Merged

[Experimental] Modernize Python tooling scripts#213
TheGoatGod merged 10 commits intomasterfrom
codex/update-all-python-packages

Conversation

@TheGoatGod
Copy link
Copy Markdown
Member

@TheGoatGod TheGoatGod commented Oct 7, 2025

User description

Name the mod added to the compilation or fixed.

  1. N/A (tooling maintenance)

fixes and tweeks.

  1. Tooling scripts
    a. Standardized each helper's CLI, logging controls, and path handling.
    b. Hardened shared JSON utilities for safer formatting and error reporting.
    c. Refreshed vehicle reformatter automation for cross-platform use.

https://chatgpt.com/codex/tasks/task_e_68e58ac3b2308333bf660209def294d7


CodeAnt-AI Description

Modernize the JSON maintenance scripts

What Changed

  • Replaced several old helper scripts with command-line tools that can process one file or a whole folder, preview changes first, and report updated, unchanged, and error files.
  • Added safer updates for legacy JSON data, including converting old body-part covers, volume and barrel values, magazine reliability removal, storage-to-pocket conversion, and several outdated field names and formats.
  • Updated vehicle reformatting to keep mixed part data intact, handle single-object files, and still produce readable output even when the external formatter is missing.

Impact

✅ Faster bulk JSON cleanup
✅ Fewer manual edit mistakes
✅ Clearer legacy data conversion results

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Oct 7, 2025

CodeAnt AI is reviewing your PR.

@codeant-ai codeant-ai bot added the size:XL This PR changes 500-999 lines, ignoring generated files label Oct 7, 2025
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment thread tools/recipe_extractor_and_editor.py Outdated
Comment thread tools/barrellength_volume.py Outdated
Comment thread tools/barrellength_volume.py Outdated
Comment thread tools/base_script.py Outdated
Comment thread tools/base_script.py Outdated
Comment thread tools/covers_update.py Outdated
Comment thread tools/vehicle_reformatter.py Outdated
Comment thread tools/vehicle_reformatter.py Outdated
Comment thread tools/weight_update.py Outdated
Comment thread tools/weight_update.py Outdated
Comment thread tools/weight_update.py Outdated
Comment thread tools/time_to_string.py
@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Oct 7, 2025

CodeAnt AI finished reviewing your PR.

@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Mar 29, 2026

CodeAnt AI is running Incremental review


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai bot added size:XL This PR changes 500-999 lines, ignoring generated files and removed size:XL This PR changes 500-999 lines, ignoring generated files labels Mar 29, 2026
Comment thread tools/update_legacy_json.py
Comment thread tools/vehicle_reformatter.py
@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Mar 29, 2026

CodeAnt AI Incremental review completed.

@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Apr 3, 2026

CodeAnt AI is running Incremental review


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai bot added size:XXL This PR changes 1000+ lines, ignoring generated files and removed size:XL This PR changes 500-999 lines, ignoring generated files labels Apr 3, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Apr 3, 2026

CodeAnt AI Incremental review completed.

@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Apr 9, 2026

CodeAnt AI is running Incremental review


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai bot added size:XXL This PR changes 1000+ lines, ignoring generated files and removed size:XXL This PR changes 1000+ lines, ignoring generated files labels Apr 9, 2026
@TheGoatGod TheGoatGod merged commit f272016 into master Apr 9, 2026
0 of 2 checks passed
@TheGoatGod TheGoatGod deleted the codex/update-all-python-packages branch April 9, 2026 09:08

# Run formatter if provided
if args.formatter and os.path.exists(args.formatter):
subprocess.run([args.formatter, path], capture_output=True)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The formatter process result is ignored, so the script reports success even when formatting fails. Check the formatter exit code and return an error when it fails so broken formatter runs are not silently treated as successful updates. [logic error]

Severity Level: Major ⚠️
- ⚠️ Storage-to-pocket converter reports success despite formatter failures.
- ⚠️ Error summary ignores failures from json_formatter.cgi runs.
Suggested change
subprocess.run([args.formatter, path], capture_output=True)
result = subprocess.run([args.formatter, path], capture_output=True, text=True)
if result.returncode != 0:
LOGGER.error(f"Formatter failed for {path}: {result.stderr.strip()}")
return "error"
Steps of Reproduction ✅
1. Run the script from the repo root, e.g. `python3 tools/storage_to_pocket_data.py
--formatter /path/to/failing_formatter some.json`, which executes `main()` at
`tools/storage_to_pocket_data.py:140-157`.

2. `main()` calls `process_path()` at `tools/storage_to_pocket_data.py:121-138`, which in
turn calls `process_file()` at `tools/storage_to_pocket_data.py:82-119` for `some.json`.

3. Inside `process_file()`, after writing the transformed JSON at lines 107-109, the
formatter condition at lines 111-112 passes (`args.formatter` is set and exists) and
`subprocess.run([args.formatter, path], capture_output=True)` at line 113 is executed; the
return code is ignored and no exception is raised on non‑zero exit.

4. Even if `/path/to/failing_formatter` exits with an error, execution continues to lines
115-116 where `[UPDATED] some.json` is printed and `"updated"` is returned, and `main()`
aggregates stats at lines 151-154 reporting an updated file and zero errors, masking the
formatter failure.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** tools/storage_to_pocket_data.py
**Line:** 113:113
**Comment:**
	*Logic Error: The formatter process result is ignored, so the script reports success even when formatting fails. Check the formatter exit code and return an error when it fails so broken formatter runs are not silently treated as successful updates.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Apr 9, 2026

CodeAnt AI Incremental review completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex size:XXL This PR changes 1000+ lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant