@christang/keel 5.64.0 → 5.65.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,4 +1,4 @@
1
- <!-- keel:start version=5.64.0 -->
1
+ <!-- keel:start version=5.65.0 -->
2
2
  ## Keel Bootstrap
3
3
 
4
4
  - Start every session with `keel context`; OpenSpec artifacts and Git are the only durable authority — never native memory, goals, or transcripts.
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.64.0",
5
+ "version": "5.65.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.64.0",
3
+ "version": "5.65.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.64.0",
3
+ "version": "5.65.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",
@@ -38,8 +38,8 @@ REQUIRED_SCRIPTS = [
38
38
  "scripts/validate_plugin.py",
39
39
  ]
40
40
 
41
- PACKAGE_VERSION = "5.64.0"
42
- PROTOCOL_VERSION = "5.64.0"
41
+ PACKAGE_VERSION = "5.65.0"
42
+ PROTOCOL_VERSION = "5.65.0"
43
43
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
44
44
  OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
45
45
  # Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
@@ -28459,6 +28459,138 @@ def validate_a_claim_names_what_would_falsify_it_scenario() -> int:
28459
28459
  return 0
28460
28460
 
28461
28461
 
28462
+ def validate_a_negation_is_not_a_marker_scenario() -> int:
28463
+ """Issue #144: `Not resolved here:` was read as `Resolved here:`.
28464
+
28465
+ The marker scan's `\\b` sits at the space inside the negation, so a finding
28466
+ that said in as many words it was *not* resolved here had the next word read
28467
+ as its resolution evidence — a dismissal read as a repair, then refused for
28468
+ lacking repair evidence. 5.42.0 established that a quoted marker is a
28469
+ quotation; a negated one is the same class and was not covered.
28470
+ """
28471
+ label = "a-negation-is-not-a-marker"
28472
+
28473
+ def findings_task(findings: str) -> str:
28474
+ return "\n".join(
28475
+ [
28476
+ "- [x] 1.1 Findings probe",
28477
+ " - Owner: claude",
28478
+ " - Mode: implementation",
28479
+ " - Covers:",
28480
+ " - E1: the task proves its own behavior",
28481
+ " - Read:",
28482
+ " - README.md",
28483
+ " - Touch:",
28484
+ " - src/example.js",
28485
+ " - Verify:",
28486
+ " - Strategy: vertical-tdd",
28487
+ " - M1: node test.js asserts the public behavior",
28488
+ " - Evidence:",
28489
+ " - Contract: pending",
28490
+ " - M1: pass. node test.js reported the behavior.",
28491
+ " - M1.red: fail. the behavior did not exist.",
28492
+ " - M1.green: pass.",
28493
+ " - Review:",
28494
+ " - Status: pass",
28495
+ " - Acceptance check: the behavior is proven.",
28496
+ " - Scope check: only Touch changed.",
28497
+ f" - Findings: {findings}",
28498
+ " - Blocker: none",
28499
+ " - Reauthorizations: none",
28500
+ ]
28501
+ )
28502
+
28503
+ with tempfile.TemporaryDirectory(prefix="keel-negation-") as raw:
28504
+ root = Path(raw)
28505
+
28506
+ def complete(name: str, findings: str) -> dict:
28507
+ repo = root / name
28508
+ write_gate_fixture(repo, tasks=findings_task(findings))
28509
+ run_keel(
28510
+ repo, "gate", "task-start", "--change", "demo", "--task", "1.1",
28511
+ "--record", "--json",
28512
+ )
28513
+ done = run_keel(
28514
+ repo, "gate", "task-complete", "--change", "demo", "--task", "1.1",
28515
+ "--json",
28516
+ )
28517
+ try:
28518
+ return json.loads(done.stdout)
28519
+ except json.JSONDecodeError:
28520
+ return {"status": "unparsed", "problems": [{"message": done.stdout[:400]}]}
28521
+
28522
+ # M1 — the text that produced #144, verbatim in shape.
28523
+ negated = complete(
28524
+ "negated",
28525
+ "one, still open. The count is derivable from the declarations the "
28526
+ "module reads. Not resolved here: it is a different module and would "
28527
+ "be scope expansion. Durable owner: https://example.com/issues/1",
28528
+ )
28529
+ if negated.get("status") != "pass":
28530
+ report(
28531
+ f"{label}: names neither a check nor a path — a finding saying it "
28532
+ "was *not* resolved here, closing with a durable owner, was "
28533
+ f"refused; {problem_codes(negated)!r} {problem_text(negated)!r}."
28534
+ )
28535
+ return 1
28536
+ if "resolution evidence" in problem_text(negated).lower():
28537
+ report(
28538
+ f"{label}: the negated phrase still produced a resolution-evidence "
28539
+ f"diagnostic; {problem_text(negated)!r}."
28540
+ )
28541
+ return 1
28542
+
28543
+ # M2 — the positive control, in all three opening positions. Without it
28544
+ # the narrowing could pass by recognizing no marker anywhere.
28545
+ for name, findings in (
28546
+ ("opens-value", "Resolved here: M9"),
28547
+ ("after-break", "one, and it was fixed.\n Resolved here: M9"),
28548
+ ("after-stop", "one, and it was fixed. Resolved here: M9"),
28549
+ ):
28550
+ payload = complete(name, findings)
28551
+ if payload.get("status") == "pass":
28552
+ report(
28553
+ f"{label}: stopped recognizing a real marker ({name}) — a "
28554
+ "`Resolved here:` naming a check this task does not declare "
28555
+ "completed cleanly."
28556
+ )
28557
+ return 1
28558
+ if "M9" not in problem_text(payload):
28559
+ report(
28560
+ f"{label}: stopped recognizing a real marker ({name}) — the "
28561
+ f"refusal does not name the cited check; {problem_text(payload)!r}."
28562
+ )
28563
+ return 1
28564
+
28565
+ # M3 — a marker that opens no clause is refused, not ignored, and the
28566
+ # refusal names the rule so the author is not told to add what they wrote.
28567
+ swallowed = complete(
28568
+ "swallowed", "one, and the fix was Resolved here: M1 in passing"
28569
+ )
28570
+ if swallowed.get("status") == "pass":
28571
+ report(
28572
+ f"{label}: a finding whose only marker opens no clause completed "
28573
+ "cleanly, so it carried no disposition and nothing said so."
28574
+ )
28575
+ return 1
28576
+ # Asserted on the whole phrase, not the word: `opens` alone matches
28577
+ # inside `openspec`, which the same diagnostic already prints, and the
28578
+ # assertion was vacuous until this was tightened.
28579
+ if "opens its clause" not in problem_text(swallowed).lower():
28580
+ report(
28581
+ f"{label}: does not name the opening requirement — an author "
28582
+ "whose sentence visibly contains a marker is told to add a "
28583
+ f"disposition; {problem_text(swallowed)!r}."
28584
+ )
28585
+ return 1
28586
+
28587
+ if label not in {name for name, _ in SCENARIOS}:
28588
+ report(f"{label}: the scenario registry does not include it.")
28589
+ return 1
28590
+ report(f"{label} scenario passed.")
28591
+ return 0
28592
+
28593
+
28462
28594
  SCENARIOS: tuple = (
28463
28595
  ("stateless-continuity", validate_stateless_continuity_scenario),
28464
28596
  ("core-gates", validate_core_gates_scenario),
@@ -28817,6 +28949,10 @@ SCENARIOS: tuple = (
28817
28949
  "a-claim-names-what-would-falsify-it",
28818
28950
  validate_a_claim_names_what_would_falsify_it_scenario,
28819
28951
  ),
28952
+ (
28953
+ "a-negation-is-not-a-marker",
28954
+ validate_a_negation_is_not_a_marker_scenario,
28955
+ ),
28820
28956
  )
28821
28957
 
28822
28958
 
package/src/core/gates.js CHANGED
@@ -672,7 +672,24 @@ function transientOwnerMessage(candidate) {
672
672
  // swallow and changes nothing about why this one is narrow. The match is
673
673
  // global because each resolved claim owes its own evidence; checking only the
674
674
  // first would let a second one assert itself for free.
675
- const RESOLVED_HERE = /\bresolved here\s*:[ \t]*(\S*)/gi;
675
+ // A marker is a disposition only where it OPENS its clause: the start of the
676
+ // value, a line break, or sentence-ending punctuation may precede it, and a word
677
+ // may not. `Not resolved here:` contains the marker and means its opposite, and a
678
+ // `\b` boundary sat happily at the space inside it — the negation was read as a
679
+ // resolution claim and the next word, `it`, as its evidence, so a dismissal was
680
+ // read as a repair and then refused for lacking repair evidence (issue #144).
681
+ // Quoting was the first way a marker could appear without being one (5.42.0);
682
+ // negating it is the second.
683
+ //
684
+ // Written as a lookbehind so the captures keep reading from the same offsets —
685
+ // every rule here is positional, and a rule that shortened the text would move
686
+ // what they read.
687
+ const CLAUSE_OPENING = "(?<=^|[\\n.;:!?\u2014\u2013])[ \\t]*";
688
+
689
+ const RESOLVED_HERE = new RegExp(
690
+ `${CLAUSE_OPENING}resolved here\\s*:[ \\t]*(\\S*)`,
691
+ "gi"
692
+ );
676
693
 
677
694
  // Resolution evidence is deliberately narrower than a durable owner. An
678
695
  // `http`/`https` reference says someone else will do the work later, which is
@@ -714,8 +731,24 @@ function resolutionEvidenceVerdict(repo, value, commands, change) {
714
731
  // next token, so a shortened text would move what they read. The original is
715
732
  // kept for anything reported back, since a diagnostic quoting the blanked copy
716
733
  // would show the author a sentence with holes in it.
717
- const DISPOSITION_MARKER =
718
- /\b(?:resolved here|durable owner|discard (?:reason|rationale))\s*:/gi;
734
+ // The same opening rule, for the same reason. Narrowing only the capture would
735
+ // leave a negated marker counted as a disposition being *present* while it
736
+ // supplied no evidence — a finding accepted as disposed with nothing behind it,
737
+ // which is worse than either half of the defect alone.
738
+ // The marker vocabulary wherever it appears, with no opening rule. Two different
739
+ // questions are asked of this text and they need different patterns. *Blanking* a
740
+ // marker inside a quoted span asks "is this marker text?" — and inside a span the
741
+ // character before it is a backtick, so an opening rule would refuse to blank it
742
+ // and the quotation would survive into the recognition scan. *Recognizing* a
743
+ // disposition asks "does this marker open a clause?", which is the narrower
744
+ // question `DISPOSITION_MARKER` below answers.
745
+ const MARKER_VOCABULARY =
746
+ /(?:resolved here|durable owner|discard (?:reason|rationale))\s*:/gi;
747
+
748
+ const DISPOSITION_MARKER = new RegExp(
749
+ `${CLAUSE_OPENING}(?:resolved here|durable owner|discard (?:reason|rationale))\\s*:`,
750
+ "gi"
751
+ );
719
752
 
720
753
  function withoutQuotedMarkers(text) {
721
754
  return String(text || "").replace(/`[^`\n]*`/g, (span) =>
@@ -725,7 +758,7 @@ function withoutQuotedMarkers(text) {
725
758
  // span would destroy the very path the rule exists to read. Measured: the
726
759
  // first draft of this function did exactly that, and both the backticked
727
760
  // owner path and the backticked resolution path started failing.
728
- span.replace(DISPOSITION_MARKER, (marker) => " ".repeat(marker.length))
761
+ span.replace(MARKER_VOCABULARY, (marker) => " ".repeat(marker.length))
729
762
  );
730
763
  }
731
764
 
@@ -1269,6 +1302,16 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
1269
1302
  + "must still do is `Durable owner:` naming "
1270
1303
  + `${DURABLE_OWNER_FORMS}; one deliberately not being done is a `
1271
1304
  + "`Discard reason:`/`Discard rationale:` prefix."
1305
+ // Said only where a marker is visibly present and was not counted,
1306
+ // which is the one case where "carry a disposition" reads as a
1307
+ // contradiction of what the author can see they wrote.
1308
+ + (mentionsUnopenedMarker(scannable)
1309
+ ? " A marker counts only where it opens its clause — after the "
1310
+ + "start of the value, a line break, or sentence-ending "
1311
+ + "punctuation. This text mentions one mid-sentence, so it was "
1312
+ + "read as prose; move it to the start of its own clause, or "
1313
+ + "keep it as prose and add the disposition separately."
1314
+ : "")
1272
1315
  )
1273
1316
  );
1274
1317
  }
@@ -1276,6 +1319,15 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
1276
1319
  return { problems, reviewProblems };
1277
1320
  }
1278
1321
 
1322
+ // Whether the text names a disposition marker somewhere that is not a clause
1323
+ // opening. Used only to add a sentence to a refusal, never to accept anything:
1324
+ // a marker mid-sentence stays prose, and this is what tells its author why.
1325
+ function mentionsUnopenedMarker(text) {
1326
+ const body = String(text || "");
1327
+ if (!new RegExp(MARKER_VOCABULARY.source, "i").test(body)) return false;
1328
+ return !new RegExp(DISPOSITION_MARKER.source, "i").test(body);
1329
+ }
1330
+
1279
1331
  function taskComplete(repo, options) {
1280
1332
  const selection = loadSelection(repo, options);
1281
1333
  const task = selection.selected[0];