Persona search: a result counts only when its title or body holds every word of hers

The forge's own search matches loosely: GameCult/Bifrost?q=consent returned
ten, most without the word. One matcher, search_finds, now decides for the
live path and the fixture alike: every non-stopword word of her query, whole
and case-blind, in the title or in the body (the fixture's first line and the
rest). Nothing passing is an honest not-found. Tested against a recorded copy
of that live response, trimmed to the fields read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-21 02:43:39 +01:00
commit 72bc08e946
3 changed files with 169 additions and 6 deletions

View file

@ -0,0 +1,132 @@
[
{
"number": 87,
"title": "Merge pages and notices: prove both, choose survivor with preview, undo, notice feed (dark by default)",
"body": "Merge pages and notices (merge design cuts: proofs, status and undo, merge page, notice feed), plus the fix batch for Soul verdict cut-merge-notices.s1.\n\n- Proof of both accounts by Heimdall account id only; no email or name matching; the other account is named only after both proofs; survivor chosen against a preview; consent for both; undo with fresh proof inside the grace window.\n- Derived notice feed (merged/undone/final) with idempotent acks, bearer-gated pull routes, migration `AddAccountMergeNoticeAcks`.\n- Dark by default: `AccountMerge:Enabled` false. Not deployed.\n- Soul: s1 (no Blocker/High), fixes at 63b9596, delta verdict s2 clean (one Low: stale login list drives the conflict block).\n\nCo-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n",
"state": "closed",
"pull_request": {
"merged": true
},
"user": {
"login": "heimdall"
},
"created_at": "2026-11-14T13:18:15Z"
},
{
"number": 80,
"title": "Start refusal: read headers only so the 4 KiB body bound limits the read",
"body": "Follow-on to #79, which merged at 87a1bb6 while this fix was still unpushed (my push failed from a detached worktree and I merged anyway; the Soul re-pass on 87a1bb6 had findings).\n\n- `StartAsync` sends with `HttpCompletionOption.ResponseHeadersRead` so `RefusedStartMessageAsync`'s 4 KiB bound limits the read; `PostAsJsonAsync` buffered the whole body first (Soul finding 1).\n- The swallow is `catch (Exception error) when (error is not OperationCanceledException)`.\n- The charset test is renamed to say what it pins. Cancellation mid-read has no test: the fake handler returns buffered content, so it cannot be observed.\n\nHeimdall-filtered suite: 160 pass. Not deployed.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)",
"state": "closed",
"pull_request": {
"merged": true
},
"user": {
"login": "heimdall"
},
"created_at": "2026-11-12T14:48:42Z"
},
{
"number": 78,
"title": "Heimdall__AppSecretFile: keep the Heimdall app secret out of the process environment",
"body": "Cuts follow-up heimdall-body:follow_up:bifrost-appsecret-hazard.\n\n- New option `Heimdall:AppSecretFile` (systemd `LoadCredential` style `%d/name`). Resolved once in an options PostConfigure (`HeimdallOptions.ResolveAppSecret`); the file wins, one trailing newline is trimmed.\n- Set-but-missing/unreadable/directory/empty file fails startup closed in every environment (validator touches the options first), naming the option and path, never the secret.\n- `Heimdall:AppSecret` (env) still works and logs a deprecation warning without the value. Neither set: unchanged. Existing header log redaction is untouched and still covers the header.\n- Tests: `HeimdallAppSecretFileTests` (14). Eight mutations each fail a test (no PostConfigure, no validator touch, Trim vs TrimEnd, env wins, empty accepted, missing swallowed, warning removed, secret logged).\n- Full suite: base 1365 pass, head 1379 pass, 0 failures.\n- Docs: deploy-main-to-live.md, concept-mill-votes-target.md, new docs/heimdall-app-secret-file.md. Ops steps are in the commons handoff note bifrost-appsecret-file-ops-note-20261112.md (not applied; no host files read).\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)",
"state": "closed",
"pull_request": {
"merged": true
},
"user": {
"login": "heimdall"
},
"created_at": "2026-11-12T13:25:01Z"
},
{
"number": 77,
"title": "Linux path fixes: containment by path.relative, hostile-cursor test, verify prerequisites",
"body": "Closes the small-fix remainder of concept-mill-votes:follow_up:bifrost-linux-verify-remainder (items 1-3; item 4, the never-deleted bifrost-gate-shims-* temp dirs, is untouched).\n\n- `tools/path-within.mjs`: one `isWithin(root, candidate, {pathApi, allowSelf})` built on `path.relative`, replacing the hardcoded `\\\\` containment in `bifrost-bridge.mjs` (repo-root check), `git-gate/git-proxy.mjs` and `git-gate/gh-proxy.mjs` (`isWithinExcludedDir`). Windows keeps case-insensitive comparison (path.win32); POSIX is now case-sensitive. Fixes `github-draft-pr` throwing \"Target path escapes repo root\" on Linux and the gate never excluding its own wrapper dir.\n- `tests/path-within.test.mjs` (12 node tests, posix and win32 flavours via explicit `pathApi`, both run on Linux): inside, root itself, `/repo-evil` sibling refused, `..` escape refused, `..cache` name inside, excluded dir under and not under. With the old backslash logic in the helper, 3 of 12 fail.\n- Cursor test: server already bounds cursors at `RankCursor.MaxLength` = 200 (400 before any query). The 100,000-char case could never be sent by a real client (System.Uri rejects over 65,519 on Unix), so the test was wrong, not the server. It now sends 50,000 chars, still a server-side 400; the 201-char case keeps the exact boundary. No server change.\n- README: test line states the two prerequisites (real .NET 8 runtime, built CultLib at `$VOIDBOT_CULTLIB_ROOT`); the stale roll-forward advice is replaced.\n\nFull suite, real .NET 8 + built CultLib, 1365 tests: main 2 failures (the hostile cursor, `Bridge_owned_github_draft_pr_authorizes_push_under_dispatch_gate`); this branch 1 failure, `UnixSocketDeskDoorTests.A_silent_door_is_503_with_retry_after_not_a_hang`, a timing test that passed 3 of 3 reruns in isolation (52/52) and is not touched by this diff.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n",
"state": "closed",
"pull_request": {
"merged": true
},
"user": {
"login": "heimdall"
},
"created_at": "2026-11-12T12:36:58Z"
},
{
"number": 76,
"title": "Mouth: follow upgrades only a plain basis; @room keeps room",
"body": "Reverses #74's room upgrade on Persona's decision: a followed peer's plain message (null basis) becomes `follow`; an @room keeps `room`, does not wake via follow and spends none of the peer's K. tag/reply/direct unchanged.\n\nAlso corrects the stale wording (mouth header, flag comment, docs/bridge.md Follow): Huginn's variant is `Basis::FollowUp`, wire string `follow` (FOLLOW_UP_BASIS f09bc56e).\n\nTests: the room-upgrade assertion now expects `room`; new test: four @room from a followed peer stay `room`, then three plain messages still all upgrade (cap unspent). Reverting the one-line fix fails 2 tests. Full node suite: 283 tests, 271 pass, 12 fail; the 12 are a subset of main's failures (main run showed 13, one extra a timing-flaky brake-gate test).\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)",
"state": "closed",
"pull_request": {
"merged": true
},
"user": {
"login": "heimdall"
},
"created_at": "2026-11-12T12:27:18Z"
},
{
"number": 72,
"title": "Mouth: id shape on every delivery field, mentions bounded in bytes, round cap counts every target GET",
"body": "Cuts the two remaining lows after #68 (CHAT_PENDING_V4 off, not deployed).\n\n1. Delivery ids: event id, sender, context sender, mention and tail id must be Matrix ids (<=255 bytes, no whitespace/control/format). The mouth skips such an event or drops the context/tail line or mention; encoders and parsers refuse them. Mentions are bounded in bytes. A sender with an empty localpart is shown under its full id.\n2. Round cap: the 8 per round now counts every uncached reply-target GET (basis, reply_to, thread root); an event that would pass it waits for the next round. The check pins targets it counted as cached for that event only. Context reads stay separate and uncounted (documented).\n\nTests: mouth + runtime 194/195 (the systemd-credentials test fails identically on base in this sandbox); golden v1-v6 green, fixtures untouched. Soul: two findings rounds fixed, final clean at 34f6dc1. Known, not fixed: a busy earlier room can starve a deferred event (pre-existing in #68's DEFER); follow-up admitted.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)",
"state": "closed",
"pull_request": {
"merged": true
},
"user": {
"login": "heimdall"
},
"created_at": "2026-11-11T21:06:13Z"
},
{
"number": 71,
"title": "Desk: bearer credential (OpenIddict validation, desk.read/desk.answer, audience bifrost-desk) and answerer masking",
"body": "Production IDeskCredential and answerer masking (no deploy; no production Ratatoskr client is seeded).\n\n- OidcDeskCredential: OpenIddict local-server validation (OpenIddict.Validation.AspNetCore + ServerIntegration 7.7.1), not the default scheme. Authenticates only; audience, scope and per-request Active membership stay the desk's.\n- Issuer registers desk.read/desk.answer and stamps audience bifrost-desk. MAS cannot request them; its token and the session cookie are 401 on /api/desk/*. A Desk section without Oidc fails startup.\n- Notes: for non-deciders every note is nil (DeskRedaction). Bifrost masks no answerer id and no card.deciders: Huginn's door withholds both and returns counts (ruling eureka-substrate:ruling:desk-read-visibility-withheld-ids, Huginn #56 79d954c); Bifrost cannot mask what it cannot read (the card is opaque).\n- Consent gate: the training-notice receipt gates the chat token only; a desk token issues for a member with no receipt (test), a chat token is still sent to the consent page. Suspension still stops both.\n- Tests use real tokens from the test host's issuer. 1089 pass / 43 fail; the same 43 fail on f6a826b in this sandbox.\n\nSteward answers applied: card.deciders leak is the door's (Huginn #56); consent gate chat-only; scheme name stays OpenIddict's fixed one (design note corrected in #69).\n\nTextual overlap with the door PR (#70) in DeskReplay/test helpers; whichever merges second rebases.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)",
"state": "closed",
"pull_request": {
"merged": true
},
"user": {
"login": "heimdall"
},
"created_at": "2026-11-11T17:48:25Z"
},
{
"number": 70,
"title": "Desk: UnixSocketDeskDoor (Huginn desk door client), fixtures at 79d954c, card re-pin to CultLib 3a51bbab, card opaque",
"body": "Production IDeskDoor for the Desk (no deploy; the Desk stays unmapped until configured).\n\n- Vendors Huginn's golden desk fixtures at Huginn 232764bf (99 files, sha256 pin, exact file set) and CultLib fork-card-vectors.json at d3025d3c (17/18-key card, answerer_count). Card is opaque (JsonElement): raised_at and any re-pinned key order pass through unchanged.\n- UnixSocketDeskDoor: one connection per call, 1 s deadline, u32-BE framed CultNet/MessagePack, 65536 bound both ways, messageId echo, strict closed-map decoding (one variant key, schemaVersion, no duplicates, canonical base64). Any failure is DeskDoorException -> 503 for that Mind only. ReadAsync refuses an entry whose card fork_id differs from the route's.\n- Registered by default in AddBifrostDesk beside the #71 credential. Adds the MessagePack NuGet package (3.1.12).\n- Bifrost still nils every `note` for a non-decider (DeskNotes.Strip); decider and answerer ids are withheld by Huginn's door, not here.\n- Unpinned: the Answer request has no golden bytes (derived from desk_wire.rs and the schema).\n\nTests: full suite 1322 pass / 43 fail on this branch; the same 43 fail on main (1092 pass / 43 fail) in this sandbox (Windows assumptions, see concept-mill-votes:follow_up:bifrost-tests-windows-only). Desk tests 386 pass. Soul passes: clean on 18851346.\n\nGenerated with [Claude Code](https://claude.com/claude-code)\n",
"state": "closed",
"pull_request": {
"merged": true
},
"user": {
"login": "heimdall"
},
"created_at": "2026-11-11T17:43:38Z"
},
{
"number": 62,
"title": "Prefix lengths: host-level startup tests (tests only)",
"body": "Validation already existed on main (eca71f5, checked in every environment); this pins it with host-level tests. Follow-up concept-mill-votes:dev-prefix-length-validation.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)",
"state": "closed",
"pull_request": {
"merged": true
},
"user": {
"login": "heimdall"
},
"created_at": "2026-11-11T14:12:43Z"
},
{
"number": 61,
"title": "Drop HTMX (unpkg, no integrity); guard against third-party assets",
"body": "Removes unpkg HTMX and dead hx- attributes; source-scan test with explicit Google Fonts allowance. Follow-up concept-mill-votes:htmx-from-unpkg.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)",
"state": "closed",
"pull_request": {
"merged": true
},
"user": {
"login": "heimdall"
},
"created_at": "2026-11-11T14:12:43Z"
}
]

View file

@ -240,6 +240,14 @@ fn content(word: &str) -> bool {
!STOPWORDS.contains(&word)
}
/// Whether a search's words find `text`: every word of the query that carries content stands in it as a whole word, case
/// blind (Soul's R7). One matcher for the live forge and the fixture, so the harness and the live path agree.
fn search_finds(query: &str, text: &str) -> bool {
let wanted: Vec<String> = word_tokens(query).into_iter().filter(|word| content(word)).collect();
let held = word_tokens(text);
!wanted.is_empty() && wanted.iter().all(|word| held.contains(word))
}
/// The repo a repo target names, lowercased: `GameCult/Bifrost#89` names `bifrost`. None when it is no repo target.
pub(crate) fn repo_name(target: &str) -> Option<String> {
let target = repo_target(target.trim())?;
@ -352,20 +360,20 @@ impl ReadSource for ReadFixture {
}
}
/// A search of a repo by the titles of its recorded pull requests and issues: each whose title holds every word, as
/// `- #n title`; none, and nothing was found.
/// A search of a repo by its recorded pull requests and issues: each whose title (first line) or body (the rest) the
/// search finds (`search_finds`), as `- #n title`; none, and nothing was found.
fn fixture_search(entries: &[ReadEntry], request: &ReadRequest) -> Option<String> {
let ReadRequest::Repo(target) = request else { return None };
let (repo, words) = target.split_once("?q=")?;
let (repo, words) = (repo.to_lowercase(), word_tokens(words));
let repo = repo.to_lowercase();
let listed: Vec<String> = entries
.iter()
.filter(|entry| entry.kind == "repo")
.filter_map(|entry| {
let (of, number) = entry.target.split_once('#')?;
let title = entry.text.as_deref()?.lines().next()?.trim();
let held = word_tokens(title);
(of.to_lowercase() == repo && words.iter().all(|word| held.contains(word))).then(|| format!("- #{number} {title}"))
let (title, body) = entry.text.as_deref()?.split_once('\n').unwrap_or((entry.text.as_deref()?, ""));
let title = title.trim();
(of.to_lowercase() == repo && (search_finds(words, title) || search_finds(words, body))).then(|| format!("- #{number} {title}"))
})
.collect();
(!listed.is_empty()).then(|| listed.join("\n"))
@ -509,6 +517,9 @@ fn search(forge: &dyn ForgeGet, name: &str, words: &str) -> Result<String, ReadF
.as_array()
.into_iter()
.flatten()
// The forge's own search matches loosely (Soul's R7: `q=consent` on Bifrost returned ten, most without the word);
// only a result whose title or body holds every word of hers counts, and none is an honest not-found.
.filter(|item| search_finds(words, item["title"].as_str().unwrap_or_default()) || search_finds(words, item["body"].as_str().unwrap_or_default()))
.map(|item| {
let pull = item.get("pull_request").is_some_and(|pull| !pull.is_null());
let state = if item["pull_request"]["merged"].as_bool() == Some(true) { "merged" } else { item["state"].as_str().unwrap_or("?") };

View file

@ -121,7 +121,27 @@ fn r7_a_fixture_search_matches_the_titles_of_its_recorded_changes() {
let since = Utc::now();
let search = |target: &str| fixture.read(&ReadRequest::Repo(target.into()), since);
assert_eq!(search("GameCult/Bifrost?q=consent receipt"), Ok("- #89 Consent receipt for door grants".into()));
assert_eq!(search("GameCult/Bifrost?q=body"), Ok("- #89 Consent receipt for door grants".into()), "the body counts as the forge's does");
assert_eq!(search("GameCult/Bifrost?q=consent rec"), Err(ReadFailure::NotFound), "whole words only");
assert_eq!(search("gamecult/bifrost?q=Consent"), Ok("- #89 Consent receipt for door grants".into()), "the repo's own changes only, case-blind");
assert_eq!(search("GameCult/Bifrost?q=consent signature"), Err(ReadFailure::NotFound));
assert_eq!(search("gamecult/BIFROST#90"), Ok("Sign-in gate".into()), "a recorded read by its normal form");
}
/// Soul's R7, against a recorded copy of the live forge's answer to `GameCult/Bifrost?q=consent` (2026-11-21): the forge
/// returned ten; only a result whose title or body holds every word of hers counts. Two bodies say "consent" (#87, #71);
/// the other eight are dropped. "consent receipt" leaves #71 alone, and words none of them hold are an honest not-found.
#[test]
fn r7_a_live_search_keeps_only_results_that_hold_her_words() {
struct Recorded;
impl ForgeGet for Recorded {
fn get(&self, _path: &str) -> anyhow::Result<(u16, String)> {
Ok((200, include_str!("../fixtures/forge-bifrost-q-consent.json").to_owned()))
}
}
let kept = repo_read(&Recorded, "GameCult/Bifrost?q=consent").unwrap();
assert!(kept.starts_with("- #87 ") && kept.lines().count() == 2 && kept.lines().nth(1).is_some_and(|line| line.starts_with("- #71 ")), "{kept}");
assert!(repo_read(&Recorded, "GameCult/Bifrost?q=CONSENT receipt").unwrap().starts_with("- #71 "));
assert_eq!(repo_read(&Recorded, "GameCult/Bifrost?q=consent signature"), Err(ReadFailure::NotFound));
assert_eq!(repo_read(&Recorded, "GameCult/Bifrost?q=sealion"), Err(ReadFailure::NotFound));
}