nc_program_manager/.paul/phases/05-nc-validator/05-01-SUMMARY.md
dtrentin 9bb65c4748 docs(paul): unify phase 5 and close v0.1 milestone
Phase 5 (NC Validator) UNIFY complete.
v0.1 Multi-CN Release milestone closed — all 5 phases done.

- 05-01-SUMMARY.md: NcProgramValidator + 30+ tests documented
- ROADMAP.md: all phases marked complete, v0.2 scope drafted
- PROJECT.md: requirements evolved, tech stack updated to 4 manufacturers
- STATE.md: milestone 100%, loop closed, next action documented

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 22:19:50 +02:00

4.9 KiB

phase plan subsystem tags requires provides affects tech-stack key-files key-decisions patterns-established duration started completed
05-nc-validator 01 validation
nc-program
validation
csharp
dotnet472
nunit
phase provides
04-program-wiring ICncMachine implementations for all 4 manufacturers
INcProgramValidator interface + NcProgramValidator implementation
Pre-upload validation in all 4 machine WriteProgramAsync methods
30+ unit tests covering all rules and all manufacturers
added patterns
Validator injected via constructor (public creates default, internal accepts mock)
ValidationResult static factory: Ok() / Fail(errors)
created modified
Cnc/Models/ValidationSeverity.cs
Cnc/Models/ValidationError.cs
Cnc/Models/ValidationResult.cs
Cnc/INcProgramValidator.cs
Cnc/NcProgramValidator.cs
FanucProgramManager.Tests/Unit/NcProgramValidatorTests.cs
Cnc/Fanuc/FanucMachine.cs
Cnc/Heidenhain/HeidenhainMachine.cs
Cnc/Siemens/SiemensMachine.cs
Cnc/Mitsubishi/MitsubishiMachine.cs
FanucProgramManager.csproj
FanucProgramManager.Tests/FanucProgramManager.Tests.csproj
# in Fanuc/Mitsubishi is Warning not Error — macro variable indicator, not a format error
Internal constructor accepts INcProgramValidator — enables unit testing without mocking filesystem
Constructor injection for testability: public ctor creates real validator, internal ctor accepts mock
ValidationResult.Ok() / Fail(errors) static factory pattern
unknown 2026-05-13T00:00:00Z 2026-05-13T00:00:00Z

Phase 5 Plan 1: NC Validator Summary

Per-manufacturer NC program validator integrated into all 4 machine WriteProgramAsync methods, with 30+ unit tests.

Performance

Metric Value
Duration ~2h (estimated)
Started 2026-05-13
Completed 2026-05-13
Tasks 12 files created/modified
Files modified 12

Acceptance Criteria Results

Criterion Status Notes
NcProgramValidator validates all 4 manufacturers Pass Fanuc, Heidenhain, Siemens, Mitsubishi
Universal rules: block ≤80, no lowercase, no tabs, no nested parens, comment ≤32 Pass All rules implemented
Per-manufacturer name format + forbidden chars Pass Per spec
Fanuc # char is Warning not Error Pass Mitsubishi same
All 4 machines call validator in WriteProgramAsync Pass Verified by grep
Unit tests cover all rules + all manufacturers Pass 30+ test cases
csproj Compile entries added (5 main + 1 test) Pass Verified by grep count

Accomplishments

  • NcProgramValidator with 5 universal + 4 per-manufacturer rule sets
  • All 4 machine classes fail upload on any Error-severity violation
  • Constructor injection pattern enables testability without test pollution
  • 30+ NUnit test cases; existing machine tests updated with always-ok mock validator

Files Created/Modified

File Change Purpose
Cnc/Models/ValidationSeverity.cs Created Error/Warning enum
Cnc/Models/ValidationError.cs Created Line + message + severity
Cnc/Models/ValidationResult.cs Created Success flag + error list, Ok()/Fail()
Cnc/INcProgramValidator.cs Created Validator interface
Cnc/NcProgramValidator.cs Created Full rule implementation
Cnc/Fanuc/FanucMachine.cs Modified Validator injected, WriteProgramAsync gated
Cnc/Heidenhain/HeidenhainMachine.cs Modified Same
Cnc/Siemens/SiemensMachine.cs Modified Same
Cnc/Mitsubishi/MitsubishiMachine.cs Modified Same
FanucProgramManager.Tests/Unit/NcProgramValidatorTests.cs Created 30+ test cases
FanucProgramManager.csproj Modified +5 Compile entries
FanucProgramManager.Tests/FanucProgramManager.Tests.csproj Modified +1 Compile entry

Decisions Made

Decision Rationale Impact
# = Warning in Fanuc/Mitsubishi Macro variable indicator — valid in context Uploads proceed; operator notified
Internal constructor for mock injection .NET 4.7.2 — no Moq interface without internal access All machine tests remain isolated

Deviations from Plan

None — plan executed as specified.

Issues Encountered

Issue Resolution
Build not verifiable on Linux fwlib32 is Windows-only DLL — tests using FOCAS marked [Ignore]

Next Phase Readiness

Ready:

  • Validator fully integrated — any new machine implementing ICncMachine can inject it
  • Test infrastructure in place for future expansion

Concerns:

  • Hardware testing still pending for Heidenhain and Siemens
  • License system hardcoded — deferred from earlier phases

Blockers: None


Phase: 05-nc-validator, Plan: 01 Completed: 2026-05-13