Skip to content

feat(parser): implement strict indentation mode (LogseqIndentationError) #64

Description

@MarcoPorcellato

Problem

LogseqIndentationError is defined and tested for hierarchy placement (tests/test_exceptions.py) but is never raised by StackMachineParser. Misaligned bullets are silently floored to the nearest indent level (test_misaligned_indentation_floors_to_nearest_level).

Operators and integrators cannot opt into fail-fast parsing for corrupted vault indentation.

Proposed Solution

  • Add strict_indent: bool = False to StackMachineParser (or wire LogseqIndentationError to an existing strict flag)
  • When enabled, raise LogseqIndentationError on non-monotonic indent jumps that today are coerced
  • Document behavior in ARCHITECTURE.md and logseq_ast_primer.md
  • Table-driven tests in tests/test_logos_parser.py

Context

Reserved exception surfaced during local code study (wave 9). Aligns with docs/roadmaps/ROADMAP_ROBUSTNESS_AND_SOFT_BREAKS.md tension between lenient vs strict modes.

Out of scope

  • Changing default lenient behavior (breaking change)

Definition of Done

  • Opt-in strict mode with tests
  • make all passes
  • CHANGELOG.md entry under [Unreleased] if behavior is user-visible

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention or skill is welcome

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions