Skip to content

fix(pulse): make effort badge tier-aware (E1–E5) via a shared resolver#1399

Open
krikauskis wants to merge 1 commit into
danielmiessler:mainfrom
krikauskis:digibrain/fix-pulse-effort-tier
Open

fix(pulse): make effort badge tier-aware (E1–E5) via a shared resolver#1399
krikauskis wants to merge 1 commit into
danielmiessler:mainfrom
krikauskis:digibrain/fix-pulse-effort-tier

Conversation

@krikauskis

Copy link
Copy Markdown

What

Introduces src/lib/effort-tier.ts — a single resolveEffortTier() + tier class
maps — and rewires the three Observability renderers (EffortBadge,
PhaseDetailPanel, UnifiedWorkDashboard) to it, removing three copies of an
inline legacy quality→E-level map.

Why

work.json's effort field carries two vocabularies: a session-init placeholder
(standard/starting) and the real Algorithm tier written by ISASync (E1..E5).
The renderers only understood the legacy quality words, producing two bugs:

  1. A real tier (E3/E4) has no map key → the badge renders nothing
    (EffortBadge returns null; the ladder lights nothing).
  2. The not-yet-classified placeholder standard is mapped to E1 → a session that
    was never classified shows a confident, false "E1 STANDARD" badge.

Change

  • New src/lib/effort-tier.ts: resolveEffortTier(raw) maps E1..E5
    (case-insensitive) → that tier; legacy extended/advanced/deep/comprehensive
    their tier; everything else (incl. standard/starting) → a neutral pending
    state — never a false E1. Ships tier class maps (TIER_BADGE_CLASSES,
    TIER_TEXT_CLASSES, EFFORT_TIERS) as the single source of truth.
  • EffortBadge / PhaseDetailPanel / UnifiedWorkDashboard consume the resolver;
    their inline maps are deleted (DRY — one source of truth). EffortBadge gains a
    hidePending opt to render nothing for placeholders instead of a pending chip.

Testing

  • Visual: a session with effort="E3" now shows an E3 badge (was blank); a session
    with effort="standard" shows a neutral pending chip (was a false "E1 STANDARD").
  • resolveEffortTier is a pure function covering E1–E5 (any case), the four legacy
    words, and the never-false-E1 placeholder cases — straightforward to unit-test.

The only maintainer-taste call is cosmetic — whether a not-yet-classified session
shows a neutral "Pending" chip or renders nothing; hidePending supports both.

work.json's effort field carries two writer vocabularies: a session-init
placeholder (standard/starting) and the real Algorithm tier written by ISASync
(E1..E5). The three Observability renderers each hard-coded an inline legacy
quality->E-level map and never reconciled the two, producing two defects:

1. A real tier (E3/E4) had no map key -> EffortBadge returned null (no badge);
   the ladder lit nothing.
2. The placeholder 'standard' mapped to E1 -> an unclassified session showed a
   confident, false 'E1 STANDARD' badge.

Adds src/lib/effort-tier.ts (single resolveEffortTier() + tier class maps) and
rewires EffortBadge / PhaseDetailPanel / UnifiedWorkDashboard to it, deleting
three copies of the inline map. Placeholders now resolve to a neutral pending
state, never a false E1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant