Urgent.News

What's breaking now, across thousands of outlets.

Tech

Why a PR walkthrough can pass validation and still be hard to read

I made an HTML guide for reading pull requests. When I shared it with coworkers, the visual feedback was encouraging, but I still felt that parts were hard to follow. One person wanted to see the explanation before the code pane, which led to a layout switch. That feedback points to a limit of validation: source references can all be valid while the reader still lacks the context needed to…

A PR walkthrough can be validated, yet remain challenging to read. I created an HTML guide for navigating pull requests, but still found certain aspects difficult to follow. One suggestion was to display explanations before the code. This observation highlights a validation limitation: source references can be accurate, yet the reader might still lack necessary context to comprehend a change.

The PR Tour project implements this concept. A coding agent crafts the reading order, explanations, and definitions within a manifest. A Python builder takes this information, accesses the repository, and generates HTML. The builder verifies the source material more efficiently than it can validate the explanations. Each excerpt should belong to a single snapshot.

The manifest stores the PR URL and commits from the base and head. The builder identifies the shared base of both commits and collects the modifications between that merge and the head. The guide's two sides originate from these snapshots, ensuring reproducibility. However, this approach imposes a constraint: if the PR undergoes modifications later, the saved HTML will reflect the previous snapshot, not the current one.

A functional link to a PR does not guarantee that the embedded code is up-to-date. The essential invariant is that an excerpt and its line numbers correspond to the same source revision. Whether the explanation accurately describes that revision is a separate verification task. Both sides of the diff must be reconstructed. Unlike a standard diff, this version includes unchanged regions as expandable rows for supported text files.

The builder confirms that the line numbers constitute a complete sequence and that the reconstructed line text matches the original source. Both checks are necessary to ensure reliable source viewing. The builder also necessitates that every modified file appears in a reading step, even if the file cannot be rendered as a text diff.

Binary and non-UTF-8 files receive a notice directing the reader to GitHub. This represents file coverage, not explanation coverage. A step may reference a file without including critical failure paths. The same file can appear in multiple steps if following a behavior requires revisiting it later. Link placement must be validated without assuming symbol resolution.

Definition previews rely on authored mappings, and the builder confirms that the target exists, its source range is valid, and the clickable text aligns with the source. An explicit text link must be unambiguous or specify its column. Cross-language nuances exist: Python string positions count Unicode code points, whereas JavaScript string slicing counts UTF-16 code units.

The builder converts positions before displaying them in the browser. Even with accurate offsets, the chosen definition might be conceptually incorrect. Two objects can share the same name. A functional preview confirms the existence of a source range but does not prove that the author correctly mapped the reference to the relevant object.

The explanation should be placed near the definition for easy inspection. Notes direct readers to the discussed lines. The layout switch allows readers to choose which pane appears first, serving as a navigation option rather than evidence of improved comprehension. For instance, the public Starlette example features five changed files, eight reading steps, and thirteen definition previews.

These metrics describe the guide's structure but do not quantify its effectiveness in teaching the change. The resulting HTML file contains the source excerpts, explanations, styles, and scripts, thereby sharing the source code as well. The public example adheres to licensing guidelines and includes the necessary attribution. Testing the explanation with a reviewer could help validate it in ways that a line-range validator cannot.

Currently, no review-time benchmark or controlled comprehension study has been conducted for this release. The upstream Starlette test suite was not executed during the example's generation. Building the guide should not be mistaken for testing the underlying change. While valid source references provide evidence for inspection, the explanation must still convince the reader.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

🪄 The Beauty of Being Bad at First: Why We Need to Protect Our Beginner Mindset 🎨✨

╭──────────────────────────────────────────╮ │ 📁 ℋ𝒾𝓏𝒷𝒶'𝓈 𝒯𝒽ℴ𝓊ℊ𝒽𝓉𝓈 & ℛℯ𝒻𝓁ℯ𝒸𝓉𝒾ℴ𝓃𝓈 │ ╰──────────────────────────────────────────╯ 💡 𝒫ℯ𝓇𝓈ℴ𝓃𝒶𝓁 𝒮ℯ𝓇𝒾ℯ𝓈: ℋ𝒾𝓏𝒷𝒶'𝓈…

More from Monday 14 September →