Skip to content

fix(layout): document computeFaceOpacity dead branch and add full Vitest coverage for all 3 opacity paths#3665

Open
ChetanSenta wants to merge 2 commits into
JhaSourav07:mainfrom
ChetanSenta:fix/compute-face-opacity-dead-branch
Open

fix(layout): document computeFaceOpacity dead branch and add full Vitest coverage for all 3 opacity paths#3665
ChetanSenta wants to merge 2 commits into
JhaSourav07:mainfrom
ChetanSenta:fix/compute-face-opacity-dead-branch

Conversation

@ChetanSenta
Copy link
Copy Markdown
Contributor

Description

Fixes #3660

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

No visual change — this is a documentation and test coverage fix.
The SVG output is geometrically identical before and after.

What this PR does

computeFaceOpacity in lib/svg/layout.ts had a dead branch where
count === 0, isGhostCityMode === false returned the same value as
isGhostCityMode === true. The function had zero Vitest test coverage
despite being called for every single tower in the isometric grid.

This PR:

  1. Adds clarifying comments to both branches explaining that returning
    the same opacity is intentional design — empty days in active
    calendars should look visually quiet like ghost city towers
  2. Adds 11 Vitest unit tests covering all 3 branches with explicit
    regression guards so any future opacity change is caught immediately

Changes

File Change
lib/svg/layout.ts Added clarifying comments to ghost city and empty-day branches of computeFaceOpacity
lib/svg/layout.test.ts Added computeFaceOpacity describe block with 11 tests, added computeFaceOpacity to imports

Test results

Before: layout.test.ts had 23 tests, zero coverage for computeFaceOpacity
After: layout.test.ts has 34 tests, 100% branch coverage for computeFaceOpacity

Tests: 836 passed ✅
Coverage: branch coverage maintained at or above 70% ✅

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have starred the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord server for faster collaboration, mentorship, and PR support.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Jun 4, 2026

Someone is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jun 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

🚨 Hey @ChetanSenta, the CI Pipeline is failing on this PR and it has been marked as status:blocked.

Please fix the issues before this can be reviewed. Here's how:

1. Run checks locally before pushing:

npm run format:check   # Check Prettier formatting
npm run lint           # Run ESLint
npm run typecheck      # TypeScript type check
npm run test           # Run unit tests (Vitest)
npm run build          # Verify production build passes

2. Auto-fix common issues:

npm run format         # Auto-fix formatting with Prettier
npm run lint -- --fix  # Auto-fix lint errors where possible

3. Check the full failure log here:
👉 View CI Run

Once you push a fix and the CI passes, the status:blocked label will be removed automatically. 💪

@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jun 4, 2026
Copy link
Copy Markdown
Collaborator

@Aamod007 Aamod007 left a comment

Choose a reason for hiding this comment

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

LGTM! Great documentation and test coverage for the opacity logic.

@Aamod007 Aamod007 added level:intermediate Moderate complexity tasks gssoc26 mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests GSSoC 2026 and removed gssoc26 labels Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSSoC 2026 level:intermediate Moderate complexity tasks mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: computeFaceOpacity dead branch — count===0 non-ghost path returns identical output to ghost mode, making it unreachable and untested

2 participants