Skip to content

Develop#16

Closed
exrienz wants to merge 5 commits intomainfrom
develop
Closed

Develop#16
exrienz wants to merge 5 commits intomainfrom
develop

Conversation

@exrienz
Copy link
Owner

@exrienz exrienz commented Dec 15, 2025

PR Type

Enhancement, Tests


Description

  • Add time-based urgency boosts for approaching due dates

    • Stepped bonuses at 1 month, 1 week, 3 days, and 1 day thresholds
  • Implement delete confirmation dialog to prevent accidental data loss

  • Update CI/CD pipeline to build on develop branch

  • Document scoring algorithm and UX learnings


Diagram Walkthrough

flowchart LR
  A["Task Scoring<br/>Algorithm"] -->|"Add Time-Based<br/>Boosts"| B["Enhanced<br/>Urgency Calculation"]
  C["Delete Action"] -->|"Add Confirmation<br/>Dialog"| D["Safer User<br/>Experience"]
  E["CI/CD Pipeline"] -->|"Include develop<br/>Branch"| F["Automated Builds"]
  G["Documentation"] -->|"Update README &<br/>Palette Journal"| H["Improved<br/>Knowledge Base"]
Loading

File Walkthrough

Relevant files
Enhancement
index.php
Add time boosts and delete confirmation                                   

src/index.php

  • Enhanced urgency scoring with stepped time-based boosts (1 month, 1
    week, 3 days, 1 day)
  • Added delete confirmation dialog using native browser confirm() to
    prevent accidental task deletion
  • Improved code comments for clarity on urgency calculation logic
+19/-4   
Documentation
palette.md
Track UX learnings and design patterns                                     

.Jules/palette.md

  • Created new UX learnings journal documenting design decisions
  • Documented delete confirmation pattern as critical safety feature
  • Noted form accessibility best practices for future implementation
+9/-0     
README.md
Document enhanced urgency scoring algorithm                           

README.md

  • Added documentation for new time-based urgency boost values
  • Updated urgency calculation pseudocode to reflect stepped boost logic
  • Clarified scoring algorithm with concrete boost thresholds
+16/-1   
Configuration changes
main.yml
Enable CI/CD for develop branch                                                   

.github/workflows/main.yml

  • Extended CI/CD pipeline to trigger builds on both main and develop
    branches
  • Enables automated Docker image publishing for development branch
+1/-1     

exrienz and others added 5 commits June 23, 2025 08:15
- Added a browser-native confirmation dialog to the task delete action to prevent accidental data loss.
- Created .Jules/palette.md to track UX learnings.
…998117011936505

🎨 Palette: Add Delete Confirmation
@qodo-code-review
Copy link

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
Delete auditing: The new delete form adds a confirmation but there is no evidence that the delete action is
logged with user, timestamp, and outcome for audit purposes.

Referred Code
<form method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this task?');">
    <input type="hidden" name="task_id" value="<?= $task['id'] ?>">
    <button type="submit" name="delete_task" class="btn btn-sm btn-outline-danger">Delete</button>
</form>

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Date edge cases: New urgency logic relies on due date parsing and day calculations without visible handling
for invalid or missing dates, which may cause errors or incorrect scores.

Referred Code
// Urgency calculation with stepped boosts as the due date approaches
if ($daysLeft < 0) {
    $urgencyScore = $OVERDUE_BOOST;
} else {
    $urgencyScore = $URGENCY_MAX / (1 + $daysLeft);
    if ($daysLeft <= 1) {
        $urgencyScore += $BOOST_1_DAY;
    } elseif ($daysLeft <= 3) {
        $urgencyScore += $BOOST_3_DAYS;
    } elseif ($daysLeft <= 7) {
        $urgencyScore += $BOOST_1_WEEK;
    } elseif ($daysLeft <= 30) {
        $urgencyScore += $BOOST_1_MONTH;
    }
}

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Form validation: The delete form submission adds a client-side confirm but shows no server-side validation
or CSRF protection in the new code, which may risk insecure input handling.

Referred Code
<form method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this task?');">
    <input type="hidden" name="task_id" value="<?= $task['id'] ?>">
    <button type="submit" name="delete_task" class="btn btn-sm btn-outline-danger">Delete</button>
</form>

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Centralize scoring algorithm configuration values

Centralize the hardcoded time-based urgency boost values, currently duplicated
in src/index.php and README.md, into a single configuration file. This will act
as a single source of truth, improving maintainability and preventing
inconsistencies.

Examples:

src/index.php [116-119]
    $BOOST_1_MONTH = 5;   // <= 30 days
    $BOOST_1_WEEK  = 10;  // <= 7 days
    $BOOST_3_DAYS  = 20;  // <= 3 days
    $BOOST_1_DAY   = 30;  // <= 1 day
README.md [29-32]
  - 1 month left: +5
  - 1 week left: +10
  - 3 days left: +20
  - 1 day left: +30

Solution Walkthrough:

Before:

// In src/index.php
function calculateTaskScore($task) {
    // ...
    $BOOST_1_MONTH = 5;
    $BOOST_1_WEEK  = 10;
    $BOOST_3_DAYS  = 20;
    $BOOST_1_DAY   = 30;

    if ($daysLeft <= 1) {
        $urgencyScore += $BOOST_1_DAY;
    } // ... and so on
}

// In README.md
- Due date boosts:
  - 1 month left: +5
  - 1 week left: +10
  - 3 days left: +20
  - 1 day left: +30

After:

// In a new config.php file
define('BOOST_1_DAY', 30);
define('BOOST_3_DAYS', 20);
define('BOOST_1_WEEK', 10);
define('BOOST_1_MONTH', 5);
// ... other scoring constants

// In src/index.php
require_once 'config.php';
function calculateTaskScore($task) {
    // ...
    if ($daysLeft <= 1) {
        $urgencyScore += BOOST_1_DAY;
    } // ... and so on
}

// README.md is now updated by referring to the single source of truth in config.php
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies duplicated configuration values in the code and documentation, which poses a significant long-term maintenance risk of them becoming inconsistent.

Medium
General
Improve delete confirmation with task name

Improve the delete confirmation dialog by including the task name. Ensure the
task name is escaped using htmlspecialchars to prevent potential XSS
vulnerabilities.

src/index.php [237]

-<form method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this task?');">
+<form method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this task: \'<?= htmlspecialchars($task['task_name'], ENT_QUOTES) ?>\'?');">
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: This is a valuable suggestion that improves user experience by making the delete confirmation more specific, and it correctly includes a security best practice by using htmlspecialchars to prevent XSS.

Medium
Optimize by calculating timestamp once

To improve performance, calculate the current day's timestamp once outside the
task processing loop and pass it into the calculateTaskScore function, avoiding
redundant calculations.

src/index.php [107]

-$daysLeft    = ceil((strtotime($task['due_date']) - strtotime(date('Y-m-d'))) / 86400);
+$todayTimestamp = strtotime(date('Y-m-d'));
+$daysLeft    = ceil((strtotime($task['due_date']) - $todayTimestamp) / 86400);

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 4

__

Why: The suggestion correctly identifies a performance inefficiency by repeatedly calling strtotime(date('Y-m-d')) within a loop and proposes a valid optimization, though its impact is minor unless dealing with a very large number of tasks.

Low
  • More

@exrienz exrienz closed this Dec 15, 2025
@exrienz exrienz deleted the develop branch December 15, 2025 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant