vigil-codeintel 0.1.0__py3-none-any.whl
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.
- vigil_codeintel-0.1.0.dist-info/METADATA +780 -0
- vigil_codeintel-0.1.0.dist-info/RECORD +131 -0
- vigil_codeintel-0.1.0.dist-info/WHEEL +5 -0
- vigil_codeintel-0.1.0.dist-info/entry_points.txt +3 -0
- vigil_codeintel-0.1.0.dist-info/licenses/LICENSE +21 -0
- vigil_codeintel-0.1.0.dist-info/top_level.txt +3 -0
- vigil_forensic/__init__.py +224 -0
- vigil_forensic/_git_utils.py +178 -0
- vigil_forensic/_shared.py +510 -0
- vigil_forensic/_stubs.py +156 -0
- vigil_forensic/gate_checks/__init__.py +1 -0
- vigil_forensic/gate_checks/_ast_helpers.py +629 -0
- vigil_forensic/gate_checks/_deployment_detector.py +573 -0
- vigil_forensic/gate_checks/atomic_write_checks.py +1143 -0
- vigil_forensic/gate_checks/authority_checks.py +95 -0
- vigil_forensic/gate_checks/boundary_breach_checks.py +202 -0
- vigil_forensic/gate_checks/broad_except_checks.py +301 -0
- vigil_forensic/gate_checks/broad_except_hidden_sentinel_checks.py +365 -0
- vigil_forensic/gate_checks/common.py +253 -0
- vigil_forensic/gate_checks/config_safety_checks.py +704 -0
- vigil_forensic/gate_checks/config_ssot_checks.py +78 -0
- vigil_forensic/gate_checks/conflict_checks.py +193 -0
- vigil_forensic/gate_checks/context_fallback_checks.py +697 -0
- vigil_forensic/gate_checks/context_health_checks.py +289 -0
- vigil_forensic/gate_checks/contract_shape_drift_checks.py +459 -0
- vigil_forensic/gate_checks/dirty_baseline_check.py +274 -0
- vigil_forensic/gate_checks/duplication_checks.py +387 -0
- vigil_forensic/gate_checks/embedded_string_checks.py +123 -0
- vigil_forensic/gate_checks/empty_output_checks.py +87 -0
- vigil_forensic/gate_checks/encoding_checks.py +847 -0
- vigil_forensic/gate_checks/export_completeness_checks.py +156 -0
- vigil_forensic/gate_checks/fallback_checks.py +41 -0
- vigil_forensic/gate_checks/file_proliferation_checks.py +171 -0
- vigil_forensic/gate_checks/fix_without_test_checks.py +69 -0
- vigil_forensic/gate_checks/forensic_cluster_runners/__init__.py +9 -0
- vigil_forensic/gate_checks/forensic_cluster_runners/_helpers.py +71 -0
- vigil_forensic/gate_checks/forensic_cluster_runners/advanced_checks.py +322 -0
- vigil_forensic/gate_checks/forensic_cluster_runners/core.py +273 -0
- vigil_forensic/gate_checks/forensic_cluster_runners/integrity_checks.py +203 -0
- vigil_forensic/gate_checks/forensic_cluster_runners/quality_checks.py +666 -0
- vigil_forensic/gate_checks/forensic_clusters/__init__.py +193 -0
- vigil_forensic/gate_checks/forensic_clusters/allowlist.py +426 -0
- vigil_forensic/gate_checks/forensic_clusters/allowlist_writer.py +302 -0
- vigil_forensic/gate_checks/forensic_clusters/api_protocol.py +231 -0
- vigil_forensic/gate_checks/forensic_clusters/async_quality.py +1156 -0
- vigil_forensic/gate_checks/forensic_clusters/code_style.py +808 -0
- vigil_forensic/gate_checks/forensic_clusters/core.py +319 -0
- vigil_forensic/gate_checks/forensic_clusters/data_quality.py +763 -0
- vigil_forensic/gate_checks/forensic_clusters/dead_code.py +480 -0
- vigil_forensic/gate_checks/forensic_clusters/edit_mutation.py +842 -0
- vigil_forensic/gate_checks/forensic_clusters/exception_boundary.py +240 -0
- vigil_forensic/gate_checks/forensic_clusters/legacy_debt.py +556 -0
- vigil_forensic/gate_checks/forensic_clusters/static_analysis.py +834 -0
- vigil_forensic/gate_checks/forensic_clusters/structural_quality.py +298 -0
- vigil_forensic/gate_checks/god_object_zones_checks.py +173 -0
- vigil_forensic/gate_checks/hallucination_checks.py +566 -0
- vigil_forensic/gate_checks/hunter_artifact_completeness_check.py +139 -0
- vigil_forensic/gate_checks/implementation_overfit_checks.py +380 -0
- vigil_forensic/gate_checks/import_integrity_checks.py +233 -0
- vigil_forensic/gate_checks/imports_in_function_checks.py +283 -0
- vigil_forensic/gate_checks/ml_checks.py +318 -0
- vigil_forensic/gate_checks/performance_checks.py +106 -0
- vigil_forensic/gate_checks/project_specific_runner.py +691 -0
- vigil_forensic/gate_checks/provider_capability_checks.py +73 -0
- vigil_forensic/gate_checks/refactor_completeness_checks.py +274 -0
- vigil_forensic/gate_checks/reliability_checks.py +389 -0
- vigil_forensic/gate_checks/reporting_checks.py +55 -0
- vigil_forensic/gate_checks/runtime_behavior_checks.py +220 -0
- vigil_forensic/gate_checks/security_injection_checks.py +332 -0
- vigil_forensic/gate_checks/semantic_intent_checks.py +139 -0
- vigil_forensic/gate_checks/size_complexity_checks.py +336 -0
- vigil_forensic/gate_checks/stuck_feature_flag_checks.py +354 -0
- vigil_forensic/gate_checks/syntax_validity_checks.py +217 -0
- vigil_forensic/gate_checks/temporal_freshness_checks.py +79 -0
- vigil_forensic/gate_checks/test_quality_checks.py +946 -0
- vigil_forensic/gate_checks/testing_checks.py +149 -0
- vigil_forensic/gate_checks/toctou_checks.py +367 -0
- vigil_forensic/gate_checks/type_checking_checks.py +316 -0
- vigil_forensic/gate_models.py +392 -0
- vigil_forensic/gate_packs/__init__.py +1 -0
- vigil_forensic/gate_packs/universal.py +179 -0
- vigil_forensic/gate_profile.json +31 -0
- vigil_forensic/gate_registry.py +21 -0
- vigil_forensic/language_profiles.py +219 -0
- vigil_forensic/meta_findings.py +207 -0
- vigil_forensic/self_audit.py +725 -0
- vigil_forensic/source_analysis.py +175 -0
- vigil_mapper/__init__.py +103 -0
- vigil_mapper/_ast_helpers_minimal.py +229 -0
- vigil_mapper/_extract_imports_impl.py +123 -0
- vigil_mapper/_file_count_guard.py +129 -0
- vigil_mapper/_git_utils.py +178 -0
- vigil_mapper/_runtime_ast.py +438 -0
- vigil_mapper/_runtime_dispatch.py +137 -0
- vigil_mapper/_seed_helpers.py +82 -0
- vigil_mapper/authority_builder.py +1102 -0
- vigil_mapper/cli_entry.py +731 -0
- vigil_mapper/conflict_builder.py +818 -0
- vigil_mapper/data_contract_builder.py +446 -0
- vigil_mapper/findings_builder.py +716 -0
- vigil_mapper/fingerprint.py +53 -0
- vigil_mapper/hotspot_builder.py +539 -0
- vigil_mapper/map_common.py +449 -0
- vigil_mapper/map_errors.py +55 -0
- vigil_mapper/map_models.py +431 -0
- vigil_mapper/map_models_ext.py +206 -0
- vigil_mapper/map_models_findings.py +130 -0
- vigil_mapper/map_storage.py +455 -0
- vigil_mapper/parse_cache.py +795 -0
- vigil_mapper/refactor_boundary_builder.py +266 -0
- vigil_mapper/runtime_builder.py +527 -0
- vigil_mapper/runtime_tracer.py +243 -0
- vigil_mapper/runtime_tracer_entry.py +199 -0
- vigil_mapper/semantic_diff.py +71 -0
- vigil_mapper/source_adapters/__init__.py +109 -0
- vigil_mapper/source_adapters/_base.py +264 -0
- vigil_mapper/source_adapters/_ir.py +156 -0
- vigil_mapper/source_adapters/_lexer.py +309 -0
- vigil_mapper/source_adapters/_patterns.py +212 -0
- vigil_mapper/source_adapters/_treesitter.py +182 -0
- vigil_mapper/source_adapters/go.py +553 -0
- vigil_mapper/source_adapters/java.py +541 -0
- vigil_mapper/source_adapters/javascript.py +626 -0
- vigil_mapper/source_adapters/python.py +325 -0
- vigil_mapper/source_adapters/typescript.py +749 -0
- vigil_mapper/structural_builder.py +586 -0
- vigil_mcp/__init__.py +1 -0
- vigil_mcp/_jobs.py +587 -0
- vigil_mcp/_paths.py +93 -0
- vigil_mcp/forensic_server.py +419 -0
- vigil_mcp/map_server.py +452 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"""Integrity cluster wrappers -- universal (project-agnostic) clusters.
|
|
2
|
+
|
|
3
|
+
Covers: success proof, proxy-as-truth, config applied, state divergence,
|
|
4
|
+
fallback transparency.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from ...gate_models import GateFinding, PostExecGateContext
|
|
9
|
+
from ..common import normalize_path
|
|
10
|
+
from ..forensic_clusters import (
|
|
11
|
+
ProofRequirement,
|
|
12
|
+
assess_config_applied,
|
|
13
|
+
assess_fallback_transparency,
|
|
14
|
+
assess_source_truthfulness,
|
|
15
|
+
assess_state_consistency,
|
|
16
|
+
assess_success_proof,
|
|
17
|
+
)
|
|
18
|
+
import logging
|
|
19
|
+
_log = logging.getLogger(__name__)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# ---------------------------------------------------------------------------
|
|
23
|
+
# Cluster 2: Success Without Proof
|
|
24
|
+
# ---------------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _check_success_proof(ctx: PostExecGateContext) -> list[GateFinding]:
|
|
28
|
+
"""Cluster 2: Success Without Proof."""
|
|
29
|
+
if not ctx.session_number:
|
|
30
|
+
return []
|
|
31
|
+
|
|
32
|
+
status = {
|
|
33
|
+
"phase": "completed" if ctx.verification_summary.passed else "incomplete",
|
|
34
|
+
"ok": ctx.verification_summary.passed and not ctx.verification_summary.blocking_issues,
|
|
35
|
+
"proof_path": ctx.artifact_refs.get("final_report", ""),
|
|
36
|
+
"forensic_path": ctx.artifact_refs.get("forensic", ""),
|
|
37
|
+
}
|
|
38
|
+
proof_reqs: list[ProofRequirement] = [
|
|
39
|
+
ProofRequirement(name="final_report", field_path="proof_path", required=True),
|
|
40
|
+
]
|
|
41
|
+
if ctx.task_intent == "code_change":
|
|
42
|
+
proof_reqs.append(
|
|
43
|
+
ProofRequirement(name="forensic_report", field_path="forensic_path", required=True),
|
|
44
|
+
)
|
|
45
|
+
return assess_success_proof(status, proof_reqs)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# ---------------------------------------------------------------------------
|
|
49
|
+
# Cluster 4: Config Accepted But Ignored (proof requirements)
|
|
50
|
+
# ---------------------------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
# Maps abstract required_proof names → artifact_refs keys that carry their evidence.
|
|
53
|
+
# Proof names in validation contracts are conceptual (e.g. "verification_commands"),
|
|
54
|
+
# while artifact_refs keys are physical files (e.g. "executor_handoff"). Without this
|
|
55
|
+
# map, every proof name that doesn't literally appear as an artifact key is a structural
|
|
56
|
+
# false positive — the names will never match file-path strings.
|
|
57
|
+
_PROOF_ARTIFACT_MAP: dict[str, tuple[str, ...]] = {
|
|
58
|
+
"structured_handoff": ("executor_handoff",),
|
|
59
|
+
"verification_commands": ("executor_handoff",),
|
|
60
|
+
"truth_surface_proof": ("executor_handoff", "forensic"),
|
|
61
|
+
"commit_proof": ("executor_handoff",),
|
|
62
|
+
"remote_file_truth": ("executor_handoff",),
|
|
63
|
+
"hook_compatibility": ("stream_trace", "executor_handoff"),
|
|
64
|
+
"forensic_summary": ("forensic",),
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _proof_is_consumed(proof_name: str, refs: dict[str, str]) -> bool:
|
|
69
|
+
"""Return True if a required proof is satisfied by available artifacts.
|
|
70
|
+
|
|
71
|
+
Check order:
|
|
72
|
+
1. Direct key match in artifact_refs.
|
|
73
|
+
2. Known proof→artifact mapping (_PROOF_ARTIFACT_MAP).
|
|
74
|
+
3. Partial string matching (legacy fallback for unlisted proof names).
|
|
75
|
+
"""
|
|
76
|
+
if proof_name in refs:
|
|
77
|
+
return True
|
|
78
|
+
artifact_keys = _PROOF_ARTIFACT_MAP.get(proof_name)
|
|
79
|
+
if artifact_keys:
|
|
80
|
+
return any(bool(refs.get(k)) for k in artifact_keys)
|
|
81
|
+
return any(
|
|
82
|
+
proof_name.startswith(k) or k.startswith(proof_name.replace("_report", ""))
|
|
83
|
+
for k in refs
|
|
84
|
+
) or any(proof_name in str(v) for v in refs.values())
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _check_config_applied(ctx: PostExecGateContext) -> list[GateFinding]:
|
|
88
|
+
"""Cluster 4: Config Accepted But Ignored (proof requirements)."""
|
|
89
|
+
findings: list[GateFinding] = []
|
|
90
|
+
contract = ctx.validation_contract
|
|
91
|
+
required_proofs = getattr(contract, "required_proofs", None)
|
|
92
|
+
if not required_proofs:
|
|
93
|
+
return findings
|
|
94
|
+
|
|
95
|
+
has_session = bool(ctx.session_number) and bool(ctx.artifact_refs)
|
|
96
|
+
if not has_session:
|
|
97
|
+
return findings
|
|
98
|
+
|
|
99
|
+
refs = ctx.artifact_refs or {}
|
|
100
|
+
for proof_name in required_proofs:
|
|
101
|
+
persisted = bool(proof_name)
|
|
102
|
+
consumed = _proof_is_consumed(proof_name, refs)
|
|
103
|
+
findings.extend(assess_config_applied(proof_name, proof_name, persisted, consumed))
|
|
104
|
+
return findings
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
# ---------------------------------------------------------------------------
|
|
108
|
+
# Cluster 6: State Divergence
|
|
109
|
+
# ---------------------------------------------------------------------------
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _check_state_divergence(ctx: PostExecGateContext) -> list[GateFinding]:
|
|
113
|
+
"""Cluster 6: State Divergence."""
|
|
114
|
+
if not ctx.changed_files_reported or not ctx.changed_files_observed:
|
|
115
|
+
return []
|
|
116
|
+
reported_set = frozenset(normalize_path(f) for f in ctx.changed_files_reported)
|
|
117
|
+
observed_set = frozenset(normalize_path(f) for f in ctx.changed_files_observed)
|
|
118
|
+
return assess_state_consistency(
|
|
119
|
+
representations={"reported": reported_set, "observed": observed_set},
|
|
120
|
+
expected_equal_keys=[("reported", "observed")],
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# ---------------------------------------------------------------------------
|
|
125
|
+
# Cluster 7: Fallback Hides Truth
|
|
126
|
+
# ---------------------------------------------------------------------------
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _check_fallback_transparency(ctx: PostExecGateContext) -> list[GateFinding]:
|
|
130
|
+
"""Cluster 7: Fallback Hides Truth."""
|
|
131
|
+
remote_mode = "remote_authoritative" in ctx.transport_mode
|
|
132
|
+
if not remote_mode:
|
|
133
|
+
return []
|
|
134
|
+
has_remote_proof = bool(ctx.artifact_refs.get("remote_commit_proof"))
|
|
135
|
+
return assess_fallback_transparency(
|
|
136
|
+
primary_available=True,
|
|
137
|
+
fallback_used=not has_remote_proof,
|
|
138
|
+
degradation_labeled=False,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# ---------------------------------------------------------------------------
|
|
143
|
+
# Cluster 3: Proxy as Truth
|
|
144
|
+
# ---------------------------------------------------------------------------
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def _check_proxy_as_truth(ctx: PostExecGateContext) -> list[GateFinding]:
|
|
148
|
+
"""Cluster 3: Check truth-source labeling honesty."""
|
|
149
|
+
remote_mode = "remote_authoritative" in ctx.transport_mode
|
|
150
|
+
if not remote_mode:
|
|
151
|
+
return []
|
|
152
|
+
|
|
153
|
+
has_remote_proof = bool(ctx.artifact_refs.get("remote_commit_proof"))
|
|
154
|
+
has_local_only = not has_remote_proof and bool(ctx.artifact_refs.get("final_report"))
|
|
155
|
+
|
|
156
|
+
if has_remote_proof:
|
|
157
|
+
return assess_source_truthfulness(
|
|
158
|
+
stated_source="authoritative",
|
|
159
|
+
actual_source="authoritative",
|
|
160
|
+
label_shown="remote commit verified",
|
|
161
|
+
)
|
|
162
|
+
elif has_local_only:
|
|
163
|
+
return assess_source_truthfulness(
|
|
164
|
+
stated_source="authoritative",
|
|
165
|
+
actual_source="proxy",
|
|
166
|
+
label_shown="local artifacts only in remote-authoritative mode",
|
|
167
|
+
)
|
|
168
|
+
else:
|
|
169
|
+
return []
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
# ---------------------------------------------------------------------------
|
|
173
|
+
# Cluster 4 expansion: Config beyond proof-only
|
|
174
|
+
# ---------------------------------------------------------------------------
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def _check_config_general(ctx: PostExecGateContext) -> list[GateFinding]:
|
|
178
|
+
"""Cluster 4 expanded: Check broader config acceptance patterns."""
|
|
179
|
+
findings: list[GateFinding] = []
|
|
180
|
+
|
|
181
|
+
transport = ctx.transport_mode or ""
|
|
182
|
+
project_mode = getattr(ctx, "project_mode", "") or ""
|
|
183
|
+
if transport and project_mode:
|
|
184
|
+
consistent = transport == project_mode or project_mode in transport
|
|
185
|
+
findings.extend(assess_config_applied(
|
|
186
|
+
config_key="transport_mode",
|
|
187
|
+
config_value=transport,
|
|
188
|
+
persisted=True,
|
|
189
|
+
consumed_by_runtime=consistent,
|
|
190
|
+
))
|
|
191
|
+
|
|
192
|
+
contract = ctx.validation_contract
|
|
193
|
+
contract_class = getattr(contract, "task_classification", "") or ""
|
|
194
|
+
if contract_class and ctx.task_intent:
|
|
195
|
+
consistent = contract_class == ctx.task_intent or ctx.task_intent in contract_class
|
|
196
|
+
findings.extend(assess_config_applied(
|
|
197
|
+
config_key="task_classification",
|
|
198
|
+
config_value=contract_class,
|
|
199
|
+
persisted=True,
|
|
200
|
+
consumed_by_runtime=consistent,
|
|
201
|
+
))
|
|
202
|
+
|
|
203
|
+
return findings
|