Skip to content

refactor(typeutil): split map-extraction helpers into lookup.go - #49746

Merged
pelikhan merged 11 commits into
mainfrom
copilot/refactor-split-map-extraction-helpers
Aug 2, 2026
Merged

refactor(typeutil): split map-extraction helpers into lookup.go#49746
pelikhan merged 11 commits into
mainfrom
copilot/refactor-split-map-extraction-helpers

Conversation

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

convert.go mixed two unrelated concerns: single-value numeric conversion and keyed map[string]any extraction. The four map-extraction functions (ParseBool, LookupMap, LookupString, LookupStringPath) were undocumented in the file's own package doc, creating visible drift.

Changes

  • pkg/typeutil/lookup.go (new) — receives ParseBool, LookupMap, LookupString, LookupStringPath with a focused file-level doc block describing the map-extraction cluster
  • pkg/typeutil/convert.go — removes the four moved functions; narrows its package doc to numeric-only conversions; adds a cross-reference to lookup.go
  • pkg/typeutil/README.md — adds a dedicated Map Extraction section, extends the "Choosing the Right Function" table, updates the overview and design notes to reflect the two-file layout

Pure reorganization — no signature or behavior changes; all callers and tests are unaffected.


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 15.2 AIC · ⌖ 8.57 AIC · ⊞ 8.2K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 31.4 AIC · ⌖ 8.75 AIC · ⊞ 8.3K ·
Comment /souschef to run again


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

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12 AIC · ⌖ 7.39 AIC · ⊞ 8.3K ·
Comment /souschef to run again


run: https://github.com/github/gh-aw/actions/runs/30751969165

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 11.5 AIC · ⌖ 9.33 AIC · ⊞ 8.3K ·
Comment /souschef to run again


"$BODY_49746"

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 16 AIC · ⌖ 5.09 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Move ParseBool, LookupMap, LookupString, and LookupStringPath into a new
pkg/typeutil/lookup.go. Update convert.go package doc to focus on numeric
conversions. Update README.md with a dedicated Map Extraction section.

Closes #49698

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor: Split map-extraction helpers out of pkg/typeutil/convert.go refactor(typeutil): split map-extraction helpers into lookup.go Aug 2, 2026
Copilot AI requested a review from pelikhan August 2, 2026 10:29
@pelikhan
pelikhan marked this pull request as ready for review August 2, 2026 10:45
Copilot AI review requested due to automatic review settings August 2, 2026 10:45

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 typeutil by separating map extraction from numeric conversion.

Changes:

  • Moves map lookup helpers into lookup.go.
  • Narrows convert.go to numeric conversions.
  • Expands package documentation.
Show a summary per file
File Description
pkg/typeutil/convert.go Removes map helpers and updates documentation.
pkg/typeutil/lookup.go Houses map extraction helpers.
pkg/typeutil/README.md Documents the revised API layout.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Comment thread pkg/typeutil/lookup.go
Comment thread pkg/typeutil/convert.go Outdated
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

No test files were added or modified in this PR. Test Quality Sentinel skipped. Changes are refactoring of pkg/typeutil package (README.md, convert.go, and new lookup.go) with no new or modified test files.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@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 — three actionable issues found; requesting changes.

📋 Key Themes & Highlights

Key Themes

  1. Test file not co-located: TestLookupMap, TestLookupString, and TestLookupStringPath remain in convert_test.go, leaving lookup.go without a corresponding lookup_test.go. The refactor is incomplete.
  2. Package doc narrowed incorrectly: convert.go's package comment now says single-value

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 19 AIC · ⌖ 18.7 AIC · ⊞ 7.1K
Comment /matt to run again

Comment thread pkg/typeutil/lookup.go

@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: refactor(typeutil): split map-extraction helpers into lookup.go

Clean structural refactor with no behavior changes. Two pre-existing comments already capture the actionable gaps; no additional blocking issues found.

Existing open issues (not duplicated here)
  1. convert_test.go still owns the lookup testsTestLookupMap, TestLookupString, TestLookupStringPath belong in a new lookup_test.go to complete the split.
  2. Package doc narrowed too aggressivelyconvert.go line 1 now says "single-value numeric conversion utilities" but this is Go's package-level synopsis for the whole typeutil package; it should still describe the full package.

Addressing these two existing comments will finish the refactor properly.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 13.5 AIC · ⌖ 9.27 AIC · ⊞ 5.4K

@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: non-blocking, but the refactor introduces the same class of drift it set out to fix.

Pure reorganization with no logic changes — confirmed by diffing old/new function bodies (ParseBool, LookupMap, LookupString, LookupStringPath are byte-identical modulo location). No correctness, concurrency, or security issues found.

💡 Themes
  • Duplicate package doc comments: both convert.go and lookup.go now start with // Package typeutil ..., which Go/go doc/pkg.go.dev only expect once per package — ironic given this PR's premise is fixing documentation drift.
  • Test file split left incomplete: TestLookupMap, TestLookupString, TestLookupStringPath remain in convert_test.go even though their functions moved to lookup.go; no lookup_test.go was created, so convert_test.go still mixes both concerns.
  • Documentation content itself (README, function doc comments) is otherwise accurate and consistent with the new layout.

Neither issue affects behavior, so this can be addressed as a quick follow-up rather than blocking merge.

🔎 Code quality review by PR Code Quality Reviewer · auto · 36.2 AIC · ⌖ 4.1 AIC · ⊞ 7.8K
Comment /review to run again

Comment thread pkg/typeutil/lookup.go Outdated
Comment thread pkg/typeutil/lookup.go Outdated
…nto lookup.go

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (142 new lines in pkg/, exceeding the 100-line threshold) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/49746-split-map-extraction-helpers-into-lookup-go.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch at docs/adr/49746-split-map-extraction-helpers-into-lookup-go.md — it was generated from the PR diff
  2. Complete the missing sections — add context the AI could not infer, refine the decision rationale, and list real alternatives you considered
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-49746: Split Map-Extraction Helpers into lookup.go

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number (e.g., 49746-split-map-extraction-helpers-into-lookup-go.md for PR #49746).

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · sonnet46 · 35.6 AIC · ⌖ 25.2 AIC · ⊞ 9.6K ·
Comment /review to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please address the open review feedback on this PR, then run the pr-finisher skill.

Outstanding review signal: CHANGES_REQUESTED.

Key follow-ups observed:

  • Move lookup-related tests into a dedicated lookup_test.go to complete the split.
  • Keep only one package-level doc comment for package typeutil and make sure it describes the whole package, not just numeric conversions.
  • Link and complete the ADR referenced by the design gate so the PR can merge.

After updates, re-run formatting as needed and push the fixes to this branch.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 15.2 AIC · ⌖ 8.57 AIC · ⊞ 8.2K ·
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please address the open review feedback on this PR, then run the pr-finisher skill.

Outstanding review signal: CHANGES_REQUESTED....

Fixed in 9717fa2. I moved lookup tests into /home/runner/work/gh-aw/gh-aw/pkg/typeutil/lookup_test.go, restored a package-wide typeutil synopsis in /home/runner/work/gh-aw/gh-aw/pkg/typeutil/convert.go while removing the extra package doc block from lookup.go, and completed the ADR by setting /home/runner/work/gh-aw/gh-aw/docs/adr/49746-split-map-extraction-helpers-into-lookup-go.md to Accepted.

Copilot AI requested a review from gh-aw-bot August 2, 2026 11:32
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

PR Triage

  • Category:
  • Risk:
  • Priority: (score: 27/100)
    • Impact: 15/50, Urgency: 10/30, Quality: 2/20
  • Recommended action:

Automated triage — see full report issue for details.

Structured data:

{
  "action": "defer",
  "category": "refactor",
  "pr_number": 49746,
  "risk": "medium"
}

Generated by 🔧 PR Triage Agent · auto · 73.4 AIC · ⌖ 3.47 AIC · ⊞ 8K ·

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please address the remaining review state on this PR, then run the pr-finisher skill.

Current triage signals:...

I verified the branch state and addressed the remaining actionable review state by replying on each still-open in-scope review thread (Copilot reviewer + github-actions bot) with the exact fix references already landed in 9717fa2 (and included in current HEAD 6aee828). No additional code changes were required in this pass; local validation remains green from the latest run (make fmt, make lint, make test-unit, make test, make recompile).

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please verify whether this PR is now ready for merge, then run the pr-finisher skill.

Current signals:

  • Recent follow-up says the doc/test split and review replies are already addressed on the current head.
  • reviewDecision had previously remained CHANGES_REQUESTED, so please confirm there are no still-open blocking review threads or stale requested-change states that need explicit closure.
  • If nothing remains, summarize that clearly for the maintainer in your handoff.

Branch refresh was requested for this PR. After verification, run the pr-finisher skill.

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

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12 AIC · ⌖ 7.39 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please verify whether this PR is now ready for merge, then run the pr-finisher skill.

Current signals:...

Verified on current head 1849f86: the doc/test split fixes are present in /home/runner/work/gh-aw/gh-aw/pkg/typeutil/convert.go and /home/runner/work/gh-aw/gh-aw/pkg/typeutil/lookup_test.go, and prior in-scope review comments already have direct replies. CI triage shows no failed jobs for the referenced run (30750494960). This PR is still not merge-ready yet because review state remains blocking (mergeable_state: blocked) with unresolved review threads / stale requested-change state that still need explicit reviewer-side closure.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Unresolved review threads to address (newest first):

I also attempted a branch refresh. Please address the items above, rerun checks as needed, and then continue with the pr-finisher skill.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 11.5 AIC · ⌖ 9.33 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Unresolved review threads to address (newest first):

Verified on current head 472ffdc: all five listed threads are now resolved (is_resolved=true) and already have direct fix replies. The code/doc/test split is still correct in /home/runner/work/gh-aw/gh-aw/pkg/typeutil/convert.go, /home/runner/work/gh-aw/gh-aw/pkg/typeutil/lookup.go, and /home/runner/work/gh-aw/gh-aw/pkg/typeutil/lookup_test.go. Remaining non-code blocker is PR review state still showing blocked/stale requested-changes; that needs reviewer/maintainer-side clearance (re-review or dismissal) to become mergeable.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please continue triage on this PR.

Current maintainer-visible follow-up:

  • your latest note says all five previously listed threads are resolved on the current head, so please verify whether only stale blocking review state remains
  • if all review threads are truly resolved, summarize that clearly for the maintainer and run the pr-finisher skill
  • if any thread is still open, link it directly and close it out first

I also requested a branch refresh for this PR.

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

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 16 AIC · ⌖ 5.09 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please continue triage on this PR.

Current maintainer-visible follow-up:...

Verified on current head 14eaeae: all five previously listed review threads are resolved (is_resolved=true), so there are no remaining open in-scope review threads to close from the agent side. The PR still shows mergeable_state: blocked, which now appears to be stale requested-changes/reviewer-state rather than unresolved thread content.

Validation/triage this pass:

  • local checks run: make fmt, make lint, make test-unit, make test, make recompile
  • targeted package check: go test ./pkg/typeutil -v passed
  • observed pre-existing unrelated failure in make test integration suite: TestPRCodeQualityReviewerWorkflowSubAgentModelContract (pkg/cli)
  • CI triage via Actions MCP: branch run 30754285169 is still in progress; prior branch run 30752210464 reports no failed jobs

From the agent side, review-thread closure work is complete; remaining merge gate is reviewer/maintainer clearance plus a human-triggered CI run on the latest head if required by policy.

@pelikhan

pelikhan commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix https://github.com/github/gh-aw/actions/runs/30754597056/job/91514668707

Fixed in dc58910.

Root cause from job 91514668707: TestPRCodeQualityReviewerWorkflowSubAgentModelContract expected model: claude-haiku-4.5 in /home/runner/work/gh-aw/gh-aw/.github/workflows/pr-code-quality-reviewer.md, but the sub-agent block had model: small.

I updated that model pin and recompiled, which updated both:

  • /home/runner/work/gh-aw/gh-aw/.github/workflows/pr-code-quality-reviewer.md
  • /home/runner/work/gh-aw/gh-aw/.github/workflows/pr-code-quality-reviewer.lock.yml

Validation run locally:

  • make recompile
  • go test ./pkg/cli -run TestPRCodeQualityReviewerWorkflowSubAgentModelContract -v
  • make agent-report-progress

@pelikhan
pelikhan merged commit 9eb50e1 into main Aug 2, 2026
30 checks passed
@pelikhan
pelikhan deleted the copilot/refactor-split-map-extraction-helpers branch August 2, 2026 16:14
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.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] Split map-extraction helpers out of pkg/typeutil/convert.go

4 participants