Skip to content

Commit 2c5bd86

Browse files
committed
Initial planning docs
1 parent c606f50 commit 2c5bd86

File tree

10 files changed

+804
-0
lines changed

10 files changed

+804
-0
lines changed

IMPLEMENTATION_CHECKLIST.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# Implementation Checklist: `-force-dependencies` Flag
2+
3+
## Phase 1: Core Flag Support
4+
5+
### 1.1 Command Definition
6+
- [ ] Add `-force-dependencies` modifier (alias `-force-deps`) to `update` command in Main.cls XData (line ~157)
7+
- Modifier: `force-dependencies` with alias `force-deps`
8+
- Data alias: `ForceDependenciesUpdate` with value `1`
9+
- Description: "Updates the target module and forces recursive resolution/updates of all dependencies..."
10+
11+
### 1.2 Update() Method Enhancement (Main.cls ~line 4014)
12+
- [ ] Check for `ForceDependenciesUpdate` flag in `pCommandInfo("data","ForceDependenciesUpdate")`
13+
- [ ] If flag is set:
14+
- [ ] Set `pCommandInfo("data","IgnoreInstalled") = 1`
15+
- [ ] Wrap `Install()` call in transaction (tstart/tcommit/trollback)
16+
- [ ] Keep existing behavior unchanged when flag is not set
17+
18+
### 1.3 Orphan Detection (New)
19+
- [ ] After successful Install(), call orphan detection
20+
- [ ] Display list of orphaned modules to user
21+
22+
### 1.4 Testing Phase 1
23+
- [ ] Create test case: `TestUpdateForceDepsBasic`
24+
- Install parent v1.0.0, dep-a v1.0.0, dep-b v1.0.0
25+
- Update parent -force-deps to v1.1.0
26+
- Verify all three are at v1.1.0
27+
28+
- [ ] Create test case: `TestUpdateForceDepsDiamond`
29+
- Recreate exact diamond pattern from problem statement:
30+
- parent v1.0.0 → dep-a v1.0.0 → dep-base v1.0.0
31+
- parent v1.0.0 → dep-b v1.0.0 → dep-base v1.0.0 (shared)
32+
- Standard update parent to v1.1.0 fails with error about dep-base constraint
33+
- Update parent -force-deps to v1.1.0 succeeds, pulling all v1.1.0 versions
34+
35+
- [ ]**SKIPPED** Create test case: `TestUpdateForceDepsWithSibling`
36+
- Install parent v1.0.0, sibling v1.0.0 (both depend on child v1.0.0)
37+
- Parent v1.1.0 needs child v1.1.0, but sibling v1.0.0 still requires child v1.0.0
38+
- Demonstrates known limitation: sibling constraint blocks resolution
39+
- This will fail until Phase 2 Level 2 namespace resolution implemented
40+
41+
- [ ]**SKIPPED** Create test case: `TestUpdateForceDepsDiamondWithSibling`
42+
- Combines diamond and sibling patterns:
43+
- parent v1.0.0 → dep-a v1.0.0 → dep-base v1.0.0
44+
- parent v1.0.0 → dep-b v1.0.0 → dep-base v1.0.0 (shared)
45+
- unrelated-sibling v1.0.0 → dep-base v1.0.0 (independent)
46+
- Update parent -force-deps to v1.1.0 pulls dep-base v1.1.0
47+
- Sibling v1.0.0 still requires dep-base v1.0.0, causing conflict
48+
- Demonstrates why sibling conflicts require manual intervention
49+
- This will fail until Phase 2 Level 2 implementation
50+
51+
- [ ] Create test case: `TestUpdateNormalUnaffected`
52+
- Verify `update` (without -force-deps) still works as before
53+
- Standard update should not use IgnoreInstalled=1 behavior
54+
55+
---
56+
57+
## Implementation Notes
58+
59+
### Update Step Execution
60+
Update steps run as each module loads (existing behavior). Since modules load in dependency order, update steps automatically execute in the correct order - dependencies are already at their new versions when a dependent module's update step runs. This approach:
61+
- Leverages existing dependency resolution
62+
- Requires no code changes
63+
- Works for both normal updates and `-force-deps` scenarios
64+
- Assumes dependencies are correctly declared (best practice anyway)
65+
66+
No deferred update step mechanism is needed.
67+
68+
---
69+
70+
## Implementation Details
71+
72+
### Files to Modify
73+
74+
1. **src/cls/IPM/Main.cls**
75+
- Update XData Commands: Add `-force-dependencies` modifier (~line 157)
76+
- Update() method: Detect flag, set params, wrap in transaction (~line 4014)
77+
- Add orphan detection and reporting after successful update
78+
79+
2. **tests/integration_tests/Test/PM/Integration/Update.cls**
80+
- Add test cases (see Testing sections above)
81+
82+
### Key Parameters Flow
83+
84+
```
85+
User: zpm "update -force-deps parent 1.1.0"
86+
87+
Parser: pCommandInfo("data","ForceDependenciesUpdate") = 1
88+
89+
Update(): Check flag
90+
├─ Set pCommandInfo("data","IgnoreInstalled") = 1
91+
└─ Call Install() with params
92+
93+
Install(): Uses modified params
94+
└─ Calls LoadDependencies() with IgnoreInstalled=1
95+
96+
LoadDependencies(): Does clean resolution
97+
├─ BuildDependencyGraph() with IgnoreInstalled
98+
├─ Constructs ordered dependency list
99+
└─ Loads modules bottom-up
100+
101+
Module loading: Update steps run as modules load (dependency order)
102+
103+
Orphan detection: Display orphaned modules
104+
105+
Commit transaction
106+
```
107+
108+
### Transaction Boundaries
109+
110+
```objectscript
111+
tstart
112+
113+
try {
114+
// Set up params
115+
set pCommandInfo("data","IgnoreInstalled") = 1
116+
117+
// Resolve and load dependencies (update steps run as modules load)
118+
do ..Install(.pCommandInfo, log)
119+
120+
// Detect orphans
121+
do ..DetectOrphans(.orphanList)
122+
123+
// Commit on success
124+
tcommit
125+
126+
} catch e {
127+
trollback
128+
throw e
129+
}
130+
```
131+
132+
### Verbose Output Structure
133+
134+
When `-v` flag is used:
135+
1. Show target module and desired version
136+
2. Show dependency resolution plan (modules to update)
137+
3. Show loading/compilation progress
138+
4. Show update step execution progress
139+
5. Show final list of orphaned modules
140+
141+
---
142+
143+
## Success Criteria
144+
145+
- [ ] `-force-dependencies` flag is recognized by parser
146+
- [ ] `update -force-deps module v1.1.0` updates target + dependencies
147+
- [ ] Updates happen in correct order (bottom-up)
148+
- [ ] All code loaded and compiled before update steps run
149+
- [ ] Transactional semantics: all-or-nothing
150+
- [ ] Orphan detection works and is displayed
151+
- [ ] No breaking changes to existing `update` command
152+
- [ ] Integration tests pass
153+
- [ ] Verbose output is clear and helpful
154+
155+
---
156+
157+
## Known Limitations / Future Work
158+
159+
1. **Lock files** - Currently ignored; should be regenerated in future enhancement
160+
2. **Dry-run** - Not implemented; would be nice for preview mode
161+
3. **Scoped dependencies** - Should work but not explicitly tested yet
162+
4. **Global modules** - Assumed to work via existing resolution; needs validation
163+
5. **Cross-namespace updates** - Not in scope; resolution should prevent these
164+

0 commit comments

Comments
 (0)