# M06-L05 — Detailed Lab: CI and static analysis

## Objective
Add forge test and Slither workflow. Final observable result: **Pipeline fails on failing tests**.

## Environment
Java 21/Maven for Java simulations; Foundry/Anvil for Solidity/EVM; BSC Testnet only for explicitly network-oriented lessons. No real funds.

## Steps
1. Read the theory and define an invariant that must never be violated.
2. Create a new working directory under `starter/`; record tool versions and configuration in `lab-notes.md`.
3. Implement **Add forge test and Slither workflow** using the relevant runtime. Separate domain state from network IO. Avoid hidden global state and unbounded retries.
4. Write a positive-path test that demonstrates: **Pipeline fails on failing tests**.
5. Write a negative test: invalid input, insufficient balance, wrong nonce/chain, unauthorized caller, or duplicate event (choose what applies).
6. Add one failure-injection test: RPC timeout, revert, restart, competing write, or stale block (choose what applies).
7. Run the appropriate command: `mvn test` for Java, `forge test -vvv` for Solidity; save real stdout to `results/test-output.txt`.
8. Explain why observed state is correct and how it differs from the naive design. Document reproducible steps and test seed where applicable.

## Acceptance criteria
- The implementation is deterministic in local tests.
- The happy path and at least two negative paths have assertions.
- **Pipeline fails on failing tests** is demonstrated by actual logs/assertions.
- No secrets or real private keys are committed.

## Submission
Source code, automated tests, `lab-notes.md`, captured output, and a short architecture explanation.

> This is a guided lab specification. For runnable reference code, consult `labs/` and `IMPLEMENTATION_STATUS.md`.
