Merged
Conversation
chrisghill
approved these changes
Jan 28, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the cost field handling across the codebase to support nullable amount and currency values. The changes address scenarios where cost data may not be available from the API.
Changes:
- Updated GraphQL schema to make
amountandcurrencyfields nullable inCostSampletype - Modified generated code to use pointer types (
*float64) for nullable amount fields - Added display helper methods (
DisplayAmountandDisplayAmountUSD) to handle null values gracefully - Updated templates and command handlers to check for nil costs and display "-" as fallback
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/api/schema.graphql | Made Cost fields (amount, currency) nullable and updated documentation |
| pkg/api/zz_generated.go | Generated code changes to use pointer types for nullable amount fields |
| pkg/api/genqlient.graphql | Added @genqlient(pointer: true) directives to amount fields in queries |
| pkg/api/cost.go | Restructured Cost types, added Previous/Currency fields, and display helper methods |
| pkg/api/environment_test.go | Updated test data to use pointer types for amount fields |
| cmd/project.go | Added nil checks for Cost field before accessing display methods |
| cmd/environment.go | Added nil checks for Cost field before accessing display methods |
| cmd/templates/project.get.md.tmpl | Added conditional rendering for cost data with fallback for nil |
| cmd/templates/environment.get.md.tmpl | Added conditional rendering for cost data with fallback for nil |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates the CLI to align with the new GraphQL cost API and surfaces the server version in
mass version.Changes
Cost schema alignment
pkg/api/schema.graphqlfrom the live API and updatedzz_generated.go.Cost/Summary/CostSamplehandling so:costis now required onEnvironment,Project, andPackage(matchingCost!in the schema).CostSample.amountandcurrencyare nullable and modeled as pointers in Go.EnvironmentandProjectstructs to use valueCost(non-pointer), matching the now-required cost fields.mass project listandmass environment listnow readCost.Monthly/Daily.Average.Amountdirectly, rendering empty cells when amount is null.environment.get/project.gettemplates now print$<amount>when present and nothing when amount is null.Runtime behavior
pkg/api/environment_test.goto cover the newCostshape and pointeramount.Version command
mass versionto: