# TASK 3.2: Refactor tenant bootstrap SQL loading to selected staging plus global curated

## Summary

Refactor tenant warehouse bootstrap so it always applies foundation and curated artifacts, while loading staging artifacts only for the enabled source services passed in the bootstrap request.

This task is the physical warehouse side of the source-aware provisioning design.

## Dependencies

- [TASK 3.1](./TASK3.1.md) - Resolve enabled source services and extend bootstrap requests

## Files to Modify

Expected implementation touch points:

- `backend/Kds.Ai.Warehouse/Services/TenantWarehouseBootstrapper.cs`
- `backend/Kds.Ai.Warehouse/Services/EmbeddedSqlArtifactLoader.cs`
- `backend/Kds.Ai.Warehouse/Sql/Bootstrap/**` if resource grouping needs adjustment
- related warehouse and API service tests under `backend/tests/`

## Required Behavior

- Always apply foundation artifacts.
- Always apply access boundary artifacts.
- Always apply curated artifacts.
- Apply staging artifacts only for services present in the bootstrap request.
- With the current enum, `BrinkPos` must load `Tenant/Staging/BrinkPos/**` plus all curated artifacts.
- Repeated bootstrap for the same tenant must remain safe.

## Acceptance Criteria

- [ ] Bootstrap execution is split into explicit phases
- [ ] Staging artifacts are selected by enabled service set
- [ ] Curated artifacts remain global for all tenants
- [ ] Bootstrap remains safe to rerun

## Notes

- Verify whether any curated artifact has an unexpected dependency on staging objects from non-selected systems.
- If such a dependency exists, curated SQL may need to be split further into neutral and source-specific subsets.
