Skip to content

Commit d0d0b77

Browse files
authored
Merge branch 'main' into rbfl-fix
2 parents f44f620 + 3dd4459 commit d0d0b77

File tree

3 files changed

+3
-28
lines changed

3 files changed

+3
-28
lines changed

.github/workflows/codeflash-optimize.yaml

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: CodeFlash
22

33
on:
4-
pull_request_target:
4+
pull_request:
55
paths:
66
- '**' # Trigger for all paths
77

@@ -14,8 +14,6 @@ concurrency:
1414
jobs:
1515
optimize:
1616
name: Optimize new Python code
17-
# Dynamically determine if environment is needed only when workflow files change and contributor is external
18-
environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }}
1917
if: ${{ github.actor != 'codeflash-ai[bot]' }}
2018
runs-on: ubuntu-latest
2119
env:
@@ -28,31 +26,7 @@ jobs:
2826
- name: 🛎️ Checkout
2927
uses: actions/checkout@v4
3028
with:
31-
ref: ${{ github.event.pull_request.head.ref }}
32-
repository: ${{ github.event.pull_request.head.repo.full_name }}
3329
fetch-depth: 0
34-
- name: Validate PR
35-
run: |
36-
# Check for any workflow changes
37-
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then
38-
echo "⚠️ Workflow changes detected."
39-
40-
# Get the PR author
41-
AUTHOR="${{ github.event.pull_request.user.login }}"
42-
echo "PR Author: $AUTHOR"
43-
44-
# Allowlist check
45-
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
46-
echo "✅ Authorized user ($AUTHOR). Proceeding."
47-
elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then
48-
echo "✅ PR is open. Proceeding with appropriate protections."
49-
else
50-
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
51-
exit 1
52-
fi
53-
else
54-
echo "✅ No workflow file changes detected. Proceeding."
55-
fi
5630

5731
- name: 🐍 Set up Python 3.11 for CLI
5832
uses: astral-sh/setup-uv@v5

code_to_optimize/code_directories/simple_tracer_e2e/workload.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
def funcA(number):
5+
number = number if number < 1000 else 1000
56
k = 0
67
for i in range(number * 100):
78
k += i

tests/scripts/end_to_end_test_tracer_replay.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def run_test(expected_improvement_pct: int) -> bool:
1010
min_improvement_x=0.1,
1111
expected_unit_tests=1,
1212
coverage_expectations=[
13-
CoverageExpectation(function_name="funcA", expected_coverage=100.0, expected_lines=[5, 6, 7, 9, 12]),
13+
CoverageExpectation(function_name="funcA", expected_coverage=100.0, expected_lines=[5, 6, 7, 8, 10, 13]),
1414
],
1515
)
1616
cwd = (

0 commit comments

Comments
 (0)