#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Build the SEARCH-CONVENTIONS.md revision (two additive insertions, from the served bytes).""" import hashlib import json import os import sys sys.stdout.reconfigure(encoding="utf-8", errors="replace") RUN = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE = "evidence/served/SEARCH-CONVENTIONS.md" WANT = "6160114056b5978f277959993d05a7693cc3c333bbe1becc57c4e3ed03db4b25" A1 = """**Calibrate, every time, in the same session and on the same channel.** Known positives that must return: `2,6,18,30,66,150,192,258` \u2192 A288815; `2,4,6,10,14,22,26,34,40,46,58,66` \u2192 A048670; `2,3,5,7,10,13,19,25,35,45,59,73` \u2192 A023192. If those fail, the channel is broken and any negative that day is void. """ I1 = """ **A channel can fail on EVERY query, its own control included, and that is a broken channel and not a negative.** Recorded 2026-09-17. The keyword search channel this corpus's literature lanes use answered `No search results found` for **every** query tried in the session: a topical one (`Cantarini arXiv 2607.09110 \u2026`), a second topical one, the corpus's own control `twin prime conjecture`, and finally `Python programming language`, which cannot legitimately have zero indexed results. Under the rule immediately above, that channel was **broken**, and *every* negative produced while only that channel was tried is **VOID**. This is the third time this file has had to correct its own pessimism about a channel; \u00a73's MathSciNet row, corrected 2026-08-19, is the second, and the pattern is worth naming: a channel that refuses is far more often the tool than the literature. **The path that works when the keyword index is down: direct provider ENDPOINTS, fetched as URLs.** They are addressable with no search index in the loop and are unaffected by the failure above. Verified live 2026-09-17, in the same session in which the keyword channel was dead: | channel | how | what it returned on 2026-09-17 | |---|---|---| | arXiv API | `https://export.arxiv.org/api/query?search_query=\u2026&sortBy=submittedDate&sortOrder=descending` | `all:"twin primes"` \u2192 **252** results; `cat:math.NT AND abs:"twin prime"` \u2192 **143**, newest 2026-08; `abs:"M\u00f6bius" AND abs:"Elliott-Halberstam"` \u2192 **2**, one of them **`2607.09110v1` with its FULL abstract** \u2014 the Cantarini paper this corpus already relies on | | arXiv abstract page | `https://arxiv.org/abs/` | HTTP **200** and the complete record | | MathSciNet | `POST https://mathscinet.ams.org/mrlookup` (\u00a73) | bibliographic fields only, no review text | The arXiv API also accepts `au:` for a named author and `cat:` for a category, so \u00a72's **named-person lead** becomes an endpoint rather than a hope. **Consequence for every sentence of the form "no source located".** It must now name the channel AND its outcome, per channel. A negative from a provider endpoint that was actually reached is evidence. A negative from a keyword box that was not calibrated in that session is not \u2014 and a record that declares a source gap while the only channel tried was broken has, by this file's own rule, an **unsearched gap** and must say so. """ A2 = """**Keyword sweeps cannot reach a differently-worded entry.**""" # Insert the second block at the head of section 5, i.e. just after its heading line. A3 = "## 5. What is still open, stated so it is not mistaken for coverage\n" I3 = """ > **Void negatives, added 2026-09-17.** Any \u00a75 entry below whose text rests on a keyword-search > negative taken while the keyword channel was uncalibrated must be re-taken through a provider > endpoint before it is used to justify a "still open" claim. The channel evidence, with the > queries and their outcomes, is in the paragraph added to \u00a72; the loaded check is that a > TRIVIAL control must return before any negative in the same session counts. """ def main(): p = os.path.join(RUN, BASE) raw = open(p, "rb").read() got = hashlib.sha256(raw).hexdigest() assert got == WANT, "base hash mismatch: %s != %s" % (got, WANT) text = raw.decode("utf-8") new = text for anchor, insert, label in ((A1, I1, "section 2"), (A3, I3, "section 5")): n = new.count(anchor) assert n == 1, "%s: anchor appears %d times" % (label, n) new = new.replace(anchor, anchor + insert if label == "section 2" else insert + anchor, 1) assert new.replace(insert, "", 1) == (text if label == "section 2" else new.replace(insert, "", 1)), \ "%s: not purely additive" % label # final additive check against the original base check = new for insert in (I1, I3): assert check.count(insert) == 1 check = check.replace(insert, "", 1) assert check == text, "the revision is not purely additive" out = os.path.join(RUN, "artifacts", "rev-SEARCH-CONVENTIONS.md") with open(out, "w", encoding="utf-8", newline="\n") as fh: fh.write(new) nb = new.encode("utf-8") print(json.dumps({"doc": "research/SEARCH-CONVENTIONS.md", "base_sha256": got, "base_bytes": len(raw), "out": "artifacts/rev-SEARCH-CONVENTIONS.md", "out_bytes": len(nb), "out_sha256": hashlib.sha256(nb).hexdigest(), "added_lines": new.count("\n") - text.count("\n"), "removed_lines": 0}, indent=1)) return 0 if __name__ == "__main__": sys.exit(main())