pub struct FindingStore<'a> { /* private fields */ }Implementations§
Source§impl<'a> FindingStore<'a>
impl<'a> FindingStore<'a>
pub fn new(pool: &'a SqlitePool) -> Self
pub async fn upsert(&self, f: &FindingRecord) -> Result<(), StoreError>
Sourcepub async fn list_run_membership(
&self,
run_id: &str,
) -> Result<Vec<(String, String)>, StoreError>
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.
pub async fn get(&self, id: &str) -> Result<Option<FindingRecord>, StoreError>
Sourcepub async fn list_active_for_repo(
&self,
repo: &str,
) -> Result<Vec<FindingRecord>, StoreError>
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.
Sourcepub async fn list_filtered(
&self,
filter: &FindingFilter<'_>,
) -> Result<Vec<FindingRecord>, StoreError>
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.
pub async fn list_by_run( &self, run_id: &str, ) -> Result<Vec<FindingRecord>, StoreError>
pub async fn set_triage( &self, id: &str, state: &str, assignee: Option<&str>, ) -> Result<(), StoreError>
pub async fn set_chain( &self, id: &str, chain_id: &str, ) -> Result<(), StoreError>
Sourcepub async fn set_spec(
&self,
id: &str,
spec_id: &str,
attack_provenance: &str,
prompt_version: &str,
) -> Result<(), StoreError>
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.
Sourcepub async fn set_attack_provenance(
&self,
id: &str,
attack_provenance: &str,
prompt_version: &str,
) -> Result<(), StoreError>
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.
Sourcepub async fn per_path_promotion_rate(
&self,
repo: &str,
) -> Result<HashMap<String, f64>, StoreError>
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.
Sourcepub async fn set_verify_result(
&self,
id: &str,
status: &str,
verdict_blob: &str,
attack_provenance: &str,
) -> Result<(), StoreError>
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.
pub async fn supersede(&self, id: &str, by_id: &str) -> Result<(), StoreError>
pub async fn delete(&self, id: &str) -> Result<u64, StoreError>
Sourcepub async fn manual_promote(
&self,
id: &str,
new_status: &str,
verdict_blob: &str,
) -> Result<(), StoreError>
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.
Sourcepub async fn manual_dismiss(
&self,
id: &str,
verdict_blob: &str,
) -> Result<(), StoreError>
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.
Sourcepub async fn quarantine(
&self,
id: &str,
reason_json: &str,
) -> Result<u64, StoreError>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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