This repository was archived by the owner on Oct 10, 2025. It is now read-only.
Commit 31227bc
committed
0a36bbc fix: [#14] correct configure-env test logic to eliminate CI warning (Jose Celano)
efd79da fix: [#14] add .gitkeep to preserve application/config/templates directory structure (Jose Celano)
e505846 docs: add table of contents to copilot instructions (Jose Celano)
db45c94 refactor: [#14] separate testing concerns across three-layer architecture (Jose Celano)
d3fe01e docs: [#14] fix table formatting in copilot instructions (Jose Celano)
8c75916 refactor: [#14] reorganize Makefile into infrastructure/application layers (Jose Celano)
732a297 feat: [#14] improve cloud-init completion detection robustness (Jose Celano)
8ba6858 refactor: [#14] centralize log_section function and improve Docker Compose deployment (Jose Celano)
42c52c4 refactor: [#14] move general utility functions from test-e2e.sh to shell-utils.sh (Jose Celano)
Pull request description:
## 🎯 Overview
This PR completes **Phase 2.3** of the twelve-factor app refactoring initiative (#14), implementing a strict **three-layer testing architecture** and comprehensive documentation improvements to ensure maintainable separation of concerns.
## 🚀 Key Achievements
### ✅ **Three-Layer Testing Architecture Implementation**
Implemented strict separation of testing concerns across three layers to prevent future mixing of concerns and improve maintainability:
**1. Project-Wide/Global Layer** (`tests/` folder)
- **Command**: `make test-ci`
- **Scope**: Cross-cutting concerns and orchestration
- **Responsibilities**: Global syntax validation, Makefile validation, orchestrates other layers
**2. Infrastructure Layer** (`infrastructure/` folder)
- **Command**: `make infra-test-ci`
- **Scope**: Infrastructure-specific validation ONLY
- **Responsibilities**: Terraform/OpenTofu syntax, cloud-init templates, infrastructure scripts
**3. Application Layer** (`application/` folder)
- **Command**: `make app-test-ci`
- **Scope**: Application-specific validation ONLY
- **Responsibilities**: Docker Compose syntax, application configuration, deployment scripts
### ✅ **Enhanced Documentation & Contributor Experience**
- **Table of Contents**: Added comprehensive TOC to `.github/copilot-instructions.md` for improved navigation
- **AI Assistant Guidelines**: Enhanced with explicit testing layer separation warnings and examples
- **Contributor Documentation**: Updated with three-layer architecture requirements and best practices
### ✅ **Shell Utilities Consolidation**
- **Centralized Functions**: Moved reusable shell functions to `scripts/shell-utils.sh`
- **Consistent Logging**: Standardized `log_section` function across all scripts
- **Sudo Cache Management**: Improved user experience for infrastructure operations
### ✅ **Makefile Organization**
- **Layer Separation**: Clear distinction between infrastructure and application commands
- **Orchestration**: Project-wide test orchestrator that respects layer boundaries
- **Backward Compatibility**: Legacy commands maintained with proper deprecation notices
## 📁 Files Changed
### Core Architecture Files
- **`Makefile`**: Refactored test targets for three-layer architecture
- **`tests/test-ci.sh`**: New project-wide orchestrator for global concerns
- **`infrastructure/tests/test-ci.sh`**: Refactored to focus only on infrastructure concerns
- **`application/tests/test-ci.sh`**: New application-layer CI test script
### Documentation & Guidelines
- **`.github/copilot-instructions.md`**: Added TOC and enhanced AI assistant guidelines
- **`docs/refactoring/`**: Added comprehensive refactoring documentation
- **`tests/README.md`**: Updated to reflect three-layer architecture
### Utilities & Scripts
- **`scripts/shell-utils.sh`**: Consolidated utility functions with sudo cache management
- **Infrastructure scripts**: Updated to use centralized utilities
- **Cloud-init templates**: Improved completion detection robustness
## 🔧 Benefits Delivered
### **Maintainable Architecture**
- ✅ **Clear separation**: Each layer focuses only on its own concerns
- ✅ **Prevent regression**: Strong guidelines prevent future mixing of concerns
- ✅ **Better debugging**: Issues can be isolated to specific layers
- ✅ **Faster CI**: Each layer can be tested independently when needed
### **Enhanced Developer Experience**
- ✅ **Better navigation**: TOC makes comprehensive documentation more accessible
- ✅ **Clear guidelines**: AI assistants and contributors have explicit boundaries
- ✅ **Improved workflows**: Centralized utilities improve script consistency
- ✅ **Quality assurance**: All changes pass complete CI validation
### **Future-Proof Foundation**
- ✅ **Scalable testing**: Architecture supports adding new layers if needed
- ✅ **Cultural enforcement**: Documentation prevents regression to mixed concerns
- ✅ **Technical enforcement**: Make targets enforce proper layer separation
## 🧪 Testing & Validation
### **Complete CI Validation**
```bash
make test-ci # ✅ All project-wide tests pass
├── Global concerns (syntax, structure, Makefile) ✅
├── make infra-test-ci (Infrastructure layer only) ✅
└── make app-test-ci (Application layer only) ✅
```
### **Layer Separation Validation**
- ✅ **Infrastructure tests**: Only test infrastructure concerns (no global linting calls)
- ✅ **Application tests**: Only test application concerns (CI-friendly environment handling)
- ✅ **Global tests**: Handle cross-cutting concerns and orchestration only
### **Documentation Quality**
- ✅ **Markdown linting**: All documentation passes markdownlint validation
- ✅ **Link validation**: Table of contents links work correctly in GitHub
- ✅ **Comprehensive coverage**: All major workflow aspects documented
## 🔗 Relationship to Issue #14
This PR addresses **Phase 2.3** objectives from the twelve-factor refactoring plan:
- ✅ **Testing Infrastructure**: Three-layer architecture prevents future technical debt
- ✅ **Documentation Improvements**: Enhanced contributor guidelines and navigation
- ✅ **Shell Utilities**: Consolidated and improved script utilities
- ✅ **Foundation Completion**: Solid base for remaining twelve-factor implementation
**Next Phase**: Configuration management system implementation (template-based configurations)
## 🔍 Review Focus Areas
### **Testing Architecture**
- Verify that each test layer only handles its own concerns
- Confirm `make test-ci` properly orchestrates all layers
- Check that AI assistant guidelines prevent future violations
### **Documentation Quality**
- Review table of contents navigation and completeness
- Validate AI assistant guidelines are clear and actionable
- Confirm refactoring documentation provides good context
### **Code Quality**
- Verify shell utilities follow project standards
- Check that Makefile changes maintain backward compatibility
- Confirm all linting and syntax validation passes
---
**Ready for Review** ✅ | **All CI Tests Pass** ✅ | **Documentation Complete** ✅
ACKs for top commit:
josecelano:
ACK 0a36bbc
Tree-SHA512: fba11e0c5baff4fc1798be7dd1567b507fc9601ccd2fe619b33ee388d44513cb9cce97a5dd5f3c91f69c61413fc6cdb5c12ca5c72063bc10271b75b11f841177
File tree
19 files changed
+837
-303
lines changed- .github
- application
- config/templates
- tests
- docs
- guides
- refactoring
- infrastructure
- cloud-init
- scripts
- tests
- scripts
- scripts
- tests
19 files changed
+837
-303
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
3 | 24 | | |
4 | 25 | | |
5 | 26 | | |
| |||
132 | 153 | | |
133 | 154 | | |
134 | 155 | | |
135 | | - | |
| 156 | + | |
136 | 157 | | |
137 | 158 | | |
138 | 159 | | |
139 | 160 | | |
140 | | - | |
141 | | - | |
| 161 | + | |
| 162 | + | |
142 | 163 | | |
143 | 164 | | |
144 | 165 | | |
145 | | - | |
146 | | - | |
| 166 | + | |
| 167 | + | |
147 | 168 | | |
148 | 169 | | |
149 | 170 | | |
150 | 171 | | |
151 | 172 | | |
152 | 173 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
159 | 180 | | |
160 | 181 | | |
161 | 182 | | |
| |||
171 | 192 | | |
172 | 193 | | |
173 | 194 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
179 | 200 | | |
180 | 201 | | |
181 | 202 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
187 | 207 | | |
188 | 208 | | |
189 | 209 | | |
| |||
245 | 265 | | |
246 | 266 | | |
247 | 267 | | |
248 | | - | |
| 268 | + | |
249 | 269 | | |
250 | 270 | | |
251 | 271 | | |
| |||
349 | 369 | | |
350 | 370 | | |
351 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
352 | 432 | | |
353 | 433 | | |
354 | 434 | | |
| |||
408 | 488 | | |
409 | 489 | | |
410 | 490 | | |
411 | | - | |
412 | | - | |
| 491 | + | |
| 492 | + | |
413 | 493 | | |
414 | 494 | | |
415 | 495 | | |
| |||
439 | 519 | | |
440 | 520 | | |
441 | 521 | | |
442 | | - | |
| 522 | + | |
443 | 523 | | |
444 | 524 | | |
445 | 525 | | |
| |||
448 | 528 | | |
449 | 529 | | |
450 | 530 | | |
451 | | - | |
| 531 | + | |
452 | 532 | | |
453 | 533 | | |
454 | 534 | | |
| |||
467 | 547 | | |
468 | 548 | | |
469 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
470 | 571 | | |
471 | 572 | | |
472 | 573 | | |
| |||
482 | 583 | | |
483 | 584 | | |
484 | 585 | | |
485 | | - | |
| 586 | + | |
486 | 587 | | |
487 | 588 | | |
488 | 589 | | |
489 | 590 | | |
490 | 591 | | |
491 | 592 | | |
492 | 593 | | |
493 | | - | |
| 594 | + | |
494 | 595 | | |
495 | 596 | | |
496 | 597 | | |
| |||
569 | 670 | | |
570 | 671 | | |
571 | 672 | | |
572 | | - | |
| 673 | + | |
573 | 674 | | |
574 | 675 | | |
575 | 676 | | |
| |||
581 | 682 | | |
582 | 683 | | |
583 | 684 | | |
584 | | - | |
| 685 | + | |
585 | 686 | | |
586 | 687 | | |
587 | 688 | | |
| |||
0 commit comments