Skip to content

fix: close the remaining writer-contract and layering gaps from the review - #61

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

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

Conversation

@kevindadi

Copy link
Copy Markdown
Owner

Summary

Follow-up to #60 from a verification /code-review pass on the merged fixes. Closes the remaining I/O-contract gaps, hardens the CMake isolation guard, and removes the remaining duplicated helpers.

Writer I/O contract

  • --diagnostics-file envelope: flush/close are now checked; a delayed write failure adds E-INT-002, is reported on stderr, updates the exit code, and appears in the stdout envelope when --diagnostics json is also set.
  • Allocation report (save_report_json) now uses ptpn::finish_output and returns false on write/flush/close failure (the caller already maps that to E-INT-002).
  • PTPN DOT no longer creates parent directories automatically, matching the documented contract and the TDG DOT/WCET behavior.
  • New regressions: allocation report and diagnostics file on /dev/full, PTPN DOT missing parent, success-log detection for [PETRI_EXPORT].

Robustness

  • Metrics JSON escapes task/lock names (quotes, backslashes, control chars) while keeping byte-identical output for normal identifiers.
  • WCET interval sums use 64-bit accumulators; the writer reuses as_task_node.
  • app/logging.h no longer exposes spdlog types; implementations moved to logging.cpp, keeping spdlog PRIVATE.
  • Lock-type classification and time-range formatting are shared from model/types.h (removes the fourth mutex/spin copy and the parse/export format_range duplicate); the unreachable [Post:<lock>] branch is simplified.

CMake check-isolation guard

  • Runs after every library target is defined; deny-list covers ptpn_dbm/ptpn_reductions; aliases are resolved via ALIASED_TARGET; raw dependency entries (including generator expressions) are matched against the forbidden names before being skipped.
  • Validated by temporarily linking ptpn_reachability (direct and via an alias) into ptpn_app_support: both abort configure; reverted afterwards.

Docs

  • architecture.md: export no longer depends on ptpn_metrics; the SCG writer still depends on ptpn_reachability.
  • diagnostics.md: output-writer coverage is now uniform.

Verification

  • cmake --build build --parallel
  • ctest --test-dir build --output-on-failure: 331/331 passed
  • Golden outputs unchanged (test/golden/ untouched)
  • Manual /dev/full repros: diagnostics file, allocation report, all export writers → exit 1 + E-INT-002; PTPN DOT missing parent leaves the directory uncreated

🤖 Generated with Claude Code

…eview

- check flush/close of the diagnostics envelope file and report E-INT-002 in
  both the stderr log and the stdout envelope
- check flush/close in the allocation report writer
- escape task/lock names in the hand-written metrics JSON
- sum WCET intervals in 64-bit and use as_task_node in the WCET writer
- stop creating parent directories in the PTPN DOT writer
- harden the CMake check-isolation guard (runs after target definitions,
  covers dbm/reductions, resolves aliases and matches raw/genex entries)
- remove spdlog types from app/logging.h via a logging.cpp implementation
- share lock-type and time-range helpers from model/types.h; simplify the
  unreachable post-CS label branch
- sync architecture/diagnostics docs
- add /dev/full, missing-parent, JSON-escaping and WCET-overflow regressions

Co-Authored-By: Claude Code <[email protected]>
@kevindadi
kevindadi merged commit b2b86e4 into ptpn Oct 20, 2026
2 checks passed
@kevindadi
kevindadi deleted the fix/review-60-followups branch October 20, 2026 04:51
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