Skip to content

Commit 0cc67f4

Browse files
authored
docs: update README.md (#134)
1 parent 2d1fd02 commit 0cc67f4

File tree

15 files changed

+825
-170
lines changed

15 files changed

+825
-170
lines changed

.claude/plan/48-docs-restructure.md

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@
6565
- **DIAGRAMS**: Copy mermaid diagrams from `.claude/plan/32-zerv-flow-implementation-plan.md`
6666
- ✅ **Schema Variants**: 10+ standard schema presets only (no CalVer support)
6767
- ✅ **Branch Rules**: Configurable pattern matching (default GitFlow) for pre-release automation
68-
- **Pre-release Control**: Labels (alpha/beta/rc), numbers, hash-based identification
69-
- **Post Mode Options**: Tag distance vs commit distance calculation modes
68+
- **Pre-release Control**: Labels (alpha/beta/rc), numbers, hash-based identification
69+
- **Post Mode Options**: Tag distance vs commit distance calculation modes
7070
- **zerv version**: Manual control with 4 main capability areas:
71-
- **Schema Variants**: 20+ presets (standard, calver families) and custom RON schemas
72-
- **VCS Overrides**: Override tag version, distance, dirty state, branch, commit data
73-
- **Version Bumping**: Field-based bumps (major/minor/patch) and schema-based bumps
71+
- **Schema Variants**: 20+ presets (standard, calver families) and custom RON schemas
72+
- **VCS Overrides**: Override tag version, distance, dirty state, branch, commit data
73+
- **Version Bumping**: Field-based bumps (major/minor/patch) and schema-based bumps
7474
- **Component Overrides**: Fine-grained control over individual version components
7575
- **zerv check**: Version validation for different formats
7676
- **Input/Output & Piping**: Shared capabilities for both zerv version and zerv flow:
@@ -150,20 +150,78 @@ Every code example in documentation must have a corresponding test with referenc
150150
4. **Validate**: Ensure examples exactly match test outputs
151151
5. **Coordinated Updates**: Update tests first, then documentation to match
152152

153+
### 🚨 Critical Implementation Patterns & Pitfalls
154+
155+
**BRANCH HASH PATTERNS - AVOID REGEX FALLBACKS**:
156+
157+
**WRONG**: Using `{regex:\\d+}` for branch hashes
158+
159+
```rust
160+
// BAD - This is lazy and unpredictable
161+
"1.0.1-alpha.{regex:\\d+}.post.1+feature.test.1.g{hex:7}"
162+
```
163+
164+
**CORRECT**: Use `expect_branch_hash()` for predictable hash generation
165+
166+
```rust
167+
// GOOD - Use actual hash values from expect_branch_hash()
168+
let feature_test_hash = expect_branch_hash("feature/test", 5, "60124");
169+
assert_command(
170+
"flow --source stdin --distance 42",
171+
&format!(
172+
"1.0.1-alpha.{}.post.42+feature.test.42.g{{hex:7}}",
173+
feature_test_hash
174+
),
175+
);
176+
```
177+
178+
**GIT COMMIT HASH PATTERNS**:
179+
180+
-**For generated commits**: Use `g{{hex:7}}` in format strings
181+
-**For manual overrides**: Use exact hash (e.g., `.a1b2c3d` without `g` prefix)
182+
183+
**LOOK AT EXISTING EXAMPLES FIRST**:
184+
185+
Before writing new tests, study these reference files:
186+
187+
1. **Branch Hash Examples**: `tests/integration_tests/flow/docs/quick_start.rs` - Shows proper `expect_branch_hash()` usage
188+
2. **Hash Generation**: `src/cli/flow/test_utils.rs` - Understanding hash calculation
189+
3. **Existing Override Tests**: `tests/integration_tests/flow/docs/override_controls.rs` - Working examples of all patterns
190+
4. **Branch Rules**: `tests/integration_tests/flow/docs/branch_rules.rs` - Shows `release/` branch number extraction vs hash fallback
191+
192+
**COMMON PITFALLS TO AVOID**:
193+
194+
1. **Never use `{regex:\\d+}`** - Always use `expect_branch_hash()` for predictable results
195+
2. **Don't guess hash values** - Run the test first to get actual hash, then update expected value
196+
3. **Don't mix hash patterns** - Consistently use either numeric hashes or `{{hex:7}}` format
197+
4. **Don't assume override behavior** - Test actual behavior, don't rely on assumptions
198+
5. **Always check branch patterns** - `release/42``rc.42` (number extraction) vs `release/candidate``rc.{hash}` (hash fallback)
199+
200+
**WORKFLOW FOR NEW DOCUMENTATION EXAMPLES**:
201+
202+
1. **Study existing patterns** in `tests/integration_tests/flow/docs/`
203+
2. **Run the actual command** to see real output before writing test
204+
3. **Get the actual hash** using `expect_branch_hash("branch-name", 5, "12345")`
205+
4. **Match the test assertion pattern** exactly from existing working examples
206+
5. **Use realistic hex values** in documentation (e.g., `ga1b2c3d`, `g8f7e6d5`)
207+
153208
**Infrastructure in Place**:
154209

155210
-**TestScenario**: Chainable test framework with CLI command execution
156211
-**Pattern Assertion System**: `{hex:7}`, `{timestamp:now}`, `{regex:pattern}` support
157212
-**Documentation Standards**: Comprehensive guidelines in `.claude/ref/documentation-maintenance.md`
158213
-**Maintenance Comments**: Professional "Corresponding test:" format
214+
-**Hash Generation**: `expect_branch_hash()` for predictable branch hash generation
159215

160216
**File Structure**:
161217

162218
```
163219
tests/integration_tests/flow/docs/
164220
├── mod.rs
165221
├── test_utils.rs # TestScenario implementation
166-
├── quick_start.rs # Quick Start documentation tests
222+
├── quick_start.rs # Quick Start documentation tests (BEST PATTERN REFERENCE)
223+
├── branch_rules.rs # Branch pattern and hash examples
224+
├── override_controls.rs # Override examples with proper hash patterns
167225
└── tmp.rs # assert_commands functionality (temporary)
168226
```
169227

.github/workflows/cd.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
new_release_published: ${{ steps.set-outputs.outputs.published }}
2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
22+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2323
with:
2424
fetch-depth: 0
2525

@@ -97,7 +97,7 @@ jobs:
9797
asset_name: zerv-windows-arm64.exe
9898

9999
steps:
100-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
100+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
101101

102102
- uses: dtolnay/rust-toolchain@0b1efabc08b657293548b77fb76cc02d26091c7e # stable
103103
with:
@@ -139,7 +139,7 @@ jobs:
139139
needs: [versioning, release-bin]
140140
if: needs.versioning.outputs.new_release_published == 'true'
141141
steps:
142-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
142+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
143143

144144
- uses: dtolnay/rust-toolchain@0b1efabc08b657293548b77fb76cc02d26091c7e # stable
145145
with:

.github/workflows/ci-pre-commit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ jobs:
88
pre-commit:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
11+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1212

1313
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
1414
with:
1515
python-version: "3.x"
1616

1717
- name: Setup Node.js
18-
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
18+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
1919
with:
2020
node-version: "latest"
2121

.github/workflows/ci-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
ZERV_TEST_DOCKER: ${{ matrix.os == 'ubuntu-latest' && 'true' || 'false' }}
2020
ZERV_FORCE_RUST_LOG_OFF: ${{ matrix.os == 'ubuntu-latest' && 'true' || 'false' }}
2121
steps:
22-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
22+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2323
with:
2424
fetch-depth: 0
2525

.github/workflows/security.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
steps:
1313
- name: Checkout repository
14-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
14+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1515

1616
- name: Run Trivy dependency scan
1717
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # 0.33.1
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727

2828
steps:
29-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
29+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3030
with:
3131
fetch-depth: 0
3232

@@ -40,7 +40,7 @@ jobs:
4040

4141
steps:
4242
- name: Checkout repository
43-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
43+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4444

4545
- name: Setup Rust
4646
uses: dtolnay/rust-toolchain@0b1efabc08b657293548b77fb76cc02d26091c7e # stable

Cargo.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)