mirror of
https://github.com/cassandra/home-information.git
synced 2026-04-17 21:19:45 -04:00
* Document design workflow process and update CLAUDE.md
- Add comprehensive design workflow documentation in docs/dev/workflow/design-workflow.md
- Update CLAUDE.md with design work documentation workflow section
- Establishes data/design/issue-{number}/ pattern for local work
- Documents GitHub issue attachment vs comment organization
- Provides reusable process for future design-focused issues
- Maintains repository cleanliness while enabling design iteration
* Snapshpt fo semi-working new entity and attribute edit modal.
* Refactored new forms to remove duplication. Fixed some textarea bugs.
* Fixed textarea attributes to prevent data corruption.
* Fixed new attribute validation error handling.
* Moved Entity attribute formset non-file filtering closer to def.
* Styling impovements.
* Added attribute value history browsing and restoring.
* Fixed styling on new entity edit modal header area.
* Refactored the messy and confusing new entity edit modal.
* Fixed icon in new attruibute form.
* Attribute Edit style changes.
* Fixed bad claude factoring. Fixed CSRF file upload issue.
* Added scroll-to in antinode.js whic helped fix file upload UX issue.
* Fixed styling of the add new attribute card for the 'mark as secret'.
* Added modified field forms styling for new entity edit modal.
* Fixed bug in secret attribute readonly editing logic.
* Added file attribute value editing to new entity edit modal.
* Removed legacy EntityEditView and related code.
* Refactor to remove EntityEditData.
* Refactor to rename: EntityDetailsData -> EntityEditModeData
* More refactoring for name change from "details" to "edit mode"
* Removed debug log messages. Doc typo fix.
* Refactored entity views to add helper classes.
* Coded cleanup and test fixes.
* Refactored to replace use of hardcoded DOM ids, classes, selectors.
* Refactorings: better naming removed debug messages.
* Renamed "property" to "attribute".
* Fixed unit test gaps.
* Replaced hardcoded form field prefixes with common access.
* Added EntityTransitionType to replace brittle "magic" strings.
* Tweaks on display names for entity edit modal.
* Added missing __init__.py to nested test dirs. (New failures found.)
* Working on fixing unit tests: checkpoint. WIP
* Fixed units tests
* Removed mocking from soem unit tests.
* Removed partial V2 implementation mistake from entity edit work.
* Added testing doc about lessons learned.
* Added a bunch of testing-related documentation.
* Fixed test expectation for LocationAttributeUploadView invalid upload
Updated test to expect 200 status with modal form response instead of 400 error, aligning with new form error handling behavior from entity attribute redesign.
Django Test Pattern Examples
This directory contains concrete examples of well-structured Django tests derived from extensive refactoring work in the HI application.
Files
django-test-patterns-examples.py
Comprehensive examples showing:
- CRUD Testing: Real database objects vs mocking
- AJAX/JSON Views: Testing modern async responses
- Form Validation: Complete field requirements and file uploads
- Complex Business Logic: Entity pairings, many-to-many through models
- Session Dependencies: Middleware state requirements
- Synthetic Data: Consistent test data generation
- Error Handling: 404s, validation errors without mocking
Usage
When working on Django tests, refer to these examples to:
- Avoid anti-patterns like over-mocking database operations
- Follow established patterns for session setup and form validation
- Use proper assertions for JSON vs HTML responses
- Structure test data consistently with synthetic generators
- Test integration flows rather than just method calls
Key Principles
- ✅ Test real behavior with actual database transactions
- ✅ Use Django's test framework as designed (isolated DB transactions)
- ✅ Test business outcomes not implementation details
- ✅ Follow application patterns for enums, sessions, relationships
- ❌ Don't mock basic CRUD, model relationships, or form processing
- ❌ Don't assume direct relationships - verify through models/admin
Context
These patterns were discovered while converting heavily mocked tests to use real objects, resulting in:
- More reliable tests that catch real bugs
- Better documentation of application architecture
- Easier maintenance and debugging
- Higher confidence in system behavior
Use these examples as templates when writing new tests or refactoring existing ones.