Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/autophagy-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ enum Commands {
query: Option<String>,

/// Exact normalized operation signature, such as
/// `operation/v1|shell|cargo test`.
/// `operation/v2|shell|cargo test`.
#[arg(long, value_name = "SIGNATURE")]
signature: Option<String>,

Expand Down
24 changes: 24 additions & 0 deletions crates/autophagy-cli/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ pub struct IndexStatus {
pub signatures: u64,
/// Whether redacted tool input has been indexed for exact recall.
pub tool_input_indexed: bool,
/// Indexed signatures minted under a superseded signature grammar. When
/// non-zero, the index predates the current grammar and a
/// `reindex --index-tool-input` re-mints every row (ADR 0014).
pub stale_signatures: u64,
}

/// One adapter's import activity and freshness.
Expand Down Expand Up @@ -121,6 +125,15 @@ pub fn run(
let size_bytes = std::fs::metadata(&db_path).ok().map(|meta| meta.len());
let stats = store.stats()?;
let signatures = store.signature_count()?;
// Every indexed signature is an `operation/<version>|…` key. Rows that do not
// carry the current grammar's prefix were minted under a superseded grammar
// and no longer match freshly minted signatures (ADR 0014); `reindex` heals
// them.
let stale_prefix = format!(
"operation/{}|",
autophagy_events::signature::SIGNATURE_SPEC_VERSION
);
let stale_signatures = store.signatures_below_version(&stale_prefix)?;
let activity = store.adapter_activity()?;
let candidates = store.mutation_state_counts()?;
let schema_version = store.schema_version()?;
Expand Down Expand Up @@ -176,6 +189,7 @@ pub fn run(
index: IndexStatus {
signatures,
tool_input_indexed: signatures > 0,
stale_signatures,
},
adapters,
detector: DetectorStatus {
Expand Down Expand Up @@ -269,6 +283,16 @@ pub fn write_text(report: &StatusReport, writer: &mut impl Write) -> std::io::Re
"commands not indexed — run `autophagy reindex --index-tool-input`".to_owned()
};
writeln!(writer, "{}", row("Search", &search))?;
if report.index.stale_signatures > 0 {
writeln!(
writer,
"{}",
cont(&format!(
"{} signatures use an older grammar — run `autophagy reindex --index-tool-input` to re-mint and detect recurring shapes",
group(i64::try_from(report.index.stale_signatures).unwrap_or(i64::MAX))
))
)?;
}
writeln!(writer)?;

if report.adapters.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion crates/autophagy-core/tests/generic_jsonl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use autophagy_store::{EventStore, RetrievalMatchKind, RetrievalQuery, StoreStats
const MIXED: &str = include_str!("fixtures/mixed.jsonl");
const RETRIEVAL: &str = include_str!("../../../evals/fixtures/retrieval/deterministic.jsonl");

const BUILD_SIG: &str = "operation/v1|shell|cargo build";
const BUILD_SIG: &str = "operation/v2|shell|cargo build";

fn hit_ids(hits: &[autophagy_store::RetrievalHit]) -> Vec<String> {
hits.iter().map(|hit| hit.event_id.clone()).collect()
Expand Down
1 change: 1 addition & 0 deletions crates/autophagy-events/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ repository.workspace = true
publish = false

[dependencies]
regex.workspace = true
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
Expand Down
Loading
Loading