Skip to main content

FindingStore

Struct FindingStore 

Source
pub struct FindingStore<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> FindingStore<'a>

Source

pub fn new(pool: &'a SqlitePool) -> Self

Source

pub async fn upsert(&self, f: &FindingRecord) -> Result<(), StoreError>

Source

pub async fn list_run_membership( &self, run_id: &str, ) -> Result<Vec<(String, String)>, StoreError>

All (finding_id, status) pairs observed during run_id. Backs the FindingDiffStatus classifier in the API layer. Returns an empty vec when the run never observed any finding.

Source

pub async fn get(&self, id: &str) -> Result<Option<FindingRecord>, StoreError>

Source

pub async fn list_active_for_repo( &self, repo: &str, ) -> Result<Vec<FindingRecord>, StoreError>

List findings for repo filtered by the UI’s standard (cap, status, origin) triple. Quarantine rows are excluded.

Source

pub async fn list_filtered( &self, filter: &FindingFilter<'_>, ) -> Result<Vec<FindingRecord>, StoreError>

Composite filter used by the findings browser. Every field is optional; combining them ANDs in SQLite, and an empty filter returns every active row (i.e. status != Quarantine unless FindingFilter::include_quarantine is set). Ordering matches FindingStore::list_active_for_repo / FindingStore::list_by_run: most-recent last_seen first.

Source

pub async fn list_by_run( &self, run_id: &str, ) -> Result<Vec<FindingRecord>, StoreError>

Source

pub async fn set_triage( &self, id: &str, state: &str, assignee: Option<&str>, ) -> Result<(), StoreError>

Source

pub async fn set_chain( &self, id: &str, chain_id: &str, ) -> Result<(), StoreError>

Source

pub async fn set_spec( &self, id: &str, spec_id: &str, attack_provenance: &str, prompt_version: &str, ) -> Result<(), StoreError>

Stamp id with the SpecDerivation result. Sets the spec_id back-link plus the attack_provenance / prompt_version columns so the findings detail view can render “AI synthesised the harness spec for this row” without an extra join. Runtime- checked SQL to keep the .sqlx/ cache from growing for a helper that only runs once per finding per scan.

Source

pub async fn set_attack_provenance( &self, id: &str, attack_provenance: &str, prompt_version: &str, ) -> Result<(), StoreError>

Stamp id with the supplied attack_provenance + prompt_version pair without touching status / verdict_blob. Used after PayloadSynthesis insert so the finding’s detail view can render “AI synthesised the payload for this row” without joining through the payloads table. Runtime-checked SQL to keep the .sqlx/ cache from growing for a helper called once per finding per scan.

Source

pub async fn per_path_promotion_rate( &self, repo: &str, ) -> Result<HashMap<String, f64>, StoreError>

Per-path AI-finding promotion rate for repo, in [0.0, 1.0]. Numerator: AI-originated findings on the path whose final status is Open (verifier-confirmed) or Verified (operator- promoted). Denominator: total AI-originated findings on the path, plus a Laplace prior so a path with one observation does not score the same as a path with fifty. Backs the file priority heuristic in the Novel discovery walker: paths that historically converted are more worth burning AI budget on.

Source

pub async fn set_verify_result( &self, id: &str, status: &str, verdict_blob: &str, attack_provenance: &str, ) -> Result<(), StoreError>

Stamp the verifier outcome on id: flips status (Verified for Confirmed, Closed for NotConfirmed, untouched for Errored, where the caller passes the row’s existing status) and overwrites verdict_blob + attack_provenance.

Source

pub async fn supersede(&self, id: &str, by_id: &str) -> Result<(), StoreError>

Source

pub async fn delete(&self, id: &str) -> Result<u64, StoreError>

Source

pub async fn manual_promote( &self, id: &str, new_status: &str, verdict_blob: &str, ) -> Result<(), StoreError>

Operator-driven promote: flip id to new_status, write the supplied JSON verdict_blob, and stamp attack_provenance = 'ManualPromote' so the audit trail distinguishes operator overrides from verifier-confirmed rows. Mirror image of the candidate-side promote_candidate_to_finding path: both writers now produce a typed ManualPromote blob instead of reusing set_verify_result.

Source

pub async fn manual_dismiss( &self, id: &str, verdict_blob: &str, ) -> Result<(), StoreError>

Operator-driven dismissal: flip id to 'Closed', write the supplied JSON verdict_blob, and stamp attack_provenance = 'ManualDismiss'. Used for the quarantine dismiss flow, where reusing set_verify_result would silently inherit the prior verifier’s provenance and obscure the operator’s intent.

Source

pub async fn quarantine( &self, id: &str, reason_json: &str, ) -> Result<u64, StoreError>

Flip id to status = 'Quarantine', stamping verdict_blob with the supplied JSON reason. PayloadSynthesis falls back here when both synthesis attempts fail to parse; SpecDerivation and NovelFindingsDiscovery reuse the same shape so the quarantine page can surface a uniform reason field. Runtime-checked SQL to avoid bloating the .sqlx/ cache with a one-off operator-facing helper; the parameter is bound, so injection is not a concern.

Auto Trait Implementations§

§

impl<'a> Freeze for FindingStore<'a>

§

impl<'a> !RefUnwindSafe for FindingStore<'a>

§

impl<'a> Send for FindingStore<'a>

§

impl<'a> Sync for FindingStore<'a>

§

impl<'a> Unpin for FindingStore<'a>

§

impl<'a> UnsafeUnpin for FindingStore<'a>

§

impl<'a> !UnwindSafe for FindingStore<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Fruit for T
where T: Send + Downcast,