Skip to content

PCTL-18: define cost driver and observation contracts - #48

Open
hudsonaikins wants to merge 12 commits into
mainfrom
codex/pctl-18-cost-contract
Open

PCTL-18: define cost driver and observation contracts#48
hudsonaikins wants to merge 12 commits into
mainfrom
codex/pctl-18-cost-contract

Conversation

@hudsonaikins

@hudsonaikins hudsonaikins commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Outcome

Defines additive, versioned profitctl.cost/v1 domain contracts for forecast drivers and cost observations. Forecasts can distinguish fixed, variable, cadence, concurrency, and uptime drivers while observations preserve claim-level quantity, price, total-cost, provenance, confidence, and measurement status.

Scope

  • Go contract types and fail-closed semantic validation
  • JSON Schemas for drivers and observations
  • explicit legacy scenario mapping with required unit, currency, and time-window inputs
  • compatibility proof that existing simulation totals remain unchanged
  • synthetic Upstash idle-polling forecast-to-observation fixture
  • mapping and versioning notes

Safety and compatibility

  • additive package only; no simulator or CLI output wiring
  • no live provider calls, credentials, billing data, spend, collector, ledger, alert, release, or deployment changes
  • provenance alone cannot claim measurement
  • claim-specific source authority prevents telemetry from silently becoming rate or billed-cost evidence
  • missing scale bases, units, time windows, currency, source identity, capture time, or provider stale-policy metadata fail closed
  • legacy paid-user scope and fixed 30-day daily normalization are preserved
  • derived totals must reconcile arithmetically
  • synthetic Upstash values remain labeled synthetic/user-supplied and make no current-price or billing claim

Validation

Exact candidate: 04d2ee3babe6d1ac10f9827f41a0c8cb15a3fce7

  • gofmt
  • go mod tidy with no diff
  • go vet ./...
  • go test ./...
  • Draft 2020-12 JSON Schema validation against the Upstash fixture
  • Plane Codex Control exact-head evidence: passed and pushed

Review fixes

Addressed all six findings from Codex review on 4644bf2: paid-user scope, claim authority, scale bases, derived arithmetic, 30-day legacy normalization, and provider stale-policy metadata.

Plane

PCTL-18. Native blocker PCTL-3 is Done. PCTL-3 and PCTL-14 decisions are authoritative. This PR does not start PCTL-19 or PCTL-22.

@hudsonaikins

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4644bf2b45

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/contracts/cost/v1/legacy.go Outdated
Comment thread pkg/contracts/cost/v1/validate.go
Comment thread pkg/contracts/cost/v1/validate.go
Comment thread pkg/contracts/cost/v1/validate.go
Comment thread pkg/contracts/cost/v1/legacy.go Outdated
Comment thread pkg/contracts/cost/v1/types.go
@hudsonaikins

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 143fbd0fa6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/contracts/cost/v1/legacy.go
Comment thread pkg/contracts/cost/v1/validate.go
Comment thread pkg/contracts/cost/v1/validate.go
@hudsonaikins

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49ed95ca24

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/contracts/cost/v1/validate.go Outdated
Comment thread pkg/contracts/cost/v1/legacy.go
Comment thread pkg/contracts/cost/v1/validate.go
@hudsonaikins

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d6b6d13ce

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/contracts/cost/v1/validate.go Outdated
Comment thread pkg/contracts/cost/v1/legacy.go
Comment thread pkg/contracts/cost/v1/validate.go
Comment thread pkg/contracts/cost/v1/validate.go
Comment thread pkg/contracts/cost/v1/legacy.go Outdated
@hudsonaikins

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 906a345677

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/contracts/cost/v1/validate.go
Comment thread pkg/contracts/cost/v1/legacy.go Outdated
Comment thread pkg/contracts/cost/v1/validate.go
@hudsonaikins

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0f04304d2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/contracts/cost/v1/legacy.go Outdated
Comment thread pkg/contracts/cost/v1/validate.go
Comment thread schemas/cost-contract/v1/common.schema.json
@hudsonaikins

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d8e17dc40

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/contracts/cost/v1/validate.go Outdated
Comment thread pkg/contracts/cost/v1/validate.go
Comment thread schemas/cost-contract/v1/common.schema.json
Comment thread schemas/cost-contract/v1/common.schema.json
Comment thread schemas/cost-contract/v1/common.schema.json
Comment thread pkg/contracts/cost/v1/legacy_test.go Outdated
@hudsonaikins

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18e75def3f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread schemas/cost-contract/v1/common.schema.json
Comment thread schemas/cost-contract/v1/cost-observation.schema.json Outdated
Comment thread schemas/cost-contract/v1/common.schema.json
Comment thread schemas/cost-contract/v1/cost-observation.schema.json Outdated
Comment thread schemas/cost-contract/v1/common.schema.json
Comment thread schemas/cost-contract/v1/common.schema.json Outdated
@hudsonaikins

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53221f11d1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/contracts/cost/v1/legacy.go Outdated
Comment thread schemas/cost-contract/v1/common.schema.json Outdated
Comment thread pkg/contracts/cost/v1/validate.go
Comment thread pkg/contracts/cost/v1/validate.go
@hudsonaikins

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e00ae8798

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread schemas/cost-contract/v1/common.schema.json Outdated
Comment thread pkg/contracts/cost/v1/validate.go
@hudsonaikins

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1cbf0ee3d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/contracts/cost/v1/validate.go Outdated
Comment thread pkg/contracts/cost/v1/validate.go
Comment thread schemas/cost-contract/v1/common.schema.json Outdated
@hudsonaikins

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 04d2ee3bab

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

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