pub struct Request<'a> {
pub seeds: Vec<String>,
pub paths: BTreeSet<String>,
pub terms: BTreeSet<String>,
pub max_depth: usize,
pub floor: f64,
pub all_blocking_rules: bool,
pub branch: Option<&'a str>,
}Expand description
What the walk was asked to start from and how far it may go.
This is the resolved request, not the caller’s. Every short name is already a canonical
identifier, every path has been normalised, and the free-text intent has already become a
set of terms by intent_terms — so the walk parses nothing and infers nothing about
what it was asked. That separation is what keeps the inference in one place where its
confidence can be labelled, instead of spread through the traversal.
paths is wider than what the caller named: it is the union of the request’s own paths
and the scope every seed declares, which is how naming an issue selects the contracts
over the code that issue is about without the caller listing them.
use std::collections::BTreeSet;
use majordomus_cli::devcontext::select::Request;
use majordomus_cli::devcontext::{intent_terms, DEFAULT_FLOOR, DEFAULT_MAX_DEPTH};
let branch = String::from("master");
let req = Request {
seeds: vec!["majordomus://issue/I0301".into()],
// the request named one path; the issue's own declared scope added the other
paths: BTreeSet::from(["apps/majordomus-cli/src".to_string(), "lib".to_string()]),
terms: intent_terms("Explain the CONTEXT budget"),
max_depth: DEFAULT_MAX_DEPTH,
floor: DEFAULT_FLOOR,
all_blocking_rules: false,
branch: Some(&branch),
};
// the intent arrives parsed: lowercased, deduplicated, and without the short words
assert!(req.terms.contains("context") && req.terms.contains("budget"));
assert!(!req.terms.contains("CONTEXT"), "the walk never re-parses the intent");
assert!(!req.terms.contains("the"));
// and the branch is borrowed, because it belongs to the checkout and not to the request
assert_eq!(req.branch, Some("master"));
assert_eq!(req.seeds.len(), 1);Fields§
§seeds: Vec<String>The canonical identifiers the request named, already resolved.
paths: BTreeSet<String>The repository-relative paths the request named, plus every seed’s declared scope.
terms: BTreeSet<String>The words of the intent, lowercased and deduplicated.
max_depth: usizeThe furthest from a seed the walk goes.
floor: f64Relevance below this is reached and not offered.
all_blocking_rules: boolEvery blocking rule of the layer, not only the ones a seed reaches.
branch: Option<&'a str>The branch the checkout is on, for selecting the sessions that ran on it.