Skip to content

Commit bf9fb11

Browse files
fix(pr): resolve formatting and compliance issues for PR #2307
- Fix requirements.txt organization and sorting - Remove trailing whitespace from all files - Update .gitignore with .env and data exclusions - Add comprehensive PR issue checker script Addresses all pre-commit hook failures and CI/CD check requirements. Signed-off-by: cogniware-devops <[email protected]>
1 parent 3437fe9 commit bf9fb11

62 files changed

Lines changed: 2088 additions & 610 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CogniwareIms/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,14 @@ Thumbs.db
4848
# Postman exports
4949
*.postman_collection.json
5050
*.postman_environment.json
51+
52+
# === Environment and secrets ===
53+
.env
54+
.env.local
55+
.env.*.local
56+
*.env
57+
58+
# === Data files (download separately) ===
59+
data/
60+
!data/.gitkeep
61+
!data/README.md

CogniwareIms/.pre-commit-config.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Copyright (C) 2024 Intel Corporation
2-
# SPDX-License-Identifier: Apache-2.0
3-
41
# Pre-commit hooks configuration for OPEA compliance
52
# See https://pre-commit.com for more information
63

@@ -72,4 +69,4 @@ repos:
7269
- id: flake8
7370
args: ["--max-line-length=120", "--ignore=E203,W503"]
7471
files: \.py$
75-
exclude: "^((?!CogniwareIms/).)*$"
72+
exclude: '^((?!CogniwareIms/).)*$'
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Quick Reference: Changes Made and File Locations
2+
3+
## 📋 All Changes Summary
4+
5+
### Files Created (8 total)
6+
7+
1. **License Header Templates** (3 files)
8+
- `LICENSE_HEADER_PYTHON.txt` - For Python files
9+
- `LICENSE_HEADER_SHELL.txt` - For shell scripts
10+
- `LICENSE_HEADER_JS.txt` - For JavaScript/TypeScript files
11+
- **Location:** `/Users/deadbrain/cogniware-opea-ims/` (root)
12+
13+
2. **Pre-commit Configuration**
14+
- `.pre-commit-config.yaml` - Defines all code quality hooks
15+
- **Location:** `/Users/deadbrain/cogniware-opea-ims/` (root)
16+
17+
3. **Fix Script**
18+
- `fix_precommit_issues.sh` - Automated fix script
19+
- **Location:** `/Users/deadbrain/cogniware-opea-ims/` (root)
20+
21+
4. **Documentation** (3 files)
22+
- `docs/PRECOMMIT_FIXES.md`
23+
- `docs/PRECOMMIT_SUMMARY.md`
24+
- `docs/CHANGES_SUMMARY.md`
25+
26+
### Files Modified (~95 total)
27+
28+
- **Python files** (~52): Added license headers, formatted, sorted imports
29+
- **Shell scripts** (~8): Added license headers, made executable
30+
- **Config files** (~15): Formatted, added headers where applicable
31+
- **Documentation** (~20): Formatted, added newlines
32+
33+
---
34+
35+
## 🔍 Why Files Were Created Outside cogniware-ims Folder
36+
37+
### The Problem
38+
39+
When `pre-commit` runs, it executes from the **current working directory**. The `insert-license` hook looks for `LICENSE_HEADER_*.txt` files in that directory.
40+
41+
### Two Scenarios
42+
43+
**Scenario 1: Run from Monorepo Root**
44+
```bash
45+
cd /path/to/GenAIExamples
46+
pre-commit run --all-files
47+
# Hook looks for: GenAIExamples/LICENSE_HEADER_PYTHON.txt
48+
```
49+
50+
**Scenario 2: Run from Subproject Root**
51+
```bash
52+
cd /path/to/GenAIExamples/CogniwareIms
53+
pre-commit run --all-files
54+
# Hook looks for: GenAIExamples/CogniwareIms/LICENSE_HEADER_PYTHON.txt
55+
```
56+
57+
### Why This Happens
58+
59+
1. **Pre-commit executes relative to working directory**
60+
2. **License files must be where pre-commit runs**
61+
3. **Monorepo structure** means files might be needed in parent directory
62+
63+
### Solution
64+
65+
**Option 1: Always run from subproject** (Recommended)
66+
```bash
67+
cd CogniwareIms
68+
pre-commit run --all-files
69+
```
70+
71+
**Option 2: Place files in both locations**
72+
- `GenAIExamples/LICENSE_HEADER_*.txt` (for monorepo runs)
73+
- `GenAIExamples/CogniwareIms/LICENSE_HEADER_*.txt` (for subproject runs)
74+
75+
---
76+
77+
## 📝 Reasons for Each Change
78+
79+
| Change | Reason |
80+
|--------|--------|
81+
| **License Headers** | OPEA requires Apache 2.0 headers for legal compliance |
82+
| **Code Formatting** | Consistent style improves readability and reviews |
83+
| **Import Sorting** | Organized imports follow PEP 8, reduce conflicts |
84+
| **End-of-File Newlines** | POSIX standard, required for some tools |
85+
| **Trailing Whitespace** | Invisible but causes diff noise |
86+
| **Requirements Sorting** | Easier maintenance, prevents duplicates |
87+
| **Shell Permissions** | Scripts must be executable to run |
88+
89+
---
90+
91+
## ✅ Verification Checklist
92+
93+
- [ ] License header files exist in project root
94+
- [ ] `.pre-commit-config.yaml` is present
95+
- [ ] All source files have license headers
96+
- [ ] Code is properly formatted
97+
- [ ] Pre-commit hooks pass: `pre-commit run --all-files`
98+
99+
---
100+
101+
## 🚀 Quick Commands
102+
103+
```bash
104+
# Check license files exist
105+
ls -la LICENSE_HEADER*.txt
106+
107+
# Run pre-commit from subproject
108+
cd cogniware-opea-ims
109+
pre-commit run --all-files
110+
111+
# Fix issues manually
112+
./fix_precommit_issues.sh
113+
114+
# Check what changed
115+
git status
116+
git diff --stat
117+
```
118+
119+
---
120+
121+
**For detailed information, see:** `docs/CHANGES_SUMMARY.md`
122+

CogniwareIms/LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,4 @@ distributed under the License is distributed on an "AS IS" BASIS,
188188
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189189
See the License for the specific language governing permissions and
190190
limitations under the License.
191+

CogniwareIms/LICENSE_HEADER_JS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Copyright (C) 2024 Intel Corporation
22
SPDX-License-Identifier: Apache-2.0
3+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Copyright (C) 2024 Intel Corporation
22
SPDX-License-Identifier: Apache-2.0
3+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Copyright (C) 2024 Intel Corporation
22
SPDX-License-Identifier: Apache-2.0
3+
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
# PR #2307 Merge Conflict Resolution Guide
2+
3+
## Situation
4+
5+
Your PR: https://github.com/opea-project/GenAIExamples/pull/2307
6+
- **From:** `Cogniware-Inc:main`
7+
- **To:** `opea-project:main`
8+
- **Status:** Has conflicts that must be resolved
9+
10+
## Step-by-Step Resolution
11+
12+
### Step 1: Clone/Update Your Repository
13+
14+
```bash
15+
# If you haven't cloned yet:
16+
git clone https://github.com/Cogniware-Inc/GenAIExamples.git
17+
cd GenAIExamples
18+
19+
# OR if you already have it, update:
20+
cd /path/to/GenAIExamples
21+
git fetch origin
22+
git fetch upstream # If you have opea-project as upstream
23+
```
24+
25+
### Step 2: Set Up Remote Repositories
26+
27+
```bash
28+
# Check current remotes
29+
git remote -v
30+
31+
# If you don't have upstream, add it:
32+
git remote add upstream https://github.com/opea-project/GenAIExamples.git
33+
34+
# Fetch from upstream
35+
git fetch upstream
36+
```
37+
38+
### Step 3: Checkout Your Branch
39+
40+
```bash
41+
# Switch to your main branch (the one in the PR)
42+
git checkout main
43+
44+
# Make sure you're on the right branch
45+
git branch
46+
47+
# Pull latest from your fork
48+
git pull origin main
49+
```
50+
51+
### Step 4: Merge Upstream Main into Your Branch
52+
53+
```bash
54+
# Merge opea-project's main into your branch
55+
git merge upstream/main
56+
57+
# OR if upstream isn't set:
58+
git merge https://github.com/opea-project/GenAIExamples.git main
59+
```
60+
61+
### Step 5: Resolve Conflicts
62+
63+
When conflicts appear, resolve them:
64+
65+
```bash
66+
# Accept upstream version for EdgeCraftRAG (not your project)
67+
git checkout --theirs EdgeCraftRAG/
68+
git add EdgeCraftRAG/
69+
70+
# Accept upstream version for .github files
71+
git checkout --theirs .github/code_spell_ignore.txt
72+
git add .github/code_spell_ignore.txt
73+
74+
git checkout --theirs .github/workflows/pr-image-size.yml
75+
git add .github/workflows/pr-image-size.yml
76+
77+
# Keep YOUR CogniwareIms changes
78+
git checkout --ours CogniwareIms/
79+
git add CogniwareIms/
80+
81+
# Check what's left
82+
git status
83+
```
84+
85+
### Step 6: Complete the Merge
86+
87+
```bash
88+
# Complete the merge
89+
git commit -s -m "Resolve merge conflicts: accept EdgeCraftRAG changes from upstream main"
90+
```
91+
92+
### Step 7: Push to Your Fork
93+
94+
```bash
95+
# Push to your fork (Cogniware-Inc)
96+
git push origin main --force-with-lease
97+
```
98+
99+
The PR will automatically update once you push!
100+
101+
## Alternative: Rebase Instead of Merge
102+
103+
If you prefer a cleaner history:
104+
105+
```bash
106+
# Rebase your branch onto upstream main
107+
git rebase upstream/main
108+
109+
# Resolve conflicts as they appear (same commands as Step 5)
110+
# After each conflict resolution:
111+
git add .
112+
git rebase --continue
113+
114+
# When done, force push
115+
git push origin main --force-with-lease
116+
```
117+
118+
## Complete Command Sequence (Copy & Paste)
119+
120+
```bash
121+
# 1. Navigate to your repository
122+
cd /path/to/GenAIExamples
123+
124+
# 2. Add upstream if not exists
125+
git remote add upstream https://github.com/opea-project/GenAIExamples.git 2>/dev/null || true
126+
127+
# 3. Fetch latest
128+
git fetch upstream
129+
git fetch origin
130+
131+
# 4. Checkout your branch
132+
git checkout main
133+
git pull origin main
134+
135+
# 5. Merge upstream
136+
git merge upstream/main
137+
138+
# 6. Resolve conflicts
139+
git checkout --theirs EdgeCraftRAG/ && git add EdgeCraftRAG/
140+
git checkout --theirs .github/code_spell_ignore.txt && git add .github/code_spell_ignore.txt
141+
git checkout --theirs .github/workflows/pr-image-size.yml && git add .github/workflows/pr-image-size.yml
142+
git checkout --ours CogniwareIms/ && git add CogniwareIms/
143+
144+
# 7. Complete merge
145+
git commit -s -m "Resolve merge conflicts: accept EdgeCraftRAG changes from upstream main"
146+
147+
# 8. Push
148+
git push origin main --force-with-lease
149+
```
150+
151+
## Verify Resolution
152+
153+
After pushing:
154+
155+
1. Go to your PR: https://github.com/opea-project/GenAIExamples/pull/2307
156+
2. The status should change from "has conflicts" to "ready to merge"
157+
3. Check that all CI checks pass
158+
159+
## Important Notes
160+
161+
1. **Don't modify EdgeCraftRAG files** - The reviewer specifically said "Please do not change the code for the other OPEA examples"
162+
163+
2. **Keep your CogniwareIms changes** - These are your contributions
164+
165+
3. **Use `--force-with-lease`** - Safer than `--force`, prevents overwriting others' work
166+
167+
4. **Sign your commits** - Use `-s` flag for DCO compliance
168+
169+
## If You Get Stuck
170+
171+
### Check Current Status
172+
```bash
173+
git status
174+
git log --oneline --graph -10
175+
```
176+
177+
### See What's Different
178+
```bash
179+
git diff upstream/main...HEAD --name-only
180+
```
181+
182+
### Abort and Start Over
183+
```bash
184+
git merge --abort # or git rebase --abort
185+
```
186+
187+
## After Successful Merge
188+
189+
Once conflicts are resolved and PR is merged:
190+
- Your CogniwareIms code will be in `opea-project/GenAIExamples/CogniwareIms/`
191+
- The PR will show as merged
192+
- You can delete your branch if desired
193+
194+
---
195+
196+
**PR Link:** https://github.com/opea-project/GenAIExamples/pull/2307
197+
**Status:** Ready for conflict resolution
198+
**Last Updated:** November 12, 2025
199+

0 commit comments

Comments
 (0)