Skip to content

LaunchDesk Class - Debugging Exercise#5

Open
Kavishka Weerasinghe (KavishkaWeerasinghe2001) wants to merge 12 commits into
codezelaca:mainfrom
KavishkaWeerasinghe2001:main
Open

LaunchDesk Class - Debugging Exercise#5
Kavishka Weerasinghe (KavishkaWeerasinghe2001) wants to merge 12 commits into
codezelaca:mainfrom
KavishkaWeerasinghe2001:main

Conversation

@KavishkaWeerasinghe2001
Copy link
Copy Markdown

@KavishkaWeerasinghe2001 Kavishka Weerasinghe (KavishkaWeerasinghe2001) commented May 11, 2026

Summary by CodeRabbit

Release Notes

  • Documentation

    • Updated instructor guide with comprehensive debugging procedures and test scenarios.
  • Bug Fixes

    • Fixed form submission handler and validation logic.
    • Expanded search to cover multiple data fields.
    • Corrected status filtering and badge display.
    • Fixed metrics calculations for completion and due-date tracking.
    • Resolved data persistence and storage key inconsistencies.
    • Corrected CSV export field mapping.
  • Chores

    • Updated development server script.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

📝 Walkthrough

Walkthrough

This pull request fixes twelve interconnected bugs in the launch-checks application and updates instructor documentation. Key fixes include unifying localStorage keys, correcting form validation and submit handler spelling, expanding search filtering across multiple fields, fixing status filter logic, adjusting metrics calculations, aligning row action dataset keys, persisting status changes, and correcting demo fetch and CSV export paths.

Changes

Launch-Checks Application Fixes

Layer / File(s) Summary
Storage Key Consolidation
js/app.js, docs/instructor-solution-guide.md
Replace separate STORAGE_SAVE_KEY and STORAGE_LOAD_KEY constants with a single STORAGE_KEY in loadChecks() and saveChecks() to eliminate localStorage mismatches.
Form Submission and Validation
js/app.js
Fix form submit handler to call handleAddCheck (correcting misspelling) and update validation to reject when either title or category is missing.
Search and Status Filtering
js/app.js
Expand free-text search to match owner, title, category, priority, and status fields; correct status filter to use check.status instead of check.priority.
Badge and Option Rendering
js/app.js
Slugify status badge CSS classes to handle spaces (e.g., "In Progress" → "in-progress") and restructure status select option construction.
Metrics Calculation
js/app.js
Update "fixed" count to use status === "Fixed" and fix "due soon" logic to count items due within 7 days using <= 7.
Row Actions and State Persistence
js/app.js
Align delete button event delegation to use data-remove-id/dataset.removeId and modify status changes to persist via saveChecks() and refresh via applyFilters().
Demo Reset and CSV Export
js/app.js
Fix demo reset to fetch from data/launch-checks.json and correct CSV export to use check.title instead of check.name.
Development Setup
package.json
Update dev npm script to use python instead of python3 for http.server, while keeping start script unchanged.
Instructor Documentation
docs/instructor-solution-guide.md
Add detailed debugging coverage matrix, recommended fix order, expected final working state, instructor smoke test, and step-by-step code-level fixes for all twelve bugs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Twelve little bugs scattered here and there,
Storage keys tangled, filters in despair!
Fixed with precision—one key, one way,
Metrics and badges now work today!
A student's debug guide, complete and bright,
The checklist app shines—now everything's right! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main purpose of the changes—documenting a debugging exercise with specific bug fixes and instructor guidance for the LaunchDesk class application.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
js/app.js (1)

1-2: ⚡ Quick win

Remove or clarify the outdated comment.

The comment on Line 2 states "this key should match STORAGE_KEY," but there is only one STORAGE_KEY constant defined. This comment appears to be a remnant from when there were two separate keys (for saving and loading). Since the bug is now fixed, the comment is misleading.

🧹 Proposed fix
 const STORAGE_KEY = "launchdesk-v1-items";
-// Intentional bug: this key should match STORAGE_KEY.

Or update to clarify the teaching intent:

 const STORAGE_KEY = "launchdesk-v1-items";
-// Intentional bug: this key should match STORAGE_KEY.
+// Fixed: unified storage key (previously had separate save/load keys).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@js/app.js` around lines 1 - 2, The trailing comment next to the STORAGE_KEY
constant is outdated and misleading; remove the comment or replace it with a
short, accurate note (e.g., "key used for local storage of items" or a brief
teaching note) so it no longer implies a second key exists; locate the const
STORAGE_KEY declaration and update or delete the adjacent comment accordingly.
docs/instructor-solution-guide.md (1)

240-241: ⚡ Quick win

Clarify the broken code example for localStorage keys.

Lines 240-241 both declare const STORAGE_KEY = with different values, which would be a syntax error. The documentation should clarify that these represent two different constants that were originally in the code (e.g., STORAGE_SAVE_KEY and STORAGE_LOAD_KEY), or show this as a before/after comparison more clearly.

📝 Suggested clarification
-- Broken constants:
+- Broken code (two different keys were defined):

 ```js
-const STORAGE_KEY = "launchdesk-v1-items";
-const STORAGE_KEY = "launchdesk-items-v1";
+const STORAGE_SAVE_KEY = "launchdesk-v1-items";
+const STORAGE_LOAD_KEY = "launchdesk-items-v1";
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @docs/instructor-solution-guide.md around lines 240 - 241, The docs show two
conflicting const declarations for STORAGE_KEY which is a syntax error; update
the example to clarify intent by renaming them to distinct identifiers (e.g.,
STORAGE_SAVE_KEY and STORAGE_LOAD_KEY) or present them explicitly as a
before/after diff so readers see the change; locate the duplicated STORAGE_KEY
lines and replace the second with a clear alternative name (or wrap the pair in
a before/after block) to remove the duplicate declaration and make the example
unambiguous.


</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @js/app.js:

  • Line 242: The dueSoon calculation currently counts overdue items because it
    only checks daysUntil(check.dueDate) <= 7; update the filter in the dueSoon
    computation (the checks.filter callback where daysUntil is called) to ensure the
    returned days are non-negative and at most 7 (e.g., compute days =
    daysUntil(check.dueDate) and require days >= 0 && days <= 7) so only items due
    within the next 7 days are counted and overdue items are excluded.

In @package.json:

  • Around line 7-8: The npm scripts are inconsistent: "dev" uses python while
    "start" uses python3; update the package.json scripts so both "dev" and "start"
    use the same Python executable (prefer python3 for modern environments) to avoid
    Python2 fallback; edit the "dev" entry to match "start" (or vice versa) so both
    scripts run "python3 -m http.server 5173" and save the file.

Nitpick comments:
In @docs/instructor-solution-guide.md:

  • Around line 240-241: The docs show two conflicting const declarations for
    STORAGE_KEY which is a syntax error; update the example to clarify intent by
    renaming them to distinct identifiers (e.g., STORAGE_SAVE_KEY and
    STORAGE_LOAD_KEY) or present them explicitly as a before/after diff so readers
    see the change; locate the duplicated STORAGE_KEY lines and replace the second
    with a clear alternative name (or wrap the pair in a before/after block) to
    remove the duplicate declaration and make the example unambiguous.

In @js/app.js:

  • Around line 1-2: The trailing comment next to the STORAGE_KEY constant is
    outdated and misleading; remove the comment or replace it with a short, accurate
    note (e.g., "key used for local storage of items" or a brief teaching note) so
    it no longer implies a second key exists; locate the const STORAGE_KEY
    declaration and update or delete the adjacent comment accordingly.

</details>

<details>
<summary>🪄 Autofix (Beta)</summary>

Fix all unresolved CodeRabbit comments on this PR:

- [ ] <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended)
- [ ] <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: Organization UI

**Review profile**: CHILL

**Plan**: Pro Plus

**Run ID**: `b7d3b7da-e8ad-4feb-a960-b2205a3ed381`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between ccb0d19576026476f7d69e2381775937746f70e2 and 95bf7b7911329865a4d83e8049c9c5c5e9a076bb.

</details>

<details>
<summary>📒 Files selected for processing (3)</summary>

* `docs/instructor-solution-guide.md`
* `js/app.js`
* `package.json`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment thread js/app.js
(check) => check.priority === "Critical" && check.status !== "Fixed",
).length;
const dueSoon = checks.filter((check) => daysUntil(check.dueDate) > 7).length; // Intentional bug: this should count items due within 7 days.
const dueSoon = checks.filter((check) => daysUntil(check.dueDate) <= 7).length; // Intentional bug: this should count items due within 7 days.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix incomplete: "Due soon" metric includes overdue items.

The current logic daysUntil(check.dueDate) <= 7 will incorrectly count items with negative days (overdue items). According to the instructor guide (lines 181-184), the fix should also verify that days are non-negative.

🐛 Complete the fix
-  const dueSoon = checks.filter((check) => daysUntil(check.dueDate) <= 7).length; // Intentional bug: this should count items due within 7 days.
+  const dueSoon = checks.filter((check) => {
+    const days = daysUntil(check.dueDate);
+    return days >= 0 && days <= 7;
+  }).length;

This ensures only items due in the future within 7 days are counted, excluding overdue items.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const dueSoon = checks.filter((check) => daysUntil(check.dueDate) <= 7).length; // Intentional bug: this should count items due within 7 days.
const dueSoon = checks.filter((check) => {
const days = daysUntil(check.dueDate);
return days >= 0 && days <= 7;
}).length;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@js/app.js` at line 242, The dueSoon calculation currently counts overdue
items because it only checks daysUntil(check.dueDate) <= 7; update the filter in
the dueSoon computation (the checks.filter callback where daysUntil is called)
to ensure the returned days are non-negative and at most 7 (e.g., compute days =
daysUntil(check.dueDate) and require days >= 0 && days <= 7) so only items due
within the next 7 days are counted and overdue items are excluded.

Comment thread package.json
Comment on lines +7 to 8
"dev": "python -m http.server 5173",
"start": "python3 -m http.server 5173"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Inconsistent Python command between dev and start scripts.

The dev script uses python while start uses python3. On systems where python points to Python 2.x, the dev script will fail. For consistency and compatibility, both should use the same command.

🔧 Proposed fix
-    "dev": "python -m http.server 5173",
+    "dev": "python3 -m http.server 5173",
     "start": "python3 -m http.server 5173"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"dev": "python -m http.server 5173",
"start": "python3 -m http.server 5173"
"dev": "python3 -m http.server 5173",
"start": "python3 -m http.server 5173"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 7 - 8, The npm scripts are inconsistent: "dev"
uses python while "start" uses python3; update the package.json scripts so both
"dev" and "start" use the same Python executable (prefer python3 for modern
environments) to avoid Python2 fallback; edit the "dev" entry to match "start"
(or vice versa) so both scripts run "python3 -m http.server 5173" and save the
file.

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