Contribution Workflow¶
This document defines how changes are made across
se-formal-contract and se-constitution.
Principles¶
- Always work from the formal contract outward
- Never duplicate contract definitions
- Keep generated artifacts in sync
- Validate before committing
- Prefer small, complete changes
Standard workflow¶
1. Make changes in se-formal-contract (if needed)¶
Only if the change affects:
- invariants
- regimes
- relations
- proof status
cd se-formal-contract
lake build
lake exe export_contract
uv run python -m se_formal_contract validate
uv run pytest
2. Commit contract changes¶
3. Update submodule in se-constitution¶
cd se-constitution
git submodule update --remote upstream/se-formal-contract
git add upstream/se-formal-contract
git commit -m "Update formal contract submodule"
4. Update constitutional artifacts (if needed)¶
Examples:
- dependency rules
- class registry
- naming patterns
- manifest schema
- repo requirements
5. Run validation¶
6. Commit constitutional changes¶
When to skip steps¶
- If only documentation changes → skip formal contract + submodule
- If only constitution changes → skip formal contract
- If only tests change → run validation and commit
Required invariants¶
The following must always hold:
and:
Common tasks¶
Add a new invariant¶
- Define in Lean (
se-formal-contract) - Export JSON
- Commit
- Update submodule
- Reference in
dependency-rules.toml - Validate
Modify dependency rules¶
- Edit
data/dependency/dependency-rules.toml - Run validation
- Fix any invariant mismatches
- Commit
Fix validation failure¶
Always read the error message literally.
Typical causes:
- missing class definition
- missing naming pattern
- missing repo requirement
- invariant not declared upstream
Recovery steps¶
Submodule not initialized¶
Contract mismatch¶
Design constraint¶
The workflow is directional:
Never modify downstream layers to compensate for upstream errors.