Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .changes/maintainability-contracts.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
内置 Job 的输入与发布目录共用同一合同;Source 可以显式保留稳定类型身份,扩展资源收尾与进程排空顺序集中维护。
1 change: 1 addition & 0 deletions .changes/maintainability.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
在修改 Python 环境前拒绝替换仍启用的扩展,并在取消操作时保留安装所需资源直到收尾完成。模块加载或启动失败后仍保留已加载版本,避免在同一进程中误用另一版本。
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ repos:
pass_filenames: false
- id: typecheck
name: Check Pyrefly types
entry: pyrefly check --min-severity=warn --output-format=min-text --progress-bar=no
entry: pdm run typecheck
language: system
files: ^(app/|extensions/|libs/|migrations/|scripts/|tests/|utils/|run\.py$|pyproject\.toml$|pdm\.lock$)
pass_filenames: false
- id: check-lock
name: Check PDM lock
entry: python scripts/check_lock.py
entry: pdm run check:lock
language: system
files: ^(pyproject\.toml|pdm\.lock)$
pass_filenames: false
- id: lint-migrations
name: Lint migration contract
entry: ruff check --no-cache migrations/env.py migrations/metadata.py migrations/settings.py scripts/_tooling.py scripts/doctor.py scripts/check_lock.py scripts/check_migration_history.py scripts/database_manifest.py scripts/sanitize_preview_base.py tests/migrations
entry: pdm run lint:migrations
language: system
files: ^(alembic\.ini|migrations/|scripts/|tests/migrations/)
pass_filenames: false
- id: test-migrations
name: Test migration contract
entry: python -m pytest -q tests/migrations
entry: pdm run test:migrations
language: system
files: ^(alembic\.ini|migrations/|tests/migrations/)
pass_filenames: false
3 changes: 3 additions & 0 deletions app/business/extension/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
- `ExtensionBase` 保持配置校验、`on_start_async`、`on_close` 与 active-effect publication。Route、Peer inbound
和 public claim 可逆;已 import 的 Source/Resolver/Sink class registration 在当前进程内单调保留。
- Extension wheel 直接 import Core 模块;Host 只接受标准 `inkcre.core.extensions` entry point。
- `ActiveExtensionEffects` 拥有已取得的 claim/class 效果及释放顺序;新增 active effect 只修改该所有者。
普通停止遇错立即退出;intent 冲突清理聚合 close/unpublish/unbind 错误;启动失败保留原错误并尽力
收尾。claim 释放错误不被吞掉。环境应用由 Host 在已持锁处关闭 Extension,bootstrap callback 只排空生产者。
- Registry Simple URL 必须与配置的 Registry 同源且路径精确匹配 Project。
- runtime 只能把普通 wheel 安装到当前 Core interpreter/site-packages;禁止 `pip --target`、
per-Extension overlay、`sys.path` 或 `extensions.__path__` 改写。
Expand Down
25 changes: 1 addition & 24 deletions app/business/extension/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from inkcre_extension_runtime_core_py.distribution import (
AcquiredDistribution,
PipDistributionConsumer as RuntimePipDistributionConsumer,
PipDistributionConsumer,
)
from inkcre_extension_runtime_core_py.modules import DistributionModules

Expand All @@ -30,29 +30,6 @@ def apply(
) -> AcquiredDistribution: ...


class PipDistributionConsumer:
def __init__(self, origin: str) -> None:
self._runtime = RuntimePipDistributionConsumer(origin)

def download(
self,
release: ExtensionReleaseDescriptor,
association: PythonReleaseDescriptor,
host_version: str,
wheel_dir: Path,
) -> Path:
return self._runtime.download(release, association, host_version, wheel_dir)

def apply(
self,
extension_wheel: Path,
release: ExtensionReleaseDescriptor,
association: PythonReleaseDescriptor,
host_version: str,
) -> AcquiredDistribution:
return self._runtime.apply(extension_wheel, release, association, host_version)


__all__ = [
"AcquiredDistribution",
"DistributionConsumer",
Expand Down
Loading
Loading