Skip to content

chore: drop unused generated code - #2714

Open
golanglemonade wants to merge 5 commits into
mainfrom
feat-drop-unusued-code
Open

chore: drop unused generated code#2714
golanglemonade wants to merge 5 commits into
mainfrom
feat-drop-unusued-code

Conversation

@golanglemonade

@golanglemonade golanglemonade commented Aug 20, 2026

Copy link
Copy Markdown
Member

tl;dr: Cleans up over 250k lines of unused code; mostly in history generated code;

  • We don't need updates on history schemas, this pulls in the entx update to not include this; this updates all historyschema to now have the below; which will then drop all Update code from generation (see the 45k lines of code removed from internal/graphapi/generated/ent.generated.go
	// history rows are insert only, so no tracked field may be updated
	field.Descriptor().Immutable = true

	// ent still emits a setter for an immutable field that carries an update
	// default, and a snapshot column must keep the value it was written with
	field.Descriptor().UpdateDefault = nil
  • Generated code for admin search when we didn't have admin search enabled, fixed by the gqlgen-plugins update
  • The FeatureSchemaConfig feature in ent we turned on but never used; removed gen.FeatureModifier from history generation in entc.go
  • A bunch of filters we'd never use like a string being GT/LT, an int In, have been removed via the template setup. See internal/ent/generate/templates/entgql/gql_where.tmpl changes
  • Some unsued functions, mostly dropped int he last commit found via deadcode; I did not remove unused code from workflows though since I know that is in flux or the oscalgenerated code for the same reason but these both showed up on the report, includes:
    • rules internal/ent/privacy/rule/allow_mutation_valid_signup_token.go and internal/ent/privacy/rule/deny_questionnaire.go
    • helper functions in privacy/rule/token
    • validator I believe was at one point used for exports? can't remember internal/ent/validator/graphql_filter_validator.go
    • Moves ImplementAllDirective functions out of internal/graphapi/directives/directives.go into the graphapi package to prevent not-fun times on code generation due to deps on the graphapi generated files
    • Unused with opts in internal/httpserve/route/router.go

Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
@golanglemonade
golanglemonade force-pushed the feat-drop-unusued-code branch from c5078fa to bd66965 Compare August 20, 2026 16:57
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
@golanglemonade
golanglemonade marked this pull request as ready for review August 20, 2026 21:08
@golanglemonade
golanglemonade requested a review from a team as a code owner August 20, 2026 21:08
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.6% Coverage on New Code (required ≥ 20%)

See analysis details on SonarQube Cloud

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant