Skip to content

adding merge script#138

Merged
CIGbalance merged 33 commits intomainfrom
feat/merge_script
Apr 21, 2026
Merged

adding merge script#138
CIGbalance merged 33 commits intomainfrom
feat/merge_script

Conversation

@CIGbalance
Copy link
Copy Markdown
Collaborator

@CIGbalance CIGbalance commented Dec 3, 2025

Adds a script that merges new problems in a yaml file into the big problems yaml (after validity check). This is intended for usage locally

Closes #125

@CIGbalance CIGbalance changed the base branch from feat/ga_consistency to main April 8, 2026 09:04
@CIGbalance CIGbalance marked this pull request as ready for review April 20, 2026 12:30
Copilot AI review requested due to automatic review settings April 20, 2026 12:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a merge utility intended for GitHub Actions that validates a “new problems” YAML file and merges it into problems.yaml, refactoring the existing YAML validator to be reusable from other scripts.

Changes:

  • Refactor utils/validate_yaml.py to expose validate_data() / return booleans instead of exiting.
  • Add utils/merge_yaml.py to validate and merge new problems into problems.yaml.
  • Update docs/workflow files related to the “new problem” flow.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
utils/validate_yaml.py Refactors validation into reusable functions and adjusts CLI behavior.
utils/new_problem.yaml Removes the template file (affects submission/validation flow).
utils/merge_yaml.py New script to validate + merge new problems into problems.yaml.
utils/README.md Adds an example snippet for the new-problem YAML format.
docs/problems.html Updates rendered docs table output (empty cells / spacing).
docs/index.html Updates rendered docs table output (empty cells / spacing).
.github/workflows/new_problem_check.yml Adjusts workflow triggers/step guard for the new-problem validation.
Comments suppressed due to low confidence (1)

.github/workflows/new_problem_check.yml:11

  • This workflow is still keyed to utils/new_problem.yaml, but that file was removed in this PR. As a result the validation step will never run for new submissions (and contributors no longer have a template to edit). Either keep/restore utils/new_problem.yaml in the repo, or update the workflow paths (and the script invocation) to match the new intended submission file pattern.
  push:
    branches:
      - main
    paths:
      - "utils/new_problem.yaml"
  pull_request:
    paths:
      - "utils/new_problem.yaml"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread utils/merge_yaml.py Outdated
Comment thread utils/merge_yaml.py Outdated
Comment thread utils/README.md Outdated
Comment thread utils/validate_yaml.py Outdated
@CIGbalance CIGbalance changed the title adding merge script (untested) adding merge script Apr 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new utility script intended for GitHub Actions to merge a “new problems” YAML file into the repository’s main problems.yaml after validation (Issue #125).

Changes:

  • Introduces utils/merge_yaml.py to read/validate a new YAML file and append its entries to problems.yaml.
  • Writes the updated problems.yaml and removes the “new problems” file after merging.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread utils/merge_yaml.py Outdated
Comment thread utils/merge_yaml.py
Comment thread utils/merge_yaml.py Outdated
@CIGbalance CIGbalance changed the base branch from main to feat/problem_check_cosmetics April 20, 2026 12:53
Base automatically changed from feat/problem_check_cosmetics to main April 20, 2026 14:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a utility script intended for GitHub Actions that merges a “new problems” YAML file into the repository’s main problems.yaml after validating the incoming data.

Changes:

  • Introduce utils/merge_yaml.py to read, validate, append, and write merged YAML data
  • Add cleanup behavior to delete the “new problems” YAML file after a successful merge

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread utils/merge_yaml.py Outdated
Comment thread utils/merge_yaml.py
Comment thread utils/merge_yaml.py Outdated
Comment thread utils/merge_yaml.py Outdated
CIGbalance and others added 6 commits April 20, 2026 16:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an automated merge utility to combine newly submitted problem definitions into the main problems.yaml, reusing the existing YAML validation logic (intended for GitHub Actions usage).

Changes:

  • Refactors utils/validate_yaml.py to expose validate_data(...) for programmatic validation reuse.
  • Adds utils/merge_yaml.py to validate a “new problems” YAML file, append entries into problems.yaml, and delete the input file after a successful merge.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
utils/validate_yaml.py Adds typing and splits validation into a reusable validate_data helper plus CLI wrapper.
utils/merge_yaml.py New script to validate + merge new problems into problems.yaml and clean up the input file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread utils/validate_yaml.py
@CIGbalance CIGbalance requested a review from kvdblom April 20, 2026 14:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a GitHub Actions–oriented utility for merging newly submitted problems from a separate YAML file into the main problems.yaml, and refactors the existing YAML validator to expose a reusable validation function.

Changes:

  • Refactors utils/validate_yaml.py to add type hints and introduce validate_data() for programmatic validation.
  • Adds utils/merge_yaml.py to validate, append, write back, and then delete the “new problems” YAML file.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
utils/validate_yaml.py Adds typing + extracts validate_data() so other scripts can reuse validation logic.
utils/merge_yaml.py New merge script that reads/validates new problems, appends them to the target YAML, writes, and deletes the input file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread utils/merge_yaml.py
Comment thread utils/merge_yaml.py Outdated
Comment on lines +79 to +81
# Remove the new file after merging
rm_status = delete_new_file(new_problems_yaml_path)
if not rm_status:
Comment thread utils/validate_yaml.py
Comment thread utils/validate_yaml.py Outdated
Comment on lines 84 to 87
def check_novelty(data: Dict) -> bool:
# Load existing problems
read_status, existing_data = read_data(PROBLEMS_FILE)
if read_status != 0:
Comment thread utils/validate_yaml.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new YAML merge utility intended for GitHub Actions / maintainer workflows, and refactors the existing YAML validator so its validation logic can be reused programmatically.

Changes:

  • Refactor validate_yaml.py to expose validate_data() for validating already-loaded YAML data structures.
  • Add merge_yaml.py to merge a “new problems” YAML file into the main problems.yaml file (and delete the source file after merging).
  • Update utils/README.md to document the updated workflow and new merge script.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
utils/validate_yaml.py Adds type hints and extracts reusable validate_data() used by other scripts.
utils/merge_yaml.py New script that reads/validates new YAML, appends it to the existing YAML, writes back, and deletes the input file.
utils/README.md Updates usage/workflow docs for validation and merging scripts.
Comments suppressed due to low confidence (1)

utils/validate_yaml.py:24

  • The read_data() return type is annotated as Tuple[int, List[Dict] | None], but yaml.safe_load() can return many top-level types (e.g., dict, str, None). This annotation is inaccurate and encourages callers to skip explicit type checks. Consider widening the return type (e.g., to Any | None) and adding an explicit isinstance(data, list) check with a clear error when the top-level YAML is not the expected list-of-maps format.
def read_data(filepath: str) -> Tuple[int, List[Dict] | None]:
    try:
        with open(filepath, "r") as f:
            data = yaml.safe_load(f)
            return 0, data

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread utils/README.md Outdated
Comment thread utils/README.md Outdated
Comment thread utils/merge_yaml.py
@CIGbalance CIGbalance merged commit c9d37c8 into main Apr 21, 2026
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.

Create a script that merges new problem (in separate file) and existing problems (yaml)

3 participants