Skip to content

Clarify settings requirements - #4670

Open
ildyria wants to merge 2 commits into
masterfrom
interdependences-settings
Open

Clarify settings requirements#4670
ildyria wants to merge 2 commits into
masterfrom
interdependences-settings

Conversation

@ildyria

@ildyria ildyria commented Aug 25, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Added support for configuration dependencies.
    • Configuration options are disabled when their required settings are not enabled.
    • Added dependency metadata for several configuration areas.
    • Exposed required configuration keys consistently across the application.
    • Highlighted required settings when hovering over dependent options.
    • Dependency checks now reflect pending configuration changes before they are saved.

@ildyria
ildyria requested a review from a team as a code owner August 25, 2026 23:17
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Configuration dependencies

Layer / File(s) Summary
Dependency storage and model mapping
database/migrations/..., app/Models/Configs.php
Adds nullable configs.required_keys, populates dependencies for feature settings, supports rollback, and allows mass assignment.
Resource dependency contract
app/Http/Resources/Models/ConfigResource.php, resources/js/lychee.d.ts, resources/js/v8/views/admin/LandingConfig.vue
Converts comma-delimited dependencies to string[] and exposes the field in the frontend type. The landing configuration includes an empty dependency array.
Pending-aware settings behavior
resources/js/v8/components/settings/ConfigGroup.vue, resources/js/v8/components/settings/AllSettings.vue, resources/js/v8/views/admin/Settings.vue
Passes pending configurations to settings groups. Groups evaluate dependencies from pending or saved values, disable inactive rows, and highlight required keys on hover.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: 🔵 Low · up to 87723

Settings dependencies may remain inactive when their controlling value is stored in another category, and keyboard users may still edit controls presented as inactive. The change is otherwise mergeable with explicit owner follow-up on these bounded issues.

Poem

A rabbit maps each required key
Pending values change what rows can be
Inactive fields wait when roots are low
Typed arrays show the data flow
Migration paths roll back clean
Settings reflect the current state seen

🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. (3 skipped: 3… Write docstrings for the functions missing them to satisfy the coverage threshold.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a2d354a-9dc1-43d9-be8d-edec546dd213

📥 Commits

Reviewing files that changed from the base of the PR and between 30b99fd and eed02c3.

📒 Files selected for processing (6)
  • app/Http/Resources/Models/ConfigResource.php
  • app/Models/Configs.php
  • database/migrations/2026_08_25_000001_add_config_required_keys.php
  • resources/js/lychee.d.ts
  • resources/js/v8/components/settings/ConfigGroup.vue
  • resources/js/v8/views/admin/LandingConfig.vue

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment thread resources/js/v8/components/settings/ConfigGroup.vue Outdated
@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.34%. Comparing base (30b99fd) to head (8772301).
⚠️ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a21e9bcd-5517-4863-a6fc-58794e81726d

📥 Commits

Reviewing files that changed from the base of the PR and between eed02c3 and 8772301.

📒 Files selected for processing (3)
  • resources/js/v8/components/settings/AllSettings.vue
  • resources/js/v8/components/settings/ConfigGroup.vue
  • resources/js/v8/views/admin/Settings.vue

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment on lines +259 to +265
function currentValue(key: string): string | undefined {
const pending = props.modified.find((m) => m.key === key);
if (pending !== undefined) {
return pending.value ?? undefined;
}

return props.configs.find((c) => c.key === key)?.value;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect dependency declarations and category assignments.
# Expect: every required key belongs to the dependent configuration's category,
# or the frontend must receive a cross-category saved-value lookup.
rg -n -C 4 --glob '*.php' 'required_keys|->cat|["'\'']cat["'\'']' database app
rg -n -C 3 --glob '*.vue' '<ConfigGroup|:configs=' resources/js

Repository: LycheeOrg/Lychee

Length of output: 50373


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- applicable repository conventions ---'
find /tmp/coderabbit-repo-knowledge/lycheeorg-lychee-cc271fdf -type f -name '*.md' -maxdepth 3 -print
for f in /tmp/coderabbit-repo-knowledge/lycheeorg-lychee-cc271fdf/*/*.md; do
	[ -f "$f" ] || continue
	case "$f" in
		* coding-conventions.md|*learnings*settings*.md|*learnings*frontend*.md)
			printf '\n--- %s ---\n' "$f"
			sed -n '1,220p' "$f"
			;;
	esac
done

printf '\n--- required_keys declarations only ---\n'
rg -n -C 5 --glob '*.php' 'required_keys' database app

printf '\n--- ConfigGroup dependency flow ---\n'
sed -n '245,280p' resources/js/v8/components/settings/ConfigGroup.vue

printf '\n--- ConfigGroup callers ---\n'
rg -n -C 5 --glob '*.vue' '<ConfigGroup|:configs=' resources/js/v8/views resources/js/v8/components/settings

Repository: LycheeOrg/Lychee

Length of output: 3129


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- dependency declarations ---'
rg -n -C 8 --glob '*.php' 'required_keys' database app

printf '\n%s\n' '--- reviewed component flow ---'
sed -n '200,285p' resources/js/v8/components/settings/ConfigGroup.vue

printf '\n%s\n' '--- direct callers ---'
rg -n -C 8 --glob '*.vue' '<ConfigGroup' resources/js/v8

printf '\n%s\n' '--- settings data types and assembly ---'
rg -n -C 6 --glob '*.{php,ts,vue}' 'modified|required_keys|config_categories|configGroups|configGroup' app resources/js | head -n 500

Repository: LycheeOrg/Lychee

Length of output: 50372


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- required-keys migration ---'
sed -n '1,240p' database/migrations/2026_08_25_000001_add_config_required_keys.php

printf '\n%s\n' '--- all explicit required-key assignments ---'
rg -n -C 4 --glob '*.{php,sql,json,yaml,yml}' 'required_keys\s*=>|required_keys["'\'']\s*:|required_keys\s*=' database app resources

printf '\n%s\n' '--- config grouping and resource construction ---'
rg -n -C 8 --glob '*.php' 'ConfigResource|config_categories|groupBy\(.*cat|->groupBy\(.*cat' app

Repository: LycheeOrg/Lychee

Length of output: 25914


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import pathlib, re

migration = pathlib.Path("database/migrations/2026_08_25_000001_add_config_required_keys.php").read_text()
keys = re.findall(r"'([A-Za-z0-9_]+)'", migration)
# Keep only keys that occur in update whereIn lists, excluding category names and column names.
keys = [k for k in keys if k not in {"required_keys", "landing_page_enable", "landing_about_enabled",
                                    "landing_featured_items_enabled", "timeline_photos_enabled",
                                    "timeline_albums_enabled", "ai_vision_enabled",
                                    "ai_vision_face_enabled", "ai_vision_face_overlay_enabled",
                                    "ai_vision_nsfw_enabled", "watermark_enabled", "mod_frame_enabled",
                                    "map_display", "flow_enabled", "flow_min_max_enabled",
                                    "flow_image_header_enabled", "flow_carousel_enabled"}]

files = list(pathlib.Path("database/migrations").glob("*.php"))
for key in keys:
    hits = []
    for path in files:
        lines = path.read_text(errors="replace").splitlines()
        for i, line in enumerate(lines):
            if re.search(r"'key'\s*=>\s*'" + re.escape(key) + r"'", line):
                block = "\n".join(lines[i:min(i + 18, len(lines))])
                cats = re.findall(r"'cat'\s*=>\s*([^,\n]+)", block)
                hits.append((str(path), i + 1, cats[:1]))
    print(f"{key}: {hits}")
PY

Repository: LycheeOrg/Lychee

Length of output: 11947


Resolve saved dependency values across all categories.

The migration assigns flow_enabled as a required_keys value for flow_blur_nsfw_enabled and hide_nsfw_in_flow, but those settings belong to the Mod NSFW category while flow_enabled belongs to Mod Flow. Each ConfigGroup receives only its category’s configs; therefore currentValue returns undefined for the saved flow_enabled value unless it has a pending edit. The dependent settings remain inactive.

Pass a complete saved-value lookup to ConfigGroup, while keeping modified as the higher-priority override.

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.

1 participant