Skip to content

fix(artifacts): import artifact plugins with the core package only - #2577

Open
ctxloop wants to merge 3 commits into
oceanbase:masterfrom
ctxloop:fix/core-artifact-plugins-import
Open

ctxloop wants to merge 3 commits into
oceanbase:masterfrom
ctxloop:fix/core-artifact-plugins-import

Conversation

@ctxloop

@ctxloop ctxloop commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Refs #2085 (N3). This PR does not close the umbrella issue.

Rationale for this change

powercontext.artifact_plugins is a core public export. A core-only installation (pip install powercontext without extras) cannot import it. from powercontext import * also fails:

artifact_plugins.py:27 -> artifacts/indexes.py:23 -> builtin/artifacts/memory/__init__.py:41
  -> jev_reranking.py:25 -> ModuleNotFoundError: No module named 'httpx2'

The core module artifacts/indexes.py imports EmbeddingProfile from the builtin Memory package. That import loads the full Memory package and its optional HTTP dependencies.

The installation role CI did not find this problem. The role smoke check imported artifact_plugins only when extras were installed.

What changes are included in this PR?

  • Move EmbeddingProfile into the core module powercontext.artifacts.indexes. The builtin Memory models import it from there. Existing import paths stay valid, and the class is the same object. The docstring stays the same, because Pydantic writes it into the generated schema, and the plugin manager compares persisted content schemas verbatim.
  • The role smoke check imports artifact_plugins for every role, including core.

Are there any user-facing changes?

Yes. A core-only installation can import powercontext.artifact_plugins and run from powercontext import *. No public import path is removed. The model fields, the serialized format, and the generated JSON schema do not change. Plugins registered by the previous release reload without a schema conflict.

How was this change tested?

  • Reproduced the failure in a clean Python 3.11 venv with the wheel and no extras.
  • scripts/ci_role_smoke.py core fails with the old wheel and passes with the new wheel.
  • scripts/ci_installation_roles.py passes for all five roles: core, builtin, cli, builtin,cli, server,cli.
  • New regression test test_reload_accepts_embedding_profile_schema_persisted_by_existing_registration: it writes the schema that the previous release persisted, then reloads the plugin through the Server. If the docstring changes, the reload returns 409 and the test fails.
  • The JSON schemas of all 584 Pydantic models in powercontext are identical on 63f021d6 and on this branch.
  • make check
  • uv run pytest -n 8 on the 68 test files that use EmbeddingProfile, VectorIndex, or artifact_plugins: 1399 passed, 293 skipped.
  • make docs-test

AI usage statement

I used Claude Code (Claude Opus 5.5) to write this change. I chose the approach after I read the analysis of the import chain. I examined the tests.

- Move EmbeddingProfile into powercontext.artifacts.indexes; builtin
  Memory models import it from there, so existing import paths still work.
- Import artifact_plugins in the core installation role smoke check.

Refs oceanbase#2085 (N3)

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One upgrade compatibility regression remains in the moved model; details inline.

Comment thread src/powercontext/artifacts/indexes.py Resolved
…ating it

Moving EmbeddingProfile into powercontext.artifacts.indexes dropped "Memory" from its
docstring. Pydantic emits that docstring as $defs.EmbeddingProfile.description, so an
unchanged plugin with an EmbeddingProfile field generated a different content schema and
reloading a registration persisted by the previous release failed with a 409
artifact_schema conflict. Restore the original docstring and cover reloading such a
registration through the Server.
@ctxloop
ctxloop requested a review from hidb4ai November 10, 2026 15:32

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The persisted-schema regression is fixed: the previously registered plugin reloads successfully on this head. The new regression test still blocks the required type check; details inline.

Comment thread tests/e2e/test_artifact_vector_http.py Resolved
…ng them

- Read the family schema and binding spec with scalar_one(), so ty no longer
  reports a possibly-None subscript and a missing row fails the test directly.

Refs oceanbase#2085 (N3)
@ctxloop
ctxloop requested a review from hidb4ai November 11, 2026 01:33

@hireview001 hireview001 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • CI failed: CI result (failure).
  • CI failed: harness-validation / Acceptance (sqlite) (failure).
  • CI failed: dsh-package (failure).
  • CI failed: Main (failure). Failed steps: dsh-package / Test built plugin in the real DSH runtime; harness-validation / Acceptance (sqlite) / Run deterministic scenarios; harness-validation / Acceptance (sqlite) / Require all selected acceptance work and evidence.

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both previous findings are addressed. Rechecked type validation and reloading the pre-upgrade SQLite registration on this head; the persisted schema and existing import paths are preserved. No new database tables or public interfaces. The remaining DSH setup and harness CI failures still block merging; the harness evidence shows an ACP dependency import failure (text_block).

@AlexStocks AlexStocks added the 1.6.0 v1.6.0 release tracking label Nov 12, 2026
SearchMode = Literal["text", "vector", "hybrid"]


class EmbeddingProfile(BaseModel):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Preserve the profile's historical schema identity

For plugin content containing both the builtin profile and a distinct model named EmbeddingProfile, this move changes Pydantic's module-qualified $defs keys and $ref values, as reproduced against the base definition. Consequently, ArtifactPluginManager._validate_identity rejects the unchanged plugin on reload with an artifact_schema conflict; preserve the historical schema identity and add regression coverage for colliding model names.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.6.0 v1.6.0 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants