Skip to content

[Code Quality] Refactor addActivationInteractionPermissionsMap to reduce complex branching depth #48087

Description

@github-actions

Description

The addActivationInteractionPermissionsMap function in pkg/cli/compiler_activation_job.go (62 lines) has been flagged for complex branching depth. Its high cyclomatic complexity makes the function hard to reason about, test in isolation, and maintain when permission rules change.

Suggested Changes

  • Break addActivationInteractionPermissionsMap (62 lines) into 2-3 focused helpers, one per permission category/concern
  • Extract repeated branching patterns into a small table-driven lookup or data-driven approach
  • Ensure each extracted helper has a godoc comment
  • Verify all existing tests in compiler_activation_job_test.go still pass after refactor

Files Affected

  • pkg/cli/compiler_activation_job.go (lines ~62-line function)
  • pkg/cli/compiler_activation_job_test.go (update or add unit tests for new helpers)

Success Criteria

  • addActivationInteractionPermissionsMap is ≤35 lines
  • Each extracted helper has a godoc comment
  • All existing tests pass (make test-unit)
  • No change to external behavior

Source

Extracted from Daily Compiler Code Quality Report - 2026-07-25 discussion #47903: addActivationInteractionPermissionsMap is 62 lines with complex branching depth.

Priority

Medium — improves maintainability of the activation pipeline

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · sonnet46 · 54.2 AIC · ⌖ 8.34 AIC · ⊞ 7.2K ·

  • expires on Jul 26, 2026, 5:20 PM UTC-08:00

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions