---
id: TST-ACC-PRD-032
title: Domain product database functions
kind: integration
product_area: accounting
module: products
revision: 1
status: draft
product_intent: proposed
implementation_evidence: observed
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
repository: services-accounting
files:
  - modules/products/tests/integration/db/save-product-function.integration.spec.js
implements:
  - ATS-ACC-PRD-007-03
  - ATS-ACC-PRD-007-04
  - ATS-ACC-PRD-007-05
  - ATS-ACC-PRD-007-06
  - ATS-ACC-PRD-007-07
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 3
estimation_note: Planning estimate; no runtime measurement is claimed.
isolation: 'Suite-named local workspaces, isolated fixture records and explicit cleanup or rollback.'
evidence:
  - 'services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js'
assertion_bindings:
  - scenario: ATS-ACC-PRD-007-03
    assertions:
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#is
        the same product Accounting’s own persistence service reads
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#wrote
        the grid in request order, each cell as the API answers it
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#wrote
        the bundle and every feature
    provenance: test
    source: 'services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js'
  - scenario: ATS-ACC-PRD-007-04
    assertions:
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#refuses
        a transaction with no tenant as RHP04
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#refuses
        a session that is no macroservice application role (the owner, no role set) as RHP04
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#refuses
        Accounting’s own role writing a membership package: the owner rule names the owner, the type and the
        caller
    provenance: test
    source: 'services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js'
  - scenario: ATS-ACC-PRD-007-05
    assertions:
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#refuses
        bundled prices above the product price with one sentence on both paths
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#refuses
        a fixed-priced product without a standard price in the base currency with one sentence
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#refuses
        two prices of one cell applying at the same time with one sentence on both paths
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#refuses
        a Donation Product with prices with one sentence on both paths
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#refuses
        the version already replaced as stale (RHP02)
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#refuses
        a replacement of a product the tenant does not have (RHP03), another tenant’s among them
    provenance: test
    source: 'services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js'
  - scenario: ATS-ACC-PRD-007-06
    assertions:
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#refuses
        a product-specific confirmation e-mail, which Accounting’s API composes
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#refuses
        a second create under the same id
    provenance: test
    source: 'services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js'
  - scenario: ATS-ACC-PRD-007-07
    assertions:
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#replaces
        the row and every collection as a whole, keeping an omitted property and clearing a null one
      - >-
        services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js#keeps
        an omitted confirmation e-mail as stored
    provenance: test
    source: 'services-accounting:modules/products/tests/integration/db/save-product-function.integration.spec.js'
coverage_note: Scenario references name existing assertion evidence; broader unexecuted variants remain findings.
---

# Domain product database functions

## Verification Boundary

The suite exercises real PostgreSQL and Accounting persistence or database functions with isolated local workspace fixtures.

## What This Suite Proves

Database functions check owning application and session context, save and retire common records, and compare selected validation cases with service persistence.

## What It Does Not Prove

Local execution does not prove deployed infrastructure, downstream purchase behavior, real domain extension completion or atomic remote-template recovery.

## Real Dependencies and Test Doubles

PostgreSQL, transaction context, constraints, foreign keys and Accounting persistence are real. The test owns its workspace fixtures and clock.

## Must Not Be Doubled

Do not double PostgreSQL, row-level security, transaction boundaries, constraints or the persistence implementation when claiming these local guarantees.
