Skip to content

feat(models): allow null battery_mah/weight_g on mobile devices - #109

Merged
Seungpyo1007 merged 1 commit into
mainfrom
Seungpyo1007/e15-nullable-mobile-fields
Sep 28, 2026
Merged

Seungpyo1007 merged 1 commit into
mainfrom
Seungpyo1007/e15-nullable-mobile-fields

Conversation

@Seungpyo1007

Copy link
Copy Markdown
Member

What & why

Allow unknown battery capacity and weight on tablets, watches, and PDAs to be represented as null instead of fabricated numbers. Accuracy work in GetTechAPI/TechAPI#296 found the same battery_mah=1500 and weight_g=150.0 placeholders across 43 watch and 217 tablet records; the correction in blocked draft GetTechAPI/TechAPI#324 cannot be seeded or dumped while the engine requires numeric values. Those required fields likely encouraged the original placeholder workaround.

How

  • Default only mobile-device battery_mah and weight_g to None in SQLModel and the response schema; smartphone requirements and every other field's nullability stay unchanged.
  • Allow omitted mobile specs in seed validation while retaining range checks for known values. The serializer, dump generator, and verification consumers already pass through or guard unknown values; battery scoring applies to smartphones.
  • Cover omitted values, explicit nulls, each field independently unknown, and known values across tablets, watches, and PDAs through validation, seeding, API responses, and dumps; verify the OpenAPI contract and smartphone requirements.

Existing databases need these columns altered to allow SQL NULL, or the tables recreated, before reseeding corrected records: SQLModel's create_all creates new tables but does not migrate existing ones. This PR changes only TechEngine; it does not modify TechAPI data.

Testing

  • pytest --cov=app --cov-report=term --cov-fail-under=60 --tb=short --basetemp=.pytest-nullable-canonical: 552 passed, 77.63% coverage, using TECHAPI_DATA_DIR=C:/Users/29/Desktop/TechAPI/data read-only.
  • python -m mypy app: success, 111 source files.
  • python -m ruff check app tests: all checks passed.
  • python -m app.validate: canonical seed data validation passed.

Checklist

  • Type hints on all new functions
  • Tests added/updated
  • ruff check and pytest pass locally
  • Seed-data validation passes; no data changes
  • README documents the nullable contract

@Seungpyo1007
Seungpyo1007 merged commit f78d9d8 into main Sep 28, 2026
1 check passed
@Seungpyo1007
Seungpyo1007 deleted the Seungpyo1007/e15-nullable-mobile-fields branch September 30, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant