DevPath icon indicating copy to clipboard operation
DevPath copied to clipboard

[Bug]: Duplicate project IDs in projects.json cause ambiguous project lookup

Open nrynmish opened this issue 6 months ago • 9 comments

What happened?

Bug Description

Several entries in data/projects.json use duplicate project IDs.

Current duplicates:

  • ID 8 appears twice
  • ID 9 appears three times
  • ID 10 appears twice

The application uses project IDs for project lookup via get_project_by_id(...).

Because IDs are not unique, only the first matching project is returned during lookup.

Steps to Reproduce

  1. Open data/projects.json

  2. Observe duplicate IDs:

    • 8
    • 9
    • 10
  3. Start the application

  4. Navigate to:

    /project/8

Expected Behavior

Each project should have a unique identifier and be individually accessible.

Actual Behavior

The first matching project is returned. Projects sharing the same ID become unreachable.

Impact

Affected routes may include:

  • /project/<id>
  • /project/<id>/code
  • /project/<id>/download

This can result in:

  • Incorrect project detail pages
  • Incorrect starter code downloads
  • Recommendation links resolving to the wrong project

Suggested Fix

  1. Ensure all project IDs are unique.
  2. Add a dataset validation test that fails when duplicate IDs are present.

Example test:

ids = [project["id"] for project in projects]
assert len(ids) == len(set(ids))

### Steps to reproduce


1. Open `data/projects.json`.

2. Search for duplicate IDs:
   - ID 8 appears twice
   - ID 9 appears three times
   - ID 10 appears twice

3. Start the application:

   ```bash
   python app.py

### Expected behaviour

Each project should have a unique ID and be individually accessible through the project detail route.

### Area of the app affected

Project detail page

### Python version

Python 3.12.3

### Operating system

Ubuntu 24.04

### Relevant error output or logs

```shell

Before submitting

  • [x] I searched existing issues and this has not been reported before.
  • [x] I can reproduce this bug consistently with the steps above.
  • [x] I am running the latest version of the main branch.

nrynmish avatar Jun 03 '26 22:06 nrynmish

Thank you for opening your first issue in DevPath.

Please make sure to:

  • Read CONTRIBUTING.md
  • Wait for assignment before starting work
  • Follow repository guidelines carefully

Happy contributing.

github-actions[bot] avatar Jun 03 '26 22:06 github-actions[bot]

Hi, I am a GSSoC 2026 contributor and would like to work on this issue. Can I get it assigned to me?

prerendrarahitya1708 avatar Jun 04 '26 05:06 prerendrarahitya1708

Hi @komalharshita Mentor, I'm a registered GSSoC contributor. My local environment is fully configured and ready. Please assign this task to me!

Stewartsson avatar Jun 04 '26 07:06 Stewartsson

@komalharshita if yu find the issue ready to be worked upon please assign it to me

nrynmish avatar Jun 04 '26 10:06 nrynmish

Hi, I am a contributor under GSSoC'26 and would like to work on this issue. Could you please assign it to me?

Stewartsson avatar Jun 04 '26 11:06 Stewartsson

Hi! I'd like to work on this issue under GSSoC 2026.

Approach: I'll deduplicate the project IDs in data/projects.json by assigning unique sequential IDs to the conflicting entries (IDs 8, 9, 10), then update get_project_by_id(...) in app.py to use a dictionary-based lookup for O(1) access and early error detection. Finally, I'll add a Pytest validation test that asserts all project IDs are unique to prevent regression.

I have experience with Python, Flask, and data validation. Please assign me this issue.

PranavAgarkar07 avatar Jun 04 '26 16:06 PranavAgarkar07

Hi @komalharshita, I reproduced this issue locally and identified the duplicate project IDs causing the conflict. I'd like to work on this issue under GSSoC 2026. Could you please assign it to me? Thank you!

Harshitabansal123 avatar Jun 08 '26 15:06 Harshitabansal123

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

github-actions[bot] avatar Nov 13 '26 07:11 github-actions[bot]

This issue was closed because it has been inactive for an extended period. If this issue is still relevant, feel free to reopen it or create a new one.

github-actions[bot] avatar Nov 20 '26 08:11 github-actions[bot]