Repository navigation
chore: promote main to staging (page screen gating, scan evidence in coarse profile, PDF CPU off event loop) - #609
Merged
EricNGOntos merged 41 commits intoDec 4, 2026
Conversation
…ut-cleanup-to-ops Move S3 indexing input cleanup to an operator script
…base-cutover Prepare database TLS and API timeouts for Neon
A large Markdown document could starve the gevent heartbeat while the heading rules rewrote candidate rows one at a time. Run those rules in a bounded subprocess, batch candidate updates, and look up predictions by line ID.
Pass the current worker import path to the child and reuse precomputed Markdown rules when the model fails. Exercise both paths in regression tests.
…heading-filtering Keep Markdown heading filtering from blocking Worker heartbeats
Repeated ID searches in the heading tree projection starved the worker heartbeat on dense Markdown. Collect the first depth-first level per ID once and apply the levels in a single DataFrame write.
…ee-projection Project heading tree levels in linear time
…ng-input-limit Raise production indexing input limit to 1,048,576 characters
…me-anchor Preserve anchors when TOC rehome paths collide
Make Knowhere production S3 placement configurable
…oduction-storage Remove the Virginia storage fallback from production releases
Build cleanup runs _delete_by_query, which opens a scroll and clears it when the delete finishes. The worker role granted indices:data/read/scroll but not indices:data/read/scroll/clear, so every clear was denied and each scroll stayed open for its 5-minute keep-alive. Once the hourly maintenance sweep had opened 500 scrolls, the node rejected every later delete and the worker request timed out after 30 seconds. Grant both scroll actions at cluster and index level, as OpenSearch requires, and add a role-check test for a worker role that cannot clear scrolls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scripts in deploy/opensearch run with that folder first on sys.path, so Python's own `import operator` (from collections, at startup) loaded the repository's operator.py and failed with a circular-import ImportError. It stayed hidden only because the shared package's editable-install .pth happens to import collections before the script folder is added. Rename the module to native_operator.py, the name workload_snapshot.py already loads it under, and update every reference. The launch-issuer kind stays `operator`, so installed backup services keep their command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ar-permission Let the OpenSearch worker clear its delete-by-query scrolls
…or-shadowing Stop deploy/opensearch/operator.py shadowing the stdlib operator module
An index-use lease turns uncertain when its holder loses track of an in-flight OpenSearch request, and nothing ever released it again. Until then its build stays pending cleanup, its namespace index cannot close as empty, and its revision's indexing input is retained. - Build cleanup now always releases its own lease. A delete with an unknown outcome can only remove the retired or failed build's records, and the build stays pending until a later delete verifies it is empty. - The hourly maintenance sweep first releases uncertain leases that expired more than 15 minutes ago. Writers check their lease before every batch, so after expiry at most one request is still in flight, and it ends within the 30-second request timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The failure transition records audit metadata through make_json_safe, which imports numpy and pandas on first use. When nothing earlier in the process had loaded them, that import (about half a second) landed inside the measured region and exceeded the 0.40-second bound. Run make_json_safe once before the timer starts so the test measures cancellation only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-lexical-leases Release uncertain lexical leases that can no longer cover a request
…gnostics Raise production indexing limit and observe parser stalls
Text PDFs already find TOC candidates by keywords in the page text. The image screen on them only added TOC nodes for unnumbered section lists and cost about 40% of the coarse model calls (Sydney: 139 -> 79 calls, 207s -> 117s, same 105 section nodes). Slide decks and PDFs without a text layer (scanned, or no page text after the text scan) keep the screen, since keywords cannot find their TOCs (TAOCP still finds pages 14-15). The native-text test is shared with the stop_after_native_baseline check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Page-screen tiling and PNG encoding ran on the gevent hub and stalled every greenlet for 40-50 s on an 804-page PDF, starving lease renewal and the heartbeat. Tiling now runs in the PyMuPDF child process. - Skip the table search and drawing clustering in the asset probe once a page already has an asset; only has_asset reads that geometry. - Run PyMuPDF children at nice +10 so the event loop is scheduled first when the task's two CPUs are saturated. - Log event-loop stalls over 2 s with the blocking stack, keep the worst gevent delay between rate-limited pressure warnings, and report child CPU time. All observations are WARNING logs; no alerts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…has a side-effect' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Screen page images only for slides and text-less PDFs
…cking Keep PDF CPU work off the worker event loop
The coarse profile decides is_scanned from page screenshots, but since the asset probe moved after it the model saw no image measurements, every page labelled "normal" (defined as having native text) and every textless page as blank-like. A clean scan such as TAOCP was judged digital in 2 of 5 runs. - The text probe now records image coverage and image count, so the coarse call sees them; doc_stats adds invisible-text and image-coverage distributions (no sampling extrema). - The coarse prompt explains the evidence: a page is scanned when its screenshot shows clearly more text than its visible text layer holds and images cover most of it; a matching visible text layer means digital. Sampled page rows add invisible text, image coverage and image count and drop the text-only blank flag. - The geometry-only page kind "normal" is renamed "portrait"; persisted labels other than landscape still read as portrait. - Image placements come from one get_image_info pass instead of a get_image_rects call per image, in both probes (TAOCP asset probe 16s -> 0.15s; has_asset unchanged on all pages of four test documents). TAOCP is now judged scanned in 10 of 10 runs; Sydney, a standards document and a slide deck stay digital in 18 of 18. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eout test The test bounded the whole worker run, settlement included, by the budget plus 0.32s. The settlement's database work takes about 0.1s locally but 0.8s on the CI runner, so the test failed there without any regression. It now measures how long the blocked native wait lasted and asserts the deadline ended it before its own end. Settlement keeps its own deadline; missing it makes the run return "pending", which the test already rejects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Give the coarse profile scanning evidence and probe images in one pass
…arse profile, PDF CPU work off the event loop
…native wait in The 0.08s execution budget also covers the database work before the native wait. On a slow CI runner the deadline fired before the wait began, so the fake native call never ran. A one second budget still ends the twenty second wait early and keeps the test about one second long. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…-test-budget Fix the execution-timeout test budget on slow runners
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Promotes main to staging. The merge is conflict-free and adds no migrations.
🤖 Generated with Claude Code