cc-continuity 0.3.48__tar.gz → 0.3.49__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.48 → cc_continuity-0.3.49}/PKG-INFO +1 -1
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/README.md +1 -1
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/__init__.py +1 -1
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/cli.py +43 -11
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/watchdogd.py +10 -1
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity.egg-info/PKG-INFO +1 -1
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/pyproject.toml +1 -1
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_cli.py +116 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/LICENSE +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/__main__.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/atomic.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/blink.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/blink_watch.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/bootstrap.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/checkpoint.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/config.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/daemon_supervisor.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/doctor.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/gitsnap.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/hooks/__init__.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/hooks/common.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/hooks/pre_compact.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/hooks/pre_tool_use.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/hooks/session_end.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/hooks/session_start.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/hooks/stop.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/hooks/task.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/hooks/tool_use.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/hooks/user_prompt.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/hosting.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/install.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/launch.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/ledger.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/lock.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/managed.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/naming.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/notify.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/paths.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/power_plug.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/progress_pane.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/project.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/redact.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/rotator.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/settings_merge.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/skills.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/state.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/statusline.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/thresholds.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/transcript.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/validate.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/watchdog.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity/watchdog_digest.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity.egg-info/SOURCES.txt +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity.egg-info/dependency_links.txt +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity.egg-info/entry_points.txt +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/cc_continuity.egg-info/top_level.txt +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/setup.cfg +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_atomic.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_blink.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_blink_watch.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_bootstrap.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_changelog_notes.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_checkpoint.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_cli_ledger.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_cli_log.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_config.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_daemon_supervisor.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_doctor.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_gitsnap.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_hooks_common.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_hooks_pre_compact.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_hooks_pre_tool_use.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_hooks_session_end.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_hooks_session_start.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_hooks_stop.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_hooks_task.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_hooks_tool_use.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_hooks_user_prompt.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_hosting.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_hygiene.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_install.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_integration_phase5.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_integration_phase6.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_integration_phase7.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_launch.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_ledger.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_lock.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_managed.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_naming.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_notify.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_notify_integration.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_paths.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_power_plug.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_progress_pane.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_project.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_readme_badges.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_redact.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_rotator.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_settings_merge.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_skills.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_state.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_status.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_statusline.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_thresholds.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_tmux_host.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_transcript.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_transcript_finalize.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_uninstall.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_validate.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_watchdog.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_watchdog_digest.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_watchdog_integration.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_watchdogd.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_wsl_doctor.py +0 -0
- {cc_continuity-0.3.48 → cc_continuity-0.3.49}/tests/test_wsl_install.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cc-continuity
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.49
|
|
4
4
|
Summary: Zero-touch session rotation for Claude Code (local large-context model)
|
|
5
5
|
Classifier: Development Status :: 5 - Production/Stable
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -41,11 +41,11 @@ The five most recent updates, newest first. Each line links to its
|
|
|
41
41
|
commit, so you can see what changed lately without digging through the
|
|
42
42
|
log:
|
|
43
43
|
|
|
44
|
+
- **2026-11-19**: Two small observability wins for the push layer. `notify stop|notification --dry-run` renders the exact push (enabled state, title, priority and body) without sending anything or burning the one-push-per-minute bucket, and `watchdog status` now ends with a `last heartbeat: <local time> (<N>s ago)` line so a stalled daemon is visible at a glance; a missing or corrupt stamp reads `last heartbeat: never` ([commit](https://github.com/pqant/claude-continuity/commit/eb93cc1)).
|
|
44
45
|
- **2026-11-18**: The rotation gate can no longer invert silently. `doctor` gained a `config-sanity` check that verifies `0 < warn_ratio <= rotate_ratio <= hard_ratio < 1`, a plausible `window_tokens` (>= 32768) and an http(s) `notify_endpoint`, naming the offending values in its detail; a typo like warn 0.80 / rotate 0.75 used to make rotations fire late or never. The check is warn-only, the values stay the user's call ([commit](https://github.com/pqant/claude-continuity/commit/c7381cc)).
|
|
45
46
|
- **2026-11-18**: The session chain went machine-readable: `cc-continuity history --json` prints it as one JSON array with stable keys (`nnn`, `name`, `session_id`, `created`, `state`). The state comes from each session's `state.json` with the same fallback the status rotation line uses, a project without a record prints `[]`, and the default human output is unchanged ([commit](https://github.com/pqant/claude-continuity/commit/180b761)).
|
|
46
47
|
- **2026-11-17**: A second badges row landed under the title, this one for the package side: PyPI version and monthly-download counters, MIT license, live CI status, supported Python versions (backed by new PyPI classifiers in pyproject.toml) and a good-first-issues counter that opens the labeled contributor on-ramp ([commit](https://github.com/pqant/claude-continuity/commit/fb0ad8a)).
|
|
47
48
|
- **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)).
|
|
48
|
-
- **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)).
|
|
49
49
|
|
|
50
50
|
## How it works
|
|
51
51
|
|
|
@@ -278,6 +278,8 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
278
278
|
help="generic Stop/Notification hook push "
|
|
279
279
|
"(issue #7)")
|
|
280
280
|
p_nt.add_argument("kind", choices=["stop", "notification"])
|
|
281
|
+
p_nt.add_argument("--dry-run", action="store_true",
|
|
282
|
+
help="render the push, send nothing (issue #37)")
|
|
281
283
|
|
|
282
284
|
p_ne = sub.add_parser("notify-emit",
|
|
283
285
|
help="emit one queued notify spec (internal, "
|
|
@@ -1001,15 +1003,7 @@ def cmd_signal(args: argparse.Namespace) -> int:
|
|
|
1001
1003
|
event, fields = "task_done", {"summary": args.text}
|
|
1002
1004
|
title, body, prio = notify.build_message(event, slug=slug, nnn=nnn,
|
|
1003
1005
|
**fields)
|
|
1004
|
-
|
|
1005
|
-
print("cc-continuity: dry run (nothing sent, nothing recorded)")
|
|
1006
|
-
print(f"enabled: {on}"
|
|
1007
|
-
+ ("" if on else " — would NOT send (disabled or bad config)"))
|
|
1008
|
-
print(f"title: {title}")
|
|
1009
|
-
print(f"priority: {prio}")
|
|
1010
|
-
print("body:")
|
|
1011
|
-
for ln in body.splitlines():
|
|
1012
|
-
print(f" {ln}")
|
|
1006
|
+
_print_dry_run(notify.enabled(cfg), title, body, prio)
|
|
1013
1007
|
return 0
|
|
1014
1008
|
if args.kind == "needs-human":
|
|
1015
1009
|
sent = notify.safe_send(cfg, "needs_human", slug=slug, nnn=nnn,
|
|
@@ -1028,6 +1022,19 @@ def cmd_signal(args: argparse.Namespace) -> int:
|
|
|
1028
1022
|
return 0
|
|
1029
1023
|
|
|
1030
1024
|
|
|
1025
|
+
def _print_dry_run(on: bool, title: str, body: str, prio: str) -> None:
|
|
1026
|
+
"""Shared --dry-run render (issue #30 contract): the exact push to
|
|
1027
|
+
stdout, nothing sent, nothing recorded (re-used by notify #37)."""
|
|
1028
|
+
print("cc-continuity: dry run (nothing sent, nothing recorded)")
|
|
1029
|
+
print(f"enabled: {on}"
|
|
1030
|
+
+ ("" if on else " — would NOT send (disabled or bad config)"))
|
|
1031
|
+
print(f"title: {title}")
|
|
1032
|
+
print(f"priority: {prio}")
|
|
1033
|
+
print("body:")
|
|
1034
|
+
for ln in body.splitlines():
|
|
1035
|
+
print(f" {ln}")
|
|
1036
|
+
|
|
1037
|
+
|
|
1031
1038
|
def cmd_notify(args: argparse.Namespace) -> int:
|
|
1032
1039
|
"""Issue #7 B5/B8 — generic Stop/Notification hook push.
|
|
1033
1040
|
|
|
@@ -1048,7 +1055,7 @@ def cmd_notify(args: argparse.Namespace) -> int:
|
|
|
1048
1055
|
if not isinstance(payload, dict):
|
|
1049
1056
|
payload = {}
|
|
1050
1057
|
cfg = config.load_config()
|
|
1051
|
-
if not notify.enabled(cfg):
|
|
1058
|
+
if not getattr(args, "dry_run", False) and not notify.enabled(cfg):
|
|
1052
1059
|
return 0
|
|
1053
1060
|
sid = (str(payload.get("session_id") or "").strip()
|
|
1054
1061
|
or os.environ.get("CC_CONTINUITY_SESSION", "").strip())
|
|
@@ -1067,9 +1074,18 @@ def cmd_notify(args: argparse.Namespace) -> int:
|
|
|
1067
1074
|
return 0
|
|
1068
1075
|
digest = hashlib.sha1(msg.encode("utf-8")).hexdigest()[:10]
|
|
1069
1076
|
bucket = int(time.time() // 60) # B8: one push per minute
|
|
1070
|
-
if
|
|
1077
|
+
if (not getattr(args, "dry_run", False)
|
|
1078
|
+
and notify.dedup_seen(f"notification:{sid}:{digest}:{bucket}")):
|
|
1071
1079
|
return 0
|
|
1072
1080
|
fields = {"msg": msg}
|
|
1081
|
+
if getattr(args, "dry_run", False):
|
|
1082
|
+
# issue #37: render the exact push; the minute bucket is NOT
|
|
1083
|
+
# burned and no spec/spawn happens (same contract as #30).
|
|
1084
|
+
title, body, prio = notify.build_message(
|
|
1085
|
+
event, slug=slug, nnn=nnn, source="cli", sid=sid or None,
|
|
1086
|
+
repo=cwd, **fields)
|
|
1087
|
+
_print_dry_run(notify.enabled(cfg), title, body, prio)
|
|
1088
|
+
return 0
|
|
1073
1089
|
notify.safe_send(cfg, event, slug=slug, nnn=nnn, wait=False,
|
|
1074
1090
|
source="cli", sid=sid or None, repo=cwd, **fields)
|
|
1075
1091
|
return 0
|
|
@@ -1532,10 +1548,26 @@ def cmd_watchdog(args: argparse.Namespace, home: Path | None = None,
|
|
|
1532
1548
|
if action == "status":
|
|
1533
1549
|
out = host.status("watchdog", home)
|
|
1534
1550
|
print("watchdog: not loaded" if out is None else out.rstrip())
|
|
1551
|
+
print(_watchdog_heartbeat_note()) # issue #37
|
|
1535
1552
|
return 0
|
|
1536
1553
|
return 2
|
|
1537
1554
|
|
|
1538
1555
|
|
|
1556
|
+
def _watchdog_heartbeat_note() -> str:
|
|
1557
|
+
"""Issue #37: age of the daemon's last full tick. ``watchdogd.
|
|
1558
|
+
run_forever`` stamps ``runtime/watchdog-beat.json`` after every tick;
|
|
1559
|
+
a missing or corrupt stamp reads as never."""
|
|
1560
|
+
try:
|
|
1561
|
+
data = json.loads((paths.runtime_dir() / "watchdog-beat.json")
|
|
1562
|
+
.read_text(encoding="utf-8"))
|
|
1563
|
+
ts = datetime.fromisoformat(str(data["ts"])).timestamp()
|
|
1564
|
+
return ("last heartbeat: "
|
|
1565
|
+
f"{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(ts))} "
|
|
1566
|
+
f"({int(time.time() - ts)}s ago)")
|
|
1567
|
+
except (OSError, ValueError, KeyError, TypeError):
|
|
1568
|
+
return "last heartbeat: never"
|
|
1569
|
+
|
|
1570
|
+
|
|
1539
1571
|
def _daemon_name(name: str) -> str:
|
|
1540
1572
|
# the rc self-heal line (spec §7.4) passes the SESSION name
|
|
1541
1573
|
return name[len("cc-d-"):] if name.startswith("cc-d-") else name
|
|
@@ -19,10 +19,11 @@ import signal
|
|
|
19
19
|
import subprocess
|
|
20
20
|
import time
|
|
21
21
|
import traceback
|
|
22
|
+
from datetime import datetime, timezone
|
|
22
23
|
from pathlib import Path
|
|
23
24
|
from urllib.parse import urlsplit
|
|
24
25
|
|
|
25
|
-
from . import ledger, notify, paths, power_plug, state
|
|
26
|
+
from . import atomic, ledger, notify, paths, power_plug, state
|
|
26
27
|
from .watchdog import (Episode, HealthState, build_nudge_text, classify,
|
|
27
28
|
exit_hang_due, find_claude_pid, find_exit_marker_ts,
|
|
28
29
|
frozen_nudge_due, nudge_action, parse_entry_ts,
|
|
@@ -1817,6 +1818,14 @@ def run_forever(cfg: dict, *, max_ticks: int | None = None,
|
|
|
1817
1818
|
line = {"ts": ctx.now, "error": "tick exception"}
|
|
1818
1819
|
_log_line(line)
|
|
1819
1820
|
ticks += 1
|
|
1821
|
+
# issue #37: full-tick heartbeat stamp read by `watchdog
|
|
1822
|
+
# status`; a stamp failure must never touch the loop.
|
|
1823
|
+
try:
|
|
1824
|
+
atomic.atomic_write_json(
|
|
1825
|
+
paths.runtime_dir() / "watchdog-beat.json",
|
|
1826
|
+
{"ts": datetime.now(timezone.utc).isoformat()})
|
|
1827
|
+
except OSError:
|
|
1828
|
+
pass
|
|
1820
1829
|
if max_ticks is not None and ticks >= max_ticks:
|
|
1821
1830
|
return 0
|
|
1822
1831
|
sleep(EXIT_HANG_POLL_S)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cc-continuity
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.49
|
|
4
4
|
Summary: Zero-touch session rotation for Claude Code (local large-context model)
|
|
5
5
|
Classifier: Development Status :: 5 - Production/Stable
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -1176,6 +1176,122 @@ def test_cli_notify_emit_corrupt_exits_zero(cc_home, tmp_path):
|
|
|
1176
1176
|
assert not bad.exists() # corrupt spec consumed, not left in queue
|
|
1177
1177
|
|
|
1178
1178
|
|
|
1179
|
+
# ------------------------------------------------------- notify --dry-run (issue #37)
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+
def test_cli_notify_dry_run_renders_without_sending(cc_home, tmp_path,
|
|
1183
|
+
monkeypatch, capsys):
|
|
1184
|
+
# issue #37: --dry-run renders the exact push and sends nothing
|
|
1185
|
+
from cc_continuity import notify
|
|
1186
|
+
repo = make_repo(tmp_path)
|
|
1187
|
+
_notify_cfg(cc_home)
|
|
1188
|
+
register_session(repo)
|
|
1189
|
+
monkeypatch.chdir(repo)
|
|
1190
|
+
payload = {"session_id": SID,
|
|
1191
|
+
"transcript_path": str(repo / "t.jsonl"),
|
|
1192
|
+
"cwd": str(repo)}
|
|
1193
|
+
monkeypatch.setattr(sys, "stdin", io.StringIO(json.dumps(payload)))
|
|
1194
|
+
sub = _NotifySub()
|
|
1195
|
+
monkeypatch.setattr(notify, "subprocess", sub)
|
|
1196
|
+
assert cli.main(["notify", "--dry-run", "stop"]) == 0
|
|
1197
|
+
assert sub.popen_calls == [] and sub.run_calls == [] # nothing sent
|
|
1198
|
+
out = capsys.readouterr().out
|
|
1199
|
+
assert "cc-continuity: dry run (nothing sent, nothing recorded)" in out
|
|
1200
|
+
assert "enabled: True" in out
|
|
1201
|
+
assert "title: ✅ cc-continuity: Claude is done" in out
|
|
1202
|
+
assert "priority: default" in out
|
|
1203
|
+
assert "body:" in out
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
def test_cli_notify_dry_run_reports_disabled(cc_home, tmp_path, monkeypatch,
|
|
1207
|
+
capsys):
|
|
1208
|
+
# disabled notify must be visible in the render instead of a silent no-op
|
|
1209
|
+
repo = make_repo(tmp_path)
|
|
1210
|
+
register_session(repo) # default cc_home config: notify disabled
|
|
1211
|
+
monkeypatch.chdir(repo)
|
|
1212
|
+
payload = {"session_id": SID,
|
|
1213
|
+
"transcript_path": str(repo / "t.jsonl"),
|
|
1214
|
+
"cwd": str(repo)}
|
|
1215
|
+
monkeypatch.setattr(sys, "stdin", io.StringIO(json.dumps(payload)))
|
|
1216
|
+
assert cli.main(["notify", "--dry-run", "stop"]) == 0
|
|
1217
|
+
out = capsys.readouterr().out
|
|
1218
|
+
assert "enabled: False" in out
|
|
1219
|
+
assert "would NOT send" in out
|
|
1220
|
+
assert "title: ✅ cc-continuity: Claude is done" in out
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
def test_cli_notify_dry_run_does_not_consume_dedup_bucket(cc_home, tmp_path,
|
|
1224
|
+
monkeypatch,
|
|
1225
|
+
capsys):
|
|
1226
|
+
# a dry run must not burn the one-push-per-minute bucket (#37)
|
|
1227
|
+
from cc_continuity import notify
|
|
1228
|
+
repo = make_repo(tmp_path)
|
|
1229
|
+
_notify_cfg(cc_home)
|
|
1230
|
+
register_session(repo)
|
|
1231
|
+
monkeypatch.chdir(repo)
|
|
1232
|
+
payload = {"session_id": SID, "message": "deploy? y/n", "cwd": str(repo)}
|
|
1233
|
+
sub = _NotifySub()
|
|
1234
|
+
monkeypatch.setattr(notify, "subprocess", sub)
|
|
1235
|
+
monkeypatch.setattr(sys, "stdin", io.StringIO(json.dumps(payload)))
|
|
1236
|
+
assert cli.main(["notify", "--dry-run", "notification"]) == 0
|
|
1237
|
+
monkeypatch.setattr(sys, "stdin", io.StringIO(json.dumps(payload)))
|
|
1238
|
+
assert cli.main(["notify", "--dry-run", "notification"]) == 0
|
|
1239
|
+
assert sub.popen_calls == [] # dry runs touched nothing
|
|
1240
|
+
monkeypatch.setattr(sys, "stdin", io.StringIO(json.dumps(payload)))
|
|
1241
|
+
assert cli.main(["notify", "notification"]) == 0
|
|
1242
|
+
assert len(sub.popen_calls) == 1 # real push still gets its bucket
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
def test_cli_notify_dry_run_notification_without_message_is_silent(
|
|
1246
|
+
cc_home, tmp_path, monkeypatch, capsys):
|
|
1247
|
+
# a message-less notification payload stays a silent rc 0 even in a dry run
|
|
1248
|
+
repo = make_repo(tmp_path)
|
|
1249
|
+
_notify_cfg(cc_home)
|
|
1250
|
+
register_session(repo)
|
|
1251
|
+
monkeypatch.chdir(repo)
|
|
1252
|
+
payload = {"session_id": SID, "cwd": str(repo)} # no message field
|
|
1253
|
+
monkeypatch.setattr(sys, "stdin", io.StringIO(json.dumps(payload)))
|
|
1254
|
+
assert cli.main(["notify", "--dry-run", "notification"]) == 0
|
|
1255
|
+
assert capsys.readouterr().out == ""
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
# ------------------------------------------------- watchdog status heartbeat (issue #37)
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
def test_watchdog_status_shows_last_heartbeat_age(cc_home, tmp_path,
|
|
1262
|
+
monkeypatch, capsys):
|
|
1263
|
+
# issue #37: status reports the daemon's last full-tick heartbeat
|
|
1264
|
+
from datetime import datetime, timezone
|
|
1265
|
+
runner, _ = _fake_runner()
|
|
1266
|
+
fixed = 1795000000.0
|
|
1267
|
+
monkeypatch.setattr(time, "time", lambda: fixed)
|
|
1268
|
+
beat_ts = datetime.fromtimestamp(fixed - 120, timezone.utc).isoformat()
|
|
1269
|
+
(cc_home / "runtime").mkdir(parents=True, exist_ok=True)
|
|
1270
|
+
(cc_home / "runtime" / "watchdog-beat.json").write_text(
|
|
1271
|
+
json.dumps({"ts": beat_ts}), encoding="utf-8")
|
|
1272
|
+
assert cli.cmd_watchdog(_wd_ns("status"), home=tmp_path,
|
|
1273
|
+
runner=runner) == 0
|
|
1274
|
+
out = capsys.readouterr().out
|
|
1275
|
+
expected = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(fixed - 120))
|
|
1276
|
+
assert "state = running" in out
|
|
1277
|
+
assert f"last heartbeat: {expected} (120s ago)" in out
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
def test_watchdog_status_heartbeat_never_when_missing_or_corrupt(
|
|
1281
|
+
cc_home, tmp_path, capsys):
|
|
1282
|
+
# no stamp (fresh install) or a corrupt stamp both read as "never"
|
|
1283
|
+
runner, _ = _fake_runner()
|
|
1284
|
+
assert cli.cmd_watchdog(_wd_ns("status"), home=tmp_path,
|
|
1285
|
+
runner=runner) == 0
|
|
1286
|
+
assert "last heartbeat: never" in capsys.readouterr().out
|
|
1287
|
+
(cc_home / "runtime").mkdir(parents=True, exist_ok=True)
|
|
1288
|
+
(cc_home / "runtime" / "watchdog-beat.json").write_text(
|
|
1289
|
+
"{not json", encoding="utf-8")
|
|
1290
|
+
assert cli.cmd_watchdog(_wd_ns("status"), home=tmp_path,
|
|
1291
|
+
runner=runner) == 0
|
|
1292
|
+
assert "last heartbeat: never" in capsys.readouterr().out
|
|
1293
|
+
|
|
1294
|
+
|
|
1179
1295
|
def test_notify_claimed_passes_prev_and_handoff(cc_home, tmp_path,
|
|
1180
1296
|
monkeypatch):
|
|
1181
1297
|
from cc_continuity import notify
|
|
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
|
|
File without changes
|