|
| 1 | +--- |
| 2 | +'@objectstack/service-settings': patch |
| 3 | +--- |
| 4 | + |
| 5 | +feat(service-settings): a settings value that misses the format its `email`, `url`, `phone` or `color` type declares is now reported in the server log; the save is still accepted (#24882) |
| 6 | + |
| 7 | +Clause-②: no (warning only: every save and every `OS_*` override accepted before is still accepted, with the same value stored or served, the same status and the same errors) |
| 8 | + |
| 9 | +ADR-0007 declares a format for four specifier types: `email`, `url` and `phone` take "format validation", and `color` takes a hex string. Until now nothing judged that format. `PUT /api/settings/branding` stored a Logo URL of `not a url` and answered 200, and an `OS_*` override was served unchecked. |
| 10 | + |
| 11 | +Both doors now judge the format through one shared check, and report a miss instead of refusing it: |
| 12 | + |
| 13 | +- **Save.** When a save is accepted and a key it touches holds a value that misses its type's format, the service logs one `warn` line for that key. The line names the setting, the type, the expected format and the value's length. |
| 14 | +- **Environment override.** An in-force `OS_*` override whose value misses the format draws one `warn` line, at boot or on the first read. The line names the variable, the setting, the type and the expected format. The override stays in force, is served with source `env`, and still locks the key. |
| 15 | +- **The value is never printed** in either line, for any key. |
| 16 | + |
| 17 | +The formats are the platform's existing grammars for the same words: |
| 18 | + |
| 19 | +- `email`: an address with a dotted domain, the grammar the mail transport sends with. |
| 20 | +- `url`: `scheme://…`, a root-relative `/path`, a `data:` URI or a `blob:` URL. An http(s)-only grammar would flag a relative logo path that the branding reader serves. |
| 21 | +- `phone`: digits, spaces and `+ ( ) - .`, at least five characters. |
| 22 | +- `color`: `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa`. |
| 23 | + |
| 24 | +Empty values and non-string values are not judged. |
| 25 | + |
| 26 | +**Unchanged.** Status codes, response bodies, stored values, the `FieldError`s a refused save carries, and which overrides are in force. Under the standing rule 「甲」, refusing these values waits for the next major version. |
0 commit comments