@jesdi/skills 0.0.83 → 0.0.84

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jesdi/skills",
3
- "version": "0.0.83",
3
+ "version": "0.0.84",
4
4
  "description": "jesdi's agent skills (content package consumed by @jesdi/skills-cli)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -11,7 +11,7 @@ import pytest
11
11
 
12
12
  from fixture_repo import HERE, load, snapshots, weigh
13
13
  from kill_repo import replaced
14
- from test_mutation_score import SLOW, commit, start, wait_for_mutmut, worktrees
14
+ from test_mutation_score import SLOW, commit, finish, start, wait_for_mutmut, worktrees
15
15
 
16
16
  sys.path.insert(0, str(HERE.parent))
17
17
 
@@ -46,7 +46,7 @@ def test_run_sigkilled_while_mutmut_runs_is_cleaned_up_by_the_next_run(tmp_path,
46
46
 
47
47
  repo = build_repo(tmp_path / "demo")
48
48
  commit(repo, {"tests/test_slow.py": SLOW})
49
- first = start(repo, home, cache)
49
+ first = start(repo, home, cache, tmp_path / "first.err")
50
50
  second = None
51
51
  try:
52
52
  wait_for_mutmut(repo, first)
@@ -54,11 +54,11 @@ def test_run_sigkilled_while_mutmut_runs_is_cleaned_up_by_the_next_run(tmp_path,
54
54
  first.wait()
55
55
  stale = [l.removeprefix("worktree ") for l in worktrees(repo)[1:]]
56
56
  assert len(stale) == 1
57
- second = start(repo, home, cache)
57
+ second = start(repo, home, cache, tmp_path / "second.err")
58
58
  fresh = wait_for_mutmut(repo, second, ignore=stale)
59
59
  assert [l.removeprefix("worktree ") for l in worktrees(repo)[1:]] == [fresh]
60
60
  assert not os.path.exists(stale[0])
61
- assert second.wait(timeout=900) == 0
61
+ assert finish(second, tmp_path / "second.err", 900) == 0
62
62
  finally:
63
63
  kill_group(first.pid)
64
64
  if second:
@@ -39,9 +39,25 @@ def worktrees(repo):
39
39
  return [l for l in git(repo, "worktree", "list", "--porcelain").splitlines() if l.startswith("worktree ")]
40
40
 
41
41
 
42
- def start(repo, home, cache):
43
- return subprocess.Popen([sys.executable, str(WEIGH), str(repo), "--mutation", "--no-open"], env=env_for(home, cache),
44
- stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, start_new_session=True)
42
+ def start(repo, home, cache, log):
43
+ """weigh.py --mutation in its own process group, stderr to the file log (where `finish` reads its stack dump)."""
44
+ with open(log, "w") as err:
45
+ return subprocess.Popen([sys.executable, str(WEIGH), str(repo), "--mutation", "--no-open"], env=env_for(home, cache),
46
+ stdout=subprocess.DEVNULL, stderr=err, start_new_session=True)
47
+
48
+
49
+ def finish(proc, log, timeout):
50
+ """proc's exit code. A run still going after timeout fails the test with weigh.py's Python stacks (faulthandler, on
51
+ SIGUSR1) and its process group, so a hang shows where it waits."""
52
+ try:
53
+ return proc.wait(timeout=timeout)
54
+ except subprocess.TimeoutExpired:
55
+ os.kill(proc.pid, signal.SIGUSR1)
56
+ time.sleep(2)
57
+ ps = subprocess.run(["ps", "-A", "-o", "pid,ppid,pgid,stat,etime,args"], capture_output=True, text=True).stdout.splitlines()
58
+ group = [l for l in ps[1:] if l.split()[2] == str(proc.pid)]
59
+ pytest.fail(f"weigh.py still running {timeout} s on\n--- its stderr ---\n{open(log).read()}\n--- its process group ---\n"
60
+ + "\n".join(ps[:1] + group))
45
61
 
46
62
 
47
63
  def wait_for_mutmut(repo, proc, ignore=()):
@@ -107,7 +123,7 @@ def test_clean_run_leaves_the_target_untouched(tmp_path, home, cache):
107
123
  def test_killed_run_is_cleaned_up_by_the_next_run(tmp_path, home, cache):
108
124
  repo = build_repo(tmp_path / "demo")
109
125
  commit(repo, {"tests/test_slow.py": SLOW})
110
- proc = start(repo, home, cache)
126
+ proc = start(repo, home, cache, tmp_path / "first.err")
111
127
  try:
112
128
  wait_for_mutmut(repo, proc)
113
129
  proc.kill()
@@ -115,13 +131,13 @@ def test_killed_run_is_cleaned_up_by_the_next_run(tmp_path, home, cache):
115
131
  reap(proc)
116
132
  stale = [l.removeprefix("worktree ") for l in worktrees(repo)[1:]]
117
133
  assert len(stale) == 1
118
- second = start(repo, home, cache)
134
+ second = start(repo, home, cache, tmp_path / "second.err")
119
135
  try:
120
136
  fresh = wait_for_mutmut(repo, second, ignore=stale)
121
137
  # the second mutation is under way: the interrupted run's worktree is already gone, registration and directory
122
138
  assert [l.removeprefix("worktree ") for l in worktrees(repo)[1:]] == [fresh]
123
139
  assert not os.path.exists(stale[0])
124
- assert second.wait(timeout=900) == 0
140
+ assert finish(second, tmp_path / "second.err", 900) == 0
125
141
  finally:
126
142
  reap(second)
127
143
  assert len(worktrees(repo)) == 1
@@ -130,11 +146,11 @@ def test_killed_run_is_cleaned_up_by_the_next_run(tmp_path, home, cache):
130
146
  def test_ctrl_c_removes_the_worktree(tmp_path, home, cache):
131
147
  repo = build_repo(tmp_path / "demo")
132
148
  commit(repo, {"tests/test_slow.py": SLOW})
133
- proc = start(repo, home, cache)
149
+ proc = start(repo, home, cache, tmp_path / "weigh.err")
134
150
  try:
135
151
  wait_for_mutmut(repo, proc)
136
152
  os.killpg(proc.pid, signal.SIGINT)
137
- assert proc.wait(timeout=120) != 0
153
+ assert finish(proc, tmp_path / "weigh.err", 120) != 0
138
154
  finally:
139
155
  reap(proc)
140
156
  assert len(worktrees(repo)) == 1
@@ -1,5 +1,6 @@
1
1
  """Weigh a repo's test suite: `weigh.py <repo-path> [--pytest-args "..."]`."""
2
2
  import argparse
3
+ import faulthandler
3
4
  import signal
4
5
  import sys
5
6
  import webbrowser
@@ -127,6 +128,7 @@ def _terminate(signum, frame):
127
128
 
128
129
  if __name__ == "__main__":
129
130
  signal.signal(signal.SIGTERM, _terminate)
131
+ faulthandler.register(signal.SIGUSR1, all_threads=True) # `kill -USR1 <pid>` prints every thread's stack to stderr
130
132
  try:
131
133
  sys.exit(main())
132
134
  except KeyboardInterrupt: # the temporary worktree is removed on the way out
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-11-03T11:57:29.230Z",
3
+ "generatedAt": "2026-11-03T12:00:34.732Z",
4
4
  "skills": [
5
5
  {
6
6
  "name": "agents-wayfinder",
@@ -106,8 +106,8 @@
106
106
  },
107
107
  {
108
108
  "name": "test-weigh-in",
109
- "version": "0.1.1",
110
- "hash": "sha256-ac7274252521da3b7c27896d73e3010fffd8a7da40fc88b401ea8f7462de23bf",
109
+ "version": "0.1.2",
110
+ "hash": "sha256-3f0a00b5a362a869c0c9e12bfa6a9e11674338f24b5b2248ec9479b0e0581ed1",
111
111
  "description": "Measure a Python/pytest suite and score it on five pillars (Protection against regressions, Resistance to refactoring, Fast feedback, Maintainability, Economy), writing a JSON snapshot and a static HTML dashboard. Read-only. Use when the user asks to weigh, measure or score their test suite."
112
112
  },
113
113
  {