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,96 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://patchrail.dev/schemas/funded-issues-store-status.v1.schema.json",
4
+ "title": "PatchRail Funded Issues Tracker Store Status",
5
+ "description": "Read-only summary of a funded-issues tracker store emitted by patchrail funded-issues track-status. Aggregates totals only; never triggers a third-party write.",
6
+ "type": "object",
7
+ "required": [
8
+ "schema_version",
9
+ "source_schema_version",
10
+ "read_only",
11
+ "blocked_actions",
12
+ "requirements",
13
+ "now",
14
+ "total_entries",
15
+ "states",
16
+ "added_24h",
17
+ "total_usd",
18
+ "usd_entries"
19
+ ],
20
+ "properties": {
21
+ "schema_version": {
22
+ "const": "patchrail.funded_issues.store_status.v1"
23
+ },
24
+ "source_schema_version": {
25
+ "const": "patchrail.funded_issues.v1"
26
+ },
27
+ "read_only": {
28
+ "const": true
29
+ },
30
+ "blocked_actions": {
31
+ "$ref": "#/$defs/blocked_actions"
32
+ },
33
+ "requirements": {
34
+ "$ref": "#/$defs/safe_requirements"
35
+ },
36
+ "now": {
37
+ "type": ["string", "null"]
38
+ },
39
+ "total_entries": {
40
+ "type": "integer",
41
+ "minimum": 0
42
+ },
43
+ "states": {
44
+ "type": "object",
45
+ "additionalProperties": {
46
+ "type": "integer",
47
+ "minimum": 0
48
+ }
49
+ },
50
+ "added_24h": {
51
+ "type": ["integer", "null"],
52
+ "minimum": 0
53
+ },
54
+ "total_usd": {
55
+ "type": ["number", "null"],
56
+ "minimum": 0
57
+ },
58
+ "usd_entries": {
59
+ "type": "integer",
60
+ "minimum": 0
61
+ }
62
+ },
63
+ "additionalProperties": false,
64
+ "$defs": {
65
+ "blocked_actions": {
66
+ "type": "array",
67
+ "contains": { "const": "automatic_claims" },
68
+ "items": {
69
+ "enum": [
70
+ "automatic_claims",
71
+ "automatic_pull_requests",
72
+ "automatic_issue_comments",
73
+ "mass_outreach",
74
+ "ranking_by_money_only"
75
+ ]
76
+ },
77
+ "uniqueItems": true
78
+ },
79
+ "safe_requirements": {
80
+ "type": "object",
81
+ "required": [
82
+ "network_required",
83
+ "github_write_permission_required",
84
+ "external_model_required",
85
+ "billing_required"
86
+ ],
87
+ "properties": {
88
+ "network_required": { "const": false },
89
+ "github_write_permission_required": { "const": false },
90
+ "external_model_required": { "const": false },
91
+ "billing_required": { "const": false }
92
+ },
93
+ "additionalProperties": false
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,117 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://patchrail.dev/schemas/funded-issues-store.v1.schema.json",
4
+ "title": "PatchRail Funded Issues Tracker Store",
5
+ "description": "Read-only local persistence file for the funded-issues opportunity tracker, written by patchrail funded-issues track. Entries are keyed by canonical issue URL and never trigger any third-party write.",
6
+ "type": "object",
7
+ "required": [
8
+ "schema_version",
9
+ "source_schema_version",
10
+ "read_only",
11
+ "blocked_actions",
12
+ "requirements",
13
+ "entries"
14
+ ],
15
+ "properties": {
16
+ "schema_version": {
17
+ "const": "patchrail.funded_issues.store.v1"
18
+ },
19
+ "source_schema_version": {
20
+ "const": "patchrail.funded_issues.v1"
21
+ },
22
+ "read_only": {
23
+ "const": true
24
+ },
25
+ "blocked_actions": {
26
+ "$ref": "#/$defs/blocked_actions"
27
+ },
28
+ "requirements": {
29
+ "$ref": "#/$defs/safe_requirements"
30
+ },
31
+ "entries": {
32
+ "type": "object",
33
+ "additionalProperties": {
34
+ "$ref": "#/$defs/store_entry"
35
+ }
36
+ }
37
+ },
38
+ "additionalProperties": false,
39
+ "$defs": {
40
+ "blocked_actions": {
41
+ "type": "array",
42
+ "contains": { "const": "automatic_claims" },
43
+ "items": {
44
+ "enum": [
45
+ "automatic_claims",
46
+ "automatic_pull_requests",
47
+ "automatic_issue_comments",
48
+ "mass_outreach",
49
+ "ranking_by_money_only"
50
+ ]
51
+ },
52
+ "uniqueItems": true
53
+ },
54
+ "safe_requirements": {
55
+ "type": "object",
56
+ "required": [
57
+ "network_required",
58
+ "github_write_permission_required",
59
+ "external_model_required",
60
+ "billing_required"
61
+ ],
62
+ "properties": {
63
+ "network_required": { "const": false },
64
+ "github_write_permission_required": { "const": false },
65
+ "external_model_required": { "const": false },
66
+ "billing_required": { "const": false }
67
+ },
68
+ "additionalProperties": false
69
+ },
70
+ "store_state": {
71
+ "enum": ["active", "closed", "stale", "unknown"]
72
+ },
73
+ "state_transition": {
74
+ "type": "object",
75
+ "required": ["state", "at", "from"],
76
+ "properties": {
77
+ "state": { "$ref": "#/$defs/store_state" },
78
+ "at": { "type": "string", "minLength": 1 },
79
+ "from": {
80
+ "anyOf": [
81
+ { "$ref": "#/$defs/store_state" },
82
+ { "type": "null" }
83
+ ]
84
+ }
85
+ },
86
+ "additionalProperties": false
87
+ },
88
+ "store_entry": {
89
+ "type": "object",
90
+ "required": [
91
+ "issue",
92
+ "first_seen",
93
+ "last_seen",
94
+ "last_checked",
95
+ "state",
96
+ "state_history"
97
+ ],
98
+ "properties": {
99
+ "issue": { "type": "object" },
100
+ "first_seen": { "type": "string", "minLength": 1 },
101
+ "last_seen": { "type": "string", "minLength": 1 },
102
+ "last_checked": { "type": "string", "minLength": 1 },
103
+ "state": { "$ref": "#/$defs/store_state" },
104
+ "state_history": {
105
+ "type": "array",
106
+ "items": { "$ref": "#/$defs/state_transition" },
107
+ "minItems": 1
108
+ },
109
+ "score": {
110
+ "type": ["integer", "null"],
111
+ "minimum": 0
112
+ }
113
+ },
114
+ "additionalProperties": false
115
+ }
116
+ }
117
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://patchrail.dev/schemas/queue-audit-event.v1.schema.json",
4
+ "title": "PatchRail Queue Audit Event",
5
+ "description": "Append-only local audit event emitted by PatchRail queue operations.",
6
+ "type": "object",
7
+ "required": [
8
+ "id",
9
+ "ts",
10
+ "event_type",
11
+ "work_item_id",
12
+ "payload"
13
+ ],
14
+ "properties": {
15
+ "id": {
16
+ "type": "integer",
17
+ "minimum": 1
18
+ },
19
+ "ts": {
20
+ "type": "string",
21
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T"
22
+ },
23
+ "event_type": {
24
+ "type": "string",
25
+ "enum": [
26
+ "work_item_added",
27
+ "work_item_approved",
28
+ "work_item_rejected",
29
+ "work_items_exported",
30
+ "proposal_added",
31
+ "proposal_approved",
32
+ "proposal_rejected"
33
+ ]
34
+ },
35
+ "work_item_id": {
36
+ "type": ["string", "null"],
37
+ "pattern": "^prq_[0-9a-f]{12}$"
38
+ },
39
+ "payload": {
40
+ "type": "object"
41
+ }
42
+ },
43
+ "additionalProperties": false
44
+ }
@@ -0,0 +1,169 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://patchrail.dev/schemas/queue-audit-summary.v1.schema.json",
4
+ "title": "PatchRail Queue Audit Summary",
5
+ "description": "Local audit summary emitted by patchrail queue audit-summary for Agent Control Plane gate evidence.",
6
+ "type": "object",
7
+ "required": [
8
+ "schema_version",
9
+ "queue_schema_version",
10
+ "patchrail_version",
11
+ "db_path",
12
+ "local_first",
13
+ "status",
14
+ "counts",
15
+ "required_events",
16
+ "missing_required_events",
17
+ "gates",
18
+ "affected_work_item_ids",
19
+ "latest_audit_event",
20
+ "safety"
21
+ ],
22
+ "properties": {
23
+ "schema_version": {
24
+ "const": "patchrail.queue_audit_summary.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": ["human_gates_exercised", "needs_more_audit_evidence"]
43
+ },
44
+ "counts": {
45
+ "type": "object",
46
+ "required": [
47
+ "audit_events_total",
48
+ "event_types",
49
+ "work_items_total",
50
+ "proposals_total",
51
+ "affected_work_items"
52
+ ],
53
+ "properties": {
54
+ "audit_events_total": {
55
+ "type": "integer",
56
+ "minimum": 0
57
+ },
58
+ "event_types": {
59
+ "type": "object",
60
+ "additionalProperties": {
61
+ "type": "integer",
62
+ "minimum": 0
63
+ }
64
+ },
65
+ "work_items_total": {
66
+ "type": "integer",
67
+ "minimum": 0
68
+ },
69
+ "proposals_total": {
70
+ "type": "integer",
71
+ "minimum": 0
72
+ },
73
+ "affected_work_items": {
74
+ "type": "integer",
75
+ "minimum": 0
76
+ }
77
+ },
78
+ "additionalProperties": false
79
+ },
80
+ "required_events": {
81
+ "type": "array",
82
+ "items": {
83
+ "type": "string",
84
+ "minLength": 1
85
+ }
86
+ },
87
+ "missing_required_events": {
88
+ "type": "array",
89
+ "items": {
90
+ "type": "string",
91
+ "minLength": 1
92
+ }
93
+ },
94
+ "gates": {
95
+ "type": "object",
96
+ "required": [
97
+ "work_item_approval_gate_exercised",
98
+ "work_item_rejection_gate_exercised",
99
+ "proposal_approval_gate_exercised",
100
+ "proposal_rejection_gate_exercised",
101
+ "queue_export_recorded"
102
+ ],
103
+ "properties": {
104
+ "work_item_approval_gate_exercised": {
105
+ "type": "boolean"
106
+ },
107
+ "work_item_rejection_gate_exercised": {
108
+ "type": "boolean"
109
+ },
110
+ "proposal_approval_gate_exercised": {
111
+ "type": "boolean"
112
+ },
113
+ "proposal_rejection_gate_exercised": {
114
+ "type": "boolean"
115
+ },
116
+ "queue_export_recorded": {
117
+ "type": "boolean"
118
+ }
119
+ },
120
+ "additionalProperties": false
121
+ },
122
+ "affected_work_item_ids": {
123
+ "type": "array",
124
+ "items": {
125
+ "type": "string",
126
+ "pattern": "^prq_[0-9a-f]{12}$"
127
+ }
128
+ },
129
+ "latest_audit_event": {
130
+ "oneOf": [
131
+ { "type": "null" },
132
+ { "$ref": "queue-audit-event.v1.schema.json" }
133
+ ]
134
+ },
135
+ "safety": {
136
+ "type": "object",
137
+ "required": [
138
+ "write_actions_allowed_by_default",
139
+ "github_write_permission_required",
140
+ "network_required",
141
+ "external_model_required",
142
+ "billing_required",
143
+ "approval_records_execute_actions"
144
+ ],
145
+ "properties": {
146
+ "write_actions_allowed_by_default": {
147
+ "const": false
148
+ },
149
+ "github_write_permission_required": {
150
+ "const": false
151
+ },
152
+ "network_required": {
153
+ "const": false
154
+ },
155
+ "external_model_required": {
156
+ "const": false
157
+ },
158
+ "billing_required": {
159
+ "const": false
160
+ },
161
+ "approval_records_execute_actions": {
162
+ "const": false
163
+ }
164
+ },
165
+ "additionalProperties": false
166
+ }
167
+ },
168
+ "additionalProperties": false
169
+ }
@@ -0,0 +1,158 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://patchrail.dev/schemas/queue-gate-report.v1.schema.json",
4
+ "title": "PatchRail Queue Gate Report",
5
+ "description": "Reviewer-facing readiness report emitted by patchrail queue gate-report 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
+ "missing_required_events",
17
+ "decision_counts",
18
+ "audit_counts",
19
+ "gates",
20
+ "reviewer_actions",
21
+ "safety"
22
+ ],
23
+ "properties": {
24
+ "schema_version": {
25
+ "const": "patchrail.queue_gate_report.v1"
26
+ },
27
+ "queue_schema_version": {
28
+ "const": "patchrail.queue.v1"
29
+ },
30
+ "patchrail_version": {
31
+ "type": "string",
32
+ "minLength": 1
33
+ },
34
+ "db_path": {
35
+ "type": "string",
36
+ "minLength": 1
37
+ },
38
+ "local_first": {
39
+ "const": true
40
+ },
41
+ "status": {
42
+ "type": "string",
43
+ "enum": ["ready_for_reviewer_handoff", "needs_reviewer_decisions"]
44
+ },
45
+ "ready_for_reviewer_handoff": {
46
+ "type": "boolean"
47
+ },
48
+ "pending_decisions": {
49
+ "type": "integer",
50
+ "minimum": 0
51
+ },
52
+ "missing_required_events": {
53
+ "type": "array",
54
+ "items": {
55
+ "type": "string",
56
+ "minLength": 1
57
+ }
58
+ },
59
+ "decision_counts": {
60
+ "type": "object",
61
+ "required": [
62
+ "pending_work_items",
63
+ "pending_proposals",
64
+ "approved_work_items",
65
+ "rejected_work_items",
66
+ "approved_proposals",
67
+ "rejected_proposals"
68
+ ],
69
+ "properties": {
70
+ "pending_work_items": { "type": "integer", "minimum": 0 },
71
+ "pending_proposals": { "type": "integer", "minimum": 0 },
72
+ "approved_work_items": { "type": "integer", "minimum": 0 },
73
+ "rejected_work_items": { "type": "integer", "minimum": 0 },
74
+ "approved_proposals": { "type": "integer", "minimum": 0 },
75
+ "rejected_proposals": { "type": "integer", "minimum": 0 }
76
+ },
77
+ "additionalProperties": false
78
+ },
79
+ "audit_counts": {
80
+ "type": "object",
81
+ "required": [
82
+ "audit_events_total",
83
+ "event_types",
84
+ "work_items_total",
85
+ "proposals_total",
86
+ "affected_work_items"
87
+ ],
88
+ "properties": {
89
+ "audit_events_total": { "type": "integer", "minimum": 0 },
90
+ "event_types": {
91
+ "type": "object",
92
+ "additionalProperties": { "type": "integer", "minimum": 0 }
93
+ },
94
+ "work_items_total": { "type": "integer", "minimum": 0 },
95
+ "proposals_total": { "type": "integer", "minimum": 0 },
96
+ "affected_work_items": { "type": "integer", "minimum": 0 }
97
+ },
98
+ "additionalProperties": false
99
+ },
100
+ "gates": {
101
+ "type": "object",
102
+ "required": [
103
+ "work_item_approval_gate_exercised",
104
+ "work_item_rejection_gate_exercised",
105
+ "work_item_skip_gate_exercised",
106
+ "proposal_approval_gate_exercised",
107
+ "proposal_rejection_gate_exercised",
108
+ "queue_export_recorded"
109
+ ],
110
+ "properties": {
111
+ "work_item_approval_gate_exercised": { "type": "boolean" },
112
+ "work_item_rejection_gate_exercised": { "type": "boolean" },
113
+ "work_item_skip_gate_exercised": { "type": "boolean" },
114
+ "proposal_approval_gate_exercised": { "type": "boolean" },
115
+ "proposal_rejection_gate_exercised": { "type": "boolean" },
116
+ "queue_export_recorded": { "type": "boolean" }
117
+ },
118
+ "additionalProperties": false
119
+ },
120
+ "reviewer_actions": {
121
+ "type": "array",
122
+ "minItems": 1,
123
+ "items": {
124
+ "type": "string",
125
+ "minLength": 1
126
+ }
127
+ },
128
+ "safety": {
129
+ "type": "object",
130
+ "required": [
131
+ "write_actions_allowed_by_default",
132
+ "github_write_permission_required",
133
+ "network_required",
134
+ "external_model_required",
135
+ "billing_required",
136
+ "approval_records_execute_actions",
137
+ "report_is_read_only",
138
+ "report_records_audit_event",
139
+ "local_paths_redacted",
140
+ "execution_allowed"
141
+ ],
142
+ "properties": {
143
+ "write_actions_allowed_by_default": { "const": false },
144
+ "github_write_permission_required": { "const": false },
145
+ "network_required": { "const": false },
146
+ "external_model_required": { "const": false },
147
+ "billing_required": { "const": false },
148
+ "approval_records_execute_actions": { "const": false },
149
+ "report_is_read_only": { "const": true },
150
+ "report_records_audit_event": { "const": false },
151
+ "local_paths_redacted": { "const": true },
152
+ "execution_allowed": { "const": false }
153
+ },
154
+ "additionalProperties": false
155
+ }
156
+ },
157
+ "additionalProperties": false
158
+ }