cc-continuity 0.3.43__tar.gz → 0.3.45__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/PKG-INFO +1 -1
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/README.md +10 -2
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/__init__.py +1 -1
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/transcript.py +10 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity.egg-info/PKG-INFO +1 -1
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity.egg-info/SOURCES.txt +1 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/pyproject.toml +1 -1
- cc_continuity-0.3.45/tests/test_readme_badges.py +62 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_transcript.py +66 -6
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/LICENSE +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/__main__.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/atomic.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/blink.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/blink_watch.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/bootstrap.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/checkpoint.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/cli.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/config.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/daemon_supervisor.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/doctor.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/gitsnap.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/hooks/__init__.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/hooks/common.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/hooks/pre_compact.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/hooks/pre_tool_use.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/hooks/session_end.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/hooks/session_start.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/hooks/stop.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/hooks/task.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/hooks/tool_use.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/hooks/user_prompt.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/hosting.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/install.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/launch.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/ledger.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/lock.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/managed.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/naming.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/notify.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/paths.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/power_plug.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/progress_pane.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/project.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/redact.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/rotator.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/settings_merge.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/skills.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/state.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/statusline.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/thresholds.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/validate.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/watchdog.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/watchdog_digest.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity/watchdogd.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity.egg-info/dependency_links.txt +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity.egg-info/entry_points.txt +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/cc_continuity.egg-info/top_level.txt +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/setup.cfg +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_atomic.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_blink.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_blink_watch.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_bootstrap.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_changelog_notes.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_checkpoint.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_cli.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_cli_ledger.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_cli_log.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_config.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_daemon_supervisor.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_doctor.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_gitsnap.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_hooks_common.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_hooks_pre_compact.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_hooks_pre_tool_use.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_hooks_session_end.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_hooks_session_start.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_hooks_stop.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_hooks_task.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_hooks_tool_use.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_hooks_user_prompt.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_hosting.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_hygiene.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_install.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_integration_phase5.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_integration_phase6.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_integration_phase7.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_launch.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_ledger.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_lock.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_managed.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_naming.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_notify.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_notify_integration.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_paths.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_power_plug.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_progress_pane.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_project.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_redact.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_rotator.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_settings_merge.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_skills.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_state.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_status.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_statusline.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_thresholds.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_tmux_host.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_transcript_finalize.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_uninstall.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_validate.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_watchdog.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_watchdog_digest.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_watchdog_integration.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_watchdogd.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_wsl_doctor.py +0 -0
- {cc_continuity-0.3.43 → cc_continuity-0.3.45}/tests/test_wsl_install.py +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# cc-continuity
|
|
2
2
|
|
|
3
|
+
[](https://github.com/pqant/claude-continuity/forks)
|
|
4
|
+
[](https://github.com/pqant/claude-continuity/stargazers)
|
|
5
|
+
[](https://github.com/pqant/claude-continuity/issues)
|
|
6
|
+
[](https://github.com/pqant/claude-continuity/commits/main)
|
|
7
|
+
[](CODE_OF_CONDUCT.md)
|
|
8
|
+
[](CONTRIBUTING.md)
|
|
9
|
+
[](SECURITY.md)
|
|
10
|
+
|
|
3
11
|
Zero-touch session rotation and supervision for Claude Code.
|
|
4
12
|
|
|
5
13
|
**Why it exists.** Long sessions die when the context window fills up, and local LLMs make it worse: their window is fixed and small, and the built-in compaction (`/compact`, auto-compact) is a lossy one-shot summary. With a small model it silently drops decisions, rejected approaches and the exact stopping point, and every compaction then summarizes a summary, so the drift compounds. cc-continuity exists to give long work room to breathe inside the window: at a safe threshold it rotates the session with a structured, validated handoff instead of a lossy summary.
|
|
@@ -26,11 +34,11 @@ The five most recent updates, newest first. Each line links to its
|
|
|
26
34
|
commit, so you can see what changed lately without digging through the
|
|
27
35
|
log:
|
|
28
36
|
|
|
37
|
+
- **2026-11-17**: The README now opens at a glance. A badges row sits under the title: live shields.io counters for forks, stars, open issues and the last commit (each links to the matching GitHub page), plus Code of conduct, Contributions and Security badges that lead straight into the community files ([commit](https://github.com/pqant/claude-continuity/commit/f642a4b)).
|
|
38
|
+
- **2026-11-17**: Pasted images stopped cloning themselves in transcript exports. Claude Code writes one paste as two records: the base64 record plus an isMeta sibling carrying the same `[Image: source: ...]` lines. While the image cache was still on disk the sibling embedded the very same images, so the export opened a second User block repeating the whole gallery right next to the first. A sibling whose timestamp and image count both match the block before it is the same paste and is now folded away; a genuine second paste carries its own timestamp and still gets its own gallery ([commit](https://github.com/pqant/claude-continuity/commit/55b1c1c)).
|
|
29
39
|
- **2026-11-17**: Debugging the logs got a front door: `cc-continuity log blink` and `cc-continuity log errors` tail the root log files read-only (newest last, default 20 lines, `--lines N`, `--follow` keeps streaming), with UTC stamps rendered in your local time; blink's already-local stamps and traceback continuation lines stay byte-identical so nothing shifts twice ([commit](https://github.com/pqant/claude-continuity/commit/1ce3269)).
|
|
30
|
-
- **2026-11-15**: Tags now open their own release. A tag push used to publish to PyPI but the GitHub Release was still opened by hand; the release workflow now extracts the matching section from the changelog with a stdlib-only `tools/changelog_notes.py` helper (a missing or empty section stops the run before any upload, so notes can never ship blank) and creates the release itself, refreshing the notes on re-runs. A public release is now one push ([commit](https://github.com/pqant/claude-continuity/commit/0e31994)).
|
|
31
40
|
- **2026-11-17**: Zombie panes are measured now too. After the 0.3.40 revival, Claude Code still rendered the status line with the abandoned startup session id, so the ratio metric kept landing on the dead id: the pane showed a ratio while the tracked session never moved (measurement without reaction). The hook entry now stamps a pane-scoped binding with the session id it actually runs as, and the status line writes its metric under it whenever that binding is fresh and names a different live session. Non-tmux runs and normal panes behave byte-for-byte exactly as before ([commit](https://github.com/pqant/claude-continuity/commit/361b7b1)).
|
|
32
41
|
- **2026-11-16**: Zombie sessions are gone. Claude Code remembers the last conversation it opened per project (lastSessionId); a plain `claude` could reopen a conversation that died in a rotation and then run forever unmonitored (no ratio movement, no rotation, and the handoff chain silently broken). Now a resumed conversation whose session id is no longer alive is anchored onto the open chain tip under the same index, handed the bootstrap protocol, and taken over by the normal monitoring; live resumes behave exactly as before ([commit](https://github.com/pqant/claude-continuity/commit/dbaea33)).
|
|
33
|
-
- **2026-11-16**: The transcript fold arrows are anchored: both triangles now share one slot at the true screen center of the header (the previous version centered against the controls row, which spans only the left half of the header grid, so the arrow sat off-center over the theme button), they carry a red tint (a deeper red in light theme, a lighter red in dark theme), and folding keeps the reopen arrow in the very same spot so the button never jumps ([commit](https://github.com/pqant/claude-continuity/commit/1ca6ad5), [commit](https://github.com/pqant/claude-continuity/commit/e33874d)).
|
|
34
42
|
|
|
35
43
|
## How it works
|
|
36
44
|
|
|
@@ -279,6 +279,16 @@ def parse_conversation(lines: list[str]) -> list[Block]:
|
|
|
279
279
|
# next to the live gallery is worse than folding it in
|
|
280
280
|
# (issue #59).
|
|
281
281
|
continue
|
|
282
|
+
rec_ts = rec.get("timestamp")
|
|
283
|
+
if (imgs and out and out[-1].images
|
|
284
|
+
and isinstance(rec_ts, str)
|
|
285
|
+
and out[-1].ts == rec_ts
|
|
286
|
+
and len(out[-1].images) == len(imgs)):
|
|
287
|
+
# While the image cache is on disk, CC's isMeta sibling of
|
|
288
|
+
# a paste embeds the very same images the base64 record
|
|
289
|
+
# already showed. Same timestamp plus equal image count
|
|
290
|
+
# marks the same paste, not a second one (issue #72).
|
|
291
|
+
continue
|
|
282
292
|
text = _IMAGE_CHIP
|
|
283
293
|
if out and out[-1].text == _IMAGE_CHIP:
|
|
284
294
|
# Fold the run: merge the galleries into one chip.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cc-continuity"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.45"
|
|
8
8
|
description = "Zero-touch session rotation for Claude Code (local large-context model)"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
dependencies = [] # stdlib only at runtime (PRD §0.5)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Issue #73: README badges row.
|
|
2
|
+
|
|
3
|
+
The seven shields.io badges under the title are the README's at-a-glance
|
|
4
|
+
vitals. Pin the exact badge lines (image URL + link target) and their
|
|
5
|
+
position so a later edit cannot silently drop one or retarget a link.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
11
|
+
TEXT = (ROOT / "README.md").read_text(encoding="utf-8")
|
|
12
|
+
|
|
13
|
+
BADGES = [
|
|
14
|
+
"[]"
|
|
16
|
+
"(https://github.com/pqant/claude-continuity/forks)",
|
|
17
|
+
"[]"
|
|
19
|
+
"(https://github.com/pqant/claude-continuity/stargazers)",
|
|
20
|
+
"[]"
|
|
22
|
+
"(https://github.com/pqant/claude-continuity/issues)",
|
|
23
|
+
"[]"
|
|
26
|
+
"(https://github.com/pqant/claude-continuity/commits/main)",
|
|
27
|
+
"[]"
|
|
29
|
+
"(CODE_OF_CONDUCT.md)",
|
|
30
|
+
"[](CONTRIBUTING.md)",
|
|
32
|
+
"[](SECURITY.md)",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_badges_row_is_the_first_block():
|
|
38
|
+
lines = TEXT.splitlines()
|
|
39
|
+
assert lines[0] == "# cc-continuity"
|
|
40
|
+
assert lines[1] == ""
|
|
41
|
+
row = [ln for ln in lines[2:2 + 7]]
|
|
42
|
+
assert all(ln.startswith("[![") for ln in row), row
|
|
43
|
+
# the tagline still follows the row (not displaced)
|
|
44
|
+
assert lines[2 + 7] == ""
|
|
45
|
+
assert lines[2 + 8].startswith("Zero-touch session rotation")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_badge_lines_are_exact():
|
|
49
|
+
lines = TEXT.splitlines()
|
|
50
|
+
assert lines[2:2 + 7] == BADGES
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_live_counters_hit_the_repo():
|
|
54
|
+
for line in BADGES[:4]:
|
|
55
|
+
assert "https://img.shields.io/github/" in line
|
|
56
|
+
assert "pqant/claude-continuity" in line
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_static_badges_link_into_community_files():
|
|
60
|
+
assert "(CODE_OF_CONDUCT.md)" in TEXT
|
|
61
|
+
assert "(CONTRIBUTING.md)" in TEXT
|
|
62
|
+
assert "(SECURITY.md)" in TEXT
|
|
@@ -105,11 +105,14 @@ def test_mixed_text_and_image_appends_chip():
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
def test_folded_chips_merge_galleries():
|
|
108
|
+
# Two GENUINE back-to-back pastes (distinct timestamps, issue #72
|
|
109
|
+
# realism) merge their galleries; an identical-timestamp pair would be
|
|
110
|
+
# one paste's echo and folds instead.
|
|
108
111
|
blocks = transcript.parse_conversation([
|
|
109
112
|
_rec("user", [{"type": "text", "text": "[Image: source: /a]"},
|
|
110
|
-
_img(data="QQ==")]),
|
|
113
|
+
_img(data="QQ==")], ts="2026-11-17T10:00:01.100Z"),
|
|
111
114
|
_rec("user", [{"type": "text", "text": "[Image: original 10x10]"},
|
|
112
|
-
_img(data="Qg==")])])
|
|
115
|
+
_img(data="Qg==")], ts="2026-11-17T10:00:09.200Z")])
|
|
113
116
|
assert [t for _, t, _, _ in blocks] == ["🖼 image"]
|
|
114
117
|
assert list(blocks[0][3]) == ["data:image/png;base64,QQ==",
|
|
115
118
|
"data:image/png;base64,Qg=="]
|
|
@@ -306,16 +309,73 @@ def test_empty_image_record_folds_into_preceding_gallery(tmp_path):
|
|
|
306
309
|
assert list(blocks[0][3]) == ["data:image/png;base64,QUJD"]
|
|
307
310
|
|
|
308
311
|
|
|
309
|
-
def
|
|
312
|
+
def test_recoverable_sibling_of_same_paste_folds(tmp_path):
|
|
313
|
+
# Issue #72: the sibling is CC's echo of the SAME paste - connector-255
|
|
314
|
+
# proved both records carry the identical timestamp string. While the
|
|
315
|
+
# image cache is still on disk the sibling embeds the same images and
|
|
316
|
+
# every thumbnail rendered twice in a second User block; the echo must
|
|
317
|
+
# fold just like the pruned sibling does.
|
|
310
318
|
png = _png(tmp_path)
|
|
311
319
|
blocks = transcript.parse_conversation([
|
|
312
|
-
_rec("user", [{"type": "text", "text": "metin oncesi"}, _img(data="QQ==")]
|
|
313
|
-
|
|
314
|
-
|
|
320
|
+
_rec("user", [{"type": "text", "text": "metin oncesi"}, _img(data="QQ==")],
|
|
321
|
+
ts="2026-11-17T10:49:03.973Z"),
|
|
322
|
+
_rec("user", f"[Image: source: {png}]",
|
|
323
|
+
ts="2026-11-17T10:49:03.973Z")])
|
|
324
|
+
assert [(r, t) for r, t, _, _ in blocks] == [("user", "metin oncesi")]
|
|
315
325
|
assert list(blocks[0][3]) == ["data:image/png;base64,QQ=="]
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def test_sibling_with_different_timestamp_keeps_its_own_chip(tmp_path):
|
|
329
|
+
# A genuine second paste carries a later timestamp: even with the same
|
|
330
|
+
# image count it is NOT an echo and keeps its own chip.
|
|
331
|
+
png = _png(tmp_path)
|
|
332
|
+
blocks = transcript.parse_conversation([
|
|
333
|
+
_rec("user", [{"type": "text", "text": "first paste"}, _img(data="QQ==")],
|
|
334
|
+
ts="2026-11-17T10:49:03.973Z"),
|
|
335
|
+
_rec("user", f"[Image: source: {png}]",
|
|
336
|
+
ts="2026-11-17T10:49:41.120Z")])
|
|
337
|
+
assert [t for _, t, _, _ in blocks] == ["first paste", "🖼 image"]
|
|
338
|
+
assert list(blocks[1][3]) == [f"data:image/png;base64,{PNG1x1}"]
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def test_same_timestamp_different_count_keeps_its_own_chip(tmp_path):
|
|
342
|
+
# Count guard: an adjacent recoverable chip with a DIFFERENT image
|
|
343
|
+
# count is not the echo of the gallery next to it, even at the same
|
|
344
|
+
# timestamp; it survives as its own chip.
|
|
345
|
+
png = _png(tmp_path)
|
|
346
|
+
blocks = transcript.parse_conversation([
|
|
347
|
+
_rec("user", [{"type": "text", "text": "two images here"},
|
|
348
|
+
_img(data="QQ=="), _img(data="Qg==")],
|
|
349
|
+
ts="2026-11-17T10:49:03.973Z"),
|
|
350
|
+
_rec("user", f"[Image: source: {png}]",
|
|
351
|
+
ts="2026-11-17T10:49:03.973Z")])
|
|
352
|
+
assert [t for _, t, _, _ in blocks] == ["two images here", "🖼 image"]
|
|
316
353
|
assert list(blocks[1][3]) == [f"data:image/png;base64,{PNG1x1}"]
|
|
317
354
|
|
|
318
355
|
|
|
356
|
+
def test_mixed_text_base64_record_folds_sibling_echo(tmp_path):
|
|
357
|
+
# connector-255 reproduction: text + 3 base64 images, then the isMeta
|
|
358
|
+
# sibling (identical timestamp) repeating the same three images as
|
|
359
|
+
# [Image: source:] lines while the cache exists. One User block,
|
|
360
|
+
# original gallery intact, no duplicate thumbnails.
|
|
361
|
+
a = _png(tmp_path, "a.png")
|
|
362
|
+
b = _png(tmp_path, "b.png")
|
|
363
|
+
c = _png(tmp_path, "c.png")
|
|
364
|
+
ts = "2026-11-17T10:49:03.973Z"
|
|
365
|
+
blocks = transcript.parse_conversation([
|
|
366
|
+
_rec("user", [{"type": "text", "text": "[Image #6] fix the readme now"},
|
|
367
|
+
_img(data="QQ=="), _img(data="Qg=="), _img(data="Qw==")],
|
|
368
|
+
ts=ts),
|
|
369
|
+
_rec("user", f"[Image: source: {a}]\n[Image: source: {b}]\n"
|
|
370
|
+
f"[Image: source: {c}]", ts=ts)])
|
|
371
|
+
assert [(r, t) for r, t, _, _ in blocks] == [
|
|
372
|
+
("user", "[Image #6] fix the readme now")]
|
|
373
|
+
assert list(blocks[0][3]) == [
|
|
374
|
+
"data:image/png;base64,QQ==",
|
|
375
|
+
"data:image/png;base64,Qg==",
|
|
376
|
+
"data:image/png;base64,Qw=="]
|
|
377
|
+
|
|
378
|
+
|
|
319
379
|
def test_dead_chip_survives_when_no_gallery_to_fold_into():
|
|
320
380
|
# Without an adjacent gallery the plain chip is the only trace of the
|
|
321
381
|
# unrecoverable paste; it must not disappear.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|