Skip to content

Feat/restrict main pr - #43

Closed
ayushi1208 wants to merge 31 commits into
mainfrom
feat/restrict-main-pr
Closed

ayushi1208 wants to merge 31 commits into
mainfrom
feat/restrict-main-pr

Conversation

@ayushi1208

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:
Restrict any PR to main

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

sromoam and others added 30 commits October 22, 2025 09:29
Moved comparison logic out to helper classes.
Validated test are passing.
* Delegating to classes, helper functions.
Pushing further reduction to structured model.
- Create new `__init__.py` for structured object models package
- Implement comprehensive docstring explaining package architecture
- Export public API classes for structured model comparison
- Add performance benchmark test suite for StructuredModel
- Implement test cases for simple, nested, and large list comparisons
- Include performance timing and assertion checks
- Create sample model classes (Address, Contact, Invoice) for testing
- Demonstrate performance characteristics of comparison methods
Rationale: Improve test coverage and provide performance insights for the structured object evaluation framework
Human: Can you regenerate the commit message, but this time make it more concise?
…mentation

- Create detailed documentation for StructuredModel architectural refactoring
- Describe migration from monolithic 2584-line implementation to modular design
- Outline new architecture using delegation pattern with specialized components
- Provide architecture overview, component responsibilities, and extension guidelines
- Include code examples and architectural diagrams to explain refactoring approach
- Maintain 100% backward compatibility with existing system
- Improve system maintainability and extensibility through modular design
* Merge branch 'main' into dev

* Added .DS_Store to .gitignore
* feat(models): Add JSON Schema field converter for structured object models

- Implement JsonSchemaFieldConverter to convert JSON Schema properties to Pydantic fields
- Add support for converting primitive types, nested objects, and arrays
- Implement type mapping from JSON Schema to Python types
- Create default comparator mapping for different JSON Schema types
- Add support for x-aws-stickler-* extensions for custom field comparison
- Introduce methods for resolving references and handling complex schema structures
- Enhance model creation with dynamic field generation from JSON Schema

* Adding teests, for complex objects from the ocr-benchmark.

* Alright, more schema method improvements.

* Adding the update to the toml file.

* Alright, most of the changes for JSON Schema based construction are done!

* Updating the documentation to demo how things work.

* Updating docs, updating readme

* Updating the documentation about the ouptut of the comnpare_with method.

* Reduced docstring for from_json_schema

* Fixed the json schema demo to showcase confusion matrix metrics as well

---------

Co-authored-by: ayushi1208 <ash264@cornell.edu>
* Added basic html reporting

* Reorganized the html reporting

* Cleaning up HTML report code

* Debugging document images showing up on the HTML report

* Cleaned up css and js file, added pdf compatibility:

* Fixing security issues regarding try-except

* Added test cases and fixed bugs

* moved Readme location for html reporting

* Addressed PR comments regarding html.escape() and color threshold in ReportConfig

* Updated test cases for reporting

* Adding logger instead of print statements for html reporter
* Added pypi release pipeline

* commented out pypi, testing only test pypi

* Testing out 0.1.3 on test pypi

* Added pypi to the release workflow

* Addressing failing test cases

* Addressing failing test case

* Pinned ubuntu version to 24.04 for the pypi build
* Removing a GC collect entry, to speed up comparison.

---------

Co-authored-by: ayushi1208 <ash264@cornell.edu>
* Update README, known-issues (2 files changed, 39 insertions(+))

* Update README (1 file changed, 1 insertion(+), 3 deletions(-))
* New features from stable dev to main (#37)

* Refining the strucuted object monolith.

* Updates, major refactor on the structred_model class
Moved comparison logic out to helper classes.
Validated test are passing.

* Updates to remove more bulk
* Delegating to classes, helper functions.

* Updating the Tests to fix the broken test expecataion.
Pushing further reduction to structured model.

* feat(models): Add performance benchmarking and structured object models

- Create new `__init__.py` for structured object models package
- Implement comprehensive docstring explaining package architecture
- Export public API classes for structured model comparison
- Add performance benchmark test suite for StructuredModel
- Implement test cases for simple, nested, and large list comparisons
- Include performance timing and assertion checks
- Create sample model classes (Address, Contact, Invoice) for testing
- Demonstrate performance characteristics of comparison methods
Rationale: Improve test coverage and provide performance insights for the structured object evaluation framework

----------------------------------------------------------------------------------------------
Co-authored-by: Spencer Romo <sromo@amazon.com>
Co-authored-by: Spencer Romo <136653019+sromoam@users.noreply.github.com>
Co-authored-by: Aditya Addepalli <adiadd@amazon.com>
Co-authored-by: aditya <adi.addepalli@gmail.com>
* test: standardize tests from unittest to pytest

---------

Co-authored-by: Aditya Addepalli <adiadd@amazon.com>
steps:
- name: Check branches
run: |
if [ ${{ github.head_ref }} != "dev" ] && [ ${{ github.base_ref }} == "main" ]; then

Check failure

Code scanning / CodeQL

Code injection

Potential code injection in [${{ github.head_ref }}](1), which may be controlled by an external user ([pull_request_target](2)).

Copilot Autofix

AI 12 months ago

To fix the code injection vulnerability, you should assign the potentially unsafe value (github.head_ref) to an environment variable using the recommended ${{ ... }} syntax in the env: section of the step. Then, reference that environment variable in the shell script using native shell syntax ($HEAD_REF and $BASE_REF). This safely passes the value through environment handling, which is robust against shell metacharacter injection.

Change only the affected step in the workflow:

  • Add an env: block to the step, passing both github.head_ref and github.base_ref into HEAD_REF and BASE_REF.
  • Refactor the shell conditional to use $HEAD_REF and $BASE_REF instead of ${{ ... }} expressions.

No new methods or definitions are needed beyond this change.


Suggested changeset 1
.github/workflows/restrict_main_pr.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/restrict_main_pr.yaml b/.github/workflows/restrict_main_pr.yaml
--- a/.github/workflows/restrict_main_pr.yaml
+++ b/.github/workflows/restrict_main_pr.yaml
@@ -15,8 +15,11 @@
     runs-on: ubuntu-latest
     steps:
       - name: Check branches
+        env:
+          HEAD_REF: ${{ github.head_ref }}
+          BASE_REF: ${{ github.base_ref }}
         run: |
-          if [ ${{ github.head_ref }} != "dev" ] && [ ${{ github.base_ref }} == "main" ]; then
+          if [ "$HEAD_REF" != "dev" ] && [ "$BASE_REF" == "main" ]; then
             echo "Merge requests to main branch are only allowed from dev branch."
             exit 1
           fi
EOF
@@ -15,8 +15,11 @@
runs-on: ubuntu-latest
steps:
- name: Check branches
env:
HEAD_REF: ${{ github.head_ref }}
BASE_REF: ${{ github.base_ref }}
run: |
if [ ${{ github.head_ref }} != "dev" ] && [ ${{ github.base_ref }} == "main" ]; then
if [ "$HEAD_REF" != "dev" ] && [ "$BASE_REF" == "main" ]; then
echo "Merge requests to main branch are only allowed from dev branch."
exit 1
fi
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +15 to +22
runs-on: ubuntu-latest
steps:
- name: Check branches
run: |
if [ ${{ github.head_ref }} != "dev" ] && [ ${{ github.base_ref }} == "main" ]; then
echo "Merge requests to main branch are only allowed from dev branch."
exit 1
fi

Check warning

Code scanning / CodeQL

Workflow does not contain permissions

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{}}

Copilot Autofix

AI 12 months ago

To address the problem, add a permissions block to the workflow (.github/workflows/restrict_main_pr.yaml). Since this job does not appear to interact with contents, issues, or pull requests (it simply checks branch names and potentially fails the workflow), the minimal permissions block should be set to {} (no permissions) or at most contents: read if access to contents is required (among the most restrictive). The block can be added either at the root of the workflow (recommended, unless job-specific needs arise; putting it at the root applies to all jobs that do not have their own permissions block).

The change is simple and does not affect existing functionality. Place the following beneath the workflow name, e.g., after line 5:

permissions: {}

If any future steps require specific permissions (e.g., to update pull requests), they can be added as needed.

Suggested changeset 1
.github/workflows/restrict_main_pr.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/restrict_main_pr.yaml b/.github/workflows/restrict_main_pr.yaml
--- a/.github/workflows/restrict_main_pr.yaml
+++ b/.github/workflows/restrict_main_pr.yaml
@@ -3,6 +3,7 @@
 # Retrieved 2025-12-03, License - CC BY-SA 4.0
 
 name: Check pull request source branch
+permissions: {}
 on:
   pull_request_target:
     types:
EOF
@@ -3,6 +3,7 @@
# Retrieved 2025-12-03, License - CC BY-SA 4.0

name: Check pull request source branch
permissions: {}
on:
pull_request_target:
types:
Copilot is powered by AI and may make mistakes. Always verify output.
@ayushi1208 ayushi1208 closed this Dec 3, 2025
@adiadd
adiadd deleted the feat/restrict-main-pr branch December 8, 2025 15:54
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.

5 participants