Skip to content

[lint-monster] LintMonster: package-level mutable state cleanup #53889

Description

@github-actions

Summary

Daily make golint-custom surfaced a small non-largefunc cluster about package-level mutable slice/map state being reassigned, which risks shared-state leakage and data races.

Current findings: 5

Affected paths:

  • pkg/parser/virtual_fs.go:46builtinVirtualFiles
  • pkg/actionpins/data.go:45cachedActionPins
  • pkg/actionpins/data.go:47cachedActionPinsByRepo
  • pkg/actionpins/data.go:50cachedContainerPins
  • pkg/actionpins/data.go:52 — additional reassignment path for cachedContainerPins

Representative diagnostics:

  • pkg/parser/virtual_fs.go:46:2: package-level slice/map variable builtinVirtualFiles is mutated via wholesale re-assignment; mutating shared package state risks data races and can leak state across calls
  • pkg/actionpins/data.go:45:3: package-level slice/map variable cachedActionPins is mutated via wholesale re-assignment; mutating shared package state risks data races and can leak state across calls

Expected outcome

Refactor the affected code so package-level slice/map data is not reassigned in a way that creates shared mutable state hazards, while preserving existing behavior and call sites.

Remediation checklist

  • Keep remediation scoped to the listed package-level mutable-state findings only.
  • Prefer minimal, targeted edits such as immutable snapshots, copy-on-write helpers, or encapsulated initialization.
  • Preserve public behavior and existing tests.
  • Validate with make golint-custom after changes.
  • Avoid bundling unrelated cleanup.

Copilot instructions

  1. Work only on the pkg/parser/virtual_fs.go and pkg/actionpins/data.go mutable package-state findings.
  2. Replace whole-sale reassignment patterns with safer initialization/copy patterns.
  3. Keep edits local and behavior-preserving.
  4. Do not take on unrelated largefunc cleanup.
  5. Validate with make golint-custom before finishing.

Generated by 🧌 LintMonster · gpt54 · 29.2 AIC · ⌖ 4.25 AIC · ⊞ 6K ·

  • expires on Aug 25, 2026, 6:51 PM UTC-08:00

Summary

Daily make golint-custom still shows package-level mutable slice/map state being reassigned, which risks shared-state leakage and data races.

Current findings: 13

Affected paths:

  • pkg/parser/virtual_fs.go:46builtinVirtualFiles
  • pkg/actionpins/data.go:45cachedActionPins
  • pkg/actionpins/data.go:47cachedActionPinsByRepo
  • pkg/actionpins/data.go:50 and :52cachedContainerPins
  • pkg/workflow/engine_definition.go:433knownEngineImports
  • pkg/workflow/model_aliases.go:93builtinOnlyAliasMap
  • pkg/workflow/runtime_definitions.go:242allManifestFilesBaseCache
  • pkg/workflow/samples_validation.go:172sortedSafeOutputFieldNames
  • pkg/cli/model_costs.go:50 and :73modelPriceRecords
  • pkg/cli/update_version_labels.go:73 and :86versionLabelCache

Representative diagnostics:

  • pkg/parser/virtual_fs.go:46:2: package-level slice/map variable builtinVirtualFiles is mutated via wholesale re-assignment; mutating shared package state risks data races and can leak state across calls
  • pkg/actionpins/data.go:45:3: package-level slice/map variable cachedActionPins is mutated via wholesale re-assignment; mutating shared package state risks data races and can leak state across calls
  • pkg/cli/model_costs.go:73:5: package-level slice/map variable modelPriceRecords is mutated via append() re-assignment; mutating shared package state risks data races and can leak state across calls

Expected outcome

Refactor the affected code so package-level slice/map data is not mutated in shared-state patterns, while preserving behavior and existing callers.

Remediation checklist

  • Keep remediation scoped to the listed package-level mutable-state findings only.
  • Prefer minimal, targeted edits such as immutable snapshots, copy-on-write helpers, or encapsulated initialization.
  • Preserve public behavior and existing tests.
  • Validate with make golint-custom after changes.
  • Avoid bundling unrelated cleanup.

Copilot instructions

  1. Work only on the listed package-level mutable-state findings.
  2. Replace whole-sale reassignment, append reassignment, and index assignment patterns with safer initialization/copy patterns.
  3. Keep edits local and behavior-preserving.
  4. Do not take on unrelated largefunc cleanup.
  5. Validate with make golint-custom before finishing.> Generated by 🧌 LintMonster · gpt54 · 33.2 AIC · ⌖ 6.66 AIC · ⊞ 6K ·

Activity

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions