Repository navigation
Rust engine: live feeds and repository discovery, parity-checked against Python, with prebuilt releases - #41
Merged
Conversation
Port discover_repo.py to Rust with output that matches byte for byte: the same walk order and budgets, ID quoting, gap ordering, and Python's json.dumps formatting. The YAML loader is a port of PyYAML's reader, scanner, and parser plus the SafeLoader resolver, so it accepts and rejects exactly what PyYAML does (tabs, NEL line breaks, YAML 1.1 scalars such as 1:30). - discover_repo.py: refuse explicit YAML tags; bound YAML nesting (64) and JSON nesting (512) explicitly instead of at Python's recursion limit; a TOML float that overflows is an error, not infinity; parse failures report a stable category (YAMLError, JSONDecodeError, TOMLDecodeError, UnicodeError, DiscoveryError) - control_room --view-engine rust also discovers with the binary (native_view_bridge.native_discover, clean environment, trust checks) - engine_binary(): $ONTOLOGYEX_ENGINE_DIR, skill bin/, then the checkout's release and debug builds - tests/rust_discover_parity.py: 49 edge-case repositories plus seeded manifest mutations; 0 mismatches over 24,000 mutated manifests - Cargo.lock is now committed for reproducible release builds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SoxWvtYbajXo6hFeADTXYF
…oofs A Rust drop-in for feeds.py: the same ONTOLOGYEX_FEEDS config, the same observations and status files. HTTP probes and Prometheus targets are polled in parallel; the OTLP/HTTP receiver (protobuf and JSON, gzip, bearer token) runs on a small worker pool. No proxy, no redirects, system trust store. On a 4-core container: ~1.74M spans/s vs ~98k for feeds.py (17.8x), 8.3 MiB vs 41.5 MiB resident. feeds.py is tightened where Rust could not match its quirks, refusing input that was malformed anyway: URLs must be printable RFC 3986 with a plain host and port; OTLP/JSON and Prometheus bodies are strict UTF-8 JSON with typed fields; truncated gzip is refused; the bearer token is compared as bytes (a non-ASCII header no longer raises); a non-object Prometheus response no longer crashes the runner; the status file's folder is created when no rows were written. Verification: - tests/rust_feeds_parity.py: config validation, OTLP decoding (seeded byte mutations), Prometheus parsing, span-window replays, store merges byte for byte, `once` end to end, and the live receiver - tests/feeds_conformance.py: classification, retention, and p95 rank tables compared across Python, Rust, and Lean - Lean (OntologyEX.Feeds): down_is_error, threshold_inclusive, classify_monotone, keep_at_most, keep_from_input, dropped_are_older, p95_index_in_range - CI runs both parity suites, the feeds conformance table for Rust and Lean, and cargo with --locked Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SoxWvtYbajXo6hFeADTXYF
- release-engine.yml: build the four binaries for Linux (static musl, x86_64 and arm64) and macOS (arm64, and x86_64 cross-built); run the discovery and feeds parity suites on each native build; on an engine-v* tag, publish the archives, SHA256SUMS, and a GitHub build provenance attestation. Pull requests build without publishing. - fetch_engine.py: download a release over HTTPS from github.com only, check the archive against SHA256SUMS, and install only the expected binaries into the skill's bin/ (no traversal, symlinks, or extra files; no silent overwrite). Prints the gh attestation verify command. Shipped with the installed skill. - docs/rust-engine.md: install, run, measured speedups, how parity is checked, what is proven, known differences, and how to release. - README, live feeds, operating-picture reference: point to the engine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SoxWvtYbajXo6hFeADTXYF
Python 3.11.9's urlsplit accepts http://x[::1]/ and http://[::1]x/, newer versions refuse them; check the shape explicitly so feeds.py and ontologyex-feeds agree everywhere. The parity harness now prints only the rows that differ in the end-to-end case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SoxWvtYbajXo6hFeADTXYF
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.
What this adds
Two new Rust binaries that do the same jobs as the Python tools, faster and with the same answers, plus a way to install them without a Rust toolchain.
ontologyex-feedsfeeds.pyontologyex-discoverdiscover_repo.pyPython stays the default and the reference.
control_room.py --view-engine rustnow also uses Rust discovery. Benchmark:tests/bench_rust_engines.py.How we know they give the same answers
tests/rust_discover_parity.py): 49 edge-case repos plus seeded mutations of compose files, workflows,package.json,Cargo.tomlandpyproject.toml. Locally, 0 mismatches over 24,000+ mutated manifests. The YAML loader is a port of PyYAML's reader, scanner and parser. A YAML 1.2 crate first disagreed on tabs,U+0085line breaks and indentation, which is why the port exists.tests/rust_feeds_parity.py): config validation (60 URL shapes plus seeded mutations), OTLP protobuf/JSON/gzip decoding with byte-flipped bodies, Prometheus responses, span-window replays, byte-for-byte store merges,onceend to end, and the live receiver's status codes and rows. 2,223 cases, 0 mismatches. A planted bug is caught.tests/feeds_conformance.py): classification (31,250 cases), retention (4,095) and the p95 rank for every count up to 100,000. Compared across Python, Rust and Lean.OntologyEX.Feeds):down_is_error,threshold_inclusive,classify_monotone,keep_at_most,keep_from_input,dropped_are_older,p95_index_in_range.CI runs all of this in
rust-proof-foundation.yml, withcargo --locked.Cargo.lockis now committed.Python changes (needed for exact parity)
Each change refuses input that was malformed anyway, rather than copying a quirk into Rust:
error_typeis now a stable parse category.Releases
release-engine.ymlbuilds Linux (static musl, x86_64 and arm64) and macOS (arm64, plus x86_64 cross-built), and runs the parity suites on each native build. On anengine-v*tag it publishes the archives,SHA256SUMS, and a build provenance attestation. This PR only builds.fetch_engine.pydownloads from github.com only, verifies the checksum, and installs just the four binaries into the skill'sbin/. It never runs them and prints thegh attestation verifycommand.Docs:
docs/rust-engine.md, which includes the known differences (IPv6 bind, timestamp forms, Windows via WSL).Verification run locally
cargo test --all-targetswith-D warnings: 39 tests.Generated by Claude Code