Skip to content

Commit 519a5cd

Browse files
authored
Show shared threads inline in code diffs (#288)
Line comments should remain beside the changed code while using the same Thread model, replies, reactions, and settlement as the global Threads panel. This adds registry-declared widget thread surfaces. Widgets provide outlets for exact projected datums; core renders retained Thread views and reconciles local placements before the living-margin fallback. The diff widget seats conversations below their lines and returns them to the fallback when files are collapsed, filtered, unloaded, or outdated. Adapter failures are reported and release that widget's views to the fallback without interrupting other conversations; core rendering errors still fail the state application. Outlet removal uses canonical conversation cleanup, including releasing any reaction picker that owns the keyboard. Data projections and fragment loads carry the snapshot that supplied their records. Anchors record source revisions, so source replacement preserves old conversations and drafts without attaching them to replacement content. Returning from the panel waits for the diff outlet, and intervening reader input cancels delayed focus and scrolling. Shared DOM reconciliation preserves retained controls, focus, and caret. Export and print retain conversation messages while removing live controls across shadow roots. Inline and panel controls use the shared button styles, including a neutral disabled state. The feature gallery, registry reference, and widget authoring contracts document and exercise the complete path. ## Verification All 858 everyday tests and formatting/lint checks pass after integrating main. Browser integration checks cover anchors, navigation, visual targets, data projection, startup, and export, including light/dark lifecycle checks. Regression checks reproduce adapter failures and stale reaction-picker keyboard ownership before the fixes, and confirm that reverting the disabled-button fixes fails the new assertions. Browser inspection covered light/dark themes, narrow layouts, drafts, and print. > _This was written by Codex on behalf of max-sixty_
1 parent 4b68d2d commit 519a5cd

62 files changed

Lines changed: 2306 additions & 315 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/registry.html‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ <h2>Find a declaration</h2>
8181
<a href="#x-says"><code>x-says</code></a>
8282
<a href="#x-shadow"><code>x-shadow</code></a>
8383
<a href="#x-state"><code>x-state</code></a>
84+
<a href="#x-thread-surface"><code>x-thread-surface</code></a>
8485
<a href="#x-tone"><code>x-tone</code></a>
8586
<a href="#x-upgrade"><code>x-upgrade</code></a>
8687
<a href="#x-verbatim"><code>x-verbatim</code></a>
@@ -573,6 +574,30 @@ <h3><code>x-state</code></h3>
573574
</details>
574575
</div>
575576
</section>
577+
<section class="reference-entry" id="x-thread-surface">
578+
<h3><code>x-thread-surface</code></h3>
579+
<div class="reference-copy">
580+
<p>
581+
The upgraded widget can seat canonical Thread views beside exact
582+
projected datums.
583+
</p>
584+
<details class="reference-more">
585+
<summary aria-label="Full x-thread-surface contract">
586+
Full contract
587+
</summary>
588+
<p>
589+
Its module registers one adapter through registerThreadSurface; the
590+
adapter owns only outlet geometry and visibility, while Leaf owns
591+
Thread rendering, reply and reaction state, settlement, focus,
592+
receipts, and living-margin fallback. Returning an outlet claims that
593+
thread locally for the current reconciliation; unloaded, filtered,
594+
collapsed, outdated, or otherwise undisplayable datums return no
595+
outlet and remain in the global Threads index plus the ordinary
596+
fallback.
597+
</p>
598+
</details>
599+
</div>
600+
</section>
576601
<section class="reference-entry" id="x-tone">
577602
<h3><code>x-tone</code></h3>
578603
<div class="reference-copy">

‎examples/corpus.data.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
"diff": "diff --git a/atlas/api.py b/atlas/api.py\n--- a/atlas/api.py\n+++ b/atlas/api.py\n@@ -7,3 +7,3 @@ class ImportResult:\n- errors: list[str]\n+ failures: tuple[ImportFailure, ...]\n rows: int"
115115
}
116116
},
117+
"gallery-patch": "diff --git a/gallery/review.py b/gallery/review.py\n--- a/gallery/review.py\n+++ b/gallery/review.py\n@@ -1,2 +1,2 @@\n def route():\n- return \"courtyard\"\n+ return \"covered terrace\"\n",
117118
"gallery-worktrees": {
118119
"bg-request-live-tree": {
119120
"branch": "gallery/ready",

‎examples/corpus.html‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1995,14 +1995,28 @@ <h4 id="bg-request-live-decision-heading">
19951995
</section>
19961996

19971997
<section id="bg-external-data">
1998-
<p class="eyebrow bg-feature-elements">lf-source · lf-num</p>
1998+
<p class="eyebrow bg-feature-elements">lf-diff · lf-source · lf-num</p>
19991999
<h2 id="bg-external-data-heading">
20002000
<strong>External data</strong
20012001
><span class="bg-feature-detail"
20022002
>: live values, snapshots, and provenance</span
20032003
>
20042004
</h2>
20052005

2006+
<section id="bg-inline-diff-threads">
2007+
<p class="eyebrow bg-feature-elements">lf-diff · inline Thread</p>
2008+
<h3 id="bg-inline-diff-threads-heading">
2009+
<strong>Inline diff threads</strong
2010+
><span class="bg-feature-detail">: line comments in review context</span>
2011+
</h3>
2012+
<p id="bg-inline-diff-guide">
2013+
The seeded Thread follows its added line. Reply or resolve in place. Close
2014+
the file to move the Thread to the page margin, then reopen it to return the
2015+
conversation to the diff.
2016+
</p>
2017+
<lf-diff id="bg-review-diff" source="gallery-patch"><pre></pre></lf-diff>
2018+
</section>
2019+
20062020
<section id="bg-source-captures">
20072021
<p class="eyebrow bg-feature-elements">lf-source</p>
20082022
<h3 id="bg-source-captures-heading">

‎examples/developer/feature-gallery.data.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"lines": "1:4"
77
}
88
},
9+
"gallery-patch": "diff --git a/gallery/review.py b/gallery/review.py\n--- a/gallery/review.py\n+++ b/gallery/review.py\n@@ -1,2 +1,2 @@\n def route():\n- return \"courtyard\"\n+ return \"covered terrace\"\n",
910
"gallery-worktrees": {
1011
"bg-request-live-tree": {
1112
"branch": "gallery/ready",

‎examples/developer/feature-gallery.html‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,28 @@ <h4 id="bg-request-live-decision-heading">
316316
</section>
317317

318318
<section id="bg-external-data">
319-
<p class="eyebrow bg-feature-elements">lf-source · lf-num</p>
319+
<p class="eyebrow bg-feature-elements">lf-diff · lf-source · lf-num</p>
320320
<h2 id="bg-external-data-heading">
321321
<strong>External data</strong
322322
><span class="bg-feature-detail"
323323
>: live values, snapshots, and provenance</span
324324
>
325325
</h2>
326326

327+
<section id="bg-inline-diff-threads">
328+
<p class="eyebrow bg-feature-elements">lf-diff · inline Thread</p>
329+
<h3 id="bg-inline-diff-threads-heading">
330+
<strong>Inline diff threads</strong
331+
><span class="bg-feature-detail">: line comments in review context</span>
332+
</h3>
333+
<p id="bg-inline-diff-guide">
334+
The seeded Thread follows its added line. Reply or resolve in place. Close
335+
the file to move the Thread to the page margin, then reopen it to return the
336+
conversation to the diff.
337+
</p>
338+
<lf-diff id="bg-review-diff" source="gallery-patch"><pre></pre></lf-diff>
339+
</section>
340+
327341
<section id="bg-source-captures">
328342
<p class="eyebrow bg-feature-elements">lf-source</p>
329343
<h3 id="bg-source-captures-heading">

‎examples/developer/feature-gallery.jsonl‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{"kind":"comment","author":"claude","agent":"Codex","revision":1,"text":"Gallery conversation: should the practice exercise come before lunch? Try replying here; the agenda is fictional.","anchor":{"section":"bg-thread-text","quote":"The sample agenda has room for one more topic.","prefix":"n existing conversation.","suffix":"Open the speech-bubble B"},"id":"2be2443f0bb6cc49fc86b52f340e6073","ts":"2026-09-02T00:12:33-07:00"}
22
{"kind":"comment","author":"claude","agent":"Codex","revision":1,"text":"Gallery conversation: can the facilitator show a map?","anchor":{"section":"bg-resolved-text","quote":"The room has a projector.","prefix":"A resolved conversation.","suffix":"Its earlier question is "},"id":"bab3cdfcfb8c02aacbb27da731de947a","ts":"2026-09-02T00:12:33-07:00"}
33
{"kind":"comment","author":"claude","agent":"Codex","revision":1,"text":"Gallery conversation: which space is easier to find? This thread shares its target with the verdict and reaction Buttons.","anchor":{"section":"bg-crowded"},"id":"a554d5e884abffdb6494a2fb90b0634f","ts":"2026-09-02T00:12:33-07:00"}
4+
{"kind":"comment","author":"user","revision":1,"text":"Keep the route choice visible beside the line that changes it.","anchor":{"section":"bg-review-diff","datum":"[\"gallery/review.py\",\"new\",2]","source":"gallery-patch","data_revision":2},"id":"8c91ac4c0c9d4e17831f45581a11639a","ts":"2026-09-02T00:12:48-07:00"}
45
{"kind":"reply","author":"claude","agent":"Codex","parent":"bab3cdfcfb8c02aacbb27da731de947a","text":"Yes. This sample answer closes the question; reopen it to try the resolved-thread controls.","id":"83c4cc0bc4433af2b0aadd2e034a6c46","ts":"2026-09-02T00:13:01-07:00"}
56
{"kind":"resolve","author":"claude","agent":"Codex","parent":"bab3cdfcfb8c02aacbb27da731de947a","id":"0a3570ceeb3630d5b3ef5a6c87cdf9cb","ts":"2026-09-02T00:13:02-07:00"}
67
{"kind":"comment","author":"user","revision":1,"token":"ok","anchor":{"section":"bg-react-ok"},"id":"80001234","ts":"2026-09-02T00:13:00-07:00"}

‎examples/developer/versions/feature-gallery.v1.html‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,16 @@ <h3>Where should the sample group meet?</h3>
273273
<section id="bg-external-data">
274274
<h2>Exercise external data</h2>
275275

276+
<section id="bg-inline-diff-threads">
277+
<h3 id="bg-inline-diff-threads-heading">Review a line in its diff</h3>
278+
<p id="bg-inline-diff-guide">
279+
The seeded Thread follows its added line. Reply or resolve in place. Close
280+
the file to move the Thread to the page margin, then reopen it to return the
281+
conversation to the diff.
282+
</p>
283+
<lf-diff id="bg-review-diff" source="gallery-patch"><pre></pre></lf-diff>
284+
</section>
285+
276286
<section id="bg-source-captures">
277287
<h3>Compare a live source with a frozen snapshot</h3>
278288
<p id="bg-source-guide">

0 commit comments

Comments
 (0)