feat(core)!: introduce the v0.8 rendering architecture#129
Draft
BalconyJH wants to merge 92 commits into
Draft
Conversation
Introduce weighted LRU with per-key singleflight and a byte-budget accountant backing the resource cache. Add logical package/filesystem source addressing so package resources stay path-agnostic. Wire the MEMORY remote-local resource policy.
Rebuild the filehost cache layer on the shared weighted cache and tighten warmup handling.
Add token-aware HTML/CSS reference discovery, document-local filesystem materialization, and binary template-variable staging into backend-neutral prepared assets. Drop the cwd file:// base_url from the deprecated template_to_pic path.
Rebuild the telemetry backends and stop auto-requiring optional prometheus/sentry plugins at import time. Export PreparedStylesheet and refresh plugin metadata.
Grow the Takumi runtime and resource source handling, add validation for values crossing the Python-to-Rust boundary, and refine the native render operations and error surface.
Overhaul the Playwright operations and prepared-asset handling to consume the in-memory materialized assets, with corresponding model and render adjustments.
Update release/publish workflows and auto-tag, add a distribution verification script, and refresh the remote-test infra and smoke test.
… API Emit text CSS via the safe filter and track the prepared-asset API rename (render_prepared_html, prepared.html) in the render tests.
Add the v0.7.2 migration guide and update user/maintainer docs across config, architecture, quality, and rendering guidance.
Baseline for 0.8 architecture work: extract path guard, tighten cache concurrency, translate takumi native errors, isolate telemetry exporter failures.
AST-based layer rules with a shrink-only legacy-edge allowlist, plus characterization of Prometheus/Sentry metric names, labels and tags so the 0.8 rework cannot silently break dashboards.
New rendering/ boundary (neutral requests, typed artifacts, stable error model, executor/observer/lifecycle/capability ports) and application/ layer (use cases, RendererBindings-derived capabilities, idempotent Application lifecycle). preparation/service.py exposes the injectable HtmlPreparer seam; prepare_template gains extensions passthrough. No existing call chain is switched yet.
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.
背景
0.7 的渲染入口、backend session、资源解析和可选引擎逐渐形成了跨层耦合:调用方需要理解具体 backend,生命周期与 admission 缺少统一所有者,本地资源传输依赖部署拓扑,新增引擎还会扩大兼容壳和伪公共契约。
本 PR 汇总 v0.8 的破坏性架构升级,把 HTML 渲染、原生文档渲染与栅格场景统一到 Provider/Capability 模型,并把资源、生命周期、可观测性和发布门禁收回各自明确的边界。
方案
公共契约与运行时
Application、composition-owned runtime plan、admission 与 typed lease 统一启动、执行、排空和关闭;nonebot-plugin-localstore作为所有引擎共享的插件基础设施,而不是单一 Provider 的实现细节。Provider、图形与资源
RasterScenegraphics capability;memory与受请求头保护的 filehost transport;工程质量、文档与发布
commit-msg与 manual stage 的本地和 CI 门禁。行为、兼容性与风险
Important
release/v0.8.0当前相对master落后 8 个、领先 92 个提交。主线独有内容属于 v0.7.2 发布线,其运行时修复已在 v0.8 新架构中等价吸收,但 Git 拓扑尚未同步。转为 Ready 前需要完成一次审计式主线合并并解决重写目录、workflow、迁移文档和版本文件的冲突;不应机械 cherry-pick 或重写这 92 个提交。验证
make ruff-format-check(通过make check)make ruff-check(通过make check)make typecheck:Basedpyright 零诊断,公共类型完备性 100%make tymake test-ci:622 passed、2 skipped,coverage 90%prek run --all-filesprek run actionlint --all-files --hook-stage=manualmake remote-smoke:远程 Chromium 的 memory/filehost transport 均通过make docs-build:Zensical strict build 无问题文档
合并前
type(scope): subject的 squash commit subjectmaster拓扑同步并重新运行受影响门禁