Add objective mapping constants and tests#38293
Conversation
|
@copilot Resolve merge conflicts |
There was a problem hiding this comment.
Pull request overview
This PR introduces an objective-mapping layer (label → numeric value) and threads it through outcome evaluation so gh aw outcomes (and related reporting) can compute objective value/efficiency from traced “root” GitHub objects (e.g., PR → closing issue labels). It also adds a new gh aw outcomes history subcommand plus repository configuration and workflow-spec updates to support impact/efficiency reporting.
Changes:
- Add
ObjectiveMappingloading (env/config/default), label scoring logic, and unit tests. - Enrich outcome evaluation with
objective_value,objective_labels,traced_root_url, plus summary/domain breakdown aggregation. - Add
outcomes historyCLI subcommand and repo/workflow artifacts (.github/objective-mapping.json, updated impact-report workflow spec/lock, and a detailed design spec).
Show a summary per file
| File | Description |
|---|---|
specs/objective-mapping-portfolio-reporting.md |
New end-to-end specification for objective mapping, root tracing, and future portfolio reporting. |
pkg/github/label_objective_mapping.go |
Implements mapping model, scoring logic, and config/env/default loading. |
pkg/github/label_objective_mapping_test.go |
Adds unit tests for mapping scoring and config loading behavior. |
pkg/github/label_objective_mapping_constants.go |
Adds label/value constants intended to describe default objective labels/values. |
pkg/cli/README.md |
Documents the new gh aw outcomes history subcommand. |
pkg/cli/outcomes_history.go |
Implements historical scoring of recent closed issues/merged PRs via objective mapping. |
pkg/cli/outcomes_history_test.go |
Adds tests for the history report builder and JSON output path. |
pkg/cli/outcomes_command.go |
Wires objective mapping into the outcomes command execution flow and registers the history subcommand. |
pkg/cli/outcome_eval.go |
Adds objective enrichment + PR→closing-issue tracing and extends OutcomeReport/OutcomeSummary. |
pkg/cli/outcome_eval_test.go |
Updates tests for new function signatures and adds tests for objective enrichment/root tracing. |
pkg/cli/outcome_domain_breakdown.go |
New domain/objective breakdown aggregation + insight helper. |
pkg/cli/audit_report.go |
Wires objective mapping into audit report outcome evaluation/summary computation. |
.github/workflows/objective-impact-report.md |
Updates the workflow spec to use objective mapping + adds safe-output close-issue behavior. |
.github/workflows/objective-impact-report.lock.yml |
Regenerates the compiled lock workflow to reflect the spec changes (adds close_issue). |
.github/objective-mapping.json |
Adds repo-local objective mapping configuration used by the CLI. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 15/15 changed files
- Comments generated: 9
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot Fix remaining review comments by github-actions or copilot and reolve merge conflicts. |
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Merged main into the branch in commit |
Add objective mapping and
outcomes historysubcommandSummary
Introduces a label-driven objective-value scoring system that maps GitHub issue/PR labels to numeric impact scores, threads that mapping through the existing outcome-evaluation pipeline, adds a new
gh aw outcomes historysubcommand for scoring recent closed issues and merged PRs, and updates the objective-impact-report workflow to use the new config-backed scoring in place of hardcoded priority tiers.A companion spec document (
specs/objective-mapping-portfolio-reporting.md) defines the full architecture; Phase 1 (this PR) is fully implemented.Changes
New:
pkg/github— Objective mapping foundationlabel_objective_mapping.goObjectiveMappingtype. Computes numeric objective values from a slice of GitHub labels using configurablesum/max/firstmulti-label logic. Loads config from env var,.github/objective-mapping.json, or built-in defaults in that precedence order.label_objective_mapping_constants.gomax,sum,first).label_objective_mapping_test.goLoadObjectiveMappingFromConfigprecedence chain.New:
.github/objective-mapping.jsonChecked-in JSON configuration mapping GitHub labels to numeric objective values, specifying
maxas the multi-label aggregation strategy, and providing a rankedpriority-labelslist used by the impact-efficiency workflow.Modified:
pkg/cli— Outcome evaluation pipelineoutcome_eval.goEvaluateOutcomesandComputeOutcomeSummaryeach gain a required*github.ObjectiveMappingparameter.OutcomeReportgainsObjectiveValue,ObjectiveLabels, andTracedRootURL.OutcomeSummarygainsTotalObjectiveValue,AcceptedObjectiveValue,ObjectiveEfficiency, andDomainBreakdowns. Adds a GraphQL-backed PR root-tracing pipeline (ghAPIGraphQL,tracePullRequestRoot,enrichOutcomeWithObjectiveValue) to resolve labels from closing issues.outcome_domain_breakdown.goComputeDomainBreakdownsaggregates per-label metrics and sorts by total objective value.AnalyzeDomainPerformanceclassifies domain efficiency intoexcellent/good/fair/poor/newtiers with human-readable messages and improvement suggestions.audit_report.gobuildAuditDatato callgithub.LoadObjectiveMappingFromConfigand forward the result to the updatedEvaluateOutcomesandComputeOutcomeSummary.outcomes_command.gooutcomes historysubcommand and threads the loadedObjectiveMappingthrough bothEvaluateOutcomesandComputeOutcomeSummarycall sites.outcome_eval_test.gogithub.DefaultObjectiveMapping(). AddedTestEnrichOutcomeWithObjectiveValue_TracesPullRequestToRootIssueandTestEnrichOutcomeWithObjectiveValue_FallsBackToDirectLabelswith injectable API stubs.New:
pkg/cli/outcomes_history.go+outcomes_history_test.goImplements the
gh aw outcomes historysubcommand. Fetches recent closed issues and merged PRs from GitHub, scores each against the objective label mapping, and renders a bucketed summary with representative items to stderr (or JSON to stdout with--json). Tests cover subcommand registration, historical report building, JSON output mode, and verbose flag inheritance.Modified:
.github/workflows/objective-impact-report.mdRewrites the workflow to consume
objective-mapping.json-based scoring, removing all hardcoded P0–P3 tiers and milestone/project bonuses. Adds aclose-issuesafe-output permission so stale same-day reports are replaced before a new one is created. Formalises a deterministic AIC source-of-truth ordering that prefers precomputedgh aw logs --jsondata over live MCP retrieval.New:
specs/objective-mapping-portfolio-reporting.mdSpecification covering implementation scope (Phase 1 complete, Phase 2+ as future extensions), configuration format, root-tracing architecture, campaign alignment, and end-to-end data flow.
Modified:
pkg/cli/README.mdAdded documentation row for
gh aw outcomes history(NewOutcomesHistorySubcommand).Breaking changes
EvaluateOutcomes(...)objectiveMapping *github.ObjectiveMappingComputeOutcomeSummary(...)objectiveMapping *github.ObjectiveMappingAll in-tree call sites (
audit_report.go,outcomes_command.go,outcome_eval_test.go) have been updated.Testing
pkg/github/label_objective_mapping_test.go— unit tests for all scoring logic modes and config loading precedencepkg/cli/outcome_eval_test.go— updated existing tests; two new tests for PR root-tracing and direct-label fallback using injectable stubspkg/cli/outcomes_history_test.go— four new tests for theoutcomes historysubcommand (registration, report building, JSON mode, verbose inheritance)