|
1 | | -# [PROJECT_NAME] Constitution |
2 | | -<!-- Example: Spec Constitution, TaskFlow Constitution, etc. --> |
| 1 | +# Nextflow Development Constitution |
| 2 | + |
| 3 | +<!-- |
| 4 | +SYNC IMPACT REPORT |
| 5 | +================== |
| 6 | +Version Change: INITIAL → 1.0.0 (Initial constitution) |
| 7 | +Modified Principles: N/A (new constitution) |
| 8 | +Added Sections: |
| 9 | + - All principles (I-VII) |
| 10 | + - Development Workflow |
| 11 | + - Quality Standards |
| 12 | + - Governance |
| 13 | +
|
| 14 | +Removed Sections: N/A (initial version) |
| 15 | +
|
| 16 | +Templates Status: |
| 17 | + ✅ plan-template.md - Reviewed, aligned with modular architecture and testing principles |
| 18 | + ✅ spec-template.md - Reviewed, aligned with user scenario focus and requirements structure |
| 19 | + ✅ tasks-template.md - Reviewed, aligned with test-driven and parallel development principles |
| 20 | + ✅ agent-file-template.md - Reviewed, no agent-specific conflicts |
| 21 | + ✅ checklist-template.md - Reviewed, compatible with quality standards |
| 22 | +
|
| 23 | +Follow-up TODOs: |
| 24 | + - None at this time |
| 25 | +================== |
| 26 | +--> |
3 | 27 |
|
4 | 28 | ## Core Principles |
5 | 29 |
|
6 | | -### [PRINCIPLE_1_NAME] |
7 | | -<!-- Example: I. Library-First --> |
8 | | -[PRINCIPLE_1_DESCRIPTION] |
9 | | -<!-- Example: Every feature starts as a standalone library; Libraries must be self-contained, independently testable, documented; Clear purpose required - no organizational-only libraries --> |
| 30 | +### I. Modular Architecture |
| 31 | + |
| 32 | +Nextflow MUST maintain a clear separation between core functionality and extensions through its modular architecture: |
| 33 | + |
| 34 | +- **Core modules** (`modules/`) contain essential functionality: workflow engine (nextflow), shared utilities (nf-commons), language parsing (nf-lang), HTTP filesystem support (nf-httpfs), and lineage tracking (nf-lineage) |
| 35 | +- **Plugin system** (`plugins/`) provides cloud provider integrations (AWS, Azure, GCP), execution platforms (Kubernetes), and specialized services (Seqera Platform, Wave container management) |
| 36 | +- New features MUST be evaluated for placement: core features belong in `modules/`, specialized/cloud-specific features belong in `plugins/` |
| 37 | +- Each module and plugin MUST be independently buildable and testable |
| 38 | +- Plugin dependencies MUST be explicitly declared in `build.gradle` with semantic versioning |
| 39 | + |
| 40 | +**Rationale**: This architecture enables independent development of cloud provider features without core engine changes, supports third-party plugin development, and maintains a clean separation of concerns across a large multi-module codebase. |
| 41 | + |
| 42 | +### II. Test-Driven Quality Assurance (NON-NEGOTIABLE) |
| 43 | + |
| 44 | +Testing MUST be comprehensive and multi-layered before any code is merged: |
| 45 | + |
| 46 | +- **Unit tests** MUST use Spock Framework for all Groovy code, be independently executable, and achieve meaningful coverage (measured via JaCoCo) |
| 47 | +- **Integration tests** (`tests/` directory) MUST validate end-to-end workflows using actual `.nf` scripts with expected outputs |
| 48 | +- **Smoke tests** (`make smoke` or `NXF_SMOKE=1`) MUST be available to skip long-running and cloud-dependent tests during rapid development |
| 49 | +- **Cloud validation tests** (`validation/` directory) MUST verify cloud provider integrations end-to-end before release |
| 50 | +- **Documentation tests** (`docs/snippets/`) MUST ensure all documentation examples remain functional |
| 51 | +- All tests MUST pass before commits, and `make test` MUST be run locally before pushing |
| 52 | + |
| 53 | +**Rationale**: Scientific workflows demand reliability and reproducibility. Multi-layered testing catches issues at appropriate levels: unit tests for logic, integration tests for workflow correctness, and validation tests for cloud provider compatibility. |
| 54 | + |
| 55 | +### III. Dataflow Programming Model |
| 56 | + |
| 57 | +Nextflow's core abstraction MUST adhere to the dataflow programming model: |
| 58 | + |
| 59 | +- Workflows are defined as dataflow graphs where data flows between processes |
| 60 | +- Processes MUST be stateless, side-effect-free transformations that communicate via channels |
| 61 | +- The DSL MUST prioritize expressiveness for concurrent and parallel pipeline definition |
| 62 | +- Changes to the language parser (ANTLR grammars in `nf-lang`) MUST preserve backward compatibility with existing pipelines unless explicitly versioned (DSL1 vs DSL2) |
| 63 | +- Concurrency primitives (GPars actors/dataflow) MUST be used correctly to maintain the dataflow semantics |
| 64 | + |
| 65 | +**Rationale**: The dataflow model is Nextflow's fundamental value proposition, enabling automatic parallelization and distribution. Preserving this model ensures existing scientific pipelines continue to work and users can reason about workflow behavior. |
| 66 | + |
| 67 | +### IV. Apache 2.0 License Compliance |
| 68 | + |
| 69 | +All source code MUST include Apache 2.0 license headers: |
| 70 | + |
| 71 | +- Every source file MUST begin with the Apache 2.0 license header |
| 72 | +- All contributions MUST comply with Apache 2.0 terms |
| 73 | +- Third-party dependencies MUST use compatible licenses |
| 74 | +- License compliance MUST be verified during code review |
| 75 | + |
| 76 | +**Rationale**: Legal clarity protects both contributors and users. Consistent licensing enables academic and commercial use, which is critical for scientific software adoption. |
| 77 | + |
| 78 | +### V. Developer Certificate of Origin (DCO) Sign-off |
| 79 | + |
| 80 | +All commits MUST be signed with DCO certification: |
| 81 | + |
| 82 | +- Contributors MUST certify they have the right to submit the code by using `git commit -s` or `git commit --signoff` |
| 83 | +- Every commit message MUST include a `Signed-off-by` line |
| 84 | +- The DCO bot MUST verify sign-off before any PR can be merged |
| 85 | +- Contributors MUST NOT bypass the DCO requirement |
10 | 86 |
|
11 | | -### [PRINCIPLE_2_NAME] |
12 | | -<!-- Example: II. CLI Interface --> |
13 | | -[PRINCIPLE_2_DESCRIPTION] |
14 | | -<!-- Example: Every library exposes functionality via CLI; Text in/out protocol: stdin/args → stdout, errors → stderr; Support JSON + human-readable formats --> |
| 87 | +**Rationale**: DCO provides legal protection and clear chain of custody for contributions, which is essential for open-source projects with diverse contributors. |
15 | 88 |
|
16 | | -### [PRINCIPLE_3_NAME] |
17 | | -<!-- Example: III. Test-First (NON-NEGOTIABLE) --> |
18 | | -[PRINCIPLE_3_DESCRIPTION] |
19 | | -<!-- Example: TDD mandatory: Tests written → User approved → Tests fail → Then implement; Red-Green-Refactor cycle strictly enforced --> |
| 89 | +### VI. Semantic Versioning and Release Discipline |
20 | 90 |
|
21 | | -### [PRINCIPLE_4_NAME] |
22 | | -<!-- Example: IV. Integration Testing --> |
23 | | -[PRINCIPLE_4_DESCRIPTION] |
24 | | -<!-- Example: Focus areas requiring integration tests: New library contract tests, Contract changes, Inter-service communication, Shared schemas --> |
| 91 | +Version management MUST follow strict semantic versioning with calendar-based releases: |
25 | 92 |
|
26 | | -### [PRINCIPLE_5_NAME] |
27 | | -<!-- Example: V. Observability, VI. Versioning & Breaking Changes, VII. Simplicity --> |
28 | | -[PRINCIPLE_5_DESCRIPTION] |
29 | | -<!-- Example: Text I/O ensures debuggability; Structured logging required; Or: MAJOR.MINOR.BUILD format; Or: Start simple, YAGNI principles --> |
| 93 | +- **Project versions** use calendar-based scheme: `YY.MM.PATCH` where April (`.04.`) and October (`.10.`) are stable releases, all other months use `-edge` suffix (e.g., `25.09.0-edge`) |
| 94 | +- **Plugin versions** MUST use semantic versioning (`MAJOR.MINOR.PATCH`) |
| 95 | +- Version changes MUST be documented in `changelog.txt` files (both project root and per-plugin) |
| 96 | +- Breaking changes MUST increment MAJOR version for plugins and be clearly documented |
| 97 | +- Release process MUST follow the documented procedure in `CLAUDE.md` including: updating changelogs, version files, running `make releaseInfo`, using `[release]` tag in commit message |
30 | 98 |
|
31 | | -## [SECTION_2_NAME] |
32 | | -<!-- Example: Additional Constraints, Security Requirements, Performance Standards, etc. --> |
| 99 | +**Rationale**: Predictable versioning enables users to understand compatibility and stability expectations. Calendar-based versioning for the main project makes release timing transparent, while semantic versioning for plugins enables clear communication of breaking changes. |
33 | 100 |
|
34 | | -[SECTION_2_CONTENT] |
35 | | -<!-- Example: Technology stack requirements, compliance standards, deployment policies, etc. --> |
| 101 | +### VII. Groovy Idioms and Code Standards |
36 | 102 |
|
37 | | -## [SECTION_3_NAME] |
38 | | -<!-- Example: Development Workflow, Review Process, Quality Gates, etc. --> |
| 103 | +Code MUST follow Groovy best practices and Nextflow conventions: |
39 | 104 |
|
40 | | -[SECTION_3_CONTENT] |
41 | | -<!-- Example: Code review requirements, testing gates, deployment approval process, etc. --> |
| 105 | +- Use Groovy idioms (closures, operator overloading, DSL builders) appropriately |
| 106 | +- Follow existing code patterns and conventions from similar modules |
| 107 | +- Leverage Groovy's dynamic capabilities judiciously without sacrificing type safety where beneficial |
| 108 | +- Use Groovy's `@CompileStatic` where performance is critical or type safety is desired |
| 109 | +- AST transformations (in `modules/nextflow`) MUST be well-documented due to their compile-time magic |
| 110 | +- Code MUST be formatted consistently (consider CodeNarc configuration in `gradle/codenarc.groovy`) |
| 111 | + |
| 112 | +**Rationale**: Groovy enables powerful DSL capabilities that make Nextflow's language expressive, but requires discipline to maintain readability and debuggability. Consistency across the large codebase improves maintainability. |
| 113 | + |
| 114 | +## Development Workflow |
| 115 | + |
| 116 | +### Build and Development Process |
| 117 | + |
| 118 | +- **Build tool**: Gradle with wrapper (`./gradlew`) is the authoritative build system |
| 119 | +- **Quick commands**: Makefile provides convenience targets (`make compile`, `make test`, `make assemble`, `make check`, `make clean`) |
| 120 | +- **Development testing**: Use `./launch.sh run script.nf` for testing changes against real workflows without full installation |
| 121 | +- **Local installation**: `make install` publishes to Maven local for integration testing |
| 122 | +- **Dependency management**: All dependencies MUST be declared in `build.gradle` with explicit versions; use `make deps` to analyze dependency trees |
| 123 | + |
| 124 | +### Git Workflow |
| 125 | + |
| 126 | +- **Branch management**: Work on feature branches, never commit directly to `master` |
| 127 | +- **Commit sign-off**: Always use `git commit -s` to add DCO sign-off |
| 128 | +- **CI control tags**: Use special commit message tags to control CI behavior: |
| 129 | + - `[ci skip]` - Skip CI tests entirely |
| 130 | + - `[ci fast]` - Run only unit tests, skip integration tests |
| 131 | + - `[e2e stage]` - Run end-to-end tests against Seqera platform staging environment |
| 132 | + - `[e2e prod]` - Run end-to-end tests against production platform |
| 133 | + - `[release]` - Trigger release automation |
| 134 | +- **Pull requests**: Must pass all CI checks, require code review, and have DCO verification |
| 135 | + |
| 136 | +### Architecture Decision Records (ADRs) |
| 137 | + |
| 138 | +- Significant structural and technical decisions MUST be documented as ADRs in the `adr/` directory |
| 139 | +- ADRs MUST follow the template format: date prefix + descriptive name (e.g., `20251114-module-system.md`) |
| 140 | +- ADRs provide historical context for why architectural decisions were made |
| 141 | +- When changing fundamental architecture, review existing ADRs and create new ones documenting the rationale |
| 142 | + |
| 143 | +## Quality Standards |
| 144 | + |
| 145 | +### Code Review Requirements |
| 146 | + |
| 147 | +- All changes MUST go through pull request review |
| 148 | +- Reviewers MUST verify: |
| 149 | + - Tests are included and passing |
| 150 | + - Code follows Groovy idioms and project conventions |
| 151 | + - License headers are present |
| 152 | + - DCO sign-off is present |
| 153 | + - Changes align with modular architecture principles |
| 154 | + - Breaking changes are appropriately versioned and documented |
| 155 | + |
| 156 | +### Testing Gates |
| 157 | + |
| 158 | +- `make test` MUST pass before committing locally |
| 159 | +- All CI tests MUST pass before merging |
| 160 | +- Integration tests MUST be run for changes affecting workflow execution |
| 161 | +- Cloud validation tests MUST be run before releases touching cloud provider plugins |
| 162 | +- Smoke tests enable rapid iteration but MUST NOT replace full test execution |
| 163 | + |
| 164 | +### Performance and Compatibility |
| 165 | + |
| 166 | +- Target platform: Java 17 runtime compatibility (development uses Java 21 toolchain) |
| 167 | +- Performance-critical paths SHOULD be profiled and optimized |
| 168 | +- Memory usage SHOULD be monitored for large-scale workflows |
| 169 | +- Backward compatibility MUST be maintained for existing DSL features unless a new DSL version is introduced |
42 | 170 |
|
43 | 171 | ## Governance |
44 | | -<!-- Example: Constitution supersedes all other practices; Amendments require documentation, approval, migration plan --> |
45 | 172 |
|
46 | | -[GOVERNANCE_RULES] |
47 | | -<!-- Example: All PRs/reviews must verify compliance; Complexity must be justified; Use [GUIDANCE_FILE] for runtime development guidance --> |
| 173 | +### Amendment Process |
| 174 | + |
| 175 | +This constitution supersedes all other development practices. Amendments require: |
| 176 | + |
| 177 | +1. **Proposal**: Submit amendment proposal via GitHub issue or pull request |
| 178 | +2. **Discussion**: Community discussion period (minimum 1 week for major changes) |
| 179 | +3. **Approval**: Approval from core maintainers |
| 180 | +4. **Documentation**: Update this constitution with version bump following semantic versioning: |
| 181 | + - **MAJOR**: Backward incompatible governance changes, principle removal/redefinition |
| 182 | + - **MINOR**: New principle added or materially expanded guidance |
| 183 | + - **PATCH**: Clarifications, wording improvements, typo fixes |
| 184 | + |
| 185 | +### Compliance and Review |
| 186 | + |
| 187 | +- All pull requests and code reviews MUST verify compliance with these principles |
| 188 | +- Deviations from principles MUST be explicitly justified in PR description |
| 189 | +- Complexity additions MUST be justified against the "simplicity first" principle |
| 190 | +- Constitution compliance is enforced through code review and CI automation where possible |
| 191 | + |
| 192 | +### Ratification and Version History |
| 193 | + |
| 194 | +**Version**: 1.0.0 | **Ratified**: 2025-11-17 | **Last Amended**: 2025-11-17 |
48 | 195 |
|
49 | | -**Version**: [CONSTITUTION_VERSION] | **Ratified**: [RATIFICATION_DATE] | **Last Amended**: [LAST_AMENDED_DATE] |
50 | | -<!-- Example: Version: 2.1.1 | Ratified: 2025-06-13 | Last Amended: 2025-07-16 --> |
| 196 | +This constitution was derived from the Nextflow project's documented practices in `CLAUDE.md`, `CONTRIBUTING.md`, and the project's existing architectural patterns. It codifies the development principles that have made Nextflow a successful scientific workflow management system. |
0 commit comments