Skip to content

Fix: project path encoding inconsistency causing duplicate projects#102

Merged
bbsngg merged 2 commits intoOpenLAIR:mainfrom
renjie-liang:fix/project-path-encoding-dedup
Mar 26, 2026
Merged

Fix: project path encoding inconsistency causing duplicate projects#102
bbsngg merged 2 commits intoOpenLAIR:mainfrom
renjie-liang:fix/project-path-encoding-dedup

Conversation

@renjie-liang
Copy link
Copy Markdown
Contributor

Summary

  • Add . to encodeProjectPath regex so paths like /home/user.name/project produce the same ID as CLI-generated directory names
  • Add path-based dedup check in addProjectManually to prevent duplicates from legacy-encoded IDs

Root cause: encodeProjectPath used replace(/[\\:\s~_]/g, '-') which did not replace ., while CLI directory names replace all non-alphanumeric chars. Same path → different IDs → duplicate projects in database.

Closes #86

🤖 Generated with Claude Code

renjie-liang and others added 2 commits March 25, 2026 19:32
The encodeProjectPath regex was missing `.` in its replacement list,
causing paths like `/home/user.name/project` to produce different IDs
than CLI-generated directory names. This led to duplicate projects in
the database for the same path.

Also adds a path-based dedup check in addProjectManually to prevent
duplicates from legacy-encoded IDs.

Closes OpenLAIR#86

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…gacy IDs

- Replace inline regex in addProjectManually with encodeProjectPath() to
  eliminate duplication
- Add getProjectByPath() DB method using existing idx_projects_path index,
  replacing full-table scan via getAllProjects + find
- Proactively migrate legacy-encoded project IDs via migrateProjectIdentity()
  when path match is found with mismatched ID
- Add Playwright API tests for path encoding and dedup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bbsngg bbsngg merged commit c886cbe into OpenLAIR:main Mar 26, 2026
1 check passed
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.

CLI-created projects not visible in web UI + duplicate projects for same path

2 participants