@windyroad/itil 0.27.0-preview.296 → 0.27.1-preview.300
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
|
@@ -125,7 +125,7 @@ Same P056-safe local_max + origin_max formula as `/wr-itil:manage-problem` Step
|
|
|
125
125
|
# extends the same coverage to the origin tree.
|
|
126
126
|
local_max=$(ls docs/problems/*.md docs/problems/*/*.md 2>/dev/null | sed 's|.*/||' | grep -oE '^[0-9]+' | sort -n | tail -1)
|
|
127
127
|
origin_max=$(git ls-tree -r --name-only origin/main docs/problems/ 2>/dev/null | sed 's|.*/||' | grep -oE '^[0-9]+' | sort -n | tail -1)
|
|
128
|
-
next=$(printf '%03d' $((
|
|
128
|
+
next=$(printf '%03d' $(( 10#$(echo -e "${local_max:-0}\n${origin_max:-0}" | sort -n | tail -1) + 1 )))
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
Log the renumber decision in the operation report if origin and local diverged.
|
|
@@ -131,7 +131,7 @@ teardown() {
|
|
|
131
131
|
[ "$local_max" = "107" ]
|
|
132
132
|
|
|
133
133
|
# No origin available in the fixture; default to 0 then increment.
|
|
134
|
-
next=$(printf '%03d' $((
|
|
134
|
+
next=$(printf '%03d' $(( 10#$(echo -e "${local_max:-0}\n0" | sort -n | tail -1) + 1 )))
|
|
135
135
|
[ "$next" = "108" ]
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -141,10 +141,29 @@ teardown() {
|
|
|
141
141
|
| sed 's/.*\///' \
|
|
142
142
|
| grep -oE '^[0-9]+' \
|
|
143
143
|
| sort -n | tail -1)
|
|
144
|
-
next=$(printf '%03d' $((
|
|
144
|
+
next=$(printf '%03d' $(( 10#$(echo -e "${local_max:-0}\n0" | sort -n | tail -1) + 1 )))
|
|
145
145
|
[ "$next" = "001" ]
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
@test "capture-problem: next-ID handles 099 → 100 transition without octal-eval failure (P164)" {
|
|
149
|
+
# P164 regression: bash $(( ... )) parses leading-zero numbers as octal.
|
|
150
|
+
# `099` is invalid octal (digits >= 8). Without `10#` prefix, this fires:
|
|
151
|
+
# bash: 099: value too great for base (error token is "099")
|
|
152
|
+
# The fix is the standard `10#` base-10 prefix on the inner $(echo ... | tail -1).
|
|
153
|
+
mkdir -p "$TMPROOT/docs/problems"
|
|
154
|
+
: > "$TMPROOT/docs/problems/098-foo.open.md"
|
|
155
|
+
: > "$TMPROOT/docs/problems/099-bar.open.md"
|
|
156
|
+
|
|
157
|
+
local_max=$(ls "$TMPROOT/docs/problems"/*.md 2>/dev/null \
|
|
158
|
+
| sed 's/.*\///' \
|
|
159
|
+
| grep -oE '^[0-9]+' \
|
|
160
|
+
| sort -n | tail -1)
|
|
161
|
+
[ "$local_max" = "099" ]
|
|
162
|
+
|
|
163
|
+
next=$(printf '%03d' $(( 10#$(echo -e "${local_max:-0}\n0" | sort -n | tail -1) + 1 )))
|
|
164
|
+
[ "$next" = "100" ]
|
|
165
|
+
}
|
|
166
|
+
|
|
148
167
|
# ---------------------------------------------------------------------------
|
|
149
168
|
# Conservative duplicate-grep — title-only filename match, 3-keyword cap.
|
|
150
169
|
# Architect Q1 verdict: title-only because conservative threshold rationale
|
|
@@ -128,7 +128,7 @@ Same `max(local, origin) + 1` formula as `capture-problem` Step 3, scanning `doc
|
|
|
128
128
|
```bash
|
|
129
129
|
local_max=$(ls docs/rfcs/RFC-*.md 2>/dev/null | sed 's|.*/RFC-||;s|-.*||' | grep -oE '^[0-9]+' | sort -n | tail -1)
|
|
130
130
|
origin_max=$(git ls-tree --name-only origin/main docs/rfcs/ 2>/dev/null | sed 's|^docs/rfcs/RFC-||;s|-.*||' | grep -oE '^[0-9]+' | sort -n | tail -1)
|
|
131
|
-
next=$(printf '%03d' $((
|
|
131
|
+
next=$(printf '%03d' $(( 10#$(echo -e "${local_max:-0}\n${origin_max:-0}" | sort -n | tail -1) + 1 )))
|
|
132
132
|
```
|
|
133
133
|
|
|
134
134
|
Log the renumber decision in the operation report if origin and local diverged.
|
|
@@ -331,7 +331,7 @@ local_max=$(ls docs/problems/*.md docs/problems/*/*.md 2>/dev/null | sed 's|.*/|
|
|
|
331
331
|
origin_max=$(git ls-tree --name-only -r origin/main docs/problems/ 2>/dev/null | sed 's|.*/||' | grep -oE '^[0-9]+' | sort -n | tail -1)
|
|
332
332
|
|
|
333
333
|
# Take the max of the two and increment.
|
|
334
|
-
next=$(printf '%03d' $((
|
|
334
|
+
next=$(printf '%03d' $(( 10#$(echo -e "${local_max:-0}\n${origin_max:-0}" | sort -n | tail -1) + 1 )))
|
|
335
335
|
```
|
|
336
336
|
|
|
337
337
|
If the local choice would have collided with an origin ticket created since the last fetch, the `git ls-tree origin/<base>` lookup catches it here and the renumber is automatic. Log the renumber decision in the operation report (e.g. "Bumped next ID from 042 → 043 to avoid collision with origin").
|