-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstate.py
More file actions
131 lines (121 loc) · 3.09 KB
/
Copy pathstate.py
File metadata and controls
131 lines (121 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
"""Public state API facade.
State internals live in `engine._state`; this module exposes the
stable, non-private API used by commands, review flows, and language phases.
"""
from typing import NamedTuple
from engine._state.filtering import (
add_ignore,
finding_in_scan_scope,
is_ignored,
make_finding,
open_scope_breakdown,
path_scoped_findings,
remove_ignored_findings,
)
from engine._state.merge import (
MergeScanOptions,
find_suspect_detectors,
merge_scan,
upsert_findings,
)
from engine._state.noise import (
DEFAULT_FINDING_NOISE_BUDGET,
DEFAULT_FINDING_NOISE_GLOBAL_BUDGET,
apply_finding_noise_budget,
resolve_finding_noise_budget,
resolve_finding_noise_global_budget,
resolve_finding_noise_settings,
)
from engine._state.persistence import load_state, save_state
from engine._state.resolution import (
coerce_assessment_score,
match_findings,
resolve_findings,
)
from engine._state.schema import (
CURRENT_VERSION,
STATE_DIR,
STATE_FILE,
ConcernDismissal,
DimensionScore,
Finding,
StateModel,
StateStats,
SubjectiveAssessment,
SubjectiveIntegrity,
empty_state,
ensure_state_defaults,
get_objective_score,
get_overall_score,
get_strict_score,
get_verified_strict_score,
json_default,
utc_now,
validate_state_invariants,
)
from engine._state.scoring import (
suppression_metrics,
)
class ScoreSnapshot(NamedTuple):
"""All four canonical scores from a single state dict."""
overall: float | None
objective: float | None
strict: float | None
verified: float | None
def score_snapshot(state: StateModel) -> ScoreSnapshot:
"""Load all four canonical scores from *state* in one call."""
return ScoreSnapshot(
overall=get_overall_score(state),
objective=get_objective_score(state),
strict=get_strict_score(state),
verified=get_verified_strict_score(state),
)
__all__ = [
# Types
"ConcernDismissal",
"DimensionScore",
"Finding",
"MergeScanOptions",
"ScoreSnapshot",
"StateModel",
"StateStats",
"SubjectiveAssessment",
"SubjectiveIntegrity",
# Constants
"CURRENT_VERSION",
"DEFAULT_FINDING_NOISE_BUDGET",
"DEFAULT_FINDING_NOISE_GLOBAL_BUDGET",
"STATE_DIR",
"STATE_FILE",
# Functions
"add_ignore",
"apply_finding_noise_budget",
"coerce_assessment_score",
"empty_state",
"ensure_state_defaults",
"find_suspect_detectors",
"finding_in_scan_scope",
"get_objective_score",
"get_overall_score",
"open_scope_breakdown",
"get_strict_score",
"get_verified_strict_score",
"is_ignored",
"json_default",
"load_state",
"make_finding",
"match_findings",
"merge_scan",
"path_scoped_findings",
"remove_ignored_findings",
"resolve_finding_noise_budget",
"resolve_finding_noise_global_budget",
"resolve_finding_noise_settings",
"resolve_findings",
"save_state",
"score_snapshot",
"suppression_metrics",
"upsert_findings",
"utc_now",
"validate_state_invariants",
]