Skip to content

fix(robustness): warn on unused adapter flags, reject empty dirs, catch malformed YAML#17

Merged
nullhack merged 4 commits intomainfrom
fix/export-robustness
May 7, 2026
Merged

fix(robustness): warn on unused adapter flags, reject empty dirs, catch malformed YAML#17
nullhack merged 4 commits intomainfrom
fix/export-robustness

Conversation

@nullhack
Copy link
Copy Markdown
Owner

@nullhack nullhack commented May 7, 2026

Summary

Three post-PR robustness fixes for the export command and CLI error handling:

  • Warn on unused adapter flags--flat with --format mermaid now prints a warning to stderr listing unused flag names instead of silently ignoring them
  • Reject empty directories — exporting from a directory with no YAML files produces an error (exit code 1) instead of silently returning []
  • Catch malformed YAML — all CLI commands now catch yaml.YAMLError and print a single-line error with no traceback (pre-existing defect)

Changes

  • flowr/__main__.py: added _run_command() helper, unused-flag warning in _cmd_export, empty-directory check, yaml.YAMLError catch for export and general command paths
  • flowr/domain/export.py: added accepted_options() to FlowExporter Protocol
  • flowr/exporters/json_exporter.py: implemented accepted_options() returning ["flat", "no_attrs"]
  • flowr/exporters/mermaid_exporter.py: implemented accepted_options() returning ["no_conditions"]

Test Coverage

  • 6 new BDD scenarios in tests/features/export_robustness/
  • 343 passed, 2 skipped, 100% coverage
  • @ids: a1b2c3d4, e5f6a7b8, c9d0e1f2, a3b4c5d6, e7f8a9b0, c1d2e3f4

Post-Mortems Addressed

  • PM_20260507_cross-adapter-flags
  • PM_20260507_empty-directory-silent
  • PM_20260507_yaml-traceback-leak

nullhack added 4 commits May 7, 2026 02:16
- Post-mortems: cross-adapter flags, empty directory, YAML traceback leak
- Feature file: 6 BDD scenarios across 3 rules
- Interview notes, event storming addendum, test stubs
…ch malformed YAML

- Warn on stderr when adapter flags irrelevant to selected format are used
- Error exit code 1 when exporting from empty or non-YAML directory
- Catch yaml.YAMLError across all commands with single-line error
- Add accepted_options() to FlowExporter Protocol
- Extract _run_command() helper to reduce main() complexity

@a1b2c3d4 @e5f6a7b8 @c9d0e1f2 @a3b4c5d6 @e7f8a9b0 @c1d2e3f4
@nullhack nullhack merged commit 15071a4 into main May 7, 2026
7 checks passed
@nullhack nullhack deleted the fix/export-robustness branch May 7, 2026 06: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