@deepslacker/dsh-task-progress 0.5.12 → 0.5.13

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 (3) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/client.js +37 -14
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to `dsh-task-progress` are documented here. GitHub Releases are created from the matching section of this file by the `Release` workflow.
4
4
 
5
+ ## [0.5.13] - 2026-11-19
6
+
7
+ ### Fixed
8
+
9
+ - The node rail stays in completion order. A downward re-estimate used to place later nodes left of earlier ones, so the last completed node before the head could be an old one (node 9 while node 18 was current) and a node from an earlier, higher estimate vanished. Every completed node now stays on the rail, positions are monotonic and capped at the fill head, and a run lifted by a re-estimate spreads across the space up to the next node.
10
+
5
11
  ## [0.5.12] - 2026-11-17
6
12
 
7
13
  ### Changed
package/client.js CHANGED
@@ -619,20 +619,43 @@ window.__ModuleLoader__.load({
619
619
  .map((step, index) => ({ step, index }))
620
620
  .filter(entry => entry.step !== null && typeof entry.step === 'object')
621
621
  const closedEntries = allEntries.filter(entry => entry.step.endedAt > 0)
622
- // A completed node beyond the current fill belongs to an earlier, higher
623
- // estimate; showing it there would label a future task as already done.
624
622
  const currentPercent = known ? Math.max(0, Math.min(100, progress.percent)) : 100
625
- const visibleEntries = done
626
- ? closedEntries
627
- : known
628
- ? closedEntries.filter(entry => {
629
- const value = Number(entry.step.percent)
630
- return !Number.isFinite(value) || value <= currentPercent + 0.5
631
- })
632
- : []
623
+ // Every completed node stays on the rail, in completion order. The
624
+ // evaluator can re-estimate a task downward, so a later node may carry a
625
+ // lower percentage than an earlier one; positions are therefore made
626
+ // monotonic (a later node never sits left of an earlier one) and capped
627
+ // at the fill head (a node from an earlier, higher estimate moves to the
628
+ // head instead of disappearing). Otherwise the rail can show node 9 as
629
+ // the last completed node while the badge already counts node 18.
630
+ const ceiling = done ? 100 : currentPercent
631
+ const placed = []
632
+ let floor = 0
633
+ for (const entry of closedEntries) {
634
+ const value = Number(entry.step.percent)
635
+ const raw = Number.isFinite(value) ? Math.max(0, Math.min(100, value)) : floor
636
+ const position = Math.min(ceiling, Math.max(floor, raw))
637
+ placed.push({ ...entry, position, lifted: raw < position })
638
+ floor = position
639
+ }
640
+ // A run of nodes lifted by a re-estimate keeps its order but spreads into
641
+ // the space before the next real position, so it does not pile on one dot.
642
+ for (let start = 0; start < placed.length;) {
643
+ if (!placed[start].lifted) { start += 1; continue }
644
+ let end = start
645
+ while (end + 1 < placed.length && placed[end + 1].lifted && placed[end + 1].position === placed[start].position) {
646
+ end += 1
647
+ }
648
+ const from = placed[start].position
649
+ const next = end + 1 < placed.length ? placed[end + 1].position : ceiling
650
+ const count = end - start + 1
651
+ for (let step = 0; step < count; step += 1) {
652
+ placed[start + step] = { ...placed[start + step], position: from + ((next - from) * (step + 1)) / (count + 1) }
653
+ }
654
+ start = end + 1
655
+ }
633
656
  // The bar is spatial, but node numbers stay chronological so the card and
634
657
  // the expanded list agree on which node is which.
635
- const closed = [...visibleEntries].sort((left, right) => Number(left.step.percent) - Number(right.step.percent))
658
+ const closed = placed
636
659
  const open = steps.length > 0 && steps[steps.length - 1] !== null && typeof steps[steps.length - 1] === 'object'
637
660
  ? { step: steps[steps.length - 1], index: steps.length - 1 }
638
661
  : undefined
@@ -658,14 +681,14 @@ window.__ModuleLoader__.load({
658
681
  const bucketKey = value => Math.round(Number(value || 0) * 2) / 2
659
682
  const buckets = new Map()
660
683
  for (const entry of closed) {
661
- const key = bucketKey(entry.step.percent)
684
+ const key = bucketKey(entry.position)
662
685
  const bucket = buckets.get(key)
663
686
  if (bucket === undefined) buckets.set(key, [entry])
664
687
  else bucket.push(entry)
665
688
  }
666
689
  const currentKey = bucketKey(currentPercent)
667
690
  const nodeOffset = entry => {
668
- const key = bucketKey(entry.step.percent)
691
+ const key = bucketKey(entry.position)
669
692
  const bucket = buckets.get(key) ?? []
670
693
  const rank = bucket.indexOf(entry)
671
694
  let offset = (rank - (bucket.length - 1) / 2) * 16
@@ -676,7 +699,7 @@ window.__ModuleLoader__.load({
676
699
  const edge = position => (position < 16 ? 'start' : position > 84 ? 'end' : undefined)
677
700
  for (const entry of closed) {
678
701
  const { step, index } = entry
679
- const position = railPosition(step.percent)
702
+ const position = railPosition(entry.position)
680
703
  const label = step.label || ''
681
704
  const took = durationText(t, step.durationMs)
682
705
  const finished = timeText(step.endedAt)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepslacker/dsh-task-progress",
3
- "version": "0.5.12",
3
+ "version": "0.5.13",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },