| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Convex.Tasty.Streaming.TMSummary
Synopsis
- data ThreatModelSummary = ThreatModelSummary {}
- data ThreatModelCategory
- data Fault
- = Contract
- | Declaration
- | Setup
- faultLabel :: Fault -> String
- threatModelGroupName :: ThreatModelCategory -> String
- data TMStore
- newtype TMRecorder = TMRecorder {
- tmRecord :: String -> ThreatModelSummary -> IO ()
- newtype TMStoreOption = TMStoreOption (Maybe TMStore)
- data TraceRecorder = TraceRecorder {
- trEnabled :: IO Bool
- recordIteration :: String -> String -> [SrcLocRange] -> Value -> IO ()
- findTestIdIO :: String -> String -> IO (Maybe Int)
- newtype CoverageIndexStorage = CoverageIndexStorage {}
- newTMStore :: IO TMStore
- storeRecorder :: TMStore -> TMRecorder
- lookupThreatModelSummary :: TMStore -> String -> IO (Maybe ThreatModelSummary)
Documentation
data ThreatModelSummary Source #
Structured summary of a threat-model test case.
Constructors
| ThreatModelSummary | |
Instances
data ThreatModelCategory Source #
Which list of a suite's ThreatModelsFor instance a threat model was run
from. It decides how the counts in a ThreatModelSummary are to be read: the
same tmsFailed (the attack's mutated transaction still validated) is a
vulnerability for a Claimed model, the required outcome for an Expected
one, and a known, tolerated artifact for an Accepted one. A consumer that
alerts on failed > 0 must therefore filter on the category first.
Constructors
| Claimed | From |
| Expected | From |
| Accepted | From |
| Surveyed | From |
| NotApplicable | From |
Instances
Whose fault a failing threat-model test case is.
Only one cell of the slot-by-outcome matrix is the contract's fault; most red is a stale declaration. Saying which lets a reader — or a dashboard — tell "the contract regressed" from "somebody needs to update the instance", and stops a resolved vulnerability from reading as a broken contract.
Constructors
| Contract | The script is at fault: fix the contract. |
| Declaration | The |
| Setup | The attack could not be carried out: fix the generator, or accept a harness limit. |
Instances
| FromJSON Fault Source # | |
| ToJSON Fault Source # | |
| Bounded Fault Source # | |
| Enum Fault Source # | |
Defined in Convex.Tasty.Streaming.TMSummary | |
| Generic Fault Source # | |
| Show Fault Source # | |
| Eq Fault Source # | |
| Ord Fault Source # | |
| type Rep Fault Source # | |
Defined in Convex.Tasty.Streaming.TMSummary type Rep Fault = D1 ('MetaData "Fault" "Convex.Tasty.Streaming.TMSummary" "convex-tasty-streaming-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Contract" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Declaration" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Setup" 'PrefixI 'False) (U1 :: Type -> Type))) | |
faultLabel :: Fault -> String Source #
The prefix a failure message leads with, so the fault is greppable.
threatModelGroupName :: ThreatModelCategory -> String Source #
The Tasty group that a category's per-model test cases live under. The
single source of both the group the test tree is built with and the names the
streaming reporter matches on, so that a category cannot end up in a group the
reporter does not recognise (--test-id resolves a per-model test's
Positive tests prerequisite from these names).
newtype TMRecorder Source #
A recorder closure passed to test bodies via Tasty's option system. The default no-op makes summaries silently dropped when the streaming reporter is not active.
Constructors
| TMRecorder | |
Fields
| |
Instances
| IsOption TMRecorder Source # | |
Defined in Convex.Tasty.Streaming.TMSummary Methods defaultValue :: TMRecorder Source # parseValue :: String -> Maybe TMRecorder Source # optionName :: Tagged TMRecorder String Source # optionHelp :: Tagged TMRecorder String Source # showDefaultValue :: TMRecorder -> Maybe String Source # | |
newtype TMStoreOption Source #
Internal option carrying the live store. Set by defaultMainStreaming
alongside the recorder so the reporter can read summaries back out.
Constructors
| TMStoreOption (Maybe TMStore) |
Instances
| IsOption TMStoreOption Source # | |
Defined in Convex.Tasty.Streaming.TMSummary Methods defaultValue :: TMStoreOption Source # parseValue :: String -> Maybe TMStoreOption Source # optionName :: Tagged TMStoreOption String Source # optionHelp :: Tagged TMStoreOption String Source # | |
data TraceRecorder Source #
Callback for recording iteration traces as pre-serialized JSON. Arguments: group name, category ("positive"/"negative"), pre-serialized trace JSON. Default is a no-op (zero overhead when streaming is not active).
When trEnabled returns True, test bodies use the expensive traced code
path (building IterationTrace values with UTxO snapshots, transaction
summaries, and JSON serialisation). When it returns False (the IsOption
default), the cheap runActions path is used instead, avoiding all that
work.
trEnabled is an IO action so that the decision can be deferred until the
streaming reporter has parsed --no-trace and written the shared IORef.
Constructors
| TraceRecorder | |
Fields
| |
Instances
| IsOption TraceRecorder Source # | |
Defined in Convex.Tasty.Streaming.TMSummary Methods defaultValue :: TraceRecorder Source # parseValue :: String -> Maybe TraceRecorder Source # optionName :: Tagged TraceRecorder String Source # optionHelp :: Tagged TraceRecorder String Source # | |
newtype CoverageIndexStorage Source #
Internal option carrying the coverage index, i.e. all the possible code range that can be reported as covered.
Constructors
| CoverageIndexStorage | |
Fields | |
Instances
| IsOption CoverageIndexStorage Source # | |
Defined in Convex.Tasty.Streaming.TMSummary | |
newTMStore :: IO TMStore Source #
Allocate fresh storage. Call once per reporter run.
storeRecorder :: TMStore -> TMRecorder Source #
Build a recorder that writes into the given store.
lookupThreatModelSummary :: TMStore -> String -> IO (Maybe ThreatModelSummary) Source #
Look up a summary by key (does not delete).