paces 0.0.24__tar.gz → 0.0.26__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.
Files changed (60) hide show
  1. {paces-0.0.24 → paces-0.0.26}/PKG-INFO +1 -1
  2. {paces-0.0.24 → paces-0.0.26}/paces/ask.py +54 -53
  3. paces-0.0.26/paces/ask_contract.py +149 -0
  4. {paces-0.0.24 → paces-0.0.26}/paces/data/ask/ask.js +12 -1
  5. {paces-0.0.24 → paces-0.0.26}/pyproject.toml +1 -1
  6. {paces-0.0.24 → paces-0.0.26}/tests/test_ask.py +48 -0
  7. {paces-0.0.24 → paces-0.0.26}/.gitignore +0 -0
  8. {paces-0.0.24 → paces-0.0.26}/LICENSE +0 -0
  9. {paces-0.0.24 → paces-0.0.26}/README.md +0 -0
  10. {paces-0.0.24 → paces-0.0.26}/docs/README.md +0 -0
  11. {paces-0.0.24 → paces-0.0.26}/docs/alignment/README.md +0 -0
  12. {paces-0.0.24 → paces-0.0.26}/docs/poc-reference/README.md +0 -0
  13. {paces-0.0.24 → paces-0.0.26}/docs/poc-reference/artifacts/clips.json +0 -0
  14. {paces-0.0.24 → paces-0.0.26}/paces/__init__.py +0 -0
  15. {paces-0.0.24 → paces-0.0.26}/paces/__main__.py +0 -0
  16. {paces-0.0.24 → paces-0.0.26}/paces/bodies/__init__.py +0 -0
  17. {paces-0.0.24 → paces-0.0.26}/paces/bodies/_base.py +0 -0
  18. {paces-0.0.24 → paces-0.0.26}/paces/bodies/derivation.py +0 -0
  19. {paces-0.0.24 → paces-0.0.26}/paces/bodies/document.py +0 -0
  20. {paces-0.0.24 → paces-0.0.26}/paces/bodies/signal.py +0 -0
  21. {paces-0.0.24 → paces-0.0.26}/paces/bodies/step.py +0 -0
  22. {paces-0.0.24 → paces-0.0.26}/paces/corrections.py +0 -0
  23. {paces-0.0.24 → paces-0.0.26}/paces/cues.py +0 -0
  24. {paces-0.0.24 → paces-0.0.26}/paces/data/ask/ask.css +0 -0
  25. {paces-0.0.24 → paces-0.0.26}/paces/data/ask/ask.html +0 -0
  26. {paces-0.0.24 → paces-0.0.26}/paces/derivation.py +0 -0
  27. {paces-0.0.24 → paces-0.0.26}/paces/edits.py +0 -0
  28. {paces-0.0.24 → paces-0.0.26}/paces/evidence.py +0 -0
  29. {paces-0.0.24 → paces-0.0.26}/paces/excerpts.py +0 -0
  30. {paces-0.0.24 → paces-0.0.26}/paces/measure.py +0 -0
  31. {paces-0.0.24 → paces-0.0.26}/paces/model.py +0 -0
  32. {paces-0.0.24 → paces-0.0.26}/paces/pose.py +0 -0
  33. {paces-0.0.24 → paces-0.0.26}/paces/projection.py +0 -0
  34. {paces-0.0.24 → paces-0.0.26}/paces/render.py +0 -0
  35. {paces-0.0.24 → paces-0.0.26}/paces/segmentation.py +0 -0
  36. {paces-0.0.24 → paces-0.0.26}/paces/segmenters.py +0 -0
  37. {paces-0.0.24 → paces-0.0.26}/paces/timed_text.py +0 -0
  38. {paces-0.0.24 → paces-0.0.26}/paces/tools.py +0 -0
  39. {paces-0.0.24 → paces-0.0.26}/tests/audio_synth.py +0 -0
  40. {paces-0.0.24 → paces-0.0.26}/tests/data/body_schemas.json +0 -0
  41. {paces-0.0.24 → paces-0.0.26}/tests/data/routine.json +0 -0
  42. {paces-0.0.24 → paces-0.0.26}/tests/poc_fixture.py +0 -0
  43. {paces-0.0.24 → paces-0.0.26}/tests/test_chapters.py +0 -0
  44. {paces-0.0.24 → paces-0.0.26}/tests/test_cli_surface.py +0 -0
  45. {paces-0.0.24 → paces-0.0.26}/tests/test_corrections.py +0 -0
  46. {paces-0.0.24 → paces-0.0.26}/tests/test_cues.py +0 -0
  47. {paces-0.0.24 → paces-0.0.26}/tests/test_derivation.py +0 -0
  48. {paces-0.0.24 → paces-0.0.26}/tests/test_edit_protection_residuals.py +0 -0
  49. {paces-0.0.24 → paces-0.0.26}/tests/test_edits.py +0 -0
  50. {paces-0.0.24 → paces-0.0.26}/tests/test_evidence.py +0 -0
  51. {paces-0.0.24 → paces-0.0.26}/tests/test_evidence_schemas.py +0 -0
  52. {paces-0.0.24 → paces-0.0.26}/tests/test_excerpts.py +0 -0
  53. {paces-0.0.24 → paces-0.0.26}/tests/test_measure.py +0 -0
  54. {paces-0.0.24 → paces-0.0.26}/tests/test_pose.py +0 -0
  55. {paces-0.0.24 → paces-0.0.26}/tests/test_render_media.py +0 -0
  56. {paces-0.0.24 → paces-0.0.26}/tests/test_roundtrip_poc.py +0 -0
  57. {paces-0.0.24 → paces-0.0.26}/tests/test_segment.py +0 -0
  58. {paces-0.0.24 → paces-0.0.26}/tests/test_smoke.py +0 -0
  59. {paces-0.0.24 → paces-0.0.26}/tests/test_vertical_slice.py +0 -0
  60. {paces-0.0.24 → paces-0.0.26}/tests/video_synth.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: paces
3
- Version: 0.0.24
3
+ Version: 0.0.26
4
4
  Summary: Turn instructional media into structured, interactive learning material
5
5
  Project-URL: Homepage, https://github.com/thorwhalen/paces
6
6
  Project-URL: Repository, https://github.com/thorwhalen/paces
@@ -48,15 +48,19 @@ from paces.corrections import (
48
48
  normalize_corrections,
49
49
  time_str,
50
50
  )
51
+ from paces.ask_contract import (
52
+ ANSWERS_KIND,
53
+ CONTRACT_VERSION,
54
+ PROPOSAL_KIND,
55
+ AnswersDocument,
56
+ Proposal,
57
+ ProposedStep,
58
+ Snap,
59
+ contract_schemas,
60
+ )
51
61
  from paces.model import seconds_per_unit
52
62
  from paces.segmentation import Segmentation
53
63
 
54
- PROPOSAL_KIND = "PacesAskProposal"
55
- ANSWERS_KIND = "PacesAskAnswers"
56
- #: The proposal/answers contract version. Both documents carry it; a reader
57
- #: refuses any other, so a page and a loader of different ages fail loudly.
58
- CONTRACT_VERSION = 1
59
-
60
64
  #: How far a tap may land from a snap target and still snap to it (§7.3 step
61
65
  #: 3). It is the merge tolerance on purpose: both absorb the same thing, the
62
66
  #: imprecision of a human tapping along, so one number serves both.
@@ -66,7 +70,6 @@ DFLT_SNAP_S = DFLT_MERGE_TOLERANCE_S
66
70
  DFLT_MAX_GRID_TICKS = 2000
67
71
 
68
72
  _ASSETS = files("paces") / "data" / "ask"
69
- _ANSWERS_KEYS = {"kind", "version", "k", "corrections", "boundaries", "proposal"}
70
73
 
71
74
 
72
75
  def _grid_ticks(seg: Segmentation, lo: float, hi: float, *, limit: int) -> list[str]:
@@ -82,6 +85,21 @@ def _grid_ticks(seg: Segmentation, lo: float, hi: float, *, limit: int) -> list[
82
85
  return [time_str(origin + n * spu) for n in range(first, last + 1)]
83
86
 
84
87
 
88
+ def _meets(seg: Segmentation, cut: str) -> bool:
89
+ """Whether one step ends at ``cut`` and another begins there (no gap).
90
+
91
+ Unnamed segmentations (no steps) are spans between cuts, so every cut meets.
92
+
93
+ >>> from paces.segmenters import segment
94
+ >>> propose(segment(boundaries=[0, 10, 20]))["cutMeets"]
95
+ [True]
96
+ """
97
+ if not seg.steps:
98
+ return True
99
+ spans = [(time_str(a), time_str(b)) for step in seg.steps for a, b in step.spans]
100
+ return any(b == cut for _, b in spans) and any(a == cut for a, _ in spans)
101
+
102
+
85
103
  def propose(
86
104
  seg: Segmentation,
87
105
  *,
@@ -117,32 +135,30 @@ def propose(
117
135
  k, why = None, "nothing to count yet: the segmenter found no cuts"
118
136
  extent = (cuts[0], cuts[-1]) if len(cuts) >= 2 else None
119
137
  ticks = _grid_ticks(seg, *extent, limit=max_grid_ticks) if extent else []
120
- return {
121
- "kind": PROPOSAL_KIND,
122
- "version": CONTRACT_VERSION,
123
- "answersKind": ANSWERS_KIND,
124
- "title": title,
125
- "media": media,
126
- "method": seg.method,
127
- "flags": list(seg.flags),
128
- "k": k,
129
- "kEvidence": why,
130
- "extent": [time_str(t) for t in extent] if extent else None,
131
- "cuts": [time_str(t) for t in interior],
132
- "steps": [
133
- {
134
- "id": step.id,
135
- "name": step.name,
136
- "spans": [[time_str(a), time_str(b)] for a, b in step.spans],
137
- }
138
+ return Proposal(
139
+ title=title,
140
+ media=media,
141
+ method=seg.method,
142
+ flags=list(seg.flags),
143
+ k=k,
144
+ k_evidence=why,
145
+ extent=tuple(time_str(t) for t in extent) if extent else None,
146
+ cuts=[time_str(t) for t in interior],
147
+ cut_meets=[_meets(seg, time_str(t)) for t in interior],
148
+ steps=[
149
+ ProposedStep(
150
+ id=step.id,
151
+ name=step.name,
152
+ spans=[(time_str(a), time_str(b)) for a, b in step.spans],
153
+ )
138
154
  for step in seg.steps
139
155
  ],
140
- "minStepS": time_str(min_step_s),
141
- "snap": {
142
- "windowS": time_str(snap_s),
143
- "targets": sorted({*map(time_str, interior), *ticks}, key=float),
144
- },
145
- }
156
+ min_step_s=time_str(min_step_s),
157
+ snap=Snap(
158
+ window_s=time_str(snap_s),
159
+ targets=sorted({*map(time_str, interior), *ticks}, key=float),
160
+ ),
161
+ ).model_dump(by_alias=True, mode="json")
146
162
 
147
163
 
148
164
  def render_ask_page(proposal: Mapping, *, author: str = "") -> str:
@@ -224,29 +240,14 @@ def load_answers(answers: Mapping) -> Answers:
224
240
  ... "corrections": [{"verb": "split", "anchorT": "15"}]})
225
241
  Answers(k=4, corrections=(Correction(verb='split', anchor_t=15.0, span=None, step_id=None, author='', at='', media_key=None, reason=''),), boundaries=None)
226
242
  """
227
- if not isinstance(answers, Mapping) or answers.get("kind") != ANSWERS_KIND:
228
- got = (
229
- answers.get("kind")
230
- if isinstance(answers, Mapping)
231
- else type(answers).__name__
232
- )
243
+ if not isinstance(answers, Mapping):
233
244
  raise ValueError(
234
- f"expected {ANSWERS_KIND} answers (from the ask page), got {got!r}"
245
+ f"expected {ANSWERS_KIND} answers (from the ask page), "
246
+ f"got {type(answers).__name__!r}"
235
247
  )
236
- unknown = sorted(set(answers) - _ANSWERS_KEYS)
237
- if unknown:
238
- raise ValueError(f"unknown answers keys {unknown}")
239
- version = answers.get("version")
240
- if version != CONTRACT_VERSION:
241
- raise ValueError(
242
- f"expected version {CONTRACT_VERSION} answers, got version {version!r} "
243
- "(re-export them from a page made by this paces)"
244
- )
245
- k = answers.get("k")
246
- if k is not None and (isinstance(k, bool) or not isinstance(k, int) or k < 1):
247
- raise ValueError(f"k must be a positive integer or null, got {k!r}")
248
+ doc = AnswersDocument.model_validate(dict(answers))
248
249
  return Answers(
249
- k=k,
250
- corrections=normalize_corrections(answers.get("corrections", [])),
251
- boundaries=_answered_boundaries(answers.get("boundaries")),
250
+ k=doc.k,
251
+ corrections=normalize_corrections(doc.corrections),
252
+ boundaries=_answered_boundaries(doc.boundaries),
252
253
  )
@@ -0,0 +1,149 @@
1
+ """The ask contract as types: the proposal a machine writes and the answers a human returns.
2
+
3
+ :mod:`paces.ask` produces and reads these two JSON documents (``docs/alignment/07
4
+ §7.4``), and every other UI (the real frontend, a CLI prompt, an agent) speaks
5
+ the same two. They are declared here as pydantic models, so the shape is
6
+ written once, ``load_answers`` validates against it, and the JSON Schema a
7
+ TypeScript side needs comes from :func:`contract_schemas` and not from a second
8
+ hand-written copy.
9
+
10
+ Field names are camelCase on the wire, as the page reads them. Times are
11
+ decimal strings, as everywhere on paces' wire.
12
+
13
+ >>> sorted(contract_schemas())
14
+ ['answers', 'proposal']
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ from typing import Any, Literal
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
22
+ from pydantic.alias_generators import to_camel
23
+
24
+ PROPOSAL_KIND = "PacesAskProposal"
25
+ ANSWERS_KIND = "PacesAskAnswers"
26
+ #: The proposal/answers contract version. Both documents carry it; a reader
27
+ #: refuses any other, so a page and a loader of different ages fail loudly.
28
+ CONTRACT_VERSION = 1
29
+
30
+
31
+ class _Wire(BaseModel):
32
+ model_config = ConfigDict(
33
+ alias_generator=to_camel, populate_by_name=True, frozen=True, extra="forbid"
34
+ )
35
+
36
+
37
+ class ProposedStep(_Wire):
38
+ """A step as the machine found it: its spans, as ``[start, end]`` time strings."""
39
+
40
+ id: str
41
+ name: str | None = None
42
+ spans: list[tuple[str, str]]
43
+
44
+
45
+ class Snap(_Wire):
46
+ """Where a tap lands: within ``window_s`` of a target (a cut, or a grid tick)."""
47
+
48
+ window_s: str
49
+ targets: list[str]
50
+
51
+
52
+ class Proposal(_Wire):
53
+ """What the machine pre-computes for a human to confirm (:func:`paces.ask.propose`).
54
+
55
+ ``cut_meets`` is aligned with ``cuts``: ``True`` where one step ends and
56
+ another begins (so striking the cut merges them), ``False`` at the edge of a
57
+ gap between steps, where there is nothing to merge. Empty (an older proposal)
58
+ reads as all ``True``.
59
+ """
60
+
61
+ kind: Literal["PacesAskProposal"] = PROPOSAL_KIND
62
+ version: Literal[1] = CONTRACT_VERSION
63
+ answers_kind: Literal["PacesAskAnswers"] = ANSWERS_KIND
64
+ title: str = ""
65
+ media: str | None = None
66
+ method: str | None = None
67
+ flags: list[str] = []
68
+ k: int | None
69
+ k_evidence: str
70
+ extent: tuple[str, str] | None
71
+ cuts: list[str]
72
+ cut_meets: list[bool] = []
73
+ steps: list[ProposedStep]
74
+ min_step_s: str
75
+ snap: Snap
76
+
77
+
78
+ class AnswersDocument(_Wire):
79
+ """What the page exports (:func:`paces.ask.load_answers` reads it).
80
+
81
+ ``corrections`` is a :mod:`paces.corrections` log, each entry validated by
82
+ :func:`paces.corrections.normalize_corrections`. ``boundaries`` holds the
83
+ cuts tapped when the proposal had none to correct, from 0 to the media's
84
+ end, as time strings or seconds.
85
+ """
86
+
87
+ kind: str = Field("", validate_default=True)
88
+ version: int
89
+ k: int | None = None
90
+ corrections: list[dict[str, Any]] = []
91
+ boundaries: list[Any] | None = None
92
+ proposal: Any = None
93
+
94
+ @model_validator(mode="before")
95
+ @classmethod
96
+ def _known_keys(cls, data: Any) -> Any:
97
+ if isinstance(data, dict):
98
+ known = set(cls.model_fields) | {
99
+ f.alias for f in cls.model_fields.values() if f.alias
100
+ }
101
+ unknown = sorted(set(data) - known)
102
+ if unknown:
103
+ raise ValueError(f"unknown answers keys {unknown}")
104
+ return data
105
+
106
+ @field_validator("kind")
107
+ @classmethod
108
+ def _kind(cls, v: str) -> str:
109
+ if v != ANSWERS_KIND:
110
+ raise ValueError(
111
+ f"expected {ANSWERS_KIND} answers (from the ask page), got {v!r}"
112
+ )
113
+ return v
114
+
115
+ @field_validator("version", mode="before")
116
+ @classmethod
117
+ def _version(cls, v: Any) -> Any:
118
+ if v != CONTRACT_VERSION or isinstance(v, bool):
119
+ raise ValueError(
120
+ f"expected version {CONTRACT_VERSION} answers, got version {v!r} "
121
+ "(re-export them from a page made by this paces)"
122
+ )
123
+ return v
124
+
125
+ @field_validator("k", mode="before")
126
+ @classmethod
127
+ def _k(cls, v: Any) -> Any:
128
+ if v is not None and (isinstance(v, bool) or not isinstance(v, int) or v < 1):
129
+ raise ValueError(f"k must be a positive integer or null, got {v!r}")
130
+ return v
131
+
132
+ @field_validator("boundaries", mode="before")
133
+ @classmethod
134
+ def _boundaries_is_a_list(cls, v: Any) -> Any:
135
+ if v is not None and (not isinstance(v, list) or len(v) < 2):
136
+ raise ValueError(f"boundaries must be a list of 2 or more times, got {v!r}")
137
+ return v
138
+
139
+
140
+ def contract_schemas() -> dict[str, dict]:
141
+ """The JSON Schema of both documents, for a UI written in another language.
142
+
143
+ >>> contract_schemas()["proposal"]["properties"]["kind"]["const"]
144
+ 'PacesAskProposal'
145
+ """
146
+ return {
147
+ "proposal": Proposal.model_json_schema(by_alias=True),
148
+ "answers": AnswersDocument.model_json_schema(by_alias=True),
149
+ }
@@ -84,6 +84,13 @@ function nearest(values, t) {
84
84
 
85
85
  const same = (state, message = "") => ({ state, message });
86
86
 
87
+ /** True unless the proposal says no two steps meet at this cut (the edge of a gap). */
88
+ const meets = (proposal, cut) => !proposal.cutMeets || proposal.cutMeets[proposal.cuts.indexOf(cut)] !== false;
89
+
90
+ /** The steps have gaps, so a time between two steps belongs to none. */
91
+ const inGap = (proposal, t) =>
92
+ proposal.steps.length > 0 && !proposal.steps.some((step) => step.spans.some(([a, b]) => Number(a) <= t && t <= Number(b)));
93
+
87
94
  // One rule per action: (proposal, state, action) -> { state, message, fresh? }.
88
95
  // A refusal returns the same state and says why.
89
96
  const RULES = {
@@ -104,6 +111,7 @@ const RULES = {
104
111
  return same(s, `Not added: ${at} is outside the part being checked (${mmss(lo)}–${mmss(hi)}).`);
105
112
  }
106
113
  }
114
+ if (inGap(p, t)) return same(s, `Not added: ${at} falls in a gap between steps, where no step spans that time.`);
107
115
  const inside = absentSpans(p, s).find(([a, b]) => a < t && t < b);
108
116
  if (inside) {
109
117
  return same(s, `Not added: ${at} is inside a step you marked as not in the video (${mmss(inside[0])}–${mmss(inside[1])}).`);
@@ -118,6 +126,7 @@ const RULES = {
118
126
 
119
127
  strike(p, s, { cut }) {
120
128
  if (!p.cuts.includes(cut) || s.struck.includes(cut)) return same(s);
129
+ if (!meets(p, cut)) return same(s, `No two steps meet at ${mmss(cut)} (it is the edge of a gap), so there is nothing to merge.`);
121
130
  const t = Number(cut);
122
131
  const border = p.steps.find(
123
132
  (step, i) => isAbsent(s, i) && step.spans.some((span) => span.map(Number).includes(t)),
@@ -248,7 +257,7 @@ function buildAnswers(proposal, state) {
248
257
 
249
258
  /** Each cut the page lists: proposed (maybe struck) and added, in time order. */
250
259
  function cutRows(proposal, state) {
251
- const rows = proposal.cuts.map((t) => ({ t, kind: state.struck.includes(t) ? "struck" : "proposed" }));
260
+ const rows = proposal.cuts.map((t) => ({ t, kind: state.struck.includes(t) ? "struck" : "proposed", meets: meets(proposal, t) }));
252
261
  for (const t of new Set(state.added)) if (!proposal.cuts.includes(t)) rows.push({ t, kind: "added" });
253
262
  return rows.sort((a, b) => byTime(a.t, b.t));
254
263
  }
@@ -408,6 +417,8 @@ function startPage(doc) {
408
417
  if (row.kind === "added") {
409
418
  li.append(button("Remove", () => dispatch({ type: "remove", cut: row.t })));
410
419
  li.lastChild.dataset.focusKey = `act:${row.t}`;
420
+ } else if (!row.meets) {
421
+ label.textContent = "edge of a gap";
411
422
  } else {
412
423
  const struck = row.kind === "struck";
413
424
  li.append(button(struck ? "Keep it" : "Not a cut", () => dispatch({ type: struck ? "keep" : "strike", cut: row.t })));
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "paces"
9
- version = "0.0.24"
9
+ version = "0.0.26"
10
10
  description = "Turn instructional media into structured, interactive learning material"
11
11
  readme = "README.md"
12
12
  license = "MIT"
@@ -542,3 +542,51 @@ def test_propose_takes_the_min_step_as_a_keyword():
542
542
  def test_the_status_line_stays_on_screen():
543
543
  css = (files("paces") / "data" / "ask" / "ask.css").read_text()
544
544
  assert re.search(r"#status \{[^}]*position: sticky", css)
545
+
546
+
547
+ def test_the_contract_is_declared_as_models():
548
+ from paces.ask_contract import AnswersDocument, Proposal, contract_schemas
549
+
550
+ p = propose(segment(boundaries=CUTS), media="v.mp4", title="t")
551
+ assert Proposal.model_validate(p).model_dump(by_alias=True, mode="json") == p
552
+ schemas = contract_schemas()
553
+ assert schemas["proposal"]["properties"]["minStepS"]["type"] == "string"
554
+ assert schemas["answers"]["additionalProperties"] is False
555
+ assert AnswersDocument.model_validate(_answers()).k == 4
556
+
557
+
558
+ def test_a_gap_cut_does_not_meet():
559
+ seg = segment(boundaries=[0, 10, 30], steps=["a", "b"])
560
+ assert propose(seg)["cutMeets"] == [True]
561
+ gapped = Segmentation(
562
+ boundaries=(0, 10, 20, 30),
563
+ steps=(
564
+ segment(boundaries=[0, 10, 20, 30], steps=["a", "b", "c"]).steps[0],
565
+ ),
566
+ )
567
+ p = propose(gapped)
568
+ assert p["cuts"] == ["10", "20"] and p["cutMeets"] == [False, False]
569
+
570
+
571
+ @needs_node
572
+ def test_js_refuses_striking_a_gap_edge_and_tapping_a_gap():
573
+ proposal = {
574
+ "k": 2, "extent": ["0", "30"], "cuts": ["10", "20"], "cutMeets": [False, True],
575
+ "steps": [
576
+ {"id": "a", "name": "a", "spans": [["0", "10"]]},
577
+ {"id": "b", "name": "b", "spans": [["20", "30"]]},
578
+ ],
579
+ "minStepS": "0.2", "snap": {"windowS": "0", "targets": ["10", "20"]},
580
+ }
581
+ import json as _j
582
+
583
+ out = _run_js(
584
+ f"(() => {{ const p = {_j.dumps(proposal)}; const s = core.freshState(p);"
585
+ "const a = core.reduce(p, s, {type: 'strike', cut: '10'});"
586
+ "const b = core.reduce(p, s, {type: 'tap', t: 15});"
587
+ "const c = core.reduce(p, s, {type: 'tap', t: 25});"
588
+ "return [a.state.struck, a.message, b.state.added, b.message, c.state.added]; })()"
589
+ )
590
+ assert out[0] == [] and "nothing to merge" in out[1]
591
+ assert out[2] == [] and "gap between steps" in out[3]
592
+ assert out[4] == ["25"]
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