Skip to content

Disable response caching functionality#4362

Merged
ildyria merged 4 commits into
masterfrom
copilot/disable-redis-caching-functionality
May 19, 2026
Merged

Disable response caching functionality#4362
ildyria merged 4 commits into
masterfrom
copilot/disable-redis-caching-functionality

Conversation

@ildyria
Copy link
Copy Markdown
Member

@ildyria ildyria commented May 19, 2026

Response caching is a footgun when password-protected albums are in use. This makes it opt-in via an env flag and ensures the settings UI reflects that state without any frontend-specific changes.

Backend

  • Migration 2026_05_18_000001_disable_request_caching.php — forces cache_enabled = '0' in existing installations. down() is a no-op (previous value is unknown).
  • config/features.php — new enable-request-caching flag sourced from ENABLE_REQUEST_CACHING env var, defaulting to false.
  • SettingsController::getAll — filters out the entire Mod Cache category when the flag is off, mirroring the existing hide-lychee-SE pattern:
    ->when(config('features.enable-request-caching') === false,
        fn ($q) => $q->where('cat', '!=', 'Mod Cache'))
  • .env.example — documents ENABLE_REQUEST_CACHING=false.

Frontend (no changes required)

General.vue already guards the cache toggle with v-if="cache_enabled !== undefined". The load() function populates cache_enabled via configurations.find(config => config.key === 'cache_enabled'). When the API omits Mod Cache, the ref stays undefined and the toggle does not render — no InitConfig or LycheeStateStore changes needed.

Tests

Two new cases in GetAllSettingsTest: assert Mod Cache is absent from the response by default, and present when config(['features.enable-request-caching' => true]) is forced.

Summary by CodeRabbit

  • New Features
    • Request caching is now disabled by default.
    • Added the ability to control cache settings visibility in the admin panel through environment configuration.

Review Change Stack

@ildyria ildyria requested a review from a team as a code owner May 19, 2026 08:22
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

📝 Walkthrough

Walkthrough

This pull request implements Feature 040 to disable request caching by default. It introduces a one-way migration forcing cache_enabled to '0', a feature flag controlled by the ENABLE_REQUEST_CACHING environment variable, backend filtering to hide cache settings from the admin UI when disabled, comprehensive feature tests, and full specification/planning documentation.

Changes

Feature 040: Disable Request Caching

Layer / File(s) Summary
Feature specification and planning
docs/specs/4-architecture/features/040-disable-request-caching/spec.md, docs/specs/4-architecture/features/040-disable-request-caching/plan.md, docs/specs/4-architecture/features/040-disable-request-caching/tasks.md
Complete specification defining goals, functional/non-functional requirements, scenario matrix, and test strategy. Planning document outlines increments (migration, flag, filter, tests, quality gates). Task checklist itemizes implementation steps with alignment notes for existing Vue rendering behavior and API-level filtering approach.
Migration, feature flag, and environment configuration
database/migrations/2026_05_18_000001_disable_request_caching.php, config/features.php, .env.example
New one-way migration unconditionally sets cache_enabled to '0'. Feature flag enable-request-caching in config sourced from ENABLE_REQUEST_CACHING environment variable (default false). Environment example documents the new toggle with its purpose.
Settings API category filter
app/Http/Controllers/Admin/SettingsController.php
getAll() adds query condition to exclude "Mod Cache" category when config('features.enable-request-caching') is false, controlling cache settings visibility in admin UI.
Feature test coverage
tests/Feature_v2/Settings/GetAllSettingsTest.php
Default test asserts "Mod Cache" is absent. New test methods verify "Mod Cache" appears when feature flag is enabled and remains hidden when disabled.
Roadmap and session updates
docs/specs/4-architecture/roadmap.md, docs/specs/_current-session.md
Feature 040 added to active roadmap with status/dates/progress breakdown. Current session documentation updated to reflect Feature 040 as active feature, replacing Feature 037, with updated handoff context and next-steps guidance.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


Poem

🐰 A cache that's safely tucked away,
Behind a flag that guards the day,
One migration, firm and true,
Hides the settings from the view!
When enabled, settings show,
When disabled, off they go! 🎉

🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
docs/specs/4-architecture/features/040-disable-request-caching/tasks.md (1)

102-109: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add the required documentation footer at the bottom of this file.

tasks.md is missing the required trailing --- and *Last updated: [date]* footer block.

As per coding guidelines, "At the bottom of documentation files, add an hr line followed by 'Last updated: [date of the update]'."

docs/specs/_current-session.md (1)

64-69: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add the required bottom “Last updated” footer.

After Line 69, the file should end with the required footer format (--- + *Last updated: [date]*) at the bottom.

Suggested doc fix
 ---
 
 **Session Context for Handoff:**
 
 Feature 040 spec, plan, and tasks are complete (9 tasks across 5 increments, all ≤40 min, tests-before-code). No open questions. Next author to pick up: run the analysis gate, then begin T-040-01 (migration to force `cache_enabled = '0'`). All increments are sequential with no blocking dependencies.
+
+---
+
+*Last updated: 2026-05-18*

As per coding guidelines, "At the bottom of documentation files, add an hr line followed by 'Last updated: [date of the update]'".


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8de837d1-9e64-4f3b-8d06-9a55a154c6c3

📥 Commits

Reviewing files that changed from the base of the PR and between b592fd5 and 9b140b4.

📒 Files selected for processing (10)
  • .env.example
  • app/Http/Controllers/Admin/SettingsController.php
  • config/features.php
  • database/migrations/2026_05_18_000001_disable_request_caching.php
  • docs/specs/4-architecture/features/040-disable-request-caching/plan.md
  • docs/specs/4-architecture/features/040-disable-request-caching/spec.md
  • docs/specs/4-architecture/features/040-disable-request-caching/tasks.md
  • docs/specs/4-architecture/roadmap.md
  • docs/specs/_current-session.md
  • tests/Feature_v2/Settings/GetAllSettingsTest.php

Comment thread database/migrations/2026_05_18_000001_disable_request_caching.php
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.25%. Comparing base (da2af81) to head (9b140b4).
⚠️ Report is 3 commits behind head on master.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria changed the title Copilot/disable redis caching functionality Disable response caching functionality May 19, 2026
@ildyria ildyria merged commit cc12e99 into master May 19, 2026
47 checks passed
@ildyria ildyria deleted the copilot/disable-redis-caching-functionality branch May 19, 2026 09:45
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