Skip to content

Replace hard-coded activation symlink path literals with named/shared path constants - #44177

Merged
pelikhan merged 4 commits into
mainfrom
copilot/lint-monster-fix-hard-coded-paths
Jul 8, 2026
Merged

pelikhan merged 4 commits into
mainfrom
copilot/lint-monster-fix-hard-coded-paths

Conversation

Copilot AI commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

LintMonster flagged hard-coded .github/... activation paths in pkg/workflow/compiler_activation_job.go. This change removes those inline literals and makes activation symlink candidate paths constant-driven to align with existing path-constant patterns.

  • Scope: activation symlink candidate paths only

    • Replaced inline literals in resolveSymlinkExtraPaths with named variables:
      • .github/agents
      • .github/skills
      • .github/prompts
    • Derived from existing shared constants (constants.GithubDir) to avoid embedding well-known repo paths directly in activation logic.
  • Implementation details

    • Introduced narrowly scoped activation path variables in compiler_activation_job.go:
      • activationSymlinkBaseDir
      • activationSymlinkAgentDir
      • activationSymlinkSkillDir
      • activationSymlinkPromptDir
    • Updated candidate list construction to use those variables.
  • Focused coverage updates

    • Extended TestResolveSymlinkExtraPaths with explicit cases for:
      • .github/skills symlink target resolution
      • .github/prompts symlink target resolution
var (
    activationSymlinkBaseDir   = strings.TrimSuffix(constants.GithubDir, "/")
    activationSymlinkAgentDir  = activationSymlinkBaseDir + "/agents"
    activationSymlinkSkillDir  = activationSymlinkBaseDir + "/skills"
    activationSymlinkPromptDir = activationSymlinkBaseDir + "/prompts"
)

candidates := []string{
    activationSymlinkAgentDir,
    activationSymlinkSkillDir,
    activationSymlinkPromptDir,
}

Copilot AI linked an issue Jul 8, 2026 that may be closed by this pull request
1 of 5 tasks
Copilot AI and others added 2 commits July 8, 2026 04:02
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix hard-coded activation job path constants Replace hard-coded activation symlink path literals with named/shared path constants Jul 8, 2026
Copilot AI requested a review from pelikhan July 8, 2026 04:11
@pelikhan
pelikhan marked this pull request as ready for review July 8, 2026 04:26
Copilot AI review requested due to automatic review settings July 8, 2026 04:26
@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ PR Code Quality Reviewer failed during code quality review.

@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

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

No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (actual: 34 additions across 2 files).

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 hard-coded .github/... activation symlink candidate path literals from the activation job compiler logic by replacing them with named, shared-constant-derived path variables, and extends unit tests to cover additional symlinked directories.

Changes:

  • Introduced named activation symlink candidate path variables derived from constants.GithubDir.
  • Updated resolveSymlinkExtraPaths to build its candidate list from those variables instead of inline string literals.
  • Extended TestResolveSymlinkExtraPaths with new cases covering .github/skills and .github/prompts symlink resolution.
Show a summary per file
File Description
pkg/workflow/compiler_activation_job.go Replaces inline .github/... candidate literals with named activation symlink path variables derived from shared constants.
pkg/workflow/compiler_activation_job_test.go Adds targeted tests to ensure .github/skills and .github/prompts symlinks are resolved and appended to sparse-checkout extra paths.

Review details

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread pkg/workflow/compiler_activation_job.go Outdated
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

⚠️ Test Quality Score: 75/100 — Acceptable

Analyzed 2 test(s): 2 design, 0 implementation, 0 violation(s).

📊 Metrics (2 tests)
Metric Value
Analyzed 2 (Go: 2, JS: 0)
✅ Design 2 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 1 (50%)
Duplicate clusters 0
Inflation No (2.4:1 ratio acceptable for boilerplate)
🚨 Violations 0
Test File Classification Notes
symlink .github/skills resolved compiler_activation_job_test.go:1162 behavioral_contract Covers skills directory symlink resolution
symlink .github/prompts resolved compiler_activation_job_test.go:1174 behavioral_contract Covers prompts directory symlink resolution

Verdict

✅ Passed. 0% implementation tests (threshold: 30%). No violations.

Strengths:

  • Tests verify core behavioral contracts (symlink resolution for all three directories)
  • Proper use of require for setup, assert for assertions
  • Descriptive failure messages on all assertions
  • Graceful handling of platform limitations (symlink unsupported systems)
  • Fills coverage gap introduced by constant refactoring

Notes:

  • Both tests follow existing patterns and cover distinct code paths
  • Test:production line ratio (2.4:1) is acceptable given setup boilerplate for symlink creation

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🧪 Test quality analysis by Test Quality Sentinel · 19.3 AIC · ⌖ 12 AIC · ⊞ 6.8K · ◷
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.

✅ Test Quality Sentinel: 75/100. 0% implementation tests (threshold: 30%).

@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 — requesting changes on two maintainability issues before merge.

📋 Key Themes & Highlights

Issues

  1. Duplicate source of truth (compiler_activation_job.go line 19): constants.AgentsDir already encodes .github/agents/; the new activationSymlinkAgentDir recomputes the same value independently. Consider using strings.TrimSuffix(constants.AgentsDir, "/") and adding sibling constants (SkillsDir, PromptsDir) to pkg/constants for the other two paths.

  2. var instead of const (compiler_activation_job.go lines 18–23): path values are immutable; var allows mutation and misleads readers. If the three sub-dirs are derived from proper constants, they can be expressed as const (no strings.TrimSuffix needed).

Positive Highlights

  • ✅ Clean, narrow scope — only the relevant candidate-path literals were touched
  • ✅ New test cases for skills and prompts follow the exact same structure as the existing agents test, making them easy to read and maintain
  • ✅ t.Skipf guard for environments that don't support symlinks is a nice defensive touch

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 42.4 AIC · ⌖ 5.21 AIC · ⊞ 6.6K
Comment /matt to run again

Comment thread pkg/workflow/compiler_activation_job.go Outdated
var compilerActivationJobLog = logger.New("workflow:compiler_activation_job")

var (
activationSymlinkBaseDir = strings.TrimSuffix(constants.GithubDir, "/")

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.

[/codebase-design] activationSymlinkAgentDir duplicates the already-existing constants.AgentsDir — this creates two sources of truth for .github/agents.

pkg/constants/constants.go already has const AgentsDir = ".github/agents/". Deriving activationSymlinkAgentDir independently means a future rename of AgentsDir won't automatically propagate here.

💡 Suggested fix

Replace the agent-dir line with:

activationSymlinkAgentDir  = strings.TrimSuffix(constants.AgentsDir, "/")

(Consider also adding SkillsDir and PromptsDir constants to pkg/constants/ and using them in the same way, so all three paths share one source of truth.)

@copilot please address this.

Comment thread pkg/workflow/compiler_activation_job.go Outdated

var compilerActivationJobLog = logger.New("workflow:compiler_activation_job")

var (

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.

[/codebase-design] These new vars should be const (computed at init from other constants), not var — var allows mutation and signals the values might change.

Since constants.GithubDir is a const and all the derived paths are pure string concatenations, all four could be defined as constants (or, if the strings.TrimSuffix call prevents that, at minimum the three sub-path vars could be const once the base is established). Using var for immutable configuration values reduces readability and opens the door to accidental modification in tests.

💡 Suggested fix

If constants.AgentsDir, SkillsDir, and PromptsDir are added to pkg/constants, the entire block reduces to three const references and the var block disappears entirely.

@copilot please address this.

@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.

The refactoring is clean and well-scoped. One suggestion: since constants.GithubDir already ends with /, the four new var declarations can be simplified to true compile-time const values (no strings.TrimSuffix needed). See the inline comment for the suggested change. No blocking issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · 49.9 AIC · ⌖ 5.83 AIC · ⊞ 4.8K

Comment thread pkg/workflow/compiler_activation_job.go Outdated
var compilerActivationJobLog = logger.New("workflow:compiler_activation_job")

var (
activationSymlinkBaseDir = strings.TrimSuffix(constants.GithubDir, "/")

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.

var mutability: consider const instead

The four new package-level variables are declared as var, making them mutable and subject to init-order dependencies. Since constants.GithubDir = ".github/" already ends with a slash, strings.TrimSuffix is unnecessary — the subdirectory paths can be expressed as true compile-time constants:

const (
    activationSymlinkAgentDir  = constants.GithubDir + "agents"
    activationSymlinkSkillDir  = constants.GithubDir + "skills"
    activationSymlinkPromptDir = constants.GithubDir + "prompts"
)

This removes the strings.TrimSuffix call, the activationSymlinkBaseDir intermediate, and makes the values immutable. The resulting strings (".github/agents", etc.) are identical to the current runtime values.

@copilot please address this.

@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.

Two issues block merge

1. Runtime work on a compile-time constant (line 19): strings.TrimSuffix(constants.GithubDir, "/") is called at package-init time on a value already known at compile time. Go string constants support concatenation; the entire block should be const, removing the strings call and the intermediate activationSymlinkBaseDir variable.

2. Divergent source of truth for the agents path (line 20): constants.AgentsDir = ".github/agents/" already exists, but activationSymlinkAgentDir re-derives the same path from scratch (".github/agents", no trailing slash). If AgentsDir is ever renamed or restructured, the activation path will silently stay behind. Skills and prompts have no exported constant yet — this is the right moment to add them to constants.go and derive from there, completing the symmetry already established by AgentsDir.

🔎 Code quality review by PR Code Quality Reviewer · 179.8 AIC · ⌖ 7.56 AIC · ⊞ 5.4K
Comment /review to run again

Comment thread pkg/workflow/compiler_activation_job.go Outdated
var compilerActivationJobLog = logger.New("workflow:compiler_activation_job")

var (
activationSymlinkBaseDir = strings.TrimSuffix(constants.GithubDir, "/")

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.

var doing runtime work on a compile-time constant: strings.TrimSuffix(constants.GithubDir, "/") is a runtime call on a fully-known compile-time constant, and the whole block uses var (mutable) when const would work.

💡 Suggested fix

Go string constants support concatenation at compile time:

const (
    activationSymlinkAgentDir  = constants.GithubDir + "agents"  // .github/agents
    activationSymlinkSkillDir  = constants.GithubDir + "skills"  // .github/skills
    activationSymlinkPromptDir = constants.GithubDir + "prompts" // .github/prompts
)

This removes the strings.TrimSuffix call, eliminates the intermediate activationSymlinkBaseDir variable (which has no other use), makes all three values immutable, and still derives from constants.GithubDir. GithubDir is ".github/", so GithubDir+"agents" → ".github/agents" — identical output.

Comment thread pkg/workflow/compiler_activation_job.go Outdated

var (
activationSymlinkBaseDir = strings.TrimSuffix(constants.GithubDir, "/")
activationSymlinkAgentDir = activationSymlinkBaseDir + "/agents"

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.

Partial reuse of constants.AgentsDir: constants.AgentsDir = ".github/agents/" already exists in constants.go, but activationSymlinkAgentDir is re-derived as ".github/agents" (no trailing slash). These two paths describe the same directory; now they can diverge silently if AgentsDir is updated.

💡 Detail

constants.AgentsDir has a trailing slash (".github/agents/") while activationSymlinkAgentDir has none (".github/agents"). The different forms exist for different callers (prefix matching vs. path joining), but since there is already an established pattern of exporting path constants from constants.go, activationSymlinkSkillDir and activationSymlinkPromptDir should also be exported from constants.go as SkillsDir/PromptsDir to complete the symmetry — not re-derived inline.

At minimum, activationSymlinkAgentDir should be derived from strings.TrimSuffix(constants.AgentsDir, "/") rather than computed from scratch so there is a single source of truth for the agents path.

@pelikhan

pelikhan commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

…attern

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

Copilot AI commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Addressed in the latest commit: converted the var block to const, removed activationSymlinkBaseDir and the strings.TrimSuffix call, and switched to the constants.GithubDir + "agents" pattern consistent with pkg/cli/upgrade_org.go.

@pelikhan
pelikhan merged commit f01daef into main Jul 8, 2026
29 checks passed
@pelikhan
pelikhan deleted the copilot/lint-monster-fix-hard-coded-paths branch July 8, 2026 05:13
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.4

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.

[lint-monster] hard-coded activation job path constants

3 participants