Skip to content

[CORRUPTED] Synthetic Benchmark PR #1892 - [bench] Patch 6: Extend pricing model update endpoint for CLI sync - #8

Open
amirzaushnizer wants to merge 6 commits into
base_pr_1892_20260621_7381from
corrupted_pr_1892_20260621_7381
Open

[CORRUPTED] Synthetic Benchmark PR #1892 - [bench] Patch 6: Extend pricing model update endpoint for CLI sync#8
amirzaushnizer wants to merge 6 commits into
base_pr_1892_20260621_7381from
corrupted_pr_1892_20260621_7381

Conversation

@amirzaushnizer

Copy link
Copy Markdown
Collaborator

Benchmark PR #1892

Type: Corrupted (contains bugs)

Original PR Title: [bench] Patch 6: Extend pricing model update endpoint for CLI sync
Original PR Description: Reconstructed for skills benchmark from https://github.com/flowglad/flowglad/pull/1892
Original PR URL: https://github.com/flowglad/flowglad/pull/1892

joeysabs and others added 6 commits February 3, 2026 16:35
…r CLI sync

Adds full structure update capability to the pricing model update endpoint,
enabling the CLI to sync entire pricing model configurations including features,
products, usage meters, and resources. The update procedure now detects whether
structure fields are provided and routes to the appropriate transaction logic:
- Metadata-only updates continue using the simple update path
- Full structure updates use diffing and atomic transactions via adminTransaction

This maintains backward compatibility while enabling the CLI sync workflow for
comprehensive pricing model management.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add authorization pre-check via authenticatedTransaction before adminTransaction
  to prevent users from modifying pricing models outside their organization
- Require all structure fields when any are provided (PUT semantics) to prevent
  accidental data loss from partial updates
- Remove unused fullPricingModel database query
- Fix weak test assertion (toBeGreaterThanOrEqual(0) -> toBe(1))
- Remove unused selectPricingModelById import from test file

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates openapi.json to reflect the new extended schema for
PUT /pricing-models/:id that includes optional structure fields.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…e resources

- Replace local extendedEditPricingModelSchema with imported
  editPricingModelWithStructureSchema from editSchemas.ts
- Use imported hasStructureFields helper function
- Add resources to required structure fields validation to prevent
  accidental data loss when omitting resources in full updates
- Update error message to include resources in the list
- Regenerate OpenAPI spec

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…hing rule

- Move validation logic from router to Zod schema using superRefine
- Remove unused editPricingModelSchema import from router
- Schema now validates that either no structure fields OR all structure
  fields (features, products, usageMeters, resources) are provided
- Remove redundant validation check from router since schema handles it
- Regenerate OpenAPI spec

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename misleading test name to 'preserves structure when updated with identical structure'
- Add hasAllStructureFields type predicate to avoid non-null assertions in router
- Improve validation error message to specify which fields are missing
- Regenerate OpenAPI spec

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

2 participants