Skip to content

feat!: change AssetCache config structure (#186)#188

Open
frostyyyy1 wants to merge 1 commit into
Windows81:mainfrom
frostyyyy1:main
Open

feat!: change AssetCache config structure (#186)#188
frostyyyy1 wants to merge 1 commit into
Windows81:mainfrom
frostyyyy1:main

Conversation

@frostyyyy1

Copy link
Copy Markdown
Collaborator

add suggestion #186

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds an optional cache_directory setting propagated from a new CLI argument through game_config loaders (get_cached_config, generate_config) into obj_type's constructor, overriding the asset cache directory used, alongside a new persistence schema field.

Changes

Cache directory override

Layer / File(s) Summary
Persistence schema field
Source/game_config/structure.py
Adds optional cache_directory field to config_type.game_setup.persistence.
Constructor cache resolution
Source/game_config/__init__.py
obj_type.__init__ accepts cache_directory, merges it into effective data, and resolves asset_cache directory from it, falling back to existing config.
Loader signatures
Source/game_config/__init__.py
get_cached_config and generate_config accept and forward cache_directory into obj_type.
CLI wiring
Source/launcher/subparsers/args_launch_mode/server.py
New --cache_directory CLI argument passed through to config generation/loading calls.

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI as server.py CLI
  participant Loader as get_cached_config/generate_config
  participant Config as obj_type
  participant Cache as asset_cache

  CLI->>Loader: cache_directory=args_ns.cache_directory
  Loader->>Config: obj_type(data_dict, base_dir, cache_directory)
  Config->>Config: merge cache_directory into game_setup
  Config->>Cache: resolve dir_path from cache_directory or fallback
  Cache-->>Config: asset_cache initialised
Loading

Related PRs: None identified.

Suggested labels: enhancement, cache

Suggested reviewers: Windows81

🐇 A cache directory, tucked in with care,
From CLI flag to config, threaded with flair,
No more fixed paths, just pick where to store,
Hop along, reviewer, there's little more!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is too vague to clearly describe the changes, though it references the same suggestion. Replace it with a short summary of the config and CLI cache-directory changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title matches the main change: updating the AssetCache config structure.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Source/game_config/__init__.py`:
- Line 134: The expression in the object-type loading path is a dead statement
with no effect, so update the relevant code around
obj_type.server_core.place_file to either assign its value where intended or
remove the line entirely if it is unnecessary. Verify the surrounding logic in
the config initialization flow so the ServerCore/ObjectType handling still
behaves correctly after the cleanup.

In `@Source/game_config/structure.py`:
- Line 37: The cache_directory option is being resolved through
wrappers.path_str, which currently anchors relative paths to the config/base
directory instead of the launch cwd. Update the Structure config handling for
cache_directory so CLI-provided relative paths are interpreted from the caller’s
working directory, using the relevant config parsing path in
Source/config_type/types/__init__.py and the cache_directory field in Structure
as the locating points.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0fc96597-0ab5-408d-ba3d-c5e64543b050

📥 Commits

Reviewing files that changed from the base of the PR and between 096f96a and 8ad9377.

📒 Files selected for processing (3)
  • Source/game_config/__init__.py
  • Source/game_config/structure.py
  • Source/launcher/subparsers/args_launch_mode/server.py

'server_core': {'place_file': {'rbxl_uri': rbxl_file}},
'game_setup': {'roblox_version': version.name},
}
obj_type.server_core.place_file

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.

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Dead statement.

obj_type.server_core.place_file has no effect. Confirm intent (a missing assignment?) or drop it.

♻️ Remove
     }
-    obj_type.server_core.place_file
     base_dir = util.resource.retr_full_path(util.resource.dir_type.MISC)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
obj_type.server_core.place_file
🧰 Tools
🪛 Ruff (0.15.20)

[warning] 134-134: Found useless expression. Either assign it to a variable or remove it.

(B018)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Source/game_config/__init__.py` at line 134, The expression in the
object-type loading path is a dead statement with no effect, so update the
relevant code around obj_type.server_core.place_file to either assign its value
where intended or remove the line entirely if it is unnecessary. Verify the
surrounding logic in the config initialization flow so the ServerCore/ObjectType
handling still behaves correctly after the cleanup.

Source: Linters/SAST tools

sqlite_path: wrappers.path_str = '_.sqlite'
clear_on_start: bool = False

cache_directory: wrappers.path_str | None = None

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect path_str wrapper resolution logic
fd -t f 'wrappers' Source | head
rg -nP -C4 'class\s+path_str|def\s+__.*path' Source

Repository: Windows81/Roblox-Freedom-Distribution

Length of output: 802


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the config field and its call sites.
fd -t f 'structure.py' Source
fd -t f 'wrappers.py' Source/config_type/types
rg -n -C 4 'cache_directory|generate_config|get_cached_config|path_str\(' Source/game_config Source/config_type/types

Repository: Windows81/Roblox-Freedom-Distribution

Length of output: 7507


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Look for docs/help around cache_directory or path semantics.
rg -n -C 3 'cache_directory|cache directory|cwd|current working directory|base_dir|relative path|path_str' README* Source

Repository: Windows81/Roblox-Freedom-Distribution

Length of output: 15231


Resolve --cache_directory from the launch cwd In Source/config_type/types/__init__.py:59-60, wrappers.path_str joins against base_dir, so a relative cache path is anchored to the config file directory (or MISC for generated configs), not the caller’s cwd. That makes --cache_directory ./foo land in different places depending on how the config is loaded.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Source/game_config/structure.py` at line 37, The cache_directory option is
being resolved through wrappers.path_str, which currently anchors relative paths
to the config/base directory instead of the launch cwd. Update the Structure
config handling for cache_directory so CLI-provided relative paths are
interpreted from the caller’s working directory, using the relevant config
parsing path in Source/config_type/types/__init__.py and the cache_directory
field in Structure as the locating points.

@frostyyyy1

Copy link
Copy Markdown
Collaborator Author

im not reviewing what this ai bot bullshitted

@frostyyyy1

Copy link
Copy Markdown
Collaborator Author

might have forgotten the readme

@Windows81

Copy link
Copy Markdown
Owner

Thanks for making these proposed changes!

However, I don't want to make a drastic change to the way that game config works.

What problem does this solve? Best.

@Windows81 Windows81 changed the title 186 feat: change AssetCache config structure Jul 6, 2026
@Windows81 Windows81 changed the title feat: change AssetCache config structure feat!: change AssetCache config structure Jul 6, 2026
@frostyyyy1

frostyyyy1 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

Hi, thanks.
This would not break your current Gameconfig at all, since without the string inside the Gameconfig, it defaults to AssetCache.
It would fix this issue Laz is having. #186

@Windows81 Windows81 changed the title feat!: change AssetCache config structure feat!: change AssetCache config structure (#186) Jul 6, 2026
@Windows81

Copy link
Copy Markdown
Owner

I hope this addresses your issue now:


I want to avoid having a config option to be selected redundantly in more than one place.

RFD's way of doing things is that all configuration options must only stray from their defaults if defined in GameConfig.{toml|json}.

game_setup.asset_cache.dir_path

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