-
Notifications
You must be signed in to change notification settings - Fork 11
fix: resolve multiple core logic and UI bugs in launch readiness checker #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
bd141e9
254c8e9
3b2b7ee
0f9208f
91fa9b4
7d4699e
180f81d
50b5e93
d8c8c30
7254ac5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| const STORAGE_SAVE_KEY = "launchdesk-v1-items"; | ||
| const STORAGE_LOAD_KEY = "launchdesk-items-v1"; // Intentional bug: this key should match STORAGE_SAVE_KEY. | ||
| const STORAGE_LOAD_KEY = "launchdesk-v1-items"; // Intentional bug: this key should match STORAGE_SAVE_KEY. | ||
|
|
||
| const demoChecks = [ | ||
| { | ||
|
|
@@ -91,7 +91,7 @@ const activityLog = document.getElementById("activityLog"); | |
| let checks = loadChecks(); | ||
| let currentView = checks; | ||
|
|
||
| form.addEventListener("submit", (event) => handleAddChek(event)); // Intentional bug: misspelled function name. | ||
| form.addEventListener("submit", (event) => handleAddCheck(event)); // Intentional bug: misspelled function name. | ||
| searchInput.addEventListener("input", applyFilters); | ||
| statusFilter.addEventListener("change", applyFilters); | ||
| priorityFilter.addEventListener("change", applyFilters); | ||
|
|
@@ -132,7 +132,7 @@ function handleAddCheck(event) { | |
| const owner = ownerInput.value.trim() || "Unassigned"; | ||
| const dueDate = dueDateInput.value || new Date().toISOString().slice(0, 10); | ||
|
|
||
| if (!title && !category) { | ||
| if (!title || !category) { | ||
| // Intentional bug: validation should stop when either required field is missing. | ||
| formMessage.textContent = | ||
| "Please enter a check title and choose a category."; | ||
|
|
@@ -163,12 +163,17 @@ function applyFilters() { | |
| const selectedStatus = statusFilter.value; | ||
| const selectedPriority = priorityFilter.value; | ||
|
|
||
| let filtered = checks.filter((check) => | ||
| check.owner.toLowerCase().includes(searchTerm), | ||
| let filtered = checks.filter( | ||
| (check) => | ||
| check.owner.toLowerCase().includes(searchTerm) || | ||
| check.category.toLowerCase().includes(searchTerm) || | ||
| check.priority.toLowerCase().includes(searchTerm) || | ||
| check.status.toLowerCase().includes(searchTerm) || | ||
| check.title.toLowerCase().includes(searchTerm), | ||
| ); // Intentional bug: search should include title, category, priority, status, and owner. | ||
|
|
||
| if (selectedStatus !== "All") { | ||
| filtered = filtered.filter((check) => check.priority === selectedStatus); | ||
| filtered = filtered.filter((check) => check.status === selectedStatus); | ||
| } // Intentional bug: status filter compares against priority. | ||
|
|
||
| if (selectedPriority !== "All") { | ||
|
|
@@ -191,7 +196,7 @@ function renderRows(list) { | |
|
|
||
| const rows = list.map((check) => { | ||
| const priorityClass = `priority-${check.priority.toLowerCase()}`; | ||
| const statusClass = `status-${check.status.toLowerCase()}`; // Intentional bug: "In Progress" needs a slug class. | ||
| const statusClass = `status-${check.status.toLowerCase().replaceAll(" ", "-")}`; // Intentional bug: "In Progress" needs a slug class. | ||
|
|
||
| return ` | ||
| <tr> | ||
|
|
@@ -217,7 +222,7 @@ function renderRows(list) { | |
| ) | ||
| .join("")} | ||
| </select> | ||
| <button class="icon-button" type="button" data-remove-id="${check.id}" title="Delete check"> | ||
| <button class="icon-button" type="button" data-delete-id="${check.id}" title="Delete check"> | ||
| x | ||
| </button> | ||
| </span> | ||
|
|
@@ -231,11 +236,11 @@ function renderRows(list) { | |
|
|
||
| function updateMetrics() { | ||
| const total = checks.length; | ||
| const fixed = checks.filter((check) => check.status === "Complete").length; // Intentional bug: valid fixed status is "Fixed". | ||
| const fixed = checks.filter((check) => check.status === "Fixed").length; // Intentional bug: valid fixed status is "Fixed". | ||
| const criticalOpen = checks.filter( | ||
| (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. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Due Soon" still counts overdue items.
If the intent is "due in the next 7 days" only, add a lower bound; if "overdue or due within 7 days" is intentional, consider renaming the label so the dashboard isn't ambiguous. 🛠️ Suggested fix- const dueSoon = checks.filter((check) => daysUntil(check.dueDate) < 7).length;
+ const dueSoon = checks.filter((check) => {
+ const days = daysUntil(check.dueDate);
+ return days >= 0 && days <= 7;
+ }).length;Also applies to: 356-361 🤖 Prompt for AI Agents |
||
| const score = total === 0 ? 0 : Math.round((fixed / total) * 100); | ||
|
|
||
| totalCount.textContent = total; | ||
|
|
@@ -276,7 +281,8 @@ function handleStatusChange(event) { | |
| } | ||
|
|
||
| check.status = statusSelect.value; | ||
| renderRows(currentView); | ||
| saveChecks(); | ||
| applyFilters(); | ||
| logActivity(`Changed "${check.title}" to ${check.status}.`); | ||
| // Intentional bug: status changes should save, update filters, and refresh metrics. | ||
| } | ||
|
|
@@ -285,7 +291,7 @@ async function resetDemoData() { | |
| formMessage.textContent = ""; | ||
|
|
||
| try { | ||
| const response = await fetch("data/launch-seed.json"); // Intentional bug: real file is data/launch-checks.json. | ||
| const response = await fetch("data/launch-checks.json"); // Intentional bug: real file is data/launch-checks.json. | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error(`Demo data request failed with ${response.status}`); | ||
|
|
@@ -312,7 +318,7 @@ function exportCsv() { | |
| "Due Date", | ||
| ]; | ||
| const rows = currentView.map((check) => [ | ||
| check.name, // Intentional bug: property should be check.title. | ||
| check.title, // Intentional bug: property should be check.title. | ||
| check.category, | ||
| check.priority, | ||
| check.status, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |||||||||
| "private": true, | ||||||||||
| "description": "A polished but intentionally broken website launch readiness checker for debugging practice.", | ||||||||||
| "scripts": { | ||||||||||
| "dev": "python3 -m http.server 5173", | ||||||||||
| "start": "python3 -m http.server 5173" | ||||||||||
| "dev": "python -m http.server 5173", | ||||||||||
| "start": "python -m http.server 5173" | ||||||||||
|
Comment on lines
+7
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: On macOS 14 (macOS Sonoma), the standard/Apple-provided executable name is python3 (e.g., /usr/bin/python3). There is no general guarantee that python (without 3) is present or points to Python 3 by default; many systems only provide python3 and recommend not relying on python. [1] On Ubuntu 22.04, the standard OS-provided executable name is also python3 by default (/usr/bin/python3 points to a specific Python 3.x via a symlink). In contrast, the python command (without 3) is typically not available as a default Python 3 interpreter unless the system admin installs/configures a compatibility package (e.g., python-is-python3) or creates alternatives/symlinks. [2][3] So, in 2025 for those defaults: prefer python3 on both macOS 14 and Ubuntu 22.04; python is not the default “standard” executable name in general. [1][2][3] Citations:
Revert Using Suggested change- "dev": "python -m http.server 5173",
- "start": "python -m http.server 5173"
+ "dev": "python3 -m http.server 5173",
+ "start": "python3 -m http.server 5173"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| } | ||||||||||
| } | ||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Remove the stale
// Intentional bug:comments — they now describe the fixed behavior and will mislead future readers.After the fixes in this PR, every "Intentional bug" comment is no longer true. They were useful as bug markers in the original lab scaffold, but in the corrected code they now read as instructions to re-introduce the bug (e.g., line 136 says "validation should stop when either required field is missing" — which is exactly what the code now does, so the comment reads as a complaint about correct code). The same applies to lines 2, 94, 173, 177, 199, 239, 243, 255, 287, 294, and 321.
Sweep the file and remove (or rewrite) these markers so the remaining comments describe what the code is, not the historical bug.
♻️ Representative cleanups
logActivity(`Changed "${check.title}" to ${check.status}.`); - // Intentional bug: status changes should save, update filters, and refresh metrics. }Also applies to: 94-94, 135-140, 173-173, 177-177, 199-199, 239-239, 243-243, 255-255, 287-288, 294-294, 321-321
🤖 Prompt for AI Agents