Contributing
Canontra is an open-source systems research project licensed under Apache-2.0.
1. Prerequisites & Build Setup
Section titled “1. Prerequisites & Build Setup”- GHC:
9.6.6 - Stack (recommended,
LTS 22.28) or Cabal (>= 3.0) - Git
git clone https://github.com/symtrace/canontra.gitcd canontrastack build --faststack exec canontra -- --help2. Pedantic Test & Lint Verification
Section titled “2. Pedantic Test & Lint Verification”All pull requests must pass all 795 automated tests with zero warnings and zero failures, plus HLint checks:
stack test --pedantichlint --hint=.hlint.yaml src app bench testCanontra compiles with:
-Wall -Werror -Wcompat -Widentities -Wincomplete-record-updates-Wincomplete-uni-patterns -Wmissing-export-lists -Wpartial-fields-Wredundant-constraintsPull requests run three automated GitHub Actions gates:
.github/workflows/ci.yml: Strict-Wall --pedanticbuild and all795tests..github/workflows/lint.yml: DeterministicHLint+reviewdoginline PR review,shellcheck,actionlint, andcabal check..github/workflows/security.yml: Zero-trust architectural invariant gate, Gitleaks OSS secret scan, Google OSV-Scanner dependency audit, andzizmorworkflow security audit.
3. Core Architectural Constraints
Section titled “3. Core Architectural Constraints”- 100% Pure Haskell: Never introduce C-FFI bindings, C/C++ libraries, or dynamic runtime dependencies (
libtree-sitter). - Air-Gapped Zero-Trust: Never import networking, HTTP, socket, or telemetry packages.
- Cross-Platform Bit-Identity: Serialize all integers big-endian, normalize paths to forward slashes
/, and preserve OS-independent collation. - Memory Hygiene: Prefer
LinearASTarenas, ByteString-nativeflatparse/SIMDScanlexing, unboxedCSRGraphvectors, 4KBCNTR\x07SlabV7records, mutableMV.IOVectorChase-Lev deques, andSwissTableinterning over pointer-heavy GC trees. - Stateless AI Harness Hygiene (
Canontra.Harness.*, Alpha): Preserve zero background daemons, zero IPC/network sockets, zero.gitmutation, preflight SHA-256 + path-containment verification prior tosnap rewind, and auto-ignored.canontra/state.
4. Adding Parser or Normalization Features
Section titled “4. Adding Parser or Normalization Features”- Frontend / Pass Location: Parsers live in
src/Canontra/Parser/(Python.hs,FastPython.hs,JS.hs,Go.hs,Rust.hs); normalizers live insrc/Canontra/Normalize/. - Metamorphic Tests: Add both a soundness test (confirming
F1,F2,F_T,F4invariance under trivia/canonical transforms) and a sensitivity test (confirmingF1andF4divergence under semantic mutation) intest/Canontra/MetamorphicSpec.hs. - Installer Checks: If modifying installer scripts, validate syntax before submitting:
bash -n install.shpowershell -NoProfile -Command "Get-Command .\install.ps1 -Syntax"