Skip to content

Conversation

@roncodes
Copy link
Member

@roncodes roncodes commented Dec 21, 2025

Bug Fixes

  • Fixed cache key collision bug - Different filter parameters (e.g., type=customer vs type=contact) now generate unique cache keys instead of returning wrong cached results
  • Fixed BadMethodCallException - Models without soft deletes (like Permission) no longer crash when calling getDeletedAtColumn()

Improvements

  • Added caching to Permission model - Permission queries now benefit from Redis caching for improved performance

roncodes and others added 5 commits December 20, 2025 22:42
…in cache key

Previously, generateQueryCacheKey() only included a hardcoded whitelist of 11 parameters,
causing cache key collisions when different filter values were used (e.g., type=customer
vs type=contact generated the same cache key).

This fix includes ALL query parameters in the cache key generation, excluding only
internal/cache-busting parameters like '_', 'timestamp', 'nocache', and '_method'.

Impact:
- Fixes data integrity issue where different queries returned cached results from other queries
- Ensures accurate cache HIT/MISS behavior for all filter combinations
- Backward compatible - existing cache keys will naturally expire and regenerate

Example:
Before: /contacts?type=customer and /contacts?type=contact had SAME cache key
After:  /contacts?type=customer and /contacts?type=contact have DIFFERENT cache keys
Fix: Critical cache key collision bug in ApiModelCache
…t SoftDeletes

Issue: shouldQualifyColumn() method was unconditionally calling getDeletedAtColumn()
which only exists on models using the SoftDeletes trait. This caused a fatal error
when querying models like Permission that don't use soft deletes.

Error:
BadMethodCallException: Call to undefined method Fleetbase\Models\Permission::getDeletedAtColumn()

Fix: Check if the method exists before calling it using method_exists().
Only include deleted_at column in qualifiable columns if the model uses SoftDeletes.

Impact:
- Fixes fatal error when querying Permission and other non-soft-deletable models
- Maintains backward compatibility with models that do use SoftDeletes
- No functional changes to soft-delete behavior
@roncodes roncodes merged commit 9020d12 into main Dec 21, 2025
1 check passed
@roncodes roncodes deleted the dev-v1.6.30 branch December 21, 2025 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants