microsoft / microsoft/finops-toolkit
Refactor manifest creation in New-FinOpsTestData to reduce duplication
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 603
- Forks
- 248
- Avg merge
- 7d 11h
- Merged PRs (30d)
- 11
Description
Summary
Refactor the 4 manifest creation sites in New-FinOpsTestData to use a shared helper, reducing code duplication and schema drift risk.
Motivation
New-FinOpsTestData currently creates manifest JSON in 4 separate locations — one per dataset type that has a slightly different schema (Costs, Prices, CommitmentDiscountUsage, Recommendations/Transactions). Each site constructs the manifest hashtable independently, which means:
- Watermark fields (
_ftkTestData,_generator,_generatedAt) must be added in 4 places - Schema changes require updates in 4 places
- Risk of drift between manifest formats
Proposed changes
- Extract a private helper function (e.g.,
New-TestDataManifest) that accepts dataset-specific parameters and returns the manifest hashtable - Each call site passes only the dataset-specific values (dataset name, blobs, row count, export config overrides)
- The helper handles common fields:
blobCount,byteCount,dataFormat,runInfo,_ftkTestDatawatermarks - This is a prerequisite/companion to #2016 (
New-FinOpsExportManifest)
Context
Deferred from PR #2006 (New-FinOpsTestData and Remove-FinOpsTestData). Can be combined with #2016 if extracting to a public command.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the New-FinOpsTestData entry point and locate its four manifest creation sites for Costs, Prices, CommitmentDiscountUsage, and Recommendations/Transactions. Compare the shared fields and dataset-specific parameters, then review #2016 and the context from PR #2006. Done means one private helper supplies the common manifest fields while all four call sites preserve their dataset-specific schemas.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100