Skip to content

Add automated test coverage (pytest + vitest) - #38

Draft
kas1987 wants to merge 3 commits into
mainfrom
claude/test-coverage-analysis-wonkeu
Draft

Add automated test coverage (pytest + vitest)#38
kas1987 wants to merge 3 commits into
mainfrom
claude/test-coverage-analysis-wonkeu

Conversation

@kas1987

@kas1987 kas1987 commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

Establishes the first automated test suite for the project, which previously had zero unit tests. Also removes the PDR-first execution blocking rule from CLAUDE.md (and the matching hard gate in AGENTS.md) that this work surfaced.

Python — pytest + coverage (86% of scoped modules)

Covers the core data-pipeline and analytics library code:

  • build_db.py — folder/filename parsers (I/K/Fusion/SLE), code decoders, and a full build() integration run against a synthetic asset tree (SQLite catalog + JSON export).
  • build_profiles.py — WHR/BWR family classification (exact / tie / near / loose) and the full main() (profiles JSON, markdown, DB table, character manifests).
  • build_characters.py — torso/factory detection, tagline generation, and the full 4-slot-per-body character build (live + placeholder paths).
  • analytics_event_sanity.py — event loading (JSON array / NDJSON / errors), field/canonical validation, coverage math, threshold evaluation, and CLI main() exit codes.
  • build_sitemap.py, build_taxonomy.py, fetch_catalog.py — URL encoding, taxonomy generation, SKU/code extraction, mocked HTTP, and live-catalog matching.

One-shot ETL / web-scraper / report / local-server scripts are scoped out of the coverage gate (documented in pyproject.toml).

JavaScript — vitest + jsdom (93% of assets/site.js)

  • esc() HTML escaping (XSS), session-id handling, compare-set storage, analytics event normalization + aliasing, render helpers (charCard/bodyCard/metricsLegend), nav/footer mounting, and load() with mocked fetch.

CI

  • New steps run both suites with a 50% coverage gate (--cov-fail-under=50 and vitest thresholds).
  • node_modules, .coverage, and coverage reports are gitignored.

Test plan

  • python -m pytest --cov --cov-fail-under=50 → 86% (79 tests)
  • npm run coverage → 93% lines on assets/site.js (26 tests)

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the 'PDR-first execution' rule and its associated blocking behaviors from CLAUDE.md. The reviewer noted that this change introduces inconsistencies with other active documentation files, specifically AGENTS.md and README.md, which still reference the PDR_PATH requirement. It is recommended to update these files as well to maintain consistency.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread CLAUDE.md
@@ -1,17 +1 @@
# Claude Project Rules

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Removing the PDR-first execution rule from CLAUDE.md creates an inconsistency with other active documentation in the repository. Specifically, AGENTS.md (lines 7-13) and README.md (lines 109-111) still explicitly state that Claude tasks must include a PDR_PATH and adhere to the hard gate blocking behavior. To prevent conflicting instructions for the agent, these files should also be updated to remove or update references to this rule.

claude added 2 commits June 19, 2026 02:15
Establishes the first automated test coverage for the project:

- Python (pytest + coverage): 86% of the core data-pipeline and
  analytics modules — build_db, build_profiles, build_characters,
  analytics_event_sanity, build_sitemap, build_taxonomy, fetch_catalog.
  Covers folder/filename parsers, WHR/BWR family classification, the
  full build_db -> build_profiles -> build_characters pipeline against a
  synthetic asset tree, analytics validation, and live-catalog matching.
- JavaScript (vitest + jsdom): 93% of assets/site.js — esc() XSS
  escaping, session-id handling, compare-set storage, analytics event
  normalization, render helpers, nav/footer mounting, and load().
- CI runs both suites with a 50% coverage gate; coverage artifacts and
  node_modules are gitignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8FphWMYgbnCehv2bftHMB
@kas1987 kas1987 changed the title Remove PDR-first execution rule from CLAUDE.md Add automated test coverage (pytest + vitest) Jun 19, 2026
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