trikon 0.3.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.
Files changed (166) hide show
  1. trikon-0.3.0/.github/workflows/ci.yml +105 -0
  2. trikon-0.3.0/.github/workflows/publish.yml +72 -0
  3. trikon-0.3.0/.gitignore +47 -0
  4. trikon-0.3.0/.kiro/specs/change-intelligence/.config.kiro +1 -0
  5. trikon-0.3.0/.kiro/specs/change-intelligence/design.md +965 -0
  6. trikon-0.3.0/.kiro/specs/change-intelligence/requirements.md +89 -0
  7. trikon-0.3.0/.kiro/specs/change-intelligence/tasks.md +287 -0
  8. trikon-0.3.0/.kiro/specs/change-intelligence/tasks.meta.json +647 -0
  9. trikon-0.3.0/.kiro/specs/policy-engine/.config.kiro +1 -0
  10. trikon-0.3.0/.kiro/specs/policy-engine/design.md +1746 -0
  11. trikon-0.3.0/.kiro/specs/policy-engine/requirements.md +120 -0
  12. trikon-0.3.0/.kiro/specs/policy-engine/tasks.md +389 -0
  13. trikon-0.3.0/.kiro/specs/policy-engine/tasks.meta.json +504 -0
  14. trikon-0.3.0/.kiro/specs/verification-runner/.config.kiro +1 -0
  15. trikon-0.3.0/.kiro/specs/verification-runner/design.md +1490 -0
  16. trikon-0.3.0/.kiro/specs/verification-runner/requirements.md +104 -0
  17. trikon-0.3.0/.kiro/specs/verification-runner/tasks.md +431 -0
  18. trikon-0.3.0/.kiro/specs/verification-runner/tasks.meta.json +722 -0
  19. trikon-0.3.0/.pre-commit-config.yaml +29 -0
  20. trikon-0.3.0/ARCHITECTURE.md +558 -0
  21. trikon-0.3.0/CHANGELOG.md +58 -0
  22. trikon-0.3.0/Dockerfile.sandbox +49 -0
  23. trikon-0.3.0/EXECUTION_PLAN.md +417 -0
  24. trikon-0.3.0/LICENSE +201 -0
  25. trikon-0.3.0/OPERATIONS.md +452 -0
  26. trikon-0.3.0/PKG-INFO +153 -0
  27. trikon-0.3.0/PRICING.md +245 -0
  28. trikon-0.3.0/README.md +113 -0
  29. trikon-0.3.0/docs/change_intel.md +77 -0
  30. trikon-0.3.0/docs/mcp-integration.md +123 -0
  31. trikon-0.3.0/docs/mcp_integration.md +106 -0
  32. trikon-0.3.0/docs/policy.md +311 -0
  33. trikon-0.3.0/docs/policy_dsl.md +142 -0
  34. trikon-0.3.0/docs/quickstart.md +97 -0
  35. trikon-0.3.0/docs/verification.md +305 -0
  36. trikon-0.3.0/docs/worked_example.md +191 -0
  37. trikon-0.3.0/docs-site/README.md +48 -0
  38. trikon-0.3.0/docs-site/api-reference/introduction.mdx +76 -0
  39. trikon-0.3.0/docs-site/api-reference/policies.mdx +93 -0
  40. trikon-0.3.0/docs-site/api-reference/verdicts.mdx +107 -0
  41. trikon-0.3.0/docs-site/changelog.mdx +34 -0
  42. trikon-0.3.0/docs-site/cli/init.mdx +55 -0
  43. trikon-0.3.0/docs-site/cli/mcp.mdx +52 -0
  44. trikon-0.3.0/docs-site/cli/overview.mdx +53 -0
  45. trikon-0.3.0/docs-site/cli/verify.mdx +70 -0
  46. trikon-0.3.0/docs-site/concepts/audit-log.mdx +89 -0
  47. trikon-0.3.0/docs-site/concepts/blast-radius.mdx +141 -0
  48. trikon-0.3.0/docs-site/concepts/policy-dsl.mdx +186 -0
  49. trikon-0.3.0/docs-site/concepts/verdicts.mdx +142 -0
  50. trikon-0.3.0/docs-site/deployment/enterprise.mdx +112 -0
  51. trikon-0.3.0/docs-site/deployment/team-tier.mdx +101 -0
  52. trikon-0.3.0/docs-site/docs.json +162 -0
  53. trikon-0.3.0/docs-site/installation.mdx +112 -0
  54. trikon-0.3.0/docs-site/integrations/claude-code.mdx +112 -0
  55. trikon-0.3.0/docs-site/integrations/cursor.mdx +59 -0
  56. trikon-0.3.0/docs-site/integrations/github-actions.mdx +99 -0
  57. trikon-0.3.0/docs-site/integrations/github-app.mdx +64 -0
  58. trikon-0.3.0/docs-site/integrations/mcp.mdx +91 -0
  59. trikon-0.3.0/docs-site/integrations/unideploy.mdx +97 -0
  60. trikon-0.3.0/docs-site/introduction.mdx +80 -0
  61. trikon-0.3.0/docs-site/policy/authoring.mdx +300 -0
  62. trikon-0.3.0/docs-site/policy/overview.mdx +140 -0
  63. trikon-0.3.0/docs-site/policy/troubleshooting.mdx +198 -0
  64. trikon-0.3.0/docs-site/pricing.mdx +121 -0
  65. trikon-0.3.0/docs-site/quickstart.mdx +128 -0
  66. trikon-0.3.0/docs-site/security.mdx +93 -0
  67. trikon-0.3.0/docs-site/verification/overview.mdx +148 -0
  68. trikon-0.3.0/docs-site/verification/plugin-authoring.mdx +188 -0
  69. trikon-0.3.0/docs-site/verification/troubleshooting.mdx +148 -0
  70. trikon-0.3.0/examples/policies/default.yaml +91 -0
  71. trikon-0.3.0/examples/sample_repo/README.md +61 -0
  72. trikon-0.3.0/examples/sample_repo/conftest.py +9 -0
  73. trikon-0.3.0/examples/sample_repo/pyproject.toml +16 -0
  74. trikon-0.3.0/examples/sample_repo/src/api/__init__.py +4 -0
  75. trikon-0.3.0/examples/sample_repo/src/api/payments.py +22 -0
  76. trikon-0.3.0/examples/sample_repo/src/orders/__init__.py +4 -0
  77. trikon-0.3.0/examples/sample_repo/src/orders/worker.py +52 -0
  78. trikon-0.3.0/examples/sample_repo/src/payments/__init__.py +4 -0
  79. trikon-0.3.0/examples/sample_repo/src/payments/gateway.py +48 -0
  80. trikon-0.3.0/examples/sample_repo/src/payments/retry.py +40 -0
  81. trikon-0.3.0/examples/sample_repo/tests/__init__.py +0 -0
  82. trikon-0.3.0/examples/sample_repo/tests/api/__init__.py +0 -0
  83. trikon-0.3.0/examples/sample_repo/tests/api/test_payments.py +26 -0
  84. trikon-0.3.0/examples/sample_repo/tests/test_gateway.py +27 -0
  85. trikon-0.3.0/examples/sample_repo/tests/test_retry.py +48 -0
  86. trikon-0.3.0/examples/sample_repo/tests/test_worker.py +37 -0
  87. trikon-0.3.0/infra/README.md +31 -0
  88. trikon-0.3.0/infra/app.py +25 -0
  89. trikon-0.3.0/infra/requirements.txt +2 -0
  90. trikon-0.3.0/infra/stacks/__init__.py +0 -0
  91. trikon-0.3.0/infra/stacks/api_stack.py +42 -0
  92. trikon-0.3.0/pyproject.toml +132 -0
  93. trikon-0.3.0/tests/README.md +16 -0
  94. trikon-0.3.0/tests/__init__.py +0 -0
  95. trikon-0.3.0/tests/benchmarks/__init__.py +0 -0
  96. trikon-0.3.0/tests/benchmarks/test_perf.py +395 -0
  97. trikon-0.3.0/tests/fixtures/expected_impact/README.md +86 -0
  98. trikon-0.3.0/tests/fixtures/expected_impact/bad_retry.json +47 -0
  99. trikon-0.3.0/tests/fixtures/expected_impact/clean_refactor.json +26 -0
  100. trikon-0.3.0/tests/fixtures/expected_impact/deleted_file.json +53 -0
  101. trikon-0.3.0/tests/fixtures/expected_impact/no_python_change.json +11 -0
  102. trikon-0.3.0/tests/fixtures/expected_impact/sensitive_touch.json +51 -0
  103. trikon-0.3.0/tests/fixtures/scenarios/README.md +133 -0
  104. trikon-0.3.0/tests/fixtures/scenarios/bad_retry.patch +12 -0
  105. trikon-0.3.0/tests/fixtures/scenarios/clean_refactor.patch +25 -0
  106. trikon-0.3.0/tests/fixtures/scenarios/deleted_file.patch +68 -0
  107. trikon-0.3.0/tests/fixtures/scenarios/no_python_change.patch +13 -0
  108. trikon-0.3.0/tests/fixtures/scenarios/sensitive_touch.patch +27 -0
  109. trikon-0.3.0/tests/integration/__init__.py +0 -0
  110. trikon-0.3.0/tests/integration/change_intel/__init__.py +0 -0
  111. trikon-0.3.0/tests/integration/change_intel/test_end_to_end_sample_repo.py +480 -0
  112. trikon-0.3.0/tests/integration/change_intel/test_never_fail_open.py +304 -0
  113. trikon-0.3.0/tests/unit/__init__.py +0 -0
  114. trikon-0.3.0/tests/unit/change_intel/__init__.py +0 -0
  115. trikon-0.3.0/tests/unit/change_intel/strategies.py +254 -0
  116. trikon-0.3.0/tests/unit/change_intel/test_ast_indexer_cached.py +245 -0
  117. trikon-0.3.0/tests/unit/change_intel/test_ast_indexer_fast.py +416 -0
  118. trikon-0.3.0/tests/unit/change_intel/test_blast_radius.py +937 -0
  119. trikon-0.3.0/tests/unit/change_intel/test_dep_graph.py +650 -0
  120. trikon-0.3.0/tests/unit/change_intel/test_diff_parser.py +499 -0
  121. trikon-0.3.0/tests/unit/change_intel/test_errors_and_models.py +391 -0
  122. trikon-0.3.0/tests/unit/change_intel/test_symbol_resolver.py +703 -0
  123. trikon-0.3.0/tests/unit/test_policy_evaluator.py +38 -0
  124. trikon-0.3.0/tests/unit/verify/__init__.py +0 -0
  125. trikon-0.3.0/tests/unit/verify/test_static_checks_smoke.py +156 -0
  126. trikon-0.3.0/trikon/__init__.py +23 -0
  127. trikon-0.3.0/trikon/audit_log/__init__.py +31 -0
  128. trikon-0.3.0/trikon/audit_log/db.py +116 -0
  129. trikon-0.3.0/trikon/audit_log/writer.py +120 -0
  130. trikon-0.3.0/trikon/change_intel/__init__.py +69 -0
  131. trikon-0.3.0/trikon/change_intel/ast_indexer.py +562 -0
  132. trikon-0.3.0/trikon/change_intel/blast_radius.py +730 -0
  133. trikon-0.3.0/trikon/change_intel/dep_graph.py +765 -0
  134. trikon-0.3.0/trikon/change_intel/diff_parser.py +345 -0
  135. trikon-0.3.0/trikon/change_intel/errors.py +115 -0
  136. trikon-0.3.0/trikon/change_intel/models.py +193 -0
  137. trikon-0.3.0/trikon/change_intel/symbol_resolver.py +341 -0
  138. trikon-0.3.0/trikon/cli.py +550 -0
  139. trikon-0.3.0/trikon/evidence/__init__.py +5 -0
  140. trikon-0.3.0/trikon/evidence/formatters/__init__.py +10 -0
  141. trikon-0.3.0/trikon/evidence/formatters/json.py +15 -0
  142. trikon-0.3.0/trikon/evidence/formatters/markdown.py +200 -0
  143. trikon-0.3.0/trikon/evidence/formatters/verify_text.py +226 -0
  144. trikon-0.3.0/trikon/evidence/report.py +224 -0
  145. trikon-0.3.0/trikon/exceptions.py +26 -0
  146. trikon-0.3.0/trikon/integrations/__init__.py +10 -0
  147. trikon-0.3.0/trikon/integrations/mcp_server.py +263 -0
  148. trikon-0.3.0/trikon/policy/__init__.py +25 -0
  149. trikon-0.3.0/trikon/policy/default_policy.yaml +92 -0
  150. trikon-0.3.0/trikon/policy/dsl.py +49 -0
  151. trikon-0.3.0/trikon/policy/errors.py +67 -0
  152. trikon-0.3.0/trikon/policy/evaluator.py +275 -0
  153. trikon-0.3.0/trikon/policy/loader.py +125 -0
  154. trikon-0.3.0/trikon/sdk.py +282 -0
  155. trikon-0.3.0/trikon/verify/__init__.py +48 -0
  156. trikon-0.3.0/trikon/verify/coverage_builder.py +794 -0
  157. trikon-0.3.0/trikon/verify/db.py +131 -0
  158. trikon-0.3.0/trikon/verify/errors.py +96 -0
  159. trikon-0.3.0/trikon/verify/local_sandbox.py +365 -0
  160. trikon-0.3.0/trikon/verify/models.py +201 -0
  161. trikon-0.3.0/trikon/verify/plugins.py +369 -0
  162. trikon-0.3.0/trikon/verify/runner.py +888 -0
  163. trikon-0.3.0/trikon/verify/sandbox.py +682 -0
  164. trikon-0.3.0/trikon/verify/static_checks.py +931 -0
  165. trikon-0.3.0/trikon/verify/test_selector.py +409 -0
  166. trikon-0.3.0/uv.lock +1552 -0
@@ -0,0 +1,105 @@
1
+ # Trikon CI — see design.md §9.1 and .kiro/specs/change-intelligence/design.md §Testing Strategy.
2
+ #
3
+ # This workflow is expected to be RED until Phase 1 lands its full test suite
4
+ # (see EXECUTION_PLAN.md Phase 1 tasks 5-10). Once task 14.1 closes, this
5
+ # workflow is required-passing on every PR to main.
6
+ #
7
+ # Note: mypy is scoped to `trikon/change_intel/` in Phase 1. Widening to
8
+ # `trikon/evidence/` is deferred until pre-existing `disallow_any_explicit`
9
+ # violations in the evidence-report models are cleaned up.
10
+ # The `perf` job is added in Task 12.2.
11
+
12
+ name: ci
13
+ on:
14
+ pull_request:
15
+ push:
16
+ branches: [main]
17
+ schedule:
18
+ # Nightly at 06:00 UTC — runs perf-nightly and integration-verify (see Task 14.3).
19
+ - cron: '0 6 * * *'
20
+
21
+ jobs:
22
+ lint-type-test:
23
+ runs-on: ubuntu-latest
24
+ strategy:
25
+ matrix:
26
+ python-version: ["3.11", "3.12"]
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - uses: actions/setup-python@v5
30
+ with:
31
+ python-version: ${{ matrix.python-version }}
32
+ cache: pip
33
+ - run: pip install -e ".[dev]"
34
+ - run: ruff check trikon/ tests/
35
+ - run: ruff format --check trikon/ tests/
36
+ - run: mypy --strict trikon/change_intel/
37
+ - run: pytest tests/unit/ --cov=trikon.change_intel --cov-branch --cov-report=xml
38
+ - run: coverage report --fail-under=90 --include='trikon/change_intel/*'
39
+
40
+ integration:
41
+ runs-on: ubuntu-latest
42
+ needs: lint-type-test
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+ - uses: actions/setup-python@v5
46
+ with:
47
+ python-version: "3.12"
48
+ - run: pip install -e ".[dev]"
49
+ - run: pytest tests/integration/ -v
50
+
51
+ perf:
52
+ runs-on: ubuntu-latest
53
+ if: github.event_name == 'pull_request'
54
+ needs: lint-type-test
55
+ steps:
56
+ - uses: actions/checkout@v4
57
+ - uses: actions/setup-python@v5
58
+ with:
59
+ python-version: "3.12"
60
+ - run: pip install -e ".[dev]"
61
+ - name: Run always-on benchmarks
62
+ run: pytest tests/benchmarks/ --benchmark-only --benchmark-max-time=60 --no-cov -m "slow and not django"
63
+
64
+ # Nightly perf gate for the Verification Runner (Phase 2, Task 14.3).
65
+ # Distinct from the Phase-1 `perf` job above: that one runs on PRs against
66
+ # the change_intel benchmarks; this one runs on schedule against the verify
67
+ # benchmarks with the pinned sandbox image built fresh. Gates the wall-clock
68
+ # ceilings from Requirement 8.1 / 8.2 / 8.3.
69
+ perf-nightly:
70
+ runs-on: ubuntu-latest
71
+ if: github.event_name == 'schedule'
72
+ needs: lint-type-test
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+ - uses: actions/setup-python@v5
76
+ with:
77
+ python-version: "3.11"
78
+ cache: pip
79
+ - uses: docker/setup-buildx-action@v3
80
+ - name: Build pinned sandbox image (trikon/sandbox:0.1.0)
81
+ run: ./scripts/build_sandbox_image.sh
82
+ - run: pip install -e ".[dev]"
83
+ - name: Run nightly verify perf benchmarks
84
+ run: pytest tests/benchmarks/ -m perf --benchmark-only --benchmark-max-time=60
85
+
86
+ # Nightly integration tests for `trikon/verify/**` (Task 14.3).
87
+ # Requires a live Docker daemon and the pinned sandbox image; runs the
88
+ # opt-in integration suite that the default `pytest` invocation excludes
89
+ # via the `-m 'not perf and not integration'` addopts in pyproject.toml.
90
+ integration-verify:
91
+ runs-on: ubuntu-latest
92
+ if: github.event_name == 'schedule'
93
+ needs: lint-type-test
94
+ steps:
95
+ - uses: actions/checkout@v4
96
+ - uses: actions/setup-python@v5
97
+ with:
98
+ python-version: "3.11"
99
+ cache: pip
100
+ - uses: docker/setup-buildx-action@v3
101
+ - name: Build pinned sandbox image (trikon/sandbox:0.1.0)
102
+ run: ./scripts/build_sandbox_image.sh
103
+ - run: pip install -e ".[dev]"
104
+ - name: Run verify integration tests
105
+ run: pytest tests/integration/verify/ -m integration
@@ -0,0 +1,72 @@
1
+ name: Publish to PyPI
2
+
3
+ # Triggered by pushing a tag matching v* (e.g. v0.3.0, v0.3.1, v1.0.0).
4
+ # Publishes both the wheel and the sdist to PyPI via the trusted-publisher
5
+ # (OIDC) pattern: no long-lived API token needs to live in repo secrets.
6
+ #
7
+ # Trusted-publisher setup (do this ONCE in the PyPI project settings):
8
+ # 1. Create the trikon project on PyPI (or claim the existing one).
9
+ # 2. Under "Publishing" -> "Add a new pending publisher", register:
10
+ # Owner: suryansh639
11
+ # Repository: Trikon
12
+ # Workflow name: publish.yml
13
+ # Environment name: pypi (recommended; matches the environment: below)
14
+ # 3. Push a tag: `git tag v0.3.0 && git push origin v0.3.0`.
15
+ #
16
+ # After the first successful publish, the "pending publisher" becomes a
17
+ # permanent one and subsequent tags publish automatically.
18
+
19
+ on:
20
+ push:
21
+ tags:
22
+ - "v*"
23
+
24
+ # Every workflow that requests an OIDC token must set id-token: write at
25
+ # the job level (or workflow level as here). Actions defaults to none.
26
+ permissions:
27
+ contents: read
28
+ id-token: write
29
+
30
+ jobs:
31
+ build:
32
+ name: Build wheel + sdist
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+
37
+ - name: Set up Python
38
+ uses: actions/setup-python@v5
39
+ with:
40
+ python-version: "3.12"
41
+
42
+ - name: Install build tooling
43
+ run: python -m pip install --upgrade build
44
+
45
+ - name: Build wheel + sdist
46
+ run: python -m build
47
+
48
+ - name: Upload dist artifacts
49
+ uses: actions/upload-artifact@v4
50
+ with:
51
+ name: dist
52
+ path: dist/
53
+
54
+ publish:
55
+ name: Publish to PyPI
56
+ needs: build
57
+ runs-on: ubuntu-latest
58
+ environment:
59
+ name: pypi
60
+ url: https://pypi.org/project/trikon/
61
+ steps:
62
+ - name: Download dist artifacts
63
+ uses: actions/download-artifact@v4
64
+ with:
65
+ name: dist
66
+ path: dist/
67
+
68
+ - name: Publish to PyPI
69
+ uses: pypa/gh-action-pypi-publish@release/v1
70
+ with:
71
+ # No password/api-token — the action uses OIDC via id-token: write.
72
+ skip-existing: true
@@ -0,0 +1,47 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ .eggs/
11
+ .pytest_cache/
12
+ .mypy_cache/
13
+ .ruff_cache/
14
+ htmlcov/
15
+ .coverage
16
+ .coverage.*
17
+ coverage.xml
18
+
19
+ # venvs
20
+ .venv/
21
+ venv/
22
+ env/
23
+
24
+ # IDE
25
+ .idea/
26
+ .vscode/
27
+ *.swp
28
+
29
+ # Trikon local state
30
+ .trikon/
31
+ *.trikon.db
32
+
33
+ # helper scripts (never commit)
34
+ _*.sh
35
+ _*.py
36
+ # ...but __init__.py files are package markers, not helper scripts.
37
+ # Without this exception, hatchling's VCS-aware file discovery excludes
38
+ # every `__init__.py` from the wheel (because `_*.py` matches
39
+ # `__init__.py`) and `pip install trikon` yields a broken import graph.
40
+ !**/__init__.py
41
+
42
+ # Subagent artifacts (semantic reviews, task-execution transcripts)
43
+ semantic-review/
44
+
45
+ # Test tooling caches
46
+ .hypothesis/
47
+ .benchmarks/
@@ -0,0 +1 @@
1
+ {"specId": "99c87a2e-8ab1-4fd3-aeb4-6c818141d02c", "workflowType": "fast-task", "specType": "feature"}