Skip to content

Refactor objective mapping source-of-truth: remove dead label/value constants and align docs/specs to runtime defaults - #52831

Merged
pelikhan merged 5 commits into
mainfrom
copilot/refactor-objective-mapping-constants
Aug 15, 2026
Merged

Refactor objective mapping source-of-truth: remove dead label/value constants and align docs/specs to runtime defaults#52831
pelikhan merged 5 commits into
mainfrom
copilot/refactor-objective-mapping-constants

Conversation

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

pkg/github carried a full table of exported objective label/value constants that were not used by runtime code and had drifted from DefaultObjectiveMapping(), creating contradictory scoring semantics. This change makes runtime defaults the single source of truth and keeps only the logic constants that are actively used by the implementation.

  • Single source of truth for objective scores

    • Removed pkg/github/label_objective_mapping_constants.go (dead exported label/value constants).
    • Kept objective scoring defined by DefaultObjectiveMapping().
  • Use live constants in computation path

    • Retained MultiLabelLogicMax|Sum|First as exported constants.
    • Moved them into label_objective_mapping.go and replaced raw string literals in ComputeObjectiveValue.
  • Deduplicate label normalization/lookup logic

    • Added shared helpers for normalize+lookup and routed compute/filter/has paths through them.
    • Eliminates repeated ToLower/TrimSpace lookup sites while preserving behavior.
  • Spec and package docs now reflect runtime behavior

    • Updated pkg/github/spec_test.go to assert default mapping values directly instead of tautological constant checks.
    • Updated pkg/github/README.md to document multi-label logic constants and the default mapping table from DefaultObjectiveMapping().
// before
switch logic {
case "sum":
case "first":
default: // "max"
}

// after
switch logic {
case MultiLabelLogicSum:
case MultiLabelLogicFirst:
default: // MultiLabelLogicMax
}

Run context: https://github.com/github/gh-aw/actions/runs/31867777089> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 33.2 AIC · ⌖ 5.85 AIC · ⊞ 8.7K ·

Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 19.4 AIC · ⌖ 6.65 AIC · ⊞ 6.3K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 11.4 AIC · ⌖ 5.87 AIC · ⊞ 6.3K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/31883373617> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 16.4 AIC · ⌖ 5.78 AIC · ⊞ 6.3K ·

Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 19.6 AIC · ⌖ 7.98 AIC · ⊞ 8.7K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor dead ObjectiveMapping constants to align with live defaults Refactor objective mapping source-of-truth: remove dead label/value constants and align docs/specs to runtime defaults Aug 15, 2026
Copilot AI requested a review from pelikhan August 15, 2026 05:00
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for implementing this refactor! 🎯

You've tackled the key issues cleanly:

  • Removed the dead label_objective_mapping_constants.go that contradicted the live defaults
  • Aligned specs and documentation to reflect actual runtime behavior
  • Replaced string literals with named constants in ComputeObjectiveValue
  • Updated test assertions to be concrete rather than tautological

Observation on contribution type:
The CONTRIBUTING.md doesn't explicitly state whether internal refactoring/technical debt (cleanup, dead code removal) are accepted contribution types for this project. This looks great, but confirming alignment with roadmap priorities would help.

What looks good:

  • ✅ Tests updated to match refactored code
  • ✅ PR body clearly documents the changes with examples
  • ✅ All changes are focused on a single objective

Ready for technical review by maintainers.

Generated by ✅ Contribution Check · auto · 50.6 AIC · ⌖ 3.74 AIC · ⊞ 8.8K ·

@pelikhan
pelikhan marked this pull request as ready for review August 15, 2026 05:18
Copilot AI balanced review requested due to automatic review settings August 15, 2026 05:18
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #52831

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #52831 does not have the 'implementation' label and has only 79 new lines of code in business logic directories (threshold: 100).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

🧪 Test quality analysis by Test Quality Sentinel

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

No actionable blocking issues found in the changed lines.

Review notes

I checked the refactor against the touched code paths and did not find a correctness, concurrency, or performance regression in the runtime behavior. The main behavioral change is the intentional removal of stale exported score constants in favor of DefaultObjectiveMapping() as the sole source of truth, and the updated tests/docs are aligned with that direction.

The background grumpy-coder pass did not yield usable findings during the review window, so this verdict is based on the direct code review of the diff.

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 3.73 AIC · ⌖ 5.17 AIC · ⊞ 4K
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Approved

This PR correctly removes dead label/value constants that had diverged from the runtime defaults in DefaultObjectiveMapping() (e.g., ObjectiveValueSecurityFix was 70 in constants but 75 at runtime; ObjectiveValueHighPriority was 35 vs runtime 50). Key improvements:

  • Single source of truth: DefaultObjectiveMapping() is now the only canonical definition of label values.
  • DRY refactor: objectiveValueForLabel with nil-guard consolidates 4 duplicate normalization call sites.
  • Constants preserved where needed: MultiLabelLogicMax/Sum/First correctly moved to the main file.
  • Tests updated: TestSpec_DefaultObjectiveMapping_Values now tests the live function output rather than stale constants.

No correctness issues found. The README values match the actual Go function.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 28.7 AIC · ⌖ 7.05 AIC · ⊞ 5.4K

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors objective scoring so DefaultObjectiveMapping() defines runtime defaults.

Changes:

  • Removes obsolete objective label/value constants.
  • Centralizes normalized label lookup.
  • Aligns tests and documentation with runtime defaults.
Show a summary per file
File Description
pkg/github/label_objective_mapping.go Adds shared lookup helpers and uses live logic constants.
pkg/github/label_objective_mapping_constants.go Removes legacy exported constants.
pkg/github/spec_test.go Tests default mappings directly.
pkg/github/README.md Documents current defaults and logic constants.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread pkg/github/spec_test.go Outdated
Comment thread pkg/github/README.md
@github-actions github-actions Bot mentioned this pull request Aug 15, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated by ✂️ Ponytail Reviewer for #52831 · auto · 21.1 AIC · ⌖ 7.59 AIC · ⊞ 6.8K
Comment /ponytail to run again

Comment thread pkg/github/label_objective_mapping.go Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /codebase-design, /tdd, and /grill-with-docs — commenting on a few targeted issues; no blocking changes.

📋 Key Themes & Highlights

Key Themes

  • Test spec completeness: TestSpec_DefaultObjectiveMapping_ExcludesUnmappedLabels only checks "bug" — the former constants file had ~15 excluded labels worth documenting as intentional.
  • Nil-guard placement: objectiveValueForLabel adds a nil check that is already handled by all callers; the contract should live in one place.
  • Documentation gap: The README doesn't explain why formerly-constant labels (bug, testing, reliability) are now absent from the default mapping, which may confuse future contributors.

Positive Highlights

  • ✅ Excellent call removing the drifted constants file — tautological tests are a subtle but real correctness risk.
  • objectiveValueForLabel helper is a clean deep-module move: one normalize+lookup path instead of three.
  • ✅ Replacing raw string literals with MultiLabelLogicMax/Sum/First in the switch makes intent explicit.
  • ✅ New spec test asserts real behaviour rather than round-tripping through exported constants.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 47 AIC · ⌖ 8.64 AIC · ⊞ 7K
Comment /matt to run again

Comment thread pkg/github/spec_test.go Outdated
Comment thread pkg/github/spec_test.go
Comment thread pkg/github/label_objective_mapping.go Outdated
Comment thread pkg/github/README.md
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, address the remaining maintainer-facing follow-up, and run the pr-finisher skill before handing this PR back to maintainers.

Outstanding review items (newest first):

  • No unresolved review threads were available from the compact context; please verify the current branch and maintainer expectations before handoff.

Failed checks from the compact candidate set:

Branch update was requested automatically for this run when GitHub allows it.
Run context: https://github.com/github/gh-aw/actions/runs/31867777089

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 33.2 AIC · ⌖ 5.85 AIC · ⊞ 8.7K ·
Comment /souschef to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, address the remaining maintainer-facing follow-up, and run the pr-finisher skill before handing this PR back to maintainers.

Outstanding review items (newest first):

  • verify the current branch is maintainer-ready after the latest fixes and confirm whether any reviewer follow-up remains
  • listed failures in the earlier run looked cache-related; ensure the current branch state is ready for a fresh CI pass before handoff

Failed checks from the compact candidate set:

  • None listed.

Branch update was requested automatically for this run when GitHub allows it.
Run context: https://github.com/github/gh-aw/actions/runs/31870657040

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 14.7 AIC · ⌖ 7.13 AIC · ⊞ 6.3K ·
Comment /souschef to run again

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, address the remaining maintainer-facing follow-up, and run the pr-finisher skill before handing this PR ba...

Maintainer-readiness triage is complete on current HEAD ac0121e.

  • Branch state: PR Refactor objective mapping source-of-truth: remove dead label/value constants and align docs/specs to runtime defaults #52831 is open, non-draft, and on the expected head SHA.
  • Local validation: make fmt, make lint, make test-unit, make test, and make recompile all pass locally.
  • CI failure triage: reviewed failed-job logs for run 31866638017; all six failures were actions/cache restore misses with fail-on-cache-miss: true (infra/cache condition), not a code regression from this branch.
  • Reviewer follow-up: no new maintainer-facing code changes were required in this pass; unresolved review threads are still visible in GitHub metadata and should be explicitly resolved/closed during final maintainer review if satisfied.

This branch is ready for a fresh CI pass and maintainer handoff.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, address any remaining maintainer-facing follow-up, and run the pr-finisher skill before handing this PR back to maintainers.

Outstanding review items (newest first):

  • No unresolved review threads were surfaced from available context; please verify current maintainer expectations before handoff.

Failed checks from the compact candidate set:

  • None listed.

Branch update was requested automatically for this run when GitHub allows it.
Run context: https://github.com/github/gh-aw/actions/runs/31874029539

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.88 AIC · ⌖ 5.77 AIC · ⊞ 8.7K ·
Comment /souschef to run again

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, address any remaining maintainer-facing follow-up, and run the pr-finisher skill before handing this PR ba...

Maintainer-readiness triage is complete on current HEAD ac0121e.

  • Verified branch/PR state is still open and on the expected head.
  • Re-checked CI context: no newly listed failed checks in the compact set.
  • Revalidated prior failing run 31866638017 at log level (get_job_logs): failures were cache-restore misses with fail-on-cache-miss: true, not code regressions.
  • Re-ran local validation: make fmt, make lint, make test-unit, make test, and make recompile all pass.

No additional code changes were required in this pass; branch is ready for maintainer CI re-trigger and handoff.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, address any remaining maintainer-facing follow-up, and run the pr-finisher skill before handing this PR back to maintainers.

Outstanding review items (newest first):

  • verify the current branch is maintainer-ready after the latest fixes and confirm whether any reviewer follow-up remains
  • listed failures in the earlier run looked cache-related; ensure the current branch state is ready for a fresh CI pass before handoff

Failed checks from the compact candidate set:

  • None listed.

Branch update was requested automatically for this run when GitHub allows it.
Run context: https://github.com/github/gh-aw/actions/runs/31875928309

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 19.4 AIC · ⌖ 6.65 AIC · ⊞ 6.3K ·
Comment /souschef to run again

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, address any remaining maintainer-facing follow-up, and run the pr-finisher skill before handing this PR ba...

Maintainer-readiness triage is complete on current HEAD ac0121e.

  • Branch state is open, non-draft, and not behind base; no branch refresh is needed.
  • Re-checked reviewer follow-up: no new maintainer-facing code changes are required from the latest feedback.
  • Re-checked the earlier failed run (31866638017) at log level: all six failures are actions/cache restore misses with fail-on-cache-miss: true, not branch regressions.
  • Re-ran local validation on current HEAD: make fmt, make lint, make test-unit, make test, and make recompile all pass.

This branch is ready for a fresh maintainer-triggered CI pass and handoff.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, address any remaining maintainer-facing follow-up, and run the pr-finisher skill before handing this PR back to maintainers.

Outstanding review items (newest first):

Failed checks from the compact candidate set:

  • None listed.

Branch update was requested automatically for this run when GitHub allows it.
Run context: https://github.com/github/gh-aw/actions/runs/31880300352

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 11.4 AIC · ⌖ 5.87 AIC · ⊞ 6.3K ·
Comment /souschef to run again

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, address any remaining maintainer-facing follow-up, and run the pr-finisher skill before handing this PR ba...

Maintainer follow-up is complete on current HEAD ac0121e.

  • Addressed all listed review comments with direct thread replies:
    • #discussion_r3788604329
    • #discussion_r3788604330
    • #discussion_r3788604331
    • #discussion_r3788604332
    • #discussion_r3788602294
    • #discussion_r3788598938
    • #discussion_r3788598925
  • Re-validated prior CI failure run 31866638017 at log level: all six failures are actions/cache restore misses with fail-on-cache-miss: true (infra/cache), not branch regressions.
  • Re-ran local validation on this HEAD: make fmt, make lint, make test-unit, make test, and make recompile all pass.
  • Branch state remains open and non-draft on expected head.

This branch is maintainer-ready for a fresh maintainer-triggered CI pass and final merge review.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot quick triage for this PR:

  • please refresh the branch with the latest base changes if GitHub's branch update is available
  • review the current PR feedback and checks status
  • then run the pr-finisher skill to drive this PR toward maintainer-ready state

Run: https://github.com/github/gh-aw/actions/runs/31883373617

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 16.4 AIC · ⌖ 5.78 AIC · ⊞ 6.3K ·
Comment /souschef to run again

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot quick triage for this PR:

  • please refresh the branch with the latest base changes if GitHub's branch update is available...

Triage complete on current HEAD ac0121e.

  • Branch/base refresh check: branch is not behind main (no update needed).
  • PR feedback/checks review: no new maintainer-facing code changes were required; remaining unresolved items are prior threads already addressed in-reply and pending maintainer thread resolution.
  • CI/checks status: latest branch runs for this head are action_required without failed jobs; earlier failing run 31866638017 still root-causes to actions/cache misses with fail-on-cache-miss: true (infra/cache, not code regression).
  • Local validation on this HEAD passed: make fmt, make lint, make test-unit, make test, and make recompile.

This PR is maintainer-ready for a fresh maintainer-triggered CI pass and final merge review.

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: refactor
  • Risk: medium
  • Priority: medium
  • Score: 50/100
  • Recommended action: fast_track

Removes dead objective-mapping constants, aligns docs to runtime defaults. CI passing (5/5). Low functional risk despite refactor scope.

Automated triage — see [PR Triage Report] for full context.

Generated by 🔧 PR Triage Agent · auto · 62.5 AIC · ⌖ 2.53 AIC · ⊞ 8.1K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, address the remaining maintainer-facing follow-up, and run the pr-finisher skill before handing this PR back to maintainers.

Outstanding review items (newest first):

Failed checks from the compact candidate set:

  • None listed.

Branch update was requested automatically for this run when GitHub allows it.
Run context: https://github.com/github/gh-aw/actions/runs/31885005799

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 19.6 AIC · ⌖ 7.98 AIC · ⊞ 8.7K ·
Comment /souschef to run again

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, address the remaining maintainer-facing follow-up, and run the pr-finisher skill before handing this PR ba...

Maintainer-readiness follow-up is complete on current HEAD 67acdde.

  • Branch refresh: head is not behind main; no branch update is needed.
  • Review follow-up: the listed review threads are now resolved in PR metadata.
  • Checks review: no failed checks are currently listed in the compact set; latest branch CGO run is action_required with no failed jobs.
  • Prior CI failure triage: run 31866638017 still root-causes to actions/cache restore misses with fail-on-cache-miss: true across all 6 failed jobs (infra/cache, not code regression).
  • Local validation re-run passed on this head: make fmt, make lint, make test-unit, make test, and make recompile.

This PR is maintainer-ready for a fresh maintainer-triggered CI pass and final merge review.

@pelikhan
pelikhan merged commit f136333 into main Aug 15, 2026
28 checks passed
@pelikhan
pelikhan deleted the copilot/refactor-objective-mapping-constants branch August 15, 2026 13:08
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.86.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] Objective-mapping constants are dead code and contradict the live default mapping

4 participants