|
| 1 | +--- |
| 2 | +title: "Canon Index — Architectural Foundation Documents" |
| 3 | +version: "1.0.0" |
| 4 | +created: "2026-03-23" |
| 5 | +status: "canon" |
| 6 | +tags: ["canon", "index", "architecture"] |
| 7 | +--- |
| 8 | + |
| 9 | +# S7Tools Architectural Canon — Index |
| 10 | + |
| 11 | +> The **Canon** is the prescriptive architectural foundation for S7Tools. These documents define |
| 12 | +> the laws that **must** be followed by all code in the system. They are not descriptions of how |
| 13 | +> code currently works, but **mandates** for how it must be written. |
| 14 | +> |
| 15 | +> Generated through a comprehensive source code audit on 2026-03-23. |
| 16 | +
|
| 17 | +--- |
| 18 | + |
| 19 | +## Universal Canon (All Projects) |
| 20 | + |
| 21 | +| Document | Description | |
| 22 | +|----------|-------------| |
| 23 | +| [ARCHITECTURE.md](./ARCHITECTURE.md) | **The Constitution** — Core philosophy, hexagonal architecture, SOLID principles, 10 commandments, mandatory patterns, anti-patterns | |
| 24 | +| [DATA_FLOW.md](./DATA_FLOW.md) | **The Blueprint** — Unidirectional data flow diagrams: UI→ViewModel→Service→Domain→Infrastructure, configuration flow, logging flow, profile CRUD flow | |
| 25 | +| [STATE_MANAGEMENT.md](./STATE_MANAGEMENT.md) | **The Ledger Rules** — State taxonomy, ownership rules, ViewModel reactive patterns, settings/profile/job/connection/log state lifecycle | |
| 26 | +| [CORE_API_CONTRACT.md](./CORE_API_CONTRACT.md) | **The Engine Manual** — Formal internal API: `IApplicationSettingsService`, `IProfileManager<T>`, `IJobScheduler`, `IBootloaderService`, `ILogDataStore`, all hardware interfaces | |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## System Blueprints (Project-Specific) |
| 31 | + |
| 32 | +| Document | Process | Complexity | |
| 33 | +|----------|---------|-----------| |
| 34 | +| [PLC_MEMORY_DUMP_PIPELINE.md](./PLC_MEMORY_DUMP_PIPELINE.md) | 14-stage PLC memory extraction workflow | Critical | |
| 35 | +| [JOB_EXECUTION_PIPELINE.md](./JOB_EXECUTION_PIPELINE.md) | Job lifecycle: enqueue → resource coordination → parallel execution → persistence | Critical | |
| 36 | +| [CONFIGURATION_AND_LOGGING_SYSTEM.md](./CONFIGURATION_AND_LOGGING_SYSTEM.md) | Complete appsettings schema, loading pipeline, logging architecture, anti-patterns audit | Critical | |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## Audit Summary |
| 41 | + |
| 42 | +### Audit Date |
| 43 | +2026-03-23 |
| 44 | + |
| 45 | +### Scope |
| 46 | +414 C# source files across 4 projects: |
| 47 | +- `S7Tools` (UI + Application Services) |
| 48 | +- `S7Tools.Core` (Domain) |
| 49 | +- `S7Tools.Infrastructure.Logging` (Logging Infrastructure) |
| 50 | +- `S7Tools.Diagnostics` (Dev Tooling) |
| 51 | + |
| 52 | +### Key Findings |
| 53 | + |
| 54 | +**Architecture Compliance**: ✅ High |
| 55 | +- Clean separation of Domain / Infrastructure / Presentation layers |
| 56 | +- All service interfaces defined in `S7Tools.Core` |
| 57 | +- No UI framework references in Core or Infrastructure |
| 58 | + |
| 59 | +**Configuration**: ✅ Compliant |
| 60 | +- Strongly-typed `AppSettings` with `[Range]`/`[Required]` validation |
| 61 | +- `WritableOptions<T>` pattern for atomic persistence |
| 62 | +- `IApplicationSettingsService` as single point of access |
| 63 | +- `ValidateOnStart()` prevents startup with invalid config |
| 64 | + |
| 65 | +**Logging**: ✅ Compliant |
| 66 | +- Custom `DataStoreLoggerProvider` (in-memory UI viewer) |
| 67 | +- `UnifiedLoggerProvider` + `FileLogSink` (persistent file output) |
| 68 | +- Per-task isolated log stores via `ITaskLoggerFactory` |
| 69 | +- Structured log templates used throughout |
| 70 | + |
| 71 | +**Active Refactoring in Progress**: |
| 72 | +- Phase 1 (SerialPort): ✅ Complete — decomposed into 3 specialized services + facade |
| 73 | +- Phase 2 (Socat): 🔄 In Progress — 4 specialized services + facade registered |
| 74 | + |
| 75 | +**No Legacy Code Found**: |
| 76 | +- Zero `TODO`, `FIXME`, `HACK`, `DEPRECATED` markers |
| 77 | +- No orphaned interfaces or dead code paths |
| 78 | +- No `Console.WriteLine` in service code (only in `--diag` path of `Program.cs`) |
| 79 | +- No string interpolation in log messages |
| 80 | + |
| 81 | +### Recommendations Encoded in Canon |
| 82 | + |
| 83 | +1. **Ensure `appsettings.json` is present** in repository root (`/src/S7Tools/`) as a build artifact. |
| 84 | + Without it, application starts with all C# defaults (no error), which may not reflect intended production settings. |
| 85 | + |
| 86 | +2. **Add CI architecture test** to enforce that `S7Tools.Core` has zero `ProjectReference` to other S7Tools projects. |
| 87 | + |
| 88 | +3. **Complete Phase 2 Socat refactoring**: Remove legacy `SocatService` monolithic entry path after `SocatFacadeService` is fully validated. |
| 89 | + |
| 90 | +4. **Standardize log level for business events**: Ensure all "job started/completed" type messages use `Information`, not `Debug`. |
0 commit comments