Harden AI agent rules and compile learning workflow
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# Common Compile Failures
|
||||
**Last Updated:** 2026-04-05
|
||||
|
||||
Record concise error fingerprints and verified fixes.
|
||||
|
||||
## Entry Template
|
||||
- **Date:** YYYY-MM-DD
|
||||
- **Error:** `CSXXXX`
|
||||
- **Fingerprint:** file + line + short symptom
|
||||
- **Root cause:** one sentence
|
||||
- **Fix:** one to three concrete steps
|
||||
- **Prevention link:** guardrail/pattern doc entry added
|
||||
|
||||
## Starter Examples
|
||||
1. **`CS0115` no suitable method found to override**
|
||||
- Root cause: incorrect NT8 override signature.
|
||||
- Fix: replace with exact official signature; recompile.
|
||||
|
||||
2. **`CS0507` cannot change access modifiers when overriding**
|
||||
- Root cause: used `public override`/`private override` instead of `protected override`.
|
||||
- Fix: change to `protected override`; recompile.
|
||||
|
||||
3. **`CS0246` type or namespace not found**
|
||||
- Root cause: missing using/namespace or undefined domain type.
|
||||
- Fix: add correct namespace reference or confirmed type definition.
|
||||
|
||||
4. **`CS1503` argument type mismatch**
|
||||
- Root cause: wrong overload or argument ordering.
|
||||
- Fix: align call with exact method signature and parameter types.
|
||||
|
||||
5. **C# 6+ syntax in C# 5 project**
|
||||
- Root cause: use of `$""`, `?.`, `nameof`, expression-bodied members, etc.
|
||||
- Fix: rewrite using C# 5 compatible constructs.
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# 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.
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
# Patterns and Anti-Patterns
|
||||
**Last Updated:** 2026-04-05
|
||||
|
||||
Capture recurring implementation patterns that impact compile stability.
|
||||
|
||||
## Pattern Entry Template
|
||||
- **Context:** where this applies
|
||||
- **Good pattern:** concise example/description
|
||||
- **Anti-pattern:** concise example/description
|
||||
- **Why it matters:** one sentence
|
||||
|
||||
## Starter Patterns
|
||||
1. **NT8 override signatures**
|
||||
- Good pattern: copy exact signature from official NT8 docs before coding.
|
||||
- Anti-pattern: infer or copy from outdated examples.
|
||||
- Why it matters: prevents `CS0115` and runtime integration drift.
|
||||
|
||||
2. **Access modifier on overrides**
|
||||
- Good pattern: use `protected override` for NT8 lifecycle/event methods.
|
||||
- Anti-pattern: `public override` or `private override`.
|
||||
- Why it matters: prevents `CS0507`.
|
||||
|
||||
3. **C# 5 compatibility discipline**
|
||||
- Good pattern: `string.Format`, explicit null checks, block-bodied members.
|
||||
- Anti-pattern: string interpolation, null-conditional, expression-bodied members.
|
||||
- Why it matters: prevents avoidable language-version compile failures.
|
||||
|
||||
4. **Managed order sequencing**
|
||||
- Good pattern: set stop/target before entry on the same bar.
|
||||
- Anti-pattern: entry first, then stop/target.
|
||||
- Why it matters: avoids silent behavior defects and rejected assumptions.
|
||||
|
||||
5. **Scope-first fixes**
|
||||
- Good pattern: smallest safe change in scoped files only.
|
||||
- Anti-pattern: broad cleanup or adjacent-file edits during bugfix.
|
||||
- Why it matters: reduces regression risk and review churn.
|
||||
|
||||
Reference in New Issue
Block a user