Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0a25fb6
feat(search): add experimental Rust lexical analyzer pilot
AlexStocks Nov 20, 2026
b20f578
fix(ci): bound end-to-end pytest worker fan-out
AlexStocks Nov 20, 2026
51116a2
fix(ci): bound unit workers and document pilot review limits
AlexStocks Nov 20, 2026
51db1fa
fix(rust): align lexical pilot with gateway toolchain
AlexStocks Nov 20, 2026
9b2b190
refactor(evaluation): group lexical pilot by responsibility
AlexStocks Nov 21, 2026
e5f7c86
feat(search): replace default lexical projection with Rust
AlexStocks Nov 21, 2026
e6fa8a2
fix(build): refresh dependent project lock metadata
AlexStocks Nov 21, 2026
3d815d6
fix(lexical): preserve accepted release artifacts and offline builds
AlexStocks Nov 21, 2026
b1bb10e
merge: sync master CI shards and preserve native lexical gates
AlexStocks Nov 21, 2026
111209d
fix(docs): link the Deep Agents adapter to the LangChain scope anchor
AlexStocks Nov 22, 2026
641ca65
fix(ci): resolve the native wheel in gates that still assume a pure w…
AlexStocks Nov 22, 2026
b612553
fix(tests): isolate blocked recheck probe deadline
AlexStocks Nov 22, 2026
a774fd0
fix(harness): install native SDK wheels in Bub task containers
AlexStocks Nov 22, 2026
24378a7
Merge upstream master into codex/rust-lexical-pilot
AlexStocks Nov 22, 2026
3cc8d7d
fix(ci): reuse pinned Rust and prepare isolated acceptance dependencies
AlexStocks Nov 23, 2026
2e4f2d9
Merge upstream master into codex/rust-lexical-pilot
AlexStocks Nov 23, 2026
8de7262
fix(ci): align Codex caches and stabilize acceptance setup
AlexStocks Nov 23, 2026
90e60b5
Merge remote-tracking branch 'origin/master' into codex/rust-lexical-…
AlexStocks Nov 23, 2026
ffd86a5
fix(ci): merge upstream release pipelines
AlexStocks Nov 24, 2026
1e12be1
fix(build): keep harness wheels and release steps portable
AlexStocks Nov 25, 2026
b1b77d6
fix(lexical): harden native package installation and delivery
AlexStocks Nov 25, 2026
b0a7643
fix(lexical): make dependency notice checks platform independent
AlexStocks Nov 25, 2026
b02bd47
chore(rust): align project toolchains on 1.97.1
AlexStocks Nov 25, 2026
cda923b
Merge remote-tracking branch 'origin/master' into codex/rust-lexical-…
AlexStocks Nov 27, 2026
01053c1
fix(lexical): keep candidate notices within Windows path budget
AlexStocks Nov 27, 2026
8bebd57
docs(integrations): note native toolchain for source installs
AlexStocks Nov 27, 2026
ccae766
fix(gateway): make process test startup ownership-safe
AlexStocks Nov 27, 2026
fc2aadb
Merge remote-tracking branch 'origin/master' into codex/rust-lexical-…
AlexStocks Nov 28, 2026
13f7f34
fix(release): refresh persistence review after master merge
AlexStocks Nov 28, 2026
1c86b18
Merge origin/master into codex/rust-lexical-pilot
AlexStocks Dec 1, 2026
adda69b
fix(lexical): adopt Unicode library analyzer contract
AlexStocks Dec 1, 2026
e6deff6
Merge remote-tracking branch 'origin/master' into codex/pr2735-confli…
AlexStocks Dec 1, 2026
1490d09
Merge remote-tracking branch 'origin/master' into codex/pr2735-confli…
AlexStocks Dec 2, 2026
a0a3573
ci(native-wheels): route Linux jobs through the internal runner policy
AlexStocks Dec 2, 2026
bdad24f
fix(migrations): reproject search projections for the native analyzer
AlexStocks Dec 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ jobs:
if: matrix.suite == 'unit'
env:
PYTEST_ADDOPTS: --require-dsh-config-runtime --require-claude-code-python-floor
# Unit tests also spawn processes and exercise short scheduling deadlines.
PYTEST_WORKERS: "2"
run: make unit-test

- name: Check Source serialization with minimum Pydantic
Expand All @@ -326,6 +328,8 @@ jobs:
if: matrix.suite == 'e2e'
env:
PYTEST_ADDOPTS: --ignore=tests/e2e/test_zcode_service_chain.py
# Each test can spawn Servers and workers; host CPU count overcommits the runner.
PYTEST_WORKERS: "2"
run: make e2e-test

isolated-installations:
Expand Down
8 changes: 8 additions & 0 deletions rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
evidence/
.venv/
.wheel-venv/
**/target/
**/*.pyd
**/*.dll
**/dist/
**/__pycache__/
11 changes: 11 additions & 0 deletions rust/DECISIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Lexical pilot decisions

## 2026-11-20: Independent native extension trial

Keep the root Python application and default behavior unchanged. A separate experimental PyO3 wheel tests the narrow analyze_text boundary before selecting production packaging. Gateway has a different owner and is not used as an extension workspace.

Unicode and Jieba dictionary behavior are compatibility inputs. Use explicit source assets and versions; a Rust dependency with a similar name is not evidence of equivalence. Runtime input conversion must handle Python surrogate strings or report a verified incompatibility.

## Fixed dictionary and scalar-only adaptation

The effective Jieba dictionaries match; their raw bytes differ because Python repeats B超. Rust adds frequency 3 to NUL, which cannot match a Han-only run, preserving the reference total 60101967. Unicode16 casefold and word classification are exported as data, not Python runtime callbacks. The adapted PyString entry replaces surrogate codepoints with nonword separators and detaches Rust computation from the GIL; this is limited to analyze_text without spans.
36 changes: 36 additions & 0 deletions rust/PORT-PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Lexical analyzer Rust pilot

## Contract

Reference: `5b557788c33b57b8ef55a3f3446ee72d693270a4` (same tracked tree as upstream `6763b07661846c19934044184995adf9183c28cc`). Unit: `powercontext.builtin.artifacts.search.analyze_text(str) -> str` and its normalization, segmentation and term encoding. Scope: an experimental extension submitted for review, with no default-backend switch or deployment.

The pilot lives in `rust/lexical-rs`, outside gateway and desktop. The existing Python runtime and root packaging remain the reference. This trial must determine whether a native implementation can preserve output and provide useful speed after crossing Python's extension boundary. It does not claim a production-ready optional dependency or universal Python support.

Preserve NFC-before-casefold, Han ranges, Jieba 0.42.1 dictionary and HMM=False behavior, Python word boundaries, apostrophe normalization, token frequency and order, pcu/pch escaping, UTF-8 length thresholds and SHA-256. Do not change admission, stopword policy, schemas, analyzer version, persistent projections, gateway or HTTP contracts.

## Design and dependencies

Use rust-anything's generated PyO3 scaffold for the real source file, keeping every other export in Python. `src/port.rs` owns the scalar Rust algorithm. Evaluate jieba-rs 0.11.0 (MIT), unicode-normalization 0.1.24 (MIT/Apache-2.0, Unicode 16), and sha2 0.10 (MIT/Apache-2.0); pin resolved dependencies in the crate lock file. Verify the bundled Rust dictionary against the reference by its complete effective word/frequency/tag map. The duplicate B超 row contributes +3 only to Python total weight; restore that mass on a NUL entry outside the Han-only input domain.

For this bounded trial, generate casefold and word classification data from CPython 3.14's Unicode 16 data as versioned compatibility data, with explicit source metadata. Older/newer Unicode versions require separate verification; do not claim the root project's Python 3.11–3.14 support from this trial alone. A small compatibility adapter may convert Python surrogate-containing strings into the equivalent nonword boundaries before native extraction. It must not invoke the original analyzer or catch-and-retry failures.

Build and package a separate experimental wheel; leave Hatchling and the root wheel unchanged. Validate the installed extension in a fresh environment. Actual native activation for existing tests occurs only in a test process, with explicit extension identity and no fallback. Final independent review remains pending; executor checks are not independent acceptance.

## Execution and acceptance

- [x] Read current rules and compare candidate code with the previous analysis. Core behavior unchanged; nearby admission helper changed and stays out of scope.
- [x] Run the related Python baseline: 13 passed (query admission and Topic chunking).
- [x] Run rust-anything analyze on the new Head and bridge only analyze_text.
- [x] Record deterministic boundary cases plus tracked English/Chinese docs using the unchanged Python reference; retain source and dictionary hashes.
- [x] Prove the comparison and forced-native tests fail on incorrect output/unavailable native code before implementing the Rust algorithm.
- [x] Implement the Rust algorithm and meaningful algorithm unit tests; iterate on actual mismatches, preserving the recording.
- [x] Run locked Cargo tests, fmt and clippy, rust-anything build/diff/bench/gate, targeted Python behavior tests with native analyze_text and native identity evidence.
- [x] Build a wheel and install/call it in a fresh environment; record supported platform and Python version precisely.
- [x] Compare warmed release throughput on recorded inputs and larger public docs, including bridge and conversion costs. Report thread count and cold initialization separately.
- [ ] Independent verification of final code, outcomes, limitations and actual snapshot; save decision and status.

The output comparison is exact, with no wildcards, tolerance or ignored order. Expected business errors and unsupported inputs are reported separately. A compatibility mismatch or material regression prevents default integration; a demonstrated blocker is a valid trial conclusion, not a passed migration. Root production files are not changed merely to make a trial pass.

## Evidence

Task-local logs and reports belong in `output/lexical-pilot/`; generated build outputs and environments are ignored; the Unicode compatibility data is reviewed source. Keep reference and candidate hashes with the final report. Baseline environment currently reuses the existing project Python dependencies while explicitly placing this worktree's `src` first on PYTHONPATH. Installed-wheel validation must use a fresh environment without the source package on its import path.
11 changes: 11 additions & 0 deletions rust/PORT-STATUS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Migration status

| Unit | Technical evidence | Independent final verification | Reference | Default integration |
| --- | --- | --- | --- | --- |
| analyze_text | PASS for bounded Windows CPython3.14/Unicode16 pilot | Pending; final independent review has not completed | 5b557788c33b57b8ef55a3f3446ee72d693270a4 | Not enabled |

Tool diff: 2033/2033. Strict unique inputs: N=2645, R=2645, F=0, E=0; 2648 executions include three repeated independent expectations. Existing tests in native process: 13 passed, 20 native calls. Tool gate passed; independent wheel installed and strictly verified in a clean environment.

Warm offline single-thread medians including bridge: Chinese documents 8.85x, English documents 3.88x (final rerun; raw initial and final samples retained); no full request-chain speedup claim. Other Python/Unicode versions, platforms and production packaging are unverified.

Published measurement samples, source identities, limits and reproduction instructions: [results](lexical-rs/results/README.md). Additional task-local logs are generated in `output/lexical-pilot/` and are not required to read the published report. This is a technically validated local trial; independent acceptance, default integration, CI, merge and release approval remain separate.
7 changes: 7 additions & 0 deletions rust/lexical-rs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
target/
*.node
pkg/
.rust-anything/
*.so
*.pyd
__pycache__/
Loading
Loading