Skip to content

Conversation

@turip
Copy link
Member

@turip turip commented Apr 22, 2025

Overview

This approach better describes the user journey: initially most likely only payment status manipuliation is required.

Going forward if they need state storage they can enable the hooks as needed.

Summary by CodeRabbit

  • Refactor
    • Renamed configuration options for custom invoicing apps from "skip" to "enable" for draft and issuing sync hooks, improving clarity and consistency.
    • Updated related documentation and user-facing descriptions to match the new naming.
    • Existing settings will be automatically migrated; no manual action required.
  • Chores
    • Database columns and API schemas have been updated to reflect the new field names.

This approach better describes the user journey: initially most
likely only payment status manipuliation is required.

Going forward if they need state storage they can enable the hooks
as needed.
@turip turip marked this pull request as ready for review April 22, 2025 17:48
@turip turip requested a review from a team as a code owner April 22, 2025 17:48
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 22, 2025

📝 Walkthrough

Walkthrough

This change systematically renames and inverts the logic of two boolean fields across the "CustomInvoicingApp" feature in both backend and frontend codebases. The fields previously named skipDraftSyncHook and skipIssuingSyncHook are replaced with enableDraftSyncHook and enableIssuingSyncHook. This affects type definitions, OpenAPI specifications, Go structs, database schema, migration scripts, and all related methods, constants, and predicates. The migration scripts also invert the stored boolean values to maintain the correct semantics after the rename. No other logic or structure is altered beyond this renaming and inversion.

Changes

Files/Paths Change Summary
api/client/javascript/src/client/schemas.ts
api/openapi.cloud.yaml
api/openapi.yaml
api/spec/src/app/custominvoicing.tsp
Renamed skipDraftSyncHook/skipIssuingSyncHook to enableDraftSyncHook/enableIssuingSyncHook in type definitions and OpenAPI schemas; updated documentation/comments accordingly.
openmeter/app/custominvoicing/adapter/appconfig.go
openmeter/app/custominvoicing/app.go
openmeter/app/httpdriver/app.go
openmeter/app/httpdriver/mapper.go
Updated Go struct fields and mapping logic to use EnableDraftSyncHook/EnableIssuingSyncHook instead of Skip* variants; updated JSON tags and internal assignments.
openmeter/ent/db/appcustominvoicing.go
openmeter/ent/db/appcustominvoicing/appcustominvoicing.go
openmeter/ent/db/appcustominvoicing/where.go
openmeter/ent/db/appcustominvoicing_create.go
openmeter/ent/db/appcustominvoicing_update.go
openmeter/ent/db/mutation.go
openmeter/ent/db/runtime.go
Renamed struct fields, constants, variables, methods, and predicate functions from Skip* to Enable* for draft and issuing sync hooks; updated all related logic and comments.
openmeter/ent/db/migrate/schema.go
openmeter/ent/schema/appcustominvoicing.go
Changed database schema field names from skip_draft_sync_hook/skip_issuing_sync_hook to enable_draft_sync_hook/enable_issuing_sync_hook; defaults unchanged.
tools/migrate/migrations/20250422174622_rename-custominvoicing-settings.up.sql
tools/migrate/migrations/20250422174622_rename-custominvoicing-settings.down.sql
Migration scripts to rename columns and invert boolean values for the affected fields, with up and down operations.

Possibly related PRs

  • openmeterio/openmeter#2678: Introduced the original CustomInvoicingApp type and the skipDraftSyncHook/skipIssuingSyncHook flags that are being renamed and inverted in this PR.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2

🔧 ast-grep (0.31.1)
openmeter/ent/db/mutation.go
🔧 SQLFluff (3.3.0)
tools/migrate/migrations/20250422174622_rename-custominvoicing-settings.down.sql

User Error: No dialect was specified. You must configure a dialect or specify one on the command line using --dialect after the command. Available dialects:
ansi, athena, bigquery, clickhouse, databricks, db2, duckdb, exasol, greenplum, hive, impala, mariadb, materialize, mysql, oracle, postgres, redshift, snowflake, soql, sparksql, sqlite, starrocks, teradata, trino, tsql, vertica

tools/migrate/migrations/20250422174622_rename-custominvoicing-settings.up.sql

User Error: No dialect was specified. You must configure a dialect or specify one on the command line using --dialect after the command. Available dialects:
ansi, athena, bigquery, clickhouse, databricks, db2, duckdb, exasol, greenplum, hive, impala, mariadb, materialize, mysql, oracle, postgres, redshift, snowflake, soql, sparksql, sqlite, starrocks, teradata, trino, tsql, vertica

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@turip turip enabled auto-merge (squash) April 22, 2025 17:50
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (6)
api/openapi.cloud.yaml (2)

12474-12485: Add defaults and enrich descriptions for clarity.

Right now clients must always provide the flag and it’s not clear what happens if they omit it. Suggest adding a default: false to both flags and updating the descriptions to something like:

@@ -12474,7 +12474,8 @@
-        enableDraftSyncHook:
-          type: boolean
+        enableDraftSyncHook:
+          type: boolean
+          default: false
           description: |-
-            Enable draft.sync hook.
+            When true, enables the `draft.sync` hook.
+            Defaults to `false` (invoice progresses automatically).

Repeat the same change for enableIssuingSyncHook.


12528-12539: Clarify update‐model behavior when flags are omitted.

In the replaceUpdate schema, explain that omitting these fields leaves the existing setting unchanged. For example:

@@ CustomInvoicingAppReplaceUpdate
-        enableDraftSyncHook:
-          type: boolean
+        enableDraftSyncHook:
+          type: boolean
           description: |-
             When true, enables the `draft.sync` hook.
             When false, disables it.
+            Omitting this field preserves the current configuration.

Apply a similar description for enableIssuingSyncHook.

api/openapi.yaml (4)

12311-12312: Confirm whether the new boolean flags should be required
The fields enableDraftSyncHook and enableIssuingSyncHook have been added to the required array but have no default. If these hooks are optional, consider removing them from required and defining default: false under their schemas to avoid breaking clients that omit them.

Suggested change:

 components:
   schemas:
     CustomInvoicingApp:
       required:
         - status
         - default
         - type
-        - enableDraftSyncHook
-        - enableIssuingSyncHook
+        # Optional flags – remove from required if clients may omit them
+#        - enableDraftSyncHook
+#        - enableIssuingSyncHook
 properties:
   enableDraftSyncHook:
     type: boolean
+    default: false
   enableIssuingSyncHook:
     type: boolean
+    default: false

12380-12391: Refine hook descriptions for clarity and consistency
The descriptions can be tightened and the hook names formatted as inline code. For example, change “Enable draft.sync hook.” to “Enable the draft.sync hook.” and streamline the second sentence.

Proposed diff:

   enableDraftSyncHook:
     type: boolean
     description: |-
-      Enable draft.sync hook.
-
-      If the hook is not enabled, the invoice will be progressed to the next state automatically.
+      Enable the `draft.sync` hook.
+
+      If this hook is disabled, the invoice automatically progresses to the next state.
   enableIssuingSyncHook:
     type: boolean
     description: |-
-      Enable issuing.sync hook.
-
-      If the hook is not enabled, the invoice will be progressed to the next state automatically.
+      Enable the `issuing.sync` hook.
+
+      If this hook is disabled, the invoice automatically progresses to the next state.

12403-12404: Verify required status of flags in the update model
Similar to the main schema, enableDraftSyncHook and enableIssuingSyncHook are marked as required in the replace‐update model without defaults. Confirm whether they should be mandatory or be treated as optional with default: false.

Suggested change:

 components:
   schemas:
     CustomInvoicingAppReplaceUpdate:
       required:
         - name
         - default
         - type
-        - enableDraftSyncHook
-        - enableIssuingSyncHook
+        # Optional flags – remove from required if not always provided
+#        - enableDraftSyncHook
+#        - enableIssuingSyncHook
 properties:
   enableDraftSyncHook:
     type: boolean
+    default: false
   enableIssuingSyncHook:
     type: boolean
+    default: false

12434-12445: Mirror description refinements in the update model
Apply the same wording and formatting improvements here: wrap hook names in backticks, add “the”, and tighten the phrasing.

Proposed diff:

   enableDraftSyncHook:
     type: boolean
     description: |-
-      Enable draft.sync hook.
-
-      If the hook is not enabled, the invoice will be progressed to the next state automatically.
+      Enable the `draft.sync` hook.
+
+      If this hook is disabled, the invoice automatically progresses to the next state.
   enableIssuingSyncHook:
     type: boolean
     description: |-
-      Enable issuing.sync hook.
-
-      If the hook is not enabled, the invoice will be progressed to the next state automatically.
+      Enable the `issuing.sync` hook.
+
+      If this hook is disabled, the invoice automatically progresses to the next state.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1af3cb9 and 51e5dad.

⛔ Files ignored due to path filters (1)
  • tools/migrate/migrations/atlas.sum is excluded by !**/*.sum
📒 Files selected for processing (19)
  • api/client/javascript/src/client/schemas.ts (2 hunks)
  • api/openapi.cloud.yaml (4 hunks)
  • api/openapi.yaml (4 hunks)
  • api/spec/src/app/custominvoicing.tsp (1 hunks)
  • openmeter/app/custominvoicing/adapter/appconfig.go (2 hunks)
  • openmeter/app/custominvoicing/app.go (1 hunks)
  • openmeter/app/httpdriver/app.go (1 hunks)
  • openmeter/app/httpdriver/mapper.go (1 hunks)
  • openmeter/ent/db/appcustominvoicing.go (4 hunks)
  • openmeter/ent/db/appcustominvoicing/appcustominvoicing.go (4 hunks)
  • openmeter/ent/db/appcustominvoicing/where.go (2 hunks)
  • openmeter/ent/db/appcustominvoicing_create.go (7 hunks)
  • openmeter/ent/db/appcustominvoicing_update.go (4 hunks)
  • openmeter/ent/db/migrate/schema.go (1 hunks)
  • openmeter/ent/db/mutation.go (7 hunks)
  • openmeter/ent/db/runtime.go (1 hunks)
  • openmeter/ent/schema/appcustominvoicing.go (1 hunks)
  • tools/migrate/migrations/20250422174622_rename-custominvoicing-settings.down.sql (1 hunks)
  • tools/migrate/migrations/20250422174622_rename-custominvoicing-settings.up.sql (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (10)
openmeter/app/custominvoicing/app.go (1)
openmeter/ent/db/appcustominvoicing/where.go (2)
  • EnableDraftSyncHook (89-91)
  • EnableIssuingSyncHook (94-96)
openmeter/app/httpdriver/app.go (1)
openmeter/ent/db/appcustominvoicing/where.go (2)
  • EnableDraftSyncHook (89-91)
  • EnableIssuingSyncHook (94-96)
openmeter/ent/db/appcustominvoicing.go (2)
openmeter/ent/db/appcustominvoicing/where.go (2)
  • EnableDraftSyncHook (89-91)
  • EnableIssuingSyncHook (94-96)
openmeter/ent/db/appcustominvoicing/appcustominvoicing.go (2)
  • FieldEnableDraftSyncHook (26-26)
  • FieldEnableIssuingSyncHook (28-28)
openmeter/app/httpdriver/mapper.go (2)
openmeter/ent/db/appcustominvoicing/where.go (2)
  • EnableDraftSyncHook (89-91)
  • EnableIssuingSyncHook (94-96)
openmeter/app/custominvoicing/app.go (1)
  • Configuration (18-21)
openmeter/ent/db/runtime.go (1)
openmeter/ent/db/appcustominvoicing/appcustominvoicing.go (2)
  • DefaultEnableDraftSyncHook (82-82)
  • DefaultEnableIssuingSyncHook (84-84)
openmeter/ent/db/appcustominvoicing/appcustominvoicing.go (1)
openmeter/ent/db/appcustominvoicingcustomer/appcustominvoicingcustomer.go (1)
  • OrderOption (91-91)
openmeter/app/custominvoicing/adapter/appconfig.go (3)
openmeter/app/custominvoicing/app.go (1)
  • Configuration (18-21)
openmeter/ent/db/appcustominvoicing/where.go (2)
  • EnableDraftSyncHook (89-91)
  • EnableIssuingSyncHook (94-96)
openmeter/ent/db/appcustominvoicing/appcustominvoicing.go (2)
  • FieldID (16-16)
  • FieldNamespace (18-18)
openmeter/ent/db/appcustominvoicing_update.go (2)
openmeter/ent/db/appcustominvoicing/where.go (2)
  • EnableDraftSyncHook (89-91)
  • EnableIssuingSyncHook (94-96)
openmeter/ent/db/appcustominvoicing/appcustominvoicing.go (2)
  • FieldEnableDraftSyncHook (26-26)
  • FieldEnableIssuingSyncHook (28-28)
openmeter/ent/db/mutation.go (5)
openmeter/ent/db/ent.go (1)
  • Op (63-63)
openmeter/ent/db/appcustominvoicing.go (2)
  • AppCustomInvoicing (17-37)
  • AppCustomInvoicing (71-86)
openmeter/ent/schema/appcustominvoicing.go (5)
  • AppCustomInvoicing (15-17)
  • AppCustomInvoicing (19-25)
  • AppCustomInvoicing (27-32)
  • AppCustomInvoicing (34-38)
  • AppCustomInvoicing (40-51)
openmeter/ent/db/appcustominvoicing/where.go (2)
  • EnableDraftSyncHook (89-91)
  • EnableIssuingSyncHook (94-96)
openmeter/ent/db/appcustominvoicing/appcustominvoicing.go (2)
  • FieldEnableDraftSyncHook (26-26)
  • FieldEnableIssuingSyncHook (28-28)
openmeter/ent/db/appcustominvoicing_create.go (3)
openmeter/ent/db/appcustominvoicing/where.go (2)
  • EnableDraftSyncHook (89-91)
  • EnableIssuingSyncHook (94-96)
openmeter/ent/db/appcustominvoicing/appcustominvoicing.go (4)
  • DefaultEnableDraftSyncHook (82-82)
  • DefaultEnableIssuingSyncHook (84-84)
  • FieldEnableDraftSyncHook (26-26)
  • FieldEnableIssuingSyncHook (28-28)
openmeter/ent/db/ent.go (1)
  • ValidationError (255-258)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Test
  • GitHub Check: E2E
  • GitHub Check: Developer environment
  • GitHub Check: CI
  • GitHub Check: Analyze (go)
🔇 Additional comments (58)
tools/migrate/migrations/20250422174622_rename-custominvoicing-settings.up.sql (2)

1-4: Well-structured migration for renaming and inverting draft sync hook field.

This SQL code correctly renames the column from negative "skip_draft_sync_hook" to positive "enable_draft_sync_hook" and properly inverts the boolean values to maintain semantic correctness. The "atlas:nolint BC102" comment appropriately suppresses backward compatibility warnings for this intentional breaking change.


5-8: Well-structured migration for renaming and inverting issuing sync hook field.

This SQL code correctly renames the column from negative "skip_issuing_sync_hook" to positive "enable_issuing_sync_hook" and properly inverts the boolean values to maintain semantic correctness. The "atlas:nolint BC102" comment appropriately suppresses backward compatibility warnings for this intentional breaking change.

openmeter/app/httpdriver/app.go (1)

196-199: Field renaming aligns with database schema changes.

The field name changes from SkipDraftSyncHook and SkipIssuingSyncHook to EnableDraftSyncHook and EnableIssuingSyncHook align with the database schema changes and create a more intuitive configuration API by using positive terminology.

tools/migrate/migrations/20250422174622_rename-custominvoicing-settings.down.sql (2)

1-4: Down migration correctly reverts issuing sync hook changes.

This SQL migration correctly reverts the column rename from "enable_issuing_sync_hook" back to "skip_issuing_sync_hook" and inverts the boolean values to maintain semantic correctness, allowing for proper rollbacks if needed.


5-7: Down migration correctly reverts draft sync hook changes.

This SQL migration correctly reverts the column rename from "enable_draft_sync_hook" back to "skip_draft_sync_hook" and inverts the boolean values to maintain semantic correctness, allowing for proper rollbacks if needed.

openmeter/app/custominvoicing/app.go (1)

18-21: Renamed fields with updated JSON tags.

The Configuration struct fields have been renamed from negative terminology (Skip*) to positive terminology (Enable*) with corresponding JSON tag updates. This change improves clarity and aligns with the database schema changes.

openmeter/app/httpdriver/mapper.go (1)

105-106: Field renaming aligns with semantic inversion across the codebase

The field names have been changed from negative flags (SkipDraftSyncHook, SkipIssuingSyncHook) to positive flags (EnableDraftSyncHook, EnableIssuingSyncHook), which better communicates their purpose. This change is part of a larger refactoring to improve semantic clarity.

openmeter/ent/db/migrate/schema.go (1)

212-213: Database column renaming follows semantic inversion pattern

The column names in the database schema have been updated from negative flags to positive ones (skip_enable_), while keeping the same boolean type and default value of false. This change maintains the same default behavior (hooks disabled by default) while making the intent clearer.

openmeter/ent/schema/appcustominvoicing.go (1)

29-30: Schema definition updated with inverted boolean semantics

The Ent schema field definitions have been renamed from negative flags to positive flags, which better reflects their purpose while maintaining the same default behavior (hooks disabled by default). This change aligns with the PR objective to improve clarity in the user journey.

openmeter/ent/db/appcustominvoicing.go (4)

29-32: Struct field names updated to follow positive flag naming convention

The field definitions in the AppCustomInvoicing struct have been changed to use positive flag naming, which improves code readability and makes the configuration more intuitive. This change is consistent with the renaming pattern applied throughout the codebase.


75-75: SQL scanning logic updated for renamed fields

The SQL scanning logic has been updated to reference the new field constants, ensuring database results are properly mapped to the struct fields. This is an essential part of the field renaming process.


127-138: Value assignment logic updated for renamed fields

The value assignment logic in assignValues has been properly updated to reference the new field names in error messages and assign scanned values to the correctly renamed struct fields. All references to the old naming have been consistently updated.


199-203: String representation updated to reflect renamed fields

The String() method has been updated to include the renamed fields in its output, maintaining consistency in debugging and logging output. This change ensures that all aspects of the struct properly reflect the new field naming.

api/spec/src/app/custominvoicing.tsp (2)

18-22: Approve improved naming for draft sync hook with inverted logic.

The renamed property enableDraftSyncHook uses positive logic which is more intuitive than the previous negative skipDraftSyncHook. The updated documentation clearly explains that when the hook is not enabled, invoices auto-progress to the next state.


25-30: Approve improved naming for issuing sync hook with inverted logic.

Similarly, renaming to enableIssuingSyncHook follows the same pattern of converting from negative to positive logic, making the API more intuitive to use and understand.

openmeter/app/custominvoicing/adapter/appconfig.go (3)

42-43: Approve consistent field renaming in the database setter methods.

The Set* methods have been properly updated to use the new positive-logic field names, maintaining consistency with the API model changes.


47-47: Improved conflict resolution with generic UpdateNewValues.

The change from updating specific fields to using UpdateNewValues() simplifies the code and makes it more maintainable when fields are added or renamed.


67-68: Approve consistent mapping in returned Configuration struct.

The mapping function correctly returns the new field names, completing the renaming throughout the adapter layer.

openmeter/ent/db/runtime.go (1)

194-201: Approve consistent descriptor and default value renaming.

The schema descriptors and default value variables have been consistently renamed throughout the generated runtime code, ensuring the database layer properly reflects the new positive-logic field names.

api/client/javascript/src/client/schemas.ts (2)

3191-3194: Improved property naming in CustomInvoicingApp interface

The renaming from skipDraftSyncHook to enableDraftSyncHook makes the configuration more intuitive by directly reflecting what the property enables rather than what it skips. The updated JSDoc comments also clearly explain the behavior when hooks are not enabled.

Also applies to: 3195-3198


3225-3228: Consistent naming applied to CustomInvoicingAppReplaceUpdate interface

The same naming improvement has been consistently applied to the update interface, making the API more intuitive and consistent throughout. The property names now use positive language (enable vs. skip) which aligns better with user expectations.

Also applies to: 3229-3232

openmeter/ent/db/appcustominvoicing/appcustominvoicing.go (4)

25-28: Field constants renamed to use positive framing

The renaming from skip_* to enable_* improves clarity by using affirmative language, making the configuration more intuitive for users. This better aligns with the PR objective of improving the clarity of the user journey related to invoicing settings.


58-59: Column names updated to match field renaming

The Columns slice entries have been correctly updated to match the field renaming from skip_* to enable_*.


81-84: Default boolean variables renamed consistently

The default value variables have been properly renamed to match the new field names while maintaining the same behavior.


117-124: Query ordering functions updated to reflect renamed fields

The By* ordering functions have been renamed to match the field renaming while maintaining the same functionality. This ensures that query ordering capabilities remain consistent with the renamed fields.

openmeter/ent/db/appcustominvoicing/where.go (2)

88-96: Equality predicates renamed to match new field semantics

The basic predicate functions have been renamed from Skip* to Enable* to match the new field naming convention while maintaining the same functionality. This improves code readability by using positive language in the predicate names.


293-311: Specialized predicate functions updated consistently

All equality (EQ) and inequality (NEQ) predicate functions have been renamed to match the new field names. This change ensures consistent naming throughout the codebase and maintains the functionality of query filtering capabilities.

openmeter/ent/db/mutation.go (8)

4538-4559: Clean field renaming in AppCustomInvoicingMutation struct

The renaming from "skip" to "enable" for the draft and issuing sync hook fields improves clarity by making the settings more intuitive for users. This change aligns with the overall refactoring goal of better reflecting the typical user journey where these features are opt-in rather than opt-out.


4822-4856: Consistent method renaming for the EnableDraftSyncHook field

All getter, setter, and utility methods have been appropriately renamed to match the new field name. The error messages have also been updated to reflect the new terminology. This maintains code consistency while improving API clarity.


4858-4892: Consistent method renaming for the EnableIssuingSyncHook field

All getter, setter, and utility methods have been appropriately renamed to match the new field name. The error messages have also been updated to reflect the new terminology. This maintains code consistency while improving API clarity.


5031-5039: Updated field references in Fields() method

The field references in the Fields() method have been properly updated to use the new constant names from the appcustominvoicing package. This ensures database operations will use the correct field names.


5053-5060: Updated field references in Field() method

The case statements and method calls in the Field() method have been correctly updated to reflect the renamed fields and methods.


5074-5081: Updated field references in OldField() method

The case statements and method calls in the OldField() method have been correctly updated to reflect the renamed fields and associated methods.


5115-5132: Updated field references in SetField() method

The field references and method calls in the SetField() method have been correctly updated to use the new field names and setter methods.


5199-5207: Updated field references in ResetField() method

The field references and method calls in the ResetField() method have been correctly updated to use the new field names and reset methods.

openmeter/ent/db/appcustominvoicing_update.go (9)

58-61: Consistent rename from negative to positive semantics

The renaming from SetSkipDraftSyncHook to SetEnableDraftSyncHook changes the boolean field from negative semantics ("skip") to positive semantics ("enable"), making the code more intuitive and less prone to double-negative confusion.


64-68: Clean transition of nillable setter method

The nillable setter method has been correctly renamed while preserving the same functionality for handling nil values.


72-74: Field rename maintains consistent pattern

This change follows the same pattern as the draft sync hook, renaming from negative to positive semantic for better clarity.


78-82: Consistent renaming pattern maintained

The nillable setter for the issuing sync hook correctly follows the same renaming pattern as the other methods.


181-182: SQL specification update aligned with field rename

The SQL specification logic correctly uses the new field name in the mutation getter.


184-185: Consistent update pattern in SQL save operation

The SQL save operation correctly uses the renamed field for the EnableIssuingSyncHook field.


278-281: Single instance update follows same renaming pattern

The AppCustomInvoicingUpdateOne struct's methods correctly implement the same renaming pattern as the bulk update methods.


431-432: SQL specification in single update properly renamed

The SQL field specification for single entity updates correctly uses the new field name.


434-435: Consistent field handling in single update operation

The field specification for the EnableIssuingSyncHook is correctly updated in the single entity update context.

openmeter/ent/db/appcustominvoicing_create.go (14)

76-79: Create method setter properly renamed

The create methods follow the same renaming pattern as the update methods, maintaining consistency across the codebase.


82-86: Nillable setter in create context properly updated

The nillable setter method for EnableDraftSyncHook is correctly implemented in the create context.


90-93: Consistent create method renaming for issuing hook

The create method for the issuing sync hook follows the same pattern as the draft sync hook.


195-198: Default value assignment correctly updated

The default value assignment in the defaults method properly uses the new field name and its associated default value.


199-202: Consistent default handling for both fields

Both EnableDraftSyncHook and EnableIssuingSyncHook fields have consistent default value handling.


225-226: Validation checks properly renamed

The validation logic in the check method correctly validates the renamed field.


228-229: Consistent validation for both fields

Both renamed fields have consistent validation logic in the check method.


283-286: Create spec field assignment correctly updated

The field assignment in the createSpec method correctly uses the new field name.


287-290: Node field assignment properly updated

The node field assignment for both fields is correctly updated to use the new field names.


406-409: Upsert type setter correctly renamed

The AppCustomInvoicingUpsert type's setters are properly renamed to match the new field names.


412-415: Update method for excluded fields renamed consistently

The update method for handling excluded fields in conflict resolution is correctly renamed.


519-523: UpsertOne type setters properly renamed

The AppCustomInvoicingUpsertOne type's setter methods correctly use the new field names.


803-807: Bulk upsert type setters consistently renamed

The AppCustomInvoicingUpsertBulk type's setter methods follow the same renaming pattern.


810-814: Bulk update method for excluded fields properly renamed

The bulk update method for excluded fields in conflict resolution uses the correct new field name.

Comment on lines +12497 to +12498
- enableDraftSyncHook
- enableIssuingSyncHook
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove flags from required in the update model.

Update schemas should allow partial updates—clients shouldn’t be forced to resupply every field. Remove enableDraftSyncHook and enableIssuingSyncHook from the required list of the update schema so they become optional.

Comment on lines +12405 to +12406
- enableDraftSyncHook
- enableIssuingSyncHook
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

❓ Verification inconclusive

Ensure new boolean flags aren’t unintentionally breaking existing clients.

By adding enableDraftSyncHook and enableIssuingSyncHook to the required list, every client will now be forced to supply these values in all requests. If you intend these hooks to be opt‑in and maintain backward compatibility, consider removing them from required and instead provide a default (for example, false) so clients that don’t care about these fields continue to work without change.


Ensure optional booleans don’t break existing clients

By adding enableDraftSyncHook and enableIssuingSyncHook to the required list, every client must now supply those values. To maintain backward compatibility, please choose one of the following:

  • Remove enableDraftSyncHook and enableIssuingSyncHook from the required array
  • OR define a default: false for each flag so that clients who don’t specify them continue to work unchanged

File: api/openapi.cloud.yaml (lines 12405–12406)

@turip turip merged commit e68a364 into main Apr 22, 2025
34 of 35 checks passed
@turip turip deleted the refactor/rename-custom-invoicing-settings branch April 22, 2025 18:00
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.

2 participants