Skip to content

[Code Quality] Deduplicate RepositoryFeatures struct across build-tag files #50005

Description

@github-actions

Description

RepositoryFeatures is declared twice, field-for-field identical (HasDiscussions bool, HasIssues bool), purely to satisfy Go build tags:

  • pkg/workflow/repository_features_validation.go:73 (//go:build !js && !wasm)
  • pkg/workflow/repository_features_validation_wasm.go:31 (//go:build js || wasm)

A prior issue (#45863) tracked this exact finding and was closed, but the duplication is still present in the codebase today (verified directly), and typist re-detected it independently in discussion #49984.

Suggested Changes

Move the struct definition to a shared, non-build-tagged file (e.g. pkg/workflow/repository_features_types.go) and keep only the validateRepositoryFeatures behavior split behind the js/wasm build tags.

Files Affected

  • pkg/workflow/repository_features_validation.go
  • pkg/workflow/repository_features_validation_wasm.go
  • pkg/workflow/repository_features_types.go (new)

Success Criteria

  • RepositoryFeatures struct declared exactly once
  • Both the native and WASM builds compile against the shared type
  • Existing tests pass on both build configurations

Source

Extracted from Typist - Go Type Consistency Analysis discussion #49984

Priority

Low/Quick win - removes a maintenance-drift risk. Estimated effort: < 1 hour.

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · auto · 88.4 AIC · ⌖ 4.01 AIC · ⊞ 10.3K · ◷

  • expires on Aug 4, 2026, 5:45 AM UTC-08:00

Activity

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

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