askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
danq9
signup: the person chooses the password and name on the confirm page
83c7aa6
2 weeks, 5 days ago
History
dbbasic-package.json · 3.3 KB · 53 lines
| 1 | { |
| 2 | "id": "app-settings", |
| 3 | "name": "Settings", |
| 4 | "version": "0.4.0", |
| 5 | "description": "user_prefs (per-user, owner-scoped settings) and feature_flags (instance-level toggles) per docs/upgrade-and-customization.md Rule 5. Effective flag value = user override (a user_prefs key of \"flag:<name>\") -> instance feature_flags value, resolved by GET /api/flags. Also ai_prices: instance-level, live-editable per-model AI pricing that object_ai's cost recording looks up instead of hardcoding. The hook added in this version enforces ONE ROW PER KEY. app_settings is read by forty-odd objects, each through its own small _setting() helper that scans and returns the FIRST matching row -- a reasonable reader, dangerous only because nothing stopped a second row with the same key from existing. A duplicate does not conflict and does not warn; it simply loses, invisibly, and the operator has no way to see why their change did nothing. That shipped a wrong journal on a live box: an inventory account setting had a stale verification value, a correct one was added beside it, and the next sale credited the stale account -- balanced, and wrong. Same posture as the provenance rule in hook_wallet_entries: stop honouring an invariant in every reader and enforce it at the one write path they share. The 409 names the record that already owns the key, because the operator's next question is always where it IS set. 0.4.0 adds unit_prices, which exists because ai_prices CANNOT express media pricing: a token has a rate (per-million in, per-million out) and an image has a PRICE -- (model, quality, size) -> cents per image, and video is (model, size) -> cents per second. There is no arithmetic that turns gpt-image-2 at 1024x1024 into the same model at 1536x1024; they are different products on a published table. So object_unit_prices looks a row up and REFUSES when there is none, rather than interpolating or falling back to a cheaper neighbour, either of which quotes a price the provider will not honour. The quote must also exist BEFORE the call, because a media run is held against the wallet at submission: an unpriced model is a run that cannot be held, and must be refused at submission rather than discovered after a 12-second sora-2-pro job has already cost six dollars. A blank dimension is a wildcard so a provider charging one price for every size need not enumerate them, and an exact row always beats a wildcard so a specific price can be added later without deleting the catch-all.", |
| 6 | "compatibility": { |
| 7 | "dbbasic_object_server": ">=0.1.0" |
| 8 | }, |
| 9 | "objects": [ |
| 10 | { |
| 11 | "id": "hook_app_settings", |
| 12 | "path": "objects/hook/app_settings.py" |
| 13 | } |
| 14 | ], |
| 15 | "schemas": [ |
| 16 | { |
| 17 | "collection": "user_prefs", |
| 18 | "path": "schemas/user_prefs.json" |
| 19 | }, |
| 20 | { |
| 21 | "collection": "feature_flags", |
| 22 | "path": "schemas/feature_flags.json" |
| 23 | }, |
| 24 | { |
| 25 | "collection": "ai_prices", |
| 26 | "path": "schemas/ai_prices.json" |
| 27 | }, |
| 28 | { |
| 29 | "collection": "app_settings", |
| 30 | "path": "schemas/app_settings.json" |
| 31 | }, |
| 32 | { |
| 33 | "collection": "unit_prices", |
| 34 | "path": "schemas/unit_prices.json" |
| 35 | } |
| 36 | ], |
| 37 | "permissions": [ |
| 38 | { |
| 39 | "path": "permissions/rules.json" |
| 40 | } |
| 41 | ], |
| 42 | "seed": [ |
| 43 | { |
| 44 | "collection": "ai_prices", |
| 45 | "path": "seed/ai_prices.tsv" |
| 46 | }, |
| 47 | { |
| 48 | "collection": "unit_prices", |
| 49 | "path": "seed/unit_prices.tsv" |
| 50 | } |
| 51 | ], |
| 52 | "migrations": [] |
| 53 | } |