feat(reports): add safe custom report builder (PMS-180) #148
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/pms-180-custom-report-builder"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Add the safe custom report builder (PMS-180), the last open piece of PMS-93. PMS-93 rejected an ad-hoc SQL query builder for v1 (injection / performance risk); this is the curated, whitelisted alternative. The user never writes SQL or raw column names.
Design
src/modules/reports/custom.rsholds a server-side catalog of report sources (tickets, time_entries, assets), each exposing a whitelisted set of dimensions (group-by), measures (aggregates), and equality filters. The builder:&'static strexpressions only,tenant_id,limit(default 100, max 1000), requires at least one measure, and only ever generatesSELECT.Results come back as the generic columns / rows / totals envelope (the shape PMS-93 AC2 wanted), with an optional
"format": "csv".Endpoints (both
RequireReports)GET /api/v1/reports/custom/schema- the catalog, so the SPA renders the builder dynamically.POST /api/v1/reports/custom- validate a spec and run it.A
customdescriptor is added to theGET /reportsregistry for discoverability.Tests
tests/reports.rsgainscustom_report_runs_and_exports,custom_report_rejects_unknown_fields(unknown / malicious source, dimension, measure, and empty-measure all 400; a valid spec succeeds), andcustom_report_is_tenant_scoped. All 8 reports tests pass; 115 lib tests,clippy --all-targets -- -D warnings, andcargo fmt --checkare clean.Out of scope (future)
Saved / shareable report definitions, scheduled delivery, charts on custom results, cross-source joins, non-equality operators, and financial sources behind the manager gate.
🤖 Generated with Claude Code