# TASK 5: Remove Simulator Path And Replace It With Debezium-First Tests And Documentation

## Summary

Remove simulator/mock KDS CDC code and replace its coverage with Debezium-first tests, fixtures, and documentation.

## Current Codebase Findings

Repository analysis shows simulator/mock footprint remains in:

- `backend/Kds.Ai.Integrations/KdsCdc/Mock/`
- `KdsCdcConstants.MockContractVersion`
- mock branch in `KdsCdcEnvelopeParser`
- `KdsCdcContractProfile.Mock`
- mock-specific tests such as `KdsCdcMockProducerTests`
- live harness paths that still call `AddKdsCdcMockModule()` or produce simulator envelopes

The user explicitly wants this simulator path removed.

## Dependencies

- TASK 1
- TASK 2
- TASK 3
- TASK 4

## Source References

- `../../docs/features/ETL/kds-cdc/debezium-payload-compatibility-notes.md`
- `../../docs/features/ETL/kds-cdc/index.md`
- `../../docs/features/ETL/kds-cdc/payloads/*.json`

## Scope From Breakdown

This task covers:

- simulator/mock code removal,
- replacement test fixtures,
- live/integration harness cleanup,
- final documentation alignment.

## Files to Remove Or Replace

Expected removal candidates:

- `backend/Kds.Ai.Integrations/KdsCdc/Mock/IKdsCdcMockProducer.cs`
- `backend/Kds.Ai.Integrations/KdsCdc/Mock/KdsCdcMockEnvelopeFactory.cs`
- related mock producer implementation files
- mock-only tests in `backend/tests/Kds.Ai.Integrations.Tests/KdsCdc/`

Expected modifications:

- `backend/Kds.Ai.Integrations/KdsCdc/KdsCdcConstants.cs`
- `backend/Kds.Ai.Integrations/KdsCdc/Messages/KdsCdcContractProfile.cs`
- `backend/tests/Kds.Ai.Integrations.Tests/KdsCdc/KdsCdcLiveTestHarness.cs`
- `backend/tests/Kds.Ai.Integrations.Tests/KdsCdc/KdsCdcIntakeIntegrationTests.cs`
- `backend/tests/Kds.Ai.ApiService.Tests/.../KdsCdcWorkerServiceTests.cs`
- docs under `docs/features/ETL/kds-cdc/`

## Required Behavior

### Remove simulator code

Production KDS CDC integration should no longer:

- publish simulator envelopes,
- parse simulator contract versions,
- register simulator-specific modules for KDS CDC tests or runtime composition.

### Replace coverage with Debezium fixtures

Tests should use:

- real sample payload JSON files,
- small helper builders that wrap those payloads in transport messages,
- explicit cases for transport metadata being absent or present without changing correctness behavior.

### Documentation alignment

Docs should reflect:

- Debezium is the supported contract,
- simulator path is removed,
- processing does not depend on `MessageGroupId`,
- landing RAW is first durable boundary,
- tenant RAW promotion feeds downstream ETL,
- curated targets are rebuilt from tenant staging state,
- native `item_bumps` are supported directly.

## Testing

Required validation at end of this task:

- relevant `Kds.Ai.Integrations.Tests` KDS CDC test suite,
- relevant `Kds.Ai.ApiService.Tests` KDS CDC worker tests,
- final backend solution build with warnings treated as errors per repo rules.

## Acceptance Criteria

- [ ] Simulator/mock KDS CDC code path is removed
- [ ] Parser/runtime no longer expose simulator contract behavior
- [ ] Tests use Debezium payload fixtures instead of simulator envelopes
- [ ] Live/integration harness no longer depends on mock module registration
- [ ] Debezium compatibility docs are updated to final intended direction
- [ ] Relevant backend tests pass
- [ ] Final backend solution build passes cleanly

## Notes

- Remove only KDS CDC simulator code. Do not disturb unrelated synthetic KDS warehouse bootstrap code unless it directly blocks KDS CDC integration.
