Skip to content

Remove AI translation pipeline from core (move to phoenix_kit_ai) - #586

Merged
ddon merged 7 commits into
BeamLabEU:mainfrom
mdon:main
Jun 8, 2026
Merged

Remove AI translation pipeline from core (move to phoenix_kit_ai)#586
ddon merged 7 commits into
BeamLabEU:mainfrom
mdon:main

Conversation

@mdon

@mdonmdon commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

What

Moves all AI-translation logic out of core and into the phoenix_kit_ai plugin. Core keeps only the migration (the phoenix_kit_ai_endpoints / _prompts tables live in core's single versioned chain). This supersedes the earlier in-core fetch/3 scope commits on this branch — that work now lands in the plugin.

Removed from core

  • PhoenixKit.Modules.AI + .Translatable / .Translations / .TranslateWorker / .Translation (the pipeline)
  • PhoenixKit.Module.ai_translatables/0 callback + ModuleRegistry.all_ai_translatables/0 / find_ai_translatable/1 (discovery re-homes to PhoenixKitAI.Translatables, a duck-typed scan over ModuleRegistry.all_modules/0)
  • PhoenixKitWeb.Components.AITranslate{,.Embed,.FormBinding,.FormGlue} (the AI-translate modal UI)
  • the corresponding test/phoenix_kit/modules/ai/* tests (relocated to the plugin)

Kept in core

  • the AI tables' migrations (core owns the versioned migration chain)
  • language_switcher's generic ai_translate attr — a parameterized affordance with no AI dependency

Why

AI is a self-contained, optional capability; its code belongs in the AI plugin, not scattered through core. Feature modules (publishing/catalogue/projects) now depend on phoenix_kit_ai and implement PhoenixKitAI.Translatable.

Coordinated release

Part of a set (one PR per repo): core (this)phoenix_kit_ai (adds the pipeline + UI) → publishing / catalogue / projects (rewire to PhoenixKitAI.*). No @version bump here — release is the maintainer's call. Consumers float to this release via ~> minimums (no precise pins).


Also in this PR (latest push): a docs-only "Local cross-repo development" section in AGENTS.md documenting the <APP>_PATH override workflow that feature modules use to build/test against a local core checkout.


Also in this branch:dev_docs/pull_requests/2026/585-host-wiring-embed-v131/FOLLOW_UP.md — the Phase-1 after-action for the (already-merged) PR #585, documenting that all review follow-ups were resolved (media_detail aligned → extracted to CommentsForwarding; double-fire note corrected to shadowing; CHANGELOG in 1.7.132). Docs-only.

mdon added 2 commits June 8, 2026 01:11
Versioned/partitioned resources couldn't tell the generic pipeline WHICH slice
to translate — fetch/2 only receives (type, uuid), so an adapter re-resolved a
default (e.g. publishing always translated a post's active version, even when
the editor was on a draft).
- Translatable: add optional `fetch/3 (type, uuid, scope)`; `fetch/2` stays
required. Adapters that don't export fetch/3 are unaffected.
- Translations.enqueue/enqueue_all_missing: accept an optional, JSON-safe
`resource_scope`; normalize it (string | nil) and include it in the in-flight
dedup key so (uuid, scope=1, lang) and (uuid, scope=2, lang) are distinct
jobs. A nil/absent scope dedups with legacy unscoped jobs.
- TranslateWorker: thread resource_scope from args; dispatch fetch/3 when the
adapter exports it (guarded with Code.ensure_loaded?/1), else fetch/2; add
resource_scope to lifecycle broadcast payloads so subscribers can filter by
slice.
Backward-compatible: catalogue/projects keep only fetch/2 and are unaffected;
jobs enqueued before scoping still parse and run.
Include resource_scope in the ai.translation_added activity metadata when
present, so audit entries for versioned/partitioned resources distinguish e.g.
v1 vs v2 translation work. Unversioned resources (nil scope) are unchanged.
Follow-up to the fetch/3 scope change.
mdon added 2 commits June 8, 2026 05:56
All AI logic now lives in the phoenix_kit_ai plugin; core keeps only the AI
tables' migrations (the single versioned chain). This supersedes the in-core
fetch/3 scope work earlier on this branch — that lands in the plugin instead.
Removed:
- PhoenixKit.Modules.AI{,.Translatable,.Translations,.TranslateWorker,.Translation}
- PhoenixKit.Module ai_translatables/0 callback + ModuleRegistry
all_ai_translatables/0 + find_ai_translatable/1 (discovery re-homes to
PhoenixKitAI.Translatables, a duck-typed scan over ModuleRegistry.all_modules)
- PhoenixKitWeb.Components.AITranslate{,.Embed,.FormBinding,.FormGlue}
Kept: the phoenix_kit_ai_endpoints / _prompts table migrations; the generic
language_switcher's parameterized `ai_translate` attr (no AI dependency).
No @Version bump — release is the maintainer's call.
It was the only module-specific helper in core's generic Routes util — a layering inversion. The AI plugin now owns it as PhoenixKitAI.Routes.ai_path/0, wrapping the generic Routes.path/1. Completes the AI move: core's Routes is module-agnostic again.
mdon added 3 commits June 8, 2026 07:02
Explain how feature modules build/test against a local core checkout via
the <APP>_PATH env override (pk_dep/3 in each module), and how
phoenix_kit_parent exercises the whole tree against local core.
@mdon

mdon commented Jun 8, 2026

Copy link
Copy Markdown
ContributorAuthor

Latest push: docs-only cleanup for the AI move. Updated README/dialyzer notes so live docs no longer point at the removed core AI translation namespace.

@ddon
ddon merged commit 1bb8649 into BeamLabEU:mainJun 8, 2026
ddon pushed a commit that referenced this pull request Jun 8, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ddon pushed a commit that referenced this pull request Jun 8, 2026
Documents the breaking removal of the in-core AI translation pipeline
(moved to phoenix_kit_ai in PR #586) under a CHANGELOG ### Removed entry.
The published 1.7.132 still ships the old in-core pipeline, so this is a
new release rather than a republish.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@mdon@ddon