Skip to content

tri learn: a code fence closes only on a bare line as long as its opener, so one odd line cannot hide the Traps section #11110

Closed

Description

@gHashTag

Part of the night-loop epic #11063 and tri learn (#11060). Found while landing the night's lessons (#11108): in .claude/skills/ci-gates/SKILL.md the command created a new ## Traps heading for each of three lessons, one after the other, instead of one section with three rows. The cause is the code-fence rule in specs/tri/loop/lesson.t27: any line that starts with three backticks closes an open fence, so the line "``` numbers" at line 12531 of that file (a fence with an info string, which GitHub treats as text inside the block) flipped the state, the file looked as if it ended inside a fence, and a heading appended at the end was never seen again.

Goal

tri learn add reads code fences the way GitHub does, so a file with such a line keeps exactly one Traps section however many lessons are added.

Requirements

  • FR-001: A line closes a fence only when it uses the same character as the opener, is at least as long as the opener, and has nothing after the run but spaces and tabs; a fence line with an info string never closes one.
  • FR-002: All 21 tests of specs/tri/loop/lesson.t27 that pass today MUST still pass, and the decisions for a file without such lines MUST not change.
  • FR-003: A test MUST plant the failing shape (a closing-looking line with an info string inside a fence, and a longer outer fence holding a shorter one) and assert that the Traps heading after it is found, and that a second lesson is ADD, not ADD_SECTION.

Scenarios

  • Given a file whose only fence anomaly is "``` numbers" inside a block, when two lessons are added in turn, then the file holds one ## Traps heading and two rows.
  • Given a heading inside a ```` fence that contains a ``` line, when the section is searched, then the heading is not found.

Boundary

  • specs/tri/loop/lesson.t27
  • gen/rust/tri/loop/lesson.rs
  • .trinity/seals/loop_TriLoopLesson.json

Success Criteria

  • t27c test-report specs/tri/loop/lesson.t27 passes with vacuous passes 0 and at least the 21 existing tests plus the new ones.
  • tri learn add run three times on a copy of .claude/skills/ci-gates/SKILL.md leaves one ## Traps heading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions