# Compile Guardrails **Last Updated:** 2026-04-05 Preventive rules to reduce repeat compile failures. ## Core Prevention Rules - [ ] Verify NT8 signatures in official docs before adding/changing any `protected override`. - [ ] Keep NinjaScript edits within task scope and allowed file boundaries. - [ ] Enforce C# 5.0 syntax only; reject C# 6+ constructs. - [ ] Keep managed order sequence correct (stop/target before entry on same bar). - [ ] Guard `OnBarUpdate` by `BarsInProgress` and bar readiness. - [ ] Do not use unsupported attributes/types/enums without confirmation. ## Verification Gates - [ ] Run `.\verify-build.bat` after changes. - [ ] Run focused tests for changed area. - [ ] If NinjaScript touched, compile in NT8 NinjaScript Editor. ## Update Rule - [ ] Add a new guardrail entry whenever a compile issue reveals a missing prevention rule. ## Test Project Reference Guardrail (added 2026-04-29) - When adding tests that instantiate types from a project not yet referenced by the test project, add a `` to the test `.csproj` BEFORE writing the test code. - NT8.Core.Tests references: NT8.Core, NT8.Adapters, NT8.Strategies (as of 2026-04-29). - Failure mode: CS0234 "type or namespace not found" at test compile stage. ## StrategyConfig Constructor Guardrail (added 2026-04-29) - `StrategyConfig` has NO parameterless constructor. Required signature: `StrategyConfig(string name, string symbol, Dictionary parameters, RiskConfig riskSettings, SizingConfig sizingSettings)` - `RiskConfig` required: `RiskConfig(double dailyLossLimit, double maxTradeRisk, int maxOpenPositions, bool emergencyFlattenEnabled)` - `SizingConfig` required: `SizingConfig(SizingMethod method, int min, int max, double riskPerTrade, Dictionary methodParameters)` - Failure mode: CS7036 "required formal parameter not supplied" at test compile stage.