Skip to content

Commit 57646a1

Browse files
committed
Merge remote-tracking branch 'origin/claude/new-session-th4e9w-clippy' into claude/new-session-th4e9w-readiness
2 parents a7777db + 74a4654 commit 57646a1

5 files changed

Lines changed: 46 additions & 25 deletions

File tree

‎src/aggregate/proven_tests.rs‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ impl ReportTier {
119119
impl FromStr for ProvenTestsReport {
120120
type Err = anyhow::Error;
121121

122-
/// Parse a run report from JSON text.
122+
/// Parse a run report from JSON text, requiring schema version 1.
123+
///
124+
/// # Errors
125+
/// Returns JSON deserialisation errors or an error if `schema_version` is not 1.
123126
fn from_str(text: &str) -> Result<Self> {
124127
let report: ProvenTestsReport =
125128
serde_json::from_str(text).context("parsing proven-tests run report")?;
@@ -134,7 +137,11 @@ impl FromStr for ProvenTestsReport {
134137
}
135138

136139
impl ProvenTestsReport {
137-
/// Parse a run report from a file path.
140+
/// Read a UTF-8 JSON run report from `path` and parse it as schema version 1.
141+
///
142+
/// # Errors
143+
/// Returns file read errors (including invalid UTF-8), JSON deserialisation
144+
/// errors or an error if `schema_version` is not 1.
138145
pub fn from_path(path: &Path) -> Result<Self> {
139146
let text =
140147
std::fs::read_to_string(path).with_context(|| format!("reading {}", path.display()))?;

‎src/assail/analyzer.rs‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,18 +263,16 @@ static RE_HARDCODED_SECRET: OnceLock<Regex> = OnceLock::new();
263263
/// Does not handle OCaml `(* *)` or Forth `\` — edge cases for later.
264264
static RE_TODO_COMMENT: OnceLock<Regex> = OnceLock::new();
265265

266-
/// Heuristic: is the `malloc` on `lines[idx]` NULL-checked within a short
267-
/// window of following lines?
266+
/// Heuristically recognise a null check for the allocation on `lines[idx]`.
268267
///
269-
/// An "UncheckedAllocation" finding should only fire when the result is *not*
270-
/// guarded. This recognises the common C idioms (`if (p == NULL)`,
271-
/// `if (!p)`, `if (p == nullptr)`) on the lvalue assigned from `malloc`.
268+
/// Searches the allocation line and up to six following lines for `NULL` or
269+
/// `nullptr` alongside the assigned identifier, or an `if` line containing `!`
270+
/// immediately followed by that identifier. If no identifier can be extracted,
271+
/// any `NULL` or `nullptr` substring in the window suffices. Substring matches
272+
/// do not establish that the allocation is guarded.
272273
///
273-
/// Deliberately conservative to avoid false negatives in a security scanner:
274-
/// a site is treated as checked only on a clear NULL-guard signal that
275-
/// references the allocated variable (or, when no lvalue can be parsed, any
276-
/// NULL/nullptr token in the window). Genuinely-unchecked allocations — the
277-
/// real finding — are still reported.
274+
/// # Panics
275+
/// Panics if the zero-based `idx` is outside `lines`.
278276
fn c_alloc_result_is_null_checked(lines: &[&str], idx: usize) -> bool {
279277
let line = lines[idx];
280278
// Parse the lvalue assigned from malloc: the last identifier left of '='.

‎src/diagnostics.rs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ const HYPATIA_ENV: &str = "HYPATIA_API_KEY";
1111
const GITBOT_FLEET_ENV: &str = "GITBOT_FLEET_ENDPOINT";
1212
const PANICBOT_DIRECTIVE_PATH: &str = ".machine_readable/bot_directives/panicbot.scm";
1313

14+
/// Print readiness checks using `manifest`, paths relative to the current
15+
/// working directory and the configured integration environment variables.
16+
///
17+
/// # Errors
18+
/// Returns an error after printing all results if any check has error severity.
19+
/// Warnings alone do not cause failure.
1420
pub fn run_self_diagnostics(manifest: &Manifest) -> Result<()> {
1521
println!("panic-attack self-diagnostics");
1622

‎src/report/gui.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ impl ReportGui {
120120
}
121121

122122
impl App for ReportGui {
123+
/// Render the file loader, navigation and selected report tab.
124+
/// A load-button click or Enter after the path field loses focus attempts
125+
/// to read the specified JSON file, updating the viewer or its status message.
123126
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut Frame) {
124127
egui::Panel::top("header").show(ui, |ui| {
125128
ui.horizontal(|ui| {

‎src/storage/mod.rs‎

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,10 @@ pub struct MigrationSemantic {
229229
pub snapshot_label: Option<String>,
230230
}
231231

232-
/// Build a VerisimDB hexad from an assault report
232+
/// Build a VerisimDB hexad from an assault report.
233+
///
234+
/// # Errors
235+
/// Propagates errors from serialising the report into its JSON document.
233236
fn build_hexad(report: &AssaultReport) -> Result<PanicAttackHexad> {
234237
let now = Utc::now();
235238
let id = format!(
@@ -375,6 +378,9 @@ pub fn persist_report(
375378
///
376379
/// Unlike single-repo hexads which wrap an AssaultReport, assemblyline
377380
/// hexads capture the batch scan results across many repos.
381+
///
382+
/// # Errors
383+
/// Propagates errors from serialising the report into its JSON document.
378384
fn build_assemblyline_hexad(
379385
report: &crate::assemblyline::AssemblylineReport,
380386
) -> Result<PanicAttackHexad> {
@@ -492,13 +498,13 @@ fn severity_label(severity: &crate::types::Severity) -> &'static str {
492498
}
493499
}
494500

495-
/// Build one hexad per `WeakPoint` across all repo results in an
496-
/// assemblyline report (issue #33 S1).
501+
/// Build one hexad per unsuppressed `WeakPoint` across repo results with an
502+
/// AssailReport in an assemblyline report (issue #33 S1).
497503
///
498504
/// Subject identity lives in `semantic.finding.finding_id`; each emitted
499-
/// hexad's top-level `id` remains per-run-unique so two runs of the same
500-
/// finding produce two distinct hexad files (the join key is the
501-
/// `finding_id`, not the hexad id).
505+
/// hexad's top-level `id` includes a millisecond timestamp and repo/finding
506+
/// indices. IDs are distinct within a call but may repeat across calls in
507+
/// the same millisecond; use `finding_id` as the join key.
502508
///
503509
/// `run_id` is shared across every finding-hexad in this run and stamped
504510
/// into both `first_seen_run` and `last_seen_run` (S1 has no prior-run
@@ -662,10 +668,10 @@ fn derive_crosslang_interactions_for_report(
662668
/// repo in an assemblyline report (issue #33 kanren-crosslang follow-up).
663669
///
664670
/// Subject identity lives in `semantic.crosslang.interaction_id`; the
665-
/// top-level hexad `id` is per-run-unique so two runs of the same
666-
/// interaction produce two distinct hexad files (the join key is the
667-
/// `interaction_id`, not the hexad id). Returns an empty `Vec` when the
668-
/// report has no AssailReport-bearing results or no derivable interactions.
671+
/// top-level hexad `id` includes a millisecond timestamp and repo/interaction
672+
/// indices. IDs are distinct within a call but may repeat across calls in
673+
/// the same millisecond; use `interaction_id` as the join key. Returns an empty
674+
/// `Vec` when the report has no AssailReport-bearing results or no derivable interactions.
669675
pub fn build_crosslang_hexads(
670676
report: &crate::assemblyline::AssemblylineReport,
671677
) -> Result<Vec<PanicAttackHexad>> {
@@ -772,9 +778,10 @@ const HEXAD_FILE_READ_LIMIT: u64 = 16 * 1024 * 1024;
772778

773779
/// Build a campaign-state hexad for one lifecycle event (issue #33 S2).
774780
///
775-
/// Append-only: each call produces a fresh hexad with a unique id. The
776-
/// `finding_id` is carried as the semantic subject so the newest hexad
777-
/// per finding is the current state.
781+
/// The id is derived from the current millisecond timestamp, so calls in the
782+
/// same millisecond can produce the same id. This only constructs a hexad;
783+
/// it does not write to storage. The `finding_id` is carried as the semantic
784+
/// subject so stored events can be grouped by finding.
778785
pub fn build_campaign_hexad(semantic: CampaignSemantic) -> PanicAttackHexad {
779786
let now = Utc::now();
780787
let hexad_id = format!(

0 commit comments

Comments
 (0)