@christang/keel 5.207.0 → 5.208.0

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.207.0",
3
+ "version": "5.208.0",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.207.0 -->
1
+ <!-- keel:start version=5.208.0 -->
2
2
  ## Keel Bootstrap
3
3
 
4
4
  - Start every session with `keel context`; OpenSpec artifacts and Git are the durable authority, and memory or transcripts may only inform.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.207.0",
3
+ "version": "5.208.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.207.0",
9
+ "version": "5.208.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@fission-ai/openspec": "^1.4.1"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@christang/keel",
3
3
  "displayName": "Keel",
4
4
  "description": "Keel OpenSpec execution discipline CLI for Claude Code, Codex, and OpenCode.",
5
- "version": "5.207.0",
5
+ "version": "5.208.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.207.0",
3
+ "version": "5.208.0",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.207.0",
3
+ "version": "5.208.0",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
@@ -35,10 +35,10 @@ os.environ["KEEL_UPDATE_CLAUDE"] = str(Path(tempfile.gettempdir()) / "keel-suite
35
35
  os.environ["KEEL_UPDATE_CODEX"] = str(Path(tempfile.gettempdir()) / "keel-suite-has-no-codex")
36
36
 
37
37
 
38
- PACKAGE_VERSION = "5.207.0"
38
+ PACKAGE_VERSION = "5.208.0"
39
39
 
40
40
 
41
- PROTOCOL_VERSION = "5.207.0"
41
+ PROTOCOL_VERSION = "5.208.0"
42
42
 
43
43
 
44
44
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
@@ -10537,6 +10537,79 @@ def problem_codes(payload: dict) -> list[str]:
10537
10537
  # passed, one where the fixture contained no wording the checker would refuse.
10538
10538
  # The declaration is what a gate can hold: written into the check, so it is in
10539
10539
  # the fingerprint, and therefore written before the run rather than after it.
10540
+ def validate_declared_literal_whitespace_scenario() -> int:
10541
+ """Issue #479 D1, D2: declared literals match recorded Evidence with whitespace runs as one space.
10542
+
10543
+ Tool output aligns with runs of spaces; a literal copied from it must
10544
+ match the raw output it was copied from, while different characters are
10545
+ still refused and the refusal rules spacing out.
10546
+ """
10547
+ label = "declared-literal-whitespace"
10548
+ with tempfile.TemporaryDirectory(prefix="keel-literal-479-") as raw:
10549
+ repo = Path(raw) / "repo"
10550
+
10551
+ def complete(check: str, evidence: list[str]) -> dict:
10552
+ task = "\n".join([
10553
+ "- [x] 1.1 Literal probe",
10554
+ " - Owner: claude",
10555
+ " - Mode: implementation",
10556
+ " - Covers:",
10557
+ " - E1: the task proves its own behavior",
10558
+ " - Read:",
10559
+ " - README.md",
10560
+ " - Touch:",
10561
+ " - src/example.js",
10562
+ " - Verify:",
10563
+ " - Strategy: vertical-tdd",
10564
+ f" - M1: node test.js asserts the public behavior. {check}",
10565
+ " - Evidence:",
10566
+ *evidence,
10567
+ " - Review:",
10568
+ " - Status: pass",
10569
+ " - Acceptance check: the behavior is proven.",
10570
+ " - Scope check: only Touch changed.",
10571
+ " - Findings: none.",
10572
+ " - Blocker: none",
10573
+ " - Reauthorizations: none",
10574
+ ])
10575
+ write_gate_fixture(repo, tasks=task)
10576
+ started = run_keel(repo, "gate", "task-start", "--change", "demo", "--task", "1.1", "--record", "--json")
10577
+ try:
10578
+ json.loads(started.stdout)
10579
+ except json.JSONDecodeError:
10580
+ return {"status": "unstarted", "problems": [{"message": started.stdout[:300]}]}
10581
+ done = run_keel(repo, "gate", "task-complete", "--change", "demo", "--task", "1.1", "--json")
10582
+ try:
10583
+ return json.loads(done.stdout)
10584
+ except json.JSONDecodeError:
10585
+ return {"status": "unparsed", "problems": [{"message": done.stdout[:400]}]}
10586
+
10587
+ cases = (
10588
+ ("an aligned failure signature", "Fails with: `FAIL record reachable`",
10589
+ [" - M1: pass.", " - M1.red: fail. `FAIL record reachable` (exit 1).", " - M1.green: pass."]),
10590
+ ("an aligned injection failure", "Fails with: `boom` Detects: `drop the guard` -> `FAIL guard missing`",
10591
+ [" - M1: pass.", " - M1.red: fail. `boom`.", " - M1.green: pass.",
10592
+ " - M1.detects: fail. `FAIL guard missing`."]),
10593
+ ("a spaced measurement", "Fails with: `boom` Measured: `took 12 s`",
10594
+ [" - M1: pass. the run took 12 s.", " - M1.red: fail. `boom`.", " - M1.green: pass."]),
10595
+ )
10596
+ for name, check, evidence in cases:
10597
+ result = complete(check, evidence)
10598
+ if result.get("status") != "pass":
10599
+ report(f"{label}: {name} copied from the raw output was refused; {problem_codes(result)!r} {problem_text(result)!r}.")
10600
+ return 1
10601
+ wrong = complete("Fails with: `FAIL record reachable`",
10602
+ [" - M1: pass.", " - M1.red: fail. `FAIL record unreachable` (exit 1).", " - M1.green: pass."])
10603
+ if "red-missing-declared-failure" not in problem_codes(wrong):
10604
+ report(f"{label}: a red with different characters was not refused as red-missing-declared-failure; {problem_codes(wrong)!r}.")
10605
+ return 1
10606
+ if "as one space" not in problem_text(wrong):
10607
+ report(f"{label}: the refusal does not say runs of whitespace are compared as one space; {problem_text(wrong)!r}.")
10608
+ return 1
10609
+ report(f"{label} scenario passed.")
10610
+ return 0
10611
+
10612
+
10540
10613
  def validate_red_declares_what_it_proves_scenario() -> int:
10541
10614
  label = "a-red-declares-what-it-proves"
10542
10615
  signature = "openspec: not found"
@@ -199,6 +199,7 @@ SCENARIOS: tuple = (
199
199
  ("output-survives-the-pipe", selfcheck.validate_output_survives_the_pipe_scenario),
200
200
  ("a-strategy-is-declared", contract.validate_strategy_is_declared_scenario),
201
201
  ("a-red-declares-what-it-proves", contract.validate_red_declares_what_it_proves_scenario),
202
+ ("declared-literal-whitespace", contract.validate_declared_literal_whitespace_scenario),
202
203
  ("the-weakest-strategy-states-its-reason", contract.validate_weakest_strategy_states_its_reason_scenario),
203
204
  ("a-quoted-marker-is-not-a-disposition", contract.validate_quoted_marker_is_not_a_disposition_scenario),
204
205
  ("drift-names-where-to-look", contract.validate_drift_names_where_to_look_scenario),
package/src/core/gates.js CHANGED
@@ -1444,7 +1444,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
1444
1444
  if (!entry.measured || !entry.label) continue;
1445
1445
  const recorded = evidenceValue(task, entry.label);
1446
1446
  if (!isConcrete(recorded)) continue;
1447
- if (!String(recorded).includes(entry.measured)) {
1447
+ if (!containsDeclared(recorded, entry.measured)) {
1448
1448
  problems.push(
1449
1449
  problem(
1450
1450
  "measurement-missing-from-evidence",
@@ -1453,7 +1453,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
1453
1453
  + "string. Paste the output the number came from, or correct the "
1454
1454
  + "declaration — which moves the contract fingerprint, because a "
1455
1455
  + "number reconciled to the output after the run is a transcription "
1456
- + "of it.",
1456
+ + `of it.${WHITESPACE_NOTE}`,
1457
1457
  )
1458
1458
  );
1459
1459
  }
@@ -1484,7 +1484,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
1484
1484
  );
1485
1485
  continue;
1486
1486
  }
1487
- if (!String(recorded).includes(entry.detects.failure)) {
1487
+ if (!containsDeclared(recorded, entry.detects.failure)) {
1488
1488
  problems.push(
1489
1489
  problem(
1490
1490
  "injection-missing-declared-failure",
@@ -1493,7 +1493,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
1493
1493
  + `${entry.label}.detects Evidence does not contain that string. `
1494
1494
  + "Record what the mutation actually printed, or correct the "
1495
1495
  + "declaration — which moves the contract fingerprint, because an "
1496
- + "injection edited after the run is a transcription of it.",
1496
+ + `injection edited after the run is a transcription of it.${WHITESPACE_NOTE}`,
1497
1497
  )
1498
1498
  );
1499
1499
  }
@@ -1525,7 +1525,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
1525
1525
  if (exempt.has(label)) continue;
1526
1526
  const expected = declaredFailure.get(label);
1527
1527
  const recorded = evidenceValue(task, `${label}.red`);
1528
- if (expected && isConcrete(recorded) && !String(recorded).includes(expected)) {
1528
+ if (expected && isConcrete(recorded) && !containsDeclared(recorded, expected)) {
1529
1529
  problems.push(
1530
1530
  problem(
1531
1531
  "red-missing-declared-failure",
@@ -1534,7 +1534,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
1534
1534
  + "string. Record the failure output the red actually printed, "
1535
1535
  + "or correct the declaration — which moves the contract "
1536
1536
  + "fingerprint, because a signature edited after the red was "
1537
- + "observed is a transcription of it.",
1537
+ + `observed is a transcription of it.${WHITESPACE_NOTE}`,
1538
1538
  )
1539
1539
  );
1540
1540
  }
@@ -1860,6 +1860,16 @@ function changeEvidenceValue(content, tasks, label) {
1860
1860
  return match ? match[1].trim() : "";
1861
1861
  }
1862
1862
 
1863
+ // A declared literal is compiled from whitespace-collapsed check text, so the
1864
+ // recorded Evidence is collapsed the same way before it is searched; nothing
1865
+ // else is folded (#479 D1).
1866
+ function containsDeclared(recorded, literal) {
1867
+ const collapse = (value) => String(value).replace(/\s+/g, " ");
1868
+ return collapse(recorded).includes(collapse(literal));
1869
+ }
1870
+
1871
+ const WHITESPACE_NOTE = " Runs of whitespace are compared as one space, so spacing is not the cause.";
1872
+
1863
1873
  // `change-close`-only: `## Change Verify`'s own shape, and completeness of
1864
1874
  // `## Change Evidence` for every check it declares — whether or not any task
1865
1875
  // actually defers to it, because a declared check still owes its own result.