MemberJunction / MemberJunction/MJ

Lite-manifest CLI consumers never load dynamicPackages.server — same class-registration gap as #3415

Open
#3,431 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TSQL
Stars
29
Forks
6
Avg merge
2d 1h
Merged PRs (30d)
323

Description

#3415 established the pattern: any process that bootstraps entity classes via the `server-bootstrap-lite` manifest registers only `@memberjunction/*` (`MJ: *`) subclasses. If that process then instantiates entity objects for non-`MJ:` namespaces (BizApps, BCSaaS, any Open App schema), ClassFactory falls back to bare `BaseEntity`: typed field getters are missing, and anything reading `record[fieldName]` gets `undefined`.

#3430 fixes the worst symptom (metadata-sync's silent pull corruption) by loading `dynamicPackages.server` from `mj.config.cjs` during provider init. The same gap exists in every other lite-manifest consumer — none of them load dynamic packages today; only the full `ServerBootstrap` does (`loadDynamicAppPackages`):

- **MJCLI** (beyond the sync commands)
- **CodeGenLib** (`runCodeGen.ts`)
- **MJCodeGenAPI**
- **MCPServer**
- **A2AServer**

## Ask

Audit each for code paths that instantiate non-`MJ:` entity objects (`GetEntityObject`, `RunView` with `ResultType: 'entity_object'`, property-style field reads). Where exposed, add the same loader — #3430's `loadDynamicServerPackages` in MetadataSync is the reference (mirrors ServerBootstrap's robustness contract: no-op when absent, per-package try/catch, `ERR_MODULE_NOT_FOUND` tolerated, warn-and-continue otherwise). Consider hoisting the loader into a shared home (e.g. alongside the lite manifest) rather than five copies.

Severity gradient: consumers that only *read and display* suffer wrong/empty values; consumers that *write or key on* field values can corrupt data the way #3415 did. Audit the writers first.

Refs: #3415 (root-cause analysis with receipts), #3430 (metadata-sync fix).

Contributor guide

Open the contributing guide

Research direction

Start with #3430's loadDynamicServerPackages and the full ServerBootstrap loader, then inspect the lite-manifest consumers: MJCLI, runCodeGen.ts, MJCodeGenAPI, MCPServer, and A2AServer. Audit writer paths first and confirm that exposed non-MJ entity-object paths load dynamicPackages.server with the stated error handling, without changing consumers that do not need it.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend, cli, tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.