← Back to Baseline

MB-0034

Automated Generated DI PHP artifacts are present

MB-C05 Production Mode & Deployment Hygiene Low

At least one readable PHP artifact exists in each configured generated/metadata and generated/code directory. This assesses artifact presence, not DI compilation correctness or freshness.

Overview

At least one readable PHP artifact exists in each configured generated/metadata and generated/code directory. This assesses artifact presence, not DI compilation correctness or freshness.

Why it Matters

Missing generated DI output can make a production release fail when Magento needs generated classes or metadata. Build artifacts should be present in the release actually served to users.

A few existing artifacts do not establish that every class is compiled correctly or belongs to the current source revision.

Verification Steps

Manual Verification

  1. Inspect generated/code and generated/metadata in the deployed release.
  2. Confirm representative generated PHP files are readable and nonempty; compare their release provenance with the build record.
  3. Artifact presence alone does not prove freshness or successful execution.

Command / Review Sample

find generated/code generated/metadata -type f -name '*.php' -size +0c -print

Use the assessed Magento project and the appropriate application or read-only review account. Replace example hosts, paths and identifiers with the assessment scope; configuration and source fragments are illustrative.

Remediation / Fix Guidance

  1. Investigate and change: Investigate the release build for missing generated dependency-injection artifacts. Run php bin/magento setup:di:compile in the build/staging stage with the correct module set and PHP version, then deploy the resulting release atomically.
  2. Validate the change: Confirm compilation succeeds and affected services load in production mode; do not compile as the web user or erase live generated files while traffic is using them.
  3. Rerun MB-0034 against the same release, profile and relevant file/key/package scope; compare the new evidence and inspect any independent collection gaps.

Examples

Illustrative examples only. Interpret them within the current revision criterion above; missing collection evidence is unresolved, never PASS.

Fail Example

Only empty generated directories exist in the served release.

Pass Example

Readable nonempty generated DI PHP artifacts are present in the assessed release.

Scope and Evidence Limits

Rule revision: 3. Target modes: LOCAL.

At least one readable PHP artifact exists in each configured generated/metadata and generated/code directory. This assesses artifact presence, not DI compilation correctness or freshness.

This check covers only the collected observation. Missing collection scope, external controls and runtime behavior require separate evidence.

Catalog coverage describes implementation capability, not a scan outcome. An incomplete manual review cannot establish that the criterion is satisfied.

References