You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(sections): row preview explains a rejected config, not a 500 - #5686
Related issue: N/A
Validation tasks: none changed. The change reaches #1140 C1 and #1141 C1 (rows created through the admin API and the web row builder). The rows those cases added still save and preview as before; only a config that saving rejects now gets a 422 from the preview.
Depends on: Silo-Server/silo-translations#206 (the new string), which merges first.
Other clients: N/A (the admin row preview and its form are web-only; the new message text reaches other clients only through the existing validation problem)
In the web admin's Add row and Edit row forms, the live preview answered 500 for a row config that saving rejects, such as a Smart row sorted by random or a last_air_date rule whose value is not a date. The form then said "The preview didn't load. The row still saves.", which was wrong: saving that row fails. The preview now runs the same config check as saving and shows the server's reason, for example "The preview can't show this row: sort.field is not supported". The shipped "New in 4K" preset, which the save check also rejected, now saves and previews.
This affects administrators building Home and library rows, and any client calling previewAdminSection.
Approach
previewAdminSection runs validateSectionConfig, the check single-row creation runs, before any query. A rejected config gets the same 422 validation_failed problem that saving returns.
validateSectionConfig parsed every row's config as a query definition. For row types whose config holds the recipe's own parameters, that parse read "New in 4K"'s {"format":"4k","sort":"recent"} as a legacy query sort and rejected it. sections.ReadsQueryDefinition now names the row types that read a query definition, and the other types leave their config to the recipe's check, which creation, bulk creation and edits already run.
Validator, decoder and recipe messages no longer repeat the value they rejected, as docs/architecture/api-contract.md requires ("Rejected values are never echoed."). They name the key or the position instead, and a rejected duration says which form is accepted. A seasonal theme key still appears in a message, but only after it matched the theme catalog exactly.
The web row form shows a 422 validation_failed in its own state with the new string web.home.addRow.preview.rejected. Any other failure keeps the generic message. In a translated interface the reason is the translated field-error text, as for other v2 problems.
docs/architecture/api-contract.md and docs/catalog-api.md now say the preview runs the save checks, including the rule that an administrator row of collections lists server collections only.
The three parts ship together because the preview now runs the save check: that put the check's messages in front of the administrator and made "New in 4K" fail in the same form. Saving keeps its statuses, problem types and field codes, and only its message text changes. The preview answers 422 where it answered 500.
Validation
Handler tests: the preview rejects a random sort and a non-date last_air_date value before any query runs, without repeating the value, and still previews a valid Smart row; every format_showcase preset passes the save check and "New in 4K" previews; row types that read a query definition still reject {"sort":"recent"}. All pass with this change. The rejection and preset tests fail on main. The "New in 4K" preview test fails when the preview runs the save check without the fix for row types that hold recipe parameters. The query-definition test passes on both, as a guard.
Message tests: the query-definition parser (9 cases) and every recipe's validator and parameter decoder (45 subtests) reject bad input without the rejected value in the message. Both failed on main and pass now.
Web: a row form test shows the server's reason for a 422 validation_failed, without "The row still saves", and the generic message for any other failure. It failed with main's row preview code and passes now.
Not covered by a test: the path from the handler's 400 through the v2 problem mapper to the text in the form. The captures below show that path on a running server.
Environment: a containerized build against a migrated PostgreSQL 18 database.
The full check list in CONTRIBUTING.md "Validate your change" passes: build, vet, gofmt, lint-changed, Go tests with PostgreSQL, contract, generated-file and migration checks, web lint, format, build, budget and tests.
Not run: make verify-actionlint, make verify-shellcheck and make verify-prometheus-rules. The change touches no workflow, shell script or Prometheus rule.
Each pair shows the same screen with the same empty library: Before is main at 8fcf75f, After is a Silo build of this branch, both in Admin > Libraries > Home Sections > Add row.
Smart row preview for a rejected config, desktop and phone width. Before: "The preview didn't load. The row still saves." After: "The preview can't show this row: sort.field is not supported".
Saving the "New in 4K" preset. Before: saving fails with sort.field "recent" is not supported. After: the row saves and appears on Home. The preset's preview works in both builds; the after set includes it.
After only: the same rejected preview under the en-XA pseudo-locale. The new string is translated, and the reason is the translated generic field-error text, as the web app shows for any v2 field error in a non-English interface.
The web form offers no random sort. For the rejected-preview captures I patched the page's fetch to send sort.field: "random" in the preview request; the status (500 before, 422 after) and the reason came from the real server.
Risks
Validation messages read differently, and a client that matched on their old text would no longer match. None of the first-party clients does.
The save check no longer parses a query definition for row types whose config is recipe parameters. Those configs still pass through the recipe's own check, so a save that used to fail only because of that parse now succeeds.
Adversarial review: Claude Opus 5.5 and GPT-6.2 Sol reviewers read the preview change against the save path and the API contract. They found that the form told an administrator a rejected draft still saves, that the 422 repeated the rejected value, and that the API docs did not say the preview runs the save check; all three are fixed here. Claude Sonnet 5.5 verifiers then checked each fix against the tests. They found recipe messages that still repeated rejected values, and that the preview would now reject "New in 4K" as saving already did; both are fixed here too.
The admin Smart-row preview skipped the config check that saving a row
runs, so a config that save rejects (a random sort, a last_air_date rule
whose value is not a date) failed inside the fetcher as a 500. Preview
now runs validateSectionConfig and answers the same validation error
before any query runs.
validateSectionConfig parsed every row's config as a query definition.
A row whose config is its recipe's own parameters, such as the shipped
"New in 4K" preset's {"sort":"recent"}, read as a legacy query sort and
could be neither saved nor previewed. sections.ReadsQueryDefinition now
names the row types that read a query definition; the other types leave
their config to the recipe.
Validator, decoder and recipe messages no longer repeat the value they
rejected, as docs/architecture/api-contract.md requires ("Rejected
values are never echoed."). They name the key or the position instead,
and a rejected duration says which form is accepted. A shared
decodeParams helper gives every recipe the same decode error, in place
of the JSON decoder's text, which carries the rejected number and Go
type names. A seasonal theme key still appears in a message, but only
after it matched the catalog exactly.
The web Add and Edit row preview shows the server's reason in its own
state (web.home.addRow.preview.rejected) instead of the generic "The row
still saves" failure. Other failures keep the generic message.
Signed-off-by: Anagh Kumar Baranwal <6824881+darthShadow@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Codex (gpt-6.2-sol) <noreply@openai.com>
The change sanitizes recipe and query-configuration validation errors, applies section configuration checks during administrator previews, and displays validation rejection reasons in the row preview UI. It also updates API documentation and translation entries.
Query-definition parsing now returns sanitized errors for invalid fields, operators, durations, and configuration values. Tests check that errors omit rejected values while retaining relevant keys or paths.
Recipe validators use shared parameter decoding and no longer include rejected values in several validation errors. Tests cover invalid settings, parameter types, and malformed JSON.
Query-definition parsing is limited to section types identified as readers. Administrator previews validate recipe and section configuration before fetching. Tests and API documentation cover the validation behavior.
The preview hook maps qualifying validation failures to a rejection state. The UI displays the server reason with a new translated message; tests cover rejection and generic error states.
sequenceDiagram
participant previewAdminSection
participant RecipeValidator
participant validateSectionConfig
participant ParseQueryDefinition
participant PreviewFetcher
previewAdminSection->>RecipeValidator: validate recipe configuration
RecipeValidator-->>previewAdminSection: validation result
previewAdminSection->>validateSectionConfig: validate section configuration
validateSectionConfig->>ParseQueryDefinition: parse config for query-reading section types
ParseQueryDefinition-->>validateSectionConfig: parse result
validateSectionConfig-->>previewAdminSection: validation result
previewAdminSection->>PreviewFetcher: fetch preview when validation passes
Loading
Suggested reviewers:quick104, rhainland
Merge Risk: Moderate · up to e625a
Rejected row previews will probably show a generic "Some values aren't valid" message instead of the specific reason, which defeats the purpose of this change. The translation catalog is also pinned to a local build and must be re-synced to a published release once silo-translations#206 merges.
Security architecture risk: Low · up to e625a
Invalid drafts are rejected before previewing, without granting additional access. The main risk is rollback: a row saved with the newly accepted preset can no longer be disabled on the older version unless its configuration is also changed.
Retained concerns
Trivial · reliability · inferred: After rollback to the base version, a disable-only edit of a newly saved New in 4K row fails before persistence. The older update path validates the retained configuration as a query definition on every edit, even when only the enabled flag changes. To take the row out of service after rollback, an administrator must supply a base-compatible configuration in the same update or delete the row.
observed — The inspected route runs with acting-admin authority. Invalid drafts now terminate before the catalog fetch, while drafts that pass validation use the same context-derived identity and access filter as before.
Trust Boundaries and Controls
observed — Request-supplied section type and configuration are checked before preview execution. Library ID parsing and caller-derived catalog filtering remain separate from those configuration checks; the new validation branch does not grant authority.
Hardening Proposals
proposed — Document how to disable or replace newly accepted rows before a downgrade, and exercise that recovery path with a saved New in 4K row.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: admin row preview now reports a rejected row config (422 validation_failed with the server's reason) instead of a 500 with a generic message. The changeset matches thi…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description states the problem (the web admin row preview returns 500 for configs that saving rejects), the approach (preview runs validateSectionConfig, ReadsQueryDefinition, message changes, API…
Full details: Title check
Explanation
The title names the main change: admin row preview now reports a rejected row config (422 validation_failed with the server's reason) instead of a 500 with a generic message. The changeset matches this: previewAdminSection runs validateSectionConfig, the web form gets a new rejected state, and recipe error messages were reworked. The title follows the fix(sections) convention and is specific enough for a teammate scanning history.
Full details: Description check
Explanation
The description states the problem (the web admin row preview returns 500 for configs that saving rejects), the approach (preview runs validateSectionConfig, ReadsQueryDefinition, message changes, API doc updates), validation steps, evidence, and risks. It relates directly to the changeset, so it is not off-topic or vague.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Architecture findings (1)
Advisory architecture findings (1)
Trivial — After rollback to the base version, a disable-only edit of a newly saved New in 4K row fails before persistence. The older update path validates the retained configuration as a query definition on every edit, even when only the enabled flag changes. To take the row out of service after rollback, an administrator must supply a base-compatible configuration in the same update or delete the row.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 6b10a140-6a4c-4af2-8120-374d75b9e091
Commits
Reviewing files that changed from the base of the PR and between a78b690 and e625a40.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Functional Correctness · Quick win
Read the server reason from errors[0].detail in previewFailure.
For a 422 validation_failed, error.message is the localized catalog sentence for error.validation_failed, not the server reason. The server sends the reason in errors[0].detail, and problemDisplayText does not use it. The row form therefore shows "Some values aren’t valid. Check them and try again." instead of the rejected config's reason.
Read the first field error's detail instead. If it is absent, keep the generic error state. The RowPreview test fixture also needs an errors entry so that it exercises the production shape.
The reason will be displayed to describe this comment to others. Learn more.
Major · Data Integrity & Integration · Heavy lift
Pin the locale catalog to the published translation release.
.silo-translations pins version=local-d9cca058cc1a-dirty with sha256=-. The locale files, including web.home.addRow.preview.rejected in web/src/locales/ar-XB.json, come from that uncommitted local build. The PR requires re-syncing these files to the published silo-translations release that includes #206.
Until the pin names a published release, scripts/sync-translations cannot reinstall this state; the script stops at its local-build guard. Once a release is pinned, the next sync rebuilds the locale files from that release. If the release lacks web.home.addRow.preview.rejected, the key is dropped and the web typecheck can fail.
After #206 publishes, run scripts/sync-translations --version <release> and commit the regenerated locale files, keys.ts, and .silo-translations. Confirm the new key is present in the release before syncing.
Source: Coding guidelines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugSomething isn't workingimpact: usabilityCore flow broken or severely blockedpriority: P2Limited scope, workaround exists, or polishsize/XL500–999 added + deleted lines (all files); change volume, not priority.
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: N/A
Validation tasks: none changed. The change reaches #1140 C1 and #1141 C1 (rows created through the admin API and the web row builder). The rows those cases added still save and preview as before; only a config that saving rejects now gets a 422 from the preview.
Depends on: Silo-Server/silo-translations#206 (the new string), which merges first.
Other clients: N/A (the admin row preview and its form are web-only; the new message text reaches other clients only through the existing validation problem)
In the web admin's Add row and Edit row forms, the live preview answered 500 for a row config that saving rejects, such as a Smart row sorted by
randomor alast_air_daterule whose value is not a date. The form then said "The preview didn't load. The row still saves.", which was wrong: saving that row fails. The preview now runs the same config check as saving and shows the server's reason, for example "The preview can't show this row: sort.field is not supported". The shipped "New in 4K" preset, which the save check also rejected, now saves and previews.This affects administrators building Home and library rows, and any client calling
previewAdminSection.Approach
previewAdminSectionrunsvalidateSectionConfig, the check single-row creation runs, before any query. A rejected config gets the same 422validation_failedproblem that saving returns.validateSectionConfigparsed every row's config as a query definition. For row types whose config holds the recipe's own parameters, that parse read "New in 4K"'s{"format":"4k","sort":"recent"}as a legacy query sort and rejected it.sections.ReadsQueryDefinitionnow names the row types that read a query definition, and the other types leave their config to the recipe's check, which creation, bulk creation and edits already run.docs/architecture/api-contract.mdrequires ("Rejected values are never echoed."). They name the key or the position instead, and a rejected duration says which form is accepted. A seasonal theme key still appears in a message, but only after it matched the theme catalog exactly.validation_failedin its own state with the new stringweb.home.addRow.preview.rejected. Any other failure keeps the generic message. In a translated interface the reason is the translated field-error text, as for other v2 problems.docs/architecture/api-contract.mdanddocs/catalog-api.mdnow say the preview runs the save checks, including the rule that an administrator row of collections lists server collections only.The three parts ship together because the preview now runs the save check: that put the check's messages in front of the administrator and made "New in 4K" fail in the same form. Saving keeps its statuses, problem types and field codes, and only its message text changes. The preview answers 422 where it answered 500.
Validation
randomsort and a non-datelast_air_datevalue before any query runs, without repeating the value, and still previews a valid Smart row; everyformat_showcasepreset passes the save check and "New in 4K" previews; row types that read a query definition still reject{"sort":"recent"}. All pass with this change. The rejection and preset tests fail onmain. The "New in 4K" preview test fails when the preview runs the save check without the fix for row types that hold recipe parameters. The query-definition test passes on both, as a guard.mainand pass now.validation_failed, without "The row still saves", and the generic message for any other failure. It failed withmain's row preview code and passes now.lint-changed, Go tests with PostgreSQL, contract, generated-file and migration checks, web lint, format, build, budget and tests.make verify-actionlint,make verify-shellcheckandmake verify-prometheus-rules. The change touches no workflow, shell script or Prometheus rule.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-5686/
Each pair shows the same screen with the same empty library: Before is
mainat 8fcf75f, After is a Silo build of this branch, both in Admin > Libraries > Home Sections > Add row.sort.field "recent" is not supported. After: the row saves and appears on Home. The preset's preview works in both builds; the after set includes it.en-XApseudo-locale. The new string is translated, and the reason is the translated generic field-error text, as the web app shows for any v2 field error in a non-English interface.The web form offers no random sort. For the rejected-preview captures I patched the page's
fetchto sendsort.field: "random"in the preview request; the status (500 before, 422 after) and the reason came from the real server.Risks
mainalready uses.Checklist
AI Disclosure