Skip to content

refactor: consolidate remaining framework batches - #103

Merged
ddtcorex merged 2 commits into
masterfrom
refactor/framework-consolidation-remaining-batches
Aug 4, 2026
Merged

refactor: consolidate remaining framework batches#103
ddtcorex merged 2 commits into
masterfrom
refactor/framework-consolidation-remaining-batches

Conversation

@ddtcorex

@ddtcorex ddtcorex commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

This PR completes the framework-consolidation refactor described in Closes #104. It establishes framework packages and the registry as the source of truth for framework-specific behavior, while retaining generic orchestration in engine, command, and desktop layers.

The refactor itself is one squashed commit to keep the review and eventual revert atomic, followed by a merge commit bringing in master's subsequent commits (see "Merged master" below) — that merge is not squashed, since it just catches the branch up rather than being part of the refactor's own diff.

Architecture

Ownership model

Layer Responsibility
internal/frameworks/<framework> Framework identity, aliases, defaults, capabilities, assets, lifecycle hooks, remote metadata, table-prefix rules, tool commands, and upgrades.
internal/frameworks Typed specs, registry construction, alias resolution, parent inheritance, validation, and shared abstractions.
internal/engine Framework-agnostic orchestration: rendering, SQL execution, migration dispatch, runtime policy, and configuration handling.
internal/cmd / internal/desktop Consume resolved framework definitions instead of owning framework-specific switches.

Family inheritance

  • OpenMage inherits Magento 1 behavior.
  • Mage-OS inherits Magento 2 behavior.

Parents hold shared family behavior. Children provide only their identity and genuine overrides, so future family changes do not need to be duplicated.

What changed

Registry and definitions

  • Consolidated canonical names, aliases, manifests, defaults, capabilities, discovery, and operational hooks in typed framework definitions.
  • Added validated parent inheritance and alias resolution to the registry.
  • Kept generated framework registration checked by CI.

Framework packages and assets

  • Moved framework-specific blueprints, Nginx templates, Varnish assets, profiles, metadata readers, upgrades, table-prefix logic, and bootstrap behavior into their owning packages.
  • Added embedded framework blueprint filesystems and a merged generic asset view for rendering and tests.
  • Moved shared Magento-family behavior to Magento 1 or Magento 2 parents, leaving OpenMage and Mage-OS as child deltas.

Generic orchestration

  • Replaced migrated framework conditionals with registry dispatch for bootstrap plans, deploy locale queries, Varnish defaults, runtime/chown policy, migrations, tool execution, and related command behavior.
  • Kept generic SQL execution and orchestration in engine/bootstrap rather than moving infrastructure concerns into frameworks.
  • Preserved compatibility helpers where needed for existing callers and tests.

Desktop and contributor experience

  • Desktop onboarding now receives framework names, labels, and aliases from the backend registry.
  • Updated English and Vietnamese framework-authoring documentation.
  • Added regression tests for registry inheritance, aliases, framework operations, blueprints, command dispatch, remote credential projection, desktop wiring, and source overrides.

CI follow-up fixes

  • Restored the entrypoint chown helper/import needed by the GitHub merge ref with master.
  • Removed an unused DB-credential helper caught by golangci-lint.
  • Kept required Magento 1/OpenMage legacy MD5:salt password compatibility in the bootstrap SQL path without performing weak password hashing in Go, resolving the CodeQL finding while preserving legacy behavior.
  • Fixed a staticcheck S1016 finding in the blueprints union-FS (mountDirEntry.Info struct-literal conversion).

Post-review fixes (folded into this squash)

  • Removed a dead compatibility fallback in Magento 2's PostClone (CmdHelpers.RunFrameworkAdminCreate/RunFrameworkReindex) that no production caller ever populated and carried a latent nil-pointer-panic path if ever reached; rewrote its tests to cover the real RunAdminCreate/RunReindex path instead.
  • Fixed several stale docs surfaced during review: adding-a-framework.md/architecture.md (+ Vietnamese mirrors) now document the Spec()/Parent/FrameworkPatch/Override[T] inheritance mechanism and drop a stale hardcoded framework count; table_prefix documentation now covers Mage-OS and PrestaShop, not just the Magento family; getting-started.md's detected-frameworks table now lists Mage-OS, PrestaShop, and Django; README.md's upgrade-pipeline list now includes Magento 1; CLAUDE.md's repository map no longer carries rotting hardcoded file counts and now notes that internal/frameworks/<name>/blueprint/** also busts the BlueprintVersion content hash.

Merged master

master gained 5 commits after this branch diverged, including two (b6f9f7b, 94ad6b7) that changed the exact same internal/engine/config.go/render.go/base.yml chown-directory logic this refactor also touches (moving the Magento-family default chown paths into a framework-owned registry). Merged master into this branch rather than rebasing, so the merge commit itself is reviewable. Verified by hand that the 3-way merge combined both sides correctly, not just that it was textually conflict-free:

  • GetDefaultChownDirList/GetEntrypointChownDirList in internal/engine/config.go — the framework-owned-registry lookup this branch introduced and master's bind-mount-exclusion filter both survived, composed correctly.
  • RenderData.EntrypointChownDirList is wired into render.go and all 4 CHOWN_DIR_LIST occurrences in base.yml reference it (not the unfiltered Config.Stack.ChownDirList) — confirms the entrypoint no longer chowns the bind-mounted project directory on every container start.
  • docker/php/etc/entrypoint.sh's chown guard and internal/engine/docker.go's IsVolumeEmpty fix both came through unchanged.
  • Golden snapshots (tests/testdata/framework_snapshots/{magento2,mageos}/compose.yml) and the new TestEntrypointChownDirListExcludesBindMounts test confirm the merged behavior end to end.

Full make test (lint, fmt-check, vet, unit, frontend, integration with Docker) passed locally against the merge commit.

Compatibility and risk

  • No config-file format migration is required.
  • Existing framework IDs and aliases remain supported through registry resolution.
  • No new framework is introduced and no product behavior is intentionally changed.
  • The primary regression risks are framework asset lookup and Magento-family lifecycle behavior; both are covered by focused tests and the CI integration suite.

Review guide

  1. Review internal/frameworks/types, internal/frameworks/registry.go, and generated registration for the ownership contract and inheritance semantics.
  2. Review a parent/child pair such as Magento 1/OpenMage or Magento 2/Mage-OS to confirm shared behavior resides in the parent and child overrides are minimal.
  3. Review internal/blueprints and individual embed.go files for the merged framework asset path.
  4. Review the generic engine and command call sites to confirm they dispatch through resolved definitions.
  5. Review the focused tests and framework-authoring documentation for the intended extension path.

Validation

Passed locally:

make lint
make fmt-check generate-check
make test-unit test-frontend

Passed locally against the current commit (go build ./..., go vet ./..., gofmt -s -l ., go test ./..., go generate ./internal/frameworks/... with no drift, plus a full make test run with Docker available), including after the post-review fixes and the master merge above. GitHub Actions is re-running against this commit:

  • Fast Tests (Frontend + Unit)
  • Quality Checks: go vet, golangci-lint, gofmt, generated registration
  • Integration Tests
  • Build Binaries
  • CodeQL and Code Scanning for Go and Actions

Linked issue

Closes #104

@ddtcorex
ddtcorex force-pushed the refactor/framework-consolidation-remaining-batches branch from c148aee to 93ebb93 Compare August 4, 2026 03:01
@ddtcorex ddtcorex changed the title fefactor: framework consolidation remaining batches refactor: consolidate remaining framework batches Aug 4, 2026
@ddtcorex ddtcorex added this to Govard Aug 4, 2026
@github-project-automation github-project-automation Bot moved this to 🆕 New in Govard Aug 4, 2026
@ddtcorex ddtcorex moved this from 🆕 New to 🏗 In progress in Govard Aug 4, 2026
@ddtcorex
ddtcorex force-pushed the refactor/framework-consolidation-remaining-batches branch 2 times, most recently from c6c7dc5 to 0be0444 Compare August 4, 2026 07:49
Comment thread internal/frameworks/magento1/legacy.go Fixed
@ddtcorex
ddtcorex force-pushed the refactor/framework-consolidation-remaining-batches branch 7 times, most recently from 29d909b to f7dfeb1 Compare August 4, 2026 08:26
Establishes framework packages and the registry as the source of
truth for framework-specific behavior, while generic orchestration
stays in engine, command, and desktop layers.

Ownership model:
- internal/frameworks/<framework>: identity, aliases, defaults,
  capabilities, assets, lifecycle hooks, remote metadata,
  table-prefix rules, tool commands, and upgrades.
- internal/frameworks: typed specs, registry construction, alias
  resolution, parent inheritance, validation, shared abstractions.
- internal/engine: framework-agnostic orchestration (rendering, SQL
  execution, migration dispatch, runtime policy, configuration).
- internal/cmd / internal/desktop: consume resolved framework
  definitions instead of owning framework-specific switches.

Family inheritance: OpenMage inherits Magento 1 behavior, Mage-OS
inherits Magento 2 behavior. Parents hold shared family behavior;
children provide only their identity and genuine overrides via
FrameworkSpec/FrameworkPatch, so future family changes don't need
duplicating across forks.

Registry and definitions:
- Consolidated canonical names, aliases, manifests, defaults,
  capabilities, discovery, and operational hooks into typed
  framework definitions.
- Added validated parent inheritance and alias resolution to the
  registry (RegisterSpecs, cycle/unknown-parent detection).
- Kept generated framework registration checked by CI.

Framework packages and assets:
- Moved framework-specific blueprints, nginx templates, Varnish
  assets, profiles, metadata readers, upgrades, table-prefix logic,
  and bootstrap behavior into their owning packages.
- Added embedded framework blueprint filesystems and a merged
  generic asset view for rendering and tests.
- Moved shared Magento-family behavior to the Magento 1/Magento 2
  parents, leaving OpenMage and Mage-OS as child deltas.

Generic orchestration:
- Replaced framework conditionals with registry dispatch for
  bootstrap plans, deploy locale queries, Varnish defaults,
  runtime/chown policy, migrations, tool execution, and related
  command behavior.
- Kept generic SQL execution/orchestration in engine/bootstrap
  rather than moving infrastructure concerns into frameworks.

Desktop and contributor experience:
- Desktop onboarding now receives framework names, labels, and
  aliases from the backend registry (ListFrameworks bridge).
- Updated English and Vietnamese framework-authoring documentation
  to cover the Spec()/Parent/FrameworkPatch/Override[T] inheritance
  mechanism, which the initial docs pass omitted; fixed several
  other stale docs surfaced along the way (table_prefix scope,
  detected-frameworks table, README's upgrade-pipeline list,
  CLAUDE.md's rotting file counts and blueprint-location note).
- Added regression tests for registry inheritance, aliases,
  framework operations, blueprints, command dispatch, remote
  credential projection, desktop wiring, and source overrides.

Cleanup:
- Removed a dead compatibility fallback in Magento 2's PostClone
  (CmdHelpers.RunFrameworkAdminCreate/RunFrameworkReindex) that no
  production caller ever populated and carried a latent nil-pointer
  panic path if ever reached; rewrote its tests to cover the real
  RunAdminCreate/RunReindex path instead.
- Fixed a staticcheck S1016 finding in the blueprints union-FS.

No config-file format migration is required. Existing framework IDs
and aliases remain supported through registry resolution. No new
product-facing behavior is intentionally changed.

Closes #104
@ddtcorex
ddtcorex force-pushed the refactor/framework-consolidation-remaining-batches branch from f7dfeb1 to 18a6028 Compare August 4, 2026 17:49
@ddtcorex
ddtcorex merged commit a6cce7a into master Aug 4, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from 🏗 In progress to ✅ Done in Govard Aug 4, 2026
@ddtcorex
ddtcorex deleted the refactor/framework-consolidation-remaining-batches branch August 4, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Refactor framework consolidation remaining batches

2 participants