Skip to content

openapi: move alias amplification out of scan.go #1054

Closed

Description

@OmarAlJarrah

Problem

compilers/openapi/internal/scan/scan.go holds three things: the walk over the source tree, the anchor-cycle check, and the alias-amplification weigher. The weigher's tests already sit in amplification_internal_test.go, a test file with no amplification.go beside it. site.go is tested from two files, site_internal_test.go and sites_internal_test.go.

Direction

  • amplification.go: aliasAmplification, the weigher (aliasWeigher and its methods, newAliasWeigher, weighFrame, childrenOf, saturatingAdd), its diagnostics (aliasAmplificationDiag, aliasBudgetDiag, shapeAllowance) and its bounds (maxAliasAmplification, minExpandedNodes).
  • scan.go keeps the walk and the cycle check. The cycle check is too small to stand alone.
  • The package comment moves from scan.go to doc.go.
  • Tests follow what they call; sites_internal_test.go merges into site_internal_test.go.

Done when

  • Every top-level declaration of the package, with its doc comment and any comment between declarations, is byte-identical before and after the move (compared with a throwaway go/ast script), and no golden changes.
  • Comments that name a file name the file the code now lives in, changed in a commit of their own.
  • go test ./compilers/openapi/... passes without -update.

Priority: P4, rule 1 (housekeeping: moves code between files and changes no lowering, validation, IR or emit-contract behaviour). wc -l compilers/openapi/internal/scan/scan.go → 522 (morphic @a1f15b29).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:P4Refactors, tests, CI, hostile-input hardening, cosmetic diagnostics, other formatstype:choreRefactor or cleanup, no behavior change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions