8000 fix(autoindex,api): complete the zero-experience naive path (#1102 #1103 #1104 #1105) by xerj-org · Pull Request #1107 · xerj-org/xerj · GitHub
[go: up one dir, main page]

Skip to content

fix(autoindex,api): complete the zero-experience naive path (#1102 #1103 #1104 #1105) - #1107

Merged
xerj-org merged 3 commits into
mainfrom
fix/naive-path-e2e
Oct 1, 2026
Merged

xerj-org merged 3 commits into
mainfrom
fix/naive-path-e2e

Conversation

@xerj-org
@xerj-org xerj-org commented Oct 1, 2026
Copy link
Copy Markdown
Owner

What

Fixes the four defects the rc.80 zero-experience E2E filed against the naive
path — the exact four stalls a first-time user hit going from install to
"measure what XERJ did for me":

Measured

Re-run of the harness on the built binaries (fresh node, same 90-file
corpus): xerj gain with no XERJ_URL override now reads the audit log on
the first try (8080 probe) and reports the user's real searches — 3/3 with
hits — with the machine traffic named separately. The --no-graph run
ends with the same next: + code hint the graph run prints. Autoindex
against a dead port prints the start-a-node recipe.

Token A/B from the same harness (unchanged by this PR, for context):
152.7× context reduction vs reading whole files (926,492 → 6,066 tok over
5 questions), 34.2× vs reading just the top hit's file.

Notes

  • The audit-note change is additive (s 8000 ize= appended); gain treats a
    missing size= as a user search, so pre-existing logs still parse.
  • search_all/GET share the one search audit site; no other note writers
    pin the old format (engine audit doc comment + gain fixtures updated).
  • ES-YAML conformance: 0 failed (full suite, private port, throwaway dir).

…de recipe, success guidance, and a gain that tells the truth

The rc.80 zero-experience E2E (AGENT_FTX_HARNESS, PR #1106) walked the
shipped installer from install to "measure impact" as a first-time user
and filed four defects. This fixes all four; each was reproduced
verbatim before the fix and re-verified after it.

#1102 — autoindex's first contact printed ping's raw context
("endpoint unreachable ... Connection refused") and taught a
first-time user nothing. autoindex is the onboarding verb, so the
no-node case now prints the same recipe `xerj def` has: start a node,
or aim --url/$XERJ_URL at one. (lib.rs, Es::ping call site)

#1103 — two success printers existed: the interactive summary taught
the data map, the search shape and the _passage projection, while the
generated-run (--no-graph / brain) printer stopped at "generation N
committed" — and --no-graph is exactly the recovery the journal guard
recommends, so users were steered onto the hint-less path. The
code-aware hint text moved into one shared code_search_hint() and the
generated-run printer now calls next_hint() + it too (gated on the
committed run doc's code_files_indexed, the plan not being in scope on
that resume/watch path). Before: bare one-liner. After: same guidance
the graph path prints, verified on a fresh --no-graph run.

#1104 — xerj gain probed XERJ_URL and ES-port+1 for the native
listener, but a default node puts native REST on 8080 (the banner says
so), so gain was unusable without hand-guessing the port. Probe order
is now: given URL, host:8080 (default native), then the +1 convention,
deduplicated; the error lists every URL tried. Verified: bare
`xerj gain` on a default-ports node reads the audit log first try.

#1105 — gain reported "283 searches, 3.0% found something, 275
zero-hit" after a session where every real search hit. The audit log
mixed machine traffic into op=search: autoindex's read-back
verification issues size:0 searches (~2/group; 179 in the harness
window) and reconcile sweeps full-page searches against
autoindex-catalog. Three parts:
  - the search audit note now carries the requested page size
    (took=4ms hits=0 size=0); additive, and gain treats a missing
    size= as a user search so pre-existing logs still parse.
  - gain separates the window into user searches vs counting probes
    vs catalog sweeps, reports the user's stats, and names what was
    excluded (nothing thrown away — it is all still in the audit log).
  - Es::count() uses the real _count endpoint first (audited
    count.post), keeping the size:0 search only as the old-build
    fallback.
  After, the same shape of session reports 4 user searches (2 hits,
  2 honest misses) with 274 machine searches counted aside.

Gates: xerj-autoindex --lib 1155 passed / 0 failed; ES-YAML
conformance on a private port 1380 passed / 0 failed / 3 skipped.

Files:
- engine/crates/xerj-api/src/es_compat.rs — search audit note + size
- engine/crates/xerj-autoindex/src/gain.rs — SearchWindow, note
  parser, native_candidates, output, tests
- engine/crates/xerj-autoindex/src/esclient.rs — count() via _count
- engine/crates/xerj-autoindex/src/lib.rs — ping recipe, shared
  code_search_hint, generated-run guidance
@cla-bot cla-bot Bot added the cla-signed label Oct 1, 2026
@xerj-org
xerj-org merged commit 7e7f786 into main Oct 1, 2026
22 checks passed
neoneye pushed a commit to agent-memory-atlas-archive/xerj-org--xerj that referenced this pull request Oct 4, 2026
Version bump rc.80 -> rc.81 (17 workspace crates in Cargo.lock). CHANGELOG
section cites every window PR: xerj-org#1106 xerj-org#1107 xerj-org#1112 xerj-org#1113 xerj-org#1114 xerj-org#1115 xerj-org#1116
xerj-org#1117 xerj-org#1119 xerj-org#1123 xerj-org#1124. ROADMAP rolled: shortlist re-verified live at cut
(four open xerj-org#1091 xerj-org#1092 xerj-org#1094 xerj-org#1100; xerj-org#1093 closed by xerj-org#1112 inside the
window and moves to the CHANGELOG). Landing stamp sweep RC.80 -> RC.81 in
54 files — footer stamps only; historical prose ('since rc.80', 'rc.80
closed that', PR xerj-org#1082 claims in llms.txt/llms-full.txt and the S3/alerting
answers pages) deliberately left at rc.80.
neoneye pushed a commit to agent-memory-atlas-archive/xerj-org--xerj that referenced this pull request Oct 10, 2026
xerj-org#1109)

Problem: audit search entries recorded WHO issued a query (subject) but
not WHO IT SERVED. The only machine/user separation available was the
client-side heuristic in `xerj gain` (xerj-org#1105): parse `size=0` out of the
note string, match resource == "autoindex-catalog". That is re-derivation
of a classification the server already knew at append time, breakable by
any note-format change, and spoofable by anything that can write
audit-shaped entries (a client-set marker was proposed as
`X-Xerj-Internal` during xerj-org#1107 and rejected as spoofable; that decision
stands and this is the replacement).

Fix: every AuditEntry now carries `actor: "user"|"machine"`, derived at
append time by the SERVER alone, from the request's own semantics:

  machine iff size == 0 (a counting probe: asks for no hits back) or
            the target is the autoindex catalog (a maintenance index
            no person searches)

`search_actor_class(size, index)` in es_compat.rs is the single
derivation, deliberately a function of nothing a client can set. The
search handler calls the new `audit.append_as(actor, ...)`; every other
call site keeps `append()`, whose default is "user" — the writes and
security ops are all request-driven user traffic.

Tamper-evidence: actor is in compute_hash's input, so flipping an entry
user->machine (the dodge that would remove unfavourable traffic from
the gain hit-rate denominator) breaks the chain like any other edit.
Mixed-version logs: serde `default = "default_actor"` loads fieldless
pre-xerj-org#1109 entries as "user" — which is what they all were — and the
hash recomputes over that deserialized default, so a log spanning the
upgrade still verifies (pinned by test: hand-strip the field from one
line of a persisted log, reopen, verify ok, keep appending).

Consumer: `xerj gain` (xerj-autoindex/gain.rs) prefers the field when
present and keeps the note/resource derivation ONLY as the legacy
fallback for entries written by older binaries — an upgraded install
whose ring still holds pre-xerj-org#1109 entries must not report a hit-rate dip
that is really version skew. The probe/sweep counters keep their split
inside machine traffic for the existing honesty line.

The catalog index name moved to xerj-common::AUTOINDEX_CATALOG_INDEX
(single source of truth) because the classifier (xerj-api) and the name's
owner (xerj-autoindex::catalog) do not share a dependency edge; both now
read the constant.

Tests: 735/1256/337 lib tests green in xerj-engine/xerj-autoindex/
xerj-api; new pins — actor flip breaks the chain; mixed-version log
verifies; actor field authoritative over note heuristics; catalog-named
DATA index ("autoindex-catalog-copy") stays user; clippy clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
0