Skip to content

Build setup: minimal fs_data + override example#343

Open
GraspGG wants to merge 4 commits intoMoonModules:mdevfrom
GraspGG:olaf/mdev
Open

Build setup: minimal fs_data + override example#343
GraspGG wants to merge 4 commits intoMoonModules:mdevfrom
GraspGG:olaf/mdev

Conversation

@GraspGG
Copy link
Copy Markdown

@GraspGG GraspGG commented Mar 1, 2026

Adds minimal fs_data JSON placeholders (no secrets) and an override example for local builds.

Summary by CodeRabbit

  • Chores

    • Added minimal placeholder configuration files to support local build customization and safe handling of optional secrets for reduced filesystem payloads.
    • Included an example local build override to customize build environment and release naming.
  • Documentation

    • Added a README describing how to use a reduced-data local directory for reproducible local/CI builds and guidance on managing sensitive info.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 1, 2026

📝 Walkthrough

Walkthrough

Added a minimal local filesystem payload: three empty JSON placeholders in fs_data/, a PlatformIO override example, and a README documenting using fs_data as a build data_dir for constrained environments.

Changes

Cohort / File(s) Summary
Configuration Placeholders
fs_data/cfg.json, fs_data/presets.json, fs_data/wsec.json
Added three files containing empty JSON objects ({}) as placeholders for configuration, presets, and optional Wi‑Fi/security data.
PlatformIO Override Example
platformio_override.ini.olaf.example
Added an example override that sets default_envs = esp32_4MB_V4_M and appends a -D WLED_RELEASE_NAME="WLEDMM-OLAF" build flag.
fs_data Documentation
fs_data/README.md
Added README explaining fs_data usage as a minimal data_dir, recommended files (cfg.json, presets.json, optional wsec.json), and how to enable it via a PlatformIO override.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • netmindz

Poem

🐇 I found three jars, all tidy and small,
Empty and ready to answer the call.
A tiny override tucked in the stack,
A README to guide the build back on track.
Hop, build, and blink—small changes, big cheer!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: introducing a minimal fs_data directory with JSON placeholder files and a PlatformIO override example for local builds on constrained flash layouts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ 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 and usage tips.

@softhack007
Copy link
Copy Markdown
Collaborator

@GraspGG what is fs_data used for? I've never seen the folder, maybe you can say a few words about the purpose?

@GraspGG
Copy link
Copy Markdown
Author

GraspGG commented Mar 2, 2026

@GraspGG what is fs_data used for? I've never seen the folder, maybe you can say a few words about the purpose?

fs_data is a local/minimal PlatformIO data_directory used to build/upload a small filesystem image (via buildfs/uploadfs).
I introduced it because the default WLED00/data content (pxmagic etc.) exceeded my ESP32 4MB FS partition during mkspiffs, causing an SPIFFS_write error: File system is full.
With fs_data I can keep only tiny config files (e.g. empty or template cfg.json, presets.json, optionally wsec.json without secrets) and still use the PR/build workflow without touching upstream platformio.ini.
Simplified: It’s basically a “minimal FS payload” folder for reproducible builds on limited flash/FS layouts.

Thank you for pointing me on that documentation gap!
I should have added a README to that folder.

@softhack007
Copy link
Copy Markdown
Collaborator

@coderabbitai re-review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 5, 2026

@softhack007 Sure, I'll re-review the PR now with the latest changes including the newly added fs_data/README.md.

✅ Actions performed

Full review triggered.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@fs_data/README.md`:
- Around line 12-14: The README currently says cfg.json/presets.json/wsec.json
"can be {}" but cfg deserialization in wled00/cfg.cpp dereferences null/empty
objects causing crashes; update the README to either (A) specify the minimal
valid JSON skeleton required for each file (list required keys and example
minimal structure for cfg.json, presets.json, and wsec.json) so users won't
create `{}` that triggers null access in the deserializer, or (B) add a clear
safety warning that empty `{}` is unsafe and requires fixing wled00::cfg.cpp
deserialization; also update the repo example JSON files to match the minimal
valid structures you document so examples are safe.

In `@platformio_override.ini.olaf.example`:
- Around line 6-8: The example config is missing the data_dir directive so users
won't enable the fs_data payload; update the [env] block to add a data_dir entry
(e.g., data_dir = ${PROJECT_DIR}/fs_data) alongside the existing build_flags (-D
WLED_RELEASE_NAME="WLEDMM-OLAF") so the template matches the fs_data/README.md
usage; ensure the new line uses the same indentation style as build_flags.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 61f2cacb-da53-454c-b8e0-7f5a33a145d1

📥 Commits

Reviewing files that changed from the base of the PR and between 7627fbd and 095ed54.

📒 Files selected for processing (5)
  • fs_data/README.md
  • fs_data/cfg.json
  • fs_data/presets.json
  • fs_data/wsec.json
  • platformio_override.ini.olaf.example

Comment on lines +12 to +14
- `cfg.json` (optional, can be `{}`)
- `presets.json` (optional, can be `{}`)
- `wsec.json` (optional) — **do not commit secrets** (WiFi credentials). Keep it empty (`{}`) or manage locally.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Documentation incorrectly states files "can be {}" without safety warnings.

Lines 12-14 state that cfg.json and presets.json "can be {}" and that wsec.json should be kept "empty ({})". However, the deserialization code in wled00/cfg.cpp has unsafe null-object access patterns that will cause undefined behavior/crashes when these files contain only {}.

The documentation should either:

  1. Provide the minimal valid JSON structure needed to avoid crashes (not empty {}), OR
  2. Explicitly warn that empty {} requires upstream fixes to cfg.cpp deserialization code
📝 Proposed documentation fix
 ## What to put here
-- `cfg.json` (optional, can be `{}`)
-- `presets.json` (optional, can be `{}`)
-- `wsec.json` (optional) — **do not commit secrets** (WiFi credentials). Keep it empty (`{}`) or manage locally.
+- `cfg.json` — minimal valid structure required (see file for example)
+- `presets.json` — minimal valid structure required (see file for example)
+- `wsec.json` — minimal valid structure without secrets (see file for example)
+
+**Note:** These files cannot be completely empty `{}` because the deserialization code in `wled00/cfg.cpp` accesses nested keys without null checks. Use the provided minimal structures to avoid crashes.

Then update the actual JSON files to use the minimal valid structures suggested in the earlier comments.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@fs_data/README.md` around lines 12 - 14, The README currently says
cfg.json/presets.json/wsec.json "can be {}" but cfg deserialization in
wled00/cfg.cpp dereferences null/empty objects causing crashes; update the
README to either (A) specify the minimal valid JSON skeleton required for each
file (list required keys and example minimal structure for cfg.json,
presets.json, and wsec.json) so users won't create `{}` that triggers null
access in the deserializer, or (B) add a clear safety warning that empty `{}` is
unsafe and requires fixing wled00::cfg.cpp deserialization; also update the repo
example JSON files to match the minimal valid structures you document so
examples are safe.

Comment on lines +6 to +8
[env]
build_flags =
-D WLED_RELEASE_NAME=\"WLEDMM-OLAF\" No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Missing data_dir directive documented in README.

The fs_data/README.md (lines 17-18) documents that fs_data is "Typically enabled via platformio_override.ini, e.g.: data_dir = ${PROJECT_DIR}/fs_data", but this example template doesn't include that directive. Users copying this example won't actually use the minimal fs_data payload for buildfs/uploadfs, defeating the purpose of this PR.

📝 Proposed fix: Add data_dir to demonstrate documented usage
 [env]
+data_dir = ${PROJECT_DIR}/fs_data
 build_flags =
   -D WLED_RELEASE_NAME=\"WLEDMM-OLAF\"

This ensures the example demonstrates the primary use case documented in the README.

📝 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
[env]
build_flags =
-D WLED_RELEASE_NAME=\"WLEDMM-OLAF\"
[env]
data_dir = ${PROJECT_DIR}/fs_data
build_flags =
-D WLED_RELEASE_NAME=\"WLEDMM-OLAF\"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@platformio_override.ini.olaf.example` around lines 6 - 8, The example config
is missing the data_dir directive so users won't enable the fs_data payload;
update the [env] block to add a data_dir entry (e.g., data_dir =
${PROJECT_DIR}/fs_data) alongside the existing build_flags (-D
WLED_RELEASE_NAME="WLEDMM-OLAF") so the template matches the fs_data/README.md
usage; ensure the new line uses the same indentation style as build_flags.

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