AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
fix(autoindex): repair four defects in the merged ignore-rules work (#279)
xerj-org08921002ab68
diff --git a/docs/recipes/zero-config-indexing.md b/docs/recipes/zero-config-indexing.mdindex c2a33f3e6..6af74c91f 100644--- a/docs/recipes/zero-config-indexing.md+++ b/docs/recipes/zero-config-indexing.md@@ -275,14 +275,20 @@ Build output never reaches the index in the first place. The walk honours`.git/info/exclude`, plus a built-in list — `node_modules/ vendor/ target/dist/ build/ .venv/ __pycache__/` — in that order of precedence; an excludeddirectory is never descended, so nothing inside it is stat-ed, hashed or sent.-Hidden files (`.env`, `.git/`) are skipped by a separate, non-optional rule.-Every run prints what was dropped and by which rule (`ignore rules: …` on-stderr), and `--dry-run` also counts the files inside each pruned directory, so-"where did my file go?" always has an answer. `--no-ignore` turns the rules off;-`--no-default-ignores` keeps your ignore files and drops only the built-in list.-The folder you point at is never excluded: if it is itself ignored — say you-run this on `~/proj/target` — it is indexed anyway and the run says which rule-it would have matched.+The two git-owned kinds stop at a repository boundary the way git does: a+`.gitignore` above a nested checkout has no authority over the files inside it,+so a vendored or submoduled tree keeps its own rules. `.xerjignore` and the+built-in list are XERJ's rather than git's and apply throughout the folder you+named. Hidden files (`.env`, `.git/`) are skipped by a separate, non-optional+rule. Every run prints what was dropped and by which rule (`ignore rules: …` on+stderr), and `--dry-run` also counts the non-hidden files inside each pruned+directory, so "where did my file go?" always has an answer. `--no-ignore` turns+the rules off; `--no-default-ignores` keeps your ignore files and drops only the+built-in list. Both apply to an indexing run only — `autoindex map` and+`autoindex status` never walk a folder and refuse them rather than accepting a+flag that would do nothing. The folder you point at is never excluded: if it is+itself ignored — say you run this on `~/proj/target` — it is indexed anyway and+the run says which rule it would have matched.`--workers` is a ceiling, not a promise: when the server answers `429 Too ManyRequests` the run halves its own bulk concurrency on the spot and probes backdiff --git a/engine/crates/xerj-autoindex/src/cli.rs b/engine/crates/xerj-autoindex/src/cli.rsindex ce648eff1..b6d17d544 100644--- a/engine/crates/xerj-autoindex/src/cli.rs+++ b/engine/crates/xerj-autoindex/src/cli.rs@@ -155,12 +155,18 @@ pub fn print_help() {.gitignore including nested ones and negation; the closest file wins.\n\.git/info/exclude per-checkout excludes, including nested checkouts.\n\built-in {defaults}\n\+ Both git-owned kinds stop at a repository boundary, exactly as git does:\n\+ a .gitignore above a nested checkout does not judge files inside it, so\n\+ vendored and submoduled trees keep their own rules. .xerjignore and the\n\+ built-in list are XERJ's, not git's, and apply throughout the folder.\n\Your global gitignore (core.excludesFile) is NOT read: a machine-wide\n\preference should not silently decide what is in your index.\n\A directory the rules reject is never descended, so nothing inside it is\n\stat-ed, hashed or sent. Every run prints what was dropped and by which\n\- rule; --dry-run additionally counts the files inside each pruned directory\n\- (bounded — past the budget the count is reported as `at least N`).\n\+ rule; --dry-run additionally counts the non-hidden files inside each\n\+ pruned directory (bounded — past the budget the count is reported as\n\+ `at least N`, and xerj-done carries\n\+ ignored_files_in_pruned_dirs_exact=false to say so).\n\The folder you name is never rejected: if it is itself ignored, it is\n\indexed anyway and the run says which rule it would have matched.\n\\n\@@ -453,7 +459,11 @@ pub fn parse(args: Vec<String>) -> Result<Cmd, String> {// `--no-ignore` already removes the built-in defaults, so there is nothing// left for `--no-default-ignores` to do — say so instead of taking a flag// that changes nothing.- if no_ignore && no_default_ignores {+ // Only meaningful for a run that walks a folder. On `map`/`status` neither+ // flag does anything at all, and the arm below says so — a message about+ // one flag subsuming the other would imply the pair is otherwise honoured.+ let sub_walks_a_folder = !matches!(sub.as_deref(), Some("map") | Some("status"));+ if no_ignore && no_default_ignores && sub_walks_a_folder {return Err("--no-ignore already turns off the built-in default rules that --no-default-ignores \targets. Drop one of the two"@@ -468,11 +478,37 @@ pub fn parse(args: Vec<String>) -> Result<Cmd, String> {);}+ // `map` reads the catalog off the server and `status` reads the local+ // journal; neither walks a filesystem, so an ignore flag on either cannot+ // change one byte of the output. Measured before this check existed:+ // `xerj autoindex map --no-ignore` was byte-identical to `xerj autoindex+ // map`. Accepting it was the #204 accept-and-ignore class (#279).+ let ignore_flags_used: Vec<&str> = [+ ("--no-ignore", no_ignore),+ ("--no-default-ignores", no_default_ignores),+ ]+ .into_iter()+ .filter_map(|(name, used)| used.then_some(name))+ .collect();+match (sub.as_deref(), folder) {(Some("map"), _) | (Some("status"), _) if progress_explicit => Err(format!("--progress/--progress-interval apply only to indexing, not `autoindex {}`",sub.as_deref().unwrap_or_default())),+ (Some("map"), _) | (Some("status"), _) if !ignore_flags_used.is_empty() => {+ let sub = sub.as_deref().unwrap_or_default();+ let (verb, them) = if ignore_flags_used.len() == 1 {+ ("applies", "it")+ } else {+ ("apply", "them")+ };+ Err(format!(+ "{} {verb} only to indexing, not `autoindex {sub}`: that subcommand never walks \+ a folder, so there is nothing for an ignore rule to skip. Drop {them}",+ ignore_flags_used.join(" and "),+ ))+ }(Some("map"), _) if bulk_timeout_explicit => {Err("--bulk-timeout-secs applies only to indexing, not `autoindex map`".into())}@@ -781,4 +817,50 @@ mod tests {let err = err(&["data", "--no-ignore", "--no-default-ignores"]);assert!(err.contains("--no-ignore already turns off"), "{err}");}++ /// #279, same class. `map` reads the catalog off the server and `status`+ /// reads the local journal; neither walks a folder, so an ignore flag on+ /// either changes nothing. Both were accepted, and `xerj autoindex map+ /// --no-ignore` was measured byte-identical to `xerj autoindex map`.+ #[test]+ fn ignore_flags_are_rejected_for_non_index_subcommands_in_any_position() {+ for args in [+ vec!["map", "--no-ignore"],+ vec!["--no-ignore", "map"],+ vec!["map", "--no-default-ignores"],+ vec!["--no-default-ignores", "map"],+ vec!["status", "--no-ignore"],+ vec!["--no-ignore", "status"],+ vec!["status", "--no-default-ignores"],+ vec!["--no-default-ignores", "status"],+ ] {+ let err = parse(args.iter().map(|a| a.to_string()).collect()).unwrap_err();+ assert!(+ err.contains("applies only to indexing") && err.contains("never walks a folder"),+ "{args:?} -> {err}"+ );+ }+ }++ /// Both flags on `map` must be refused for the reason that is actually+ /// true there — neither applies at all — not for the indexing-only reason+ /// that one subsumes the other, which would imply the pair is honoured.+ #[test]+ fn both_ignore_flags_on_map_are_refused_as_inapplicable_not_as_redundant() {+ let err = err(&["map", "--no-ignore", "--no-default-ignores"]);+ assert!(err.contains("never walks a folder"), "{err}");+ assert!(!err.contains("already turns off"), "{err}");+ assert!(+ err.contains("--no-ignore") && err.contains("--no-default-ignores"),+ "both flags must be named: {err}"+ );+ }++ /// …and the index path is untouched: the flags still work where they mean+ /// something.+ #[test]+ fn ignore_flags_still_apply_to_an_index_run() {+ assert!(!index(&["data", "--no-ignore"]).ignore.enabled);+ assert!(!index(&["data", "--no-default-ignores"]).ignore.defaults);+ }}diff --git a/engine/crates/xerj-autoindex/src/ignore_rules.rs b/engine/crates/xerj-autoindex/src/ignore_rules.rsindex 6731af882..9e4bf7591 100644--- a/engine/crates/xerj-autoindex/src/ignore_rules.rs+++ b/engine/crates/xerj-autoindex/src/ignore_rules.rs@@ -18,18 +18,34 @@//! behaviour of [`crate::walk`] is unchanged, and so we can report *which*//! rule discarded *what*, which `ignore`'s own walker does not expose.//!-//! Two behaviours are copied deliberately from that reference implementation-//! (`ignore-0.4.32/src/dir.rs`, read at `~/.cargo/registry/src/*/ignore-0.4.32`):+//! Three behaviours are copied deliberately from that reference implementation+//! (`ignore-0.4.32/src/dir.rs` — the version this crate's lockfile pins; read+//! at `~/.cargo/registry/src/*/ignore-0.4.32`). All three live in+//! `Ignore::matched_ignore`, `dir.rs:548-685`://!-//! * **Deepest ignore file wins, per kind.** `dir.rs:563-594` walks matchers-//! from the current directory outward and keeps the first decision each kind-//! produces (`if m_gi.is_none() { m_gi = … }`).-//! * **Kinds are ranked, and the rank beats depth.** `dir.rs:678-684` combines-//! them `m_custom_ignore.or(m_ignore).or(m_gi).or(m_gi_exclude)`. So a-//! `.xerjignore` at the root outranks a `.gitignore` in a deep subdirectory.-//! That is what makes `.xerjignore` useful as the stated "exclude things git-//! tracks" (and re-include things git ignores) override rather than just a-//! second `.gitignore`.+//! * **Deepest ignore file wins, per kind.** The loop at `dir.rs:563-594` walks+//! matchers from the current directory outward and keeps the first decision+//! each kind produces — `if m_custom_ignore.is_none() { m_custom_ignore = … }`+//! at `:565`, and the same shape for the other three kinds.+//! * **The two git kinds stop at a repository boundary.** In that same loop the+//! git kinds are guarded by `saw_git` — declared `:562`, tested at `:579` and+//! `:586` (`if any_git && !saw_git && m_gi.is_none()`), and set at `:593`+//! (`saw_git = saw_git || ig.inner.has_git`). Once the walk outward has+//! passed a directory holding a `.git`, no `.gitignore` or `.git/info/exclude`+//! above it is consulted. That is git's own authority model: the repository+//! that *owns* a file decides whether it is ignored, so an outer repository's+//! `.gitignore` has no say over a vendored or submoduled checkout nested+//! inside it. See [`IgnoreStack::lookup`] for our copy of the guard.+//! * **Kinds are ranked, and the rank beats depth.** `dir.rs:679-684` combines+//! them `m_custom_ignore.or(m_ignore).or(m_gi).or(m_gi_exclude).or(m_global)+//! .or(m_explicit)`. We reproduce the first four as `.xerjignore` >+//! `.gitignore` > `.git/info/exclude` > built-in defaults. The last two have+//! no analogue here: `m_global` is the global gitignore we deliberately do not+//! read (below), and `m_explicit` is ripgrep's `--ignore-file`, which XERJ+//! does not offer. So a `.xerjignore` at the root outranks a `.gitignore` in a+//! deep subdirectory — that is what makes `.xerjignore` useful as the stated+//! "exclude things git tracks" (and re-include things git ignores) override+//! rather than just a second `.gitignore`.//!//! Within one file the last matching pattern wins; that is `Gitignore::matched`//! and we do not reimplement it.@@ -136,9 +152,14 @@ pub struct RuleCount {pub files: u64,/// Directories pruned by this rule (their contents were never walked).pub dirs: u64,- /// Files found inside those pruned directories. Only ever non-zero when- /// the deep count ran (`--dry-run`).+ /// Non-hidden files found inside those pruned directories. Only ever+ /// non-zero when the deep count ran (`--dry-run`).pub files_inside_pruned_dirs: u64,+ /// How many of `dirs` had their contents counted. Always 0 for+ /// [`HIDDEN_RULE`], whose directories are never counted at all, so the+ /// reporting can stay silent about them instead of printing a `0 files+ /// inside` that is false of the filesystem.+ pub dirs_deep_counted: u64,}#[derive(Debug, Clone)]@@ -147,6 +168,12 @@ pub struct IgnoreReport {pub by_rule: BTreeMap<String, RuleCount>,pub files_skipped: u64,pub dirs_pruned: u64,+ /// Non-hidden files inside the pruned directories — see+ /// [`IgnoreStack::count_inside`] for exactly what is and is not counted.+ /// Directories pruned by [`HIDDEN_RULE`] contribute nothing: their+ /// contents were excluded by the dotfile rule before any ignore rule was+ /// consulted. Never read this without+ /// [`IgnoreReport::files_inside_pruned_dirs_is_exact`].pub files_inside_pruned_dirs: u64,/// True unless the deep count hit [`DEEP_COUNT_BUDGET`]. When false,/// `files_inside_pruned_dirs` is a floor and every line that prints it@@ -187,6 +214,18 @@ impl IgnoreReport {self.by_rule.is_empty() && self.root_exemption.is_none() && self.warnings.is_empty()}+ /// Whether [`Self::files_inside_pruned_dirs`] is the whole count or a+ /// floor.+ ///+ /// False in two cases, and a consumer must treat both the same way: the+ /// deep count never ran (a real run does not pay for it, so the field is a+ /// vacuous 0), or it ran and hit [`DEEP_COUNT_BUDGET`]. A bare `u64` on a+ /// machine surface cannot say "at least", so every such surface must carry+ /// this flag next to the number (#279).+ pub fn files_inside_pruned_dirs_is_exact(&self) -> bool {+ self.deep_count_ran && self.deep_count_complete+ }+/// Human-readable lines for the progress surface. Every number here was/// counted by this run; the ones that were deliberately not counted are/// named as such instead of being printed as zero.@@ -208,9 +247,15 @@ impl IgnoreReport {self.dirs_pruned,if self.dirs_pruned == 1 { "y" } else { "ies" },);- if self.deep_count_ran && self.dirs_pruned > 0 {+ let deep_counted_dirs: u64 = self.by_rule.values().map(|c| c.dirs_deep_counted).sum();+ if self.deep_count_ran && deep_counted_dirs > 0 {+ // "non-hidden" is the whole of the claim: dotfiles are excluded+ // from the count, and directories the dotfile rule pruned are not+ // counted at all. Anything stronger — "files that would otherwise+ // have been indexed" — would be overclaiming, because ignore files+ // nested inside a pruned tree are never read (#279).headline.push_str(&format!(- " ({}{} file{} inside them)",+ " ({}{} non-hidden file{} inside them)",if self.deep_count_complete {""} else {@@ -243,9 +288,12 @@ impl IgnoreReport {parts.push(format!("{} file{}", count.files, plural(count.files)));}if count.dirs > 0 {- let inside = if self.deep_count_ran {+ // Silent for the dotfile rule, whose directories are never+ // counted: "0 files inside" would be a false statement about+ // `.git/`, and "N files inside" was the inflated one.+ let inside = if self.deep_count_ran && count.dirs_deep_counted > 0 {format!(- " ({}{} file{} inside)",+ " ({}{} non-hidden file{} inside)",if self.deep_count_complete {""} else {@@ -289,6 +337,12 @@ struct Layer {xerj: Option<Gitignore>,git: Option<Gitignore>,exclude: Option<Gitignore>,+ /// This directory holds a `.git`, so it is the root of a checkout and the+ /// outward end of the git kinds' authority — see [`IgnoreStack::lookup`].+ /// `.git` is a directory in a normal clone and a file (`gitdir: …`) in a+ /// submodule or linked worktree; both are boundaries, so this is an+ /// `exists()` test rather than `is_dir()`.+ repo_root: bool,}/// A stack of ignore matchers, one entry per directory on the current@@ -439,6 +493,10 @@ impl IgnoreStack {// only I have". Loaded per directory so a nested checkout gets// its own.exclude: self.load(dir, dir.join(".git").join("info").join("exclude")),+ // One extra stat per directory entered, next to the three this+ // already pays, and it is the only way to know where one+ // checkout ends and another begins.+ repo_root: dir.join(".git").exists(),}} else {Layer::default()@@ -478,7 +536,28 @@ impl IgnoreStack {/// ripgrep's precedence, reproduced: the deepest match *per kind*, then/// the kinds ranked `.xerjignore` > `.gitignore` > `.git/info/exclude` >- /// built-in defaults (`ignore-0.4.32/src/dir.rs:563-594` and `:678-684`).+ /// built-in defaults (`ignore-0.4.32/src/dir.rs:563-594` and `:679-684`).+ ///+ /// # The repository boundary+ ///+ /// The two git-owned kinds — `.gitignore` and `.git/info/exclude` — stop+ /// as soon as the outward walk has passed a directory holding a `.git`.+ /// This is `saw_git` in the reference implementation (`dir.rs:562`, `:579`,+ /// `:586`, `:593`) and it is git's own rule: the repository that owns a+ /// file is the one that decides whether it is ignored. A vendored or+ /// submoduled checkout inside a tree is a different repository, and the+ /// outer `.gitignore` has no authority over its contents — `git status` in+ /// the outer repo never even descends into it. Without the stop, a root+ /// `*.md` would hide the README of every vendored dependency.+ ///+ /// Two kinds deliberately do **not** stop at the boundary, because neither+ /// is git's to scope:+ ///+ /// * `.xerjignore` is XERJ's own file and its stated job is to govern the+ /// folder you pointed at. One at the root is how a user says "not this,+ /// anywhere below here" without editing anyone's `.gitignore`.+ /// * the built-in defaults are anchored at the root and apply throughout —+ /// a `node_modules/` inside a vendored checkout is still build output.fn lookup(&self, path: &Path, is_dir: bool) -> Option<(bool, String)> {if !self.opts.enabled {return None;@@ -486,15 +565,25 @@ impl IgnoreStack {let mut xerj = None;let mut git = None;let mut exclude = None;+ // Cleared once the walk outward leaves the checkout that owns `path`.+ let mut in_owning_repo = true;for layer in self.layers.iter().rev() {if xerj.is_none() {xerj = self.decide_with(layer.xerj.as_ref(), path, is_dir);}- if git.is_none() {- git = self.decide_with(layer.git.as_ref(), path, is_dir);- }- if exclude.is_none() {- exclude = self.decide_with(layer.exclude.as_ref(), path, is_dir);+ if in_owning_repo {+ if git.is_none() {+ git = self.decide_with(layer.git.as_ref(), path, is_dir);+ }+ if exclude.is_none() {+ exclude = self.decide_with(layer.exclude.as_ref(), path, is_dir);+ }+ // This layer's own files still count — it is the repository+ // root, not the far side of the boundary. Anything above it is+ // a different repository.+ if layer.repo_root {+ in_owning_repo = false;+ }}if xerj.is_some() {// Nothing ranked lower can change the answer.@@ -558,9 +647,22 @@ impl IgnoreStack {/// The dotfile skip is decided by the walker, not here, but it is reported/// through the same accounting so `--dry-run` explains every missing file/// with one mechanism.- pub fn record_hidden(&mut self, path: &Path, is_dir: bool) {+ ///+ /// A hidden **directory** is recorded as pruned and nothing more: its+ /// contents are never deep-counted. Nothing under `.git/` or `.venv/` was+ /// ever a candidate for indexing — the dotfile rule had already excluded+ /// all of it — so counting those files would inflate+ /// [`IgnoreReport::files_inside_pruned_dirs`] with work that no run was+ /// ever going to do. On this repository that inflation was 97,731 files+ /// against a real exclusion of 273,441 (#279).+ pub fn record_hidden(&mut self, is_dir: bool) {if is_dir {- self.record_dir(path, HIDDEN_RULE);+ self.report.dirs_pruned += 1;+ self.report+ .by_rule+ .entry(HIDDEN_RULE.to_string())+ .or_default()+ .dirs += 1;} else {self.record_file(HIDDEN_RULE);}@@ -576,19 +678,15 @@ impl IgnoreStack {}fn record_dir(&mut self, path: &Path, label: &str) {- self.report.dirs_pruned += 1;- self.report- .by_rule- .entry(label.to_string())- .or_default()- .dirs += 1;let inside = self.count_inside(path);+ let entry = self.report.by_rule.entry(label.to_string()).or_default();+ entry.dirs += 1;+ entry.files_inside_pruned_dirs += inside;+ if self.opts.deep_count {+ entry.dirs_deep_counted += 1;+ }+ self.report.dirs_pruned += 1;self.report.files_inside_pruned_dirs += inside;- self.report- .by_rule- .entry(label.to_string())- .or_default()- .files_inside_pruned_dirs += inside;}/// Only under `--dry-run`. Symlinks are never followed here whatever the@@ -596,12 +694,25 @@ impl IgnoreStack {/// directory we have already decided not to index, and it must not be able/// to wander outside it or loop.///- /// The dotfile rule is applied here too, so the number means "files that- /// would otherwise have been indexed" and not "inodes under this path".- /// Without it a pruned directory containing a nested checkout reports its- /// whole `.git`, which was never indexable in the first place — a number- /// that does not reconcile with the before/after file count is worse than- /// no number.+ /// # Exactly what this counts+ ///+ /// Regular files under `dir`, excluding every dot-named file and the whole+ /// subtree of every dot-named directory — the dotfile rule, applied here+ /// too, because those paths were never indexable. That is the figure the+ /// reporting prints and the phrase it prints it with ("N non-hidden files+ /// inside them"). Two things it is deliberately *not*:+ ///+ /// * It is **not** a promise about what a `--no-ignore` run would have+ /// indexed. Ignore files nested *inside* the pruned tree are not+ /// consulted — the point of pruning is to never read that tree — so a+ /// `node_modules/.gitignore` excluding some of its own contents would+ /// make the real figure smaller than this one.+ /// * It is **not** guaranteed complete. [`DEEP_COUNT_BUDGET`] caps the+ /// traversal; past it [`IgnoreReport::deep_count_complete`] goes false+ /// and every surface says "at least".+ ///+ /// Callers that publish the number to a machine must publish+ /// [`IgnoreReport::files_inside_pruned_dirs_is_exact`] beside it.fn count_inside(&mut self, dir: &Path) -> u64 {if !self.opts.deep_count {return 0;@@ -651,7 +762,7 @@ mod tests {.to_str().is_some_and(|n| n.starts_with('.')){- stack.record_hidden(entry.path(), is_dir);+ stack.record_hidden(is_dir);if is_dir {it.skip_current_dir();}@@ -882,12 +993,143 @@ mod tests {assert_eq!(deep.files_inside_pruned_dirs, 7);assert!(deep.deep_count_complete);assert!(- deep.summary_lines().iter().any(|l| l.contains("7 files")),+ deep.summary_lines()+ .iter()+ .any(|l| l.contains("7 non-hidden files")),"{:?}",deep.summary_lines());}+ /// #279. A count that never ran and a count that ran to completion are both+ /// reported as a `u64`, and only the exactness flag separates them. A+ /// consumer that reads the number without the flag reads 0 as "nothing+ /// inside those directories", which is the opposite of the truth.+ #[test]+ fn an_unmeasured_count_is_never_claimed_to_be_exact() {+ let dir = tempfile::TempDir::new().unwrap();+ let root = dir.path();+ write(root, "keep.txt", "x");+ for i in 0..4 {+ write(root, &format!("node_modules/pkg/f{i}.js"), "x");+ }++ let (_, cheap) = survivors(root, IgnoreOptions::default());+ assert_eq!(cheap.files_inside_pruned_dirs, 0);+ assert!(+ !cheap.files_inside_pruned_dirs_is_exact(),+ "a 0 that was never measured must not be published as a total"+ );++ let (_, deep) = survivors(root, IgnoreOptions::default().with_deep_count(true));+ assert_eq!(deep.files_inside_pruned_dirs, 4);+ assert!(deep.files_inside_pruned_dirs_is_exact());++ // The floor case the budget produces, which no test can reach with a+ // real 1M-entry tree: the flag, not the number, is what says so.+ let capped = IgnoreReport {+ deep_count_ran: true,+ deep_count_complete: false,+ ..IgnoreReport::default()+ };+ assert!(!capped.files_inside_pruned_dirs_is_exact());+ }++ /// #279. `record_hidden` used to route directories through `record_dir`,+ /// which deep-counts. Every non-hidden file under `.git/`, `.venv/` and+ /// friends was therefore counted as "inside a pruned directory" — on the+ /// XERJ repository that was 97,731 phantom files on a real exclusion of+ /// 273,441. Nothing under a dot-directory was ever a candidate for+ /// indexing, so it must not appear in the exclusion accounting at all.+ #[test]+ fn a_dotfile_pruned_directory_contributes_nothing_to_the_count() {+ let dir = tempfile::TempDir::new().unwrap();+ let root = dir.path();+ write(root, "keep.txt", "x");+ // A hidden directory holding plenty of non-hidden files, exactly like+ // `.git/objects/`.+ for i in 0..9 {+ write(root, &format!(".hidden/objects/o{i}.pack"), "x");+ }+ // …and a directory pruned by a real ignore rule.+ for i in 0..3 {+ write(root, &format!("node_modules/pkg/f{i}.js"), "x");+ }++ let (kept, deep) = survivors(root, IgnoreOptions::default().with_deep_count(true));+ assert_eq!(kept, vec!["keep.txt"], "{kept:?}");+ assert_eq!(+ deep.files_inside_pruned_dirs, 3,+ "only node_modules/ may contribute; the 9 files under .hidden/ were \+ never indexable: {deep:?}"+ );++ let hidden = deep.by_rule[HIDDEN_RULE];+ assert_eq!(hidden.dirs, 1, "the dot-directory is still reported pruned");+ assert_eq!(hidden.files_inside_pruned_dirs, 0);+ assert_eq!(+ hidden.dirs_deep_counted, 0,+ "its contents must never be walked for the count"+ );++ // …and the printed sentence must agree with the printed figure: no+ // "N files inside" clause for the dotfile rule at all, because "0" is+ // as false about `.hidden/` as "9" was misleading.+ let lines = deep.summary_lines();+ let hidden_line = lines+ .iter()+ .find(|l| l.contains(HIDDEN_RULE))+ .unwrap_or_else(|| panic!("{lines:?}"));+ assert!(+ !hidden_line.contains("inside"),+ "must not claim a count it did not take: {hidden_line}"+ );+ assert!(+ lines+ .iter()+ .any(|l| l.contains("(3 non-hidden files inside them)")),+ "{lines:?}"+ );+ }++ /// #279. The claim the reporting makes about its own number, checked as+ /// arithmetic: what a default run excludes over a `--no-ignore` run is+ /// exactly the files the rules matched directly plus the files inside the+ /// directories they pruned. The dotfile rule cancels out — it applies to+ /// both arms — which is precisely why its directories must not be counted.+ #[test]+ fn the_exclusion_count_reconciles_with_a_no_ignore_walk() {+ let dir = tempfile::TempDir::new().unwrap();+ let root = dir.path();+ write(root, ".gitignore", "*.log\nbuild/\n");+ write(root, "keep.txt", "x");+ write(root, "a.log", "x");+ write(root, "src/b.log", "x");+ for i in 0..5 {+ write(root, &format!("build/out{i}.o"), "x");+ }+ for i in 0..4 {+ write(root, &format!("node_modules/pkg/m{i}.js"), "x");+ }+ // Hidden noise on both sides of the comparison.+ for i in 0..6 {+ write(root, &format!(".git/objects/o{i}.pack"), "x");+ }++ let (kept, rep) = survivors(root, IgnoreOptions::default().with_deep_count(true));+ let (all, _) = survivors(root, IgnoreOptions::off());+ assert!(rep.files_inside_pruned_dirs_is_exact());++ let hidden = rep.by_rule.get(HIDDEN_RULE).copied().unwrap_or_default();+ let by_ignore_rules = (rep.files_skipped - hidden.files) + rep.files_inside_pruned_dirs;+ assert_eq!(+ all.len() - kept.len(),+ by_ignore_rules as usize,+ "reported exclusions must equal the measured difference; kept={kept:?} all={all:?} \+ report={rep:?}"+ );+ }+/// Regression, order-independent: a depth-first walk interleaves files and/// subdirectories, so a nested `.gitignore` must be off the stack again by/// the time the walk hands back a file from the parent directory. Drivendiff --git a/engine/crates/xerj-autoindex/src/lib.rs b/engine/crates/xerj-autoindex/src/lib.rsindex 5fe5ce843..0e57afdd5 100644--- a/engine/crates/xerj-autoindex/src/lib.rs+++ b/engine/crates/xerj-autoindex/src/lib.rs@@ -2324,7 +2324,9 @@ pub fn run_index_report(cfg: IndexCfg) -> Result<(i32, Option<Value>)> {)}));- pr.finish(+ // `ignored_files_in_pruned_dirs` is budget-capped, so the flag+ // saying whether it is a total or a floor travels with it (#279).+ pr.finish_with_flags(true,0,"dry-run",@@ -2337,6 +2339,10 @@ pub fn run_index_report(cfg: IndexCfg) -> Result<(i32, Option<Value>)> {ignore_report.files_inside_pruned_dirs,),],+ &[(+ "ignored_files_in_pruned_dirs_exact",+ ignore_report.files_inside_pruned_dirs_is_exact(),+ )],);return Ok((0, None));}@@ -2776,7 +2782,8 @@ pub fn run_index_report(cfg: IndexCfg) -> Result<(i32, Option<Value>)> {if cfg.dry_run {println!("{}", serde_json::to_string_pretty(&plan)?);pr.note("(dry run — nothing indexed)");- pr.finish(+ // As above: the count is capped, so the completeness flag ships with it.+ pr.finish_with_flags(true,0,"dry-run",@@ -2789,6 +2796,10 @@ pub fn run_index_report(cfg: IndexCfg) -> Result<(i32, Option<Value>)> {ignore_report.files_inside_pruned_dirs,),],+ &[(+ "ignored_files_in_pruned_dirs_exact",+ ignore_report.files_inside_pruned_dirs_is_exact(),+ )],);return Ok((0, None));}diff --git a/engine/crates/xerj-autoindex/src/progress.rs b/engine/crates/xerj-autoindex/src/progress.rsindex 723b82c7e..20e30d63c 100644--- a/engine/crates/xerj-autoindex/src/progress.rs+++ b/engine/crates/xerj-autoindex/src/progress.rs@@ -543,6 +543,25 @@ impl Progress {/// is `panic = "abort"`, so unwinding never reaches `Drop`), cannot print/// one — which is itself the signal that the process died abnormally.pub fn finish(&self, ok: bool, exit: i32, reason: &str, extra: &[(&str, u64)]) {+ self.finish_with_flags(ok, exit, reason, extra, &[]);+ }++ /// [`Self::finish`] plus boolean fields.+ ///+ /// A count alone cannot say whether it is a total or a floor. When a+ /// number on this line is budget-capped — `ignored_files_in_pruned_dirs`+ /// is — the flag that says so has to travel with it, or an agent parsing+ /// the line reads a floor as a total with nothing to warn it (#279). Flags+ /// are real JSON booleans on the `--progress json` surface and+ /// `key=true` / `key=false` on the text one.+ pub fn finish_with_flags(+ &self,+ ok: bool,+ exit: i32,+ reason: &str,+ extra: &[(&str, u64)],+ flags: &[(&str, bool)],+ ) {if self.reported.swap(true, Ordering::SeqCst) || !self.enabled() {return;}@@ -558,6 +577,9 @@ impl Progress {for (key, value) in extra {doc.insert((*key).to_string(), (*value).into());}+ for (key, value) in flags {+ doc.insert((*key).to_string(), (*value).into());+ }let line = serde_json::Value::Object(doc);self.sink.write(format!("{line}\n").as_bytes());}@@ -574,6 +596,9 @@ impl Progress {for (key, value) in extra {line.push_str(&format!(" {key}={value}"));}+ for (key, value) in flags {+ line.push_str(&format!(" {key}={value}"));+ }line.push('\n');self.sink.write(line.as_bytes());}@@ -1509,6 +1534,45 @@ mod tests {assert_eq!(last["files"], 1922);}+ /// #279. `ignored_files_in_pruned_dirs` is budget-capped, so on its own it+ /// is a floor an agent cannot distinguish from a total. The flag that says+ /// which one it is has to reach both surfaces — a real boolean in JSON, a+ /// `key=false` token on the text line.+ #[test]+ fn a_capped_count_ships_with_the_flag_that_says_it_is_a_floor() {+ let (progress, buffer) = Progress::capture(Surface::Json, Duration::from_secs(3600));+ progress.finish_with_flags(+ true,+ 0,+ "dry-run",+ &[("ignored_files_in_pruned_dirs", 1_000_000)],+ &[("ignored_files_in_pruned_dirs_exact", false)],+ );+ let text = captured(&buffer);+ let last: serde_json::Value = serde_json::from_str(text.lines().last().unwrap()).unwrap();+ assert_eq!(last["ignored_files_in_pruned_dirs"], 1_000_000);+ assert_eq!(+ last["ignored_files_in_pruned_dirs_exact"],+ serde_json::Value::Bool(false),+ "must be a JSON boolean, not a 0/1 a consumer has to guess at: {text}"+ );++ let (progress, buffer) = Progress::capture(Surface::Plain, Duration::from_secs(3600));+ progress.finish_with_flags(+ true,+ 0,+ "dry-run",+ &[("ignored_files_in_pruned_dirs", 42)],+ &[("ignored_files_in_pruned_dirs_exact", true)],+ );+ let text = captured(&buffer);+ assert!(+ text.contains("ignored_files_in_pruned_dirs=42")+ && text.contains("ignored_files_in_pruned_dirs_exact=true"),+ "{text}"+ );+ }+/// `--progress json` promises one object per line, so the relayable view/// has to arrive as a field. A JSON consumer must not have to re-derive a/// bar to show its user the same thing a plain consumer sees.diff --git a/engine/crates/xerj-autoindex/src/walk.rs b/engine/crates/xerj-autoindex/src/walk.rsindex c230cac04..aaf4df50d 100644--- a/engine/crates/xerj-autoindex/src/walk.rs+++ b/engine/crates/xerj-autoindex/src/walk.rs@@ -83,7 +83,7 @@ pub fn walk_reporting(.to_str().is_some_and(|n| n.starts_with('.')){- stack.record_hidden(entry.path(), is_dir);+ stack.record_hidden(is_dir);if is_dir {it.skip_current_dir();}@@ -239,6 +239,144 @@ mod hidden_skip_tests {assert_eq!(off.dirs_pruned, 0, "{off:?}");}+ /// Create a real checkout at `path`. Returns false when the `git` binary+ /// is unavailable, in which case the caller still gets the on-disk shape+ /// that matters (`.git/HEAD`) but skips the parity cross-check.+ #[cfg(test)]+ fn git_init(path: &std::path::Path) -> bool {+ fs::create_dir_all(path).unwrap();+ let ok = std::process::Command::new("git")+ // A developer's global gitignore or an enclosing repo's config+ // must not decide what this test sees.+ .env("GIT_CONFIG_GLOBAL", "/dev/null")+ .env("GIT_CONFIG_SYSTEM", "/dev/null")+ .args(["init", "-q"])+ .current_dir(path)+ .status()+ .is_ok_and(|s| s.success());+ if !ok {+ fs::create_dir_all(path.join(".git")).unwrap();+ fs::write(path.join(".git").join("HEAD"), "ref: refs/heads/main\n").unwrap();+ }+ ok+ }++ /// Files a repository considers its own and does not ignore, as git itself+ /// reports them. Dotfiles are dropped because XERJ's separate, non-optional+ /// hidden-file rule removes them before any ignore rule is consulted.+ #[cfg(test)]+ fn git_untracked_visible_files(repo: &std::path::Path) -> Vec<String> {+ let out = std::process::Command::new("git")+ .env("GIT_CONFIG_GLOBAL", "/dev/null")+ .env("GIT_CONFIG_SYSTEM", "/dev/null")+ .args(["status", "--porcelain", "--untracked-files=all"])+ .current_dir(repo)+ .output()+ .expect("git status");+ let mut files: Vec<String> = String::from_utf8_lossy(&out.stdout)+ .lines()+ .filter_map(|l| l.strip_prefix("?? "))+ .map(|p| p.trim_matches('"').to_string())+ .filter(|p| !p.split('/').any(|c| c.starts_with('.')))+ .collect();+ files.sort();+ files+ }++ /// #279 (follow-up to #276). An outer repository's `.gitignore` must not+ /// judge files inside a nested checkout.+ ///+ /// This is git's authority model, not a nicety: the repository that owns a+ /// file decides whether it is ignored. `git status` in the outer repo does+ /// not descend into a nested checkout at all, and `git status` inside the+ /// nested one never consults the outer's `.gitignore`. The first cut of+ /// this feature walked every layer with no boundary stop, so a root `*.md`+ /// hid the README of every vendored dependency below it.+ ///+ /// The fixture is a real nested checkout — the boundary is a `.git` on+ /// disk, so a matcher-level unit test could not have caught this.+ #[test]+ fn an_outer_repository_does_not_judge_a_nested_checkout() {+ use super::walk_reporting;+ use crate::ignore_rules::IgnoreOptions;++ let dir = tempfile::TempDir::new().unwrap();+ let root = dir.path().join("outer");+ let have_git = git_init(&root);+ fs::write(root.join(".gitignore"), "*.md\n").unwrap();+ fs::write(root.join("OUTER.md"), "outer, and outer's to ignore").unwrap();+ fs::write(root.join("keep.txt"), "x").unwrap();++ let inner = root.join("vendored");+ git_init(&inner);+ fs::write(inner.join(".gitignore"), "local-junk.txt\n").unwrap();+ fs::write(inner.join("README.md"), "the vendored project's own README").unwrap();+ fs::write(inner.join("local-junk.txt"), "inner's own rule drops this").unwrap();+ fs::create_dir_all(inner.join("src")).unwrap();+ fs::write(inner.join("src").join("guide.md"), "also the inner repo's").unwrap();++ let (files, _) = walk_reporting(&root, false, IgnoreOptions::default()).unwrap();+ let mut rels: Vec<String> = files.into_iter().map(|e| e.rel).collect();+ rels.sort();+ assert_eq!(+ rels,+ vec![+ "keep.txt".to_string(),+ "vendored/README.md".to_string(),+ "vendored/src/guide.md".to_string(),+ ],+ "the outer *.md must stop at the nested checkout, and the inner \+ repo's own rule must still apply inside it: {rels:?}"+ );++ // Parity with the tool whose semantics we claim to reproduce: the set+ // XERJ keeps under `vendored/` is the set the nested repository itself+ // reports as its own, unignored, visible files.+ if have_git {+ let from_git = git_untracked_visible_files(&inner);+ assert_eq!(+ from_git,+ vec!["README.md".to_string(), "src/guide.md".to_string()],+ "fixture drifted from git's own answer"+ );+ let from_xerj: Vec<String> = rels+ .iter()+ .filter_map(|r| r.strip_prefix("vendored/").map(str::to_string))+ .collect();+ assert_eq!(from_xerj, from_git, "XERJ and git must agree");+ }+ }++ /// The other half of the boundary: `.xerjignore` is XERJ's own file, not+ /// git's, and its stated job is to govern the folder you pointed at. It+ /// deliberately keeps its authority across a nested checkout, so one file+ /// at the root can say "not this, anywhere below here".+ #[test]+ fn a_root_xerjignore_still_reaches_into_a_nested_checkout() {+ use super::walk_reporting;+ use crate::ignore_rules::IgnoreOptions;++ let dir = tempfile::TempDir::new().unwrap();+ let root = dir.path().join("outer");+ git_init(&root);+ fs::write(root.join(".xerjignore"), "*.md\n").unwrap();+ fs::write(root.join("keep.txt"), "x").unwrap();++ let inner = root.join("vendored");+ git_init(&inner);+ fs::write(inner.join("README.md"), "x").unwrap();+ fs::write(inner.join("code.rs"), "x").unwrap();++ let (files, _) = walk_reporting(&root, false, IgnoreOptions::default()).unwrap();+ let mut rels: Vec<String> = files.into_iter().map(|e| e.rel).collect();+ rels.sort();+ assert_eq!(+ rels,+ vec!["keep.txt".to_string(), "vendored/code.rs".to_string()],+ "{rels:?}"+ );+ }+#[test]fn a_brain_over_a_dot_named_root_still_works() {let dir = tempfile::TempDir::new().unwrap();diff --git a/landing/docs/recipes/zero-config-autoindex.html b/landing/docs/recipes/zero-config-autoindex.htmlindex 21c8b259e..f5f2cc51b 100644--- a/landing/docs/recipes/zero-config-autoindex.html+++ b/landing/docs/recipes/zero-config-autoindex.html@@ -267,7 +267,7 @@ xerj autoindex mapcurl localhost:9200/ax-*/_search -H 'Content-Type: application/json' \-d '{"query":{"match_all":{}},"size":3}'</pre><p>Useful knobs (all optional): <code class="inline">--url</code> for a non-default endpoint, <code class="inline">--workers N</code> (default: every core, reduced when the memory safe zone cannot pay for that many in-flight bulk buffers; bounds both the scan and the indexing phase), <code class="inline">--prefix</code> to namespace the indices (default <code class="inline">ax</code>), <code class="inline">--no-semantic</code> for pure BM25+keyword without vector fields, <code class="inline">--dry-run</code> to print the inferred plan without indexing anything, <code class="inline">--follow-symlinks</code> (loop-safe), <code class="inline">--sample N</code> records per file for inference (default 500).</p>- <p>Build output never reaches the index in the first place. The walk honours <code class="inline">.xerjignore</code>, <code class="inline">.gitignore</code> (nested files and <code class="inline">!negation</code> included) and <code class="inline">.git/info/exclude</code>, plus a built-in list — <code class="inline">node_modules/ vendor/ target/ dist/ build/ .venv/ __pycache__/</code> — in that order of precedence; an excluded directory is never descended, so nothing inside it is stat-ed, hashed or sent. Hidden files (<code class="inline">.env</code>, <code class="inline">.git/</code>) are skipped by a separate, non-optional rule. Every run prints what was dropped and by which rule (<code class="inline">ignore rules: …</code> on stderr), and <code class="inline">--dry-run</code> also counts the files inside each pruned directory, so “where did my file go?” always has an answer. <code class="inline">--no-ignore</code> turns the rules off; <code class="inline">--no-default-ignores</code> keeps your ignore files and drops only the built-in list. The folder you point at is never excluded: if it is itself ignored — say you run this on <code class="inline">~/proj/target</code> — it is indexed anyway and the run says which rule it would have matched.</p>+ <p>Build output never reaches the index in the first place. The walk honours <code class="inline">.xerjignore</code>, <code class="inline">.gitignore</code> (nested files and <code class="inline">!negation</code> included) and <code class="inline">.git/info/exclude</code>, plus a built-in list — <code class="inline">node_modules/ vendor/ target/ dist/ build/ .venv/ __pycache__/</code> — in that order of precedence; an excluded directory is never descended, so nothing inside it is stat-ed, hashed or sent. The two git-owned kinds stop at a repository boundary the way git does: a <code class="inline">.gitignore</code> above a nested checkout has no authority over the files inside it, so a vendored or submoduled tree keeps its own rules. <code class="inline">.xerjignore</code> and the built-in list are XERJ’s rather than git’s and apply throughout the folder you named. Hidden files (<code class="inline">.env</code>, <code class="inline">.git/</code>) are skipped by a separate, non-optional rule. Every run prints what was dropped and by which rule (<code class="inline">ignore rules: …</code> on stderr), and <code class="inline">--dry-run</code> also counts the non-hidden files inside each pruned directory, so “where did my file go?” always has an answer. <code class="inline">--no-ignore</code> turns the rules off; <code class="inline">--no-default-ignores</code> keeps your ignore files and drops only the built-in list. Both apply to an indexing run only — <code class="inline">autoindex map</code> and <code class="inline">autoindex status</code> never walk a folder and refuse them rather than accepting a flag that would do nothing. The folder you point at is never excluded: if it is itself ignored — say you run this on <code class="inline">~/proj/target</code> — it is indexed anyway and the run says which rule it would have matched.</p><p><code class="inline">--workers</code> is a ceiling, not a promise: when the server answers <code class="inline">429 Too Many Requests</code> the run halves its own bulk concurrency on the spot and probes back up one worker at a time only after a clean streak, so a busy server is not handed the same load six times over. The run's summary records where it ended up (<code class="inline">bulk_concurrency_final</code>, <code class="inline">bulk_congestion_events</code>).</p><p>Your dataset names, field types, and counts will reflect <em>your</em> folder — that is the point. The behaviors shown here (decimal-comma → <code class="inline">double</code>, date strings → typed <code class="inline">date</code>, keyword inference, junk recording, resume-to-identical-counts) are the invariants.</p>diff --git a/landing/llms-full.txt b/landing/llms-full.txtindex c90f80402..631d0c27c 100644--- a/landing/llms-full.txt+++ b/landing/llms-full.txt@@ -164,11 +164,19 @@ Ignore rules: the walk honours .xerjignore, .gitignore (nested files and!negation included) and .git/info/exclude, plus a built-in build-output list(node_modules/ vendor/ target/ dist/ build/ .venv/ __pycache__/), in that orderof precedence. An excluded directory is never descended, so nothing inside it-is stat-ed, hashed or sent. Hidden files (.env, .git/, .ssh) are skipped by a-separate rule that no flag turns off. Every run prints `ignore rules: ...` on-stderr naming each rule and what it dropped; --dry-run also counts the files-inside each pruned directory. --no-ignore turns the rules off entirely;+is stat-ed, hashed or sent. The two git-owned kinds stop at a repository+boundary the way git does, so a .gitignore above a nested checkout does not+judge files inside it; .xerjignore and the built-in list are XERJ's rather than+git's and apply throughout the folder you named. Hidden files (.env, .git/,+.ssh) are skipped by a separate rule that no flag turns off. Every run prints+`ignore rules: ...` on stderr naming each rule and what it dropped; --dry-run+also counts the non-hidden files inside each pruned directory and reports that+count on xerj-done as ignored_files_in_pruned_dirs, alongside+ignored_files_in_pruned_dirs_exact — false means the budget capped it and the+number is a floor. --no-ignore turns the rules off entirely;--no-default-ignores keeps your ignore files and drops only the built-in list.+Both are refused on `autoindex map` and `autoindex status`, which never walk a+folder.Your global gitignore (core.excludesFile) is deliberately not read. The folderyou point at is never excluded: if it is itself ignored, it is indexed anywayand the run says which rule it would have matched.diff --git a/landing/llms.txt b/landing/llms.txtindex 4272cdcac..414512cc8 100644--- a/landing/llms.txt+++ b/landing/llms.txt@@ -105,7 +105,7 @@ Two honesty notes the payload states about itself and you should pass on: the es* **Fast** — `--no-semantic --no-graph`: skips embedding-backed body fields and relationship detection. You still get typed, queryable BM25 + keyword indices over the same files — a better-than-grep experience for a fraction of the time. (Note: XERJ's default embedder is lexical feature-hashing, not neural, so `--no-semantic` costs you less than the word "semantic" suggests unless the node runs `--embed-mode neural`.)* **Narrower** — index the subdirectory that matters. Build output is already handled for you (see the ignore-rules bullet below); narrowing beyond that is still usually the biggest win available.* Also useful when their machine must stay usable: `--workers N` and `--pdf-workers N` (which accepts 1–4 only). They bound the **client-side extractor**, not the server — indexing itself runs in the node process, so do not promise a user these cap the machine's total CPU.-- **Junk is already excluded — do not re-derive it, and do read the report.** The walk honours `.xerjignore`, `.gitignore` (nested files and `!negation` included), `.git/info/exclude`, and a built-in list — `node_modules/ vendor/ target/ dist/ build/ .venv/ __pycache__/` — highest precedence first. An excluded directory is never descended, so nothing inside it is stat-ed, hashed or sent. Hidden files (`.env`, `.git/`, `.ssh`) are skipped separately and *stay* skipped: that rule is what keeps secrets out of a queryable brain, and no flag turns it off. Two things follow for you: (a) the job-size line already reflects the exclusions, so estimate from it and do not subtract build output a second time; (b) when your user says "my file is missing", the answer is on stderr — every run prints `ignore rules: …` lines naming each rule and what it dropped, and `--dry-run` additionally counts the files inside each pruned directory. Relay those lines rather than guessing. `--no-ignore` indexes everything the rules would have dropped; `--no-default-ignores` keeps the ignore files and drops only the built-in list. Your *global* gitignore is deliberately not read.+- **Junk is already excluded — do not re-derive it, and do read the report.** The walk honours `.xerjignore`, `.gitignore` (nested files and `!negation` included), `.git/info/exclude`, and a built-in list — `node_modules/ vendor/ target/ dist/ build/ .venv/ __pycache__/` — highest precedence first. An excluded directory is never descended, so nothing inside it is stat-ed, hashed or sent. The two git-owned kinds stop at a repository boundary the way git does, so a `.gitignore` above a nested checkout does not judge the files inside it; `.xerjignore` and the built-in list are XERJ's and apply throughout. Hidden files (`.env`, `.git/`, `.ssh`) are skipped separately and *stay* skipped: that rule is what keeps secrets out of a queryable brain, and no flag turns it off. Two things follow for you: (a) the job-size line already reflects the exclusions, so estimate from it and do not subtract build output a second time; (b) when your user says "my file is missing", the answer is on stderr — every run prints `ignore rules: …` lines naming each rule and what it dropped, and `--dry-run` additionally counts the non-hidden files inside each pruned directory. Relay those lines rather than guessing. On the `xerj-done` line that count is `ignored_files_in_pruned_dirs`, and it is budget-capped — always read `ignored_files_in_pruned_dirs_exact` beside it, because `false` means you are holding a floor, not a total. `--no-ignore` indexes everything the rules would have dropped; `--no-default-ignores` keeps the ignore files and drops only the built-in list; both are refused on `autoindex map` and `autoindex status`, which never walk a folder. Your *global* gitignore is deliberately not read.- **Read the progress stream — it is designed for you.** `autoindex` writes its RESULT to stdout and its LIVENESS to stderr, so `--json` stdout stays one clean parseable document while stderr narrates. When stderr is not a terminal — which is you — a tick writes **two lines, in one write**: a display line to hand to your user, and the machine line to parse.```