patchrail 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.
Files changed (47) hide show
  1. patchrail/__init__.py +7 -0
  2. patchrail/__main__.py +7 -0
  3. patchrail/ci/__init__.py +7 -0
  4. patchrail/ci/classify.py +888 -0
  5. patchrail/cli.py +8566 -0
  6. patchrail/funded_issues/__init__.py +138 -0
  7. patchrail/funded_issues/algora_board.py +240 -0
  8. patchrail/funded_issues/blocklist.py +112 -0
  9. patchrail/funded_issues/discovery.py +4091 -0
  10. patchrail/funded_issues/importers.py +316 -0
  11. patchrail/funded_issues/source_noise.py +349 -0
  12. patchrail/funded_issues/store.py +459 -0
  13. patchrail/queue/__init__.py +75 -0
  14. patchrail/queue/server.py +273 -0
  15. patchrail/queue/status.py +756 -0
  16. patchrail/queue/store.py +600 -0
  17. patchrail/reviewer_quick_check.py +650 -0
  18. patchrail/schemas/__init__.py +1 -0
  19. patchrail/schemas/application-dossier.v1.schema.json +305 -0
  20. patchrail/schemas/ci-benchmark.v1.schema.json +174 -0
  21. patchrail/schemas/ci-fixture-check.v1.schema.json +122 -0
  22. patchrail/schemas/ci-pilot-metrics.v1.schema.json +164 -0
  23. patchrail/schemas/ci-pilot-summary.v1.schema.json +146 -0
  24. patchrail/schemas/ci-result.v1.schema.json +133 -0
  25. patchrail/schemas/funded-issues-client-report.v1.schema.json +524 -0
  26. patchrail/schemas/funded-issues-recheck-queue.v1.schema.json +333 -0
  27. patchrail/schemas/funded-issues-recheck-summary.v1.schema.json +136 -0
  28. patchrail/schemas/funded-issues-report.v1.schema.json +836 -0
  29. patchrail/schemas/funded-issues-shortlist.v1.schema.json +953 -0
  30. patchrail/schemas/funded-issues-store-status.v1.schema.json +96 -0
  31. patchrail/schemas/funded-issues-store.v1.schema.json +117 -0
  32. patchrail/schemas/queue-audit-event.v1.schema.json +44 -0
  33. patchrail/schemas/queue-audit-summary.v1.schema.json +169 -0
  34. patchrail/schemas/queue-gate-report.v1.schema.json +158 -0
  35. patchrail/schemas/queue-policy-resolution.v1.schema.json +188 -0
  36. patchrail/schemas/queue-policy-scan.v1.schema.json +175 -0
  37. patchrail/schemas/queue-proposal.v1.schema.json +61 -0
  38. patchrail/schemas/queue-review.v1.schema.json +218 -0
  39. patchrail/schemas/queue-status.v1.schema.json +179 -0
  40. patchrail/schemas/queue-work-item.v1.schema.json +64 -0
  41. patchrail/schemas/reviewer-quick-check-artifacts.v1.schema.json +104 -0
  42. patchrail/web_metrics.py +649 -0
  43. patchrail-0.1.0.dist-info/METADATA +279 -0
  44. patchrail-0.1.0.dist-info/RECORD +47 -0
  45. patchrail-0.1.0.dist-info/WHEEL +4 -0
  46. patchrail-0.1.0.dist-info/entry_points.txt +2 -0
  47. patchrail-0.1.0.dist-info/licenses/LICENSE +202 -0
@@ -0,0 +1,188 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://patchrail.dev/schemas/queue-policy-resolution.v1.schema.json",
4
+ "title": "PatchRail Queue Policy Resolution",
5
+ "description": "Local policy resolution for skipped work items and rejected proposals before reviewer handoff.",
6
+ "type": "object",
7
+ "required": [
8
+ "schema_version",
9
+ "queue_schema_version",
10
+ "patchrail_version",
11
+ "db_path",
12
+ "local_first",
13
+ "status",
14
+ "reason",
15
+ "resolved_records_count",
16
+ "resolved_counts",
17
+ "resolved_records",
18
+ "before_policy_status",
19
+ "after_policy_status",
20
+ "remaining_blocked_records_count",
21
+ "reviewer_actions",
22
+ "safety"
23
+ ],
24
+ "properties": {
25
+ "schema_version": {
26
+ "const": "patchrail.queue_policy_resolution.v1"
27
+ },
28
+ "queue_schema_version": {
29
+ "const": "patchrail.queue.v1"
30
+ },
31
+ "patchrail_version": {
32
+ "type": "string",
33
+ "minLength": 1
34
+ },
35
+ "db_path": {
36
+ "type": "string",
37
+ "minLength": 1
38
+ },
39
+ "local_first": {
40
+ "const": true
41
+ },
42
+ "status": {
43
+ "type": "string",
44
+ "enum": ["resolved_blocked_records", "no_blocked_records"]
45
+ },
46
+ "reason": {
47
+ "type": "string",
48
+ "minLength": 1
49
+ },
50
+ "resolved_records_count": {
51
+ "type": "integer",
52
+ "minimum": 0
53
+ },
54
+ "resolved_counts": {
55
+ "type": "object",
56
+ "required": ["work_items_skipped", "proposals_rejected", "audit_events_added"],
57
+ "properties": {
58
+ "work_items_skipped": { "type": "integer", "minimum": 0 },
59
+ "proposals_rejected": { "type": "integer", "minimum": 0 },
60
+ "audit_events_added": { "type": "integer", "minimum": 0 }
61
+ },
62
+ "additionalProperties": false
63
+ },
64
+ "resolved_records": {
65
+ "type": "array",
66
+ "items": { "$ref": "#/$defs/resolved_record" }
67
+ },
68
+ "before_policy_status": {
69
+ "type": "string",
70
+ "enum": ["policy_clear", "blocked_records_present"]
71
+ },
72
+ "after_policy_status": {
73
+ "type": "string",
74
+ "enum": ["policy_clear", "blocked_records_present"]
75
+ },
76
+ "remaining_blocked_records_count": {
77
+ "type": "integer",
78
+ "minimum": 0
79
+ },
80
+ "reviewer_actions": {
81
+ "type": "array",
82
+ "minItems": 1,
83
+ "items": {
84
+ "type": "string",
85
+ "minLength": 1
86
+ }
87
+ },
88
+ "safety": {
89
+ "type": "object",
90
+ "required": [
91
+ "write_actions_allowed_by_default",
92
+ "github_write_permission_required",
93
+ "network_required",
94
+ "external_model_required",
95
+ "billing_required",
96
+ "approval_records_execute_actions",
97
+ "resolution_is_local_only",
98
+ "resolution_records_audit_event",
99
+ "local_paths_redacted",
100
+ "execution_allowed",
101
+ "github_write_performed",
102
+ "network_performed",
103
+ "proposals_executed",
104
+ "work_items_deleted"
105
+ ],
106
+ "properties": {
107
+ "write_actions_allowed_by_default": { "const": false },
108
+ "github_write_permission_required": { "const": false },
109
+ "network_required": { "const": false },
110
+ "external_model_required": { "const": false },
111
+ "billing_required": { "const": false },
112
+ "approval_records_execute_actions": { "const": false },
113
+ "resolution_is_local_only": { "const": true },
114
+ "resolution_records_audit_event": { "const": true },
115
+ "local_paths_redacted": { "const": true },
116
+ "execution_allowed": { "const": false },
117
+ "github_write_performed": { "const": false },
118
+ "network_performed": { "const": false },
119
+ "proposals_executed": { "const": false },
120
+ "work_items_deleted": { "const": false }
121
+ },
122
+ "additionalProperties": false
123
+ }
124
+ },
125
+ "$defs": {
126
+ "resolved_record": {
127
+ "type": "object",
128
+ "required": [
129
+ "record_type",
130
+ "id",
131
+ "title",
132
+ "action",
133
+ "approval_state_after",
134
+ "status_after",
135
+ "matched_categories",
136
+ "matched_terms"
137
+ ],
138
+ "properties": {
139
+ "record_type": {
140
+ "type": "string",
141
+ "enum": ["work_item", "proposal"]
142
+ },
143
+ "id": {
144
+ "type": "string",
145
+ "minLength": 1
146
+ },
147
+ "work_item_id": {
148
+ "type": "string",
149
+ "minLength": 1
150
+ },
151
+ "title": {
152
+ "type": "string",
153
+ "minLength": 1
154
+ },
155
+ "action": {
156
+ "type": "string",
157
+ "enum": ["skipped", "rejected"]
158
+ },
159
+ "approval_state_after": {
160
+ "type": "string",
161
+ "enum": ["rejected"]
162
+ },
163
+ "status_after": {
164
+ "type": "string",
165
+ "enum": ["skipped", "rejected"]
166
+ },
167
+ "matched_categories": {
168
+ "type": "array",
169
+ "minItems": 1,
170
+ "items": {
171
+ "type": "string",
172
+ "minLength": 1
173
+ }
174
+ },
175
+ "matched_terms": {
176
+ "type": "array",
177
+ "minItems": 1,
178
+ "items": {
179
+ "type": "string",
180
+ "minLength": 1
181
+ }
182
+ }
183
+ },
184
+ "additionalProperties": false
185
+ }
186
+ },
187
+ "additionalProperties": false
188
+ }
@@ -0,0 +1,175 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://patchrail.dev/schemas/queue-policy-scan.v1.schema.json",
4
+ "title": "PatchRail Queue Policy Scan",
5
+ "description": "Read-only policy scan for local queue records before reviewer handoff.",
6
+ "type": "object",
7
+ "required": [
8
+ "schema_version",
9
+ "queue_schema_version",
10
+ "patchrail_version",
11
+ "db_path",
12
+ "local_first",
13
+ "status",
14
+ "blocked_records_count",
15
+ "scanned_counts",
16
+ "policy_categories",
17
+ "matches",
18
+ "reviewer_actions",
19
+ "safety"
20
+ ],
21
+ "properties": {
22
+ "schema_version": {
23
+ "const": "patchrail.queue_policy_scan.v1"
24
+ },
25
+ "queue_schema_version": {
26
+ "const": "patchrail.queue.v1"
27
+ },
28
+ "patchrail_version": {
29
+ "type": "string",
30
+ "minLength": 1
31
+ },
32
+ "db_path": {
33
+ "type": "string",
34
+ "minLength": 1
35
+ },
36
+ "local_first": {
37
+ "const": true
38
+ },
39
+ "status": {
40
+ "type": "string",
41
+ "enum": ["policy_clear", "blocked_records_present"]
42
+ },
43
+ "blocked_records_count": {
44
+ "type": "integer",
45
+ "minimum": 0
46
+ },
47
+ "scanned_counts": {
48
+ "type": "object",
49
+ "required": ["work_items_total", "proposals_total", "audit_events_total"],
50
+ "properties": {
51
+ "work_items_total": { "type": "integer", "minimum": 0 },
52
+ "proposals_total": { "type": "integer", "minimum": 0 },
53
+ "audit_events_total": { "type": "integer", "minimum": 0 }
54
+ },
55
+ "additionalProperties": false
56
+ },
57
+ "policy_categories": {
58
+ "type": "array",
59
+ "minItems": 1,
60
+ "items": {
61
+ "type": "string",
62
+ "minLength": 1
63
+ }
64
+ },
65
+ "matches": {
66
+ "type": "array",
67
+ "items": { "$ref": "#/$defs/policy_match" }
68
+ },
69
+ "reviewer_actions": {
70
+ "type": "array",
71
+ "minItems": 1,
72
+ "items": {
73
+ "type": "string",
74
+ "minLength": 1
75
+ }
76
+ },
77
+ "safety": {
78
+ "type": "object",
79
+ "required": [
80
+ "write_actions_allowed_by_default",
81
+ "github_write_permission_required",
82
+ "network_required",
83
+ "external_model_required",
84
+ "billing_required",
85
+ "approval_records_execute_actions",
86
+ "scan_is_read_only",
87
+ "scan_records_audit_event",
88
+ "local_paths_redacted",
89
+ "execution_allowed"
90
+ ],
91
+ "properties": {
92
+ "write_actions_allowed_by_default": { "const": false },
93
+ "github_write_permission_required": { "const": false },
94
+ "network_required": { "const": false },
95
+ "external_model_required": { "const": false },
96
+ "billing_required": { "const": false },
97
+ "approval_records_execute_actions": { "const": false },
98
+ "scan_is_read_only": { "const": true },
99
+ "scan_records_audit_event": { "const": false },
100
+ "local_paths_redacted": { "const": true },
101
+ "execution_allowed": { "const": false }
102
+ },
103
+ "additionalProperties": false
104
+ }
105
+ },
106
+ "$defs": {
107
+ "policy_match": {
108
+ "type": "object",
109
+ "required": [
110
+ "record_type",
111
+ "id",
112
+ "title",
113
+ "approval_state",
114
+ "matched_categories",
115
+ "matched_terms",
116
+ "recommended_action"
117
+ ],
118
+ "properties": {
119
+ "record_type": {
120
+ "type": "string",
121
+ "enum": ["work_item", "proposal"]
122
+ },
123
+ "id": {
124
+ "type": "string",
125
+ "minLength": 1
126
+ },
127
+ "work_item_id": {
128
+ "type": "string",
129
+ "minLength": 1
130
+ },
131
+ "title": {
132
+ "type": "string",
133
+ "minLength": 1
134
+ },
135
+ "status": {
136
+ "type": "string",
137
+ "minLength": 1
138
+ },
139
+ "risk_level": {
140
+ "type": "string",
141
+ "minLength": 1
142
+ },
143
+ "approval_state": {
144
+ "type": "string",
145
+ "enum": ["pending", "approved", "rejected"]
146
+ },
147
+ "source": {
148
+ "type": "string"
149
+ },
150
+ "matched_categories": {
151
+ "type": "array",
152
+ "minItems": 1,
153
+ "items": {
154
+ "type": "string",
155
+ "minLength": 1
156
+ }
157
+ },
158
+ "matched_terms": {
159
+ "type": "array",
160
+ "minItems": 1,
161
+ "items": {
162
+ "type": "string",
163
+ "minLength": 1
164
+ }
165
+ },
166
+ "recommended_action": {
167
+ "type": "string",
168
+ "enum": ["reject_or_skip_before_handoff", "reject_before_handoff"]
169
+ }
170
+ },
171
+ "additionalProperties": false
172
+ }
173
+ },
174
+ "additionalProperties": false
175
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://patchrail.dev/schemas/queue-proposal.v1.schema.json",
4
+ "title": "PatchRail Queue Proposal",
5
+ "description": "Local patch-plan proposal attached to a PatchRail work item for maintainer review.",
6
+ "type": "object",
7
+ "required": [
8
+ "id",
9
+ "work_item_id",
10
+ "title",
11
+ "summary",
12
+ "patch_plan",
13
+ "risk_level",
14
+ "approval_state",
15
+ "created_at",
16
+ "updated_at",
17
+ "decision_note"
18
+ ],
19
+ "properties": {
20
+ "id": {
21
+ "type": "string",
22
+ "pattern": "^prp_[0-9a-f]{12}$"
23
+ },
24
+ "work_item_id": {
25
+ "type": "string",
26
+ "pattern": "^prq_[0-9a-f]{12}$"
27
+ },
28
+ "title": {
29
+ "type": "string",
30
+ "minLength": 1
31
+ },
32
+ "summary": {
33
+ "type": "string",
34
+ "minLength": 1
35
+ },
36
+ "patch_plan": {
37
+ "type": "string",
38
+ "minLength": 1
39
+ },
40
+ "risk_level": {
41
+ "type": "string",
42
+ "enum": ["low", "medium", "high"]
43
+ },
44
+ "approval_state": {
45
+ "type": "string",
46
+ "enum": ["pending", "approved", "rejected"]
47
+ },
48
+ "created_at": {
49
+ "type": "string",
50
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T"
51
+ },
52
+ "updated_at": {
53
+ "type": "string",
54
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T"
55
+ },
56
+ "decision_note": {
57
+ "type": ["string", "null"]
58
+ }
59
+ },
60
+ "additionalProperties": false
61
+ }
@@ -0,0 +1,218 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://patchrail.dev/schemas/queue-review.v1.schema.json",
4
+ "title": "PatchRail Queue Review Inbox",
5
+ "description": "Compact human-review inbox emitted by patchrail queue review without exporting full queue records.",
6
+ "type": "object",
7
+ "required": [
8
+ "schema_version",
9
+ "queue_schema_version",
10
+ "patchrail_version",
11
+ "db_path",
12
+ "local_first",
13
+ "status",
14
+ "ready_for_reviewer_handoff",
15
+ "pending_decisions",
16
+ "counts",
17
+ "review_groups",
18
+ "reviewer_actions",
19
+ "handoff_checklist",
20
+ "safety"
21
+ ],
22
+ "properties": {
23
+ "schema_version": {
24
+ "const": "patchrail.queue_review.v1"
25
+ },
26
+ "queue_schema_version": {
27
+ "const": "patchrail.queue.v1"
28
+ },
29
+ "patchrail_version": {
30
+ "type": "string",
31
+ "minLength": 1
32
+ },
33
+ "db_path": {
34
+ "type": "string",
35
+ "minLength": 1
36
+ },
37
+ "local_first": {
38
+ "const": true
39
+ },
40
+ "status": {
41
+ "type": "string",
42
+ "enum": ["awaiting_human_review", "clear_for_handoff"]
43
+ },
44
+ "ready_for_reviewer_handoff": {
45
+ "type": "boolean"
46
+ },
47
+ "pending_decisions": {
48
+ "type": "integer",
49
+ "minimum": 0
50
+ },
51
+ "counts": {
52
+ "type": "object"
53
+ },
54
+ "review_groups": {
55
+ "type": "object",
56
+ "required": [
57
+ "pending_work_items",
58
+ "pending_proposals",
59
+ "approved_work_items",
60
+ "approved_proposals",
61
+ "rejected_work_items",
62
+ "rejected_proposals"
63
+ ],
64
+ "properties": {
65
+ "pending_work_items": {
66
+ "type": "array",
67
+ "items": { "$ref": "#/$defs/work_item_review" }
68
+ },
69
+ "pending_proposals": {
70
+ "type": "array",
71
+ "items": { "$ref": "#/$defs/proposal_review" }
72
+ },
73
+ "approved_work_items": {
74
+ "type": "array",
75
+ "items": { "$ref": "#/$defs/work_item_review" }
76
+ },
77
+ "approved_proposals": {
78
+ "type": "array",
79
+ "items": { "$ref": "#/$defs/proposal_review" }
80
+ },
81
+ "rejected_work_items": {
82
+ "type": "array",
83
+ "items": { "$ref": "#/$defs/work_item_review" }
84
+ },
85
+ "rejected_proposals": {
86
+ "type": "array",
87
+ "items": { "$ref": "#/$defs/proposal_review" }
88
+ }
89
+ },
90
+ "additionalProperties": false
91
+ },
92
+ "reviewer_actions": {
93
+ "type": "array",
94
+ "minItems": 1,
95
+ "items": {
96
+ "type": "string",
97
+ "minLength": 1
98
+ }
99
+ },
100
+ "handoff_checklist": {
101
+ "type": "array",
102
+ "minItems": 1,
103
+ "items": { "$ref": "#/$defs/handoff_step" }
104
+ },
105
+ "safety": {
106
+ "type": "object",
107
+ "required": [
108
+ "write_actions_allowed_by_default",
109
+ "github_write_permission_required",
110
+ "network_required",
111
+ "external_model_required",
112
+ "billing_required",
113
+ "approval_records_execute_actions",
114
+ "review_is_read_only",
115
+ "review_records_audit_event",
116
+ "local_paths_redacted",
117
+ "execution_allowed"
118
+ ],
119
+ "properties": {
120
+ "write_actions_allowed_by_default": { "const": false },
121
+ "github_write_permission_required": { "const": false },
122
+ "network_required": { "const": false },
123
+ "external_model_required": { "const": false },
124
+ "billing_required": { "const": false },
125
+ "approval_records_execute_actions": { "const": false },
126
+ "review_is_read_only": { "const": true },
127
+ "review_records_audit_event": { "const": false },
128
+ "local_paths_redacted": { "const": true },
129
+ "execution_allowed": { "const": false }
130
+ },
131
+ "additionalProperties": false
132
+ }
133
+ },
134
+ "$defs": {
135
+ "work_item_review": {
136
+ "type": "object",
137
+ "required": [
138
+ "id",
139
+ "kind",
140
+ "title",
141
+ "source",
142
+ "status",
143
+ "approval_state",
144
+ "write_actions_allowed",
145
+ "decision_note",
146
+ "payload_keys"
147
+ ],
148
+ "properties": {
149
+ "id": { "type": "string", "minLength": 1 },
150
+ "kind": { "type": "string", "minLength": 1 },
151
+ "title": { "type": "string", "minLength": 1 },
152
+ "source": { "type": "string", "minLength": 1 },
153
+ "status": { "type": "string", "minLength": 1 },
154
+ "approval_state": {
155
+ "type": "string",
156
+ "enum": ["pending", "approved", "rejected"]
157
+ },
158
+ "write_actions_allowed": { "const": false },
159
+ "decision_note": {
160
+ "type": ["string", "null"]
161
+ },
162
+ "payload_keys": {
163
+ "type": "array",
164
+ "items": { "type": "string" }
165
+ }
166
+ },
167
+ "additionalProperties": false
168
+ },
169
+ "proposal_review": {
170
+ "type": "object",
171
+ "required": [
172
+ "id",
173
+ "work_item_id",
174
+ "title",
175
+ "risk_level",
176
+ "approval_state",
177
+ "decision_note"
178
+ ],
179
+ "properties": {
180
+ "id": { "type": "string", "minLength": 1 },
181
+ "work_item_id": { "type": "string", "minLength": 1 },
182
+ "title": { "type": "string", "minLength": 1 },
183
+ "risk_level": {
184
+ "type": "string",
185
+ "enum": ["low", "medium", "high"]
186
+ },
187
+ "approval_state": {
188
+ "type": "string",
189
+ "enum": ["pending", "approved", "rejected"]
190
+ },
191
+ "decision_note": {
192
+ "type": ["string", "null"]
193
+ }
194
+ },
195
+ "additionalProperties": false
196
+ },
197
+ "handoff_step": {
198
+ "type": "object",
199
+ "required": ["state", "command", "purpose"],
200
+ "properties": {
201
+ "state": {
202
+ "type": "string",
203
+ "enum": ["pending_work_items", "pending_proposals", "clear_for_handoff"]
204
+ },
205
+ "command": {
206
+ "type": "string",
207
+ "minLength": 1
208
+ },
209
+ "purpose": {
210
+ "type": "string",
211
+ "minLength": 1
212
+ }
213
+ },
214
+ "additionalProperties": false
215
+ }
216
+ },
217
+ "additionalProperties": false
218
+ }