Skip to content

Commit 53475e5

Browse files
committed
docs: improve README structure and clarity
- Fix parameter descriptions for accuracy and completeness - Add comprehensive "Recursion and Discovering Common Dependencies" section explaining why API compatibility is needed - Reorganize content flow: introduce recursion challenges before API compatibility details - Move Permissive mode requirements to logical location after API compatibility explanation - Remove outdated version references (v4.2.0) throughout document - Simplify chapter names: "Advanced Usage (Recursive Mode)" → "Recursive Mode" - Rename "API Compatible Tags - Critical Concept" → "API Compatibility - Critical Concepts" - Clarify recursive processing uses same filename as input file, not always "dependencies.json"
1 parent 16e97ab commit 53475e5

File tree

1 file changed

+112
-48
lines changed

1 file changed

+112
-48
lines changed

README.md

Lines changed: 112 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ In non-recursive mode, the script processes only the repositories listed in your
9797
- `-Verbose`: Show verbose output messages
9898
- `-ApiCompatibility`: Default API compatibility mode ('Strict' or 'Permissive', default: 'Permissive')
9999
- `-DisableRecursion`: Disable recursive dependency processing (default: recursive mode enabled)
100-
- `-DisableTagSorting`: Disable intelligent tag temporal sorting, requiring manual temporal ordering (default: tag sorting enabled)
100+
- `-DisableTagSorting`: Disable fetching tag dates from repositories and intelligent tag temporal sorting, requiring manual temporal tag ordering in the dependencies input files (default: tag sorting enabled)
101101

102102
### Configuration Files
103103

@@ -123,7 +123,7 @@ Contains repository configurations without any credential information:
123123
- **Base Path** (required): Local directory path (relative or absolute)
124124
- **Tag** (required): Git tag to checkout
125125
- **API Compatible Tags** (optional): List of API-compatible tags
126-
- **API Compatibility** (optional): "Strict" or "Permissive" (defaults to script parameter)
126+
- **API Compatibility** (optional): "Strict" or "Permissive" (defaults to script parameter when absent)
127127
- **Skip LFS** (optional): Skip Git LFS downloads for this repository and all submodules
128128

129129
#### git_credentials.json
@@ -180,11 +180,11 @@ git_credentials.json:
180180
}
181181
```
182182

183-
## Advanced Usage (Recursive Mode)
183+
## Recursive Mode
184184

185185
### Overview
186186

187-
**Recursive mode is enabled by default** starting with v4.2.0. The script automatically discovers and processes nested dependencies. After checking out each repository, it looks for a dependencies.json file within that repository and processes it recursively, with intelligent handling of shared dependencies.
187+
**When Recursive Mode is enabled (Default)** the script automatically discovers and processes nested dependencies. After checking out each repository, it looks for a dependency file with the same name as the input file within that repository and processes it recursively, with intelligent handling of shared dependencies.
188188

189189
### Controlling Recursive Mode
190190

@@ -205,9 +205,73 @@ git_credentials.json:
205205
.\LsiGitCheckout.ps1 -DisableTagSorting
206206
```
207207

208-
### API Compatible Tags - Critical Concept
208+
### Recursion and Discovering Common Dependencies
209209

210-
The **"API Compatible Tags"** field is fundamental to recursive dependency resolution. It defines the set of tags that are API-compatible with the current "Tag" version, enabling intelligent version resolution when multiple projects depend on the same repository.
210+
When recursive mode processes nested dependencies, a common scenario emerges: **the same repository is required by multiple projects with potentially different version requirements**. This creates the fundamental challenge that the script's API compatibility system is designed to solve.
211+
212+
#### The Challenge: Conflicting Dependency Requirements
213+
214+
Consider this scenario:
215+
216+
1. **ProjectA** requires `LibraryX` at version `v2.1.0`
217+
2. **ProjectB** also requires `LibraryX` but at version `v2.0.5`
218+
3. Both projects expect to work with `LibraryX`, but they're requesting different versions
219+
220+
When the script encounters `LibraryX` for the second time, it faces a critical decision: **which version should be checked out to satisfy both callers?**
221+
222+
#### Practical Example
223+
224+
```
225+
Main Project Dependencies:
226+
├── ProjectA (requires LibraryX v2.1.0)
227+
└── ProjectB (requires LibraryX v2.0.5)
228+
```
229+
230+
When processing recursively:
231+
1. **Round 1**: Processes main dependencies → clones ProjectA and ProjectB
232+
2. **Round 2**:
233+
- Processes ProjectA's dependencies → clones LibraryX at v2.1.0
234+
- Processes ProjectB's dependencies → **discovers LibraryX already exists!**
235+
236+
At this point, the script must determine:
237+
- Are v2.1.0 and v2.0.5 API-compatible?
238+
- If compatible, which version should be used?
239+
- How do we ensure both ProjectA and ProjectB continue to work?
240+
241+
#### The API Compatibility Problem
242+
243+
The core issue is that **the first caller (ProjectA) might be using APIs that are incompatible with those expected by the newly discovered caller (ProjectB)**. Simply keeping the first version could break ProjectB, while switching to the second version could break ProjectA.
244+
245+
#### Solution: API Compatible Tags
246+
247+
To solve this, the script introduces the concept of **"API Compatible Tags"**. Together with the main **"Tag"**, these define the complete set of versions that a caller declares as compatible with their usage:
248+
249+
```json
250+
{
251+
"Repository URL": "https://github.com/company/LibraryX.git",
252+
"Base Path": "libs/library-x",
253+
"Tag": "v2.1.0",
254+
"API Compatible Tags": ["v2.0.0", "v2.0.1", "v2.0.2", "v2.0.3", "v2.0.4", "v2.0.5"]
255+
}
256+
```
257+
258+
This declaration means: *"I'm using LibraryX v2.1.0, but I know my code works with any version from v2.0.0 through v2.0.5"*.
259+
260+
#### The API Compatibility Algorithm
261+
262+
When a repository conflict is detected, the script executes a compatibility algorithm that:
263+
264+
1. **Assesses Compatibility**: Checks if the union of ("Tag" + "API Compatible Tags") from the first caller overlaps with the same set from the new caller. If there's no overlap, the dependencies are incompatible and the script reports an error.
265+
266+
2. **Chooses the Optimal Version**: If the callers are not pointing to the same tag, the script determines which version to checkout based on the "API Compatibility" modes declared by both callers (Strict vs Permissive) and whether intelligent tag sorting is enabled.
267+
268+
3. **Updates Repository State**: Once the algorithm completes, it stores the resolved "API Compatibility" mode, "Tag", and "API Compatible Tags" that will apply to the checked-out repository. These resolved values will be used if the same repository becomes a dependency of future callers during continued recursive processing.
269+
270+
The specific rules for version selection and state resolution depend on the compatibility modes declared by the callers and the tag sorting configuration, which are detailed in the following sections.
271+
272+
### API Compatibility - Critical Concepts
273+
274+
The **"API Compatible Tags"** field is the foundation of the recursive dependency resolution system described above. This field, combined with the "Tag", enables intelligent version resolution when multiple projects depend on the same repository with different version requirements.
211275

212276
#### Tag Management Approaches
213277

@@ -279,46 +343,6 @@ When updating dependencies, you must maintain manual ordering:
279343
}
280344
```
281345

282-
**Important: Permissive Mode Requirements with `-DisableTagSorting` Set**
283-
284-
When `-DisableTagSorting` is set and both repositories have Permissive API compatibility mode, the union algorithm requires:
285-
286-
1. **Temporal ordering**: Both "API Compatible Tags" lists must be ordered oldest to newest
287-
2. **Common starting tag**: Both lists must start with the same tag
288-
3. **Subset relationship**: All tags from one list must be contained in the other (one list should be a subset of the other)
289-
290-
If these conditions are not met, the script will issue warnings and fall back to an unordered union, which may not produce optimal results.
291-
292-
**Example of compatible Permissive mode lists:**
293-
```json
294-
// Repository A
295-
{
296-
"Tag": "v1.0.4",
297-
"API Compatible Tags": ["v1.0.0", "v1.0.1", "v1.0.2", "v1.0.3"]
298-
}
299-
300-
// Repository B
301-
{
302-
"Tag": "v1.0.2",
303-
"API Compatible Tags": ["v1.0.0", "v1.0.1"] // Subset of Repository A
304-
}
305-
```
306-
307-
**Example of incompatible lists (will generate warnings):**
308-
```json
309-
// Repository A
310-
{
311-
"Tag": "v1.0.3",
312-
"API Compatible Tags": ["v1.0.0", "v1.0.1", "v1.0.2"]
313-
}
314-
315-
// Repository B
316-
{
317-
"Tag": "v1.0.3",
318-
"API Compatible Tags": ["v1.1.0", "v1.1.1", "v1.1.2"] // Different starting tag
319-
}
320-
```
321-
322346
#### Why This Convention Matters
323347

324348
When multiple projects depend on the same repository with different version requirements, the script:
@@ -410,9 +434,49 @@ When the same repository is encountered multiple times with different compatibil
410434
.\LsiGitCheckout.ps1 -DisableRecursion
411435
```
412436

437+
### Important: Permissive Mode Requirements with `-DisableTagSorting` Set
438+
439+
When `-DisableTagSorting` is set and both repositories have Permissive API compatibility mode, the union algorithm requires:
440+
441+
1. **Temporal ordering**: Both "API Compatible Tags" lists must be ordered oldest to newest
442+
2. **Common starting tag**: Both lists must start with the same tag
443+
3. **Subset relationship**: All tags from one list must be contained in the other (one list should be a subset of the other)
444+
445+
If these conditions are not met, the script will issue warnings and fall back to an unordered union, which may not produce optimal results.
446+
447+
**Example of compatible Permissive mode lists:**
448+
```json
449+
// Repository A
450+
{
451+
"Tag": "v1.0.4",
452+
"API Compatible Tags": ["v1.0.0", "v1.0.1", "v1.0.2", "v1.0.3"]
453+
}
454+
455+
// Repository B
456+
{
457+
"Tag": "v1.0.2",
458+
"API Compatible Tags": ["v1.0.0", "v1.0.1"] // Subset of Repository A
459+
}
460+
```
461+
462+
**Example of incompatible lists (will generate warnings):**
463+
```json
464+
// Repository A
465+
{
466+
"Tag": "v1.0.3",
467+
"API Compatible Tags": ["v1.0.0", "v1.0.1", "v1.0.2"]
468+
}
469+
470+
// Repository B
471+
{
472+
"Tag": "v1.0.3",
473+
"API Compatible Tags": ["v1.1.0", "v1.1.1", "v1.1.2"] // Different starting tag
474+
}
475+
```
476+
413477
## Tag Temporal Sorting
414478

415-
**Available since Version 4.2.0**: Intelligent automatic tag temporal sorting using actual git tag dates eliminates the need for manual temporal ordering of API Compatible Tags and provides intelligent conflict resolution.
479+
Intelligent automatic tag temporal sorting using actual git tag dates eliminates the need for manual temporal ordering of API Compatible Tags and provides intelligent conflict resolution.
416480

417481
### Overview
418482

@@ -433,7 +497,7 @@ When `-EnableTagSorting` is enabled, the script:
433497

434498
### Enabling Tag Temporal Sorting
435499

436-
**Tag temporal sorting is enabled by default** starting with v5.0.0. To customize or disable:
500+
**Tag temporal sorting is enabled by default**. To customize or disable:
437501

438502
```powershell
439503
# Default behavior (tag sorting enabled)

0 commit comments

Comments
 (0)