feat(18-01): write-only settings secrets, richeditor and tabs on settings forms (task 3)
- type: password on a settings form binds a lagoon.Encrypted column as a write-only secret (any other column fails boot naming the field): the GET omits it from data and reports stored, env or empty per field in meta.secrets; on PUT an absent key or "" keeps the value, null clears it, a non-string is a 422; the answer never carries a value - cabana.SecretFallbacks (field to config key) gives the env state; cabana.SettingsMeta, SecretStored/SecretEnv/SecretEmpty exported - settings forms accept richeditor: the Put sanitizes through seaglass like a controller save and returns meta.notices; repeater and dependsOn stay refused (settingsFormOnly next to controllerFormOnly) - backend::lang secret.* phrases in en and pl - admin SPA: PasswordField secret status line (stored with Remove stored value, env, empty, pending clear with Undo), SettingsFormView tabs with error-tab activation and the secrets/notices meta, settings payload that never sends an untouched secret; regenerated OpenAPI and TS types; rebuilt dist - vault fixture, TestSettingsSecretCompile, Docker TestSettingsSecretSmoke and TestSettingsRichEditorSmoke, conform settings fixture with a password field; settings.md sections, forms.md notes, cabana README
This commit is contained in:
@@ -344,7 +344,8 @@ func TestDependentRecheck(t *testing.T) {
|
||||
// TestRichEditor pins D-10 through the routes: a save stores the sanitized
|
||||
// value with notices in the request locale, clean HTML byte for byte with
|
||||
// none, null stays null, a value that is not a string is a 422 that writes
|
||||
// nothing; and settings and relation forms refuse the type at boot.
|
||||
// nothing; relation forms refuse the type at boot and settings forms accept
|
||||
// it (Phase 18 F3).
|
||||
func TestRichEditor(t *testing.T) {
|
||||
t.Run("boot refusals", func(t *testing.T) {
|
||||
for name, field := range map[string]string{
|
||||
@@ -360,9 +361,16 @@ func TestRichEditor(t *testing.T) {
|
||||
Code: "companions_settings", Label: "Settings", Category: "Acme", Form: "models/settings/fields.yaml", Model: "Profile",
|
||||
NewModel: func() any { return &companionsProfile{} }, Permissions: []string{"acme.companions.access"},
|
||||
}}})
|
||||
if err == nil || !strings.Contains(err.Error(), "setting companions_settings field body: "+name+" is supported in controller forms only") {
|
||||
// Phase 18 F3: a settings form lets a richeditor through its
|
||||
// gate (the fixture then fails on the missing column, not on
|
||||
// the type); a repeater is still refused.
|
||||
refused := err != nil && strings.Contains(err.Error(), "setting companions_settings field body: "+name+" is supported in controller forms only")
|
||||
if name == "repeater" && !refused {
|
||||
t.Fatalf("settings form with %s: err = %v", name, err)
|
||||
}
|
||||
if name == "richeditor" && (refused || err == nil || !strings.Contains(err.Error(), "field body is not a model column")) {
|
||||
t.Fatalf("settings form with richeditor should pass the gate: err = %v", err)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user