Skip to content

Remove duplicate TLS helpers and consolidate DIFC/proxy utility functions#7889

Merged
lpcox merged 3 commits into
mainfrom
copilot/refactor-semantic-function-clustering
Jun 21, 2026
Merged

Remove duplicate TLS helpers and consolidate DIFC/proxy utility functions#7889
lpcox merged 3 commits into
mainfrom
copilot/refactor-semantic-function-clustering

Conversation

Copilot AI commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

A recent refactor introduced duplicate TLS helper declarations in internal/httputil, which broke package compilation. This change removes the duplicate pair and folds two small utility refactors into their existing semantic homes to reduce local duplication.

  • Restore single TLS helper source in httputil

    • Remove the duplicate tls_config.go / tls_config_test.go pair.
    • Keep tls.go / tls_test.go as the canonical TLS config helpers for the package.
  • Collapse DIFC tag string conversion duplication

    • Replace the private sorted tagsToStrings helper in internal/difc/reflect.go with:
      • TagsToStrings(...)
      • explicit sort.Strings(...) at the reflect-response call site
    • Drop the now-redundant helper-specific test coverage.
  • Co-locate proxy arg parsing utilities

    • Move extractOwnerRepoNumber(...) from internal/proxy/proxy.go to internal/proxy/router.go, alongside the existing route arg builder/extractor helpers.
    • Keep behavior and signature unchanged.
secrecy := TagsToStrings(agent.GetSecrecyTags())
sort.Strings(secrecy)

integrity := TagsToStrings(agent.GetIntegrityTags())
sort.Strings(integrity)

agents[agentID] = ReflectedAgentLabels{
    Secrecy:   secrecy,
    Integrity: integrity,
}

GitHub Advanced Security started work on behalf of lpcox June 21, 2026 16:10 View session
GitHub Advanced Security finished work on behalf of lpcox June 21, 2026 16:11
GitHub Advanced Security started work on behalf of lpcox June 21, 2026 16:13 View session
GitHub Advanced Security finished work on behalf of lpcox June 21, 2026 16:14
Copilot AI changed the title [WIP] Refactor semantic function clustering analysis for httputil TLS duplicate Remove duplicate TLS helpers and consolidate DIFC/proxy utility functions Jun 21, 2026
Copilot finished work on behalf of lpcox June 21, 2026 16:15
Copilot AI requested a review from lpcox June 21, 2026 16:15
@lpcox lpcox marked this pull request as ready for review June 21, 2026 17:10
Copilot AI review requested due to automatic review settings June 21, 2026 17:10

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

This PR removes a duplicate TLS helper implementation that broke internal/httputil compilation, and consolidates small utility helpers to reduce local duplication in DIFC reflection and proxy tool argument parsing.

Changes:

  • Delete the duplicate internal/httputil/tls_config*.go pair, keeping tls.go / tls_test.go as the single TLS helper source.
  • Replace the private, sorting tagsToStrings helper with TagsToStrings plus explicit sorting at the reflect-response call site.
  • Move extractOwnerRepoNumber(...) from internal/proxy/proxy.go to internal/proxy/router.go to co-locate route/arg helpers.
Show a summary per file
File Description
internal/proxy/router.go Adds extractOwnerRepoNumber helper alongside other route/arg utilities.
internal/proxy/proxy.go Removes the duplicate extractOwnerRepoNumber implementation and related import.
internal/httputil/tls_config.go Deletes duplicate TLS helper implementation (source of package compilation conflict).
internal/httputil/tls_config_test.go Deletes duplicate TLS helper tests (canonical tests remain in tls_test.go).
internal/difc/reflect.go Uses TagsToStrings and sorts at call site; removes private sorted helper.
internal/difc/reflect_test.go Drops tests that directly targeted the removed private helper.

Copilot's findings

Tip

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

  • Files reviewed: 6/6 changed files
  • Comments generated: 1

Comment thread internal/proxy/router.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
GitHub Advanced Security started work on behalf of lpcox June 21, 2026 17:17 View session
GitHub Advanced Security finished work on behalf of lpcox June 21, 2026 17:18
@lpcox lpcox merged commit d7cd060 into main Jun 21, 2026
27 checks passed
@lpcox lpcox deleted the copilot/refactor-semantic-function-clustering branch June 21, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants