Skip to content

fix(novelty): Setext and indented code are one span; fix the guide - #1325

Merged
napetrov merged 9 commits into
intel:mainfrom
vchamarthi:issue-974-skill-novelty-walkthrough-disagrees-with-2
Dec 1, 2026
Merged

napetrov merged 9 commits into
intel:mainfrom
vchamarthi:issue-974-skill-novelty-walkthrough-disagrees-with-2

Conversation

@vchamarthi

@vchamarthi vchamarthi commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #974 scenarios 1 to 5; scenario 6 was fixed by #1049. skill novelty analyze counted a Setext heading and four-space indented code as extra sentence spans, and the walkthrough misdescribed three outputs. #973 was fixed by #1045; this change builds on it.; #1305 edits the same page, in sections this change leaves alone.

Changes

  • After fix(novelty): segment skips Setext headings, indented code and comments (#973) #1045, this change makes indented code win over a fence, lets a block start directly after a fence or heading, and makes dangling_fence read the text through segment. The closing --- of front matter is not an underline.
  • The walkthrough says a capped analyze leaves novelty.partial.json, that sole carriers and dead weight are in novelty.json under views, and that probe files carry no run_config.
  • A changelog fragment.
  • dangling_fence skips indented code the way segment does, so a stitched bundle cannot read an indented fence line as an opener.
  • _stitch drops leading blank lines of a bundle file but keeps the first line's indentation, and the walkthrough's cap paragraph lists analyze among the steps that save a partial result.
  • Indented-code detection runs before fence detection in segment and dangling_fence, and front matter needs key: value lines between the two ---.

Risk

Span ids and counts change for artifacts that use Setext headings or indented code, so a saved atoms.json made before this change may not line up with a rerun of the same skill. Plain text, # headings and fenced code segment as before.

Testing

New cases in tests/test_novelty_spans.py (Setext with = and -, front matter, a rule after a blank line, a list item, indented code with a tab and blank lines, a paragraph, a list, the start of the text, offsets) and three tests in tests/test_novelty_journey.py that read the walkthrough. The tests whose name contains novelty, span or skill pass, as do tests/test_growth_ratchet.py and ruff check on the changed files. mypy on dokimi/novelty/spans.py reports no issues. The tests whose names contain novelty, span or skill still pass. Tests whose names contain bundle, prefilter or docs pass too.

Open questions

Scenario 3 can be fixed by writing run_config into the probe record or by correcting the guide. I corrected the guide, since probe files have never carried it.

  • I chose Correct the walkthrough to say probe files carry no run_config over Write run_config into the probe record: smallest change; the probe record has never carried it. Is that the behaviour you want?
  • I chose A Setext heading is the paragraph lines above the underline over Only a single line of text over the underline: a wrapped title is one heading in CommonMark; the single-line form left it as sentence spans. Is that the behaviour you want?
  • I chose Indented code needs a blank line before it and no list context over Reading every indented line as code: keeps list continuations and wrapped paragraphs as they were. Is that the behaviour you want?

Revert

A plain revert restores the old text and span rules; saved records made in between keep the span ids they were written with.

Checklist

  • Tests added/updated and pytest passes
  • ruff, mypy, and schema checks pass
  • Docs updated (or N/A) — see the docs-drift checklist in CONTRIBUTING.md
  • Self-reviewed per "Before opening a PR" in AGENTS.md
  • Each new raise/exit and test names the doc, contract or issue it traces to
  • No ad-hoc run artifacts committed
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml)

Review points edit lines of recent commits: dokimi/dokimi/novelty/spans.py (2bda46b fix(novelty): a longer code fence closes only on a fence as long (#974). Each commit's own tests still pass; none of their assertions changes except those listed above for a scenario of the issue.

Review points also changed dokimi/dokimi/novelty/bundle.py; each change is for a point a test in this pull request reproduces.

Checklist evidence
  • Tests added/updated and pytest passes: 2 test file(s) changed; suite: 30793 passed; 1 failing test(s) fail on the base branch too: tests/test_repo_compare_interval.py::test_the_row_p_places_zero_where_large_deltas_round_p_at_zero_apart; 14 of 14 proof(s) fail before the change
  • ruff, mypy, and schema checks pass: passed: ci.yml:static / ruff check, ci.yml:typecheck / mypy, ci.yml:static / schema-check, ci.yml:static / schema_compat vs the PR base
  • Docs updated (or N/A): updated: dokimi/docs/skill-novelty-walkthrough.md
  • Self-reviewed per "Before opening a PR" in AGENTS.md: nothing left open; mutation of changed lines ran
  • Each new raise/exit and test names the doc, contract or issue it traces to: every new error path and test names a doc, contract or issue
  • No ad-hoc run artifacts committed: 1 added file(s), none a run's output
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml): no new source file

Fixes #974.

A Setext heading and four-space indented code were split into sentence
spans, so `analyze --estimate-only` counted extra spans. The walkthrough
also said `analyze` writes no artifact when the cap stops measurement
(it writes `novelty.partial.json`), sent readers to `annotated.html`
for sole carriers (they are in `novelty.json`), and asked them to
compare a `run_config` that `probe` files do not carry.

Fixes intel#974

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi
vchamarthi requested a review from a team as a code owner November 27, 2026 01:28
Copilot AI balanced review requested due to automatic review settings November 27, 2026 01:28
@exai-bot

exai-bot commented Nov 27, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 7 selected item(s).

CI at 0af133d: 21 passing, 4 skipped.

Review limit reached. This PR has had 6 reviews, so it will only be reviewed again when you ask.
To ask: re-request review from exai-bot in the Reviewers list.

Review details
  • Commit reviewed: 0af133d against merge base e260503
  • Coverage: 7 files in 1 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 332k tokens (236k from cache), 1m7s
  • Tool calls: 24 (12 file_read, 5 code_search, 5 pr_threads, 1 ci_status, 1 local_check_results)
  • Novelty walkthrough span handling, integration, tests, and documentation: 7 files

Comment thread dokimi/dokimi/novelty/spans.py Resolved
Comment thread dokimi/dokimi/novelty/spans.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

Updates novelty span segmentation to treat Setext headings and indented code blocks as single spans (aligning with CommonMark-like expectations), and corrects the novelty walkthrough to match actual CLI/artifact behavior.

Changes:

  • Adjust segment() / dangling_fence() to recognize Setext headings and indented code blocks consistently (including front matter and list-context rules).
  • Refine bundle stitching to drop only leading blank lines while preserving indentation that can affect segmentation.
  • Update walkthrough text and add tests covering the corrected scenarios and documentation expectations.
File Description
dokimi/​dokimi/​novelty/​spans.py Implements Setext + indented-code span handling and aligns dangling_fence() with segment().
dokimi/​dokimi/​novelty/​bundle.py Preserves first-line indentation while trimming leading blank lines to keep segmentation stable.
dokimi/​docs/​skill-novelty-walkthrough.md Corrects walkthrough claims about artifacts (novelty.partial.json, views.*, probe run_config).
dokimi/​tests/​test_novelty_spans.py Adds regression tests for Setext/indented-code span counting, offsets, and bundling interactions.
dokimi/​tests/​test_novelty_journey.py Adds tests asserting walkthrough statements and probe output structure.
dokimi/​changelog.d/​20261126_150000_novelty-walkthrough-spans.md Changelog entry describing behavioral + documentation alignment.

Review effort: Lite

Comment thread dokimi/dokimi/novelty/spans.py Resolved
Comment thread dokimi/dokimi/novelty/spans.py Resolved
Comment thread dokimi/tests/test_novelty_spans.py Resolved
@codecov-commenter

codecov-commenter commented Nov 27, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.29%. Comparing base (e260503) to head (0af133d).
⚠️ Report is 23 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1325      +/-   ##
==========================================
+ Coverage   96.28%   96.29%   +0.01%     
==========================================
  Files         513      515       +2     
  Lines       68470    68909     +439     
  Branches    11884    11930      +46     
==========================================
+ Hits        65924    66359     +435     
- Misses       1566     1570       +4     
  Partials      980      980              
Files with missing lines Coverage Δ
dokimi/dokimi/novelty/bundle.py 94.40% <100.00%> (ø)
dokimi/dokimi/novelty/spans.py 99.61% <100.00%> (+<0.01%) ⬆️

... and 49 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

dangling_fence now skips a list item's continuation lines as segment
does, so a fence opened after one is reported. A Setext heading or
indented code may start right after a closed code block. Indented code
is found in one pass, and the block-start check no longer reads
lines[-1] at the first line. The front-matter and list-continuation
cases get tests.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

This is ready for another look: I've pushed 1 commit on issue-974-skill-novelty-walkthrough-disagrees-with-2 (a2a8bce..b00f5da).

Changes:

  • dangling_fence skips a list item's continuation lines like segment, so a fence opened after one is reported.
  • A Setext heading or indented code can start right after a closed code block.

Threads and comments:

  • I answered each one in its thread: 6 fixed.

What I checked on the new commit:

  • One thread I marked fixed has no test of its own; the reply there says what changed.
  • All 3 new tests fail before the fix and pass after it.
  • The full test suite passes with main merged in (31,037 tests), apart from 1 failure main has too.
What each test shows
  • Indented code with many blank lines stays one span: passes.
  • A fence after a list continuation is reported by dangling_fence: fails before, passes after.
  • Setext heading after a closed fence: fails before, passes after.
  • Indented code with many blank lines stays one span: fails before, passes after.
  • A field line over --- that is not front matter is a heading: passes.
  • Also changed, outside the PR's files: dokimi/scripts/growth_baseline.json.

Comment thread dokimi/dokimi/novelty/bundle.py Resolved
Comment thread dokimi/dokimi/novelty/spans.py Resolved
Comment thread dokimi/dokimi/novelty/spans.py Resolved
…pans

- An ATX heading indented up to three spaces is a heading, so a bundled
  file that starts with `  # Setup` keeps its heading path.
- A Setext underline may end in a carriage return, so CRLF text is
  segmented like LF text.
- dangling_fence now finds Setext headings the way segment does instead
  of reading every underline-shaped line as a finished heading, so a
  bare `---` no longer lets the next file be swallowed into a code span.
- An ATX heading needs a space or tab after the #s, not any whitespace,
  so an empty indented heading reads alike in segment and dangling_fence.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

This is ready for another look: I've pushed 1 commit on issue-974-skill-novelty-walkthrough-disagrees-with-2 (b00f5da..95182a0).

Threads:

  • I answered each one in its thread: 3 fixed.

What I checked on the new commit:

  • 3 of 4 new tests fail before the fix and pass after it; the other passes before the fix too, so it guards the change rather than reproduce a bug.
  • The full test suite passes with main merged in (31,279 tests), apart from 1 failure main has too.
What each test shows
  • indented ATX heading: fails before, passes after.
  • CRLF underline: fails before, passes after.
  • bare rule: fails before, passes after.
  • empty indented ATX heading: passes before the fix too.

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change class: LOCAL (head 95182a0)

  • Contract: none
  • Responsibility: none
  • Dependency: none
  • Review depth: skim: local change, check diff + tests
  • Coverage gaps: none

The Setext and indented-code span rules, bundle offsets, and walkthrough examples pass the changed test suite. Before landing, please coordinate with already-approved #1045. Both PRs implement Setext headings and indented spans. A trial merge of their current heads conflicts in dokimi/dokimi/novelty/spans.py, dokimi/tests/test_novelty_spans.py, and dokimi/scripts/growth_baseline.json. Choose which span implementation lands first, then rebase the other to retain its distinct changes. A separate combined checkout of #1325, #1371, and #1374 passed 141 targeted tests.

Coverage: 55 passed in 2.41s. Hosted checks on the reviewed head passed or skipped.

…ng_fence

_LIST_ITEM ended in \s+, which matched the line ending segment keeps
but dangling_fence drops. A lone `-` or `1.` opened a list for one and
not the other, so _stitch left a fence open and swallowed the next file.

Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
…xt lookahead

Without the structural break in _setext, `Intro line` over a fence with a
YAML `---` became a heading that swallowed half the fence; no test failed.

Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
`> rule` over `---` became a heading, so `trace prefilter` lost the rule
and used it as the next claim's heading. CommonMark reads the block and
a thematic break. The changelog fragment now names `trace prefilter`.

Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
@xaleryb

xaleryb commented Nov 29, 2026

Copy link
Copy Markdown
Contributor
  • Run on head 95182a0 merged with current main, Python 3.13: full suite, ruff, mypy, bandit, growth, comment-block and docs gates, plus mutants of the new branches in spans.py.
  • Empty list item: _stitch of Steps:\n\n-\n\n + a fenced example line, then references/r.md -> dangling_fence returns None and the reference heading and sentence end up inside the entrypoint's code span -> both scanners read - as a list item and the reference keeps its own spans (main does this).
  • > Never run \git push --force` on main.over---->trace prefilterdrops the rule and uses it as the next claim's heading -> it stays a claim. The same happens withover---inheading_path`.
  • Commits to push: 9e992b9 (_LIST_ITEM tail does not depend on the line ending); bffac7d (tests the structural break in the Setext lookahead); 1f5a73d (blockquote/HTML comment guard, and the changelog names trace prefilter).
  • Left to the author: correct the PR body line saying the prefilter is not touched; coordinate with fix(novelty): segment skips Setext headings, indented code and comments (#973) #1045 (conflicts in spans.py, test_novelty_spans.py, growth_baseline.json). Whichever PR lands second keeps both the quote/comment guard and the dangling_fence agreement.

Comment thread dokimi/dokimi/novelty/spans.py Resolved
Comment thread dokimi/dokimi/novelty/spans.py Resolved
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Mutation of changed lines

⚠️ Tests miss 8 of 69 small breaks of the lines this PR changes

At 0af133d: 61 caught · 8 missed

Each row is a small deliberate break (a mutant) of a line this PR changes that every test reaching that line still passes. Add a test that fails on it or, if it cannot change behaviour, put # mutation-ok[<operator>]: <reason> at the end of the line or alone on the line above.

Where Operator Change no test notices Tests reaching the line
dokimi/dokimi/novelty/spans.py:321 bump-int 1 → 2 27
dokimi/dokimi/novelty/spans.py:378 bump-int 1 → 2 460
dokimi/dokimi/novelty/spans.py:398 drop-clause in_list and line.startswith((" ", "\t")) → (in_list) 45
dokimi/dokimi/novelty/spans.py:371 take-branch () if kind == "comment" else protection_tags(_blank_comments(read or stripped, " → (protection_tags(_blank_comments(read or stripped, " "))) 459
dokimi/dokimi/novelty/spans.py:398 drop-clause in_list and line.startswith((" ", "\t")) → (line.startswith((" ", "\t"))) 45
dokimi/dokimi/novelty/spans.py:398 swap-boolop in_list and line.startswith((" ", "\t")) → in_list or line.startswith((' ', '\t')) 45
dokimi/dokimi/novelty/spans.py:398 drop-element (" ", "\t") → (" ",) 45
dokimi/dokimi/novelty/spans.py:398 drop-element (" ", "\t") → ("\t",) 45

Not checked:

  • 6 changed lines were not mutated

Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary.

…with-2

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Main's segment (intel#1045) already makes Setext headings and indented code one
span each. On top of it:
- dangling_fence returns the fence segment leaves open, so a stitched bundle
  agrees with segment on indented backticks, list continuations, empty list
  items and CRLF.
- indented code is read before a fence, so four-space backticks after a blank
  line are code.
- indented code or a Setext heading may follow a closed fence or a heading
  directly; an ATX heading may be indented up to three spaces.
- the growth baseline entry for segment is dropped.
- a lone `-` under a paragraph line is a level-two Setext underline.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

@xaleryb, this is ready for another look: 2 commits on issue-974-skill-novelty-walkthrough-disagrees-with-2 (1f5a73d..9a769c7) answers 3 of your comments.

Changes:

  • dangling_fence returns the fence segment leaves open instead of counting fence-looking lines.
  • Indented code is read before a fence, and a block may start directly after a closed fence or a heading.
  • An ATX heading may be indented up to three spaces.
  • A lone - under a paragraph line is a level-two Setext underline.

PR description updated:

Your comment:

  • test_an_empty_list_item_is_read_alike_by_segment_and_dangling_fence passes on the latest commit.
  • test_a_blockquoted_rule_over_a_thematic_break_stays_a_prefilter_claim passes: the quote stays a claim; a comment over --- is now a comment span, so it is no claim and the next heading stays Rules.
  • fix(novelty): segment skips Setext headings, indented code and comments (#973) #1045 has landed and I merged main, resolving spans.py, test_novelty_spans.py and growth_baseline.json in favour of its segment; the PR text is corrected below.

Threads:

  • I answered each one in its thread: 2 fixed.

What I checked on the new commit:

  • 2 of 3 new tests fail before the fix and pass after it; the other passes before the fix too, so it guards the change rather than reproduce a bug.
  • 3 tests removed or renamed.
  • The full test suite passes with main merged in (33,537 tests), apart from 1 failure main has too.
What each test shows
  • dangling_fence agrees with segment on indented backticks: passes.
  • indented backticks after a blank line are code: passes.
  • block may follow a closed fence directly: passes.
  • CRLF Setext heading followed by indented code: passes.
  • ATX heading indented up to three spaces: passes.
  • indented code right after a heading: passes.
  • lazy list continuation read alike by both: fails before, passes after.
  • two-space continuation keeps the list open: fails before, passes after.
  • a lone hyphen underlines a paragraph line: passes before the fix too.
  • Removed or renamed tests: test_a_leading_rule_is_not_front_matter, test_an_indented_empty_atx_heading_is_read_alike_by_segment_and_dangling_fence, test_indented_code_end_does_bounded_work_over_many_blank_lines.

Comment thread dokimi/dokimi/novelty/spans.py Resolved
…tel#974)

A reference whose front matter has a blank line was scanned alone, so
its fence status differed from the stitched document and the appended
backticks opened a fence over the next file. Scan the heading and body
together, as they are stitched.

Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

This is ready for another look: I've pushed 1 commit on issue-974-skill-novelty-walkthrough-disagrees-with-2 (9a769c7..0af133d).

Changes:

  • _stitch now calls dangling_fence(header + body), so a file after the first is read with its synthetic heading above it.

Threads:

  • I answered each one in its thread: 1 fixed.

What I checked on the new commit: the new test fails before the fix and passes after it; the full test suite passes with main merged in (33,966 tests).

What each test shows
  • Three stitched files do not let the second one swallow the third: fails before, passes after.

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change class: CONTRACT (head 0af133d)

  • Contract: candidate. defaults dokimi/dokimi/novelty/spans.py:321
  • Responsibility: none
  • Dependency: none
  • Review depth: check the changed surface: callers, docs, tests pin new behaviour
  • Coverage gaps: none

Checked Setext headings, indented code, span offsets, bundle boundaries and the walkthrough against the output files. The bundle now checks the dangling fence in the context of its file heading. The spans and journey suites passed locally (100 tests), and GitHub CI passed.

@napetrov
napetrov merged commit 5757db6 into intel:main Dec 1, 2026
25 checks passed
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.

Skill novelty walkthrough disagrees with analyze and probe artifacts

6 participants