Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
design_fidelity_ledger.hpp
Go to the documentation of this file.
1#pragma once
2
3// Named fidelity taxonomy + per-run ledger.
4//
5// design_fidelity.hpp computes FidelityIssue findings (skew, dropped-vector, …)
6// during codegen. This is the reporting layer on top of them:
7//
8// - a NAMED taxonomy: every fidelity kind the checks can emit, each with a
9// stable slug, a default severity, and a one-line description. Tooling and
10// humans get a documented contract instead of ad-hoc `kind` strings.
11// - a per-run LEDGER: a deterministic JSON report of one import's findings
12// with per-kind counts, so an import's fidelity is a durable, diffable
13// artifact rather than transient stderr lines. Warnings are data, not
14// failures — the ledger records everything and lets the consumer decide.
15//
16// Kept separate from design_fidelity.cpp so the pure checks stay free of JSON
17// and reporting concerns.
18
19#include <pulp/view/design_fidelity.hpp> // FidelityIssue
20
21#include <string>
22#include <string_view>
23#include <vector>
24
25namespace pulp::view {
26
28inline constexpr std::string_view kFidelityLedgerVersion = "2026.07-fidelity-ledger-v1";
29
33 std::string kind;
34 std::string severity;
35 std::string summary;
36};
37
42const std::vector<FidelityKindInfo>& fidelity_taxonomy();
43
45const FidelityKindInfo* fidelity_kind_info(const std::string& kind);
46
49 std::string source;
50 std::string output;
51 std::string generated_at;
52};
53
59std::string fidelity_ledger_json(const std::vector<FidelityIssue>& issues,
60 const FidelityLedgerMeta& meta);
61
62} // namespace pulp::view
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
std::string fidelity_ledger_json(const std::vector< FidelityIssue > &issues, const FidelityLedgerMeta &meta)
Serialize one import run's findings to a deterministic JSON ledger.
constexpr std::string_view kFidelityLedgerVersion
Format id stamped into the ledger JSON; bump on a non-additive shape change.
Definition design_fidelity_ledger.hpp:28
const FidelityKindInfo * fidelity_kind_info(const std::string &kind)
Look up a kind by slug; nullptr if it is not in the taxonomy.
const std::vector< FidelityKindInfo > & fidelity_taxonomy()
Every fidelity kind the checks can emit, in a stable documentation order.
One entry in the named fidelity taxonomy: the stable kind slug the checks emit, its typical severity,...
Definition design_fidelity_ledger.hpp:32
std::string kind
matches FidelityIssue::kind ("dropped-vector", …)
Definition design_fidelity_ledger.hpp:33
std::string severity
typical severity: "warning" | "info"
Definition design_fidelity_ledger.hpp:34
std::string summary
one-line description of the divergence
Definition design_fidelity_ledger.hpp:35
Provenance recorded in the ledger header.
Definition design_fidelity_ledger.hpp:48
std::string generated_at
caller-supplied timestamp; empty = omitted
Definition design_fidelity_ledger.hpp:51
std::string output
output artifact path
Definition design_fidelity_ledger.hpp:50
std::string source
design source name (figma-plugin, fig, …)
Definition design_fidelity_ledger.hpp:49