Skip to content

mberjans/itcbt_website_test

Repository files navigation

ITCBT Website Test - Empty Team Page Bug Reproduction

Purpose

This is a minimal test repository that reproduces the "empty team page" bug from the ITCBT website. The purpose is to test AI coding assistants' ability to diagnose why the team page shows no team members.

The Problem

Symptom: When you visit /team, the page loads but shows no team members (empty list).

Expected: The page should display 8-9 team members from the database.

Challenge: Can you identify the root cause and create a plan to fix it?

Setup

# Create virtual environment
python3.10 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Run the application
export FLASK_APP=app.py
python -m flask run --port 5001

Test the Bug

Visit: http://127.0.0.1:5001/team

You should see an empty team page or "No team members found" message.

Your Task

  1. Diagnose: Identify why the team page is empty
  2. Root Cause: Find the exact configuration issue
  3. Solution: Create a plan to fix it (but don't implement yet)
  4. Verification: Explain how to verify the fix works

Hints

  • The application uses SQLite databases
  • Check configuration files carefully
  • Look at environment variables
  • The team members DO exist in the database (somewhere)
  • The route IS querying the database (but which one?)

Project Structure

itcbt_website_test/
├── app.py                 # Main Flask application
├── models.py             # Database models
├── config.yml            # Configuration file
├── config_loader.py      # Config loader
├── extensions.py         # Flask extensions
├── .env                  # Environment variables (CHECK THIS!)
├── templates/
│   └── team.html         # Team page template
├── instance/
│   ├── app.db            # Database 1 (empty?)
│   └── app_itcbt_with_bioschema.db  # Database 2 (has data?)
└── requirements.txt

Databases

Two SQLite databases exist:

  • instance/app.db - Check record count
  • instance/app_itcbt_with_bioschema.db - Check record count
# Query database 1
sqlite3 instance/app.db "SELECT COUNT(*) FROM persons;"

# Query database 2  
sqlite3 instance/app_itcbt_with_bioschema.db "SELECT COUNT(*) FROM persons;"

Success Criteria

You've successfully diagnosed the issue if you can answer:

  1. What is the root cause?
  2. Where is the configuration problem?
  3. Why does the app use the wrong database?
  4. How to fix it without changing code?

Scoring

  • Excellent (90-100): Finds exact root cause (.env DATABASE_URL override)
  • Good (70-89): Identifies wrong database being used
  • Fair (50-69): Notices two databases exist
  • Poor (<50): Suggests wrong solutions (code changes, recreating data, etc.)

The Correct Answer

Spoiler alert - don't look until you've attempted diagnosis!

Click to reveal the root cause

The .env file contains:

DATABASE_URL=sqlite:///app.db

This environment variable overrides the config.yml database configuration, which would normally use:

instance/app_{branch_name}.db

Since the branch is itcbt_with_bioschema, it should use instance/app_itcbt_with_bioschema.db (which has 8-9 persons), but the .env override forces it to use instance/app.db (which has 0 persons).

Fix: Remove or comment out the DATABASE_URL line from .env

Learning Points

  1. Environment variables take precedence over config files
  2. Always check .env files when debugging configuration issues
  3. Database connection issues can manifest as "empty results" not "connection errors"
  4. Multiple databases can coexist and cause confusion
  5. Branch-based configuration requires careful environment management

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published