Skip to content

feat(modules): auto-register tenant-specific plugin modules on import - #15

Merged
jochem25 merged 1 commit into
mainfrom
feat/tenant-plugin-auto-register
Apr 22, 2026
Merged

feat(modules): auto-register tenant-specific plugin modules on import#15
jochem25 merged 1 commit into
mainfrom
feat/tenant-plugin-auto-register

Conversation

@jochem25

Copy link
Copy Markdown
Collaborator

Summary

Voegt een idempotente auto-registratie hook toe voor tenant-specifieke Python modules bij package import. Lost het probleem op waar Symitech custom blocks faalden na de tenant-purge.

Achtergrond

Tijdens de tenant-purge van 15 april (commit a2edfe2) werd src/openaec_reports/modules/symitech/ toegevoegd aan .gitignore om tenant-specifieke modules privé te houden. Echter:

  1. Er was geen auto-register mechanisme voor tenant plugins
  2. Bestaande productie containers werkten via hand-patches die ontstonden vóór de purge
  3. Bij container rebuilds verdwenen die patches → Symitech custom-blocks (cost_summary/bic_table) faalden met "Onbekend content block type"

Deze wijziging

  • Veilige registratie: try/except hook die tenant plugins registreert als aanwezig, stilzwijgend skip als niet
  • Publieke builds blijven werken: geen ImportError bij ontbrekende tenant modules
  • Geen breaking changes: bestaande deployments blijven functioneren
  • Extensible pattern: nieuwe tenant plugins eenvoudig toe te voegen

Plugin architectuur

# In openaec_reports.modules.symitech (privé):
def register_symitech_modules():
    registry.register_module("cost_summary", CostSummaryModule)
    registry.register_module("bic_table", BicTableModule)
    # etc.

# Auto-hook roept deze functie aan bij package import

Verwacht vervolgwerk

In andere repos/PR's:

  • Symitech Python modules naar openaec-tenants private repo (of dedicated private repo)
  • Dockerfile hooks voor tenant plugin bundling tijdens build
  • ADR documentatie: 2-engine strategie (TemplateEngine YAML-driven + Report Python-based)

Test plan

  • Public build: package import werkt zonder errors, geen tenant blocks beschikbaar
  • Private build: tenant modules worden automatisch geregistreerd bij import
  • Bestaande reports blijven functioneren
  • Symitech cost_summary/bic_table blocks werken na container rebuild

Gerelateerde commits

  • Tenant-purge: a2edfe2 security(tenants): purge tenant-data from public repo

🤖 Generated with Claude Code

Adds an idempotent try/except hook to automatically register tenant-specific
Python modules when the package imports. This resolves the issue where
Symitech custom blocks (cost_summary/bic_table) failed with "Onbekend content
block type" after the tenant-purge commit a2edfe2 removed hand-patches.

The hook safely registers tenant plugins (like symitech modules) if present
in the image build, and silently skips them in public open-source builds.
No breaking changes for existing deployments.

Expected follow-up work in separate repos:
- Symitech Python modules move to openaec-tenants (or dedicated private repo)
- Dockerfile hooks for tenant plugin bundling during build
- ADR documentation for 2-engine strategy (YAML templates + Python plugins)

Related to tenant-purge: a2edfe2

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jochem25
jochem25 merged commit cbcd60a into main Apr 22, 2026
1 of 2 checks passed
@jochem25
jochem25 deleted the feat/tenant-plugin-auto-register branch April 22, 2026 14:41
Sign up for free to 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.

1 participant