{"record":{"id":"d867728a8a67973c","repo":"vitessio/vitess","slug":"s-has-changed","errorCode":null,"errorMessage":"'%s' has changed","messagePattern":"'(.+?)' has changed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/tools/asthelpergen/asthelpergen.go","lineNumber":239,"sourceCode":"\n// VerifyFilesOnDisk compares the generated results from the codegen against the files that\n// currently exist on disk and returns any mismatches\nfunc VerifyFilesOnDisk(result map[string]*jen.File) (errors []error) {\n\tfor fullPath, file := range result {\n\t\texisting, err := os.ReadFile(fullPath)\n\t\tif err != nil {\n\t\t\terrors = append(errors, fmt.Errorf(\"missing file on disk: %s (%w)\", fullPath, err))\n\t\t\tcontinue\n\t\t}\n\n\t\tgenFile, err := codegen.FormatJenFile(file)\n\t\tif err != nil {\n\t\t\terrors = append(errors, fmt.Errorf(\"goimport error: %w\", err))\n\t\t\tcontinue\n\t\t}\n\n\t\tif !bytes.Equal(existing, genFile) {\n\t\t\terrors = append(errors, fmt.Errorf(\"'%s' has changed\", fullPath))\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn errors\n}\n\n// Options configures the AST helper generation process.\ntype Options struct {\n\t// Packages specifies the Go packages to analyze for AST types.\n\t// Can be package paths like \"./mypackage\" or import paths like \"github.com/example/ast\".\n\tPackages []string\n\n\t// RootInterface is the fully qualified name of the root interface that all AST nodes implement.\n\t// Format: \"package.path.InterfaceName\" (e.g., \"github.com/example/ast.Node\")\n\tRootInterface string\n\n\t// Clone configures the clone generator options\n\tClone CloneOptions","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/tools/asthelpergen/asthelpergen.go#L221-L257","documentation":"VerifyFilesOnDisk compares the formatted generated bytes with the file on disk via bytes.Equal. When they differ, it reports that the file has changed, i.e. the checked-in generated code is stale relative to what the generators would produce.","triggerScenarios":"Modifying AST types or generator logic (e.g. adding a field to a struct, changing sql.y, editing generator templates) and running verify without first regenerating; committed code out of sync with `make codegen` output.","commonSituations":"CI verification failing after a PR touched AST definitions or generators; a developer forgot to run codegen after editing sqlparser types.","solutions":["Run `asthelpergen` (or `make codegen`) to regenerate and commit the updated files","Check `git diff` after regeneration to review the intended changes","Add `make codegen` to your pre-commit workflow so generated files never go stale"],"exampleFix":"// before\n$ asthelpergen verify\n// 'go/vt/sqlparser/ast_clone.go' has changed\n// after\n$ make codegen && asthelpergen verify","handlingStrategy":"validation","validationCode":"cmd := exec.Command(\"asthelpergen\")\nif err := cmd.Run(); err != nil {\n    return fmt.Errorf(\"regenerate code before verifying: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make `make codegen` part of your pre-commit routine","Add a CI job that runs codegen and fails on diff","Review git diff after regeneration to catch unintended churn"],"tags":["codegen","drift","verification"],"backgroundTag":"generated-code-drift","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}