Skip to content

fix(secom): add secom-skip opt-out tag and structured-data safety warnings - #20

Merged
timeleft-- merged 3 commits into
mainfrom
feature-21-secom-structured-data-safety
Mar 10, 2026
Merged

timeleft-- merged 3 commits into
mainfrom
feature-21-secom-structured-data-safety

Conversation

@timeleft--

Copy link
Copy Markdown
Member

Summary

  • Adds secom-skip tag as an explicit opt-out from SECOM compression in before_propose β€” semantically honest alternative to the secom-compressed workaround
  • Adds before_save advisory (secom_structured_data_advisory) when fenced code blocks or JSON-like lines are detected without secom-skip present
  • Adds WARNING log in before_propose when compression proceeds on content with detected structured data, so operators can investigate silent data corruption

Fixes the root cause from Spec 20 β€” the silent JSON/YAML destruction that caused Porch to parse plan_phases: [] and loop the builder indefinitely.

Test plan

  • uv run python -m pytest tests/test_secom.py -v β€” all 34 tests pass (4 new)
  • uv run ruff check β€” clean
  • test_secom_skip_tag_bypasses_compression β€” secom-skip skips compression
  • test_structured_data_warning_logged β€” WARNING emitted via caplog
  • test_structured_data_fenced_code_block_advises β€” fenced block triggers advisory
  • test_structured_data_json_block_advises β€” JSON-like line triggers advisory
  • test_structured_data_advisory_suppressed_with_secom_skip β€” advisory suppressed when secom-skip present
  • All existing tests pass (no regression on secom-compressed bypass, verbosity advisory, on_recall)

πŸ€– Generated with Claude Code

timeleft-- and others added 3 commits March 10, 2026 08:06
…nings

Closes spec 20. Three-part fix for silent JSON/YAML destruction at promote time:

1. secom-skip tag β€” explicit opt-out bypass in before_propose (semantically
   honest alternative to the secom-compressed workaround)
2. before_save advisory β€” warns when fenced code blocks or JSON-like lines are
   detected and secom-skip is absent (code: secom_structured_data_advisory)
3. before_propose WARNING log β€” surfaces structured-data compression to operators
   so silent data corruption can be investigated

Existing secom-compressed bypass and all prior tests continue to pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… notes

From devstral code review:
- Move `import logging` to module top in test file
- Add test_both_advisories_triggered: verbose + structured content yields both Advise actions
- Add test_secom_skip_does_not_suppress_verbosity_advisory: secom-skip is scoped to structured data only

Docs:
- README.md: add secom-skip structured data note and known limitation to SECOM section
- docs/fava_trails_faq.md: add known limitation paragraph to SECOM FAQ answer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@timeleft--
timeleft-- merged commit e9ec8c4 into main Mar 10, 2026
6 checks passed
@timeleft--
timeleft-- deleted the feature-21-secom-structured-data-safety branch March 10, 2026 12:12
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