half-orm-dev 0.17.0a5__tar.gz → 0.17.0a8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- half_orm_dev-0.17.0a8/PKG-INFO +1311 -0
- half_orm_dev-0.17.0a8/README.md +1271 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/__init__.py +0 -3
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/check.py +115 -14
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/patch.py +36 -62
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/release.py +102 -28
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/decorators.py +16 -11
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/hgit.py +120 -10
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/modules.py +1 -1
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/patch_manager.py +622 -94
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/release_manager.py +366 -47
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/repo.py +57 -20
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/conftest_template +6 -2
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/utils.py +0 -13
- half_orm_dev-0.17.0a8/half_orm_dev/version.txt +1 -0
- half_orm_dev-0.17.0a8/half_orm_dev.egg-info/PKG-INFO +1311 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/tests/conftest.py +13 -7
- half_orm_dev-0.17.0a5/PKG-INFO +0 -935
- half_orm_dev-0.17.0a5/README.md +0 -895
- half_orm_dev-0.17.0a5/half_orm_dev/version.txt +0 -1
- half_orm_dev-0.17.0a5/half_orm_dev.egg-info/PKG-INFO +0 -935
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/AUTHORS +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/LICENSE +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/__init__.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/__init__.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/apply.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/clone.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/init.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/new.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/restore.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/sync.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/todo.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/undo.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/update.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/commands/upgrade.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli/main.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/cli_extension.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/database.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/hop.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/manifest.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/patch.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/patch_validator.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/patches/0/1/0/00_half_orm_meta.database.sql +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/patches/0/1/0/01_alter_half_orm_meta.hop_release.sql +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/patches/0/1/0/02_half_orm_meta.view.hop_penultimate_release.sql +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/patches/log +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/patches/sql/half_orm_meta.sql +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/.gitignore +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/MANIFEST.in +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/Pipfile +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/README +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/git-hooks/pre-commit +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/git-hooks/prepare-commit-msg +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/init_module_template +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/module_template_1 +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/module_template_2 +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/module_template_3 +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/relation_test +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/setup.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/sql_adapter +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev/templates/warning +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev.egg-info/SOURCES.txt +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev.egg-info/dependency_links.txt +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev.egg-info/requires.txt +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/half_orm_dev.egg-info/top_level.txt +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/setup.cfg +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/setup.py +0 -0
- {half_orm_dev-0.17.0a5 → half_orm_dev-0.17.0a8}/tests/__init__.py +0 -0
|
@@ -0,0 +1,1311 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: half_orm_dev
|
|
3
|
+
Version: 0.17.0a8
|
|
4
|
+
Summary: half_orm development Framework.
|
|
5
|
+
Home-page: https://github.com/collorg/halfORM_dev
|
|
6
|
+
Author: Joël Maïzi
|
|
7
|
+
Author-email: joel.maizi@collorg.org
|
|
8
|
+
License: GNU General Public License v3 (GPLv3)
|
|
9
|
+
Keywords: postgres,relation-object mapping
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
13
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
License-File: AUTHORS
|
|
24
|
+
Requires-Dist: GitPython
|
|
25
|
+
Requires-Dist: click
|
|
26
|
+
Requires-Dist: pydash
|
|
27
|
+
Requires-Dist: half_orm<0.18.0,>=0.17.0
|
|
28
|
+
Requires-Dist: pytest
|
|
29
|
+
Dynamic: author
|
|
30
|
+
Dynamic: author-email
|
|
31
|
+
Dynamic: classifier
|
|
32
|
+
Dynamic: description
|
|
33
|
+
Dynamic: description-content-type
|
|
34
|
+
Dynamic: home-page
|
|
35
|
+
Dynamic: keywords
|
|
36
|
+
Dynamic: license
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
Dynamic: requires-dist
|
|
39
|
+
Dynamic: summary
|
|
40
|
+
|
|
41
|
+
# half_orm_dev
|
|
42
|
+
|
|
43
|
+
## **WARNING!** half_orm_dev is still in alpha development phase!
|
|
44
|
+
|
|
45
|
+
**Git-centric patch management and database versioning for halfORM projects**
|
|
46
|
+
|
|
47
|
+
[](https://www.python.org/downloads/)
|
|
48
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
49
|
+
[](https://github.com/halfORM/halfORM)
|
|
50
|
+
|
|
51
|
+
Modern development workflow for PostgreSQL databases with automatic code generation, semantic versioning, and production-ready deployment system.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## ⚠️ Breaking Changes (v0.16.0)
|
|
56
|
+
|
|
57
|
+
**This version introduces major architectural changes that completely transform how you use half_orm_dev.**
|
|
58
|
+
|
|
59
|
+
### What Changed
|
|
60
|
+
|
|
61
|
+
**1. Complete Command Reorganization**
|
|
62
|
+
- **OLD**: `half_orm patch new`, `half_orm patch apply`, `half_orm release new`
|
|
63
|
+
- **NEW**: `half_orm dev patch new`, `half_orm dev patch close`, `half_orm dev release new`
|
|
64
|
+
- All commands now under `half_orm dev` namespace for better organization
|
|
65
|
+
|
|
66
|
+
**2. New Branch Strategy**
|
|
67
|
+
- **OLD**: Various branch naming conventions
|
|
68
|
+
- **NEW**: Strict `ho-prod`, `ho-patch/*`, `ho-release/*` hierarchy
|
|
69
|
+
- Previous branch structures are not compatible
|
|
70
|
+
|
|
71
|
+
**3. Unified Promotion Command**
|
|
72
|
+
- **OLD**: `half_orm release promote-to-rc`, `half_orm release promote-to-prod`
|
|
73
|
+
- **NEW**: `half_orm dev release promote rc`, `half_orm dev release promote prod`
|
|
74
|
+
- Single `promote` command with explicit target argument
|
|
75
|
+
|
|
76
|
+
**4. Different Release File Organization**
|
|
77
|
+
- **OLD**: CHANGELOG.py-based versioning
|
|
78
|
+
- **NEW**: `releases/*.txt` files with explicit patch lists
|
|
79
|
+
- **Structure**: `X.Y.Z-candidates.txt` → `X.Y.Z-stage.txt` → `X.Y.Z-rc1.txt` | `X.Y.Z-hotfix1.txt` → `X.Y.Z.txt`
|
|
80
|
+
|
|
81
|
+
**5. Test Organization and Validation**
|
|
82
|
+
- **NEW**: Systematic test validation before ANY integration
|
|
83
|
+
- **NEW**: Temporary validation branches (`temp-valid-X.Y.Z`) for safe testing
|
|
84
|
+
- Tests must pass before patches are added to releases
|
|
85
|
+
|
|
86
|
+
### What Stayed the Same
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
- ✅ **Business Logic Code**: Your database schemas, models, and application code remain unchanged
|
|
90
|
+
- ✅ **Database Structure**: PostgreSQL schemas and data are not affected
|
|
91
|
+
- ✅ **halfORM Integration**: Code generation and ORM features work identically
|
|
92
|
+
- ✅ **Semantic Versioning**: MAJOR.MINOR.PATCH logic is preserved
|
|
93
|
+
- ✅ **SQL Patch Files**: Format and execution order unchanged
|
|
94
|
+
|
|
95
|
+
### Migration Guide
|
|
96
|
+
|
|
97
|
+
**If migrating from previous versions:**
|
|
98
|
+
|
|
99
|
+
1. **Backup your repository** before upgrading
|
|
100
|
+
2. **Update all scripts** to use `half_orm dev` prefix
|
|
101
|
+
3. **Reorganize branches** to match new `ho-prod`/`ho-patch/*` structure
|
|
102
|
+
4. **Convert release files** from CHANGELOG.py to releases/*.txt format
|
|
103
|
+
5. **Update CI/CD pipelines** with new command syntax
|
|
104
|
+
|
|
105
|
+
**For new projects:** Just follow the Quick Start guide below!
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 📖 Description
|
|
110
|
+
|
|
111
|
+
`half_orm_dev` provides a complete development lifecycle for database-driven applications:
|
|
112
|
+
- **Git-centric workflow**: Patches stored in Git branches and release files
|
|
113
|
+
- **Semantic versioning**: Automatic version calculation (patch/minor/major)
|
|
114
|
+
- **Code generation**: Python classes auto-generated from schema changes
|
|
115
|
+
- **Safe deployments**: Automatic backups, rollback support, validation
|
|
116
|
+
- **Team collaboration**: Distributed locks, branch notifications, conflict prevention
|
|
117
|
+
- **Test-driven development**: Systematic validation before any integration
|
|
118
|
+
|
|
119
|
+
Perfect for teams managing evolving PostgreSQL schemas with Python applications.
|
|
120
|
+
|
|
121
|
+
## ✨ Features
|
|
122
|
+
|
|
123
|
+
### 🔧 Development
|
|
124
|
+
- **Patch-based development**: Isolated branches for each database change
|
|
125
|
+
- **Automatic code generation**: halfORM Python classes created from schema
|
|
126
|
+
- **Complete testing**: Apply patches with full release context
|
|
127
|
+
- **Conflict detection**: Distributed locks prevent concurrent modifications
|
|
128
|
+
|
|
129
|
+
### 🧪 Test-Driven Development & Validation
|
|
130
|
+
|
|
131
|
+
**Systematic Testing Before Integration**
|
|
132
|
+
|
|
133
|
+
`half_orm_dev` enforces a **test-first approach** that guarantees code quality:
|
|
134
|
+
|
|
135
|
+
**1. Validation on Temporary Branches**
|
|
136
|
+
```bash
|
|
137
|
+
# When adding a patch to a release, tests run FIRST
|
|
138
|
+
half_orm dev patch add 456-user-auth
|
|
139
|
+
|
|
140
|
+
# What happens behind the scenes:
|
|
141
|
+
# 1. Creates temp-valid-1.3.6 branch
|
|
142
|
+
# 2. Merges ALL release patches + new patch
|
|
143
|
+
# 3. Runs pytest tests/
|
|
144
|
+
# 4. If merge and tests PASS → adds patch id to 1.3.6-stage.txt and commits to ho-prod
|
|
145
|
+
# 5. If anything FAILS → nothing committed (temp branch is deleted)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**2. No Integration Without Tests**
|
|
149
|
+
- ❌ **BLOCKED**: Patches cannot be added to releases if anything fails
|
|
150
|
+
- ✅ **SAFE**: Only validated code reaches stage/rc/production
|
|
151
|
+
- 🔒 **GUARANTEED**: Every release is testable before deployment
|
|
152
|
+
|
|
153
|
+
**3. Business Logic Testing (TDD Best Practice)**
|
|
154
|
+
```python
|
|
155
|
+
# Your business logic is fully testable
|
|
156
|
+
# Example: tests/test_user_authentication.py
|
|
157
|
+
|
|
158
|
+
def test_user_creation():
|
|
159
|
+
"""Test user creation through halfORM models."""
|
|
160
|
+
user = User(
|
|
161
|
+
username='john',
|
|
162
|
+
email='john@example.com'
|
|
163
|
+
).ho_insert()
|
|
164
|
+
|
|
165
|
+
assert user.id is not None
|
|
166
|
+
assert user.username == 'john'
|
|
167
|
+
|
|
168
|
+
def test_invalid_email_rejected():
|
|
169
|
+
"""Test validation prevents invalid emails."""
|
|
170
|
+
with pytest.raises(ValidationError):
|
|
171
|
+
User(username='john', email='invalid').ho_insert()
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**4. Full Release Context Testing**
|
|
175
|
+
```bash
|
|
176
|
+
# Test your patch with ALL previous patches
|
|
177
|
+
half_orm dev patch apply
|
|
178
|
+
|
|
179
|
+
# What happens:
|
|
180
|
+
# 1. Restores DB to production state
|
|
181
|
+
# 2. Applies all RC patches (if any)
|
|
182
|
+
# 3. Applies all stage patches
|
|
183
|
+
# 4. Applies YOUR patch in correct order
|
|
184
|
+
# 5. Generates code
|
|
185
|
+
# → Your tests run in realistic production-like environment
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**5. Workflow Integration**
|
|
189
|
+
```
|
|
190
|
+
┌───────────────────────────────────────────────────────────────────┐
|
|
191
|
+
│ Development Cycle with Test Validation │
|
|
192
|
+
├───────────────────────────────────────────────────────────────────┤
|
|
193
|
+
│ 1. Create patch │
|
|
194
|
+
│ 2. Write tests FIRST (TDD) │
|
|
195
|
+
│ 3. Implement feature │
|
|
196
|
+
│ 4. Run tests locally: pytest │
|
|
197
|
+
│ 5. Add to release → AUTOMATIC VALIDATION │
|
|
198
|
+
│ ├─ temp-valid branch created │
|
|
199
|
+
│ | ├─ All patches merged │
|
|
200
|
+
│ | └─ pytest runs automatically │
|
|
201
|
+
│ └─ Only commits if everything is OK │
|
|
202
|
+
│ 6. Promote to RC → Tests validated again, code merged on ho-prod │
|
|
203
|
+
│ 7. Deploy to prod → Tested code only │
|
|
204
|
+
└───────────────────────────────────────────────────────────────────┘
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Benefits:**
|
|
208
|
+
- ✅ **Catch Integration Issues Early**: Test interactions between patches
|
|
209
|
+
- ✅ **Prevent Regressions**: Existing tests protect against breaking changes
|
|
210
|
+
- ✅ **Document Behavior**: Tests serve as executable specifications
|
|
211
|
+
- ✅ **Safe Refactoring**: Change implementation with confidence
|
|
212
|
+
- ✅ **Team Collaboration**: Clear expectations for code quality
|
|
213
|
+
|
|
214
|
+
### 📦 Release Management
|
|
215
|
+
- **Semantic versioning**: patch/minor/major increments
|
|
216
|
+
- **Release candidates**: RC validation before production
|
|
217
|
+
- **Sequential promotion**: stage → rc → production workflow
|
|
218
|
+
- **Branch cleanup**: Automatic deletion after RC promotion
|
|
219
|
+
- **Test validation**: Automated testing at every promotion step
|
|
220
|
+
|
|
221
|
+
### 🚀 Production
|
|
222
|
+
- **Safe upgrades**: Automatic database backups before changes
|
|
223
|
+
- **Incremental deployment**: Apply releases sequentially
|
|
224
|
+
- **Dry-run mode**: Preview changes before applying
|
|
225
|
+
- **Version tracking**: Complete release history in database
|
|
226
|
+
- **Rollback support**: Automatic rollback on failures
|
|
227
|
+
|
|
228
|
+
### 👥 Team Collaboration
|
|
229
|
+
- **Distributed locks**: Prevent concurrent ho-prod modifications
|
|
230
|
+
- **Branch notifications**: Alert developers when rebase needed
|
|
231
|
+
- **Multiple stages**: Parallel development of different releases
|
|
232
|
+
- **Git-based coordination**: No external tools required
|
|
233
|
+
|
|
234
|
+
## 🚀 Installation
|
|
235
|
+
|
|
236
|
+
### Prerequisites
|
|
237
|
+
|
|
238
|
+
- Python 3.8+
|
|
239
|
+
- PostgreSQL 12+
|
|
240
|
+
- Git
|
|
241
|
+
- halfORM (`pip install halfORM`)
|
|
242
|
+
|
|
243
|
+
### Install
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
pip install half_orm_dev
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Verify Installation
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
half_orm dev --help
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## 📖 Quick Start
|
|
256
|
+
|
|
257
|
+
### Initialize New Project
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# Create project with database
|
|
261
|
+
half_orm dev init myproject --database mydb
|
|
262
|
+
|
|
263
|
+
# Navigate to project
|
|
264
|
+
cd myproject
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Clone Existing Project
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
# Clone from Git
|
|
271
|
+
half_orm dev clone https://github.com/user/project.git
|
|
272
|
+
|
|
273
|
+
# Navigate to project
|
|
274
|
+
cd project
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### First Patch (TDD Development)
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# First, create a release integration branch
|
|
281
|
+
half_orm dev release new minor # Creates ho-release/0.1.0
|
|
282
|
+
|
|
283
|
+
# Now create patch (automatically added to candidates)
|
|
284
|
+
half_orm dev patch new 1-users
|
|
285
|
+
# → Auto-added to 0.1.0-candidates.txt
|
|
286
|
+
|
|
287
|
+
# Add schema changes
|
|
288
|
+
echo "CREATE TABLE users (id uuid PRIMARY KEY DEFAULT gen_random_uuid(), username TEXT NOT NULL);" > Patches/1-users/01_users.sql
|
|
289
|
+
|
|
290
|
+
# Apply patch - this generates Python code AND test directory structure
|
|
291
|
+
half_orm dev patch apply
|
|
292
|
+
# → Restores database
|
|
293
|
+
# → Applies SQL patches
|
|
294
|
+
# → Generates Python classes (mydb/public/user.py)
|
|
295
|
+
# → Creates test directory structure (tests/public/user/)
|
|
296
|
+
|
|
297
|
+
# Now write business logic tests (TDD approach)
|
|
298
|
+
# IMPORTANT: Test business logic, NOT ORM operations like ho_insert()
|
|
299
|
+
cat > tests/public/user/test_user_business_logic.py << 'EOF'
|
|
300
|
+
from mydb.public.user import User
|
|
301
|
+
|
|
302
|
+
def test_user_creation_with_valid_data():
|
|
303
|
+
"""Test creating a user with valid business logic."""
|
|
304
|
+
# Assuming you implement a create() business method
|
|
305
|
+
user = User.create(username='alice')
|
|
306
|
+
assert user['username'] == 'alice'
|
|
307
|
+
assert user['id'] is not None
|
|
308
|
+
|
|
309
|
+
def test_user_creation_rejects_empty_username():
|
|
310
|
+
"""Test business validation."""
|
|
311
|
+
# Should raise an error if you implement validation
|
|
312
|
+
with pytest.raises(ValueError):
|
|
313
|
+
User.create(username='')
|
|
314
|
+
EOF
|
|
315
|
+
|
|
316
|
+
# Implement business logic in your User class
|
|
317
|
+
cat >> mydb/public/user.py << 'EOF'
|
|
318
|
+
|
|
319
|
+
@classmethod
|
|
320
|
+
def create(cls, username: str):
|
|
321
|
+
"""Business logic for creating a user."""
|
|
322
|
+
if not username or not username.strip():
|
|
323
|
+
raise ValueError("Username cannot be empty")
|
|
324
|
+
return cls(username=username).ho_insert()
|
|
325
|
+
EOF
|
|
326
|
+
|
|
327
|
+
# Run tests
|
|
328
|
+
pytest
|
|
329
|
+
|
|
330
|
+
# Commit your work
|
|
331
|
+
git add .
|
|
332
|
+
git commit -m "Add users table with business logic and tests"
|
|
333
|
+
|
|
334
|
+
# Close patch - integrate to release (automatic validation runs here!)
|
|
335
|
+
half_orm dev patch close 1-users
|
|
336
|
+
# → Moved from candidates to stage
|
|
337
|
+
# → Tests validated automatically
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## 💻 Development Workflow
|
|
341
|
+
|
|
342
|
+
### Vision: Git-Flow Release Management
|
|
343
|
+
|
|
344
|
+
The workflow follows a **Git-Flow** approach with dedicated integration branches (`ho-release/X.Y.Z`) that serve as **test sandboxes** before production.
|
|
345
|
+
|
|
346
|
+
**Motivation:**
|
|
347
|
+
- Patches are visible and testable on `ho-release/X.Y.Z` before production
|
|
348
|
+
- `ho-prod` remains stable and contains only validated versions (RC or production)
|
|
349
|
+
- Workflow compatible with GitLab/GitHub (milestones, merge requests, issues)
|
|
350
|
+
- No need to create RC just to make a patch accessible
|
|
351
|
+
|
|
352
|
+
### Complete Cycle: Patch → Release → Deploy
|
|
353
|
+
|
|
354
|
+
```
|
|
355
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
356
|
+
│ DEVELOPMENT (ho-release/X.Y.Z branch) │
|
|
357
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
358
|
+
│ 1. release new <level> Create ho-release/X.Y.Z │
|
|
359
|
+
│ 2. patch new <id> Create patch (auto in candidates) │
|
|
360
|
+
│ 3. patch apply Apply & test changes │
|
|
361
|
+
│ 4. patch close <id> Merge into ho-release (TESTS!) │
|
|
362
|
+
│ │
|
|
363
|
+
│ RELEASE PROMOTION │
|
|
364
|
+
│ 5. release promote rc Create RC (tags ho-release branch) │
|
|
365
|
+
│ 6. release promote prod Merge to ho-prod + deploy │
|
|
366
|
+
│ │
|
|
367
|
+
│ PRODUCTION DEPLOYMENT │
|
|
368
|
+
│ 7. update Check available releases │
|
|
369
|
+
│ 8. upgrade Apply on production servers │
|
|
370
|
+
│ │
|
|
371
|
+
│ HOTFIX WORKFLOW (urgent fixes) │
|
|
372
|
+
│ 9. release hotfix Reopen production version │
|
|
373
|
+
│ 10. patch new/close Same workflow on hotfix branch │
|
|
374
|
+
│ 11. release promote hotfix Deploy as vX.Y.Z-hotfixN │
|
|
375
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Workflow Details
|
|
379
|
+
|
|
380
|
+
#### Concepts: Release Files and Patch States
|
|
381
|
+
|
|
382
|
+
**Release Files:**
|
|
383
|
+
```
|
|
384
|
+
releases/
|
|
385
|
+
├── 0.17.0-candidates.txt # Patches in development
|
|
386
|
+
├── 0.17.0-stage.txt # Integrated patches (awaiting RC)
|
|
387
|
+
├── 0.17.0-rc1.txt # First Release Candidate
|
|
388
|
+
├── 0.17.0-rc2.txt # Second RC (with fixes)
|
|
389
|
+
├── 0.17.0.txt # Production version
|
|
390
|
+
├── 0.17.0-hotfix1.txt # Urgent production fix
|
|
391
|
+
└── 0.18.0-candidates.txt # Next release in progress
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
**Patch States:**
|
|
395
|
+
1. **Candidate**: Assigned to release, in development (in `-candidates.txt`)
|
|
396
|
+
2. **Staged**: Integrated in `ho-release/X.Y.Z`, awaiting promotion (in `-stage.txt`)
|
|
397
|
+
3. **Released**: Included in deployed production version (in `X.Y.Z.txt`)
|
|
398
|
+
|
|
399
|
+
**Analogy with GitLab/GitHub:**
|
|
400
|
+
|
|
401
|
+
| half-orm state | File | GitLab/GitHub |
|
|
402
|
+
|----------------|------|---------------|
|
|
403
|
+
| `release new` | Creates `-candidates.txt` and `-stage.txt` | Create milestone |
|
|
404
|
+
| `patch new` (on ho-release) | Adds to `-candidates.txt` | Create issue assigned to milestone |
|
|
405
|
+
| Candidate | `-candidates.txt` | Open issue assigned to milestone |
|
|
406
|
+
| `patch close` | Moves to `-stage.txt` | Merge MR and close issue |
|
|
407
|
+
| Stage | `-stage.txt` | Closed issue in milestone |
|
|
408
|
+
| `release promote rc` | Renames to `-rcN.txt` | Create pre-release |
|
|
409
|
+
| RC | `-rcN.txt` | GitHub pre-release |
|
|
410
|
+
| `release promote prod` | Renames to `X.Y.Z.txt` | Create stable release |
|
|
411
|
+
| Production | `X.Y.Z.txt` | Stable release |
|
|
412
|
+
|
|
413
|
+
#### Step 1: Create a New Release
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
half_orm dev release new minor
|
|
417
|
+
# → Detects current production version (e.g., 0.16.0)
|
|
418
|
+
# → Calculates next minor version: 0.17.0
|
|
419
|
+
# → Creates branch ho-release/0.17.0 from ho-prod
|
|
420
|
+
# → Creates releases/0.17.0-candidates.txt (empty)
|
|
421
|
+
# → Creates releases/0.17.0-stage.txt (empty)
|
|
422
|
+
# → Commits and pushes to reserve version globally
|
|
423
|
+
# → Automatically switches to ho-release/0.17.0
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
**Output:**
|
|
427
|
+
```
|
|
428
|
+
✅ Release created successfully!
|
|
429
|
+
|
|
430
|
+
Version: 0.17.0
|
|
431
|
+
Release branch: ho-release/0.17.0
|
|
432
|
+
Candidates file: releases/0.17.0-candidates.txt
|
|
433
|
+
Stage file: releases/0.17.0-stage.txt
|
|
434
|
+
|
|
435
|
+
📝 Next steps:
|
|
436
|
+
1. Create patches: half_orm dev patch new <patch_id>
|
|
437
|
+
2. Close patches: half_orm dev patch close <patch_id>
|
|
438
|
+
3. Promote to RC: half_orm dev release promote rc
|
|
439
|
+
|
|
440
|
+
ℹ️ Patches will be merged into ho-release/0.17.0 for integration testing
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
#### Step 2: Create a Candidate Patch
|
|
444
|
+
|
|
445
|
+
**Prerequisites:** Must be on `ho-release/0.17.0` branch
|
|
446
|
+
|
|
447
|
+
```bash
|
|
448
|
+
git checkout ho-release/0.17.0
|
|
449
|
+
half_orm dev patch new 6-feature-x
|
|
450
|
+
# → Auto-detects version 0.17.0 from current branch
|
|
451
|
+
# → Creates ho-patch/6-feature-x from ho-release/0.17.0
|
|
452
|
+
# → Adds 6-feature-x to 0.17.0-candidates.txt
|
|
453
|
+
# → Switches to ho-patch/6-feature-x
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
**Output:**
|
|
457
|
+
```
|
|
458
|
+
✓ Created patch branch: ho-patch/6-feature-x
|
|
459
|
+
✓ Created patch directory: Patches/6-feature-x/
|
|
460
|
+
✓ Added to candidates: releases/0.17.0-candidates.txt
|
|
461
|
+
✓ Switched to branch: ho-patch/6-feature-x
|
|
462
|
+
|
|
463
|
+
📝 Next steps:
|
|
464
|
+
1. Add SQL/Python files to Patches/6-feature-x/
|
|
465
|
+
2. Run: half_orm dev patch apply
|
|
466
|
+
3. Test your changes
|
|
467
|
+
4. Run: half_orm dev patch close 6-feature-x
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
#### Step 3: Develop and Test (TDD Approach)
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
# Apply patch (on ho-patch/* branch)
|
|
474
|
+
half_orm dev patch apply
|
|
475
|
+
# → Restores database from production state
|
|
476
|
+
# → Applies all release patches + current patch
|
|
477
|
+
# → Generates Python code
|
|
478
|
+
# → Ready for testing
|
|
479
|
+
|
|
480
|
+
# FIRST: Write tests
|
|
481
|
+
cat > tests/public/users/test_users_feature.py << 'EOF'
|
|
482
|
+
def test_feature():
|
|
483
|
+
# Your test here
|
|
484
|
+
assert True
|
|
485
|
+
EOF
|
|
486
|
+
|
|
487
|
+
# Run tests
|
|
488
|
+
pytest
|
|
489
|
+
|
|
490
|
+
# Commit your work
|
|
491
|
+
git add .
|
|
492
|
+
git commit -m "Implement feature with tests"
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
#### Step 4: Close Patch (Integrate to Release)
|
|
496
|
+
|
|
497
|
+
```bash
|
|
498
|
+
half_orm dev patch close 6-feature-x
|
|
499
|
+
# Complete workflow:
|
|
500
|
+
# → Detects version from 0.17.0-candidates.txt
|
|
501
|
+
# → Validates ho-patch/6-feature-x exists
|
|
502
|
+
# → Creates temporary validation branch
|
|
503
|
+
# → Merges ho-patch/6-feature-x into temp branch
|
|
504
|
+
# → Restores database and applies all patches
|
|
505
|
+
# → Runs tests (pytest)
|
|
506
|
+
# → If PASS: Merges into ho-release/0.17.0
|
|
507
|
+
# → Moves 6-feature-x from candidates.txt to stage.txt
|
|
508
|
+
# → Deletes branch ho-patch/6-feature-x
|
|
509
|
+
# → Commits and pushes changes
|
|
510
|
+
# → Notifies other candidate patches to sync
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
**Output:**
|
|
514
|
+
```
|
|
515
|
+
✓ Patch closed successfully!
|
|
516
|
+
|
|
517
|
+
Stage file: releases/0.17.0-stage.txt
|
|
518
|
+
Patch added: 6-feature-x
|
|
519
|
+
Tests passed: ✓
|
|
520
|
+
Notified: 2 active branch(es)
|
|
521
|
+
|
|
522
|
+
📝 Next steps:
|
|
523
|
+
• Other developers: git pull && git merge ho-release/0.17.0
|
|
524
|
+
• Continue development: half_orm dev patch new <next_patch_id>
|
|
525
|
+
• Promote to RC: half_orm dev release promote rc
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
**Important:** `patch close` replaces the old `patch add` command. The semantics are different:
|
|
529
|
+
- **OLD**: `patch add` = "I add my validated patch to release" (from ho-prod)
|
|
530
|
+
- **NEW**: `patch close` = "I close my work, it's integrated in release" (merge into ho-release)
|
|
531
|
+
|
|
532
|
+
#### Step 5: Synchronize with Other Integrated Patches
|
|
533
|
+
|
|
534
|
+
When another patch is integrated in the release, candidate patches must update:
|
|
535
|
+
|
|
536
|
+
```bash
|
|
537
|
+
git fetch origin
|
|
538
|
+
git merge origin/ho-release/0.17.0
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
#### Step 6: Promote to RC
|
|
542
|
+
|
|
543
|
+
**Sequentiality Rule:** Only the **smallest version** in preparation can be promoted to RC. This guarantees sequential release order.
|
|
544
|
+
|
|
545
|
+
**Example:** If releases `0.17.1`, `0.18.0` and `1.0.0` are in preparation, only `0.17.1` can be promoted to RC.
|
|
546
|
+
|
|
547
|
+
```bash
|
|
548
|
+
half_orm dev release promote rc
|
|
549
|
+
# Complete workflow:
|
|
550
|
+
# → Auto-detects smallest version with -stage.txt
|
|
551
|
+
# → Verifies it's sequential (follows last prod/RC)
|
|
552
|
+
# → Automatically switches to ho-release/X.Y.Z
|
|
553
|
+
# → Finds next RC number (rc1, rc2, etc.)
|
|
554
|
+
# → Creates tag vX.Y.Z-rc1 on ho-release/X.Y.Z (NOT on ho-prod!)
|
|
555
|
+
# → Renames releases/X.Y.Z-stage.txt to releases/X.Y.Z-rc1.txt (git mv)
|
|
556
|
+
# → Recreates releases/X.Y.Z-stage.txt (empty) for next patches
|
|
557
|
+
# → Commits and pushes
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
**Output:**
|
|
561
|
+
```
|
|
562
|
+
✓ Success!
|
|
563
|
+
|
|
564
|
+
Version: 0.17.0
|
|
565
|
+
Tag: v0.17.0-rc1
|
|
566
|
+
Branch: ho-release/0.17.0
|
|
567
|
+
|
|
568
|
+
📝 Next steps:
|
|
569
|
+
• Test RC thoroughly
|
|
570
|
+
• Deploy to production: half_orm dev release promote prod
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
**Important Notes:**
|
|
574
|
+
- Tag is created on `ho-release/0.17.0`, **NOT on `ho-prod`**
|
|
575
|
+
- Command **auto-detects** which version to promote (smallest)
|
|
576
|
+
- Cannot "skip" a version: if 0.17.0 isn't in prod, can't promote 0.18.0
|
|
577
|
+
|
|
578
|
+
#### Step 7: Promote to Production
|
|
579
|
+
|
|
580
|
+
**Sequentiality Rule:** Only the **smallest version in preparation** (with a stage file) can be promoted to production.
|
|
581
|
+
|
|
582
|
+
```bash
|
|
583
|
+
half_orm dev release promote prod
|
|
584
|
+
# Complete workflow:
|
|
585
|
+
# → Auto-detects smallest version with -stage.txt file
|
|
586
|
+
# → Verifies strict sequentiality (0.17.0 must follow last prod)
|
|
587
|
+
# → Automatically switches to ho-prod
|
|
588
|
+
# → Merges ho-release/0.17.0 into ho-prod (integrates patch code)
|
|
589
|
+
# → Restores database and applies all patches from stage
|
|
590
|
+
# → Generates model/schema-0.17.0.sql and metadata-0.17.0.sql
|
|
591
|
+
# → Updates symlink model/schema.sql → schema-0.17.0.sql
|
|
592
|
+
# → Renames 0.17.0-stage.txt to releases/0.17.0.txt (final list)
|
|
593
|
+
# → Deletes releases/0.17.0-candidates.txt
|
|
594
|
+
# → Preserves releases/0.17.0-rc*.txt for history (if any)
|
|
595
|
+
# → Creates tag v0.17.0 on ho-prod
|
|
596
|
+
# → Deletes branch ho-release/0.17.0 (mission complete)
|
|
597
|
+
# → Commits and pushes
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
**Output:**
|
|
601
|
+
```
|
|
602
|
+
✓ Success!
|
|
603
|
+
|
|
604
|
+
Version: 0.17.0
|
|
605
|
+
Tag: v0.17.0
|
|
606
|
+
Branches deleted: ho-release/0.17.0
|
|
607
|
+
|
|
608
|
+
📝 Next steps:
|
|
609
|
+
• Deploy to production servers
|
|
610
|
+
• Start next cycle: half_orm dev release new minor
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
**Important Notes:**
|
|
614
|
+
- This is when patch code is **actually merged into `ho-prod`**, not before
|
|
615
|
+
- Command **auto-detects** smallest version with stage file
|
|
616
|
+
- **Always uses stage file**: RC files are preserved for history but not used for promotion
|
|
617
|
+
- **RC is optional**: Can promote directly from stage to production without creating RC
|
|
618
|
+
- Sequentiality is **strictly enforced**: impossible to promote 0.18.0 if 0.17.0 isn't already in prod
|
|
619
|
+
|
|
620
|
+
#### Step 8/9: Production Upgrade
|
|
621
|
+
|
|
622
|
+
```bash
|
|
623
|
+
# On production server (automatically pulls from origin)
|
|
624
|
+
# Check available releases
|
|
625
|
+
half_orm dev update
|
|
626
|
+
|
|
627
|
+
# Apply upgrade (with automatic backup and git pull)
|
|
628
|
+
half_orm dev upgrade
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
#### Hotfix Workflow (Urgent Production Fixes)
|
|
632
|
+
|
|
633
|
+
**Scenario:** Critical bug discovered in production (v0.17.0) while new release (v0.18.0) is already in development. Production needs fixing **immediately** without waiting for v0.18.0.
|
|
634
|
+
|
|
635
|
+
**Step 1: Reopen Production Version**
|
|
636
|
+
|
|
637
|
+
```bash
|
|
638
|
+
half_orm dev release hotfix
|
|
639
|
+
# Workflow:
|
|
640
|
+
# → Detects production version from model/schema.sql (e.g., 0.17.0)
|
|
641
|
+
# → Verifies tag v0.17.0 exists
|
|
642
|
+
# → Reopens branch ho-release/0.17.0 from tag v0.17.0
|
|
643
|
+
# → Automatically switches to ho-release/0.17.0
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
**Output:**
|
|
647
|
+
```
|
|
648
|
+
✓ Reopened ho-release/0.17.0 from v0.17.0
|
|
649
|
+
✓ Ready for hotfix patches
|
|
650
|
+
|
|
651
|
+
📝 Next steps:
|
|
652
|
+
1. half_orm dev patch new <patch_id>
|
|
653
|
+
2. half_orm dev patch close <patch_id>
|
|
654
|
+
3. half_orm dev release promote hotfix
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
**Important Note:** This is a **break from sequential workflow** as we now have two active release branches simultaneously (`ho-release/0.17.0` and `ho-release/0.18.0`).
|
|
658
|
+
|
|
659
|
+
**Step 2: Create and Integrate Hotfix Patch**
|
|
660
|
+
|
|
661
|
+
The workflow is **identical** to normal workflow:
|
|
662
|
+
|
|
663
|
+
```bash
|
|
664
|
+
# On ho-release/0.17.0
|
|
665
|
+
half_orm dev patch new 999-critical-security-fix
|
|
666
|
+
# ... develop ...
|
|
667
|
+
half_orm dev patch apply
|
|
668
|
+
# ... test ...
|
|
669
|
+
half_orm dev patch close 999-critical-security-fix
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
**Step 3: Promote Hotfix to Production**
|
|
673
|
+
|
|
674
|
+
**Important:** Cannot use `promote prod` as tag `v0.17.0` already exists!
|
|
675
|
+
|
|
676
|
+
```bash
|
|
677
|
+
git checkout ho-prod
|
|
678
|
+
half_orm dev release promote hotfix
|
|
679
|
+
# Hotfix-specific workflow:
|
|
680
|
+
# → Detects hotfix context (tag vX.Y.Z already exists)
|
|
681
|
+
# → Finds next hotfix number (hotfix1, hotfix2, etc.)
|
|
682
|
+
# → Merges ho-release/0.17.0 into ho-prod
|
|
683
|
+
# → Generates model/schema-0.17.0-hotfix1.sql and metadata-0.17.0-hotfix1.sql
|
|
684
|
+
# → Updates symlink model/schema.sql → schema-0.17.0-hotfix1.sql
|
|
685
|
+
# → Creates releases/0.17.0-hotfix1.txt with patch list
|
|
686
|
+
# → Creates tag v0.17.0-hotfix1 on ho-prod
|
|
687
|
+
# → Deletes branch ho-release/0.17.0
|
|
688
|
+
# → Commits and pushes
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
**Output:**
|
|
692
|
+
```
|
|
693
|
+
✓ Hotfix deployed!
|
|
694
|
+
|
|
695
|
+
Version: 0.17.0-hotfix1
|
|
696
|
+
Tag: v0.17.0-hotfix1
|
|
697
|
+
Patches: 999-critical-security-fix
|
|
698
|
+
|
|
699
|
+
📝 Next steps:
|
|
700
|
+
• Deploy to production servers immediately
|
|
701
|
+
• Sync other releases: git checkout ho-release/0.18.0 && git merge ho-prod
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
**Step 4: Sync Other In-Progress Releases**
|
|
705
|
+
|
|
706
|
+
If a release is in development (e.g., 0.18.0), it **must** integrate the hotfix:
|
|
707
|
+
|
|
708
|
+
```bash
|
|
709
|
+
git checkout ho-release/0.18.0
|
|
710
|
+
git merge ho-prod
|
|
711
|
+
# Resolve any conflicts
|
|
712
|
+
git push origin ho-release/0.18.0
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
This guarantees the bugfix won't be lost in the next release.
|
|
716
|
+
|
|
717
|
+
## 📖 Command Reference
|
|
718
|
+
|
|
719
|
+
**NOTE**: use `half_orm dev command --help` for detailed help on each command
|
|
720
|
+
|
|
721
|
+
### Init & Clone
|
|
722
|
+
|
|
723
|
+
```bash
|
|
724
|
+
# Create new project
|
|
725
|
+
half_orm dev init <package_name> --database <db_name>
|
|
726
|
+
|
|
727
|
+
# Clone existing project (automatically pulls from origin)
|
|
728
|
+
half_orm dev clone <git_origin>
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
### Patch Commands
|
|
732
|
+
|
|
733
|
+
```bash
|
|
734
|
+
# Create new patch (must be on ho-release/* branch)
|
|
735
|
+
half_orm dev patch new <patch_id> [-d "description"]
|
|
736
|
+
|
|
737
|
+
# Apply current patch (from ho-patch/* branch)
|
|
738
|
+
half_orm dev patch apply
|
|
739
|
+
|
|
740
|
+
# Close patch - integrate to release (AUTOMATIC VALIDATION!)
|
|
741
|
+
half_orm dev patch close <patch_id>
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
### Release Commands
|
|
745
|
+
|
|
746
|
+
```bash
|
|
747
|
+
# Prepare next release (patch/minor/major)
|
|
748
|
+
# Creates ho-release/X.Y.Z branch + candidates.txt + stage.txt
|
|
749
|
+
half_orm dev release new patch
|
|
750
|
+
half_orm dev release new minor
|
|
751
|
+
half_orm dev release new major
|
|
752
|
+
|
|
753
|
+
# Promote stage to RC (automatically pushes)
|
|
754
|
+
# Tags ho-release/X.Y.Z, renames stage → rc
|
|
755
|
+
half_orm dev release promote rc
|
|
756
|
+
|
|
757
|
+
# Promote RC to production (automatically pushes)
|
|
758
|
+
# Merges ho-release/X.Y.Z → ho-prod, creates tag
|
|
759
|
+
half_orm dev release promote prod
|
|
760
|
+
|
|
761
|
+
# Reopen production version for hotfix
|
|
762
|
+
half_orm dev release hotfix
|
|
763
|
+
|
|
764
|
+
# Promote hotfix to production
|
|
765
|
+
half_orm dev release promote hotfix
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
### Production Commands
|
|
769
|
+
|
|
770
|
+
```bash
|
|
771
|
+
# Fetch available releases (automatically pulls from origin)
|
|
772
|
+
half_orm dev update
|
|
773
|
+
|
|
774
|
+
# Apply releases to production (automatically pulls from origin)
|
|
775
|
+
half_orm dev upgrade [--to-release X.Y.Z]
|
|
776
|
+
|
|
777
|
+
# Dry run (simulate upgrade)
|
|
778
|
+
half_orm dev upgrade --dry-run
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
## 🎯 Common Patterns
|
|
782
|
+
|
|
783
|
+
### Pattern 1: Planned Development with Integration Branch
|
|
784
|
+
|
|
785
|
+
```bash
|
|
786
|
+
# Start by creating release integration branch
|
|
787
|
+
half_orm dev release new minor # Creates ho-release/0.17.0
|
|
788
|
+
|
|
789
|
+
# Now on ho-release/0.17.0, create patch
|
|
790
|
+
half_orm dev patch new 123-add-users
|
|
791
|
+
# → Auto-added to 0.17.0-candidates.txt
|
|
792
|
+
|
|
793
|
+
# Add SQL/Python files
|
|
794
|
+
echo "CREATE TABLE users (id SERIAL PRIMARY KEY, username TEXT);" > Patches/123-add-users/01_users.sql
|
|
795
|
+
|
|
796
|
+
# Write tests
|
|
797
|
+
cat > tests/public/test_public_users.py << 'EOF'
|
|
798
|
+
def test_user_creation():
|
|
799
|
+
user = User(username='alice').ho_insert()
|
|
800
|
+
assert user['username'] == 'alice'
|
|
801
|
+
EOF
|
|
802
|
+
|
|
803
|
+
# Apply and test
|
|
804
|
+
half_orm dev patch apply
|
|
805
|
+
pytest # Tests should pass
|
|
806
|
+
|
|
807
|
+
# Commit your work
|
|
808
|
+
git add .
|
|
809
|
+
git commit -m "Implement users table with tests"
|
|
810
|
+
|
|
811
|
+
# Close patch - integrate to release (tests validated automatically!)
|
|
812
|
+
half_orm dev patch close 123-add-users
|
|
813
|
+
# → Moved from candidates to stage
|
|
814
|
+
# → Tests run automatically before integration
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
### Pattern 2: Team Collaboration on Same Release
|
|
818
|
+
|
|
819
|
+
```bash
|
|
820
|
+
# Integration Manager: Create release
|
|
821
|
+
half_orm dev release new minor # Creates ho-release/0.17.0
|
|
822
|
+
|
|
823
|
+
# Developer A: Working on feature
|
|
824
|
+
git checkout ho-release/0.17.0
|
|
825
|
+
half_orm dev patch new 456-dashboard
|
|
826
|
+
# → Added to 0.17.0-candidates.txt
|
|
827
|
+
# ... develop and test ...
|
|
828
|
+
half_orm dev patch close 456-dashboard
|
|
829
|
+
# → Moved to 0.17.0-stage.txt
|
|
830
|
+
|
|
831
|
+
# Developer B: Must sync with A's changes first
|
|
832
|
+
git checkout ho-release/0.17.0
|
|
833
|
+
git pull origin ho-release/0.17.0 # Get A's integrated changes
|
|
834
|
+
|
|
835
|
+
# Then create patch
|
|
836
|
+
half_orm dev patch new 789-reports
|
|
837
|
+
# → Added to 0.17.0-candidates.txt
|
|
838
|
+
# ... develop and test ...
|
|
839
|
+
git merge origin/ho-release/0.17.0 # Sync again before closing
|
|
840
|
+
half_orm dev patch close 789-reports
|
|
841
|
+
# → Tests run with 456 + 789 together!
|
|
842
|
+
|
|
843
|
+
# All patches validated together in stage
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
### Pattern 3: Parallel Development of Different Releases
|
|
847
|
+
|
|
848
|
+
```bash
|
|
849
|
+
# Parallel development of different versions
|
|
850
|
+
# 1. Create multiple release branches
|
|
851
|
+
half_orm dev release new minor # Creates 0.18.0
|
|
852
|
+
half_orm dev release new patch # Creates 0.17.1
|
|
853
|
+
|
|
854
|
+
# 2. Add patches to specific versions
|
|
855
|
+
git checkout ho-release/0.17.1
|
|
856
|
+
half_orm dev patch new 123-hotfix
|
|
857
|
+
half_orm dev patch close 123-hotfix
|
|
858
|
+
|
|
859
|
+
git checkout ho-release/0.18.0
|
|
860
|
+
half_orm dev patch new 456-feature
|
|
861
|
+
half_orm dev patch close 456-feature
|
|
862
|
+
|
|
863
|
+
# 3. Sequential promotion (must promote 0.17.1 before 0.18.0)
|
|
864
|
+
half_orm dev release promote rc # Auto-promotes 0.17.1 (smallest)
|
|
865
|
+
# ... validate ...
|
|
866
|
+
half_orm dev release promote prod # 0.17.1 to production
|
|
867
|
+
# Now can promote 0.18.0
|
|
868
|
+
half_orm dev release promote rc # Auto-promotes 0.18.0
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
### Pattern 4: Incremental RC (Fix Issues)
|
|
872
|
+
|
|
873
|
+
```bash
|
|
874
|
+
# RC1 has issues discovered in testing
|
|
875
|
+
half_orm dev release promote rc # Creates 0.17.0-rc1
|
|
876
|
+
# → stage.txt renamed to rc1.txt
|
|
877
|
+
# → new empty stage.txt created
|
|
878
|
+
|
|
879
|
+
# Found bug in testing, create fix patch
|
|
880
|
+
git checkout ho-release/0.17.0 # Back to integration branch
|
|
881
|
+
half_orm dev patch new 999-rc1-fix
|
|
882
|
+
# → Added to 0.17.0-candidates.txt
|
|
883
|
+
half_orm dev patch apply
|
|
884
|
+
# ... fix and test ...
|
|
885
|
+
|
|
886
|
+
# Close patch - adds to NEW stage
|
|
887
|
+
half_orm dev patch close 999-rc1-fix
|
|
888
|
+
# → Moved to 0.17.0-stage.txt (the new empty one)
|
|
889
|
+
# → Validated automatically
|
|
890
|
+
|
|
891
|
+
# Promote again (creates rc2, automatically pushes)
|
|
892
|
+
half_orm dev release promote rc # Creates 0.17.0-rc2
|
|
893
|
+
# → stage.txt renamed to rc2.txt
|
|
894
|
+
# → new empty stage.txt created
|
|
895
|
+
|
|
896
|
+
# Repeat until RC passes all validation
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
### Pattern 5: Hotfix on Production
|
|
900
|
+
|
|
901
|
+
```bash
|
|
902
|
+
# Bug discovered in production (v0.17.0)
|
|
903
|
+
# New release (v0.18.0) already in development
|
|
904
|
+
|
|
905
|
+
# Reopen production version
|
|
906
|
+
half_orm dev release hotfix
|
|
907
|
+
# → Reopens ho-release/0.17.0 from tag v0.17.0
|
|
908
|
+
# → Creates 0.17.0-candidates.txt and 0.17.0-stage.txt
|
|
909
|
+
|
|
910
|
+
# Same workflow as normal patch
|
|
911
|
+
half_orm dev patch new 999-critical-fix
|
|
912
|
+
# → Added to 0.17.0-candidates.txt (with # HOTFIX marker)
|
|
913
|
+
half_orm dev patch apply
|
|
914
|
+
# ... fix and test ...
|
|
915
|
+
half_orm dev patch close 999-critical-fix
|
|
916
|
+
# → Moved to 0.17.0-stage.txt
|
|
917
|
+
|
|
918
|
+
# Promote as hotfix
|
|
919
|
+
git checkout ho-prod
|
|
920
|
+
half_orm dev release promote hotfix
|
|
921
|
+
# → Creates v0.17.0-hotfix1 tag
|
|
922
|
+
# → Creates 0.17.0-hotfix1.txt file
|
|
923
|
+
# → Merges into ho-prod
|
|
924
|
+
|
|
925
|
+
# Sync other in-progress releases
|
|
926
|
+
git checkout ho-release/0.18.0
|
|
927
|
+
git merge ho-prod # Integrate the hotfix
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
### Pattern 6: Production Deployment
|
|
931
|
+
|
|
932
|
+
```bash
|
|
933
|
+
# On production server (commands automatically pull from origin)
|
|
934
|
+
|
|
935
|
+
# Check available releases
|
|
936
|
+
half_orm dev update
|
|
937
|
+
|
|
938
|
+
# Simulate upgrade
|
|
939
|
+
half_orm dev upgrade --dry-run
|
|
940
|
+
|
|
941
|
+
# Apply upgrade (creates backup automatically, pulls from origin)
|
|
942
|
+
half_orm dev upgrade
|
|
943
|
+
|
|
944
|
+
# Or apply specific version
|
|
945
|
+
half_orm dev upgrade --to-release 1.4.0
|
|
946
|
+
```
|
|
947
|
+
|
|
948
|
+
## 🏗️ Architecture
|
|
949
|
+
|
|
950
|
+
### Branch Strategy
|
|
951
|
+
|
|
952
|
+
```
|
|
953
|
+
ho-prod (main production)
|
|
954
|
+
│
|
|
955
|
+
├── ho-release/0.17.0 (integration branch, deleted after prod promotion)
|
|
956
|
+
│ ├── ho-patch/6-feature-x (temporary, deleted after close)
|
|
957
|
+
│ ├── ho-patch/7-bugfix-y (temporary, deleted after close)
|
|
958
|
+
│ └── ho-patch/8-auth-z (temporary, deleted after close)
|
|
959
|
+
│
|
|
960
|
+
└── ho-release/0.18.0 (next version in parallel)
|
|
961
|
+
└── ho-patch/10-new-api (temporary, deleted after close)
|
|
962
|
+
```
|
|
963
|
+
|
|
964
|
+
**Branch types:**
|
|
965
|
+
- **ho-prod**: Main production branch (source of truth, stable)
|
|
966
|
+
- **ho-release/X.Y.Z**: Integration branch for version X.Y.Z (temporary, deleted after prod promotion)
|
|
967
|
+
- **ho-patch/\***: Patch development branches created from ho-release/* (temporary, deleted after close)
|
|
968
|
+
|
|
969
|
+
**Branch Lifecycle:**
|
|
970
|
+
1. `release new` creates `ho-release/X.Y.Z` from `ho-prod`
|
|
971
|
+
2. `patch new` creates `ho-patch/ID` from `ho-release/X.Y.Z`
|
|
972
|
+
3. `patch close` merges `ho-patch/ID` into `ho-release/X.Y.Z` and deletes `ho-patch/ID`
|
|
973
|
+
4. `release promote prod` merges `ho-release/X.Y.Z` into `ho-prod` and deletes `ho-release/X.Y.Z`
|
|
974
|
+
|
|
975
|
+
**Exception - Hotfix Branches:**
|
|
976
|
+
- `release hotfix` reopens `ho-release/X.Y.Z` from existing tag `vX.Y.Z`
|
|
977
|
+
- Multiple `ho-release/*` branches can exist temporarily (prod version + dev version)
|
|
978
|
+
- After `promote hotfix`, the hotfix branch is deleted
|
|
979
|
+
|
|
980
|
+
### Release Files
|
|
981
|
+
|
|
982
|
+
```
|
|
983
|
+
releases/
|
|
984
|
+
├── 0.17.0-candidates.txt (patches in development, mutable)
|
|
985
|
+
├── 0.17.0-stage.txt (integrated patches, mutable)
|
|
986
|
+
├── 0.17.0-rc1.txt (first RC, immutable)
|
|
987
|
+
├── 0.17.0-rc2.txt (fixes from rc1, immutable)
|
|
988
|
+
├── 0.17.0.txt (production, immutable)
|
|
989
|
+
├── 0.17.0-hotfix1.txt (hotfix on production, immutable)
|
|
990
|
+
├── 0.18.0-candidates.txt (next version candidates)
|
|
991
|
+
└── 0.18.0-stage.txt (next version stage)
|
|
992
|
+
```
|
|
993
|
+
|
|
994
|
+
**File lifecycle (normal workflow):**
|
|
995
|
+
```
|
|
996
|
+
patch new → X.Y.Z-candidates.txt (patch added automatically)
|
|
997
|
+
↓
|
|
998
|
+
patch close → X.Y.Z-stage.txt (moved from candidates)
|
|
999
|
+
↓
|
|
1000
|
+
├─→ promote rc → X.Y.Z-rc1.txt (OPTIONAL: renamed from stage, new empty stage created)
|
|
1001
|
+
│ ↓
|
|
1002
|
+
│ promote rc → X.Y.Z-rc2.txt (if fixes needed, stage renamed again)
|
|
1003
|
+
│
|
|
1004
|
+
└─→ promote prod → X.Y.Z.txt (ALWAYS renames stage file, preserves RC for history)
|
|
1005
|
+
```
|
|
1006
|
+
|
|
1007
|
+
**Key point:** `promote prod` always uses and renames the **stage file**, regardless of whether RCs exist. RC files are kept for history only.
|
|
1008
|
+
|
|
1009
|
+
**File lifecycle (hotfix workflow):**
|
|
1010
|
+
```
|
|
1011
|
+
release hotfix → Reopens X.Y.Z-candidates.txt and X.Y.Z-stage.txt
|
|
1012
|
+
↓
|
|
1013
|
+
patch close → X.Y.Z-stage.txt (adds hotfix patches)
|
|
1014
|
+
↓
|
|
1015
|
+
promote hotfix → X.Y.Z-hotfixN.txt (new file, candidates/stage deleted)
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
**File content format:**
|
|
1019
|
+
- Each line contains a patch ID
|
|
1020
|
+
- Lines starting with `#` are comments (e.g., `# HOTFIX` marker for candidates)
|
|
1021
|
+
- Empty lines are ignored
|
|
1022
|
+
|
|
1023
|
+
### Patch Directory Structure
|
|
1024
|
+
|
|
1025
|
+
```
|
|
1026
|
+
Patches/
|
|
1027
|
+
└── 123-feature-name/
|
|
1028
|
+
├── README.md (auto-generated description)
|
|
1029
|
+
├── 01_schema.sql (schema changes)
|
|
1030
|
+
├── 02_data.sql (data migrations)
|
|
1031
|
+
└── 03_indexes.sql (performance optimizations)
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
**Execution order:** Lexicographic (01, 02, 03...)
|
|
1035
|
+
|
|
1036
|
+
### Semantic Versioning
|
|
1037
|
+
|
|
1038
|
+
```
|
|
1039
|
+
MAJOR.MINOR.PATCH
|
|
1040
|
+
│ │ │
|
|
1041
|
+
│ │ └── Bug fixes, minor changes (1.3.5 → 1.3.6)
|
|
1042
|
+
│ └──────── New features, backward compatible (1.3.5 → 1.4.0)
|
|
1043
|
+
└────────────── Breaking changes (1.3.5 → 2.0.0)
|
|
1044
|
+
```
|
|
1045
|
+
|
|
1046
|
+
### Workflow Rules
|
|
1047
|
+
|
|
1048
|
+
1. **Sequential releases**: Must promote 0.17.0 before 0.17.1 or 0.18.0
|
|
1049
|
+
2. **Auto-detection**: Commands automatically detect smallest version to promote
|
|
1050
|
+
3. **Patch origin**: Must create patches from `ho-release/*` branch, not `ho-prod`
|
|
1051
|
+
4. **Patch lifecycle**: new → candidates → close → stage → rc → prod
|
|
1052
|
+
5. **Branch cleanup**:
|
|
1053
|
+
- `patch close` deletes `ho-patch/*` branch
|
|
1054
|
+
- `promote prod` deletes `ho-release/*` branch
|
|
1055
|
+
6. **Database restore**: `patch apply` always restores from production state
|
|
1056
|
+
7. **Immutable releases**: RC and production files never modified
|
|
1057
|
+
8. **Automatic Git operations**: Push/pull handled by commands automatically
|
|
1058
|
+
9. **⚠️ SYSTEMATIC TEST VALIDATION**: Tests run before integration (in `patch close`)
|
|
1059
|
+
10. **Hotfix exception**: Can reopen production version while other releases in progress
|
|
1060
|
+
11. **# HOTFIX marker**: Candidates file marked with `# HOTFIX` comment for hotfix releases
|
|
1061
|
+
|
|
1062
|
+
## 🔧 Troubleshooting
|
|
1063
|
+
|
|
1064
|
+
### Error: "Must be on ho-release/* branch"
|
|
1065
|
+
|
|
1066
|
+
```bash
|
|
1067
|
+
# Solution: Create release or switch to release branch
|
|
1068
|
+
half_orm dev release new minor
|
|
1069
|
+
# or
|
|
1070
|
+
git checkout ho-release/0.17.0
|
|
1071
|
+
```
|
|
1072
|
+
|
|
1073
|
+
### Error: "Must be on ho-patch/* branch"
|
|
1074
|
+
|
|
1075
|
+
```bash
|
|
1076
|
+
# Solution: Create or switch to patch branch
|
|
1077
|
+
# First ensure you're on ho-release/*
|
|
1078
|
+
git checkout ho-release/0.17.0
|
|
1079
|
+
half_orm dev patch new <patch_id>
|
|
1080
|
+
# or
|
|
1081
|
+
git checkout ho-patch/<patch_id>
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
### Error: "Patch not found in candidates file"
|
|
1085
|
+
|
|
1086
|
+
```bash
|
|
1087
|
+
# Solution: Patch must be created from ho-release/* branch
|
|
1088
|
+
# to be automatically added to candidates
|
|
1089
|
+
git checkout ho-release/0.17.0
|
|
1090
|
+
half_orm dev patch new <patch_id>
|
|
1091
|
+
```
|
|
1092
|
+
|
|
1093
|
+
### Error: "Repository is not clean"
|
|
1094
|
+
|
|
1095
|
+
```bash
|
|
1096
|
+
# Solution: Commit or stash changes
|
|
1097
|
+
git status
|
|
1098
|
+
git add .
|
|
1099
|
+
git commit -m "Your message"
|
|
1100
|
+
# or
|
|
1101
|
+
git stash
|
|
1102
|
+
```
|
|
1103
|
+
|
|
1104
|
+
### Error: "Repository not synced with origin"
|
|
1105
|
+
|
|
1106
|
+
```bash
|
|
1107
|
+
# This should not happen - commands handle git operations automatically
|
|
1108
|
+
# If it does occur:
|
|
1109
|
+
git pull origin ho-prod
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
### Error: "No stage releases found"
|
|
1113
|
+
|
|
1114
|
+
```bash
|
|
1115
|
+
# Solution: Prepare a release first
|
|
1116
|
+
half_orm dev release new patch
|
|
1117
|
+
```
|
|
1118
|
+
|
|
1119
|
+
### Error: "Active RC exists"
|
|
1120
|
+
|
|
1121
|
+
```bash
|
|
1122
|
+
# Cannot promote different version while RC exists
|
|
1123
|
+
# Solution: Promote current RC to production first
|
|
1124
|
+
half_orm dev release promote prod
|
|
1125
|
+
|
|
1126
|
+
# Then promote your stage
|
|
1127
|
+
half_orm dev release promote rc
|
|
1128
|
+
```
|
|
1129
|
+
|
|
1130
|
+
### Error: "Tests failed for patch integration"
|
|
1131
|
+
|
|
1132
|
+
```bash
|
|
1133
|
+
# Tests ran on temp-valid branch and failed
|
|
1134
|
+
# Solution: Fix your tests or code
|
|
1135
|
+
half_orm dev patch apply # Test locally first
|
|
1136
|
+
pytest # Verify tests pass
|
|
1137
|
+
|
|
1138
|
+
# Fix issues in your patch
|
|
1139
|
+
vim Patches/123-feature/01_schema.sql
|
|
1140
|
+
vim tests/test_feature.py
|
|
1141
|
+
|
|
1142
|
+
# Try again
|
|
1143
|
+
git checkout ho-prod
|
|
1144
|
+
half_orm dev patch add 123-feature # Tests will run again
|
|
1145
|
+
```
|
|
1146
|
+
|
|
1147
|
+
### Patch apply failed (SQL error)
|
|
1148
|
+
|
|
1149
|
+
```bash
|
|
1150
|
+
# Database automatically rolled back
|
|
1151
|
+
# Solution: Fix SQL files and re-apply
|
|
1152
|
+
vim Patches/123-feature/01_schema.sql
|
|
1153
|
+
half_orm dev patch apply
|
|
1154
|
+
```
|
|
1155
|
+
|
|
1156
|
+
### Lost after conflicts
|
|
1157
|
+
|
|
1158
|
+
```bash
|
|
1159
|
+
# View repository state
|
|
1160
|
+
git status
|
|
1161
|
+
git log --oneline -10
|
|
1162
|
+
|
|
1163
|
+
# View current branch
|
|
1164
|
+
git branch
|
|
1165
|
+
|
|
1166
|
+
# View remote branches
|
|
1167
|
+
git branch -r
|
|
1168
|
+
|
|
1169
|
+
# Return to safe state
|
|
1170
|
+
git checkout ho-prod
|
|
1171
|
+
# Commands handle git pull automatically
|
|
1172
|
+
```
|
|
1173
|
+
|
|
1174
|
+
## 🎓 Best Practices
|
|
1175
|
+
|
|
1176
|
+
### Patch Development
|
|
1177
|
+
|
|
1178
|
+
✅ **DO:**
|
|
1179
|
+
- **Write tests FIRST** (TDD approach)
|
|
1180
|
+
- Start with exploratory patches (no release needed initially)
|
|
1181
|
+
- Use descriptive patch IDs: `123-add-user-authentication`
|
|
1182
|
+
- Test patches thoroughly before adding to release
|
|
1183
|
+
- Keep patches focused (one feature per patch)
|
|
1184
|
+
- Commit generated code with meaningful messages
|
|
1185
|
+
- Create release when patches are ready to integrate
|
|
1186
|
+
- Run `pytest` locally before `patch add`
|
|
1187
|
+
|
|
1188
|
+
❌ **DON'T:**
|
|
1189
|
+
- Mix multiple features in one patch
|
|
1190
|
+
- Skip `patch apply` validation
|
|
1191
|
+
- Add untested patches to release
|
|
1192
|
+
- Modify files outside your patch directory
|
|
1193
|
+
- Worry about git push/pull (commands handle it automatically)
|
|
1194
|
+
- Skip writing tests (validation will fail anyway)
|
|
1195
|
+
|
|
1196
|
+
### Release Management
|
|
1197
|
+
|
|
1198
|
+
✅ **DO:**
|
|
1199
|
+
- Prepare releases when patches are ready to integrate
|
|
1200
|
+
- Trust the automatic test validation system
|
|
1201
|
+
- Test RC thoroughly before promoting to production
|
|
1202
|
+
- Use semantic versioning consistently
|
|
1203
|
+
- Document breaking changes in commit messages
|
|
1204
|
+
- Let commands handle git operations automatically
|
|
1205
|
+
- Review test failures carefully before retrying
|
|
1206
|
+
|
|
1207
|
+
❌ **DON'T:**
|
|
1208
|
+
- Skip RC validation (always test before prod)
|
|
1209
|
+
- Promote multiple RCs simultaneously
|
|
1210
|
+
- Skip backup creation in production
|
|
1211
|
+
- Force promote without fixing issues
|
|
1212
|
+
- Manually push/pull (let commands handle it)
|
|
1213
|
+
- Bypass test validation (it's there for your safety)
|
|
1214
|
+
|
|
1215
|
+
### Production Deployment
|
|
1216
|
+
|
|
1217
|
+
✅ **DO:**
|
|
1218
|
+
- Always run `update` first to check available releases
|
|
1219
|
+
- Use `--dry-run` to preview changes
|
|
1220
|
+
- Verify backups exist before upgrade
|
|
1221
|
+
- Monitor application after deployment
|
|
1222
|
+
- Schedule deployments during low-traffic periods
|
|
1223
|
+
- Trust commands to handle git operations
|
|
1224
|
+
- Verify all tests passed in RC before promoting
|
|
1225
|
+
|
|
1226
|
+
❌ **DON'T:**
|
|
1227
|
+
- Deploy without testing in RC first
|
|
1228
|
+
- Skip backup verification
|
|
1229
|
+
- Deploy during peak usage hours
|
|
1230
|
+
- Ignore upgrade warnings
|
|
1231
|
+
- Apply patches directly without releases
|
|
1232
|
+
- Manually git pull (commands do it automatically)
|
|
1233
|
+
- Promote to production if RC tests failed
|
|
1234
|
+
|
|
1235
|
+
### Testing Best Practices
|
|
1236
|
+
|
|
1237
|
+
✅ **DO:**
|
|
1238
|
+
- Write tests for all business logic
|
|
1239
|
+
- Test database constraints and validations
|
|
1240
|
+
- Use fixtures for common test scenarios
|
|
1241
|
+
- Test edge cases and error handling
|
|
1242
|
+
- Keep tests fast and isolated
|
|
1243
|
+
- Document test intentions clearly
|
|
1244
|
+
- Run tests locally before pushing
|
|
1245
|
+
|
|
1246
|
+
❌ **DON'T:**
|
|
1247
|
+
- Skip tests for "simple" changes
|
|
1248
|
+
- Write tests that depend on execution order
|
|
1249
|
+
- Ignore test failures
|
|
1250
|
+
- Write tests without assertions
|
|
1251
|
+
- Test implementation details instead of behavior
|
|
1252
|
+
|
|
1253
|
+
## 📚 Documentation
|
|
1254
|
+
|
|
1255
|
+
- **Quick Reference**: This README
|
|
1256
|
+
- **Full Documentation**: `docs/half_orm_dev.md`
|
|
1257
|
+
- **Development Methodology**: `docs/METHODOLOGY.md`
|
|
1258
|
+
- **Development Log**: `docs/dev_log.md`
|
|
1259
|
+
- **API Reference**: `python-docs/`
|
|
1260
|
+
|
|
1261
|
+
## 🤝 Contributing
|
|
1262
|
+
|
|
1263
|
+
Contributions are welcome! Please read our contributing guidelines and submit pull requests to our repository.
|
|
1264
|
+
|
|
1265
|
+
### Development Setup
|
|
1266
|
+
|
|
1267
|
+
```bash
|
|
1268
|
+
# Clone repository
|
|
1269
|
+
git clone https://github.com/halfORM/half_orm_dev.git
|
|
1270
|
+
cd half_orm_dev
|
|
1271
|
+
|
|
1272
|
+
# Install in development mode
|
|
1273
|
+
pip install -e .
|
|
1274
|
+
|
|
1275
|
+
# Run tests
|
|
1276
|
+
pytest
|
|
1277
|
+
```
|
|
1278
|
+
|
|
1279
|
+
## 📞 Getting Help
|
|
1280
|
+
|
|
1281
|
+
```bash
|
|
1282
|
+
# Command help
|
|
1283
|
+
half_orm dev --help
|
|
1284
|
+
half_orm dev patch --help
|
|
1285
|
+
half_orm dev release --help
|
|
1286
|
+
|
|
1287
|
+
# Specific command help
|
|
1288
|
+
half_orm dev patch new --help
|
|
1289
|
+
half_orm dev release promote --help
|
|
1290
|
+
half_orm dev update --help
|
|
1291
|
+
half_orm dev upgrade --help
|
|
1292
|
+
```
|
|
1293
|
+
|
|
1294
|
+
### Support
|
|
1295
|
+
|
|
1296
|
+
- **Issues**: [GitHub Issues](https://github.com/halfORM/half_orm_dev/issues)
|
|
1297
|
+
- **Documentation**: [docs/](docs/)
|
|
1298
|
+
- **halfORM**: [halfORM Documentation](https://github.com/halfORM/halfORM)
|
|
1299
|
+
|
|
1300
|
+
## 📄 License
|
|
1301
|
+
|
|
1302
|
+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
|
1303
|
+
|
|
1304
|
+
---
|
|
1305
|
+
|
|
1306
|
+
**Version**: 0.17.0
|
|
1307
|
+
**halfORM**: Compatible with halfORM 0.17.x
|
|
1308
|
+
**Python**: 3.8+
|
|
1309
|
+
**PostgreSQL**: Tested with 13+ (might work with earlier versions)
|
|
1310
|
+
|
|
1311
|
+
Made with ❤️ by the halfORM team
|