Skip to content

fix(dashboard): handle dict-shaped _catalog.json (v4.3+ schema)#7

Merged
Luispitik merged 1 commit into
Luispitik:mainfrom
NestorPVsf:fix/dashboard-catalog-dict-shape
Apr 18, 2026
Merged

fix(dashboard): handle dict-shaped _catalog.json (v4.3+ schema)#7
Luispitik merged 1 commit into
Luispitik:mainfrom
NestorPVsf:fix/dashboard-catalog-dict-shape

Conversation

@NestorPVsf

Copy link
Copy Markdown
Contributor

Summary

collect_skills() in core/_generate-dashboard.py assumed _catalog.json is a flat list, but the v4.3+ schema uses a dict with globalSkills / librarySkills arrays. Iterating over a dict yielded its keys (strings), so the very first /dashboard-sinapsis run on any fresh v4.4.1 install crashes with:

AttributeError: 'str' object has no attribute 'get'
  File "_generate-dashboard.py", line 130, in collect_skills
    stubs = sum(1 for s in cat if s.get('description', '').startswith('(auto-generated'))

Fix

collect_skills() now detects both shapes:

  • dict (v4.3+) → sum globalSkills + librarySkills, derive real global count
  • list (legacy) → unchanged fallback behaviour
  • All .get() calls guarded with isinstance(s, dict) so mixed content never crashes

Reproduction

  1. Fresh install of v4.4.1 (bash install.sh)
  2. python ~/.claude/skills/_generate-dashboard.py → AttributeError
  3. After patch → dashboard generated cleanly with real skill counts
[OK] Dashboard written: ~/.claude/skills/_dashboard.html
     Skills:      3  (3 global / 0 complete / 0 stubs)

Test plan

  • Reproduced crash on real user install (v4.4.1)
  • Patched file, regenerated dashboard — all 8 KPIs populated
  • Maintainer: run tests/test-dashboard.sh (I didn't update the fixture — worth confirming the existing 12 tests still pass; the fix is backwards compatible with list-shaped input)

Related to #4 (v4.4.0 dashboard introduction). Follows the pattern of #3 (upstream regression sweep).

🤖 Generated with Claude Code

collect_skills() assumed _catalog.json is a flat list, but v4.3+ uses a
dict with globalSkills/librarySkills arrays. Iterating over dict keys
yielded strings, causing AttributeError: 'str' object has no attribute
'get' on the first run in any install with the current schema.

Now detects both shapes:
- dict → sum globalSkills + librarySkills, use real global count
- list → legacy fallback (unchanged behavior)

Also guards .get() with isinstance check so mixed content never crashes.

Reproduced on fresh v4.4.1 install. /dashboard-sinapsis now runs green.
@Luispitik Luispitik merged commit 53c3c53 into Luispitik:main Apr 18, 2026
3 checks passed
Luispitik added a commit that referenced this pull request Apr 18, 2026
CHANGELOG: add v4.4.2 entry documenting the regression fix from #7.
README: bump 4.4.1 -> 4.4.2 (tests stay at 99, PR #7 was code-only).

Fix resuelve issue #6 (crash on /dashboard-sinapsis first run).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Luispitik Luispitik mentioned this pull request Apr 18, 2026
2 tasks
Luispitik added a commit that referenced this pull request Apr 18, 2026
CHANGELOG: add v4.4.2 entry documenting the regression fix from #7.
README: bump 4.4.1 -> 4.4.2 (tests stay at 99, PR #7 was code-only).

Fix resuelve issue #6 (crash on /dashboard-sinapsis first run).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants