> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Server-Side Condition Evaluation Integration

> Status: ✅ Complete Spec Reference: PF-32 Server-Side Expansion Last Updated: 2026-03-15

**Status:** ✅ Complete
**Spec Reference:** [PF-32 Server-Side Expansion](../../../specs/pf/specs/PF-32-SERVER-SIDE-EXPANSION.md)\
**Last Updated:** 2026-03-15

***

## Purpose

Documents integration points for PF-32 Server-Side Condition Evaluation Expansion: Edge Function API, PF-51 Caching Layer, PF-07 Error Monitoring, and client hooks.

***

## Integration Points

| Consumer/Provider                 | Pattern        | Description                                   |
| --------------------------------- | -------------- | --------------------------------------------- |
| evaluate-conditions Edge Function | API            | Server-side condition evaluation endpoint     |
| PF-51 Caching Layer               | Platform Layer | Caching infrastructure for evaluation results |
| PF-07 Error Monitoring            | Platform Layer | Performance metrics, SLO alerts               |
| useConditionEvaluation hook       | Client         | Hybrid client/server evaluation routing       |

***

## API Contract: evaluate-conditions

**Endpoint:** `POST /functions/v1/evaluate-conditions`\
**Authentication:** Supabase JWT required\
**Authorization:** Use `verifyOrgAccess()` from `_shared/auth.ts`

### Request

See spec: `EvaluateConditionsRequest` (organization\_id, form\_id?, conditions, field\_values, options?)

### Response

See spec: `EvaluateConditionsResponse` (results, evaluation\_method, evaluation\_time\_ms, cache\_hit)

### Error Codes

AUTH\_FAILED | RATE\_LIMIT | INVALID\_CONDITIONS | TIMEOUT | CACHE\_ERROR

***

## PF-51 Integration

* Use PF-51 caching patterns for evaluation result storage
* `pf_condition_evaluation_cache` table stores evaluation results with TTL
* Cache key: SHA-256 hash of condition + field values (see spec)

***

## PF-07 Integration

* SLO targets: p95 \<200ms, cache hit rate >70%
* Performance dashboard metrics
* Alert channels for degradation

***

## Cross-Core Integration Matrix

PF-32 Server-Side Expansion is Platform-internal. Add row to CROSS\_CORE\_INTEGRATIONS.md if cross-core consumers emerge (e.g. FW forms, CL assessments).
