invar-tools 1.0.0__tar.gz → 1.2.0__tar.gz
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.
- {invar_tools-1.0.0 → invar_tools-1.2.0}/.aider.conf.yml +5 -7
- invar_tools-1.2.0/.claude/commands/review.md +200 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/.cursorrules +1 -1
- {invar_tools-1.0.0 → invar_tools-1.2.0}/.github/workflows/publish.yml +31 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/.invar/context.md +226 -4
- {invar_tools-1.0.0/src/invar/templates → invar_tools-1.2.0/.invar}/examples/contracts.py +3 -1
- {invar_tools-1.0.0/src/invar/templates → invar_tools-1.2.0/.invar}/examples/core_shell.py +3 -1
- invar_tools-1.2.0/.invar/examples/workflow.md +149 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/.pre-commit-config.yaml +2 -10
- invar_tools-1.2.0/.serena/cache/python/document_symbols.pkl +0 -0
- invar_tools-1.2.0/.serena/cache/python/raw_document_symbols.pkl +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/CLAUDE.md +53 -26
- {invar_tools-1.0.0 → invar_tools-1.2.0}/INVAR.md +150 -21
- invar_tools-1.2.0/LICENSE +190 -0
- invar_tools-1.2.0/LICENSE-GPL +674 -0
- invar_tools-1.2.0/NOTICE +63 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/PKG-INFO +81 -15
- {invar_tools-1.0.0 → invar_tools-1.2.0}/README.md +76 -12
- invar_tools-1.2.0/deprecated/python-invar/README.md +61 -0
- invar_tools-1.2.0/deprecated/python-invar/pyproject.toml +34 -0
- invar_tools-1.2.0/deprecated/python-invar/src/python_invar/__init__.py +29 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/AGENTS.md +101 -1
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/DESIGN.md +89 -63
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/VISION.md +9 -8
- invar_tools-1.2.0/docs/feedback/INVAR_FEEDBACK_MEMO.md +457 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/index.html +25 -34
- invar_tools-1.2.0/docs/mechanisms/README.md +55 -0
- invar_tools-1.2.0/docs/mechanisms/architecture/README.md +134 -0
- invar_tools-1.2.0/docs/mechanisms/contracts/README.md +53 -0
- invar_tools-1.2.0/docs/mechanisms/contracts/contract-complete.md +267 -0
- invar_tools-1.2.0/docs/mechanisms/contracts/doctests.md +341 -0
- invar_tools-1.2.0/docs/mechanisms/contracts/pre-post.md +304 -0
- invar_tools-1.2.0/docs/mechanisms/documentation.md +186 -0
- invar_tools-1.2.0/docs/mechanisms/rules/README.md +150 -0
- invar_tools-1.2.0/docs/mechanisms/rules/severity-design.md +251 -0
- invar_tools-1.2.0/docs/mechanisms/verification/README.md +96 -0
- invar_tools-1.2.0/docs/mechanisms/verification/smart-routing.md +178 -0
- invar_tools-1.2.0/docs/mechanisms/workflow/README.md +44 -0
- invar_tools-1.2.0/docs/mechanisms/workflow/session-start.md +265 -0
- invar_tools-1.2.0/docs/mechanisms/workflow/usbv.md +338 -0
- {invar_tools-1.0.0/.invar → invar_tools-1.2.0/docs}/proposals/DX-17-workflow-enforcement.md +6 -1
- invar_tools-1.2.0/docs/proposals/DX-22-verification-strategy.md +752 -0
- invar_tools-1.2.0/docs/proposals/DX-23-entry-point-detection.md +479 -0
- invar_tools-1.2.0/docs/proposals/DX-24-mechanism-documentation.md +811 -0
- invar_tools-1.2.0/docs/proposals/DX-25-functional-patterns.md +821 -0
- invar_tools-1.2.0/docs/proposals/DX-26-guard-simplification.md +506 -0
- invar_tools-1.2.0/docs/proposals/DX-27-system-prompt-protocol.md +182 -0
- invar_tools-1.2.0/docs/proposals/DX-28-semantic-verification.md +773 -0
- invar_tools-1.2.0/docs/proposals/DX-29-pure-content-detection.md +140 -0
- invar_tools-1.2.0/docs/proposals/DX-30-visible-workflow.md +517 -0
- invar_tools-1.2.0/docs/proposals/DX-31-adversarial-reviewer.md +723 -0
- invar_tools-1.2.0/docs/proposals/DX-32-workflow-iteration.md +322 -0
- invar_tools-1.2.0/docs/proposals/DX-33-verification-blind-spots.md +349 -0
- invar_tools-1.2.0/docs/proposals/DX-34-review-cycle.md +243 -0
- invar_tools-1.2.0/docs/proposals/README.md +78 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/pyproject.toml +11 -10
- invar_tools-1.2.0/runtime/LICENSE +190 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/runtime/README.md +23 -2
- {invar_tools-1.0.0 → invar_tools-1.2.0}/runtime/pyproject.toml +3 -3
- {invar_tools-1.0.0 → invar_tools-1.2.0}/runtime/src/invar_runtime/__init__.py +7 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/runtime/src/invar_runtime/contracts.py +30 -1
- {invar_tools-1.0.0 → invar_tools-1.2.0}/runtime/src/invar_runtime/decorators.py +37 -14
- {invar_tools-1.0.0 → invar_tools-1.2.0}/runtime/src/invar_runtime/invariant.py +4 -0
- invar_tools-1.2.0/runtime/src/invar_runtime/relations.py +190 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/contracts.py +75 -5
- invar_tools-1.2.0/src/invar/core/entry_points.py +294 -0
- invar_tools-1.2.0/src/invar/core/format_specs.py +196 -0
- invar_tools-1.2.0/src/invar/core/format_strategies.py +197 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/formatter.py +27 -4
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/hypothesis_strategies.py +47 -5
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/lambda_helpers.py +1 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/models.py +23 -17
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/parser.py +6 -2
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/property_gen.py +81 -40
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/purity.py +10 -4
- invar_tools-1.2.0/src/invar/core/review_trigger.py +298 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/rule_meta.py +61 -2
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/rules.py +83 -19
- invar_tools-1.2.0/src/invar/core/shell_analysis.py +252 -0
- invar_tools-1.2.0/src/invar/core/shell_architecture.py +171 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/suggestions.py +6 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/tautology.py +1 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/utils.py +51 -4
- invar_tools-1.2.0/src/invar/core/verification_routing.py +158 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/invariant.py +1 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/mcp/server.py +20 -3
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/cli.py +59 -31
- invar_tools-1.2.0/src/invar/shell/config.py +497 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/fs.py +5 -2
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/git.py +2 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/guard_helpers.py +78 -3
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/guard_output.py +100 -24
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/init_cmd.py +27 -7
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/mcp_config.py +3 -0
- invar_tools-1.2.0/src/invar/shell/mutate_cmd.py +184 -0
- invar_tools-1.2.0/src/invar/shell/mutation.py +314 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/perception.py +2 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/property_tests.py +17 -2
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/prove.py +35 -3
- invar_tools-1.2.0/src/invar/shell/prove_accept.py +113 -0
- invar_tools-1.2.0/src/invar/shell/prove_fallback.py +285 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/templates.py +34 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/test_cmd.py +3 -1
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/testing.py +6 -17
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/update_cmd.py +2 -0
- invar_tools-1.2.0/src/invar/templates/CLAUDE.md.template +114 -0
- invar_tools-1.2.0/src/invar/templates/INVAR.md +207 -0
- invar_tools-1.2.0/src/invar/templates/aider.conf.yml.template +31 -0
- invar_tools-1.2.0/src/invar/templates/commands/review.md +200 -0
- invar_tools-1.2.0/src/invar/templates/cursorrules.template +37 -0
- {invar_tools-1.0.0/.invar → invar_tools-1.2.0/src/invar/templates}/examples/contracts.py +3 -1
- {invar_tools-1.0.0/.invar → invar_tools-1.2.0/src/invar/templates}/examples/core_shell.py +3 -1
- invar_tools-1.2.0/uv.lock +1472 -0
- invar_tools-1.0.0/.claude/commands/attack.md +0 -76
- invar_tools-1.0.0/.claude/commands/review.md +0 -67
- invar_tools-1.0.0/LICENSE +0 -21
- invar_tools-1.0.0/src/invar/shell/config.py +0 -248
- invar_tools-1.0.0/src/invar/shell/prove_fallback.py +0 -183
- invar_tools-1.0.0/src/invar/templates/CLAUDE.md.template +0 -58
- invar_tools-1.0.0/src/invar/templates/INVAR.md +0 -134
- invar_tools-1.0.0/src/invar/templates/aider.conf.yml.template +0 -29
- invar_tools-1.0.0/src/invar/templates/cursorrules.template +0 -28
- {invar_tools-1.0.0 → invar_tools-1.2.0}/.github/workflows/ci.yml +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/.gitignore +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/.invar/examples/README.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/.invar/proposals/TEMPLATE.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/.mcp.json +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/.serena/.gitignore +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/.serena/project.yml +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/RELEASE_NOTES_v0.1.0.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/INVAR-GUIDE.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/archive/FIRST_PRINCIPLES_REVIEW.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/archive/INVAR-DETAILED-v3.16.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/archive/PHASE3_REVIEW.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/archive/PROTOCOL_EVOLUTION.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/archive/VISION-ORIGINAL.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/archive/decisions-2024.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/archive/proposals-P15-P23-2025.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/archive/proposals-phase9-reflection-2025.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/feedback/INVAR-COMPLIANCE-ANALYSIS.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/proposals/2025-12-21-dx-improvements.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/proposals/2025-12-23-dx-20-property-testing-enhancements.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/proposals/2025-12-23-dx-21-package-and-init.md +0 -0
- {invar_tools-1.0.0/.invar → invar_tools-1.2.0/docs}/proposals/AGENT-IMPROVEMENTS.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/proposals/DX-11-documentation-restructure.md +0 -0
- {invar_tools-1.0.0/.invar → invar_tools-1.2.0/docs}/proposals/DX-12-hypothesis-fallback.md +0 -0
- {invar_tools-1.0.0/.invar → invar_tools-1.2.0/docs}/proposals/DX-13-incremental-prove.md +0 -0
- {invar_tools-1.0.0/.invar → invar_tools-1.2.0/docs}/proposals/DX-14-expanded-prove-usage.md +0 -0
- {invar_tools-1.0.0/.invar → invar_tools-1.2.0/docs}/proposals/DX-16-agent-tool-enforcement.md +0 -0
- {invar_tools-1.0.0/docs/proposals → invar_tools-1.2.0/docs/proposals/archive}/2024-12-21-guard-enhancements.md +0 -0
- {invar_tools-1.0.0/docs/proposals → invar_tools-1.2.0/docs/proposals/archive}/2024-12-21-language-inspired-enhancements.md +0 -0
- {invar_tools-1.0.0/docs/proposals → invar_tools-1.2.0/docs/proposals/archive}/2024-12-21-test-first-enhancement.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/docs/research/cruxeval-quick-validation.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/runtime/src/invar_runtime/resource.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/scripts/smart-guard.sh +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/__init__.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/contracts.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/__init__.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/extraction.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/inspect.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/must_use.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/purity_heuristics.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/references.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/strategies.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/core/timeout_inference.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/decorators.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/mcp/__init__.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/mcp/__main__.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/py.typed +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/resource.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/__init__.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/shell/prove_cache.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/templates/__init__.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/templates/context.md.template +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/templates/examples/README.md +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/templates/pre-commit-config.yaml.template +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/src/invar/templates/proposal.md.template +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/tests/__init__.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/tests/conftest.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/tests/integration/__init__.py +0 -0
- {invar_tools-1.0.0 → invar_tools-1.2.0}/tests/integration/test_cli_flags.py +0 -0
|
@@ -15,13 +15,11 @@ system-prompt: |
|
|
|
15
15
|
1. invar guard --changed
|
|
16
16
|
2. invar map --top 10
|
|
17
17
|
|
|
18
|
-
Workflow (
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- Implement: Pass your doctests
|
|
24
|
-
- Verify: invar guard
|
|
18
|
+
Workflow (USBV):
|
|
19
|
+
- Understand: Intent, Inspect (invar sig), Constraints
|
|
20
|
+
- Specify: @pre/@post + doctests, Design decomposition
|
|
21
|
+
- Build: Implement leaves first, Compose
|
|
22
|
+
- Validate: invar guard, Integrate, Reflect
|
|
25
23
|
|
|
26
24
|
Project-specific:
|
|
27
25
|
- INVAR.md here is the SOURCE, templates are in src/invar/templates/
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Code Review (Reviewer Role)
|
|
2
|
+
|
|
3
|
+
## Mode Detection (Required First Step)
|
|
4
|
+
|
|
5
|
+
Before reviewing, determine the appropriate mode:
|
|
6
|
+
|
|
7
|
+
### Check for `review_suggested`
|
|
8
|
+
|
|
9
|
+
Look at your conversation history for recent `invar guard` output, or run:
|
|
10
|
+
```bash
|
|
11
|
+
invar guard --changed
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Check if `review_suggested` warning is present:
|
|
15
|
+
```
|
|
16
|
+
WARNING: review_suggested - High escape hatch count: N @invar:allow markers
|
|
17
|
+
WARNING: review_suggested - Security-sensitive path detected
|
|
18
|
+
WARNING: review_suggested - Low contract coverage
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Select Mode
|
|
22
|
+
|
|
23
|
+
| Condition | Mode | Why |
|
|
24
|
+
|-----------|------|-----|
|
|
25
|
+
| `review_suggested` present | **Isolated** | Eliminates confirmation bias |
|
|
26
|
+
| No trigger | **Quick** | Faster, context preserved |
|
|
27
|
+
| User requests `--isolated` | **Isolated** | Explicit override |
|
|
28
|
+
| User requests `--quick` | **Quick** | Explicit override |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Isolated Mode
|
|
33
|
+
|
|
34
|
+
**Use when:** `review_suggested` triggered, or user explicitly requests isolation.
|
|
35
|
+
|
|
36
|
+
Spawn an independent reviewer with fresh context using Task tool:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
I'll spawn an independent reviewer to eliminate confirmation bias...
|
|
40
|
+
|
|
41
|
+
[Task tool call]
|
|
42
|
+
prompt: |
|
|
43
|
+
You are an adversarial code reviewer. Your job is to FIND PROBLEMS.
|
|
44
|
+
|
|
45
|
+
Review these files: {files_to_review}
|
|
46
|
+
|
|
47
|
+
Read .claude/commands/review.md for the full checklist, then:
|
|
48
|
+
1. Check contract semantic value (not just syntax)
|
|
49
|
+
2. Audit all escape hatches (@invar:allow)
|
|
50
|
+
3. Look for logic errors and edge cases
|
|
51
|
+
4. Check security if applicable
|
|
52
|
+
|
|
53
|
+
Report issues as CRITICAL/MAJOR/MINOR with file:line locations.
|
|
54
|
+
|
|
55
|
+
Your success is measured by problems found, not code approved.
|
|
56
|
+
|
|
57
|
+
subagent_type: "general-purpose"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
After receiving the sub-agent's report, summarize findings for the user.
|
|
61
|
+
|
|
62
|
+
**Key:** The sub-agent has NO conversation history. It only sees the code.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Quick Mode
|
|
67
|
+
|
|
68
|
+
**Use when:** No `review_suggested` trigger, routine review needed.
|
|
69
|
+
|
|
70
|
+
Proceed with same-context review below.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Adversarial Reviewer Persona
|
|
75
|
+
|
|
76
|
+
You are an **adversarial code reviewer**. Your job is to FIND PROBLEMS.
|
|
77
|
+
|
|
78
|
+
### Your Mindset
|
|
79
|
+
|
|
80
|
+
Assume:
|
|
81
|
+
- The code has bugs until proven otherwise
|
|
82
|
+
- The contracts may be meaningless ceremony
|
|
83
|
+
- The implementer may have rationalized poor decisions
|
|
84
|
+
- Escape hatches may be abused
|
|
85
|
+
|
|
86
|
+
You are NOT here to:
|
|
87
|
+
- Validate that code works
|
|
88
|
+
- Confirm the implementer did a good job
|
|
89
|
+
- Be nice or diplomatic
|
|
90
|
+
|
|
91
|
+
You ARE here to:
|
|
92
|
+
- Find bugs, logic errors, edge cases
|
|
93
|
+
- Challenge whether contracts have semantic value
|
|
94
|
+
- Identify code smells and duplication
|
|
95
|
+
- Question every escape hatch
|
|
96
|
+
- Check if code matches contracts (not if code "seems right")
|
|
97
|
+
|
|
98
|
+
**Your success is measured by problems found, not code approved.**
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Review Checklist
|
|
103
|
+
|
|
104
|
+
> **Principle:** Only items requiring semantic judgment. Mechanical checks are excluded (see bottom).
|
|
105
|
+
|
|
106
|
+
### A. Contract Semantic Value
|
|
107
|
+
- [ ] Does @pre constrain inputs beyond type checking?
|
|
108
|
+
- Bad: `@pre(lambda x: isinstance(x, int))`
|
|
109
|
+
- Good: `@pre(lambda x: x > 0 and x < MAX_VALUE)`
|
|
110
|
+
- [ ] Does @post verify meaningful output properties?
|
|
111
|
+
- Bad: `@post(lambda result: result is not None)`
|
|
112
|
+
- Good: `@post(lambda result: len(result) == len(input))`
|
|
113
|
+
- [ ] Could someone implement correctly from contracts alone?
|
|
114
|
+
- [ ] Are boundary conditions explicit in contracts?
|
|
115
|
+
|
|
116
|
+
### B. Doctest Coverage
|
|
117
|
+
- [ ] Do doctests cover normal cases?
|
|
118
|
+
- [ ] Do doctests cover boundary cases?
|
|
119
|
+
- [ ] Do doctests cover error cases?
|
|
120
|
+
- [ ] Are doctests testing behavior, not just syntax?
|
|
121
|
+
|
|
122
|
+
### C. Code Quality
|
|
123
|
+
- [ ] Is duplicated code worth extracting?
|
|
124
|
+
- [ ] Is naming consistent and clear?
|
|
125
|
+
- [ ] Is complexity justified?
|
|
126
|
+
|
|
127
|
+
### D. Escape Hatch Audit
|
|
128
|
+
- [ ] Is each @invar:allow justification valid?
|
|
129
|
+
- [ ] Could refactoring eliminate the need?
|
|
130
|
+
- [ ] Is there a pattern suggesting systematic issues?
|
|
131
|
+
|
|
132
|
+
### E. Logic Verification
|
|
133
|
+
- [ ] Do contracts correctly capture intended behavior?
|
|
134
|
+
- [ ] Are there paths that bypass contract checks?
|
|
135
|
+
- [ ] Are there implicit assumptions not in contracts?
|
|
136
|
+
- [ ] What happens with unexpected inputs?
|
|
137
|
+
|
|
138
|
+
### F. Security
|
|
139
|
+
- [ ] Are inputs validated against security threats (injection, XSS)?
|
|
140
|
+
- [ ] No hardcoded secrets (API keys, passwords, tokens)?
|
|
141
|
+
- [ ] Are authentication/authorization checks correct?
|
|
142
|
+
- [ ] Is sensitive data properly protected?
|
|
143
|
+
|
|
144
|
+
### G. Error Handling & Observability
|
|
145
|
+
- [ ] Are exceptions caught at appropriate level?
|
|
146
|
+
- [ ] Are error messages clear without leaking sensitive info?
|
|
147
|
+
- [ ] Are critical operations logged for debugging?
|
|
148
|
+
- [ ] Is there graceful degradation on failure?
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Excluded (Covered by Tools)
|
|
153
|
+
|
|
154
|
+
These are checked by Guard or linters - don't duplicate:
|
|
155
|
+
- Core/Shell separation → Guard (forbidden_import, impure_call)
|
|
156
|
+
- Shell returns Result[T,E] → Guard (shell_result)
|
|
157
|
+
- Missing contracts → Guard (missing_contract)
|
|
158
|
+
- File/function size limits → Guard (file_size, function_size)
|
|
159
|
+
- Entry point thickness → Guard (entry_point_too_thick)
|
|
160
|
+
- Magic numbers → Linters (ruff)
|
|
161
|
+
- Escape hatch count → Guard (review_suggested)
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Report Format
|
|
166
|
+
|
|
167
|
+
For each issue found, use severity levels:
|
|
168
|
+
|
|
169
|
+
| Severity | Meaning | Enforcement |
|
|
170
|
+
|----------|---------|-------------|
|
|
171
|
+
| **CRITICAL** | Must fix before completion | Blocking |
|
|
172
|
+
| **MAJOR** | Fix or provide written justification | Strong |
|
|
173
|
+
| **MINOR** | Optional, can defer | Advisory |
|
|
174
|
+
|
|
175
|
+
```markdown
|
|
176
|
+
### [CRITICAL/MAJOR/MINOR] Issue Title
|
|
177
|
+
|
|
178
|
+
**Location:** file.py:line_number
|
|
179
|
+
**Category:** contract_quality | logic_error | security | escape_hatch | code_smell
|
|
180
|
+
**Problem:** What's wrong
|
|
181
|
+
**Suggestion:** How to fix (if applicable)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Instructions Summary
|
|
187
|
+
|
|
188
|
+
1. **Mode Detection:** Check for `review_suggested` in guard output
|
|
189
|
+
2. **If Isolated Mode:** Spawn Task sub-agent (fresh context)
|
|
190
|
+
3. **If Quick Mode:** Proceed with same-context adversarial review
|
|
191
|
+
4. Go through each checklist category
|
|
192
|
+
5. For each issue, determine severity (CRITICAL/MAJOR/MINOR)
|
|
193
|
+
6. Report with structured format above
|
|
194
|
+
7. Be thorough and adversarial
|
|
195
|
+
|
|
196
|
+
**Remember:** You are READ-ONLY. Report issues, don't fix them directly.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
Now review the recent changes or the files specified by the user.
|
|
@@ -17,7 +17,7 @@ Use MCP tools if available, otherwise use CLI commands.
|
|
|
17
17
|
|
|
18
18
|
- Core (`src/invar/core/`): @pre/@post contracts, doctests, pure (no I/O)
|
|
19
19
|
- Shell (`src/invar/shell/`): Result[T, E] return type
|
|
20
|
-
- Workflow:
|
|
20
|
+
- Workflow: Understand -> Specify -> Build -> Validate (USBV)
|
|
21
21
|
- Task complete only when final invar_guard passes.
|
|
22
22
|
|
|
23
23
|
## Project-Specific
|
|
@@ -29,6 +29,7 @@ jobs:
|
|
|
29
29
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
30
30
|
with:
|
|
31
31
|
packages-dir: runtime/dist/
|
|
32
|
+
skip-existing: true
|
|
32
33
|
# Uses trusted publishing - configure at pypi.org/manage/project/invar-runtime/settings/publishing/
|
|
33
34
|
|
|
34
35
|
publish-tools:
|
|
@@ -54,4 +55,34 @@ jobs:
|
|
|
54
55
|
|
|
55
56
|
- name: Publish invar-tools to PyPI
|
|
56
57
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
58
|
+
with:
|
|
59
|
+
skip-existing: true
|
|
57
60
|
# Uses trusted publishing - configure at pypi.org/manage/project/invar-tools/settings/publishing/
|
|
61
|
+
|
|
62
|
+
publish-deprecated:
|
|
63
|
+
name: Publish python-invar (deprecated)
|
|
64
|
+
runs-on: ubuntu-latest
|
|
65
|
+
needs: publish-tools # Deprecated package depends on invar-tools
|
|
66
|
+
permissions:
|
|
67
|
+
id-token: write # Required for trusted publishing
|
|
68
|
+
|
|
69
|
+
steps:
|
|
70
|
+
- uses: actions/checkout@v4
|
|
71
|
+
|
|
72
|
+
- name: Set up Python
|
|
73
|
+
uses: actions/setup-python@v5
|
|
74
|
+
with:
|
|
75
|
+
python-version: "3.11"
|
|
76
|
+
|
|
77
|
+
- name: Install build tools
|
|
78
|
+
run: pip install build
|
|
79
|
+
|
|
80
|
+
- name: Build python-invar package
|
|
81
|
+
run: python -m build deprecated/python-invar/
|
|
82
|
+
|
|
83
|
+
- name: Publish python-invar to PyPI
|
|
84
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
85
|
+
with:
|
|
86
|
+
packages-dir: deprecated/python-invar/dist/
|
|
87
|
+
skip-existing: true
|
|
88
|
+
# Uses trusted publishing - configure at pypi.org/manage/project/python-invar/settings/publishing/
|
|
@@ -1,13 +1,229 @@
|
|
|
1
1
|
# Invar Project Context
|
|
2
2
|
|
|
3
|
-
*Last updated: 2025-12-
|
|
3
|
+
*Last updated: 2025-12-25*
|
|
4
|
+
|
|
5
|
+
## Coverage Guarantee Matrix
|
|
6
|
+
|
|
7
|
+
Smart Guard (`invar guard`) runs multiple verification layers. Here's what covers what:
|
|
8
|
+
|
|
9
|
+
### Layer Coverage
|
|
10
|
+
|
|
11
|
+
| Layer | Runs On | Catches | Limitations |
|
|
12
|
+
|-------|---------|---------|-------------|
|
|
13
|
+
| **Static Analysis** | All Python files | Architecture violations, missing contracts, file/function size | No runtime behavior |
|
|
14
|
+
| **Doctests** | Functions with `>>>` examples | Logic errors, edge cases | Requires manual examples |
|
|
15
|
+
| **CrossHair** | Functions with @pre/@post | Contract violations via symbolic execution | Skips C extensions (ast.parse, compile) |
|
|
16
|
+
| **Hypothesis** | Functions with @pre/@post | Contract violations via random testing | Skips untestable types (Any, Pydantic, AST) |
|
|
17
|
+
|
|
18
|
+
### Function Coverage Guarantee
|
|
19
|
+
|
|
20
|
+
| Function Has | Static | Doctests | CrossHair | Hypothesis |
|
|
21
|
+
|--------------|--------|----------|-----------|------------|
|
|
22
|
+
| No contracts | ✅ | ❌ | ❌ | ❌ |
|
|
23
|
+
| @pre/@post only | ✅ | ❌ | ✅ | ✅ |
|
|
24
|
+
| Doctests only | ✅ | ✅ | ❌ | ❌ |
|
|
25
|
+
| @pre/@post + doctests | ✅ | ✅ | ✅ | ✅ |
|
|
26
|
+
| Uses ast.parse/compile | ✅ | ✅ | ⚠️ Skipped | ✅ |
|
|
27
|
+
| Uses typing.Any | ✅ | ✅ | ✅ | ⚠️ Skipped |
|
|
28
|
+
| Uses Pydantic models | ✅ | ✅ | ✅ | ⚠️ Skipped |
|
|
29
|
+
|
|
30
|
+
**Key Insight:** Doctests are the universal fallback. Every function should have at least one doctest example.
|
|
31
|
+
|
|
32
|
+
### deal.has Functions
|
|
33
|
+
|
|
34
|
+
Functions decorated with `@has("import")` or similar are:
|
|
35
|
+
- ✅ Tested by Hypothesis (deal.cases respects @pre conditions)
|
|
36
|
+
- ⚠️ Skipped by CrossHair (correctly - C extensions unsupported)
|
|
37
|
+
|
|
38
|
+
The `@has` decorator marks side effects for documentation, not verification bypass.
|
|
39
|
+
|
|
40
|
+
### Verification Results (2025-12-24)
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
Functions tested: 151
|
|
44
|
+
Functions passed: 151
|
|
45
|
+
Functions failed: 0
|
|
46
|
+
Total examples: 7000
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
All contracted functions pass property testing after switching to `deal.cases()`.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Session 2025-12-25: DX-32 USBV Implementation & Review Gate Integration
|
|
54
|
+
|
|
55
|
+
### DX-32: USBV Workflow Implementation
|
|
56
|
+
|
|
57
|
+
Replaced ICIDIV with USBV (Understand → Specify → Build → Validate):
|
|
58
|
+
- **Key insight:** Inspect before Contract. Depth varies naturally.
|
|
59
|
+
- **Iteration:** VALIDATE failure returns to appropriate phase
|
|
60
|
+
|
|
61
|
+
### Review Gate Integration (DX-31 Phase 2)
|
|
62
|
+
|
|
63
|
+
Integrated independent reviewer subagent into USBV's VALIDATE phase:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
VALIDATE Phase
|
|
67
|
+
├─ invar guard # Smart Guard
|
|
68
|
+
├─ Review Gate (条件) # If review_suggested triggered
|
|
69
|
+
│ └─ /review # Invoke independent reviewer
|
|
70
|
+
└─ Reflect & Iterate
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Trigger conditions:**
|
|
74
|
+
- Escape hatches >= 3 (`@invar:allow` markers)
|
|
75
|
+
- Contract coverage < 50% in Core files
|
|
76
|
+
- Security-sensitive paths detected
|
|
77
|
+
|
|
78
|
+
**Documentation Updated:**
|
|
79
|
+
- `docs/mechanisms/workflow/usbv.md` - Added Review Gate section
|
|
80
|
+
- `INVAR.md` - Updated VALIDATE phase, added iteration path
|
|
81
|
+
- `src/invar/templates/INVAR.md` - Synced changes
|
|
82
|
+
- `.invar/examples/workflow.md` - Added Review Gate principle
|
|
83
|
+
- `docs/AGENTS.md` - Added USBV Integration section
|
|
84
|
+
|
|
85
|
+
### Lesson #28: Review Gate as Conditional Step
|
|
86
|
+
|
|
87
|
+
**发现:** Review should be automatic trigger, not manual decision.
|
|
88
|
+
**机制:** Guard detects conditions → suggests review → Agent invokes /review → addresses findings.
|
|
89
|
+
**类别:** Integration at workflow phase boundary (VALIDATE) is more effective than separate tool.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Session 2025-12-25: DX-31 Review Trigger
|
|
94
|
+
|
|
95
|
+
### DX-31 Phase 1: Guard Trigger Rule
|
|
96
|
+
|
|
97
|
+
Implemented `review_suggested` rule that triggers independent review suggestion when:
|
|
98
|
+
- **Security-sensitive path**: Files containing auth, crypt, secret, password, token, etc.
|
|
99
|
+
- **High escape hatch count**: >= 3 `@invar:allow` markers
|
|
100
|
+
- **Low contract coverage**: < 50% of public functions have contracts
|
|
101
|
+
|
|
102
|
+
**Files Created:**
|
|
103
|
+
- `src/invar/core/review_trigger.py` (252 lines) - Central module for DX-30/31 triggers
|
|
104
|
+
|
|
105
|
+
**Files Modified:**
|
|
106
|
+
- `src/invar/core/entry_points.py` - Added `count_escape_hatches()` helper
|
|
107
|
+
- `src/invar/core/rules.py` - Registered `check_review_suggested`
|
|
108
|
+
- `src/invar/core/rule_meta.py` - Added `review_suggested` metadata
|
|
109
|
+
|
|
110
|
+
**Refactoring:**
|
|
111
|
+
- Moved `calculate_contract_ratio` and `check_contract_quality_ratio` from `contracts.py` to `review_trigger.py` to keep file sizes under 500 lines
|
|
112
|
+
|
|
113
|
+
### DX-32 Proposal: Workflow Iteration
|
|
114
|
+
|
|
115
|
+
Created `docs/proposals/DX-32-workflow-iteration.md` analyzing ICIDIV workflow order.
|
|
116
|
+
|
|
117
|
+
**Key Insight:** Contract-before-Inspect is problematic for brownfield development. Proposed USBV (Understand → Specify → Build → Validate) as alternative with iteration loops.
|
|
118
|
+
|
|
119
|
+
### Lesson #26: Contract Before Inspect Problem
|
|
120
|
+
|
|
121
|
+
**发现:** ICIDIV的Contract-before-Inspect顺序在修改现有代码时造成摩擦 - 无法为未检查的代码写合约。
|
|
122
|
+
**机制:** Brownfield需要先理解再规范;Greenfield可以先规范。
|
|
123
|
+
**类别:** Workflow order should be context-sensitive (greenfield vs brownfield).
|
|
124
|
+
|
|
125
|
+
### Lesson #27: Process Visibility vs Task Completion
|
|
126
|
+
|
|
127
|
+
**发现:** 在实现DX-31时违反了DX-30 Visible Workflow原则 - 优先完成任务而非展示过程。
|
|
128
|
+
**机制:** Agent倾向于"直接做完"而非"展示正在做什么"。需要显式检查点。
|
|
129
|
+
**类别:** Agent-Native workflows need explicit visibility checkpoints, not just documentation.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Session 2025-12-24: DX-22 AST Detection & Tech Debt Resolution
|
|
134
|
+
|
|
135
|
+
### The Problem
|
|
136
|
+
|
|
137
|
+
Full `invar guard` scan revealed 36 errors that previous `--changed` checks missed:
|
|
138
|
+
- Content-based detection used string matching (`"@pre(" in source`)
|
|
139
|
+
- This matched patterns in docstrings, causing false positives
|
|
140
|
+
- Example: `>>> @pre(NonEmpty)` in a docstring was detected as a Core module
|
|
141
|
+
|
|
142
|
+
### The Solution
|
|
143
|
+
|
|
144
|
+
1. **AST-Based Detection** (`src/invar/shell/config.py`):
|
|
145
|
+
- Replaced string matching with AST parsing
|
|
146
|
+
- `_has_contract_decorators()` - walks AST to find real decorators
|
|
147
|
+
- `_has_io_imports()` - checks actual import nodes
|
|
148
|
+
- `_has_result_types()` - detects Result/Success/Failure usage
|
|
149
|
+
- Errors reduced: 36 → 14 (-61%)
|
|
150
|
+
|
|
151
|
+
2. **Tech Debt Resolution** (14 → 0 errors):
|
|
152
|
+
- `invariant.py`: Added `@invar:allow` for false positive (`.get()` matched `router.get`)
|
|
153
|
+
- `mcp/server.py`: Added `@shell_orchestration` and `@invar:allow` for MCP framework API
|
|
154
|
+
- `pyproject.toml`: Added `templates` and `.invar/examples` to exclude paths
|
|
155
|
+
|
|
156
|
+
3. **DX-29 Proposal Created**:
|
|
157
|
+
- Pure content detection with explicit `@invar:module` markers
|
|
158
|
+
- Pending review - may need splitting into separate proposals
|
|
159
|
+
|
|
160
|
+
### Files Changed
|
|
161
|
+
|
|
162
|
+
| File | Change |
|
|
163
|
+
|------|--------|
|
|
164
|
+
| `src/invar/shell/config.py` | AST-based detection functions |
|
|
165
|
+
| `src/invar/invariant.py` | False positive escape marker |
|
|
166
|
+
| `runtime/src/invar_runtime/invariant.py` | Same |
|
|
167
|
+
| `src/invar/mcp/server.py` | MCP framework escape markers |
|
|
168
|
+
| `pyproject.toml` | Exclude templates from checking |
|
|
169
|
+
| `docs/proposals/DX-29-pure-content-detection.md` | New proposal |
|
|
170
|
+
| `docs/proposals/README.md` | Updated status for all proposals |
|
|
171
|
+
|
|
172
|
+
### Lesson #26: String Matching vs AST
|
|
173
|
+
|
|
174
|
+
**发现:** 字符串匹配检测代码特征会产生误报(docstring中的示例代码)。
|
|
175
|
+
**机制:** AST解析只匹配真正的语法结构,不会被注释或字符串内容误导。
|
|
176
|
+
**类别:** Detection logic should use AST for code patterns, string matching for comments/markers.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Session 2025-12-24: DX-28 Skip Abuse Prevention
|
|
181
|
+
|
|
182
|
+
### The Problem
|
|
183
|
+
|
|
184
|
+
During DX-28 implementation, I batch-added `@skip_property_test` to 4 functions in `format_strategies.py` without proper justification. Only 1 (zero-parameter function) truly needed skip; the other 3 had `@pre` conditions that property testing could verify.
|
|
185
|
+
|
|
186
|
+
**Root cause:** Convenience over discipline. Adding skip was easier than thinking about whether it was needed.
|
|
187
|
+
|
|
188
|
+
### The Solution
|
|
189
|
+
|
|
190
|
+
1. **Decorator enhanced** (`decorators.py`):
|
|
191
|
+
- `@skip_property_test` now requires a reason string
|
|
192
|
+
- Bare usage sets `"(no reason provided)"` enabling Guard detection
|
|
193
|
+
|
|
194
|
+
2. **Guard rule added** (`contracts.py`):
|
|
195
|
+
- `check_skip_without_reason` detects bare/empty skip usage
|
|
196
|
+
- Uses regex with `^` anchor to avoid matching examples in docstrings
|
|
197
|
+
|
|
198
|
+
3. **Rule metadata** (`rule_meta.py`):
|
|
199
|
+
- `skip_without_reason` rule registered with WARNING severity
|
|
200
|
+
|
|
201
|
+
### Files Changed
|
|
202
|
+
|
|
203
|
+
| File | Change |
|
|
204
|
+
|------|--------|
|
|
205
|
+
| `runtime/src/invar_runtime/decorators.py` | Enhanced skip_property_test decorator |
|
|
206
|
+
| `src/invar/core/contracts.py` | Added check_skip_without_reason rule |
|
|
207
|
+
| `src/invar/core/rules.py` | Registered new rule |
|
|
208
|
+
| `src/invar/core/rule_meta.py` | Added rule metadata |
|
|
209
|
+
| `src/invar/core/format_strategies.py` | Removed 3 unnecessary skips |
|
|
210
|
+
|
|
211
|
+
### Lesson #25: Skip Requires Justification
|
|
212
|
+
|
|
213
|
+
**发现:** 批量添加`@skip_property_test`是"懒惰的快捷方式"。每个skip都应该有明确理由。
|
|
214
|
+
**机制:** Guard检测缺失理由,强制开发者思考为什么跳过。
|
|
215
|
+
**类别:** 有效的跳过理由包括: `no_params`, `strategy_factory`, `external_io`, `non_deterministic`。
|
|
216
|
+
|
|
217
|
+
---
|
|
4
218
|
|
|
5
219
|
## Current State
|
|
6
220
|
|
|
7
|
-
- **PyPI:** `invar-tools` + `invar-runtime` v1.0.
|
|
8
|
-
- **Protocol:**
|
|
221
|
+
- **PyPI:** `invar-tools` + `invar-runtime` v1.0.2 (DX-21 package split + dual licensing)
|
|
222
|
+
- **Protocol:** v4.0 (DX-32: USBV workflow, DX-31: review triggers)
|
|
9
223
|
- **GitHub Pages:** https://tefx.github.io/Invar/
|
|
224
|
+
- **Licenses:** Apache-2.0 (runtime) + GPL-3.0 (tools) + CC-BY-4.0 (docs)
|
|
10
225
|
- **Status:** Feature complete, zero technical debt
|
|
226
|
+
- **Recent:** DX-31 Phase 1 (review_suggested rule), DX-32 proposal (workflow iteration)
|
|
11
227
|
- **Blockers:** None
|
|
12
228
|
|
|
13
229
|
## Documentation Structure (DX-11)
|
|
@@ -710,6 +926,8 @@ Human (Commander) ──directs──→ Agent (Executor) ──uses──→ In
|
|
|
710
926
|
| 0.8.1 | 2025-12 | Fix --top limit for JSON output |
|
|
711
927
|
| 0.8.2 | 2025-12 | Handle empty files gracefully |
|
|
712
928
|
| 1.0.0 | 2025-12 | DX-21: Package split (invar-runtime + invar-tools), Claude init integration |
|
|
929
|
+
| 1.0.1 | 2025-12 | Deprecated python-invar package with migration warning |
|
|
930
|
+
| 1.0.2 | 2025-12 | Dual licensing: Apache-2.0 (runtime) + GPL-3.0 (tools) + CC-BY-4.0 (docs) |
|
|
713
931
|
|
|
714
932
|
## Tool Priority
|
|
715
933
|
|
|
@@ -726,7 +944,7 @@ Human (Commander) ──directs──→ Agent (Executor) ──uses──→ In
|
|
|
726
944
|
|
|
727
945
|
| File | Purpose |
|
|
728
946
|
|------|---------|
|
|
729
|
-
| INVAR.md | Protocol
|
|
947
|
+
| INVAR.md | Protocol v4.0 |
|
|
730
948
|
| docs/INVAR-GUIDE.md | Why & How |
|
|
731
949
|
| docs/VISION.md | Design philosophy |
|
|
732
950
|
| CLAUDE.md | Development guide |
|
|
@@ -758,6 +976,10 @@ Human (Commander) ──directs──→ Agent (Executor) ──uses──→ In
|
|
|
758
976
|
22. **Session Context > Async Feedback** - Problems caught during Agent session (pre-commit) beat CI feedback (context lost)
|
|
759
977
|
23. **Example-Driven Learning** - Abstract rules don't teach; concrete code examples do. New agents learn fastest by seeing working code
|
|
760
978
|
24. **deal Lambda Boolean Trap** - `and`/`or` in contracts may return strings; deal interprets non-bool as error messages. Always use `bool()`
|
|
979
|
+
25. **Skip Requires Justification** - Batch-adding @skip_property_test is lazy shortcut. Each skip needs explicit reason. Guard enforces categories: no_params, strategy_factory, external_io, non_deterministic
|
|
980
|
+
26. **Contract Before Inspect Problem** - ICIDIV's Contract-before-Inspect order causes friction in brownfield development. USBV (Understand → Specify → Build → Validate) with Inspect-before-Contract is more natural
|
|
981
|
+
27. **Process Visibility vs Task Completion** - Agents tend to "just do it" rather than "show what they're doing". Need explicit visibility checkpoints
|
|
982
|
+
28. **Review Gate as Conditional Step** - Review should be automatic trigger at workflow phase boundary (VALIDATE), not separate manual step
|
|
761
983
|
|
|
762
984
|
## Release Process
|
|
763
985
|
|
|
@@ -5,7 +5,9 @@ Reference patterns for @pre/@post contracts and doctests.
|
|
|
5
5
|
Managed by Invar - do not edit directly.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
# Use invar_runtime for lightweight runtime contracts
|
|
9
|
+
# (or 'from deal import pre, post' works too - deal is the underlying library)
|
|
10
|
+
from invar_runtime import post, pre
|
|
9
11
|
|
|
10
12
|
# =============================================================================
|
|
11
13
|
# GOOD: Complete Contract
|
|
@@ -7,7 +7,9 @@ Managed by Invar - do not edit directly.
|
|
|
7
7
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
# Use invar_runtime for lightweight runtime contracts
|
|
11
|
+
# (or 'from deal import pre, post' works too - deal is the underlying library)
|
|
12
|
+
from invar_runtime import post, pre
|
|
11
13
|
from returns.result import Failure, Result, Success
|
|
12
14
|
|
|
13
15
|
# =============================================================================
|