refactor: simplify standard line type by turip ยท Pull Request #3864 ยท openmeterio/openmeter
๐ Script executed:
#!/bin/bash # Search for queries filtering on feature_key IS NULL or Nil predicates rg -n --type=go 'FeatureKeyIsNil|FeatureKeyIsNotNil|feature_key IS' -C2
Repository: openmeterio/openmeter
Length of output: 2681
๐ Script executed:
#!/bin/bash # Search for actual usage of FeatureKeyIsNil predicate rg -n 'FeatureKeyIsNil\(\)' --type=go -C2
Repository: openmeterio/openmeter
Length of output: 2412
๐ Script executed:
#!/bin/bash # Find the ent schema definition for BillingInvoiceUsageBasedLineConfig fd -type f -name '*.go' | xargs grep -l 'BillingInvoiceUsageBasedLineConfig' | xargs grep -l 'feature_key' | head -5
Repository: openmeterio/openmeter
Length of output: 235
๐ Script executed:
#!/bin/bash # Check the actual schema definition find . -name 'billinginvoiceusagebasedlineconfig.go' -o -name '*billinginvoice*lineconfig*' | head -10
Repository: openmeterio/openmeter
Length of output: 701
๐ Script executed:
#!/bin/bash # Find ent schema definitions find . -path '*/ent/schema/*.go' -name '*billinginvoice*' | head -5
Repository: openmeterio/openmeter
Length of output: 47
๐ Script executed:
#!/bin/bash # Search for where FeatureKeyIsNil() is actually called (not just defined) rg 'FeatureKeyIsNil\(\)' --type=go -B5 -A5 | grep -v 'where.go' | head -50
Repository: openmeterio/openmeter
Length of output: 76
๐ Script executed:
#!/bin/bash # Also check the current usage patterns in the file being changed rg -n 'BillingInvoiceUsageBasedLineConfig' openmeter/billing/adapter/stdinvoicelines.go
Repository: openmeterio/openmeter
Length of output: 556
๐ Script executed:
#!/bin/bash # Find schema definitions find . -path '*/ent/schema/*.go' | xargs grep -l 'feature_key\|FeatureKey' | head -3
Repository: openmeterio/openmeter
Length of output: 168
๐ Script executed:
#!/bin/bash # Check the Create builder for SetNillableFeatureKey method rg 'SetNillableFeatureKey' openmeter/ent/db/billinginvoiceusagebasedlineconfig/ -A2
Repository: openmeterio/openmeter
Length of output: 47
๐ Script executed:
#!/bin/bash # Check the feature key field definition in the schema rg -A10 'FeatureKey.*Field' openmeter/ent/schema/ | head -40
Repository: openmeterio/openmeter
Length of output: 47
๐ Script executed:
#!/bin/bash # Check the schema definition for BillingInvoiceUsageBasedLineConfig rg -A50 'type BillingInvoiceUsageBasedLineConfig struct' openmeter/ent/schema/billing.go | head -60
Repository: openmeterio/openmeter
Length of output: 1312
๐ Script executed:
#!/bin/bash # List all Set methods in the Create builder rg '^\s+func.*Set' openmeter/ent/db/billinginvoiceusagebasedlineconfig/billinginvoiceusagebasedlineconfig_create.go | head -20
Repository: openmeterio/openmeter
Length of output: 201
๐ Script executed:
#!/bin/bash # Find the Create builder file find . -name '*billinginvoiceusagebasedlineconfig*create*' -type f
Repository: openmeterio/openmeter
Length of output: 128
๐ Script executed:
#!/bin/bash # Search for SetFeatureKey method in the file rg 'func.*SetFeatureKey|func.*SetNillable' openmeter/ent/db/billinginvoiceusagebasedlineconfig_create.go | head -20
Repository: openmeterio/openmeter
Length of output: 900
๐ Script executed:
#!/bin/bash # Check if lo.EmptyableToPtr is available rg 'EmptyableToPtr' --type=go
Repository: openmeterio/openmeter
Length of output: 10033
๐ Script executed:
#!/bin/bash # Search for actual query usages of FeatureKeyIsNil to see if it matters rg -i 'featurekeyisnil' --type=go -B10 -A10 | grep -v '^--$' | head -80
Repository: openmeterio/openmeter
Length of output: 7292
๐ Script executed:
#!/bin/bash # Check the mapper code that was mentioned rg -n 'lo.FromPtr' openmeter/billing/adapter/stdinvoicelines.go -B3 -A3
Repository: openmeterio/openmeter
Length of output: 676
๐ Script executed:
#!/bin/bash # Search for active queries using FeatureKeyIsNil rg 'FeatureKeyIsNil\(\)' openmeter/ --type=go -B5 -A5 | grep -v 'where.go' | head -100
Repository: openmeterio/openmeter
Length of output: 76
๐ Script executed:
#!/bin/bash # Check the mapper code mentioned in the review cat openmeter/billing/adapter/stdinvoicelines.go | grep -n 'lo.FromPtr' | head -10
Repository: openmeterio/openmeter
Length of output: 303
๐ Script executed:
#!/bin/bash # Look for where feature_key values are actually queried/retrieved rg 'FeatureKey' openmeter/billing/adapter/ --type=go -B2 -A2 | grep -E '(Where|Query|Filter)' | head -20
Repository: openmeterio/openmeter
Length of output: 47
Preserve NULL semantics for feature_key โ this is inconsistent with how it's handled elsewhere.
The change from SetFeatureKey(line.FeatureKey) (plain string) to storing empty string instead of NULL is a real semantic shift. More importantly, the codebase already establishes the pattern of using lo.EmptyableToPtr for FeatureKey in similar contexts (gatheringinvoicependinglines.go, invoiceline.go). For consistency and to respect the schema's Optional().Nillable() definition, use: