Skip to content

feat: add DataBillingMeter and DataAggregateLimitCounter node types#1105

Merged
pyramation merged 1 commit intomainfrom
feat/upstream-billing-meter-node-types
May 10, 2026
Merged

feat: add DataBillingMeter and DataAggregateLimitCounter node types#1105
pyramation merged 1 commit intomainfrom
feat/upstream-billing-meter-node-types

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

Summary

Adds two new node type definitions to packages/node-type-registry for billing and aggregate limit tracking:

  • DataBillingMeter — Declares a billing usage-recording trigger on a table. Calls record_usage on INSERT (increment), DELETE (reversal), and optionally UPDATE (transfer when entity_field changes). Required param: meter_slug.

  • DataAggregateLimitCounter — Declares per-entity (org-level) aggregate limit triggers via org_limit_aggregates_inc/dec, complementing the existing per-user DataLimitCounter. Required param: limit_name.

Both follow the existing NodeTypeDefinition pattern and are exported from src/data/index.ts.

The corresponding SQL generators live in constructive-io/constructive-db:

Review & Testing Checklist for Human

  • Verify DataBillingMeter.parameter_schema matches the parameters consumed by the data_billing_meter generator in constructive-db (meter_slug, entity_field, quantity, events)
  • Verify DataAggregateLimitCounter.parameter_schema matches the data_aggregate_limit_counter generator (limit_name, entity_field, events)
  • Confirm the description text accurately reflects runtime behavior for both nodes

Notes

  • These are static type definitions only — no runtime code. The actual trigger generation logic lives in metaschema-generators in constructive-db.
  • DataBillingMeter includes a quantity param (default 1) that DataAggregateLimitCounter does not, mirroring the difference between billing (variable units) and limits (always ±1). This matches the generator implementations.

Link to Devin session: https://app.devin.ai/sessions/6e29559e7a5d4074810f0bd0273dcfc3
Requested by: @pyramation

Add upstream node type definitions for billing/metering:

- DataBillingMeter: attaches record_usage triggers to tables for
  billing meter tracking (increment on INSERT, decrement on DELETE,
  transfer on UPDATE when entity_field changes)

- DataAggregateLimitCounter: attaches org_limit_aggregates_inc/dec
  triggers for per-entity aggregate limit tracking (vs per-user
  limits in DataLimitCounter)
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit 13a1ef5 into main May 10, 2026
54 checks passed
@pyramation pyramation deleted the feat/upstream-billing-meter-node-types branch May 10, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant