Bumps
[mitchellh/vouch/action/manage-by-issue](https://github.com/mitchellh/vouch)
from 1.4.2 to 1.5.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/mitchellh/vouch/releases">mitchellh/vouch/action/manage-by-issue's
releases</a>.</em></p>
<blockquote>
<h2>v1.5.0</h2>
<h2>What's New</h2>
<h3>Improvements</h3>
<p>-<strong><code>action/check-issue</code></strong> has a new option
<code>auto-lock</code> to automatically lock closed issues. (<a
href="https://redirect.github.com/mitchellh/vouch/pull/90">#90</a>)</p>
<ul>
<li><strong><code>gh-manage-by-discussion</code></strong> supports
numerical IDs. (<a
href="https://redirect.github.com/mitchellh/vouch/pull/77">#77</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d66fa29a64"><code>d66fa29</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/93">#93</a>
from mitchellh/dependabot/github_actions/actions/check...</li>
<li><a
href="c22b93d0e8"><code>c22b93d</code></a>
Bump actions/checkout from 6.0.2 to 7.0.0</li>
<li><a
href="baeb3bf7c7"><code>baeb3bf</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/90">#90</a>
from trag1c/lock-issues</li>
<li><a
href="52aec3d646"><code>52aec3d</code></a>
add an option to lock closed issues</li>
<li><a
href="3dbc69c691"><code>3dbc69c</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/87">#87</a>
from freepicheep/example-attribute</li>
<li><a
href="a6933466b4"><code>a693346</code></a>
Update VOUCHED list</li>
<li><a
href="21177c0fec"><code>21177c0</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/74">#74</a>
from pavelzw/vouch-cli</li>
<li><a
href="527cdc3488"><code>527cdc3</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/81">#81</a>
from mitchellh/dependabot/github_actions/hustcer/setup...</li>
<li><a
href="1895e9c54f"><code>1895e9c</code></a>
feat: use <a
href="https://github.com/example"><code>@example</code></a> attribute
for command examples</li>
<li><a
href="8c80ada45b"><code>8c80ada</code></a>
Update README</li>
<li>Additional commits viewable in <a
href="c6d80ead49...d66fa29a64">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Bumps
[mitchellh/vouch/action/check-pr](https://github.com/mitchellh/vouch)
from 1.4.2 to 1.5.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/mitchellh/vouch/releases">mitchellh/vouch/action/check-pr's
releases</a>.</em></p>
<blockquote>
<h2>v1.5.0</h2>
<h2>What's New</h2>
<h3>Improvements</h3>
<p>-<strong><code>action/check-issue</code></strong> has a new option
<code>auto-lock</code> to automatically lock closed issues. (<a
href="https://redirect.github.com/mitchellh/vouch/pull/90">#90</a>)</p>
<ul>
<li><strong><code>gh-manage-by-discussion</code></strong> supports
numerical IDs. (<a
href="https://redirect.github.com/mitchellh/vouch/pull/77">#77</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d66fa29a64"><code>d66fa29</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/93">#93</a>
from mitchellh/dependabot/github_actions/actions/check...</li>
<li><a
href="c22b93d0e8"><code>c22b93d</code></a>
Bump actions/checkout from 6.0.2 to 7.0.0</li>
<li><a
href="baeb3bf7c7"><code>baeb3bf</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/90">#90</a>
from trag1c/lock-issues</li>
<li><a
href="52aec3d646"><code>52aec3d</code></a>
add an option to lock closed issues</li>
<li><a
href="3dbc69c691"><code>3dbc69c</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/87">#87</a>
from freepicheep/example-attribute</li>
<li><a
href="a6933466b4"><code>a693346</code></a>
Update VOUCHED list</li>
<li><a
href="21177c0fec"><code>21177c0</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/74">#74</a>
from pavelzw/vouch-cli</li>
<li><a
href="527cdc3488"><code>527cdc3</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/81">#81</a>
from mitchellh/dependabot/github_actions/hustcer/setup...</li>
<li><a
href="1895e9c54f"><code>1895e9c</code></a>
feat: use <a
href="https://github.com/example"><code>@example</code></a> attribute
for command examples</li>
<li><a
href="8c80ada45b"><code>8c80ada</code></a>
Update README</li>
<li>Additional commits viewable in <a
href="c6d80ead49...d66fa29a64">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Bumps
[mitchellh/vouch/action/check-issue](https://github.com/mitchellh/vouch)
from baeb3bf7c7e6c12d6e33bab3870b7e936580a934 to
d66fa29a64600490892131ad87597c30c91fcac4.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d66fa29a64"><code>d66fa29</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/93">#93</a>
from mitchellh/dependabot/github_actions/actions/check...</li>
<li><a
href="c22b93d0e8"><code>c22b93d</code></a>
Bump actions/checkout from 6.0.2 to 7.0.0</li>
<li>See full diff in <a
href="baeb3bf7c7...d66fa29a64">compare
view</a></li>
</ul>
</details>
<br />
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Bumps
[mitchellh/vouch/action/manage-by-discussion](https://github.com/mitchellh/vouch)
from 1.4.2 to 1.5.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/mitchellh/vouch/releases">mitchellh/vouch/action/manage-by-discussion's
releases</a>.</em></p>
<blockquote>
<h2>v1.5.0</h2>
<h2>What's New</h2>
<h3>Improvements</h3>
<p>-<strong><code>action/check-issue</code></strong> has a new option
<code>auto-lock</code> to automatically lock closed issues. (<a
href="https://redirect.github.com/mitchellh/vouch/pull/90">#90</a>)</p>
<ul>
<li><strong><code>gh-manage-by-discussion</code></strong> supports
numerical IDs. (<a
href="https://redirect.github.com/mitchellh/vouch/pull/77">#77</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d66fa29a64"><code>d66fa29</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/93">#93</a>
from mitchellh/dependabot/github_actions/actions/check...</li>
<li><a
href="c22b93d0e8"><code>c22b93d</code></a>
Bump actions/checkout from 6.0.2 to 7.0.0</li>
<li><a
href="baeb3bf7c7"><code>baeb3bf</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/90">#90</a>
from trag1c/lock-issues</li>
<li><a
href="52aec3d646"><code>52aec3d</code></a>
add an option to lock closed issues</li>
<li><a
href="3dbc69c691"><code>3dbc69c</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/87">#87</a>
from freepicheep/example-attribute</li>
<li><a
href="a6933466b4"><code>a693346</code></a>
Update VOUCHED list</li>
<li><a
href="21177c0fec"><code>21177c0</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/74">#74</a>
from pavelzw/vouch-cli</li>
<li><a
href="527cdc3488"><code>527cdc3</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/81">#81</a>
from mitchellh/dependabot/github_actions/hustcer/setup...</li>
<li><a
href="1895e9c54f"><code>1895e9c</code></a>
feat: use <a
href="https://github.com/example"><code>@example</code></a> attribute
for command examples</li>
<li><a
href="8c80ada45b"><code>8c80ada</code></a>
Update README</li>
<li>Additional commits viewable in <a
href="c6d80ead49...d66fa29a64">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Bumps
[mitchellh/vouch/action/sync-codeowners](https://github.com/mitchellh/vouch)
from 1.4.2 to 1.5.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/mitchellh/vouch/releases">mitchellh/vouch/action/sync-codeowners's
releases</a>.</em></p>
<blockquote>
<h2>v1.5.0</h2>
<h2>What's New</h2>
<h3>Improvements</h3>
<p>-<strong><code>action/check-issue</code></strong> has a new option
<code>auto-lock</code> to automatically lock closed issues. (<a
href="https://redirect.github.com/mitchellh/vouch/pull/90">#90</a>)</p>
<ul>
<li><strong><code>gh-manage-by-discussion</code></strong> supports
numerical IDs. (<a
href="https://redirect.github.com/mitchellh/vouch/pull/77">#77</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d66fa29a64"><code>d66fa29</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/93">#93</a>
from mitchellh/dependabot/github_actions/actions/check...</li>
<li><a
href="c22b93d0e8"><code>c22b93d</code></a>
Bump actions/checkout from 6.0.2 to 7.0.0</li>
<li><a
href="baeb3bf7c7"><code>baeb3bf</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/90">#90</a>
from trag1c/lock-issues</li>
<li><a
href="52aec3d646"><code>52aec3d</code></a>
add an option to lock closed issues</li>
<li><a
href="3dbc69c691"><code>3dbc69c</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/87">#87</a>
from freepicheep/example-attribute</li>
<li><a
href="a6933466b4"><code>a693346</code></a>
Update VOUCHED list</li>
<li><a
href="21177c0fec"><code>21177c0</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/74">#74</a>
from pavelzw/vouch-cli</li>
<li><a
href="527cdc3488"><code>527cdc3</code></a>
Merge pull request <a
href="https://redirect.github.com/mitchellh/vouch/issues/81">#81</a>
from mitchellh/dependabot/github_actions/hustcer/setup...</li>
<li><a
href="1895e9c54f"><code>1895e9c</code></a>
feat: use <a
href="https://github.com/example"><code>@example</code></a> attribute
for command examples</li>
<li><a
href="8c80ada45b"><code>8c80ada</code></a>
Update README</li>
<li>Additional commits viewable in <a
href="c6d80ead49...d66fa29a64">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Using `clearRetainingCapacity` as it was being used in
Fingerprint.update produces undefined behavior; both the old "copy" and
current version of the fingerprint would still be using the same
storage.
This commit changes the function so that the storage is more clearly
re-used, and shrunk at the end if need be.
Using `clearRetainingCapacity` as it was being used in
Fingerprint.update produces undefined behavior; both the old "copy" and
current version of the fingerprint would still be using the same
storage.
This commit changes the function so that the storage is more clearly
re-used, and shrunk at the end if need be.
Retain the existing fingerprint's storage instead of allocating a fresh
owned slice on every update. The previous approach built a replacement
fingerprint before it knew whether the viewport changed, discarding it
for unchanged viewports.
The fingerprint now rebuilds in place after reserving viewport-sized
capacity and reports whether its contents changed. Unchanged viewport
updates skip the allocation, while changed viewports will usually reuse
the existing buffer for the lifetime of the active search.
Retain the existing fingerprint's storage instead of allocating a fresh
owned slice on every update. The previous approach built a replacement
fingerprint before it knew whether the viewport changed, discarding it
for unchanged viewports.
The fingerprint now rebuilds in place after reserving viewport-sized
capacity and reports whether its contents changed. Unchanged viewport
updates skip the allocation, while changed viewports will usually reuse
the existing buffer for the lifetime of the active search.
Replaces #13292
This optimizes page-local hyperlink and grapheme maps under full
occupancy, repeated clear and redraw, and managed-cell movement.
Hyperlink maps previously allowed 100% occupancy and retained tombstones
after removals. This PR bounds probe lengths with a reserved load factor
and removes tombstones from the design entirely: removal now restores
the table to the exact state it would be in had the key never been
inserted, so fragmentation cannot accumulate by construction.
Clear and redraw improves by 2.4x, hyperlinked cell movement by 10.4x, a
scrolling OSC 8 stream by 1.7x, and normal ASCII/unicode output does not
regress.
## The changes
1. **Reserve probe headroom in hyperlink cell maps.** Hash maps now
support a maximum load config and hyperlink maps set it to 80%.
**Result: known-absent cell movement improves from 1.550 s to 149 ms.**
2. **Replace tombstone removal with backward-shift deletion.** Removing
an entry now closes the hole by shifting later entries backward. This
keeps probe chains short without tombstones, headroom bookkeeping, or
periodic rehashing. Removal may move other entries, but no caller
retains pointers across removals. **Result: clear and redraw improves
from 672 ms to 512 ms over the tombstone revision, 2.4x over baseline,
and the map shrinks by ~140 lines, improving maintenance.**
3. **Avoid duplicate probes when moving managed cell data.** Hyperlink
and grapheme movement already guarantees that the destination is absent,
so these paths use no-clobber insertion and skip duplicate detection.
With backward-shift deletion this fast path is safe at every load state
without special cases, because removing the source genuinely frees a
slot before the destination is inserted. **Result: movement stays at
parity with the tombstone revision (149 ms vs 148 ms) while its
rehash-retry guard is deleted.**
Note a trade-off: the map-churn microbenchmark at maximum load is ~16%
slower, because removal pays a cluster scan up front instead of
deferring cost to later probes and periodic rebuilds. But its a
synthetic case that isn't grounded in reality. Instead, the realistic
counterpart (clear and redraw at high occupancy through the full VT
stream) is 31% faster, and lookups are neutral.
## Benchmarks
| workload | baseline | tombstones | this PR |
|---|---:|---:|---:|
| clear and redraw, 3,000 frames | 1.243 s | 671.9 ms | 511.6 ms |
| scrolling OSC 8 stream, 39 MiB | 5.375 s | 3.484 s | 3.214 s |
| known-absent cell movement | 1.550 s | 148.2 ms | 149.2 ms |
| map churn, 50% load | n/a | 566.8 ms | 464.6 ms |
| map churn, max load | n/a | 1.088 s | 1.259 s |
| map lookup | n/a | 636.2 ms | 643.0 ms |
## LLM Notes
Assisted by GPT 5.6 and Fable. Hand-reviewed, transition to backshift
was my nudge, benchmark numbers are from an LLM benchmark run using
committed benchmarks.
Page maps handled removal with tombstones, which a fixed-capacity map
can never outgrow. Keeping probe lengths bounded required an insertion
headroom counter, an allocation-free rehash, and five separate recovery
paths with subtle invariants: removal created a tombstone without
restoring headroom, so the counter could reach zero while the map was
half empty and every insertion path had to be prepared to rebuild.
Replace tombstones with backward-shift deletion (Knuth vol. 3, 6.4
algorithm R). Removal restores the table to the state it would be in
had the key never been inserted, so probe chains stay canonical at all
times and fragmentation cannot accumulate by construction. This deletes
the headroom counter, the in-place rehash, and every recovery path.
Insertion no longer invalidates pointers; removal may now move other
entries instead, and no caller holds entry pointers across removals.
Removal costs a cluster scan instead of a byte write, paying
incrementally what tombstones deferred to later probes and periodic
rebuilds. Free slots remain all-zero bytes so probe loops keep fusing
the state and fingerprint checks into single-byte compares. A
randomized oracle test against the stdlib map and a canonical-placement
invariant check cover the new removal path, including full tables where
no free slot terminates the shift.
ReleaseFast benchmarks against the prior map commits:
| workload | delta |
|---|---:|
| map churn, 50% load | 1.23x faster |
| map churn, 75% load | 1.15x faster |
| map churn, max load | 1.07x slower |
| map lookup | neutral |
| clear and redraw stream | 1.32x faster |
| full OSC 8 stream | 1.06x faster |
| linked-line movement | neutral |
Hyperlink and grapheme maps are keyed by cell offset. Moving their
data removes the source entry and reinserts it at a destination known
to be absent. Generic clobbering insertion still searches the probe
sequence to rule out a duplicate.
Use no-clobber insertion for these moves so the first available
tombstone can be reused. If a destination reaches a free slot after
tombstones exhaust insertion headroom, rebuild the map in place and
retry before decrementing the budget. This keeps the known-absent fast
path safe at every load state.
The ReleaseFast movement benchmark improves from 133.7 ms to 126.4 ms,
a 5.5% reduction. The linked-line control remains neutral at 395.4 ms
before and 395.7 ms after.
#13292
Page maps previously allowed a 100% load factor. Once live entries
and tombstones filled every slot, a missing-key lookup or insertion
could scan the entire map.
Reserve 20% of each offset hash map as insertion headroom and track
that budget separately from the live count. Port the allocation-free
in-place rehash from Zig HashMapUnmanaged so canonical insertion can
rebuild fragmented probes and restore tombstone-exhausted headroom
without growing the page. Assumed-capacity insertion now applies the
same guard, preventing the headroom counter from wrapping.
Pass the exact requested hyperlink count into map layout before
load-factor scaling, avoiding a redundant power-of-two rounding step.
Screen-level recovery now grows only when live hyperlinks actually fill
usable capacity.
ReleaseFast terminal benchmarks compare main with the combined map
changes:
| workload | before | after | speedup |
|---|---:|---:|---:|
| map churn | 1.253 s | 12.5 ms | 100x |
| full OSC 8 stream | 3.576 s | 75.6 ms | 47x |
| clear and redraw | 299.1 ms | 118.3 ms | 2.5x |
Co-authored-by: Tim Culverhouse <tim@timculverhouse.com>
This changes our `page_serial` semantics from monotonic min to a
generation marker (any change means you should reload). This fixes a
number of real bugs that search had.
In reality, this invariant was already broken and not true. So this PR
comes to reality with that and fixes all our usage. The most visible
failures were panics when selecting cached search results after
partially erasing a history page or splitting a page, but the same bug
class affected viewport search fingerprints and asynchronous render
highlights.
It was mostly search, for now, but this type of fix is important for
some upcoming work I'm playing around with regarding deferred reflow and
disk offload.
## Page Serial Semantics
`Node.serial` is now explicitly a page generation. It changes whenever a
node is allocated or reused, and whenever an in-place mutation changes
the meaning or valid range of its row coordinates.
`page_serial_min` is renamed to `page_serial_epoch` to reflect its
remaining purpose. Only a whole-list reset advances the epoch. A serial
below the epoch is definitely stale and can be rejected in O(1); a
serial at or above it is only potentially valid and is checked against
the live list using its captured pointer and generation.
## Performance
The generation bump is constant work per node whose layout is already
being changed. There is no additional page-list scan on normal row
append or scrollback pruning.
I did add a new field to the render state, so I ran render state
benchmarks we already have that shows a very slight slowdown but this is
acceptable especially given recent speedups outweigh this significantly:
| render measurement | before | after | change |
|--------------------|--------|-------|--------|
| full rebuild | 2.915 us/update | 2.926 us/update | +0.27% |
| lock-held rebuild | 2.472 us/update | 2.489 us/update | +0.53% (within
noise) |
| clean update | 19.03 ns/update | 19.30 ns/update | +1.43% (+0.27 ns) |
| one dirty row | 52.97 ns/update | 53.40 ns/update | +0.96% (within
noise) |
| flattened highlight miss | 86.77 ns/update | 86.87 ns/update | +0.19%
(within noise) |
| flattened highlight match | 88.38 ns/update | 90.26 ns/update | +2.00%
(+1.88 ns) |
## LLM Notes
This work was done in concert with Codex. I reviewed and reshaped the
serial model, implementation, tests, documentation, and performance
analysis throughout. This PR message is hand-written.
reloadActive previously pruned every cached history result whenever the
active area changed. Search reconciliation runs under the terminal lock,
so this scaled with both result and page counts on a frame-paced path.
Validate only the selected history result during reload. Keep full
pruning before selection navigation so stale candidates are removed
before their coordinates are tracked.
Screen scroll fast paths and Terminal line insertion/deletion move Row
values directly instead of using PageList erasure helpers. Their node
generations therefore stayed valid after cached row coordinates changed.
Expose the PageList layout invalidator to sibling terminal modules and
renew each affected existing page once before full-row rotations or
swaps. Keep partial-width cell moves on the content-only path and cover
same-page, cross-page, and fresh-tail behavior.
libghostty-vt was already parsing OSC 52 into the clipboard_contents
action but the stream handler dropped, so there was no way to observe
clipboard writes (in this case, a program using go-libghostty). This
adds a clipboard_set effect following the existing bell/title_changed
pattern and expose it through the C API as
`GHOSTTY_TERMINAL_OPT_CLIPBOARD_SET`.
The callback receives the OSC 52 kind byte and the base64 payload
exactly as received; decoding and kind interpretation are left to the
embedder, matching how decoding is typically deferred.
Note this intentionally does not deal with clipboard read requests given
the security implications.
AI disclosure: Fable (via Claude Code) did the majority of the work
here, I validated it on the client side and fully understand the pattern
we're fitting into.
#13182
Replace the OSC 52-specific kind and encoded payload callback with an
atomic clipboard write containing a normalized destination and decoded
MIME representations. This keeps protocol details out of embedders and
lets iTerm2 Copy use the same semantic path.
Represent clears with an empty content list, preserve binary payloads,
and return a generic result for protocols that acknowledge writes. Add
the C ABI descriptors, layout metadata, and effects example so future
multipart protocols can reuse the callback without another API break.
page_serial_min no longer represented the minimum live page serial.
Its name still suggested an ordering relationship and obscured the
remaining reset-only invalidation behavior.
Rename the field to page_serial_epoch and document its O(1) rejection
and ScreenSearch bulk-pruning utility. Explicitly verify that ordinary
bounded pruning does not begin a new whole-list epoch.
Kitty graphics payloads are dispatched in bulk, but finding each slice
boundary still examines every byte with a scalar loop. This leaves large
direct base64 image transmissions parser-bound.
Scan ordinary APC bytes using the vector width recommended for the
compile target. Keep the scalar scan both as the tail and as the full
fallback when the target has no recommended vector width. Test
state-machine boundaries against byte-at-a-time parsing.
A ReleaseFast APC parser benchmark over the same 64 MiB Kitty graphics
corpus, with 10 warmups and 30 measured runs, produced:
```
mean median
scalar 37.6 ms 32.6 ms
vectorized 22.3 ms 19.0 ms
```
Hyperfine reports the vectorized version as **1.69 times faster
overall**, with the median runtime improving by approximately 42
percent.
AI Disclosure: This patch was created with the assistance of GPT-5.6
Single-row erasure and trailing blank-row trimming can remap or remove
stored row coordinates while retaining the same node. External pointer-
plus-generation references could therefore survive these less common
PageList mutation paths.
Renew each affected node inside the traversal that already changes it,
and signal compression activity only when row erasure begins in
history. This adds constant work per touched page without another list
scan or normal append cost.
Compaction and capacity growth publish fresh page generations, so an
active incremental traversal can detect them. They did not update the
separate activity token, however, and a completed compressor could
remain idle after either operation restored or replaced a cold page.
Mark successful replacements as compression activity without resetting
the exact continuation marker. The next scheduled step can retain valid
progress or restart through the existing generation checks.
ScreenSearch reloaded active state before pruning stale flattened
history. Reload could compare a shifted tracked selection against
cached page coordinates and panic before the later validation step ran.
Prune history immediately after dimension reconciliation in
reloadActive, before any cached coordinate is inspected or converted to
a pin. Selection now relies on that ordering and avoids a redundant
second prune.
RenderState applied flattened highlights after releasing the terminal
lock and matched them to copied rows by node address alone. A recycled
address could therefore make a stale asynchronous highlight decorate
unrelated content.
Capture the live node generation with each render row and require both
the pointer and copied generation to match. Validation remains lock-
free and never dereferences a potentially stale node.
ViewportSearch compared only cached node addresses when deciding
whether to reuse its owned search window. An in-place layout change or
pool address reuse could therefore make stale text and coordinates
appear current.
Snapshot each node generation with its pointer and compare only those
captured values. This detects a renewed generation at the same address
without ever dereferencing cached node pointers.
Reverse multi-page highlight construction reordered node and row-
bound columns but left captured page generations in their original
order. Every cross-page result therefore paired each node with another
page generation and could be rejected as stale despite remaining live.
Reverse the serial column with the other flattened chunk metadata and
cover the node-plus-generation pairing in the existing boundary match
test.
PageList.split moved the source suffix into a fresh target but left
the shortened source on its old generation. Cached matches in that
suffix could therefore pass validation against the live source pointer
and reach pin tracking with invalid coordinates.
Renew the source generation only after target cloning succeeds, and
mark compression activity so restored history is reconsidered. The
conservative floor keeps bounded pruning safe even when the renewed
source and fresh target precede older successors.
Partial history erasure shifted retained rows while preserving the
node generation. Cached flattened matches then passed pointer-plus-
generation validation and could be tracked with coordinates beyond the
shortened page.
Renew the generation before reinitializing or shifting a page layout,
and mark compression activity so an incremental pass restarts and
revisits a restored cold page. The conservative serial floor permits
the fresh generation to remain before older live successors without
rejecting them.
Page generations are not ordered with the page list because splits
and in-place replacements insert fresh generations before older live
pages. Advancing page_serial_min while pruning could therefore reject
live successors and fail PageList integrity checks.
Keep the floor as a whole-list invalidation epoch and use the existing
pointer-plus-generation membership check for ordinary removals. Add
bounded pruning coverage for split and replacement ordering, and verify
reset still rejects a stale generation when its node address is reused.
Kitty graphics payloads are dispatched in bulk, but finding each slice
boundary still examines every byte with a scalar loop. This leaves large
direct base64 image transmissions parser-bound.
Scan ordinary APC bytes using the vector width recommended for the compile
target. Keep the scalar scan both as the tail and as the full fallback when
the target has no recommended vector width. Test state-machine boundaries
against byte-at-a-time parsing.
A ReleaseFast APC parser benchmark over the same 64 MiB Kitty graphics
corpus, with 10 warmups and 30 measured runs, produced:
mean median
scalar 37.6 ms 32.6 ms
vectorized 22.3 ms 19.0 ms
Hyperfine reports the vectorized version as 1.69 times faster overall, with
the median runtime improving by approximately 42 percent.
All found by GPT 5.6. I'm still going through manual review of each one
now and will remove or rewrite the ones that are pointless or
unreachable (if any, I prompted it to ignore those too).
Count-limited PageIterator traversal took the minimum of the page and requested lengths, then tested whether that minimum exceeded the request. The condition was impossible, so iteration never crossed a page. Reverse traversal also excluded the current row and subtracted one from row zero, causing a runtime safety panic.
Count the current row in both directions, consume the returned length, and move to an adjacent page only when the request has rows remaining. Returned chunks now preserve their half-open bounds at row zero and across page boundaries.
Search selection could run after the terminal removed a screen but before the next refresh reconciled the cached searchers. Reloading that stale ScreenSearch dereferenced freed PageList nodes, while normal cleanup also tried to untrack pins from the destroyed list.
Reconcile under the terminal lock before selecting, track ScreenSet generations so allocator address reuse cannot hide replacements, and release stale search buffers without touching pins already freed with the screen. Cleanup now takes the same lock when live pins must be untracked.