system bug fixer

📁 chrysaliscat/designgraduation 📅 Jan 1, 1970
1
总安装量
0
周安装量
#49963
全站排名
安装命令
npx skills add https://github.com/chrysaliscat/designgraduation --skill System Bug Fixer

Skill 文档

System Bug Fixer Skill

1. Objective

To rapidly identify, isolate, and resolve system anomalies such as:

  • Service startup failures (Port conflicts, DB connection errors)
  • Persistent “Ghost” Data (Menu items that won’t disappear)
  • Logic inconsistencies between Frontend and Backend
  • Caching issues (Redis, Browser, Vuex)

2. Methodology

Phase 1: The Health Check (Stop & Clear)

Before debugging a weird issue, ensure the environment is clean.

  1. Kill Zombie Processes:
    taskkill /F /IM java.exe
    
  2. Clear Ports: Check if 8080/6379 are truly free.
  3. Restart Middleware: Restart Redis/MySQL if data seems “stuck”.
  4. Flush Logs: Rename backend.log (e.g., backend.log.old) to ensure you are reading fresh logs.

Phase 2: Deep Log Analysis

Do not trust the UI. Trust the Logs.

  1. Enable Debug Logging:
    • Add log.info("DEBUG_TRACE: Variable={}", var) in critical logical paths.
    • If utilizing MyBatis, inspect the ==> Preparing: SQL output.
  2. Result Verification:
    • Does <== Total: 0 match your expectation?
    • Did the code actually reach your log.info? If not, check try-catch blocks swallowing exceptions.

Phase 3: Data Integrity Verification

Code is often correct, but Data is wrong.

  1. Direct DB Query: Use MySQL CLI/Workbench to query the raw data.
    • Example: SELECT * FROM sys_menu WHERE menu_name LIKE '%Cart%';
    • Compare menu_id in DB vs Code Hardcoding.
  2. Cache vs Source:
    • Redis: FLUSHALL (in Dev) to rule out stale permissions.
    • User Permissions: Logout and Re-login to refresh Subject principal.

Phase 4: The “Nuclear” Option (Hardcoding & Isolation)

If logic seems inexplicably skipped:

  1. Isolate: Create a localized test case (e.g., a specific if block).
  2. Hardcode: Temporarily hardcode IDs to confirm control.
    • Example: if (id == 2021) remove();
  3. Broaden Scope: Use toLowerCase() and .contains() instead of equals().

3. Common Fix Patterns (RuoYi Specific)

Menu/Permission Persistence

  • Symptom: Menu visible after Role revocation.
  • Fix: Check SysMenuServiceImpl.selectMenuTreeByUserId. Ensure getChildPerms isn’t caching an old tree. Force backend restart.

Port In Use (8080)

  • Symptom: “Web server failed to start”.
  • Fix:
    netstat -ano | findstr :8080
    taskkill /PID <PID> /F
    

Frontend Not Updating

  • Symptom: Code changed, UI stuck.
  • Fix: npm run build:prod might be needed if not running dev. Disable Browser Cache (DevTools -> Network -> Disable Cache).

4. Verification

After applying a fix:

  1. Clean Start: Restart backend.
  2. Clean Login: Logout -> Clear Browser Cache -> Login.
  3. Log Confirmation: Verify the specific log entry for the fix appears.