Skip to content

[deep-report] Refactor extractAllImportFields (508-line function in pkg/parser/import_field_extractor.go) #31725

@github-actions

Description

@github-actions

Context

Identified by DeepReport intelligence briefing 2026-05-12 (Repository Quality report #31693).

pkg/parser/import_field_extractor.go is 1,127 lines and contains a single 508-line functionextractAllImportFields — that handles YAML parsing, validation, schema defaults, input substitution, and observability extraction all in one place. This is the most critical offender across the 211 Go files (57% of pkg/) currently exceeding the documented 300-line hard limit from AGENTS.md.

Expected Impact

  • Brings the worst-offender file into compliance with AGENTS.md 300-line limit
  • Improves test coverage targeting (a 508-line function with one test exercises minimal branching)
  • Reduces cognitive load for future contributors
  • Sets a refactoring precedent for the other 210 oversized files

Suggested Approach

  • Identify the natural seams: parse → validate → defaults → substitution → observability
  • Extract each phase into its own well-named function (~100 lines each)
  • Run make agent-finish after each extraction to leverage the 2.1× test-to-source ratio
  • Keep the public API stable; this is an internal refactor

Suggested Agent

Sergo or any Go-capable coding agent.

Estimated Effort

2 hours of agent time (per the report's own sizing).


Source: DeepReport 2026-05-12 #aw_dr3

Generated by DeepReport - Intelligence Gathering Agent · ● 9.5M ·

  • expires on May 14, 2026, 3:42 PM UTC

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions