Files
descrybe/README_FIX_2026-10-20.md
T
2026-10-20 17:03:09 +02:00

27 lines
2.9 KiB
Markdown

# Descrybe: processing credit settings and Unicode exports (2026-10-20)
## Changes
- Fixed `PUT /api/admin/credit-value-eur` failing with `unknown settings key`. The platform-settings allowlist now permits the `billing.reference_eur_per_credit` value (not a secret).
- Fixed `GET /api/admin/processing-costs` reporting `could not scan processing costs` by reading PostgreSQL numeric/integer costs as text, then explicitly parsing into the JSON response. This avoids driver conversion problems across schema revisions.
- Product Management can still start a valid full-enrichment request when the *credit estimate* endpoint is temporarily unavailable, without displaying an invented credit estimate. A retry action is provided. Permission and billing checks still happen on the API/worker side.
- Price, stock and availability remain optional supplier/product inputs; missing values are not fabricated or used to block enrichment.
- All server-generated CSV downloads (product exports, public feed CSV, usage, Stripe invoices, AI costs) now use UTF-8 plus a single BOM (`EF BB BF`) for direct Microsoft Excel compatibility.
- Browser-generated CSV/TSV downloads (categories, attribute templates, sample feed) use UTF-8 with BOM. XML and JSON exports remain standard UTF-8 **without** a BOM.
- Added tests for credit reference-setting permission, price/stock-optional enrichment, CSV/TSV Unicode and XML/JSON preservation.
## Deploy
1. Backup your database and deploy **both** the updated Go API/worker and SvelteKit web client. Don't just upload the web files.
2. Apply existing database migrations through `054_catalog_import_languages.sql`, especially `049_processing_cost_overrides.sql` and `053_content_credit_rates.sql`. From the project root, `npm run migrate` after setting up the database environment.
3. Rebuild/restart API and web; refresh the UI.
4. In Admin > Billing, save the EUR-per-credit **reference value**. Set the actual product/output credit costs on the plan separately; **EUR reference value does not set processing charges**.
5. Check `GET /api/admin/processing-costs` and `GET /api/billing/processing-costs` with appropriate authenticated roles.
6. Try an imported product with no price/stock information, and export `Črpalka, šoba, Žarnica` to CSV. A CSV file should begin `EF BB BF` and decode as UTF-8.
## Validation in this environment
- Focused JS tests (pricing fallback, plan mode, UTF-8 exports): **6 passed, 0 failed**.
- Full web test suite: **299 passed, 6 failed**, due to unrelated existing translation key discrepancies, an absent source file and missing dependencies in the supplied archive.
- Go source was formatted/parsed by `gofmt`. Full Go tests/build could not be run here: project requires Go 1.25, host has Go 1.23.2, and external downloads are unavailable. Run `go test ./internal/platformsettings ./internal/feeds ./internal/httpapi ./internal/billing ./internal/processing` from `apps/api` in your Go 1.25 environment.