nc_program_manager/.paul/STATE.md
dtrentin 39a9566858 feat(07-license-core): RSA offline license core
Phase 07 complete:
- IMachineFingerprint + ILicenseValidator interfaces
- MachineFingerprint: WMI CPU ProcessorID + BaseBoard SerialNumber
- LicenseValidator: RSACryptoServiceProvider + SHA256, injectable public key
- LicenseFile.TryRead: out-param bool, no exceptions from file I/O
- 6 NUnit tests (valid/wrong-machine/tampered/empty/not-base64/missing-file)
- 118 tests total, 116 pass, 2 Fanuc FOCAS ignored (Windows DLL)
- Fix: missing 'using System' in CncMachineFactoryTests.cs
- Fix: Dockerfile.test updated for NcProgramManager rename

PublicKeyXml = PLACEHOLDER until Phase 09 generates real key pair.

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

102 lines
4.1 KiB
Markdown

# Project State
## Project Reference
See: .paul/PROJECT.md (updated 2026-05-17)
**Core value:** Machinists transfer CNC programs to/from any controller without manual steps or internet
**Current focus:** v0.1 complete — ready for next milestone planning
## Current Position
Milestone: v0.2 NcProgramManager
Phase: 3 of 4 (08-license-integration) — Not started
Plan: Not started
Status: Ready to plan Phase 08
Last activity: 2026-05-17 — Phase 07 complete, transitioned to Phase 08
Progress:
- Milestone v0.1: [██████████] 100% (complete)
- Milestone v0.2: [█████░░░░░] 50%
- Phase 08: [░░░░░░░░░░] 0%
## Loop Position
Current loop state:
```
PLAN ──▶ APPLY ──▶ UNIFY
✓ ✓ ✓ [Loop complete — ready for next PLAN]
```
## What Was Built (v0.1 Multi-CN Release)
### Phase 1 — CNC Abstraction
- Namespace: `Fanuc_integration.Cnc.*``FanucProgramManager.Cnc.*` (29 files)
- `IFocasDialect` extended: `UploadStart`/`DownloadStart` accept `short fileType`
- `IFanucMachine` created: extends `ICncMachine` with tool offset + work zero R/W
- `CncManufacturer` enum: Fanuc, Heidenhain, Siemens, Mitsubishi
- All 29 `Cnc/**/*.cs` files added to csproj
### Phase 2 — Heidenhain LSV2
- `HeidenhainConnectionConfig` — IP, port 19000, credentials, timeout
- `Lsv2Client` — TCP framing, CRC-16/CCITT, login (SELECT+LOG_IN), ReceiveFile/SendFile
- `HeidenhainMachine : ICncMachine` — RunGuardedAsync pattern, state machine
### Phase 3 — Siemens + Mitsubishi FTP
- `SiemensConnectionConfig` / `SiemensFtpClient` / `SiemensMachine : ICncMachine`
- `MitsubishiConnectionConfig` / `MitsubishiFtpClient` / `MitsubishiMachine : ICncMachine`
### Phase 4 — Wiring
- `CncMachineFactory` — creates right `ICncMachine` from `InputArgs`
- `InputArgs` — added `manufacturer`, `username`, `password` fields
- `Program.cs` — full rewrite using `ICncMachine`; Fanuc 3-file via `IFanucMachine` cast
### Phase 5 — NC Validator
- `ValidationSeverity` / `ValidationError` / `ValidationResult` model types
- `INcProgramValidator` + `NcProgramValidator` (5 universal + per-manufacturer rules)
- Validator injected into all 4 machine classes; upload blocked on Error severity
- `NcProgramValidatorTests` — 30+ NUnit tests
### Test Infrastructure
- `FanucProgramManager.Tests/` — NUnit 3.13.3 + Moq 4.18.4, .NET 4.7.2
- `FtpServerStub` + `Lsv2ServerStub` — in-process TCP stubs
- Unit + integration tests; Fanuc FOCAS tests `[Ignore]`d (Windows-only DLL)
## CLI Args (v0.1)
- `-manufacturer=fanuc|heidenhain|siemens|mitsubishi` (default: fanuc)
- `-username=` (Heidenhain/Siemens/Mitsubishi)
- `-password=` (Heidenhain/Siemens/Mitsubishi)
## Accumulated Context
### Decisions
- .NET 4.7.2 locked — max compatibility
- RSA asymmetric offline licensing: private key vendor-only, public key embedded in binary
- PublicKeyXml = PLACEHOLDER until Phase 09 generates real key pair
- `RSACryptoServiceProvider` + `SHA256CryptoServiceProvider` (not HashAlgorithmName) — .NET 4.7.2 compat
- Constructor injection pattern: internal ctor accepts key XML — testable without Windows WMI
- Heidenhain: LSV2 port 19000, needs real hardware testing
- Siemens: FTP `/_N_MPF_DIR/`, needs Sinumerik FTP option enabled on machine
- `#` = Warning in Fanuc/Mitsubishi — macro variable indicator
### Deferred Issues
- License wiring into Program.cs — Phase 08 target
- License generator tool — Phase 09 target
- Real RSA key pair — Phase 09 output; copy PublicKeyXml into LicenseValidator.cs
- Heidenhain: `ReadActiveProgramAsync` / `SelectMainProgram` not implemented
- Siemens: same as Heidenhain
- Build + integration not verifiable on Linux (fwlib32 Windows-only)
- MachineFingerprint WMI — code-review verified, needs real Windows hardware test
### Blockers/Concerns
None — Phase 08 can start.
## Session Continuity
Last session: 2026-05-17
Stopped at: Phase 07 complete (UNIFY done)
Next action: /paul:plan for Phase 08 (license-integration)
Resume file: .paul/ROADMAP.md
---
*STATE.md — Updated after every significant action*