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,836 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://patchrail.dev/schemas/funded-issues-report.v1.schema.json",
4
+ "title": "PatchRail Funded Issues Report",
5
+ "description": "Read-only opportunity coverage report emitted by patchrail funded-issues report.",
6
+ "type": "object",
7
+ "required": [
8
+ "schema_version",
9
+ "source_schema_version",
10
+ "read_only",
11
+ "safe_only",
12
+ "blocked_actions",
13
+ "filters",
14
+ "totals",
15
+ "breakdown",
16
+ "no_go_moat",
17
+ "decision_summary",
18
+ "delivery_budget",
19
+ "delivery_pack",
20
+ "source_quality",
21
+ "recheck_plan",
22
+ "evidence_debt",
23
+ "client_fit_summary",
24
+ "client_fit_gaps",
25
+ "intake_followup",
26
+ "cash_path_status",
27
+ "operator_next_steps",
28
+ "top_safe_candidates",
29
+ "requirements",
30
+ "boundary"
31
+ ],
32
+ "properties": {
33
+ "schema_version": {
34
+ "const": "patchrail.funded_issues.report.v1"
35
+ },
36
+ "source_schema_version": {
37
+ "const": "patchrail.funded_issues.v1"
38
+ },
39
+ "read_only": {
40
+ "const": true
41
+ },
42
+ "safe_only": {
43
+ "type": "boolean"
44
+ },
45
+ "blocked_actions": {
46
+ "$ref": "#/$defs/blocked_actions"
47
+ },
48
+ "filters": {
49
+ "$ref": "#/$defs/filters"
50
+ },
51
+ "totals": {
52
+ "type": "object",
53
+ "required": [
54
+ "loaded",
55
+ "in_scope",
56
+ "returned",
57
+ "safe_to_list",
58
+ "high_risk",
59
+ "funding_known",
60
+ "funding_unknown"
61
+ ],
62
+ "properties": {
63
+ "loaded": { "type": "integer", "minimum": 0 },
64
+ "in_scope": { "type": "integer", "minimum": 0 },
65
+ "returned": { "type": "integer", "minimum": 0 },
66
+ "safe_to_list": { "type": "integer", "minimum": 0 },
67
+ "high_risk": { "type": "integer", "minimum": 0 },
68
+ "funding_known": { "type": "integer", "minimum": 0 },
69
+ "funding_unknown": { "type": "integer", "minimum": 0 }
70
+ },
71
+ "additionalProperties": false
72
+ },
73
+ "breakdown": {
74
+ "type": "object",
75
+ "required": ["risk_levels", "platforms", "languages", "risk_flags", "opportunity_states"],
76
+ "properties": {
77
+ "risk_levels": { "$ref": "#/$defs/count_map" },
78
+ "platforms": { "$ref": "#/$defs/count_map" },
79
+ "languages": { "$ref": "#/$defs/count_map" },
80
+ "risk_flags": { "$ref": "#/$defs/count_map" },
81
+ "opportunity_states": { "$ref": "#/$defs/count_map" }
82
+ },
83
+ "additionalProperties": false
84
+ },
85
+ "no_go_moat": {
86
+ "$ref": "#/$defs/no_go_moat"
87
+ },
88
+ "decision_summary": {
89
+ "$ref": "#/$defs/decision_summary"
90
+ },
91
+ "delivery_budget": {
92
+ "$ref": "#/$defs/delivery_budget"
93
+ },
94
+ "delivery_pack": {
95
+ "$ref": "#/$defs/delivery_pack"
96
+ },
97
+ "source_quality": {
98
+ "$ref": "#/$defs/source_quality"
99
+ },
100
+ "recheck_plan": {
101
+ "$ref": "#/$defs/recheck_plan"
102
+ },
103
+ "evidence_debt": {
104
+ "$ref": "#/$defs/evidence_debt"
105
+ },
106
+ "client_fit_summary": {
107
+ "$ref": "#/$defs/client_fit_summary"
108
+ },
109
+ "client_fit_gaps": {
110
+ "$ref": "#/$defs/client_fit_gaps"
111
+ },
112
+ "intake_followup": {
113
+ "$ref": "#/$defs/intake_followup"
114
+ },
115
+ "cash_path_status": {
116
+ "$ref": "#/$defs/cash_path_status"
117
+ },
118
+ "operator_next_steps": {
119
+ "$ref": "#/$defs/operator_next_steps"
120
+ },
121
+ "top_safe_candidates": {
122
+ "type": "array",
123
+ "items": {
124
+ "type": "object",
125
+ "required": [
126
+ "reference",
127
+ "title",
128
+ "platform",
129
+ "funding",
130
+ "opportunity_state",
131
+ "risk_level",
132
+ "signals",
133
+ "url"
134
+ ],
135
+ "properties": {
136
+ "reference": { "type": "string", "minLength": 1 },
137
+ "title": { "type": "string", "minLength": 1 },
138
+ "platform": { "type": "string", "minLength": 1 },
139
+ "funding": { "type": "string", "minLength": 1 },
140
+ "opportunity_state": { "$ref": "#/$defs/opportunity_state" },
141
+ "risk_level": { "enum": ["low", "medium", "high"] },
142
+ "signals": {
143
+ "type": "array",
144
+ "items": { "type": "string", "minLength": 1 }
145
+ },
146
+ "url": { "type": "string", "format": "uri" }
147
+ },
148
+ "additionalProperties": false
149
+ }
150
+ },
151
+ "requirements": {
152
+ "$ref": "#/$defs/safe_requirements"
153
+ },
154
+ "boundary": {
155
+ "type": "string",
156
+ "minLength": 1
157
+ }
158
+ },
159
+ "additionalProperties": false,
160
+ "$defs": {
161
+ "blocked_actions": {
162
+ "type": "array",
163
+ "contains": { "const": "automatic_claims" },
164
+ "items": {
165
+ "enum": [
166
+ "automatic_claims",
167
+ "automatic_pull_requests",
168
+ "automatic_issue_comments",
169
+ "mass_outreach",
170
+ "ranking_by_money_only"
171
+ ]
172
+ },
173
+ "uniqueItems": true
174
+ },
175
+ "count_map": {
176
+ "type": "object",
177
+ "additionalProperties": {
178
+ "type": "integer",
179
+ "minimum": 0
180
+ }
181
+ },
182
+ "filters": {
183
+ "type": "object",
184
+ "required": [
185
+ "profile",
186
+ "platform",
187
+ "language",
188
+ "min_usd",
189
+ "opportunity_state",
190
+ "risk_level"
191
+ ],
192
+ "properties": {
193
+ "profile": {
194
+ "anyOf": [
195
+ { "$ref": "#/$defs/client_profile" },
196
+ { "type": "null" }
197
+ ]
198
+ },
199
+ "platform": { "type": ["string", "null"] },
200
+ "language": { "type": ["string", "null"] },
201
+ "min_usd": { "type": ["number", "null"], "minimum": 0 },
202
+ "opportunity_state": { "anyOf": [{ "$ref": "#/$defs/opportunity_state" }, { "type": "null" }] },
203
+ "risk_level": { "anyOf": [{ "$ref": "#/$defs/risk_level" }, { "type": "null" }] }
204
+ },
205
+ "additionalProperties": false
206
+ },
207
+ "client_profile": {
208
+ "type": "object",
209
+ "required": [
210
+ "schema_version",
211
+ "name",
212
+ "languages",
213
+ "min_usd",
214
+ "allowed_opportunity_states",
215
+ "allowed_risk_levels",
216
+ "excluded_risk_flags",
217
+ "read_only"
218
+ ],
219
+ "properties": {
220
+ "schema_version": {
221
+ "const": "patchrail.funded_issues.client_profile.v1"
222
+ },
223
+ "name": { "type": ["string", "null"] },
224
+ "languages": {
225
+ "type": "array",
226
+ "items": { "type": "string" }
227
+ },
228
+ "min_usd": { "type": ["number", "null"], "minimum": 0 },
229
+ "allowed_opportunity_states": {
230
+ "type": "array",
231
+ "items": { "$ref": "#/$defs/opportunity_state" }
232
+ },
233
+ "allowed_risk_levels": {
234
+ "type": "array",
235
+ "items": { "$ref": "#/$defs/risk_level" }
236
+ },
237
+ "excluded_risk_flags": {
238
+ "type": "array",
239
+ "items": { "type": "string", "minLength": 1 }
240
+ },
241
+ "read_only": { "const": true }
242
+ },
243
+ "additionalProperties": false
244
+ },
245
+ "no_go_moat": {
246
+ "type": "object",
247
+ "required": [
248
+ "high_risk_or_excluded",
249
+ "missing_contribution_guidelines",
250
+ "ambiguous_scope",
251
+ "spam_attractive",
252
+ "funding_unknown",
253
+ "stale_or_closed"
254
+ ],
255
+ "properties": {
256
+ "high_risk_or_excluded": { "type": "integer", "minimum": 0 },
257
+ "missing_contribution_guidelines": { "type": "integer", "minimum": 0 },
258
+ "ambiguous_scope": { "type": "integer", "minimum": 0 },
259
+ "spam_attractive": { "type": "integer", "minimum": 0 },
260
+ "funding_unknown": { "type": "integer", "minimum": 0 },
261
+ "stale_or_closed": { "type": "integer", "minimum": 0 }
262
+ },
263
+ "additionalProperties": false
264
+ },
265
+ "decision_summary": {
266
+ "type": "object",
267
+ "required": [
268
+ "total_rows",
269
+ "candidate_rows",
270
+ "no_go_rows",
271
+ "gate_counts",
272
+ "verification_needed",
273
+ "authorization_needed",
274
+ "recommended_batch_action",
275
+ "safety_boundary"
276
+ ],
277
+ "properties": {
278
+ "total_rows": { "type": "integer", "minimum": 0 },
279
+ "candidate_rows": { "type": "integer", "minimum": 0 },
280
+ "no_go_rows": { "type": "integer", "minimum": 0 },
281
+ "gate_counts": { "$ref": "#/$defs/count_map" },
282
+ "verification_needed": { "type": "integer", "minimum": 0 },
283
+ "authorization_needed": { "type": "integer", "minimum": 0 },
284
+ "recommended_batch_action": { "type": "string", "minLength": 1 },
285
+ "safety_boundary": { "type": "string", "minLength": 1 }
286
+ },
287
+ "additionalProperties": false
288
+ },
289
+ "delivery_budget": {
290
+ "type": "object",
291
+ "required": [
292
+ "suggested_package",
293
+ "estimated_review_minutes",
294
+ "estimated_review_hours",
295
+ "max_paid_hours",
296
+ "within_margin_budget",
297
+ "analysis_rows",
298
+ "boundary"
299
+ ],
300
+ "properties": {
301
+ "suggested_package": {
302
+ "enum": [
303
+ "none",
304
+ "mini_diagnostic",
305
+ "validation_sprint",
306
+ "opportunity_shortlist",
307
+ "custom_batch"
308
+ ]
309
+ },
310
+ "estimated_review_minutes": { "type": "integer", "minimum": 0 },
311
+ "estimated_review_hours": { "type": "number", "minimum": 0 },
312
+ "max_paid_hours": { "type": ["number", "null"], "minimum": 0 },
313
+ "within_margin_budget": { "type": "boolean" },
314
+ "analysis_rows": {
315
+ "type": "object",
316
+ "required": [
317
+ "l1_state_and_noise_review",
318
+ "l2_scope_and_readiness_review",
319
+ "l3_deep_dive_deferred"
320
+ ],
321
+ "properties": {
322
+ "l1_state_and_noise_review": { "type": "integer", "minimum": 0 },
323
+ "l2_scope_and_readiness_review": { "type": "integer", "minimum": 0 },
324
+ "l3_deep_dive_deferred": { "type": "integer", "minimum": 0 }
325
+ },
326
+ "additionalProperties": false
327
+ },
328
+ "boundary": { "type": "string", "minLength": 1 }
329
+ },
330
+ "additionalProperties": false
331
+ },
332
+ "delivery_pack": {
333
+ "type": "object",
334
+ "required": [
335
+ "suggested_package",
336
+ "phase_counts",
337
+ "phases",
338
+ "handoff",
339
+ "boundary"
340
+ ],
341
+ "properties": {
342
+ "suggested_package": {
343
+ "enum": [
344
+ "none",
345
+ "mini_diagnostic",
346
+ "validation_sprint",
347
+ "opportunity_shortlist",
348
+ "custom_batch"
349
+ ]
350
+ },
351
+ "phase_counts": { "$ref": "#/$defs/count_map" },
352
+ "phases": {
353
+ "type": "array",
354
+ "items": { "$ref": "#/$defs/delivery_phase" }
355
+ },
356
+ "handoff": { "$ref": "#/$defs/delivery_handoff" },
357
+ "boundary": { "type": "string", "minLength": 1 }
358
+ },
359
+ "additionalProperties": false
360
+ },
361
+ "delivery_phase": {
362
+ "type": "object",
363
+ "required": ["phase", "row_count", "references", "objective", "exit_criteria"],
364
+ "properties": {
365
+ "phase": {
366
+ "enum": [
367
+ "l1_state_and_noise_review",
368
+ "l2_shortlist_readiness_review",
369
+ "l3_deep_dive_deferred"
370
+ ]
371
+ },
372
+ "row_count": { "type": "integer", "minimum": 0 },
373
+ "references": {
374
+ "type": "array",
375
+ "items": { "type": "string", "minLength": 1 }
376
+ },
377
+ "objective": { "type": "string", "minLength": 1 },
378
+ "exit_criteria": { "type": "string", "minLength": 1 }
379
+ },
380
+ "additionalProperties": false
381
+ },
382
+ "delivery_handoff": {
383
+ "type": "object",
384
+ "required": [
385
+ "candidate_references",
386
+ "verification_references",
387
+ "no_go_references"
388
+ ],
389
+ "properties": {
390
+ "candidate_references": {
391
+ "type": "array",
392
+ "items": { "type": "string", "minLength": 1 }
393
+ },
394
+ "verification_references": {
395
+ "type": "array",
396
+ "items": { "type": "string", "minLength": 1 }
397
+ },
398
+ "no_go_references": {
399
+ "type": "array",
400
+ "items": { "type": "string", "minLength": 1 }
401
+ }
402
+ },
403
+ "additionalProperties": false
404
+ },
405
+ "source_quality": {
406
+ "type": "object",
407
+ "required": ["summary", "sources", "boundary"],
408
+ "properties": {
409
+ "summary": { "$ref": "#/$defs/source_quality_summary" },
410
+ "sources": {
411
+ "type": "object",
412
+ "additionalProperties": { "$ref": "#/$defs/source_quality_source" }
413
+ },
414
+ "boundary": { "type": "string", "minLength": 1 }
415
+ },
416
+ "additionalProperties": false
417
+ },
418
+ "source_quality_summary": {
419
+ "type": "object",
420
+ "required": [
421
+ "source_count",
422
+ "total_rows",
423
+ "candidate_rows",
424
+ "no_go_rows",
425
+ "candidate_source_count",
426
+ "no_go_only_source_count",
427
+ "funding_verification_needed",
428
+ "authorization_needed",
429
+ "status",
430
+ "next_tracker_action",
431
+ "boundary"
432
+ ],
433
+ "properties": {
434
+ "source_count": { "type": "integer", "minimum": 0 },
435
+ "total_rows": { "type": "integer", "minimum": 0 },
436
+ "candidate_rows": { "type": "integer", "minimum": 0 },
437
+ "no_go_rows": { "type": "integer", "minimum": 0 },
438
+ "candidate_source_count": { "type": "integer", "minimum": 0 },
439
+ "no_go_only_source_count": { "type": "integer", "minimum": 0 },
440
+ "funding_verification_needed": { "type": "integer", "minimum": 0 },
441
+ "authorization_needed": { "type": "integer", "minimum": 0 },
442
+ "status": {
443
+ "enum": [
444
+ "candidate_sources_available",
445
+ "collect_more_rows",
446
+ "needs_authorization",
447
+ "needs_funding_verification",
448
+ "no_go_only_sources",
449
+ "no_sources"
450
+ ]
451
+ },
452
+ "next_tracker_action": { "type": "string", "minLength": 1 },
453
+ "boundary": { "type": "string", "minLength": 1 }
454
+ },
455
+ "additionalProperties": false
456
+ },
457
+ "source_quality_source": {
458
+ "type": "object",
459
+ "required": [
460
+ "total_rows",
461
+ "candidate_rows",
462
+ "no_go_rows",
463
+ "safe_to_list",
464
+ "funding_verification_needed",
465
+ "authorization_needed",
466
+ "average_score",
467
+ "usable_signal_ratio",
468
+ "recommended_use"
469
+ ],
470
+ "properties": {
471
+ "total_rows": { "type": "integer", "minimum": 0 },
472
+ "candidate_rows": { "type": "integer", "minimum": 0 },
473
+ "no_go_rows": { "type": "integer", "minimum": 0 },
474
+ "safe_to_list": { "type": "integer", "minimum": 0 },
475
+ "funding_verification_needed": { "type": "integer", "minimum": 0 },
476
+ "authorization_needed": { "type": "integer", "minimum": 0 },
477
+ "average_score": { "type": "number", "minimum": 0, "maximum": 100 },
478
+ "usable_signal_ratio": { "type": "number", "minimum": 0, "maximum": 1 },
479
+ "recommended_use": { "type": "string", "minLength": 1 }
480
+ },
481
+ "additionalProperties": false
482
+ },
483
+ "recheck_plan": {
484
+ "type": "object",
485
+ "required": [
486
+ "total_rows",
487
+ "recheck_rows",
488
+ "no_go_rows",
489
+ "priority_counts",
490
+ "action_counts",
491
+ "next_rows",
492
+ "boundary"
493
+ ],
494
+ "properties": {
495
+ "total_rows": { "type": "integer", "minimum": 0 },
496
+ "recheck_rows": { "type": "integer", "minimum": 0 },
497
+ "no_go_rows": { "type": "integer", "minimum": 0 },
498
+ "priority_counts": { "$ref": "#/$defs/count_map" },
499
+ "action_counts": { "$ref": "#/$defs/count_map" },
500
+ "next_rows": {
501
+ "type": "array",
502
+ "items": { "$ref": "#/$defs/recheck_row" }
503
+ },
504
+ "boundary": { "type": "string", "minLength": 1 }
505
+ },
506
+ "additionalProperties": false
507
+ },
508
+ "evidence_debt": {
509
+ "type": "object",
510
+ "required": [
511
+ "status",
512
+ "blocking_rows",
513
+ "archive_only_rows",
514
+ "highest_priority",
515
+ "next_action",
516
+ "action_counts",
517
+ "platform_counts",
518
+ "priority_counts",
519
+ "references",
520
+ "payment_route_allowed_now",
521
+ "external_body_allowed",
522
+ "boundary"
523
+ ],
524
+ "properties": {
525
+ "status": { "enum": ["active_evidence_debt", "clear"] },
526
+ "blocking_rows": { "type": "integer", "minimum": 0 },
527
+ "archive_only_rows": { "type": "integer", "minimum": 0 },
528
+ "highest_priority": { "enum": ["high", "medium", "low", "none"] },
529
+ "next_action": {
530
+ "enum": [
531
+ "confirm_client_authorization",
532
+ "ready_for_delivery_readiness_review",
533
+ "recheck_public_issue_state",
534
+ "recheck_scope_and_noise",
535
+ "verify_funding_visibility"
536
+ ]
537
+ },
538
+ "action_counts": { "$ref": "#/$defs/count_map" },
539
+ "platform_counts": { "$ref": "#/$defs/count_map" },
540
+ "priority_counts": { "$ref": "#/$defs/count_map" },
541
+ "references": {
542
+ "type": "array",
543
+ "items": { "type": "string", "minLength": 1 }
544
+ },
545
+ "payment_route_allowed_now": { "const": false },
546
+ "external_body_allowed": { "const": false },
547
+ "boundary": { "type": "string", "minLength": 1 }
548
+ },
549
+ "additionalProperties": false
550
+ },
551
+ "recheck_row": {
552
+ "type": "object",
553
+ "required": [
554
+ "reference",
555
+ "platform",
556
+ "decision_gate",
557
+ "priority",
558
+ "action",
559
+ "reason"
560
+ ],
561
+ "properties": {
562
+ "reference": { "type": "string", "minLength": 1 },
563
+ "platform": { "type": "string", "minLength": 1 },
564
+ "decision_gate": {
565
+ "enum": [
566
+ "go_after_recheck",
567
+ "needs_authorization",
568
+ "needs_funding_verification",
569
+ "no_go",
570
+ "watchlist"
571
+ ]
572
+ },
573
+ "priority": { "enum": ["high", "medium", "low", "none"] },
574
+ "action": {
575
+ "enum": [
576
+ "archive_as_no_go_evidence",
577
+ "confirm_client_authorization",
578
+ "recheck_public_issue_state",
579
+ "recheck_scope_and_noise",
580
+ "verify_funding_visibility"
581
+ ]
582
+ },
583
+ "reason": { "type": "string", "minLength": 1 }
584
+ },
585
+ "additionalProperties": false
586
+ },
587
+ "client_fit_gaps": {
588
+ "type": "array",
589
+ "items": { "$ref": "#/$defs/client_fit_gap" }
590
+ },
591
+ "client_fit_summary": {
592
+ "type": "object",
593
+ "required": [
594
+ "profile_name",
595
+ "status",
596
+ "total_rows",
597
+ "matching_rows",
598
+ "excluded_rows",
599
+ "gap_counts",
600
+ "recommended_action",
601
+ "boundary"
602
+ ],
603
+ "properties": {
604
+ "profile_name": { "type": ["string", "null"], "minLength": 1 },
605
+ "status": {
606
+ "enum": [
607
+ "all_rows_match",
608
+ "no_matching_rows",
609
+ "no_profile",
610
+ "no_rows",
611
+ "partial_match"
612
+ ]
613
+ },
614
+ "total_rows": { "type": "integer", "minimum": 0 },
615
+ "matching_rows": { "type": "integer", "minimum": 0 },
616
+ "excluded_rows": { "type": "integer", "minimum": 0 },
617
+ "gap_counts": { "$ref": "#/$defs/count_map" },
618
+ "recommended_action": { "type": "string", "minLength": 1 },
619
+ "boundary": { "type": "string", "minLength": 1 }
620
+ },
621
+ "additionalProperties": false
622
+ },
623
+ "client_fit_gap": {
624
+ "type": "object",
625
+ "required": ["reference", "title", "url", "platform", "gap_codes", "gap_summary"],
626
+ "properties": {
627
+ "reference": { "type": "string", "minLength": 1 },
628
+ "title": { "type": "string", "minLength": 1 },
629
+ "url": { "type": "string", "format": "uri" },
630
+ "platform": { "type": "string", "minLength": 1 },
631
+ "gap_codes": {
632
+ "type": "array",
633
+ "items": { "type": "string", "minLength": 1 },
634
+ "minItems": 1
635
+ },
636
+ "gap_summary": { "type": "string", "minLength": 1 }
637
+ },
638
+ "additionalProperties": false
639
+ },
640
+ "intake_followup": {
641
+ "type": "object",
642
+ "required": [
643
+ "status",
644
+ "suggested_package",
645
+ "required_before_paid_delivery",
646
+ "requested_fields",
647
+ "next_internal_action",
648
+ "boundary"
649
+ ],
650
+ "properties": {
651
+ "status": {
652
+ "enum": [
653
+ "needs_buyer_intake",
654
+ "needs_source_expansion",
655
+ "ready_after_read_only_recheck",
656
+ "ready_for_scope_confirmation"
657
+ ]
658
+ },
659
+ "suggested_package": {
660
+ "enum": [
661
+ "none",
662
+ "mini_diagnostic",
663
+ "validation_sprint",
664
+ "opportunity_shortlist",
665
+ "custom_batch"
666
+ ]
667
+ },
668
+ "required_before_paid_delivery": { "type": "integer", "minimum": 0 },
669
+ "requested_fields": {
670
+ "type": "array",
671
+ "items": { "$ref": "#/$defs/intake_field" }
672
+ },
673
+ "next_internal_action": { "type": "string", "minLength": 1 },
674
+ "boundary": { "type": "string", "minLength": 1 }
675
+ },
676
+ "additionalProperties": false
677
+ },
678
+ "cash_path_status": {
679
+ "type": "object",
680
+ "required": [
681
+ "status",
682
+ "next_revenue_action",
683
+ "copy_brief_facts_available",
684
+ "payment_route_allowed_now",
685
+ "requires_written_acceptance_before_payment_route",
686
+ "buyer_ready",
687
+ "boundary"
688
+ ],
689
+ "properties": {
690
+ "status": {
691
+ "enum": [
692
+ "needs_buyer_intake",
693
+ "needs_source_expansion",
694
+ "ready_after_read_only_recheck",
695
+ "ready_for_scope_confirmation"
696
+ ]
697
+ },
698
+ "next_revenue_action": {
699
+ "enum": [
700
+ "collect_buyer_intake",
701
+ "expand_permitted_sources",
702
+ "run_read_only_recheck",
703
+ "confirm_paid_scope"
704
+ ]
705
+ },
706
+ "copy_brief_facts_available": { "type": "boolean" },
707
+ "payment_route_allowed_now": { "const": false },
708
+ "requires_written_acceptance_before_payment_route": { "const": true },
709
+ "buyer_ready": { "type": "boolean" },
710
+ "boundary": { "type": "string", "minLength": 1 }
711
+ },
712
+ "additionalProperties": false
713
+ },
714
+ "operator_next_steps": {
715
+ "type": "object",
716
+ "required": [
717
+ "schema_version",
718
+ "status",
719
+ "primary_action",
720
+ "copy_brief_facts_available",
721
+ "payment_route_allowed_now",
722
+ "external_body_allowed",
723
+ "steps",
724
+ "boundary"
725
+ ],
726
+ "properties": {
727
+ "schema_version": {
728
+ "const": "patchrail.funded_issues.operator_next_steps.v1"
729
+ },
730
+ "status": {
731
+ "enum": [
732
+ "needs_buyer_intake",
733
+ "needs_source_expansion",
734
+ "ready_after_read_only_recheck",
735
+ "ready_for_scope_confirmation"
736
+ ]
737
+ },
738
+ "primary_action": {
739
+ "enum": [
740
+ "collect_buyer_intake",
741
+ "expand_permitted_sources",
742
+ "run_read_only_recheck",
743
+ "confirm_paid_scope"
744
+ ]
745
+ },
746
+ "copy_brief_facts_available": { "type": "boolean" },
747
+ "payment_route_allowed_now": { "const": false },
748
+ "external_body_allowed": { "const": false },
749
+ "steps": {
750
+ "type": "array",
751
+ "items": { "$ref": "#/$defs/operator_next_step" }
752
+ },
753
+ "boundary": { "type": "string", "minLength": 1 }
754
+ },
755
+ "additionalProperties": false
756
+ },
757
+ "operator_next_step": {
758
+ "type": "object",
759
+ "required": [
760
+ "priority",
761
+ "action",
762
+ "source",
763
+ "reason",
764
+ "reference_scope",
765
+ "evidence_required",
766
+ "blocks_paid_delivery",
767
+ "copy_brief_allowed",
768
+ "external_body_allowed",
769
+ "payment_route_allowed_now",
770
+ "blocked_actions"
771
+ ],
772
+ "properties": {
773
+ "priority": { "enum": ["high", "medium", "low", "none"] },
774
+ "action": {
775
+ "enum": [
776
+ "collect_buyer_intake",
777
+ "confirm_paid_scope",
778
+ "expand_permitted_sources",
779
+ "preserve_no_go_evidence",
780
+ "run_read_only_recheck"
781
+ ]
782
+ },
783
+ "source": {
784
+ "enum": ["cash_path", "delivery_pack", "recheck_plan", "source_quality"]
785
+ },
786
+ "reason": { "type": "string", "minLength": 1 },
787
+ "reference_scope": {
788
+ "type": "array",
789
+ "items": { "type": "string", "minLength": 1 }
790
+ },
791
+ "evidence_required": {
792
+ "type": "array",
793
+ "items": { "type": "string", "minLength": 1 }
794
+ },
795
+ "blocks_paid_delivery": { "type": "boolean" },
796
+ "copy_brief_allowed": { "type": "boolean" },
797
+ "external_body_allowed": { "const": false },
798
+ "payment_route_allowed_now": { "const": false },
799
+ "blocked_actions": { "$ref": "#/$defs/blocked_actions" }
800
+ },
801
+ "additionalProperties": false
802
+ },
803
+ "intake_field": {
804
+ "type": "object",
805
+ "required": ["field", "reason", "required_before_paid_delivery"],
806
+ "properties": {
807
+ "field": { "type": "string", "minLength": 1 },
808
+ "reason": { "type": "string", "minLength": 1 },
809
+ "required_before_paid_delivery": { "type": "boolean" }
810
+ },
811
+ "additionalProperties": false
812
+ },
813
+ "opportunity_state": {
814
+ "enum": ["active", "stale", "closed", "unknown"]
815
+ },
816
+ "risk_level": {
817
+ "enum": ["low", "medium", "high"]
818
+ },
819
+ "safe_requirements": {
820
+ "type": "object",
821
+ "required": [
822
+ "network_required",
823
+ "github_write_permission_required",
824
+ "external_model_required",
825
+ "billing_required"
826
+ ],
827
+ "properties": {
828
+ "network_required": { "const": false },
829
+ "github_write_permission_required": { "const": false },
830
+ "external_model_required": { "const": false },
831
+ "billing_required": { "const": false }
832
+ },
833
+ "additionalProperties": false
834
+ }
835
+ }
836
+ }