Fix help text column showing raw JSON for structured settings - #320
Conversation
Extract the human readable string from structured help_text values instead of printing the raw JSON in edge-app setting list output.
There was a problem hiding this comment.
🟡 Changes recommended
The new behavior isn’t covered by existing tests and it also unnecessarily expands the public API surface (should be pub(crate) given current usage).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes screenly edge-app setting list human-readable table output so the “Help text” column shows the extracted properties.help_text string when the setting’s help_text is stored in the structured JSON schema, instead of printing the raw JSON.
Changes:
- Added a helper to extract displayable help text from the structured help-text JSON payload.
- Updated the
EdgeAppSettingstable formatter to apply the extraction logic for thehelp_textfield when rendering human-readable output.
File summaries
| File | Description |
|---|---|
src/commands/mod.rs |
Adjusts human-readable table rendering for help_text to display extracted text instead of raw JSON. |
src/api/edge_app/setting.rs |
Introduces a helper to extract properties.help_text from structured help text JSON. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Scope extract_display_help_text to the crate and add a formatter test covering both structured and plain help_text values.
sergey-borovkov
left a comment
There was a problem hiding this comment.
Approving — the fix is correct for the case it targets and I found no regression.
What I checked: extract_display_help_text only rewrites the cell when the value parses to a JSON object and properties.help_text is a string; every other input returns verbatim, so plain help texts and the HELP_TEXT_NAME_OVERRIDES settings are untouched. JSON output goes through the raw-value branch of format_value and is unaffected, and EdgeAppSettings::supports_csv() is false so the CSV branch is unreachable. Built the branch, ran the full suite (235 passed, including the new test) and cargo clippy --all-targets — clean.
Two non-blocking notes inline. The first is a real gap in this fix rather than a style point, and it's a couple of lines in the function this PR just added, so it may be worth folding in here rather than as a follow-up.
Render an empty cell instead of the raw JSON when the object has no properties.help_text, and accept the field as an object value too.
Skip JSON parsing for help_text strings that clearly aren't objects, and bind the extracted help text to a local before building the cell.
There was a problem hiding this comment.
🟡 Changes recommended
extract_display_help_text currently turns malformed structured schemas (e.g., "properties" not an object) into an empty cell, conflicting with existing code that expects those cases to render as raw JSON (per the warning in assign_setting_display_orders).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
Only extract properties.help_text when the schema is well-formed, matching the existing malformed-schema warning in assign_setting_display_orders.
There was a problem hiding this comment.
🔵 Needs a closer look
extract_display_help_text currently returns an empty string for malformed-object inputs (when help_text is already a JSON object with invalid properties), which can silently drop information and should be made consistent with the raw-JSON fallback behavior.
Review details
Suppressed comments (1)
src/api/edge_app/setting.rs:233
extract_display_help_textreturns an empty string when the input is a JSON object with malformedproperties(e.g.,propertiesis a string/null). This happens because theValue::Objectarm only matches whenpropertiesis not malformed, and the fallback arm returnsString::new(), losing the original content; it also differs from the string-parsing branch which preserves the raw JSON in this case.
pub(crate) fn extract_display_help_text(help_text: &Value) -> String {
match help_text {
Value::Object(object) if !properties_are_malformed(object) => object
.get("properties")
.and_then(|properties| properties.get("help_text"))
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
salmanfarisvp
left a comment
There was a problem hiding this comment.
As per slack discussion.
Summary
screenly edge-app setting listprinted the raw JSON ofhelp_textfor settings that use the structured help text format, instead of the human readable text. This extractsproperties.help_textfrom the structured format before rendering the table.Before
After
Plain string
help_textvalues (e.g.override_locale,override_timezone) are unaffected.Edge case
A structured
help_textwith noproperties.help_textkey now renders an empty cell instead of falling back to the raw JSON.