@windyroad/jtbd 0.12.11 → 0.12.12-preview.884

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.
@@ -90,5 +90,5 @@
90
90
  }
91
91
  },
92
92
  "name": "wr-jtbd",
93
- "version": "0.12.11"
93
+ "version": "0.12.12"
94
94
  }
@@ -192,6 +192,21 @@ mk_existing_artefact() {
192
192
  [ -f "$(expected_marker "$art")" ]
193
193
  }
194
194
 
195
+ # P368: genuine cold path — no CLAUDE_SESSION_ID and no announce markers at all.
196
+ # The shim correctly writes zero markers but must NOT do so SILENTLY: a loud
197
+ # stderr diagnostic explains why the subsequent discipline-hook deny happens,
198
+ # breaking the confusing "you didn't run the shim" loop. Exit stays 0 (contract:
199
+ # do not crash SKILL flows before any hook has fired this session).
200
+ @test "mark-oversight-confirmed.sh emits a loud stderr diagnostic on the no-candidate cold path (P368)" {
201
+ mk_existing_artefact "developer/JTBD-342-coldpath.proposed.md"
202
+ art="$DIR/docs/jtbd/developer/JTBD-342-coldpath.proposed.md"
203
+ run env -u CLAUDE_SESSION_ID bash "$MARK_SCRIPT" "$art"
204
+ [ "$status" -eq 0 ] # contract: cold path still exits 0
205
+ [ ! -f "$(expected_marker "$art")" ] # no marker written
206
+ [[ "$output" == *"no candidate session id"* ]] # loud, not silent
207
+ [[ "$output" == *"P368"* ]]
208
+ }
209
+
195
210
  @test "tool_name=Bash exits 0 silently regardless of file path" {
196
211
  json=$(jq -nc --arg s "$SID" \
197
212
  '{tool_name:"Bash",session_id:$s,tool_input:{command:"echo human-oversight: confirmed"}}')
@@ -11,6 +11,11 @@ setup() {
11
11
  PLUGIN_ROOT="$REPO_ROOT/packages/jtbd"
12
12
  DIR="$(mktemp -d)"
13
13
  mkdir -p "$DIR/docs/jtbd/solo-developer"
14
+ # Hermeticity (P391): the AFK work-problems orchestrator exports
15
+ # WR_SUPPRESS_OVERSIGHT_NUDGE=1, which the hook self-suppresses on. Unset it so
16
+ # count-emitting tests assert real behaviour; guard-specific tests set it
17
+ # per-invocation via `run env WR_SUPPRESS_OVERSIGHT_NUDGE=...`.
18
+ unset WR_SUPPRESS_OVERSIGHT_NUDGE
14
19
  }
15
20
 
16
21
  teardown() { rm -rf "$DIR"; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/jtbd",
3
- "version": "0.12.11",
3
+ "version": "0.12.12-preview.884",
4
4
  "description": "Jobs-to-be-done enforcement for UI changes",
5
5
  "bin": {
6
6
  "windyroad-jtbd": "./bin/install.mjs"
@@ -36,7 +36,10 @@
36
36
  #
37
37
  # Exit codes:
38
38
  # 0 — marker(s) written for at least one candidate SID, OR no candidate
39
- # SID was discoverable (cold-path: no announce markers yet).
39
+ # SID was discoverable (cold path: no announce markers yet). The latter
40
+ # writes no marker and prints a loud stderr diagnostic (P368) explaining
41
+ # the downstream hook deny, then exits 0 so SKILL flows do not crash
42
+ # before any hook has fired in the session.
40
43
  # 2 — bad argument (missing or empty artefact-path).
41
44
  #
42
45
  # @adr ADR-068 (JTBD/persona human-oversight marker)
@@ -93,7 +96,23 @@ candidates=$(
93
96
  } | awk 'NF && !seen[$0]++'
94
97
  )
95
98
 
96
- [ -n "$candidates" ] || exit 0
99
+ # No candidate SID cold path. Emit a loud stderr diagnostic (P368) and still
100
+ # exit 0. Exit 0 preserves the documented contract (do not crash SKILL flows
101
+ # before any announce marker has fired this session); the diagnostic replaces the
102
+ # prior SILENT no-op, which masqueraded as success and left the caller to hit the
103
+ # oversight-marker-discipline hook's deny with no idea why — the confusing loop
104
+ # P368 documents (the deny points back at this shim, which the caller already ran).
105
+ if [ -z "$candidates" ]; then
106
+ {
107
+ echo "wr-jtbd-mark-oversight-confirmed: no candidate session id discoverable"
108
+ echo " (CLAUDE_SESSION_ID empty and no *-announced-* markers in ${MARKER_DIR} within ${WINDOW_MINS}min)."
109
+ echo " NO oversight marker was written for: ${ABS_PATH}"
110
+ echo " The oversight-marker-discipline hook will DENY the 'human-oversight: confirmed' Edit"
111
+ echo " until a session announce marker exists. Start a fresh session, or point SESSION_MARKER_DIR"
112
+ echo " at a dir containing a *-announced-<sid> file, then re-run this shim (P368)."
113
+ } >&2
114
+ exit 0
115
+ fi
97
116
 
98
117
  while IFS= read -r sid; do
99
118
  [ -n "$sid" ] || continue