Repository navigation
feat(search): replace default lexical analyzer with Rust - #2735
AlexStocks wants to merge 35 commits into
Conversation
Add an isolated PyO3 implementation of analyze_text with Unicode16 and fixed Jieba dictionary compatibility, strict replay checks and native test activation. Include reproducible warm benchmark samples and installed-wheel validation identities. Constraint: Production defaults, persistence and root Python packaging are unchanged. Scope-risk: Windows CPython 3.14 pilot; final independent review and wider platform validation remain pending. Tested: rust-anything diff (2033/2033) and gate (12 checks); locked Cargo tests and clippy; strict direct/wheel replay (2637 strings plus type/boundary checks); native pytest (13 passed, 20 calls); Ruff and scoped ty passed. Prek whole-repository ty reports 93 existing Windows diagnostics, also present with rust excluded.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
PowerContext 文本分析 Rust 试点:实现、测试、性能和复现报告 测试日期:2026-11-20。对应 PR 提交: Python 参考提交: 1. 结论与验收状态 这个独立 Rust 实现已经通过本轮 rust-anything 门禁、严格行为比较、既有测试的原生装配,以及干净环境中的 wheel 安装验证。在相同离线语料上,计入 Python↔Rust 调用和数据转换成本后,三组负载均测得性能改善。 技术结果支持继续评估产品接入,但当前交付仍是一个有明确版本和平台边界的试点。默认 PowerContext 运行路径仍使用 Python;正常安装主项目 wheel 不会自动使用此扩展,也不会直接获得表中的提速。
2. 实现范围和保持的契约 实现位于独立的 迁移需要保留以下现有语义,不能仅以“分词结果看起来差不多”作为正确依据:
本 PR 没有修改 query/spans/admission、分析器版本、数据库 schema 或投影、gateway、desktop、HTTP 契约和根 SDK 的 Hatchling 打包。原生装配只发生在显式探针或测试进程中。 依赖使用 3. 两处需要额外处理的兼容问题 词典内容相同,不代表分词概率权重自动相同。 准备脚本比较了 Python 和 Rust 默认词典的完整有效 Rust 实现在 NUL 词上补入频次 3。NUL 不可能出现在送给 Jieba 的 Han-only 片段中,因此该处理用于对齐总权重,同时不增加这个单元可以命中的词。它只针对本次已核对的固定默认词典;不据此承诺自定义词典和运行时词典修改的兼容性。
Python 字符串中的代理项需要单独验证。 Python 固定预期中包含: analyze_text("ABC ab ABC") == "abc pcu6162 abc"
analyze_text("a\ud800b") == "pcu61 pcu62"
analyze_text("\ud800\udc00") == ""
analyze_text("ǰ") == "pcu6a"最后一项用于守住 NFC-before-casefold 和后续单词提取行为。casefold 和 word 分类通过固定数据导出,不在运行时回调 Python,也没有直接拿 Rust 默认 Unicode 单词分类替代 Python 注意:rust-anything 4. 行为语料如何生成,分母如何计算 参考结果由未修改的 Python 函数生成,准备脚本固定校验 Unicode 版本、Jieba 版本和默认词典 SHA-256,然后生成严格语料。输入包括:
两种录制用途不同:工具
验证脚本报告 5. 测试、负控和门禁的具体结果
rust-anything gate 的 12 项为: 工具对异常比较较宽松,所以没有把工具 diff 作为唯一错误 oracle。严格比较器、固定输出和错误类型检查用于补充这一边界;没有为了迁移通过而放宽字符串相等、忽略顺序或给 mismatch 加容差。 6. 独立打包与安装验证 根 Python 应用继续使用 Hatchling,本试点使用自己的 maturin wheel,不改变主项目的安装方式,也没有为普通用户增加 Rust 编译要求。 wheel 的验证过程为:单独构建 release wheel → 在干净环境安装该 wheel → 使用该环境的 Python,以 直接扩展与 wheel 内扩展由不同构建选项产生,SHA 不同。两份二进制分别通过严格检查,不能把其中一份的哈希用作另一份的身份,也不能把直接扩展的性能数据说成最终 wheel 的性能数据。 最终 wheel 文件为 7. 性能测量方法和结果 硬件:Intel Core Ultra 5 225H。系统:Windows x64。Python:CPython 3.14.3,Unicode 16.0.0。Rust:1.97.1 MSVC,release 构建。单线程,不使用 batch 并行。 测量步骤:先比较两端输出完全一致并预热 → 预先读入相同文本 → 每轮交替两端先后顺序 → 共 9 轮 → 对每端分别取中位数。计时包括 Python 调用、跨原生边界、输入转换和输出分配,不包括读盘、HTTP 或服务请求。
短查询内容为 最终复测的全部 9 轮样本,单位 ms:
初测的数据也完整保留,便于判断波动:
初测使用直接扩展 另外,初测 rust-anything 基于 2,033 条录制用例执行的工具 bench 为 Python 约 41,077.816 ns、Rust 约 7,050.357 ns,工具报告约 5.83×。该口径不同于文档分组及重复短查询,不与表中倍数混合;它也没有作为最终构建的重新测量结果。 8. 冷启动观察单独记录 初测中,每种实现各启动 3 个新进程,分别计时模块导入和第一次中文分析。输入为
这些是初测构建上的小样本观察,没有对最终 wheel 重做。导入时间还包含两种模块各自不同的依赖导入成本,不能解释为纯分词算法耗时,也不作为服务启动 SLA。 以上性能结果没有测量 HTTP、数据库、推理、完整召回和真实宿主调用延迟。特别是,默认应用路径未接入原生扩展,不能据此声称整个 PowerContext 请求快 8.85 倍。 9. 构建身份与语料清单
初测试点报告中的 wheel 内扩展为 中文语料与英文语料采用对应的 12 个相对路径:
完整路径的前缀分别是 10. 可复现命令 准备 CPython 3.14 / Unicode16 环境,安装根项目锁定依赖、Jieba 0.42.1、pytest,以及单独的 maturin、rust-anything。Windows 上需要明确选择 MSVC 工具链;仓库或系统默认 Rust 版本可能低于本试点要求。rust-anything 的 Python 驱动优先选择 以下命令从仓库根目录执行, $env:RUSTUP_TOOLCHAIN = '1.97.1-x86_64-pc-windows-msvc'
$env:PYO3_PYTHON = (Get-Command python).Source
cargo fetch --locked --manifest-path rust/lexical-rs/Cargo.toml
python rust/lexical-rs/scripts/prepare.py
cargo fmt --manifest-path rust/lexical-rs/Cargo.toml --check
cargo test --locked --manifest-path rust/lexical-rs/Cargo.toml
cargo clippy --locked --manifest-path rust/lexical-rs/Cargo.toml --all-targets -- -D warnings
rust-anything build rust/lexical-rs
python rust/lexical-rs/scripts/verify.py
rust-anything diff rust/lexical-rs
rust-anything gate rust/lexical-rs
rust-anything bench rust/lexical-rs
python rust/lexical-rs/scripts/benchmark.py如需重新录制工具用例,准备脚本生成的输入文件可用于: rust-anything record rust/lexical-rs --count 200 --inputs output/lexical-pilot/inputs.jsonl强制装配原生函数运行既有测试: $env:PYTHONPATH = "$PWD\src;$PWD\rust\lexical-rs\scripts"
python -m pytest -p native_pytest tests/builtin/artifacts/test_text_search_admission.py tests/builtin/artifacts/topic_memory/test_chunking.py -q独立 wheel 验证: python -m maturin build --locked --release --manifest-path rust/lexical-rs/Cargo.toml --out output/lexical-pilot/wheels
python -m venv output/lexical-pilot/clean-runtime
uv pip install --python output/lexical-pilot/clean-runtime/Scripts/python.exe output/lexical-pilot/wheels/pc_lexical_pilot-0.1.0-cp39-abi3-win_amd64.whl
& output/lexical-pilot/clean-runtime/Scripts/python.exe -I rust/lexical-rs/scripts/verify.py --installed准备脚本在源码树生成严格语料;隔离环境中的验证脚本读取这些数据,但不通过源码路径导入扩展。生成数据和日志位于被忽略的 11. 未通过、未验证和下一步边界 本机最终执行了 changed-file prek。文件冲突、TOML/JSON、JSON 格式、文件结尾、尾空白、Ruff check 和 format 等内容检查通过;完整 prek 中的全仓 本地验证中的非致命输出还包括 release 链接器创建 import library 的 warning,以及一次新环境加载 Jieba 时出现的上游 Python SyntaxWarning;它们未导致上述测试失败。不据此把“构建完成”扩展成“全仓所有质量门禁通过”。 没有运行完整仓库全部 已验证范围为 固定默认词典 + Windows x64 + CPython 3.14 / Unicode16 + 窄 继续评估默认接入时,需要明确主项目 wheel 的发布矩阵、旧 Python/Unicode 的语义、后端选择与回滚契约,并完成最终独立审查。本 PR 提交的试点证据不代表这些后续工作已经完成。 公开证据索引
本评论直接展开了实现、测试、性能和复现材料;链接用于核查具体源码、逐轮样本和构建身份。仓库中的结果 JSON 与这里的计时、分母和哈希对应。 |
The failed Python 3.11 job started 32 xdist workers with -n auto and hit Server startup and spawned-worker deadlines. The same base tree passed its end-to-end matrix with two workers. Pin only the remaining E2E step to two workers so visible host CPUs do not multiply subprocess pressure. Constraint: Keep test selection, assertions, deadlines and serial Hook checks unchanged. Scope-risk: CI scheduling only; Linux rerun must establish the outcome. Tested: CI pipeline tests (50 passed, 7 platform skips); Make dry-run using the actual workflow environment emits -n 2 and keeps -n 0 for serial Hook tests; 307 action pins verified; YAML/content hooks passed. Whole-repository ty still reports 93 existing Windows diagnostics.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
CI 排查与更新,对应提交 失败日志中的事实 首次运行 44730982822 / Python 3.11 e2e 的结果为 15 failed、1571 passed、654 skipped。日志显示 作为对照,同一基线 本次调整 原命令通过 Make 使用 新提交只在 实际验证
新运行:44736400188。提交后核查时 preflight 尚在排队,不能把本地通过写成远端 CI 已恢复。 Review 状态 本次读取到的 review 是 Copilot 的额度不足提示,它未执行代码审查。REST 行内评论列表和 GraphQL review threads 均为空,目前没有代码评审意见可以逐项修改或回复。没有调整 Copilot 的账户、计费或组织配置。 此前完整性能报告仍对应 |
happy-v587
left a comment
There was a problem hiding this comment.
Independently verified locally (macOS ARM, CPython 3.14.7 / Unicode 16), using my own maturin build of this crate at b20f578 rather than the author's Windows artifacts:
- Recorded oracle: 2,033/2,033 recorded cases match on both the Python 3.14 reference and my locally built native extension.
- Beyond the recorded corpus: exhaustive per-codepoint comparison (all 1,114,112 scalar values as
X'xyz Xinputs), ~6,000 adversarial fuzz cases (Han/Latin interleaving, pcu/pch 40/41/80/81 byte thresholds, NFC recomposition, 100k-char inputs), 16-thread concurrent calls against the GIL-detached entry, and a full 375-file / 6.47M-char repository docs diff — zero mismatches in all of them. - Effective jieba dictionaries compared independently: 349,045 entries identical, total-weight delta exactly the recorded
frequency_correction=3. - Focused admission/chunking tests re-run with
native_pytest.pyagainst my locally built.so: 13 passed, 20 native calls. cargo test,cargo fmt --checkand locked clippy-D warningspass with Rust 1.97.1.
No correctness findings. Two non-blocking design notes below. The pending CI matrix should still be green before merge.
The unit job still auto-detected 32 workers and missed short runtime and subprocess deadlines. Bound it to two workers, matching the successful base run and the existing E2E bound, without changing test assertions. Document the pilot-specific Rust toolchain and LF-only JSONL parsing. Constraint: No runtime, corpus, benchmark or timeout changes. Scope-risk: Full Linux matrix remains to be verified by the new run. Tested: Four formerly failing tests passed locally with two workers; one POSIX-only test skipped on Windows. CI pipeline tests: 50 passed, 7 platform skips. Actual workflow environments produce -n 2 for unit and E2E commands; README reader parses 2033 records. 307 action pins and YAML/content hooks passed. Whole-repository ty still reports 93 existing Windows diagnostics.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
针对第二轮 CI 和两条新 review 的更新,提交为 第二轮失败发生在 unit,不能把 e2e 的取消记作验证通过。 44736400188 / Python 3.11 unit 启动了 32 个 worker,结果 5 failed、9342 passed、327 skipped。失败项为:
同一基线的 Python 3.11 unit 使用 2 个 worker,结果 9347 passed、327 skipped。本轮 e2e 已采用上一提交固定的并行度,但在 unit 失败后被矩阵 fail-fast 取消,因此其完整远端结果仍未验证。升级门禁和最终 CI 汇总随后失败,不能当作额外独立的业务缺陷。 新提交给 unit 步骤也设置 本地检查
Review 逐条处理
两个线程保留 reviewer 自行确认;没有将作者回复等同于 reviewer 接受。 新运行为 44759823908,发布时 preflight 正在执行。当前是修复已推送、相关本地检查通过,完整远端 CI 仍待结果。 |
The generated manifest inherited rust-anything's own Rust 1.97 minimum. The pilot itself builds and passes strict validation with Rust 1.95.0. Declare Rust 1.95 and use the gateway's 1.95.0 toolchain in instructions. Keep published 1.97.1 benchmark identities and measurements explicit. Constraint: No dependency, algorithm, recorded behavior or performance data changes. Scope-risk: Validation is Windows MSVC with CPython 3.14.3; pilot Linux compilation remains outside current CI. Tested: Rust 1.95.0 fmt, locked cargo test (2 passed), locked clippy --all-targets -- -D warnings, release maturin wheel, clean environment isolated strict replay (2637 strings; type and negative controls passed). TOML/content hooks passed; full ty retains 93 existing Windows diagnostics.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Master commit 3441a37 changed managed startup admission diagnostics without refreshing the persistence review digest. Record the resulting digest and document that the change is guidance-only with no schema or persisted-encoding impact. Constraint: Compatibility-review metadata only; no persistence behavior changes. Scope-risk: Upgrade release gate digest and rationale. Tested: make upgrade-policy-check.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
复检结论(head
|
hidb4ai
left a comment
There was a problem hiding this comment.
Re-reviewed 13f7f34. CI is green and the previous Windows packaging finding remains fixed. The pre-merge Unicode-library requirement in #2735 (comment) is still open; the analyzer implementation and compatibility tables are unchanged. Please implement that requirement or obtain explicit resolution from the requesting maintainer. I found no new analyzer-output defect.
I also independently reproduced the source-artifact limitation discussed in #2735 (comment): source_artifact accepts a universal wheel but rejects an otherwise valid cp311-abi3-manylinux_2_28_x86_64 wheel for the same version. This becomes a release-gate failure when a native-only release is selected as an upgrade source. The current policy still selects 1.3.0, so this is a concrete follow-up before adopting a native source, not a failure of the current matrix. Artifact resolution and its platform/backend consumers need compatible handling together.
The current source passed a real SQLite + configured embedding/LLM flow: persistent write, native FTS recall, Server lifespan restart, context preparation, and the model recovering a random stored fact. HTTP routing was in-process. OceanBase was exercised in the previous review, not rerun on this head. Approval remains withheld while the explicit pre-merge requirement is unresolved.
Fengzdadi
left a comment
There was a problem hiding this comment.
Re-reviewed 13f7f34dd. My earlier points are resolved, so this approval replaces my change request.
- Windows candidate. 01053c1 moves the lexical notices to
LICENSES/lex/under shorter names and keeps every file. With the CI staging root (114 characters) and a0.0.0+candidate.<40 hex>version, the longest notice path is now 251 UTF-16 units (py-jieba.LICENSEandrs-jieba.LICENSE), under the 259 limit.test_native_license_payload_fits_candidate_staging_budgetpins this, andmanaged-resource-candidates / Candidate windows-x86_64passes at this head. - Analyzer. Nothing under
src/powercontext/builtin/artifacts/lexical/or insearch.pyhas changed sinceb02bd477c, so my earlier reading of the port still holds.
The branch now conflicts with master in four files: three from #2909 (the candidate workflow, prepare_managed_resources.py and test_managed_resource_producer.py) and #2630's digest change in release/upgrade-support.json. None of them changes the Windows staging root or the candidate version, so the budget still holds; please keep the new test when resolving.
This approval is for this head. It doesn't settle frf12's pre-merge Unicode-library requirement (#2735 (comment)). If the analyzer changes for it, I'll review that change.
Non-blocking:
source_artifactinscripts/upgrade_release_matrix.pystill accepts only apy3-none-anywheel, as NeverENG and hidb4ai reproduced. Nothing fails today because the policy's source is 1.3.0, but this needs fixing before a native-only release becomes an upgrade source.- Five integration READMEs (OpenClaw, LangChain, DSH and its plugin, OpenCode) still install from
masteror a local checkout without--python ">=3.11,<3.15"and without the Rust 1.97.1 and C toolchain note that the integration guides now have. - The arm64 image was built at
b1b77d62, before the 1.97.1 base image. As NeverENG suggested, a run on the final head would close that gap.
|
Status refresh for unchanged head 13f7f34: GitHub now reports CONFLICTING / DIRTY against current master. Please reconcile the conflicts, preserve the native notice path regression and complete license payload, refresh the persistence review digest against the merged tree, and validate that result. The existing green checks do not validate a future conflict resolution. The Unicode-library/analyzer-contract requirement in #2735 (comment) remains open. The native-only upgrade-source resolver limitation remains a follow-up before selecting such a release as a source; it is not a failure of today's 1.3.0 matrix. No new code was pushed, so I did not rerun the previously passing real SQLite/embedding/LLM flow on the same head. Approval remains withheld pending resolution of the pre-merge requirement and validation of the reconciled branch. |
# Conflicts: # .github/workflows/managed-resource-candidates.yml # README.md # README_CN.md # README_JP.md # docs/en/docs/get-started/install-and-run.md # docs/en/docs/get-started/manual-start.md # docs/zh/docs/get-started/install-and-run.md # docs/zh/docs/get-started/manual-start.md # release/upgrade-support.json # scripts/prepare_managed_resources.py # tests/test_managed_resource_producer.py
Replace per-version Unicode snapshots with unicode-normalization, caseless and unicode-properties; serve text, terms, normalization and spans from one native analyzer, and bump the analyzer version so projections rebuild. Correct Rust/Python version documentation and stale evaluation claims.
…ct-merge-20261201 # Conflicts: # .github/workflows/desktop.yml # tests/test_ci_pipeline.py
frf12
left a comment
There was a problem hiding this comment.
Re-reviewed e6deff67b63b3751bce0261270f07d0d599f616a. The Unicode-library adoption requirement is addressed: the custom tables are removed, and indexing, queries and spans use the shared Unicode 16 implementation. I am not requesting a different library or per-CPython compatibility scheme.
Requesting changes for the existing-database upgrade blocker below: the analyzer version changes, but an already-current managed database has no executable transition to the new projection version. Please verify the supported upgrade, restart and retrieval path before merge.
Separately, Main CI exceeded its 45-minute preflight limit after checkout alone took 37m23s; environment setup did not finish and the downstream tests did not run. This is not evidence of an analyzer-output failure and can be handled separately from the migration defect.
|
|
||
| # Bump when document segmentation or token encoding changes; query stopwords do not affect projections. | ||
| TEXT_ANALYZER_VERSION = "jieba-0.42.1-words-v1" | ||
| TEXT_ANALYZER_VERSION = "unicode16-caseless0.2.2-jieba0.42.1-words-v2" |
There was a problem hiding this comment.
[P1] Provide an executable migration path for existing managed databases
A managed database already at schema revision v1_6_0 retains the jieba-0.42.1-words-v1 projection markers. This version bump makes the readiness check raise projection_migration_required. Managed startup only validates these projections, while db-migrate apply encounters the same check during planning, before it can perform maintenance. At the unchanged schema revision, the domain registry also selects no pending steps.
Consequently, an existing installation cannot start or complete the supported migration command, even with empty user tables if the previous markers are present. Please provide a supported transition that rebuilds the affected projections/search indexes and records the new analyzer version, then verify upgrade, restart and retrieval against existing data.
Validation: I executed the exact Python marker check against a SQLite table populated with the previous analyzer markers: the base check passes, the new check raises projection_migration_required, and the current domain registry selects no pending steps at v1_6_0. The startup and db-migrate apply failure paths were traced in source; I did not execute a full Server/native or real seekDB/OceanBase upgrade.
There was a problem hiding this comment.
Independently reproduced the complete managed-database transition at e6deff6. Using the base c54a50a, I initialized a real SQLite Server database through the supported migration runner, created a Scope and remembered a fact through HTTP, verified FTS recall, then closed/reopened the Server and verified recall again. No projection markers were edited. Running the PR head against that same database fails during Server lifespan startup with MigrationError: projection_migration_required; invoking the supported deployment runner plan also raises the same error, so it cannot produce a plan for apply. The old v1 markers remain intact.
The PR changes TEXT_ANALYZER_VERSION to the v2 Unicode-library contract but adds no registered persistence transition. Please add the required reprojection/data-migration step through the shared unpublished 000 workflow (without changing frozen revisions), preserve authoritative records, and verify existing-data upgrade, restart and retrieval. This is real SQLite/source-code and in-process HTTP validation; it is not an installed-release wheel or OceanBase/LLM acceptance result.
There was a problem hiding this comment.
Confirmed on e6deff6 with the actual Server and migration runner, extending the evidence above:
- Created a managed SQLite database at v1_6_0 using the previous analyzer (b02bd47), wrote two memories through the HTTP app with a real configured embedding provider, then verified FTS recall, lifecycle restart, context preparation and a real LLM answer.
- Opened a copy of that database with the newly built native extension at this head. Server lifespan startup, deployment_runner.plan(), and deployment_runner.apply() all fail with projection_migration_required in plugin_artifact_readiness.py:100. The persisted v1 markers remain unchanged. This was a real database transition, not a mocked marker check; it was not an installed-release-wheel or OceanBase upgrade test.
- A fresh SQLite database at this head completes the same HTTP-app/embedding/FTS/restart/prepare/LLM flow. Thus fresh initialization does not establish upgrade safety.
Please add the executable projection transition under the cumulative unpublished 000 workflow, preserve frozen revisions, and verify that existing records remain retrievable after migration and restart. The library-based analyzer direction addresses the earlier implementation concern, but this upgrade blocker remains.
There was a problem hiding this comment.
Reproduced again at the new head a0a3573 after syncing its locked environment. Opening the same real v1_6_0 SQLite database created and populated through the base Server still fails at Server lifespan startup with projection_migration_required; the supported deployment runner plan fails with the same error. The new commits merge master and adjust native-wheel CI routing, but do not change the analyzer or add a registered projection migration. Please implement the transition through the cumulative unpublished 000 workflow and verify upgrade, restart and recall. The runner-policy checker passes locally; that does not resolve this existing-data upgrade blocker.
There was a problem hiding this comment.
Extended the reproduction to the real configured OceanBase backend at a0a3573:
- Created an isolated OceanBase CE 4.3.5.4 database with base c54a50a using the supported managed initializer. Through a real loopback HTTP listener, wrote two facts with the configured embedding provider and verified both Chinese-query and random-marker FTS recall.
- Stopped/restarted the Server lifespan, prepared context, and called the real generation provider. The answer contained the stored random marker and port; the no-context control did not contain the random marker.
- Opened this unchanged database at the PR head: Server lifespan startup, migration plan, and migration apply each failed with
MigrationError: projection_migration_required. No projection markers were manually altered. - As a separate control, a fresh SQLite database at this head passed the real HTTP/embedding/FTS/restart/prepare/LLM flow, including the no-context control. This does not establish a fresh OceanBase run at the head.
The isolated OceanBase database was removed after testing. These are real-backend/provider source-checkout results, not an installed-release-wheel upgrade claim. The existing-data migration blocker is confirmed on OceanBase as well as SQLite.
There was a problem hiding this comment.
Implemented in bdad24ff3.
Draft 000 carries the transition
migrations/server_resources/lexical_reprojection.pyis aprojectiondomain step that re-derives Atomic Memory, active Topic title/summary/chunk, Experience and Skillsearchable_text, and the SQLite/OceanBase full-text helpers from their authoritative records, then records the analyzer version of the running build. It reuses the registered primitives (refresh_lexical_projections,rebuild_experience_projections/rebuild_skill_projections,SQLiteExperienceFTSIndex.rebuild,SQLiteAtomicMemoryIndex.rebuild_fts,SQLite/OceanBaseTopicMemoryFTSIndex.initialize).- The Topic FTS refresh has to call
SQLiteTopicMemoryFTSIndex.initialize()rather thanTopicMemoryRepository.initialize(): the repository initializer also reconfigures the retrieval shape and raisesembedding_profile_mismatchwhen the historical space differs from the configured profile. Rebuilding projections is not a deployment-profile transition. versions/000.pyplusschemas/{sqlite,mysql}-000.jsonregister no schema object.MySQLSchema._load_state_layoutspreviously rejected an empty statement list, which made a derived-data-only revision impossible to register on the OceanBase/seekDB chain; it now accepts an exact empty pair, and000's resulting layout is identical tov1_6_0's.000also carries the analyzer readiness validator, so a database that reaches the head without the rebuild still fails admission withprojection_migration_requiredinstead of opening stale projections.DomainRegistry.admitdefers exactly that one code, and only while a pendingprojectionstep exists. This is the part that was actually unreachable: both runners validate the source revision before computing pending steps, soplanandapplynever reached the step that repairs. Every other rejection, and every rejection without a pending projection step, still refuses.
Verified (SQLite)
tests/builtin/persistence/test_lexical_reprojection_migration.py builds a managed database through the 1.6.0 bundle, writes v1 analyzer markers with released searchable_text, then asserts plan.target_revision == "000" and plan.domain_steps == ("lexical_reprojection",); apply reprojects the texts to analyze_text(...), records the v2 versions, leaves the authoritative records untouched, verify() is ready and a repeated apply reports no change. A second test drives check_server_schema: the released database is refused until the revision ran and is admitted afterwards, and stale markers after the head keep plan blocked. A third asserts 000 registers with no operation on both backends.
The new head was propagated through the existing suites: tests/builtin/persistence plus the schema and revision-name tests report 1085 passed, 136 skipped, 15 failed. All 15 failures reproduce on a0a357300 in this environment: twelve are the installed pydantic_ai 2.29.0 lacking ModelContextWindowExceededError (they fail at import of builtin/inference/pydantic_ai.py, which this change does not touch), and test_cancelled_sqlite_connection_initialization_does_not_leave_a_worker_running fails identically on the base commit. scripts/schema_release.py check passes and ruff/ty report nothing in the changed files.
Not verified here
OceanBase/seekDB execution of 000. I have no such backend in this environment, and the import failures above block every create_server_app test, so the vector-profile and managed-startup paths on OceanBase are covered only by bundle-level assertions (the registered 000 layout equals v1_6_0, statements("000") == ()). Your OceanBase reproduction is the acceptance I cannot produce.
There was a problem hiding this comment.
Verified the migration fix at bdad24f on real OceanBase 4.3.5.4. Starting from base 0b60e52, I initialized a managed v1_6_0 database, wrote Atomic Memory and Topic Memory through a loopback HTTP Server using the configured embedding provider, then stopped that Server. Preserving its original external migration evidence, the new runner planned v1_6_0 → 000 with lexical_reprojection, applied it and verified ready. The new Server then started successfully; Chinese/random-marker FTS, prepared-context recall and a real generation-provider response passed, while the no-context control lacked the random marker. Authoritative artifact IDs/revisions/content were byte-identical across the transition, and all four projection markers moved to the new analyzer. The isolated database was removed. This addresses the reproduced OceanBase migration blocker; it is source-checkout backend acceptance, not an installed-release upgrade matrix or all-platform release qualification. The separate current CI test failure remains in the new review.
hidb4ai
left a comment
There was a problem hiding this comment.
The Unicode-library implementation addresses the previous design direction, but existing managed databases cannot start or obtain a migration plan after the analyzer-version change. I reproduced this with real SQLite data written and recalled through the base Server, then reopened by this head. Please provide the registered migration/reprojection path; execution details are in #2735 (comment) .
…ct-merge-20261201 # Conflicts: # .github/workflows/desktop.yml # .github/workflows/gateway-distribution.yml # .github/workflows/gateway.yml # .github/workflows/managed-resource-candidates.yml # .github/workflows/release.yml # .github/workflows/upgrade-release.yml # README.md # README_CN.md # README_JP.md # desktop/src-tauri/src/connections/compatibility.json # desktop/src-tauri/src/transport/operations.json # desktop/ui/src/generated/operations.ts # docs/en/docs/get-started/install-and-run.md # docs/en/docs/get-started/manual-start.md # docs/zh/docs/get-started/install-and-run.md # docs/zh/docs/get-started/manual-start.md
Run the production analyzer checks and the x86_64 manylinux wheel build on the internal Linux pools. Keep the native aarch64 wheel on GitHub-hosted ARM64 and record it as a capability exception because the internal pools provide only x86_64 workers; QEMU emulation is not native wheel acceptance. Constraint: PR CI Linux jobs must use the internal pools unless a capability gap is recorded in .github/ci-runners.toml. Scope-risk: Runner routing and the documented exception only; lexical and wheel build behavior are unchanged. Tested: make ci-runners-check; 105 CI-policy tests passed, 11 skipped.
The registered projection identity carries the lexical analyzer version, and frozen readiness validators resolve that constant from the installed build. A database created by 1.6.0 therefore keeps `jieba-0.42.1-words-v1` markers while the new native analyzer reports v2, and managed startup, `plan` and `apply` all refuse it with `projection_migration_required` before any revision can run. Register unreleased draft `000` as the supported transition. It changes no schema object; its `lexical_reprojection` domain step re-derives Atomic Memory, active Topic title/summary/chunk, Experience and Skill searchable text and the SQLite/OceanBase full-text helpers from their authoritative records, then records the analyzer version that produced them before the revision advances. `000` also registers the analyzer readiness validator, so a database that reaches the head without the rebuild keeps failing admission. Admission now defers exactly one rejection: `projection_migration_required` while a pending projection step exists. Without that, a released database could never reach the step that repairs it. Every other readiness rejection and every rejection without a pending projection step still refuses plan and apply. A revision without MySQL schema operations is now representable: the state layout loader required a non-empty statement list, which made a derived-data draft impossible to register on the OceanBase/seekDB chain. Constraint: no frozen revision, resource, checksum, SQLite fingerprint or upgrade-support mapping is edited; `000` is frozen as the next release revision. Scope-risk: migrations framework admission plus draft registration; the analysis, search and retrieval paths are unchanged. Tested: tests/test_schema_draft.py, tests/test_schema_release.py, tests/test_migration_revision_names.py, tests/builtin/persistence (1085 passed, 136 skipped; 15 failures reproduce on a0a3573 for the installed pydantic_ai 2.29.0 and one SQLite cancellation test). scripts/schema_release.py check; ruff check/format; ty check reports nothing in the changed files. Not verified: OceanBase/seekDB execution of `000` (no backend available here).
|
The affected modules are Core, Desktop, Gateway. @hidb4ai, please coordinate follow-up. Core: @hidb4ai @frf12 @Fengzdadi @beatenevo; Desktop: @PsiACE @knqiufan; Gateway: @frf12 @happy-v587 @NeverENG. Please coordinate the review of the affected changes. |
hidb4ai
left a comment
There was a problem hiding this comment.
The added compiler-setup check currently fails against this PR’s Desktop workflow and blocks the Python unit matrix. Please update it to validate the actual source-build jobs and their setup path. The database transition is being checked separately against real OceanBase.
| ("desktop.yml", "windows"), | ||
| ("desktop.yml", "macos"), | ||
| ("desktop.yml", "linux"), | ||
| ("desktop.yml", "installed-package"), |
There was a problem hiding this comment.
[P2] Match the compiler check to the current Desktop workflow
The new parameter list still includes desktop.yml/installed-package, which no longer exists, and assumes desktop.yml/linux contains a directly detectable source-install command. Running this test at bdad24f gives KeyError: installed-package and StopIteration, exactly matching the failures in all four Python unit jobs of run 46844166136. Update the check to cover the current source-build jobs and shared setup path without requiring removed job/step shapes; otherwise the unit matrix remains red and dependent acceptance cannot run.
NeverENG
left a comment
There was a problem hiding this comment.
Reviewed head bdad24ff331d95184b4b058914c9d57ff571176f, reconciling the complete 164-file list and reviewing the native search entry points/Unicode and span contract, derived-projection migration and readiness paths, wheel/sdist build and release selection/staging, affected CI/installer paths, and the Gateway startup/test changes.
One existing P2 remains: the compiler-presence test still targets obsolete Desktop workflow shapes. The current source still enumerates desktop.yml/installed-package and assumes a directly detectable install step in desktop.yml/linux. The current-head Python 3.11 CI log, actually checked out at merge 7b012f4 of this head into 0b60e52a, confirms KeyError: installed-package and StopIteration at lines 501–502. This is the existing root cause, so I have not opened a duplicate inline thread. No additional actionable defect established by this source review.
The earlier P1 managed-database migration finding is addressed in current source: cumulative revision 000 follows v1_6_0, admission permits the registered pending projection repair, and lexical_reprojection rebuilds the derived projections/FTS and verifies the new markers. The thread's unresolved state alone does not make that old finding current. The reported source-checkout OceanBase exercise is useful evidence, but I did not independently repeat it or treat it as the installed-release upgrade matrix.
Please also reconcile the PR description with this head: production now explicitly uses the Unicode 16 analyzer identity and Rust 1.97.1 and includes a projection migration. Statements about preserving the old analyzer identity or per-CPython Unicode behavior do not describe the current source; older performance/equivalence records are not current-head validation.
Validation limits: the unit matrix is red, the upgrade acceptance gate is unsuccessful, Gateway validation is skipped, and GitHub currently reports merge conflicts (DIRTY). I inspected source and associated CI evidence without executing PR code locally. The installed multi-platform native wheels, released-version upgrade matrix, and real host/provider workflows therefore remain unestablished by this review. Reconcile with the current base and validate the resulting head/merge before relying on them. Comment-only review; no merge approval.
Which issue or RFC does this PR close?
No existing public issue is closed. The bounded migration unit and contract are documented in the port plan.
Rationale for this change
Replace the production
analyze_text(str) -> strPython projection with Rust. Normal PowerContext installations now import and execute the native function directly, reducing analyzer time while preserving ordered projection terms, duplicates and backend-safe encoding.What changes are included in this PR?
src/powercontext/builtin/artifacts/lexical/. Remove the Python projection wrapper and experimental activation plugin. Retain Python span/query helpers for their existing offset and admission responsibilities.powercontext._lexicalinto the root Hatchling wheel using maturin andcp311-abi3; include the complete build inputs in the sdist. Pin Rust 1.95.0, matching gateway, and preserve locked dependencies.丁丁丁㐀review regression.evaluation/performance/lexical/, with production evidence, all timing samples and validation summaries.Are there any user-facing changes?
The default runtime now executes Rust. Compatible binary wheels need no compiler. Source/editable installation requires Rust 1.95.0 and a platform C toolchain; Windows uses MSVC. There is no runtime opt-in or Python fallback.
Python support is explicitly 3.11–3.14 (
>=3.11,<3.15), tightened from<4.0: the native module implements the corresponding Unicode 14/15/15.1/16 semantics. Future versions need tables and validation before this bound can expand. Installation documentation is updated in both languages. Public callable signatures, span/query behavior, projection identity and storage schema are preserved.How was this change tested?
Validation of the corrected production binary on 2026-11-21:
python -I.-D warnings, and 4 Rust tests passed; 4 tests passed on WSL/Linux. Lock consistency, changed-file Ruff/type checks, content hooks and 315 pinned action references passed.Production-default warm analyzer timings, including the native bridge, nine alternating rounds, Intel Core Ultra 5 225H / Windows x64 / CPython 3.14.3:
Limitations: actual GitHub manylinux/macOS wheel jobs and Docker execution remain unverified locally. CPython 3.12/3.13 SQLite smoke is blocked by a Windows stdlib asyncio socketpair stall reproduced without PowerContext. Whole-repository
tyretains 93 existing Windows/platform diagnostics; fullmake check, full pytest/tox, real OceanBase/seekDB/host acceptance and whole-server speedup are not claimed. CPU clock/affinity/background activity were uncontrolled; full samples are retained. New-Head CI results are tracked separately from local results.AI usage statement
Implemented and validated with OpenAI Codex (GPT-6), including an independent agent review. rust-anything assisted the initial port; final production packaging, compatibility and delivery were verified against the repository's normal installation and search paths.