lgtm-specs 0.0.4
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.
- package/.claude/settings.local.json +14 -0
- package/.gemini/README.md +8 -0
- package/.gemini/config.yaml +20 -0
- package/.gemini/styleguide.md +35 -0
- package/.github/workflows/README.md +5 -0
- package/.github/workflows/release.yml +52 -0
- package/.github/workflows/validate.yml +27 -0
- package/.prettierignore +4 -0
- package/.prettierrc +1 -0
- package/AGENTS.md +151 -0
- package/README.md +98 -0
- package/VERSION +1 -0
- package/agents/README.md +73 -0
- package/agents/modes/README.md +9 -0
- package/agents/modes/build.md +88 -0
- package/agents/modes/hack.md +76 -0
- package/agents/modes/review.md +79 -0
- package/agents/roles/builder.md +75 -0
- package/agents/roles/counsel.md +96 -0
- package/agents/roles/explorer.md +77 -0
- package/agents/roles/lead.md +76 -0
- package/agents/roles/librarian.md +63 -0
- package/agents/roles/planner.md +75 -0
- package/agents/roles/reviewer/BASE.md +9 -0
- package/agents/roles/reviewer/OUTPUT_FORMAT.md +4 -0
- package/agents/roles/reviewer/README.md +48 -0
- package/agents/roles/reviewer/lite.md +51 -0
- package/agents/roles/reviewer/logic.md +48 -0
- package/agents/roles/reviewer/performance.md +45 -0
- package/agents/roles/reviewer/plan.md +52 -0
- package/agents/roles/reviewer/quality.md +49 -0
- package/agents/roles/reviewer/security.md +47 -0
- package/agents/roles/reviewer/test.md +48 -0
- package/agents/templates/README.md +6 -0
- package/agents/templates/mode.md +33 -0
- package/agents/templates/role.md +73 -0
- package/contribute/README.md +24 -0
- package/contribute/add-agent.md +29 -0
- package/contribute/add-ci.md +31 -0
- package/contribute/add-constitution.md +17 -0
- package/contribute/add-law.md +20 -0
- package/contribute/add-policy.md +27 -0
- package/contribute/checklist.md +42 -0
- package/contribute/maintenance.md +19 -0
- package/contribute/update-models.md +47 -0
- package/docs/README.md +13 -0
- package/docs/adr/0001-knowledge-engineering-workflow.md +22 -0
- package/docs/adr/0002-rule-hierarchy.md +25 -0
- package/docs/adr/0003-atomic-knowledge-graph.md +21 -0
- package/docs/adr/0004-identification-schema.md +22 -0
- package/docs/adr/0005-agent-specialization.md +39 -0
- package/docs/adr/0006-git-workflow-integrity.md +34 -0
- package/docs/adr/0007-operating-modes-and-gates.md +54 -0
- package/docs/adr/0008-rules-vs-workflows-boundary.md +64 -0
- package/docs/adr/README.md +14 -0
- package/docs/agent_architecture.md +164 -0
- package/docs/context_lifecycle.md +228 -0
- package/docs/engineering_principles.md +128 -0
- package/docs/local_policies.md +59 -0
- package/docs/meta/collaborative_dynamics.md +142 -0
- package/docs/meta/domains/README.md +8 -0
- package/docs/meta/domains/bitcoin/01-units.md +21 -0
- package/docs/meta/domains/bitcoin/02-broadcast-cancellation.md +20 -0
- package/docs/meta/domains/bitcoin/03-fee-rates-rounding.md +21 -0
- package/docs/meta/domains/bitcoin/04-confirmations-reorgs.md +20 -0
- package/docs/meta/domains/bitcoin/05-address-gap-limit.md +16 -0
- package/docs/meta/domains/bitcoin/06-relay-policy.md +27 -0
- package/docs/meta/domains/bitcoin/README.md +12 -0
- package/docs/meta/domains/git/01-workflow.md +89 -0
- package/docs/meta/domains/git/02-commits.md +57 -0
- package/docs/meta/domains/git/03-collaboration.md +40 -0
- package/docs/meta/domains/git/04-integrity.md +26 -0
- package/docs/meta/domains/git/05-configuration.md +209 -0
- package/docs/meta/domains/git/06-advanced.md +130 -0
- package/docs/meta/domains/git/README.md +29 -0
- package/docs/meta/industry_best_practices.md +555 -0
- package/docs/meta/languages/README.md +8 -0
- package/docs/meta/languages/go/01-concurrency.md +37 -0
- package/docs/meta/languages/go/02-api-design.md +30 -0
- package/docs/meta/languages/go/03-resilience.md +27 -0
- package/docs/meta/languages/go/04-errors.md +27 -0
- package/docs/meta/languages/go/05-performance.md +18 -0
- package/docs/meta/languages/go/06-safety.md +18 -0
- package/docs/meta/languages/go/07-testing.md +44 -0
- package/docs/meta/languages/go/08-config-layout.md +23 -0
- package/docs/meta/languages/go/README.md +14 -0
- package/docs/meta/languages/typescript/01-strictness.md +19 -0
- package/docs/meta/languages/typescript/02-immutability.md +15 -0
- package/docs/meta/languages/typescript/03-async.md +18 -0
- package/docs/meta/languages/typescript/04-design.md +19 -0
- package/docs/meta/languages/typescript/05-control-flow.md +11 -0
- package/docs/meta/languages/typescript/README.md +11 -0
- package/docs/meta/workflow.md +68 -0
- package/docs/philosophy.md +36 -0
- package/integrate/README.md +459 -0
- package/integrate/versioning.md +41 -0
- package/models/README.md +68 -0
- package/models/registry.yaml +55 -0
- package/package.json +11 -0
- package/rules/README.md +57 -0
- package/rules/RULE-00000-EXAMPLE.md +29 -0
- package/rules/constitution/CONS-00001-srp.md +40 -0
- package/rules/constitution/CONS-00002-ocp.md +43 -0
- package/rules/constitution/CONS-00003-lsp.md +44 -0
- package/rules/constitution/CONS-00004-isp.md +46 -0
- package/rules/constitution/CONS-00005-dip.md +37 -0
- package/rules/constitution/CONS-00006-dry.md +45 -0
- package/rules/constitution/CONS-00007-demeter.md +35 -0
- package/rules/constitution/CONS-00008-composition.md +44 -0
- package/rules/constitution/CONS-00009-deep-modules.md +39 -0
- package/rules/constitution/CONS-00010-kiss.md +47 -0
- package/rules/constitution/CONS-00011-yagni.md +49 -0
- package/rules/constitution/CONS-00012-cognitive-limits.md +28 -0
- package/rules/constitution/CONS-00013-boy-scout.md +27 -0
- package/rules/constitution/CONS-00014-broken-windows.md +35 -0
- package/rules/constitution/CONS-00015-safety.md +46 -0
- package/rules/constitution/CONS-00016-cqs.md +39 -0
- package/rules/constitution/CONS-00017-postel.md +35 -0
- package/rules/constitution/CONS-00018-cap.md +35 -0
- package/rules/constitution/CONS-00019-fallacies.md +37 -0
- package/rules/constitution/CONS-00020-shift-left.md +28 -0
- package/rules/constitution/CONS-00021-congruence.md +28 -0
- package/rules/constitution/CONS-00022-orthogonality.md +40 -0
- package/rules/constitution/CONS-00023-determinism.md +38 -0
- package/rules/constitution/CONS-00024-security.md +42 -0
- package/rules/constitution/CONS-00025-efficiency.md +38 -0
- package/rules/constitution/CONS-00026-resilience.md +41 -0
- package/rules/constitution/CONS-00027-transparency.md +40 -0
- package/rules/constitution/CONS-00028-evolvability.md +36 -0
- package/rules/constitution/CONS-00029-operability.md +36 -0
- package/rules/constitution/CONS-00030-rework-cycle.md +27 -0
- package/rules/constitution/CONS-00031-checklist.md +28 -0
- package/rules/constitution/CONS-00032-documentation.md +39 -0
- package/rules/constitution/README.md +52 -0
- package/rules/laws/README.md +15 -0
- package/rules/laws/bitcoin/BTC-00001-amounts-as-satoshis.md +39 -0
- package/rules/laws/bitcoin/BTC-00002-broadcast-not-cancelable.md +36 -0
- package/rules/laws/bitcoin/BTC-00003-fee-rate-math-rounding.md +37 -0
- package/rules/laws/bitcoin/BTC-00004-confirmations-and-reorgs.md +40 -0
- package/rules/laws/bitcoin/BTC-00005-address-gap-limit.md +37 -0
- package/rules/laws/bitcoin/BTC-00006-relay-is-policy-dependent.md +36 -0
- package/rules/laws/bitcoin/BTC-00007-dust-policy.md +36 -0
- package/rules/laws/bitcoin/BTC-00008-min-relay-fee.md +36 -0
- package/rules/laws/bitcoin/BTC-00009-feefilter.md +36 -0
- package/rules/laws/bitcoin/README.md +29 -0
- package/rules/laws/default.md +30 -0
- package/rules/laws/git/GIT-00001-atomic-commit.md +29 -0
- package/rules/laws/git/GIT-00002-imperative-subject.md +27 -0
- package/rules/laws/git/GIT-00003-formatting-50-72.md +28 -0
- package/rules/laws/git/GIT-00004-trunk-based.md +28 -0
- package/rules/laws/git/GIT-00005-public-immutability.md +26 -0
- package/rules/laws/git/GIT-00006-signing.md +27 -0
- package/rules/laws/git/GIT-00007-reviewer-capital.md +26 -0
- package/rules/laws/git/GIT-00008-patch-series.md +28 -0
- package/rules/laws/git/GIT-00009-branch-naming.md +28 -0
- package/rules/laws/git/GIT-00010-pr-hygiene.md +51 -0
- package/rules/laws/git/GIT-00011-merge-method.md +35 -0
- package/rules/laws/git/GIT-00012-conflict-resolution.md +35 -0
- package/rules/laws/git/GIT-00013-ignore-standards.md +38 -0
- package/rules/laws/git/GIT-00014-lfs-large-binaries.md +37 -0
- package/rules/laws/git/GIT-00015-git-hooks.md +35 -0
- package/rules/laws/git/GIT-00016-branch-protection.md +34 -0
- package/rules/laws/git/GIT-00017-secrets-management.md +34 -0
- package/rules/laws/git/GIT-00018-ci-enforcement.md +33 -0
- package/rules/laws/git/GIT-00019-review-checklist.md +39 -0
- package/rules/laws/git/GIT-00020-issue-references.md +34 -0
- package/rules/laws/git/GIT-00021-partial-staging.md +38 -0
- package/rules/laws/git/GIT-00022-feature-flags.md +33 -0
- package/rules/laws/git/GIT-00023-breaking-changes.md +41 -0
- package/rules/laws/git/GIT-00024-dependency-management.md +44 -0
- package/rules/laws/git/GIT-00025-large-repository-optimization.md +54 -0
- package/rules/laws/git/README.md +31 -0
- package/rules/laws/go/GO-00001-actor-model.md +51 -0
- package/rules/laws/go/GO-00002-api-design.md +37 -0
- package/rules/laws/go/GO-00003-error-handling.md +43 -0
- package/rules/laws/go/GO-00004-context.md +45 -0
- package/rules/laws/go/GO-00005-performance.md +40 -0
- package/rules/laws/go/GO-00006-packages.md +29 -0
- package/rules/laws/go/GO-00007-circuit-breakers.md +43 -0
- package/rules/laws/go/GO-00008-safety.md +39 -0
- package/rules/laws/go/GO-00009-table-driven-test.md +48 -0
- package/rules/laws/go/GO-00010-escape-analysis.md +37 -0
- package/rules/laws/go/GO-00011-retry.md +45 -0
- package/rules/laws/go/GO-00012-rate-limiting.md +42 -0
- package/rules/laws/go/GO-00013-io-buffering.md +43 -0
- package/rules/laws/go/GO-00014-memory-layout.md +41 -0
- package/rules/laws/go/GO-00015-aaa-pattern.md +49 -0
- package/rules/laws/go/GO-00016-test-libraries.md +35 -0
- package/rules/laws/go/GO-00017-comments.md +37 -0
- package/rules/laws/go/GO-00018-test-isolation.md +38 -0
- package/rules/laws/go/GO-00019-test-comments.md +36 -0
- package/rules/laws/go/GO-00020-mocking.md +36 -0
- package/rules/laws/go/GO-00021-configuration.md +36 -0
- package/rules/laws/go/GO-00022-observability.md +34 -0
- package/rules/laws/go/GO-00023-dependency-management.md +28 -0
- package/rules/laws/go/GO-00024-project-layout.md +30 -0
- package/rules/laws/go/GO-00025-concurrency-patterns.md +39 -0
- package/rules/laws/go/README.md +45 -0
- package/rules/laws/typescript/README.md +14 -0
- package/rules/laws/typescript/TS-00001-no-any.md +39 -0
- package/rules/laws/typescript/TS-00002-immutability.md +36 -0
- package/rules/laws/typescript/TS-00003-async.md +35 -0
- package/rules/laws/typescript/TS-00004-strict-null.md +38 -0
- package/rules/laws/typescript/TS-00005-unions.md +35 -0
- package/rules/laws/typescript/TS-00006-interface.md +38 -0
- package/rules/laws/typescript/TS-00007-generics.md +38 -0
- package/rules/laws/typescript/TS-00008-modules.md +28 -0
- package/rules/policies/README.md +12 -0
- package/rules/policies/default.md +28 -0
- package/scripts/README.md +45 -0
- package/scripts/generate_release_notes.py +376 -0
- package/scripts/validate_specs.py +730 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# The Constitution (Universal Rules)
|
|
2
|
+
|
|
3
|
+
These are the immutable engineering truths that apply to all software projects. In the LGTM legal framework, each rule file represents an **Article** of the Constitution.
|
|
4
|
+
|
|
5
|
+
## Index
|
|
6
|
+
|
|
7
|
+
### Structural Integrity
|
|
8
|
+
|
|
9
|
+
- [CONS-00001: Single Responsibility Principle](CONS-00001-srp.md): A module should have one, and only one, reason to change.
|
|
10
|
+
- [CONS-00002: Open/Closed Principle](CONS-00002-ocp.md): Open for extension, closed for modification.
|
|
11
|
+
- [CONS-00003: Liskov Substitution Principle](CONS-00003-lsp.md): Subtypes must be substitutable for their base types.
|
|
12
|
+
- [CONS-00004: Interface Segregation Principle](CONS-00004-isp.md): Clients should not depend on interfaces they do not use.
|
|
13
|
+
- [CONS-00005: Dependency Inversion Principle](CONS-00005-dip.md): Depend on abstractions, not concretions.
|
|
14
|
+
- [CONS-00006: DRY](CONS-00006-dry.md): Single Source of Truth; avoid drift.
|
|
15
|
+
- [CONS-00007: Law of Demeter](CONS-00007-demeter.md): Talk to friends, not strangers (one dot rule).
|
|
16
|
+
- [CONS-00008: Composition Over Inheritance](CONS-00008-composition.md): Flatten hierarchies; delegate behavior.
|
|
17
|
+
- [CONS-00022: Orthogonality](CONS-00022-orthogonality.md): Decouple components so changes don't propagate side effects.
|
|
18
|
+
|
|
19
|
+
### Cognitive Ergonomics
|
|
20
|
+
|
|
21
|
+
- [CONS-00009: Deep Modules](CONS-00009-deep-modules.md): Simple interface, complex implementation.
|
|
22
|
+
- [CONS-00010: KISS](CONS-00010-kiss.md): Complexity is a cost; avoid speculative generality.
|
|
23
|
+
- [CONS-00011: YAGNI](CONS-00011-yagni.md): Do not implement features until necessary.
|
|
24
|
+
- [CONS-00012: Cognitive Limits](CONS-00012-cognitive-limits.md): Atomic commits; PRs under 400 lines.
|
|
25
|
+
- [CONS-00013: Boy Scout Rule](CONS-00013-boy-scout.md): Leave code cleaner than you found it.
|
|
26
|
+
- [CONS-00014: Broken Windows Theory](CONS-00014-broken-windows.md): Fix bad designs immediately to prevent normalization of deviance.
|
|
27
|
+
- [CONS-00031: The Checklist](CONS-00031-checklist.md): Automate rote verification; offload cognitive load to machines.
|
|
28
|
+
- [CONS-00032: Documentation](CONS-00032-documentation.md): Explain the "Why", not the "How".
|
|
29
|
+
|
|
30
|
+
### Behavioral Correctness
|
|
31
|
+
|
|
32
|
+
- [CONS-00015: Safety by Design](CONS-00015-safety.md): Make illegal states unrepresentable (Enums/Unions).
|
|
33
|
+
- [CONS-00016: Command-Query Separation](CONS-00016-cqs.md): Methods should do work OR return data, not both.
|
|
34
|
+
- [CONS-00023: Determinism](CONS-00023-determinism.md): Same input, same output; explicit dependencies.
|
|
35
|
+
- [CONS-00024: Security](CONS-00024-security.md): Least privilege, secure defaults, input validation.
|
|
36
|
+
|
|
37
|
+
### Runtime Survivability
|
|
38
|
+
|
|
39
|
+
- [CONS-00017: Postel's Law](CONS-00017-postel.md): Conservative output, liberal input (robustness).
|
|
40
|
+
- [CONS-00018: CAP & PACELC](CONS-00018-cap.md): Choose Consistency or Availability explicitly in distributed systems.
|
|
41
|
+
- [CONS-00019: Fallacies of Distributed Computing](CONS-00019-fallacies.md): Handle timeouts, retries, and network partitions.
|
|
42
|
+
- [CONS-00025: Efficiency](CONS-00025-efficiency.md): Aware of Big-O; bound resource usage.
|
|
43
|
+
- [CONS-00026: Resilience](CONS-00026-resilience.md): Circuit breakers, idempotency, and graceful degradation.
|
|
44
|
+
|
|
45
|
+
### Operational Lifecycle
|
|
46
|
+
|
|
47
|
+
- [CONS-00020: Shift Left](CONS-00020-shift-left.md): Verify early (Design/CI) to reduce rework cost.
|
|
48
|
+
- [CONS-00021: Socio-Technical Congruence](CONS-00021-congruence.md): Align code boundaries with team ownership.
|
|
49
|
+
- [CONS-00027: Transparency](CONS-00027-transparency.md): Telemetry, structured logging, and observability.
|
|
50
|
+
- [CONS-00028: Evolvability](CONS-00028-evolvability.md): Testability, Feature Flags, and Versioning.
|
|
51
|
+
- [CONS-00029: Operability](CONS-00029-operability.md): Runbooks, automation, and ease of maintenance.
|
|
52
|
+
- [CONS-00030: Rework Cycle](CONS-00030-rework-cycle.md): Pay down debt to prevent the death spiral.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# The Laws (Domain Contexts)
|
|
2
|
+
|
|
3
|
+
This directory contains the strict engineering standards for specific technologies.
|
|
4
|
+
|
|
5
|
+
## File Structure
|
|
6
|
+
|
|
7
|
+
Each file acts as a standalone "Knowledge Module".
|
|
8
|
+
|
|
9
|
+
## Index of Domains
|
|
10
|
+
|
|
11
|
+
- **[Go](go/README.md)**: Rules for the Go language.
|
|
12
|
+
- **[TypeScript](typescript/README.md)**: Rules for TypeScript/JavaScript.
|
|
13
|
+
- **[Git](git/README.md)**: Rules for Git version control.
|
|
14
|
+
- **[Bitcoin](bitcoin/README.md)**: Rules for Bitcoin financial engineering.
|
|
15
|
+
- **[Default](default.md)**: Fallback rules for unknown languages.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Amounts as Satoshis (BTC-00001)
|
|
2
|
+
|
|
3
|
+
**Source**: [Bitcoin: Units & Amounts](../../../docs/meta/domains/bitcoin/01-units.md#amount-representation)
|
|
4
|
+
**Tags**: #behavioral #bitcoin #finance #safety
|
|
5
|
+
**Related**: [Determinism](../../constitution/CONS-00023-determinism.md), [Safety](../../constitution/CONS-00015-safety.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Represent monetary values as integer satoshis; convert to display units only at boundaries.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Integers Only**: Represent amounts as integer satoshis.
|
|
14
|
+
2. **No Floats**: Do not use floating point types for any monetary computation.
|
|
15
|
+
3. **Explicit Units**: Encode units in names and types (e.g., `amount_sats`, `fee_rate_sat_vb`).
|
|
16
|
+
4. **Boundary Conversion**: Parse/format BTC strings only at UI/API boundaries; store and compute in sats.
|
|
17
|
+
|
|
18
|
+
## Anti-Patterns
|
|
19
|
+
|
|
20
|
+
- **Float Money**: `float64` BTC math or rounding by formatting.
|
|
21
|
+
- **Unit Ambiguity**: `amount` with no unit, or mixing sats and BTC in one codepath.
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
**Bad:**
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
btc = float(input_btc)
|
|
29
|
+
fee_btc = btc * 0.001
|
|
30
|
+
send_btc = btc - fee_btc
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Good:**
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
amount_sats = int(input_sats)
|
|
37
|
+
fee_sats = estimate_fee_sats(amount_sats)
|
|
38
|
+
send_sats = amount_sats - fee_sats
|
|
39
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Broadcast Is Not Cancelable (BTC-00002)
|
|
2
|
+
|
|
3
|
+
**Source**: [Bitcoin: Broadcast, Cancellation, and Replacement](../../../docs/meta/domains/bitcoin/02-broadcast-cancellation.md#broadcast-is-not-retractable)
|
|
4
|
+
**Tags**: #operational #bitcoin #finance #safety
|
|
5
|
+
**Related**: [Resilience](../../constitution/CONS-00026-resilience.md), [Transparency](../../constitution/CONS-00027-transparency.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
A broadcast transaction cannot be safely canceled; the only practical "cancellation" is a conflicting spend, and it is not final until confirmed.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **No Cancel Assumption**: Do not design flows that assume a broadcast can be withdrawn.
|
|
14
|
+
2. **Conflict Model**: If you support cancellation, implement it as a conflicting spend of at least one input (replacement), not deletion.
|
|
15
|
+
3. **Finality Gate**: Treat cancellation as incomplete until one of the conflicting transactions confirms.
|
|
16
|
+
4. **User Messaging**: Surface the state as "pending" until confirmation; do not claim success early.
|
|
17
|
+
|
|
18
|
+
## Anti-Patterns
|
|
19
|
+
|
|
20
|
+
- **Local Delete**: Marking a tx "canceled" because it is not in _your_ mempool.
|
|
21
|
+
- **Instant Cancel**: Treating a replacement attempt as guaranteed.
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
**Bad:**
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
"Cancel" = remove tx from local DB; assume it will never confirm
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Good:**
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
"Cancel" = create and broadcast a conflicting spend (replacement)
|
|
35
|
+
state remains PENDING until one tx confirms
|
|
36
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Fee Rate Math & Rounding (BTC-00003)
|
|
2
|
+
|
|
3
|
+
**Source**: [Bitcoin: Fee Rates, Rational Math, and Rounding](../../../docs/meta/domains/bitcoin/03-fee-rates-rounding.md#rational-fee-rates)
|
|
4
|
+
**Tags**: #behavioral #bitcoin #finance #determinism
|
|
5
|
+
**Related**: [Determinism](../../constitution/CONS-00023-determinism.md), [Safety](../../constitution/CONS-00015-safety.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Fee rate calculations must be unit-explicit and exact until the final conversion to integer satoshis.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Rational Math**: Use arbitrary-precision rational math for fee rates and intermediate results.
|
|
14
|
+
2. **Explicit Units**: Make feerate units explicit (prefer sat/vB) and convert explicitly.
|
|
15
|
+
3. **Rounding Policy**: Define and test rounding; for fee payment constraints, prefer rounding up.
|
|
16
|
+
4. **No Silent Conversions**: Do not accept a bare number as a feerate without a unit.
|
|
17
|
+
|
|
18
|
+
## Anti-Patterns
|
|
19
|
+
|
|
20
|
+
- **Float Fee Rate**: `float64` feerate calculations.
|
|
21
|
+
- **Magic Feerate**: `fee_rate = 25` without unit.
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
**Bad:**
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
fee_rate = 1.5
|
|
29
|
+
fee_sats = int(fee_rate * vbytes) # implicit unit + truncation
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Good:**
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
fee_rate_sat_vb = Rat("1.5")
|
|
36
|
+
fee_sats = ceil(fee_rate_sat_vb * vbytes)
|
|
37
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Confirmations & Reorg Safety (BTC-00004)
|
|
2
|
+
|
|
3
|
+
**Source**: [Bitcoin: Confirmations & Reorgs](../../../docs/meta/domains/bitcoin/04-confirmations-reorgs.md#reorg-handling)
|
|
4
|
+
**Tags**: #operational #bitcoin #finance #resilience
|
|
5
|
+
**Related**: [Resilience](../../constitution/CONS-00026-resilience.md), [Safety](../../constitution/CONS-00015-safety.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Confirmation state must be explicit and reorg-safe; derived state must be reversible.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Explicit Policy**: Define confirmation thresholds per flow (deposit credit, withdrawal completion).
|
|
14
|
+
2. **Track Hash+Height**: Record both block height and block hash for each processed block.
|
|
15
|
+
3. **Rollback**: On reorg detection, rollback derived state to the common ancestor and re-derive.
|
|
16
|
+
4. **No Finality Claims**: Do not treat 0-conf as final for high-risk flows.
|
|
17
|
+
5. **Practical Depth**: Design for 1-2 block reorgs as a practical concern; deeper reorgs are possible.
|
|
18
|
+
|
|
19
|
+
## Anti-Patterns
|
|
20
|
+
|
|
21
|
+
- **Height-Only Tracking**: Storing only height and assuming the chain never reorganizes.
|
|
22
|
+
- **Irreversible Derivation**: Mutating balances with no ability to revert on reorg.
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
**Bad:**
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
processed_height = 840000
|
|
30
|
+
balances += deposits_in_height(840000)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Good:**
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
processed_tip = { height: 840000, hash: H }
|
|
37
|
+
if chain_tip.hash != processed_tip.hash_at_height:
|
|
38
|
+
rollback_to_common_ancestor()
|
|
39
|
+
reprocess_forward()
|
|
40
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Address Gap Limit Safety (BTC-00005)
|
|
2
|
+
|
|
3
|
+
**Source**: [Bitcoin: Address Gap Limit and Recovery Risk](../../../docs/meta/domains/bitcoin/05-address-gap-limit.md#the-gap-limit-problem)
|
|
4
|
+
**Tags**: #operational #bitcoin #finance #resilience
|
|
5
|
+
**Related**: [Resilience](../../constitution/CONS-00026-resilience.md), [Safety](../../constitution/CONS-00015-safety.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Do not generate large sequences of unused receive addresses without controlling the address gap limit; it can cause recovery to miss funds.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Gap Awareness**: Track issued-vs-used indices and the effective gap on each receive branch.
|
|
14
|
+
2. **Bounded Issuance**: Do not exceed the operational gap limit without an explicit policy.
|
|
15
|
+
3. **Recovery Proof**: Have a documented recovery procedure that will rediscover funds after typical address issuance patterns.
|
|
16
|
+
4. **Alerting**: Emit warnings when approaching the configured gap limit.
|
|
17
|
+
|
|
18
|
+
## Anti-Patterns
|
|
19
|
+
|
|
20
|
+
- **Always New, Unbounded**: Issuing a new address for every request with no gap monitoring.
|
|
21
|
+
- **Assumed Recovery**: Assuming seed restore will find all funds regardless of issuance.
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
**Bad:**
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
service generates 100+ unused deposit addresses
|
|
29
|
+
seed restore scans only default lookahead and stops early
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Good:**
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
service enforces a gap limit policy and tracks issued-vs-used indices
|
|
36
|
+
recovery procedure includes configured lookahead/rescan bounds
|
|
37
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Relay Is Policy-Dependent (BTC-00006)
|
|
2
|
+
|
|
3
|
+
**Source**: [Bitcoin: Relay Policy Gates](../../../docs/meta/domains/bitcoin/06-relay-policy.md#relay-is-policy-dependent)
|
|
4
|
+
**Tags**: #operational #bitcoin #finance #resilience
|
|
5
|
+
**Related**: [Resilience](../../constitution/CONS-00026-resilience.md), [Safety](../../constitution/CONS-00015-safety.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Transaction propagation is not guaranteed by consensus; it depends on local node policy and peer relay filters.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **No Relay Assumption**: Do not treat "valid" as equivalent to "propagated".
|
|
14
|
+
2. **Policy Explicitness**: Make relay/mempool policy inputs explicit (dust, minimum feerate, peer filters).
|
|
15
|
+
3. **Observable Failure**: Treat relay failure as a normal outcome; capture enough context (feerate, size, policy inputs) to debug.
|
|
16
|
+
|
|
17
|
+
## Anti-Patterns
|
|
18
|
+
|
|
19
|
+
- **Consensus Confusion**: Assuming "valid" implies "will propagate".
|
|
20
|
+
- **Opaque Policy**: Fee/relay logic with no visibility into which policy gate rejected it.
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
**Bad:**
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
tx is valid => it will broadcast
|
|
28
|
+
ignore policy gates and peer filtering
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Good:**
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
construct tx with explicit relay policy checks
|
|
35
|
+
expect broadcast/relay to be policy-dependent, not guaranteed
|
|
36
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Dust Policy (BTC-00007)
|
|
2
|
+
|
|
3
|
+
**Source**: [Bitcoin: Relay Policy Gates](../../../docs/meta/domains/bitcoin/06-relay-policy.md#gate-1-dust)
|
|
4
|
+
**Tags**: #operational #bitcoin #finance #resilience
|
|
5
|
+
**Related**: [Relay Is Policy-Dependent](BTC-00006-relay-is-policy-dependent.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Transactions that create dust outputs may be non-standard and not relayed by default.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Dust Guard**: Do not create outputs that fall below the dust threshold for the prevailing relay policy.
|
|
14
|
+
2. **Change Discipline**: If change would be dust, either add it to fee or restructure inputs/outputs.
|
|
15
|
+
3. **Explicit Policy**: Treat dust limits as policy inputs; do not hard-code assumptions without documenting units and sources.
|
|
16
|
+
|
|
17
|
+
## Anti-Patterns
|
|
18
|
+
|
|
19
|
+
- **Dust Change**: Creating dust change outputs and expecting propagation.
|
|
20
|
+
- **Silent Fee Absorb**: Dropping dust value without tracking it as fee.
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
**Bad:**
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
create change output regardless of size
|
|
28
|
+
"broadcast failed" with no dust accounting
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Good:**
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
if change < dust_threshold: add change to fee
|
|
35
|
+
else: create change output
|
|
36
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Minimum Relay Fee (BTC-00008)
|
|
2
|
+
|
|
3
|
+
**Source**: [Bitcoin: Relay Policy Gates](../../../docs/meta/domains/bitcoin/06-relay-policy.md#gate-2-node-minimum-fee)
|
|
4
|
+
**Tags**: #operational #bitcoin #finance #resilience
|
|
5
|
+
**Related**: [Relay Is Policy-Dependent](BTC-00006-relay-is-policy-dependent.md), [Fee Rate Math & Rounding](BTC-00003-fee-rate-math-rounding.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Nodes enforce a minimum feerate for relay/mempool admission; transactions below it may not propagate.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Feerate Computation**: Compute and track feerate with explicit units.
|
|
14
|
+
2. **Policy-Aware Sending**: Compare feerate against the broadcasting node's current minimum policy.
|
|
15
|
+
3. **Adaptive Behavior**: Treat minimum fee as dynamic under mempool pressure; do not assume a constant.
|
|
16
|
+
|
|
17
|
+
## Anti-Patterns
|
|
18
|
+
|
|
19
|
+
- **Static Fee Assumption**: Hard-coding a minimum feerate and assuming it always relays.
|
|
20
|
+
- **Unit Drift**: Mixing sat/vB with sat/kvB without explicit conversion.
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
**Bad:**
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
fee_rate_sat_vb = 1
|
|
28
|
+
assume every node relays 1 sat/vB
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Good:**
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
fee_rate_sat_vb computed and logged
|
|
35
|
+
if below node minimum: bump fee or mark as likely-nonrelayed
|
|
36
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Peer feefilter (BTC-00009)
|
|
2
|
+
|
|
3
|
+
**Source**: [BIP-0133 (feefilter message)](https://raw.githubusercontent.com/bitcoin/bips/master/bip-0133.mediawiki#specification)
|
|
4
|
+
**Tags**: #operational #bitcoin #finance #resilience
|
|
5
|
+
**Related**: [Relay Is Policy-Dependent](BTC-00006-relay-is-policy-dependent.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Peers may advertise a `feefilter` threshold; they may not announce or relay transactions below that feerate.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Expectation Setting**: If a peer sets a `feefilter`, do not expect that peer to propagate too-low feerate transactions.
|
|
14
|
+
2. **Unit Clarity**: Treat the filter as a feerate in satoshis per kilobyte.
|
|
15
|
+
3. **Propagation Strategy**: Broadcast to multiple peers and observe relays; do not depend on a single peer.
|
|
16
|
+
|
|
17
|
+
## Anti-Patterns
|
|
18
|
+
|
|
19
|
+
- **Single Peer Reliance**: Treating one peer's lack of relay as proof the tx is "not broadcast".
|
|
20
|
+
- **Unit Confusion**: Treating feefilter as sat/vB without conversion.
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
**Bad:**
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
connected peer sets feefilter=5000 sat/kvB
|
|
28
|
+
send 1 sat/vB tx and expect inv relay
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Good:**
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
if peers set feefilter above tx feerate: expect reduced relay
|
|
35
|
+
broadcast to multiple peers and verify propagation via relays
|
|
36
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# The Law of Bitcoin
|
|
2
|
+
|
|
3
|
+
These rules define the engineering standards for Bitcoin-related development within the LGTM organization.
|
|
4
|
+
|
|
5
|
+
## Index
|
|
6
|
+
|
|
7
|
+
### Money & Units
|
|
8
|
+
|
|
9
|
+
- [BTC-00001: Amounts as Satoshis](BTC-00001-amounts-as-satoshis.md): Integers only; explicit units at boundaries.
|
|
10
|
+
|
|
11
|
+
### Mempool & Replacement
|
|
12
|
+
|
|
13
|
+
- [BTC-00002: Broadcast Is Not Cancelable](BTC-00002-broadcast-not-cancelable.md): Treat broadcast as irrevocable; replacements are conflicting spends.
|
|
14
|
+
|
|
15
|
+
### Fees
|
|
16
|
+
|
|
17
|
+
- [BTC-00003: Fee Rate Math & Rounding](BTC-00003-fee-rate-math-rounding.md): Rational feerates; explicit ceiling/floor policy.
|
|
18
|
+
|
|
19
|
+
### Confirmations & Recovery
|
|
20
|
+
|
|
21
|
+
- [BTC-00004: Confirmations & Reorg Safety](BTC-00004-confirmations-and-reorgs.md): Explicit confirmation policy; reorg-safe state.
|
|
22
|
+
- [BTC-00005: Address Gap Limit Safety](BTC-00005-address-gap-limit.md): Avoid losing funds due to lookahead limits.
|
|
23
|
+
|
|
24
|
+
### Relay Policy
|
|
25
|
+
|
|
26
|
+
- [BTC-00006: Relay Is Policy-Dependent](BTC-00006-relay-is-policy-dependent.md): Validity does not imply propagation.
|
|
27
|
+
- [BTC-00007: Dust Policy](BTC-00007-dust-policy.md): Dust outputs may be non-standard and not relayed.
|
|
28
|
+
- [BTC-00008: Minimum Relay Fee](BTC-00008-min-relay-fee.md): Feerate must meet node policy; minimums can be dynamic.
|
|
29
|
+
- [BTC-00009: Peer feefilter](BTC-00009-feefilter.md): Peers may filter low-fee tx announcements.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# The Law of Common Sense (Default)
|
|
2
|
+
|
|
3
|
+
**Source**: [Industry Best Practices](../../docs/meta/industry_best_practices.md#3-universal-fundamentals)
|
|
4
|
+
**Tags**: #operational #universal #defaults
|
|
5
|
+
**Related**: [Default Policy](../policies/default.md), [KISS](../constitution/CONS-00010-kiss.md)
|
|
6
|
+
**Context**: Used when no specific language law exists.
|
|
7
|
+
|
|
8
|
+
## Definition
|
|
9
|
+
|
|
10
|
+
When no specific law applies, follow the collective wisdom of the software engineering industry.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
1. **Linting**: Follow the standard linter for the language (e.g., `flake8` for Python, `clippy` for Rust).
|
|
15
|
+
2. **Formatting**: Use the standard formatter (e.g., `black`, `rustfmt`, `prettier`).
|
|
16
|
+
3. **Naming**: Follow the language's naming convention (snake_case for Python, camelCase for JS/Go).
|
|
17
|
+
4. **Testing**: Write unit tests for all logic. Use the standard test runner.
|
|
18
|
+
|
|
19
|
+
## Anti-Patterns
|
|
20
|
+
|
|
21
|
+
- **Bikeshedding**: Arguing about style instead of using the formatter.
|
|
22
|
+
- **No Tests**: "I'll add tests later."
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
**Bad:**
|
|
27
|
+
Manually aligning equals signs.
|
|
28
|
+
|
|
29
|
+
**Good:**
|
|
30
|
+
Running `format` on save.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# The Atomic Commit (GIT-00001)
|
|
2
|
+
|
|
3
|
+
**Source**: [02. The Commit](../../../docs/meta/domains/git/02-commits.md#1-atomicity-the-golden-rule)
|
|
4
|
+
**Tags**: #behavioral #git #git-commit #atomicity #process
|
|
5
|
+
**Related**: [Cognitive Limits](../../constitution/CONS-00012-cognitive-limits.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
A commit must represent a single, indivisible logical change.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Cognitive Focus**: The change must be understandable in a single mental pass.
|
|
14
|
+
2. **Revertability**: Reverting the commit must remove the feature/fix cleanly without breaking the build.
|
|
15
|
+
3. **Independence**: The commit must build and pass tests in isolation (supporting `git bisect`).
|
|
16
|
+
|
|
17
|
+
## Anti-Patterns
|
|
18
|
+
|
|
19
|
+
- "Big Ball of Mud": Mixing refactoring, formatting, and logic changes.
|
|
20
|
+
- "WIP": Committing broken code.
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
**Bad:**
|
|
25
|
+
`feat: add login and refactor user model` (Two concerns).
|
|
26
|
+
|
|
27
|
+
**Good:**
|
|
28
|
+
`refactor(user): decouple auth logic` (Commit 1)
|
|
29
|
+
`feat(pkg): implement login handler` (Commit 2)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# The Imperative Subject (GIT-00002)
|
|
2
|
+
|
|
3
|
+
**Source**: [02. The Commit](../../../docs/meta/domains/git/02-commits.md#3-conventional-commits-v100)
|
|
4
|
+
**Tags**: #behavioral #git #git-commit #formatting #communication
|
|
5
|
+
**Related**: [The Checklist](../../constitution/CONS-00031-checklist.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Commit subjects must use the imperative mood to match Git's internal language.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Mood**: Use "Add", not "Added" or "Adds".
|
|
14
|
+
2. **The Sentence Test**: The subject should complete the sentence: "If applied, this commit will... [subject]".
|
|
15
|
+
|
|
16
|
+
## Anti-Patterns
|
|
17
|
+
|
|
18
|
+
- `Fixed bug` (Past tense).
|
|
19
|
+
- `Fixes bug` (Present continuous).
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
**Bad:**
|
|
24
|
+
`Updated README`
|
|
25
|
+
|
|
26
|
+
**Good:**
|
|
27
|
+
`Update README` (matches "If applied, this commit will [Update README]").
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# The 50/72 Formatting Rule (GIT-00003)
|
|
2
|
+
|
|
3
|
+
**Source**: [02. The Commit](../../../docs/meta/domains/git/02-commits.md#3-conventional-commits-v100)
|
|
4
|
+
**Tags**: #behavioral #git #git-commit #formatting
|
|
5
|
+
**Related**: [Documentation](../../constitution/CONS-00032-documentation.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Commit messages must adhere to standard terminal-width constraints.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Subject**: Max 50 characters. Ensures readability in `git log --oneline`.
|
|
14
|
+
2. **Separator**: Mandatory blank line between subject and body.
|
|
15
|
+
3. **Body**: Wrap at 72 characters. Ensures readability in standard terminals (80 cols - indentation).
|
|
16
|
+
|
|
17
|
+
## Anti-Patterns
|
|
18
|
+
|
|
19
|
+
- No body.
|
|
20
|
+
- One long line that scrolls horizontally forever.
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
**Bad:**
|
|
25
|
+
`feat(ui): add new button color because the designer said so and it looks better on mobile`
|
|
26
|
+
|
|
27
|
+
**Good:**
|
|
28
|
+
`feat(ui): update button color`
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Trunk-Based Flow (GIT-00004)
|
|
2
|
+
|
|
3
|
+
**Source**: [01. The Workflow](../../../docs/meta/domains/git/01-workflow.md#1-the-single-source-of-truth)
|
|
4
|
+
**Tags**: #structural #git #git-branch #workflow #trunk
|
|
5
|
+
**Related**: [Evolvability](../../constitution/CONS-00028-evolvability.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Development occurs on short-lived branches merged frequently into a single shared trunk.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Lifespan**: Feature branches should be short-lived (target < 1 week).
|
|
14
|
+
2. **Toggle**: Incomplete features must be merged behind a Feature Flag.
|
|
15
|
+
3. **Deployability**: `main` must always be in a deployable state.
|
|
16
|
+
|
|
17
|
+
## Anti-Patterns
|
|
18
|
+
|
|
19
|
+
- **GitFlow**: Long-lived `develop` branches.
|
|
20
|
+
- **Merge Hell**: Integrating weeks of divergent code.
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
**Bad:**
|
|
25
|
+
`feature/auth-v2` (Last commit: 3 weeks ago).
|
|
26
|
+
|
|
27
|
+
**Good:**
|
|
28
|
+
`feat/pkg-scaffold` (Merged the same day).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Public History Immutability (GIT-00005)
|
|
2
|
+
|
|
3
|
+
**Source**: [04. History Integrity & Security](../../../docs/meta/domains/git/04-integrity.md#1-immutable-public-history)
|
|
4
|
+
**Tags**: #behavioral #git #git-integrity #history #immutability
|
|
5
|
+
**Related**: [Safety](../../constitution/CONS-00015-safety.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Once a commit is pushed to a shared branch, it is immutable.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Force Push**: Forbidden on `main` or `master`.
|
|
14
|
+
2. **Rebase**: Forbidden on shared branches.
|
|
15
|
+
|
|
16
|
+
## Anti-Patterns
|
|
17
|
+
|
|
18
|
+
- `git push -f origin main` to fix a typo.
|
|
19
|
+
|
|
20
|
+
## Examples
|
|
21
|
+
|
|
22
|
+
**Bad:**
|
|
23
|
+
Rewriting history to remove a secret (rotate the secret instead).
|
|
24
|
+
|
|
25
|
+
**Good:**
|
|
26
|
+
`git revert <sha>` to undo a mistake.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Cryptographic Identity (GIT-00006)
|
|
2
|
+
|
|
3
|
+
**Source**: [04. History Integrity & Security](../../../docs/meta/domains/git/04-integrity.md#3-cryptographic-identity)
|
|
4
|
+
**Tags**: #operational #git #git-security #signing
|
|
5
|
+
**Related**: [Security](../../constitution/CONS-00024-security.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
All commits must be cryptographically attributable to a verified author.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Signing**: All commits must be signed (GPG or SSH).
|
|
14
|
+
2. **Main Enforcement**: Protected branches (e.g., `main`) must reject unsigned commits via branch protection.
|
|
15
|
+
3. **PR Enforcement**: CI must fail pull requests that contain any unsigned commits.
|
|
16
|
+
|
|
17
|
+
## Anti-Patterns
|
|
18
|
+
|
|
19
|
+
- Committing with `user.email` set to `root@localhost`.
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
**Bad:**
|
|
24
|
+
Unverified commit.
|
|
25
|
+
|
|
26
|
+
**Good:**
|
|
27
|
+
Commit with `Verified` badge.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Reviewer Capital (GIT-00007)
|
|
2
|
+
|
|
3
|
+
**Source**: [03. Collaboration & Etiquette](../../../docs/meta/domains/git/03-collaboration.md#2-reviewer-capital)
|
|
4
|
+
**Tags**: #behavioral #git #git-review #collaboration
|
|
5
|
+
**Related**: [Collaboration](../../constitution/CONS-00027-transparency.md)
|
|
6
|
+
|
|
7
|
+
## Definition
|
|
8
|
+
|
|
9
|
+
Code review is a negotiation where social capital is the currency.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
1. **Default to Yes**: Accept reviewer suggestions unless there is a critical technical blocker.
|
|
14
|
+
2. **Responsiveness**: Acknowledge feedback immediately.
|
|
15
|
+
|
|
16
|
+
## Anti-Patterns
|
|
17
|
+
|
|
18
|
+
- Debating style choices (bikeshedding) when the reviewer asks for a change.
|
|
19
|
+
|
|
20
|
+
## Examples
|
|
21
|
+
|
|
22
|
+
**Bad:**
|
|
23
|
+
"I prefer my variable name."
|
|
24
|
+
|
|
25
|
+
**Good:**
|
|
26
|
+
"Done. Updated as suggested."
|