Skip to content

Commit 5c57e5d

Browse files
authored
Merge branch 'main' into codex/fix-pi-empty-totals-v2
2 parents 118be34 + a26f517 commit 5c57e5d

153 files changed

Lines changed: 28542 additions & 12332 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/scripts/contribution-gate.test.nu‎

Lines changed: 222 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,218 @@ def test-issue-number []: nothing -> nothing {
507507
} | ignore
508508
}
509509

510+
def test-issue-triage-policy []: nothing -> nothing {
511+
let excluded_feature = issue-verdict-record '{"kind":"feature_request","maintenance_fit":"excluded","confidence":"high","decision":"keep_open","priority":"priority:medium","implementation":"create_pr","reason":"Optional output formatting expands the public CLI surface."}' true
512+
(expect
513+
'closes a high-confidence excluded feature request'
514+
$excluded_feature.decision
515+
close
516+
)
517+
(expect
518+
'assigns excluded feature requests low priority'
519+
$excluded_feature.priority
520+
'priority:low'
521+
)
522+
(expect
523+
'never implements an excluded feature request automatically'
524+
$excluded_feature.implementation
525+
none
526+
)
527+
528+
let exceptional_feature = issue-verdict-record '{"kind":"feature_request","maintenance_fit":"maintainable","confidence":"high","decision":"keep_open","priority":"priority:high","implementation":"create_pr","reason":"The request may fit the core product."}' true
529+
(expect
530+
'sends even maintainable feature requests to a maintainer'
531+
$exceptional_feature.decision
532+
needs_human
533+
)
534+
(expect
535+
'does not implement a feature request without maintainer approval'
536+
$exceptional_feature.implementation
537+
none
538+
)
539+
540+
let important_excluded_feature = issue-verdict-record '{"kind":"feature_request","maintenance_fit":"excluded","confidence":"high","decision":"close","priority":"priority:high","implementation":"none","reason":"The feature has high impact but unclear long-term support cost."}' true
541+
(expect
542+
'sends a high-priority excluded feature request to a maintainer'
543+
$important_excluded_feature.decision
544+
needs_human
545+
)
546+
(expect
547+
'marks an escalated excluded feature request for review'
548+
$important_excluded_feature.maintenance_fit
549+
needs_review
550+
)
551+
552+
let uncertain = issue-verdict-record '{"kind":"bug","maintenance_fit":"excluded","confidence":"medium","decision":"close","priority":"priority:low","implementation":"none","reason":"The report may describe unsupported behavior."}' true
553+
(expect
554+
'sends a non-high-confidence verdict to a maintainer'
555+
$uncertain.decision
556+
needs_human
557+
)
558+
(expect
559+
'marks a non-high-confidence maintenance verdict for review'
560+
$uncertain.maintenance_fit
561+
needs_review
562+
)
563+
564+
let core_bug = issue-verdict-record '{"kind":"bug","maintenance_fit":"maintainable","confidence":"high","decision":"keep_open","priority":"priority:high","implementation":"create_pr","reason":"Confirmed cost calculation regression with a focused fix."}' true
565+
expect 'keeps a high-confidence core bug open' $core_bug.decision keep_open
566+
(expect
567+
'allows an important maintainable bug implementation'
568+
$core_bug.implementation
569+
create_pr
570+
)
571+
572+
let excluded_bug = issue-verdict-record '{"kind":"bug","maintenance_fit":"excluded","confidence":"high","decision":"keep_open","priority":"priority:high","implementation":"create_pr","reason":"The behavior belongs in an external wrapper."}' true
573+
(expect
574+
'never auto-closes a report classified as a bug'
575+
$excluded_bug.decision
576+
needs_human
577+
)
578+
(expect
579+
'marks an excluded bug report for review'
580+
$excluded_bug.maintenance_fit
581+
needs_review
582+
)
583+
(expect
584+
'does not implement a disputed bug report'
585+
$excluded_bug.implementation
586+
none
587+
)
588+
589+
let rejected_maintenance = issue-verdict-record '{"kind":"maintenance","maintenance_fit":"excluded","confidence":"high","decision":"close","priority":"priority:medium","implementation":"none","reason":"The cleanup adds maintenance surface without user-facing value."}' true
590+
(expect
591+
'closes a high-confidence excluded maintenance request'
592+
$rejected_maintenance.decision
593+
close
594+
)
595+
(expect
596+
'never implements a maintenance request automatically'
597+
$rejected_maintenance.implementation
598+
none
599+
)
600+
601+
let security = issue-verdict-record '{"kind":"security","maintenance_fit":"excluded","confidence":"high","decision":"close","priority":"priority:low","implementation":"none","reason":"The report may affect credential handling."}' true
602+
expect 'never auto-closes a security report' $security.decision needs_human
603+
(expect
604+
'marks a security report for review'
605+
$security.maintenance_fit
606+
needs_review
607+
)
608+
(expect
609+
'floors security reports to high priority'
610+
$security.priority
611+
'priority:high'
612+
)
613+
614+
let uncertain_security = issue-verdict-record '{"kind":"security","maintenance_fit":"needs_review","confidence":"medium","decision":"needs_human","priority":"priority:low","implementation":"none","reason":"The security impact is not yet confirmed."}' true
615+
(expect
616+
'floors uncertain security reports to high priority'
617+
$uncertain_security.priority
618+
'priority:high'
619+
)
620+
621+
let documentation = issue-verdict-record '{"kind":"documentation","maintenance_fit":"maintainable","confidence":"high","decision":"keep_open","priority":"priority:medium","implementation":"create_pr","reason":"The documented option no longer matches supported behavior."}' true
622+
(expect
623+
'keeps a valid documentation issue open'
624+
$documentation.decision
625+
keep_open
626+
)
627+
(expect
628+
'never implements documentation automatically'
629+
$documentation.implementation
630+
none
631+
)
632+
633+
let documentation_close = issue-verdict-record '{"kind":"documentation","maintenance_fit":"maintainable","confidence":"high","decision":"close","priority":"priority:low","implementation":"none","reason":"The documentation request may be obsolete."}' true
634+
(expect
635+
'sends a documentation close recommendation to a maintainer'
636+
$documentation_close.decision
637+
needs_human
638+
)
639+
(expect
640+
'marks a documentation close recommendation for review'
641+
$documentation_close.maintenance_fit
642+
needs_review
643+
)
644+
645+
let duplicate = issue-verdict-record '{"kind":"duplicate","maintenance_fit":"excluded","confidence":"high","decision":"close","priority":"priority:low","implementation":"none","reason":"A linked open issue tracks the same root cause."}' true
646+
(expect
647+
'closes a high-confidence duplicate when the model also chose close'
648+
$duplicate.decision
649+
close
650+
)
651+
652+
let disputed_duplicate = issue-verdict-record '{"kind":"duplicate","maintenance_fit":"excluded","confidence":"high","decision":"keep_open","priority":"priority:low","implementation":"none","reason":"The relationship to the linked issue is not conclusive."}' true
653+
(expect
654+
'sends a disputed duplicate to a maintainer'
655+
$disputed_duplicate.decision
656+
needs_human
657+
)
658+
659+
[duplicate invalid spam out_of_scope] | each {|kind|
660+
['priority:critical' 'priority:high'] | each {|priority|
661+
let important_report = issue-verdict-record ({
662+
kind: $kind
663+
maintenance_fit: excluded
664+
confidence: high
665+
decision: close
666+
priority: $priority
667+
implementation: none
668+
reason: 'The classification is confident, but the reported impact is important.'
669+
} | to json -r) true
670+
(expect
671+
$"keeps an important ($kind) report open at ($priority)"
672+
$important_report.decision
673+
needs_human
674+
)
675+
(expect
676+
$"preserves important ($kind) priority at ($priority)"
677+
$important_report.priority
678+
$priority
679+
)
680+
(expect
681+
$"marks an important ($kind) report for review at ($priority)"
682+
$important_report.maintenance_fit
683+
needs_review
684+
)
685+
} | ignore
686+
} | ignore
687+
688+
let bug_close = issue-verdict-record '{"kind":"bug","maintenance_fit":"maintainable","confidence":"high","decision":"close","priority":"priority:high","implementation":"none","reason":"The report appears unsupported."}' true
689+
(expect
690+
'requires human review when a bug verdict asks to close'
691+
$bug_close.decision
692+
needs_human
693+
)
694+
695+
let missing_classification = (try {
696+
issue-verdict-record '{"decision":"keep_open","priority":"priority:high","implementation":"create_pr","reason":"Missing classification fields."}' true
697+
'accepted'
698+
} catch {
699+
'rejected'
700+
})
701+
(expect
702+
'rejects a verdict without classification fields'
703+
$missing_classification
704+
'rejected'
705+
)
706+
707+
let extra_classification = (try {
708+
issue-verdict-record '{"kind":"bug","maintenance_fit":"maintainable","confidence":"high","decision":"keep_open","priority":"priority:high","implementation":"create_pr","reason":"Valid bug.","unexpected":true}' true
709+
'accepted'
710+
} catch {
711+
'rejected'
712+
})
713+
(expect
714+
'rejects a verdict with extra fields'
715+
$extra_classification
716+
'rejected'
717+
)
718+
}
719+
510720
def test-forced-issue-implementation []: nothing -> nothing {
511-
let result = '{"decision":"close","priority":"priority:low","implementation":"none","reason":"The request is low impact."}'
721+
let result = '{"kind":"feature_request","maintenance_fit":"excluded","confidence":"high","decision":"close","priority":"priority:low","implementation":"none","reason":"The request is low impact."}'
512722
let automatic_verdict = issue-verdict-record $result false
513723
let verdict = issue-verdict-record $result false --force-implementation
514724

@@ -522,7 +732,17 @@ def test-forced-issue-implementation []: nothing -> nothing {
522732
$automatic_verdict.decision
523733
needs_human
524734
)
735+
(expect
736+
'marks a permission-blocked closure for review'
737+
$automatic_verdict.maintenance_fit
738+
needs_review
739+
)
525740
expect 'keeps a manually forced issue open' $verdict.decision keep_open
741+
(expect
742+
'keeps a manually forced excluded issue under review'
743+
$verdict.maintenance_fit
744+
needs_review
745+
)
526746
(expect
527747
'preserves the triage priority for a manually forced issue'
528748
$verdict.priority
@@ -566,6 +786,7 @@ def main [] {
566786
test-implementation-publication
567787
test-issue-context
568788
test-issue-number
789+
test-issue-triage-policy
569790
test-forced-issue-implementation
570791
test-contribution-gate-comment
571792
print 'contribution-gate Nushell tests passed.'

‎.github/scripts/contribution-gate/coauthor.nu‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,5 @@ export def verify-coauthor []: nothing -> nothing {
141141
| str join "\n"
142142
error make {msg: $"Issue-author co-author verification failed for PR #($pull_request.number):\n($summary)"}
143143
}
144-
print $"Verified issue-author attribution on PR #($pull_request.number) across ($commits | length) commit(s)."
144+
print $"Verified issue-author attribution on PR #($pull_request.number) across ($commits | length) commits."
145145
}

‎.github/scripts/contribution-gate/core.nu‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,30 @@ export const PRIORITY_LABELS = [
66
]
77

88
export const IMPLEMENTATION_PRIORITIES = ['priority:critical' 'priority:high']
9+
10+
export const ISSUE_KINDS = [
11+
bug
12+
documentation
13+
feature_request
14+
maintenance
15+
duplicate
16+
invalid
17+
spam
18+
out_of_scope
19+
security
20+
question
21+
unclear
22+
]
23+
24+
export const MAINTENANCE_FITS = [maintainable excluded needs_review]
25+
export const CONFIDENCE_LEVELS = [high medium low]
26+
27+
export const TRIAGE_LABELS = [
28+
'triage:maintainable'
29+
'triage:excluded'
30+
'triage:needs-review'
31+
]
32+
933
export const COLLABORATOR_PERMISSIONS = [admin maintain write]
1034
export const COMMENT_MARKER = '<!-- pullfrog-contribution-gate -->'
1135

0 commit comments

Comments
 (0)