# API Regression Backlog

Date: 2026-04-23

## Purpose

This backlog tracks fast API-facing regression assets that should be built to
protect already-repaired high-risk behavior.

These items are intended to be:

- fast
- deterministic
- CI-friendly
- tightly scoped

## P0

### 0. Profile permission convergence and drift guardrails

- Tier: Fast API / setup-aware integration
- Why: profile permission drift is now a known multi-layer regression class spanning
  `setup repair`, `setup apply`, metadata-driven permission seeding, and operator verify
- Protects:
  - `PermissionSet` / profile-owned `PermissionSet` convergence for partially seeded business objects
  - standalone `setup repair` heals business-object `ObjectPermissions` / `FieldPermissions`
  - `setup verify` fails on remaining profile business-permission drift and passes after convergence
  - regression does not silently reintroduce “some rows exist, therefore seeded” behavior
- Preferred asset shape:
  - focused control-plane integration coverage
  - repair/verify-oriented regression check rather than browser-only proof
- Source references:
  - `docs/profile/validation-03-full-profile-gap-inventory.md`
  - `docs/profile/validation-04-business-object-permission-reconciliation.md`
  - `docs/profile/validation-05-repair-path-business-permission-convergence.md`
  - `docs/profile/validation-06-verify-guardrail-for-profile-drift.md`

### 1. Lead convert contract and default behavior

- Tier: Fast API + existing case expansion
- Why: cross-object creation and default behavior are fragile and already have
  dedicated case infrastructure
- Protects:
  - convert result shape
  - generated Account/Contact/Opportunity linkage
  - status transition and key field mapping
  - skip/create flags and readback behavior
- Existing foothold:
  - `tests/e2e-api/cases/lead_convert/*.json`

### 2. Quote creation defaults and line-copy invariants

- Tier: Fast API
- Why: quote/order/contract bugs are recurring launch-critical regressions
- Protects:
  - quote status default
  - line item copy from Opportunity to Quote
  - UnitPrice / Discount / derived amount fields
  - QuoteLineItem linkage to Quote
- Existing foothold:
  - `tests/e2e-api/cases/quote/r-517.json`
  - `tests/e2e-api/cases/quote/r-518.json`
  - `tests/e2e-api/cases/quote/r-563.json`
  - `tests/e2e-api/cases/quote/r-564.json`
  - `tests/e2e-api/cases/quote/r-565.json`
  - `tests/e2e-api/cases/quote/r-572.json`
- Source issues:
  - `#517`, `#518`, `#563`, `#564`, `#565`, `#572`

### 3. Order create gates and auto-population

- Tier: Fast API
- Why: order flows are likely to be touched by orchestration refactors
- Protects:
  - AccountId / EffectiveDate / OrderType population
  - order number autonumber generation
  - line item copy from Quote to Order
  - reject-path error stability
- Existing foothold:
  - `tests/e2e-api/cases/order/*.json`
  - `tests/e2e-api/cases/order/ord-gate-*.json`
- Source issues:
  - `#511`

### 4. Contract create/readback invariants

- Tier: Fast API
- Why: autonumber and RecordType behavior are setup-sensitive and easy to break
- Protects:
  - ContractNumber generation
  - header format
  - RecordType persistence / echo behavior
- Existing foothold:
  - `tests/e2e-api/cases/contract/ctr-001.json`
  - `tests/e2e-api/cases/contract/ctr-002.json`
  - `tests/e2e-api/cases/contract/ctr-004.json`
- Source issues:
  - `#555`, `#556`, `#557`

### 5. Setup readiness and managed metadata visibility

- Tier: Fast API or setup-aware integration
- Why: large refactors can break startup readiness without obvious UI failures
- Protects:
  - required managed metadata exists after setup
  - `_System_File` and other key managed objects remain visible
  - `setup verify` accurately reflects readiness
  - profile permission convergence and readiness signals stay aligned after repair/apply
- Source references:
  - `docs/guides/control-plane-setup-apply.md`
  - bootstrap and setup guidance in `CLAUDE.md`
  - `docs/profile/staging-validation-checklist.md`

## P1

### 6. Permission and scope enforcement

- Tier: Fast API / integration
- Why: auth and scope regressions are high-severity and CI-friendly
- Protects:
  - `api`, `api.read`, `openid` boundaries
  - disabled app rejection
  - token revoke / introspection behavior
  - read-only vs mutating endpoint behavior
- Existing foothold:
  - `tests/integration/AGENT_API_TEST_PLAN.md`

### 7. Approval API stability

- Tier: Fast API / integration
- Why: approval regressions often surface as endpoint failures before UI diagnosis
- Protects:
  - pending approvals fetch
  - queue endpoints do not 404 on metadata types
  - submission / state transitions remain readable
- Source references:
  - `tests/e2e/ORIGIN_COVERAGE_GAPS.md` Group G

### 8. Flow and validation execution invariants

- Tier: Fast API / integration
- Why: automation engines are central refactor risk zones
- Protects:
  - record-triggered flow on create/update
  - `IsChanged` semantics
  - validation on changed vs unchanged fields
  - CustomError blocking behavior
- Source references:
  - `tests/e2e/ORIGIN_COVERAGE_GAPS.md` Groups B and C

### 9. Formula execution readback

- Tier: Fast API / integration
- Why: formula regressions are subtle and often missed until downstream display breaks
- Protects:
  - computed field value readback
  - cross-object formula evaluation
- Source references:
  - `tests/e2e/ORIGIN_COVERAGE_GAPS.md` Group F

### 10. Metadata describe and generated-schema consistency

- Tier: Fast API
- Why: metadata-driven rendering depends on stable describe shapes
- Protects:
  - field type and picklist shape
  - generated schema assumptions
  - custom / standard payload compatibility
- Existing foothold:
  - `tests/e2e-api/cases/issue-1582/*.json`

## P2

### 11. Folder and sharing access filters

- Tier: Fast API / integration
- Why: important platform behavior, but slightly narrower than the main business paths
- Protects:
  - personal folder isolation
  - share-based visibility
  - view vs write access behavior
- Existing foothold:
  - `tests/integration/AGENT_API_TEST_PLAN.md`

### 12. Pagination API contract support

- Tier: Fast API
- Why: page-level UI regressions often start as contract drift
- Protects:
  - page size changes
  - total count support
  - stable page navigation contract
- Source references:
  - `tests/e2e/ORIGIN_COVERAGE_GAPS.md` Group E

## Notes

- This backlog is intentionally biased toward assets that can move into CI early.
- Some items may eventually live as Go integration tests rather than `tests/e2e-api/cases/**`.
- Scenario-worthy items should still be listed here when they also need a fast API invariant.

## Current Fail Reasons

As of 2026-04-23, the repaired regression cases have separated into three
useful buckets:

### Real product gaps exposed by repaired cases

- `tests/e2e-api/cases/quote/r-565.json`
  - Quote creation succeeds, but `quote_product__c.Net_fees__c` still reads
    back as `null`.
- `tests/e2e-api/cases/contract/ctr-002.json`
  - Contract create still returns `500` because Contract Name autonumber cannot
    resolve `{Account.BillingCountryCode}`.
- `tests/e2e-api/cases/contract/ctr-004.json`
  - Same Contract autonumber blocker prevents the RecordType readback assertion
    from executing.
- `tests/e2e-api/cases/order/ord-001.json`
  - Order create succeeds, but Quote-derived header rollups remain `null`,
    including `Overall_Start_Date__c`, `Overall_End_Date__c`,
    `Net_Fees__c`, and `Average_Discount__c`.
- `tests/e2e-api/cases/order/ord-002.json`
  - Order create succeeds, but no `order_product__c` rows are cloned from the
    source `quote_product__c`.
- `tests/e2e-api/cases/order/ord-gate-004.json`
  - After fixing the test-side seed and timeout issues, Order create still
    returns `201` instead of failing closed when the only Effective CSA
    Contract ends before the Quote service window.

### CI or runner instability

- No remaining known cases in this bucket for the current Quote / Contract /
  Order regression slice after:
  - per-case HTTP timeout support was added and `quote/R-572` was re-enabled
  - `order/ORD-GATE-003` assertion drift was aligned
  - stale teardown/runner attribution on `order/ORD-GATE-004` was retired

### Remaining test-shape or environment debt

- No remaining known test-shape debt in the current Quote / Contract / Order
  regression slice after:
  - `quote/R-564` and `quote/R-518` were revalidated as PASS
  - `order/ORD-GATE-002` and `order/ORD-GATE-003` were re-enabled
  - the duplicate `OLI-002` case-id collision was removed by renaming the
    opportunity-line case to `OPLI-002`
- Outside that main slice, the repaired `order_line` cases now also expose real
  product gaps, while the remaining self-owned debt is isolated to approval-step
  orchestration:
  - `tests/e2e-api/cases/order_line/oli-002.json`
    - case seed was repaired to current Quote / Contract / Account shape; Order
      create now succeeds, but no `order_product__c` rows are cloned from the
      source `quote_product__c`
  - `tests/e2e-api/cases/order_line/oli-004.json`
    - case seed was repaired to current Quote / Contract / Account shape; Order
      create now succeeds, but no `order_product__c` rows are cloned from the
      source `QuoteLineItem`
  - `tests/e2e-api/cases/approval/apr-001.json`
    - runner support is now in place for chained approval requests and
      alternate-user auth, but the initial Quote Submit call still returns
      `500` before the 403 permission assertion can run
  - `tests/e2e-api/cases/approval/apr-002.json`
    - runner support is now in place for chained approval requests, but the
      initial Quote Submit call still returns `500` before the second-approve
      assertion path can run
  - `tests/e2e-api/cases/approval/apr-003.json`
    - needs approval metadata deployment primitives (`ProcessNode` /
      `ProcessAction`) that are still out-of-band for the REST-only runner
