Three plans covering Docker scaffold, SQLite schema, and .intunewin spike. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8.3 KiB
8.3 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | requirements | must_haves | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 01-foundation | 02 | execute | 2 |
|
|
true |
|
|
Purpose: Establish the data layer that all subsequent phases depend on. The full schema is created upfront per the locked user decision, so later phases only add routes and logic — not schema changes. Satisfies INFRA-01 (SQLite auto-init) and INFRA-02 (no external DB). Output: Working database module with all models, driver storage helper, and startup wiring.
<execution_context> @C:/Users/SebastienQUEROL/.claude/get-shit-done/workflows/execute-plan.md @C:/Users/SebastienQUEROL/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/01-foundation/01-CONTEXT.md @.planning/phases/01-foundation/01-RESEARCH.mdFrom imptune/config.py:
DATA_DIR: str # env var, default "/data"
DB_PATH: str # DATA_DIR + "/imptune.db"
DRIVERS_DIR: str # DATA_DIR + "/drivers"
From imptune/main.py:
app = FastAPI(title="ImpTune")
# startup event already creates DATA_DIR/DRIVERS_DIR directories
# Executor must ADD init_db() call to the existing startup event
**imptune/db/models.py** (full schema for all phases per locked decision):
- BaseModel with Meta.database = db
- Client: name (CharField unique), created_at (DateTimeField default utcnow)
- Driver: sha256 (CharField unique, indexed), original_filename (CharField), size_bytes (IntegerField), uploaded_at (DateTimeField default utcnow), driver_desc (CharField null=True), inf_filename (CharField null=True), architecture (CharField null=True), has_cat_file (BooleanField default=False)
- Printer: name (CharField), ip_address (CharField), port_name (CharField), client (ForeignKeyField Client null=True backref="printers"), driver (ForeignKeyField Driver null=True backref="printers"), duplex_mode (CharField default="OneSided"), color_mode (BooleanField default=True), paper_size (CharField default="A4"), collate (BooleanField default=True), created_at, updated_at (both DateTimeField default utcnow)
- Icon: printer (ForeignKeyField Printer unique backref="icons"), sha256 (CharField), original_filename (CharField), size_bytes (IntegerField), uploaded_at (DateTimeField default utcnow)
**imptune/storage/driver_store.py**:
- Class DriverStore with __init__(self, base_dir: str)
- save(self, data: bytes) -> str: compute SHA256, write to base_dir/{sha256} if not exists, return hex digest
- get_path(self, sha256: str) -> Path: return Path(base_dir) / sha256
- exists(self, sha256: str) -> bool: check if file exists
- Import init_db from imptune.db.database
- In the existing startup event handler, add a call to init_db() AFTER the directory creation logic
- This ensures the SQLite database is created inside DATA_DIR (which was just created/verified)
- Keep all existing code (StaticFiles mount, router includes, directory creation) — only ADD the init_db() call
Do NOT use async def for the startup handler — Peewee is sync-only. Use regular def with FastAPI's @app.on_event("startup") which already exists from plan 01-01.
<success_criteria>
- SQLite database auto-creates on app startup with 4 tables
- WAL journal mode and foreign keys enabled via pragmas
- Database file lives at DATA_DIR/imptune.db (volume-mounted path)
- DriverStore saves files by SHA256 with deduplication
- All existing tests continue to pass (no regression)
- 7+ new tests pass for db and storage </success_criteria>