Skip to content

fix(export): enforce the writer I/O contract and finish review follow-ups - #60

Merged
kevindadi merged 1 commit into
ptpnfrom
fix/code-review-followups
Oct 20, 2026
Merged

kevindadi merged 1 commit into
ptpnfrom
fix/code-review-followups

Conversation

@kevindadi

Copy link
Copy Markdown
Owner

Summary

Follow-up fixes from a full /code-review pass over the post-#59 tree.

Correctness

  • Add common/checked_output.h (ptpn::finish_output) and use it in every output writer: TDG DOT, TDG JSON, PTPN DOT, SCG DOT, WCET JSON, metrics JSON. Delayed write/close errors (full disk, quota) now return failure and surface as E-INT-002 instead of a success log.
  • Extend the /dev/full integration test to cover TDG JSON (RTSL path), metrics JSON, PTPN DOT, and SCG DOT (previously only TDG DOT and WCET JSON).
  • Golden outputs are unchanged (TDG DOT labels keep byte-identical formatting).

Layering / build coupling

  • Metrics JSON writer moved back to src/analysis/metrics/; WCET JSON writer moved from src/app into src/export/.
  • ptpn_export no longer links ptpn_metrics or ptpn_json; TDG DOT label helpers are localized in src/export/tdg_dot.cpp.
  • src/app/common.h no longer includes spdlog; the [STATS]/scoped-level helpers live in src/app/logging.h, and ptpn_app_support's spdlog dependency is PRIVATE.
  • Reachability engine headers include scheduling/firing_rule.h instead of the umbrella policy header.
  • model/petri.h drops <iostream>/<sstream>; both to_string() bodies moved to petri.cpp.
  • Policy helpers are now in state_class::detail; the CMake check-isolation guard walks the transitive INTERFACE_LINK_LIBRARIES closure (unwrapping $<LINK_ONLY:...>).
  • Removed leftover unused includes (<fstream> in model/tdg.cpp, stale policy_common includes).

Docs

  • docs/architecture.md and CLAUDE.md corrected: no model↔parse include cycle, writer ownership, logging split.

Verification

  • cmake --build build --parallel
  • ctest --test-dir build --output-on-failure: 325/325 passed
  • Manual /dev/full checks for all writers: exit 1 + E-INT-002 with subject output:/dev/full

🤖 Generated with Claude Code

…ow-ups

- enforce the writer I/O contract via common/checked_output.h: open, write,
  flush and close failures now return false before any success log
- move metrics JSON back to the metrics library and WCET JSON into src/export
- decouple src/export from the parse layer by localizing the TDG DOT label
  helpers; ptpn_export no longer links ptpn_json or ptpn_metrics
- move the spdlog-backed logging helpers out of app/common.h into
  app/logging.h and make app_support's spdlog dependency PRIVATE
- slim model/petri.h by moving both to_string bodies into petri.cpp
- index scheduling policy internals under state_class::detail and include
  firing_rule.h from the reachability headers
- replace the direct app_check link check with a recursive closure guard
- fix architecture/CLAUDE docs to match the current layers

Co-Authored-By: Claude Code <[email protected]>
@kevindadi
kevindadi merged commit 989d5fc into ptpn Oct 20, 2026
2 checks passed
@kevindadi
kevindadi deleted the fix/code-review-followups branch October 20, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant