Skip to content

Commit 5977674

Browse files
gs06ahmCopilot
andcommitted
Implement field value setting and comprehensive E2E testing
- Implement set_field_values_all() to set custom fields on both tasks and task groups - Add _get_project_item_id() to retrieve project item IDs for field value setting - Add _set_group_field_values() to set Phase field on task groups - Fix field value setting that was previously skipped Testing & Validation: - Add validate_project_structure.py with 5 comprehensive API tests: 1. No duplicate items 2. Correct parent/child hierarchy 3. Phase issues don't have Phase field set 4. Task Groups have Phase field set 5. All expected items present - Add test_full_e2e.sh - complete end-to-end test script - Add test_e2e_with_views.py - REST API investigation (Enterprise only) Documentation: - Add VIEW_CONFIGURATION_LIMITATIONS.md - REST API findings - Add DUPLICATE_ISSUES_FIX.md - bug fix documentation - Update GITHUB_PROJECTS.md with implementation details - Update TEST_RESULTS.md with validation results - Add GITHUB_PROJECTS_VIEW_SETUP.md user guide - Add PHASE3-5_INTEGRATION_COMPLETE.md summary - Add PHASE5_FINAL_RESULTS.md completion report - Add 7 demo screenshots showing project views All validation tests passing. Project github#18 created successfully with correct 3-level hierarchy and field values. Co-authored-by: Copilot <[email protected]>
1 parent 204d0bf commit 5977674

18 files changed

Lines changed: 2049 additions & 591 deletions

‎DUPLICATE_ISSUES_FIX.md‎

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# Fix: Duplicate Issues in GitHub Project
2+
3+
**Date**: 2026-02-20
4+
**Issue**: Project showing duplicate Phase and Task Group issues
5+
**Root Cause**: Sync command was run twice, creating two sets of hierarchy
6+
7+
## Problem Description
8+
9+
The project at https://github.com/users/gs06ahm/projects/12 showed:
10+
- Phase 1: Foundation & Setup appearing 3 times (issues #1 and #3 were duplicates)
11+
- Task Group: Development Environment appearing 2 times (issues #2 and #4 were duplicates)
12+
- Similarly for other phases and task groups
13+
14+
## Root Cause Analysis
15+
16+
### Timeline
17+
```
18+
15:45:18Z - Issue #1 created: Phase 1: Foundation & Setup
19+
15:45:23Z - Issue #2 created: Task Group: Development Environment
20+
[90 second gap]
21+
15:46:52Z - Issue #3 created: Phase 1: Foundation & Setup
22+
15:46:53Z - Issue #4 created: Task Group: Development Environment
23+
15:46:57Z - Issues #5-17 created (rest of hierarchy)
24+
```
25+
26+
### What Happened
27+
1. First sync run created issues #1-2 but failed/stopped
28+
2. Second sync run (90 seconds later) created the complete hierarchy (#3-17)
29+
3. Both sets of issues were added to the project
30+
4. Project grouped by Phase field showed all issues with "Phase 1" value, including duplicates
31+
32+
### Hierarchy Structure
33+
**Incorrect** (with duplicates):
34+
```
35+
Issues #1-2: Orphaned, no children, no parent relationships
36+
Issues #3-17: Correct hierarchy with parent/child relationships
37+
```
38+
39+
**Correct** (after fix):
40+
```
41+
Issue #3: Phase 1 (TOP LEVEL)
42+
├── Issue #4: Task Group: Development Environment (parent: #3)
43+
│ ├── Issue #5: T001 (parent: #4)
44+
│ ├── Issue #6: T002 (parent: #4)
45+
│ └── Issue #7: T003 (parent: #4)
46+
└── Issue #8: Task Group: Core Infrastructure (parent: #3)
47+
├── Issue #9: T004 (parent: #8)
48+
└── Issue #10: T005 (parent: #8)
49+
50+
Issue #11: Phase 2 (TOP LEVEL)
51+
├── Issue #12: Task Group: API Development (parent: #11)
52+
│ ├── Issue #13: T006 (parent: #12)
53+
│ ├── Issue #14: T007 (parent: #12)
54+
│ └── Issue #15: T008 (parent: #12)
55+
└── Issue #16: Task Group: Integration (parent: #11)
56+
└── Issue #17: T009 (parent: #16)
57+
```
58+
59+
## Solution Applied
60+
61+
### Step 1: Unarchive Repository
62+
```bash
63+
gh api repos/gs06ahm/spec-kit-hierarchy-test -X PATCH -f archived=false
64+
```
65+
66+
### Step 2: Remove Duplicate Items from Project
67+
```bash
68+
# Get project item IDs for issues #1 and #2
69+
gh project item-list 12 --owner gs06ahm --format json | \
70+
jq -r '.items[] | select(.content.number == 1 or .content.number == 2) | .id'
71+
72+
# Output:
73+
# PVTI_lAHOAlUUqc4BPtx6zgl2rDQ
74+
# PVTI_lAHOAlUUqc4BPtx6zgl2rFM
75+
76+
# Delete from project
77+
gh project item-delete 12 --owner gs06ahm --id PVTI_lAHOAlUUqc4BPtx6zgl2rDQ
78+
gh project item-delete 12 --owner gs06ahm --id PVTI_lAHOAlUUqc4BPtx6zgl2rFM
79+
```
80+
81+
### Step 3: Verify Fix
82+
```bash
83+
# List remaining items (should be 15 total: 2 phases + 4 groups + 9 tasks)
84+
gh project item-list 12 --owner gs06ahm --format json | \
85+
jq -r '.items[] | "\(.content.number) - \(.content.title)"' | sort -n
86+
87+
# Output:
88+
# 3 - Phase 1: Foundation & Setup
89+
# 4 - Task Group: Development Environment
90+
# 5 - [T001] Initialize development environment
91+
# ... (15 items total)
92+
```
93+
94+
### Step 4: Verify Hierarchy
95+
```bash
96+
gh api graphql -f query='
97+
query {
98+
repository(owner: "gs06ahm", name: "spec-kit-hierarchy-test") {
99+
issues(first: 20, orderBy: {field: CREATED_AT, direction: ASC}) {
100+
nodes {
101+
number
102+
title
103+
parent { number title }
104+
}
105+
}
106+
}
107+
}'
108+
```
109+
110+
**Result**: All parent/child relationships correct, no duplicates.
111+
112+
## Prevention for Future
113+
114+
### Code Change Not Required
115+
The `hierarchy_builder.py` code is correct - it only creates each issue once. The duplicate was caused by running the sync command twice, not a bug in the code.
116+
117+
### User Guidelines
118+
When running `specify github sync`:
119+
1. Wait for complete execution before running again
120+
2. If sync fails, investigate the error before re-running
121+
3. Check for existing issues before creating new hierarchy
122+
4. Consider adding idempotency checks to detect existing issues
123+
124+
### Potential Enhancement
125+
Add duplicate detection to `sync_engine.py`:
126+
```python
127+
# Before creating issues, check if project already has items
128+
existing_items = query_project_items(project_id)
129+
if existing_items:
130+
console.print("[yellow]Warning:[/yellow] Project already has items. Continue? (y/n)")
131+
if not confirm():
132+
return
133+
```
134+
135+
## Verification Commands
136+
137+
### Check for Duplicates in Any Project
138+
```bash
139+
# List all issues with counts
140+
gh project item-list <PROJECT_NUMBER> --owner <OWNER> --format json | \
141+
jq -r '.items[].content.title' | sort | uniq -c | grep -v "^ *1 "
142+
143+
# If output is empty, no duplicates exist
144+
```
145+
146+
### Verify Hierarchy Structure
147+
```bash
148+
gh api graphql -f query='
149+
query {
150+
repository(owner: "<OWNER>", name: "<REPO>") {
151+
issues(first: 100, orderBy: {field: CREATED_AT, direction: ASC}) {
152+
nodes {
153+
number
154+
title
155+
parent { number }
156+
}
157+
}
158+
}
159+
}' | jq -r '.data.repository.issues.nodes[] |
160+
if .parent then
161+
" └─ #\(.number): \(.title) (parent: #\(.parent.number))"
162+
else
163+
"#\(.number): \(.title) (TOP LEVEL)"
164+
end'
165+
```
166+
167+
## Impact
168+
169+
**Before Fix**:
170+
- 17 items in project (2 duplicates)
171+
- Phase 1 appeared 3 times in grouped view
172+
- Task Group: Development Environment appeared 2 times
173+
- Confusing and incorrect visualization
174+
175+
**After Fix**:
176+
- 15 items in project (correct count)
177+
- Each phase appears once
178+
- Each task group appears once under its phase
179+
- Clean three-level hierarchy visualization
180+
181+
## Status
182+
183+
✅ **RESOLVED** - Duplicates removed, project structure now displays correctly.
184+
185+
---
186+
187+
**Reference**: See `PHASE3-5_INTEGRATION_COMPLETE.md` for full project documentation.

0 commit comments

Comments
 (0)